Skip to content

Commit

Permalink
Remove unnecessary use of box
Browse files Browse the repository at this point in the history
  • Loading branch information
Glyphack committed Oct 30, 2023
1 parent 72fe36b commit cda905b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions typechecker/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions typechecker/src/semantic_analyzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::{
#[allow(unused)]
pub struct SemanticAnalyzer {
pub globals: SymbolTable,
file: Box<EnderpyFile>,
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
Expand All @@ -38,7 +38,7 @@ pub struct SemanticAnalyzer {

#[allow(unused)]
impl SemanticAnalyzer {
pub fn new(file: Box<EnderpyFile>, imports: HashMap<String, ImportResult>) -> Self {
pub fn new(file: EnderpyFile, imports: HashMap<String, ImportResult>) -> Self {
let globals = SymbolTable::new(crate::symbol_table::SymbolTableType::Module, 0);
SemanticAnalyzer {
globals,
Expand Down
4 changes: 2 additions & 2 deletions typechecker/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ use crate::{

#[derive(Debug, Clone)]
pub struct State {
pub file: Box<EnderpyFile>,
pub file: EnderpyFile,
symbol_table: SymbolTable,
pub diagnostics: Vec<Diagnostic>,
// Map of import names to the result of the import
pub imports: HashMap<String, ImportResult>,
}

impl State {
pub fn new(file: Box<EnderpyFile>) -> Self {
pub fn new(file: EnderpyFile) -> Self {
Self {
file,
symbol_table: SymbolTable::new(crate::symbol_table::SymbolTableType::Module, 0),
Expand Down
2 changes: 1 addition & 1 deletion typechecker/src/type_check/type_evaluator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit cda905b

Please sign in to comment.