From 8e8be1b44919b7732d63754b8ae4b4c2a953e05a Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Sat, 11 Dec 2021 18:38:23 -0800 Subject: [PATCH] A couple simplifications --- schala-lang/src/reduced_ir/mod.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/schala-lang/src/reduced_ir/mod.rs b/schala-lang/src/reduced_ir/mod.rs index e4f0fe6..709f8e3 100644 --- a/schala-lang/src/reduced_ir/mod.rs +++ b/schala-lang/src/reduced_ir/mod.rs @@ -51,9 +51,8 @@ impl<'a, 'b> Reducer<'a, 'b> { .. }) => { let symbol = self.symbol_table.lookup_symbol(item_id).unwrap(); - let def_id = symbol.def_id(); entrypoint.push(Statement::Binding { - id: def_id, + id: symbol.def_id(), constant: *constant, expr: self.expression(expr), }); @@ -99,8 +98,7 @@ impl<'a, 'b> Reducer<'a, 'b> { } ast::Declaration::Binding { constant, expr, .. } => { let symbol = self.symbol_table.lookup_symbol(item_id).unwrap(); - let def_id = symbol.def_id(); - Some(Statement::Binding { id: def_id, constant: *constant, expr: self.expression(expr) }) + Some(Statement::Binding { id: symbol.def_id(), constant: *constant, expr: self.expression(expr) }) } _ => None, }, @@ -118,9 +116,8 @@ impl<'a, 'b> Reducer<'a, 'b> { fn insert_function_definition(&mut self, item_id: &ast::ItemId, statements: &ast::Block) { 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) }; - self.functions.insert(def_id, function_def); + self.functions.insert(symbol.def_id(), function_def); } fn expression(&mut self, expr: &ast::Expression) -> Expression {