From 9fdbe9695d2091b54a8e6576b6aba8f1345976f0 Mon Sep 17 00:00:00 2001 From: David Mak Date: Fri, 4 Oct 2024 12:51:38 +0800 Subject: [PATCH] [core] Add generator to SymbolResolver::get_symbol_value Needed in a future commit. --- nac3artiq/src/symbol_resolver.rs | 1 + nac3core/src/codegen/expr.rs | 2 +- nac3core/src/codegen/test.rs | 1 + nac3core/src/symbol_resolver.rs | 1 + nac3core/src/toplevel/test.rs | 1 + nac3core/src/typecheck/type_inferencer/test.rs | 3 ++- nac3standalone/src/basic_symbol_resolver.rs | 3 ++- 7 files changed, 9 insertions(+), 3 deletions(-) diff --git a/nac3artiq/src/symbol_resolver.rs b/nac3artiq/src/symbol_resolver.rs index 313b75d8..59f06bfc 100644 --- a/nac3artiq/src/symbol_resolver.rs +++ b/nac3artiq/src/symbol_resolver.rs @@ -1470,6 +1470,7 @@ impl SymbolResolver for Resolver { &self, id: StrRef, _: &mut CodeGenContext<'ctx, '_>, + _: &mut dyn CodeGenerator, ) -> Option> { let sym_value = { let id_to_val = self.0.id_to_pyval.read(); diff --git a/nac3core/src/codegen/expr.rs b/nac3core/src/codegen/expr.rs index f9534fb1..52146145 100644 --- a/nac3core/src/codegen/expr.rs +++ b/nac3core/src/codegen/expr.rs @@ -2886,7 +2886,7 @@ pub fn gen_expr<'ctx, G: CodeGenerator>( Some((_, Some(static_value), _)) => ValueEnum::Static(static_value.clone()), None => { let resolver = ctx.resolver.clone(); - resolver.get_symbol_value(*id, ctx).unwrap() + resolver.get_symbol_value(*id, ctx, generator).unwrap() } }, ExprKind::List { elts, .. } => { diff --git a/nac3core/src/codegen/test.rs b/nac3core/src/codegen/test.rs index 59f62129..b2799b04 100644 --- a/nac3core/src/codegen/test.rs +++ b/nac3core/src/codegen/test.rs @@ -67,6 +67,7 @@ impl SymbolResolver for Resolver { &self, _: StrRef, _: &mut CodeGenContext<'ctx, '_>, + _: &mut dyn CodeGenerator, ) -> Option> { unimplemented!() } diff --git a/nac3core/src/symbol_resolver.rs b/nac3core/src/symbol_resolver.rs index ccd90a1c..bab823c1 100644 --- a/nac3core/src/symbol_resolver.rs +++ b/nac3core/src/symbol_resolver.rs @@ -369,6 +369,7 @@ pub trait SymbolResolver { &self, str: StrRef, ctx: &mut CodeGenContext<'ctx, '_>, + generator: &mut dyn CodeGenerator, ) -> Option>; fn get_default_param_value(&self, expr: &Expr) -> Option; diff --git a/nac3core/src/toplevel/test.rs b/nac3core/src/toplevel/test.rs index cda680c7..077f6ab9 100644 --- a/nac3core/src/toplevel/test.rs +++ b/nac3core/src/toplevel/test.rs @@ -65,6 +65,7 @@ impl SymbolResolver for Resolver { &self, _: StrRef, _: &mut CodeGenContext<'ctx, '_>, + _: &mut dyn CodeGenerator, ) -> Option> { unimplemented!() } diff --git a/nac3core/src/typecheck/type_inferencer/test.rs b/nac3core/src/typecheck/type_inferencer/test.rs index a3e307f4..e56cb283 100644 --- a/nac3core/src/typecheck/type_inferencer/test.rs +++ b/nac3core/src/typecheck/type_inferencer/test.rs @@ -9,7 +9,7 @@ use nac3parser::{ast::FileName, parser::parse_program}; use super::*; use crate::{ - codegen::CodeGenContext, + codegen::{CodeGenContext, CodeGenerator}, symbol_resolver::ValueEnum, toplevel::{helper::PrimDef, DefinitionId, TopLevelDef}, typecheck::{magic_methods::with_fields, typedef::*}, @@ -43,6 +43,7 @@ impl SymbolResolver for Resolver { &self, _: StrRef, _: &mut CodeGenContext<'ctx, '_>, + _: &mut dyn CodeGenerator, ) -> Option> { unimplemented!() } diff --git a/nac3standalone/src/basic_symbol_resolver.rs b/nac3standalone/src/basic_symbol_resolver.rs index 631ee737..4b220bca 100644 --- a/nac3standalone/src/basic_symbol_resolver.rs +++ b/nac3standalone/src/basic_symbol_resolver.rs @@ -6,7 +6,7 @@ use std::{ use parking_lot::{Mutex, RwLock}; use nac3core::{ - codegen::CodeGenContext, + codegen::{CodeGenContext, CodeGenerator}, nac3parser::ast::{self, StrRef}, symbol_resolver::{SymbolResolver, SymbolValue, ValueEnum}, toplevel::{DefinitionId, TopLevelDef}, @@ -61,6 +61,7 @@ impl SymbolResolver for Resolver { &self, _: StrRef, _: &mut CodeGenContext<'ctx, '_>, + _: &mut dyn CodeGenerator, ) -> Option> { unimplemented!() }