Skip to content

Commit 7d68695

Browse files
committed
Refactor resolver collection and binding APIs
1 parent 50d0255 commit 7d68695

18 files changed

Lines changed: 751 additions & 765 deletions

File tree

crates/llmcc-cli/src/runner.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use llmcc_core::{CompileCtxt, Error, ResolveOptions, Result, print_block_tree};
1212
use llmcc_core::{GraphBuildOptions, build_graphs};
1313
use llmcc_cpp::LangCpp;
1414
use llmcc_dot::{RenderOptions, render_graph_with_options};
15-
use llmcc_resolver::{bind_symbols_with, build_and_collect_symbols};
15+
use llmcc_resolver::{bind_symbols, build_and_collect};
1616
use llmcc_rust::LangRust;
1717
use llmcc_ts::LangTypeScript;
1818

@@ -72,15 +72,15 @@ impl Runner {
7272
.with_print_ir(self.options.print_ir)
7373
.with_sequential(false);
7474

75-
let globals = build_and_collect_symbols::<L>(&cc, &resolve_options)?;
75+
let globals = build_and_collect::<L>(&cc, &resolve_options)?;
7676

7777
info!(
7878
"IR build + Symbol collection: {:.2}s",
7979
build_start.elapsed().as_secs_f64()
8080
);
8181

8282
let bind_start = Instant::now();
83-
bind_symbols_with::<L>(&cc, globals, &resolve_options)?;
83+
bind_symbols::<L>(&cc, globals, &resolve_options)?;
8484
info!("Symbol binding: {:.2}s", bind_start.elapsed().as_secs_f64());
8585

8686
let graph_start = Instant::now();

crates/llmcc-core/src/symbol.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,18 @@ pub const SYM_KIND_CALLABLE: SymKindSet = SymKindSet::empty()
155155
.with(SymKind::Const);
156156

157157
impl SymKind {
158+
/// Kinds to try first when resolving a member name without one exact kind.
159+
pub const fn member_lookup_order() -> [Self; 6] {
160+
[
161+
Self::Method,
162+
Self::Function,
163+
Self::Field,
164+
Self::Variable,
165+
Self::Const,
166+
Self::Static,
167+
]
168+
}
169+
158170
#[inline]
159171
pub fn from_u8(value: u8) -> Self {
160172
Self::from_repr(value).unwrap_or_default()

0 commit comments

Comments
 (0)