Skip to content

Commit

Permalink
set local scope
Browse files Browse the repository at this point in the history
Signed-off-by: shruti2522 <[email protected]>
  • Loading branch information
shruti2522 committed Aug 26, 2024
1 parent 8639042 commit 101043b
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion kclvm/sema/src/advanced_resolver/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,18 @@ impl<'ctx> MutSelfTypedResultWalker<'ctx> for AdvancedResolver<'ctx> {
let schema_symbol = self.ctx.schema_symbol_stack.last().unwrap_or(&None).clone();
let kind = LocalSymbolScopeKind::Config;

self.enter_local_scope(
&self.ctx.current_filename.as_ref().unwrap().clone(),
start.clone(),
end.clone(),
kind,
);

let cur_scope = *self.ctx.scopes.last().unwrap();
self.gs
.get_scopes_mut()
.set_owner_to_scope(cur_scope, schema_symbol.unwrap());

if let Some(schema_expr) = self
.gs
.get_symbols_mut()
Expand All @@ -886,9 +898,11 @@ impl<'ctx> MutSelfTypedResultWalker<'ctx> for AdvancedResolver<'ctx> {
expr_symbol.hint = Some(SymbolHint {
pos: start.clone(),
kind: SymbolHintKind::VarHint(schema_expr.name.to_string()),
})
});
}

self.leave_scope();

self.walk_config_entries(&config_expr.items)?;
Ok(None)
}
Expand Down

0 comments on commit 101043b

Please sign in to comment.