From cda905bff4b24cf8f004d1f5aaf53ed98c92bf14 Mon Sep 17 00:00:00 2001 From: Glyphack Date: Mon, 30 Oct 2023 19:42:48 +0100 Subject: [PATCH] Remove unnecessary use of box --- typechecker/src/build.rs | 4 ++-- typechecker/src/semantic_analyzer.rs | 4 ++-- typechecker/src/state.rs | 4 ++-- typechecker/src/type_check/type_evaluator.rs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/typechecker/src/build.rs b/typechecker/src/build.rs index f0055519..a2fd34b7 100644 --- a/typechecker/src/build.rs +++ b/typechecker/src/build.rs @@ -102,7 +102,7 @@ impl BuildManager { fn populate_modules(&mut self) { for build_source in self.build_sources.iter() { let file = self.parse(build_source); - let state = State::new(Box::new(file)); + let state = State::new(file); self.modules.insert(build_source.module.clone(), state); } let initial_files = self.modules.values().collect(); @@ -324,7 +324,7 @@ impl BuildManager { for resolved_import in resolved_imports { let file = self.parse(&resolved_import); - let state = State::new(Box::new(file)); + let state = State::new(file); resolved_paths.insert(state.file.module_name().clone(), state); } diff --git a/typechecker/src/semantic_analyzer.rs b/typechecker/src/semantic_analyzer.rs index 81ca722d..33c14c79 100644 --- a/typechecker/src/semantic_analyzer.rs +++ b/typechecker/src/semantic_analyzer.rs @@ -20,7 +20,7 @@ use crate::{ #[allow(unused)] pub struct SemanticAnalyzer { pub globals: SymbolTable, - file: Box, + file: EnderpyFile, /// Map of module name to import result /// The imports inside the file are resolved by this map and /// no other imports are resolved @@ -38,7 +38,7 @@ pub struct SemanticAnalyzer { #[allow(unused)] impl SemanticAnalyzer { - pub fn new(file: Box, imports: HashMap) -> Self { + pub fn new(file: EnderpyFile, imports: HashMap) -> Self { let globals = SymbolTable::new(crate::symbol_table::SymbolTableType::Module, 0); SemanticAnalyzer { globals, diff --git a/typechecker/src/state.rs b/typechecker/src/state.rs index 58f27368..b34b99f7 100644 --- a/typechecker/src/state.rs +++ b/typechecker/src/state.rs @@ -15,7 +15,7 @@ use crate::{ #[derive(Debug, Clone)] pub struct State { - pub file: Box, + pub file: EnderpyFile, symbol_table: SymbolTable, pub diagnostics: Vec, // Map of import names to the result of the import @@ -23,7 +23,7 @@ pub struct State { } impl State { - pub fn new(file: Box) -> Self { + pub fn new(file: EnderpyFile) -> Self { Self { file, symbol_table: SymbolTable::new(crate::symbol_table::SymbolTableType::Module, 0), diff --git a/typechecker/src/type_check/type_evaluator.rs b/typechecker/src/type_check/type_evaluator.rs index 693f667e..bbd87250 100755 --- a/typechecker/src/type_check/type_evaluator.rs +++ b/typechecker/src/type_check/type_evaluator.rs @@ -551,7 +551,7 @@ mod tests { vec![], ); - let mut module = State::new(Box::new(enderpy_file)); + let mut module = State::new(enderpy_file); module.populate_symbol_table(); let symbol_table = module.get_symbol_table();