Get rid of Meta use in reduce_named_struct

This commit is contained in:
greg 2019-09-19 18:38:15 -07:00
parent e1a83b5de3
commit e5a09a6ee8

View File

@ -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<String>, Meta<Expression>)>) -> Expr {
fn reduce_named_struct(&mut self, name: &QualifiedName, fields: &Vec<(Rc<String>, Meta<Expression>)>) -> 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) {