Some refactoring
This commit is contained in:
parent
0eccceabd9
commit
89a93d59c7
@ -51,24 +51,34 @@ impl<'a> SymbolTablePopulator<'a> {
|
||||
if let Err(err) = self.add_single_statement(id, kind, location, scope_stack, function_scope) {
|
||||
errors.push(err);
|
||||
} else {
|
||||
let decl = match kind {
|
||||
StatementKind::Declaration(decl) => decl,
|
||||
_ => continue,
|
||||
};
|
||||
// If there's an error with a name, don't recurse into subscopes of that name
|
||||
let recursive_errs = match kind {
|
||||
StatementKind::Declaration(Declaration::FuncDecl(signature, body)) => {
|
||||
let recursive_errs = match decl {
|
||||
Declaration::FuncDecl(signature, body) => {
|
||||
let new_scope = ScopeSegment::Name(signature.name.clone());
|
||||
scope_stack.push(new_scope);
|
||||
let output = self.add_from_scope(body.as_ref(), scope_stack, true);
|
||||
scope_stack.pop();
|
||||
output
|
||||
}
|
||||
StatementKind::Declaration(Declaration::Module { name, items }) => {
|
||||
Declaration::Module { name, items } => {
|
||||
let new_scope = ScopeSegment::Name(name.clone());
|
||||
scope_stack.push(new_scope);
|
||||
let output = self.add_from_scope(items.as_ref(), scope_stack, false);
|
||||
scope_stack.pop();
|
||||
output
|
||||
}
|
||||
StatementKind::Declaration(Declaration::TypeDecl { name, body, mutable }) =>
|
||||
Declaration::TypeDecl { name, body, mutable } =>
|
||||
self.add_type_members(name, body, mutable, location, scope_stack),
|
||||
|
||||
/*
|
||||
Declaration::Impl { type_name, body, .. } => {
|
||||
|
||||
},
|
||||
*/
|
||||
_ => vec![],
|
||||
};
|
||||
errors.extend(recursive_errs.into_iter());
|
||||
|
Loading…
Reference in New Issue
Block a user