More visitor stuff
This commit is contained in:
@@ -48,9 +48,15 @@ pub trait ASTVisitor: Sized {
|
||||
walker::maybe_type_identifier(self, type_anno);
|
||||
}
|
||||
|
||||
fn import(&mut self, import: &ImportSpecifier) {
|
||||
fn named_struct(&mut self, name: &QualifiedName, fields: &Vec<(Rc<String>, Expression)>) {
|
||||
self.qualified_name(name);
|
||||
for (_, expr) in fields.iter() {
|
||||
walker::expression(self, expr);
|
||||
}
|
||||
}
|
||||
|
||||
fn import(&mut self, import: &ImportSpecifier) {}
|
||||
fn qualified_name(&mut self, name: &QualifiedName) {}
|
||||
fn nat_literal(&mut self, n: u64) {}
|
||||
fn float_literal(&mut self, f: f64) {}
|
||||
fn string_literal(&mut self, s: &Rc<String>) {}
|
||||
|
||||
@@ -69,15 +69,16 @@ pub fn expression_kind<V: ASTVisitor>(v: &mut V, expression_kind: &ExpressionKin
|
||||
BoolLiteral(b) => v.bool_literal(*b),
|
||||
BinExp(op, lhs, rhs) => v.binexp(op, lhs, rhs),
|
||||
PrefixExp(op, arg) => v.prefix_exp(op, arg),
|
||||
TupleLiteral(exprs) => {
|
||||
for expr in exprs {
|
||||
v.expression(expr);
|
||||
}
|
||||
},
|
||||
Value(name) => v.qualified_name(name),
|
||||
NamedStruct { name, fields } => v.named_struct(name, fields),
|
||||
_ => (),
|
||||
}
|
||||
/*
|
||||
TupleLiteral(Vec<Expression>),
|
||||
Value(QualifiedName),
|
||||
NamedStruct {
|
||||
name: QualifiedName,
|
||||
fields: Vec<(Rc<String>, Expression)>,
|
||||
},
|
||||
Call {
|
||||
f: Box<Expression>,
|
||||
arguments: Vec<InvocationArgument>,
|
||||
@@ -109,4 +110,3 @@ pub fn expression_kind<V: ASTVisitor>(v: &mut V, expression_kind: &ExpressionKin
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user