syn_sem/semantic/logic/
inner.rs1use super::{
2 construct,
3 find_method::{self, MethodFinder},
4 ImplLogic,
5};
6use crate::{semantic::entry::GlobalCx, TermIn, TriResult};
7
8#[derive(Debug)]
9pub struct Logic<'gcx> {
10 gcx: &'gcx GlobalCx<'gcx>,
11 pub impl_: ImplLogic<'gcx>,
12}
13
14impl<'gcx> Logic<'gcx> {
15 pub(crate) fn new(gcx: &'gcx GlobalCx<'gcx>) -> Self {
16 Self {
17 gcx,
18 impl_: ImplLogic::new(gcx),
19 }
20 }
21
22 pub(crate) fn load_file<H: construct::Host<'gcx>>(
23 &mut self,
24 host: &mut H,
25 file: &syn::File,
26 ) -> TriResult<(), ()> {
27 self.impl_.load_file(host, file)
28 }
29
30 pub(crate) fn load_item_impl<H: construct::Host<'gcx>>(
31 &mut self,
32 host: &mut H,
33 item_impl: &syn::ItemImpl,
34 ) -> TriResult<(), ()> {
35 self.impl_.load_item_impl(item_impl, host)
36 }
37
38 pub(crate) fn find_method_sig<H: find_method::Host<'gcx>>(
39 &mut self,
40 host: &mut H,
41 parent_path: &str,
42 fn_ident: &str,
43 args: &mut [TermIn<'gcx>],
44 ) -> TriResult<(), ()> {
45 MethodFinder::new(self.gcx, &mut self.impl_, host).find_method_sig(
46 parent_path,
47 fn_ident,
48 args,
49 )
50 }
51}