From e5a09a6ee82f73a959c96bb6e2a5823a5a6c0146 Mon Sep 17 00:00:00 2001 From: greg Date: Thu, 19 Sep 2019 18:38:15 -0700 Subject: [PATCH] Get rid of Meta use in reduce_named_struct --- schala-lang/language/src/reduced_ast.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/schala-lang/language/src/reduced_ast.rs b/schala-lang/language/src/reduced_ast.rs index 91cbe39..d1a92cf 100644 --- a/schala-lang/language/src/reduced_ast.rs +++ b/schala-lang/language/src/reduced_ast.rs @@ -180,7 +180,7 @@ impl<'a> Reducer<'a> { TupleLiteral(exprs) => Expr::Tuple(exprs.iter().map(|e| self.expression(e)).collect()), IfExpression { discriminator, body } => self.reduce_if_expression(discriminator, body), Lambda { params, body, .. } => self.reduce_lambda(params, body), - NamedStruct { name, fields } => self.reduce_named_struct(expr.fqsn.as_ref(), name.node(), fields), + NamedStruct { name, fields } => self.reduce_named_struct(name.node(), fields), Index { .. } => Expr::UnimplementedSigilValue, WhileExpression { .. } => Expr::UnimplementedSigilValue, ForExpression { .. } => Expr::UnimplementedSigilValue, @@ -196,12 +196,13 @@ impl<'a> Reducer<'a> { }) } - fn reduce_named_struct(&mut self, fqsn: Option<&FullyQualifiedSymbolName>, _name: &QualifiedName, fields: &Vec<(Rc, Meta)>) -> Expr { + fn reduce_named_struct(&mut self, name: &QualifiedName, fields: &Vec<(Rc, Meta)>) -> Expr { let symbol_table = self.symbol_table; - let sym_name = match fqsn { + let ref sym_name = match symbol_table.get_fqsn_from_id(&name.id) { Some(fqsn) => fqsn, - None => return Expr::ReductionError(format!("FQSN lookup for value B failed")), + None => return Expr::ReductionError(format!("FQSN lookup for name {:?} failed", name)), }; + let FullyQualifiedSymbolName(ref v) = sym_name; let ref name = v.last().unwrap().name; let (type_name, index, members_from_table) = match symbol_table.lookup_by_fqsn(&sym_name) {