Start to get rid of Meta

This commit is contained in:
greg 2019-09-20 01:57:48 -07:00
parent 69c215eac9
commit 8d1e0ebdea
6 changed files with 9 additions and 9 deletions

View File

@ -203,7 +203,7 @@ pub enum ExpressionKind {
BinExp(BinOp, Box<Meta<Expression>>, Box<Meta<Expression>>),
PrefixExp(PrefixOp, Box<Meta<Expression>>),
TupleLiteral(Vec<Meta<Expression>>),
Value(Meta<QualifiedName>),
Value(QualifiedName),
NamedStruct {
name: Meta<QualifiedName>,
fields: Vec<(Rc<String>, Meta<Expression>)>,

View File

@ -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))
})
}

View File

@ -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![] })
}
}

View File

@ -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)),

View File

@ -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, .. } => {

View File

@ -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),