From 422aa4ca9cee52ebe87346c12f5ebc6ab37e143f Mon Sep 17 00:00:00 2001 From: shruti2522 Date: Mon, 26 Aug 2024 12:26:08 +0530 Subject: [PATCH] set local scope Signed-off-by: shruti2522 --- kclvm/sema/src/advanced_resolver/node.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/kclvm/sema/src/advanced_resolver/node.rs b/kclvm/sema/src/advanced_resolver/node.rs index 916b5d9d4..82a59a721 100644 --- a/kclvm/sema/src/advanced_resolver/node.rs +++ b/kclvm/sema/src/advanced_resolver/node.rs @@ -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() @@ -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) }