diff --git a/schala-lang/language/src/ast.rs b/schala-lang/language/src/ast.rs index c3ff024..b3d5d1b 100644 --- a/schala-lang/language/src/ast.rs +++ b/schala-lang/language/src/ast.rs @@ -203,7 +203,7 @@ pub enum ExpressionKind { BinExp(BinOp, Box>, Box>), PrefixExp(PrefixOp, Box>), TupleLiteral(Vec>), - Value(Meta), + Value(QualifiedName), NamedStruct { name: Meta, fields: Vec<(Rc, Meta)>, diff --git a/schala-lang/language/src/parsing.rs b/schala-lang/language/src/parsing.rs index 79c6f44..f6945ac 100644 --- a/schala-lang/language/src/parsing.rs +++ b/schala-lang/language/src/parsing.rs @@ -769,7 +769,7 @@ impl Parser { let fields = self.record_block()?; Expression::new(self.id_store.fresh(), NamedStruct { name: Meta::new(qualified_identifier), fields }) }, - _ => Expression::new(self.id_store.fresh(), Value(Meta::new(qualified_identifier))) + _ => Expression::new(self.id_store.fresh(), Value(qualified_identifier)) }) } diff --git a/schala-lang/language/src/parsing/test.rs b/schala-lang/language/src/parsing/test.rs index 2b438a0..1e3ee72 100644 --- a/schala-lang/language/src/parsing/test.rs +++ b/schala-lang/language/src/parsing/test.rs @@ -42,7 +42,7 @@ macro_rules! qname { }; } macro_rules! val { - ($var:expr) => { Value(Meta::new(QualifiedName { components: vec![Rc::new($var.to_string())], id: ItemIdStore::new_id() })) }; + ($var:expr) => { Value(QualifiedName { components: vec![Rc::new($var.to_string())], id: ItemIdStore::new_id() }) }; } macro_rules! ty { ($name:expr) => { Singleton(tys!($name)) } @@ -190,13 +190,13 @@ fn qualified_identifiers() { parse_test_wrap_ast! { "let q_q = Yolo::Swaggins", Meta::new(decl!(Binding { name: rc!(q_q), constant: true, type_anno: None, - expr: Meta::new(Expression::new(ItemIdStore::new_id(), Value(Meta::new(qname!(Yolo, Swaggins))))), + expr: Meta::new(Expression::new(ItemIdStore::new_id(), Value(qname!(Yolo, Swaggins)))), })) } parse_test_wrap_ast! { "thing::item::call()", - exst!(Call { f: bx![ex!(m Value(Meta::new(qname!(thing, item, call))))], arguments: vec![] }) + exst!(Call { f: bx![ex!(m Value(qname!(thing, item, call)))], arguments: vec![] }) } } diff --git a/schala-lang/language/src/reduced_ast.rs b/schala-lang/language/src/reduced_ast.rs index 82bedf7..ae065eb 100644 --- a/schala-lang/language/src/reduced_ast.rs +++ b/schala-lang/language/src/reduced_ast.rs @@ -158,7 +158,7 @@ impl<'a> Reducer<'a> { BinExp(binop, lhs, rhs) => self.binop(binop, lhs, rhs), PrefixExp(op, arg) => self.prefix(op, arg), Value(qualified_name) => { - let ref id = qualified_name.node().id; + let ref id = qualified_name.id; let ref sym_name = match symbol_table.get_fqsn_from_id(id) { Some(fqsn) => fqsn, None => return Expr::ReductionError(format!("FQSN lookup for Value {:?} failed", qualified_name)), diff --git a/schala-lang/language/src/scope_resolution.rs b/schala-lang/language/src/scope_resolution.rs index 6bc31fc..bf1ae9b 100644 --- a/schala-lang/language/src/scope_resolution.rs +++ b/schala-lang/language/src/scope_resolution.rs @@ -42,8 +42,8 @@ impl<'a> ScopeResolver<'a> { let inner_expr = expr.mut_node(); match &mut inner_expr.kind { ExpressionKind::Value(qualified_name) => { - let fqsn = lookup_name_in_scope(&qualified_name.node()); - let ref id = qualified_name.node().id; + let fqsn = lookup_name_in_scope(&qualified_name); + let ref id = qualified_name.id; self.symbol_table.map_id_to_fqsn(id, fqsn); }, NamedStruct { name, .. } => { diff --git a/schala-lang/language/src/typechecking.rs b/schala-lang/language/src/typechecking.rs index 71f6cb4..bea3db3 100644 --- a/schala-lang/language/src/typechecking.rs +++ b/schala-lang/language/src/typechecking.rs @@ -318,7 +318,7 @@ impl<'a> TypeContext<'a> { PrefixExp(op, expr) => self.prefix(op, expr.node())?, BinExp(op, lhs, rhs) => self.binexp(op, lhs.node(), rhs.node())?, IfExpression { discriminator, body } => self.if_expr(discriminator, body)?, - Value(val) => self.handle_value(val.node())?, + Value(val) => self.handle_value(val)?, Call { box ref f, arguments } => self.call(f, arguments)?, Lambda { params, type_anno, body } => self.lambda(params, type_anno, body)?, _ => ty!(Unit),