A couple simplifications
This commit is contained in:
parent
5bfd79669e
commit
8e8be1b449
@ -51,9 +51,8 @@ impl<'a, 'b> Reducer<'a, 'b> {
|
|||||||
..
|
..
|
||||||
}) => {
|
}) => {
|
||||||
let symbol = self.symbol_table.lookup_symbol(item_id).unwrap();
|
let symbol = self.symbol_table.lookup_symbol(item_id).unwrap();
|
||||||
let def_id = symbol.def_id();
|
|
||||||
entrypoint.push(Statement::Binding {
|
entrypoint.push(Statement::Binding {
|
||||||
id: def_id,
|
id: symbol.def_id(),
|
||||||
constant: *constant,
|
constant: *constant,
|
||||||
expr: self.expression(expr),
|
expr: self.expression(expr),
|
||||||
});
|
});
|
||||||
@ -99,8 +98,7 @@ impl<'a, 'b> Reducer<'a, 'b> {
|
|||||||
}
|
}
|
||||||
ast::Declaration::Binding { constant, expr, .. } => {
|
ast::Declaration::Binding { constant, expr, .. } => {
|
||||||
let symbol = self.symbol_table.lookup_symbol(item_id).unwrap();
|
let symbol = self.symbol_table.lookup_symbol(item_id).unwrap();
|
||||||
let def_id = symbol.def_id();
|
Some(Statement::Binding { id: symbol.def_id(), constant: *constant, expr: self.expression(expr) })
|
||||||
Some(Statement::Binding { id: def_id, constant: *constant, expr: self.expression(expr) })
|
|
||||||
}
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
},
|
},
|
||||||
@ -118,9 +116,8 @@ impl<'a, 'b> Reducer<'a, 'b> {
|
|||||||
|
|
||||||
fn insert_function_definition(&mut self, item_id: &ast::ItemId, statements: &ast::Block) {
|
fn insert_function_definition(&mut self, item_id: &ast::ItemId, statements: &ast::Block) {
|
||||||
let symbol = self.symbol_table.lookup_symbol(item_id).unwrap();
|
let symbol = self.symbol_table.lookup_symbol(item_id).unwrap();
|
||||||
let def_id = symbol.def_id();
|
|
||||||
let function_def = FunctionDefinition { body: self.function_internal_block(statements) };
|
let function_def = FunctionDefinition { body: self.function_internal_block(statements) };
|
||||||
self.functions.insert(def_id, function_def);
|
self.functions.insert(symbol.def_id(), function_def);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn expression(&mut self, expr: &ast::Expression) -> Expression {
|
fn expression(&mut self, expr: &ast::Expression) -> Expression {
|
||||||
|
Loading…
Reference in New Issue
Block a user