From 352831b2caadeb4d3725954fce36b79d5be3cab5 Mon Sep 17 00:00:00 2001 From: pca006132 Date: Sun, 13 Feb 2022 22:39:24 +0800 Subject: [PATCH] nac3core: removed legacy location definition --- nac3artiq/src/symbol_resolver.rs | 5 ---- nac3core/src/codegen/test.rs | 5 ---- nac3core/src/lib.rs | 1 - nac3core/src/location.rs | 28 ------------------- nac3core/src/symbol_resolver.rs | 3 +- nac3core/src/toplevel/test.rs | 5 ---- .../src/typecheck/type_inferencer/test.rs | 5 ---- nac3standalone/src/basic_symbol_resolver.rs | 5 ---- 8 files changed, 1 insertion(+), 56 deletions(-) delete mode 100644 nac3core/src/location.rs diff --git a/nac3artiq/src/symbol_resolver.rs b/nac3artiq/src/symbol_resolver.rs index 36427631..2ce335a7 100644 --- a/nac3artiq/src/symbol_resolver.rs +++ b/nac3artiq/src/symbol_resolver.rs @@ -1,7 +1,6 @@ use inkwell::{types::BasicType, values::BasicValueEnum, AddressSpace}; use nac3core::{ codegen::{CodeGenContext, CodeGenerator}, - location::Location, symbol_resolver::{StaticValue, SymbolResolver, SymbolValue, ValueEnum}, toplevel::{DefinitionId, TopLevelDef}, typecheck::{ @@ -989,10 +988,6 @@ impl SymbolResolver for Resolver { }) } - fn get_symbol_location(&self, _: StrRef) -> Option { - unimplemented!() - } - fn get_identifier_def(&self, id: StrRef) -> Option { { let id_to_def = self.0.id_to_def.read(); diff --git a/nac3core/src/codegen/test.rs b/nac3core/src/codegen/test.rs index ea0ccb74..e174f5fc 100644 --- a/nac3core/src/codegen/test.rs +++ b/nac3core/src/codegen/test.rs @@ -3,7 +3,6 @@ use crate::{ concrete_type::ConcreteTypeStore, CodeGenContext, CodeGenTask, DefaultCodeGenerator, WithCall, WorkerRegistry, }, - location::Location, symbol_resolver::{SymbolResolver, ValueEnum}, toplevel::{ composer::TopLevelComposer, DefinitionId, FunInstance, TopLevelContext, TopLevelDef, @@ -58,10 +57,6 @@ impl SymbolResolver for Resolver { unimplemented!() } - fn get_symbol_location(&self, _: StrRef) -> Option { - unimplemented!() - } - fn get_identifier_def(&self, id: StrRef) -> Option { self.id_to_def.read().get(&id).cloned() } diff --git a/nac3core/src/lib.rs b/nac3core/src/lib.rs index 10e1d257..bff6b5cc 100644 --- a/nac3core/src/lib.rs +++ b/nac3core/src/lib.rs @@ -2,7 +2,6 @@ #![allow(dead_code)] pub mod codegen; -pub mod location; pub mod symbol_resolver; pub mod toplevel; pub mod typecheck; diff --git a/nac3core/src/location.rs b/nac3core/src/location.rs deleted file mode 100644 index f0968523..00000000 --- a/nac3core/src/location.rs +++ /dev/null @@ -1,28 +0,0 @@ -use nac3parser::ast; -use std::vec::Vec; - -#[derive(Clone, Copy, PartialEq)] -pub struct FileID(u32); - -#[derive(Clone, Copy, PartialEq)] -pub enum Location { - CodeRange(FileID, ast::Location), - Builtin, -} - -#[derive(Default)] -pub struct FileRegistry { - files: Vec, -} - -impl FileRegistry { - pub fn add_file(&mut self, path: &str) -> FileID { - let index = self.files.len() as u32; - self.files.push(path.to_owned()); - FileID(index) - } - - pub fn query_file(&self, id: FileID) -> &str { - &self.files[id.0 as usize] - } -} diff --git a/nac3core/src/symbol_resolver.rs b/nac3core/src/symbol_resolver.rs index 8d537bc6..25ad5480 100644 --- a/nac3core/src/symbol_resolver.rs +++ b/nac3core/src/symbol_resolver.rs @@ -13,7 +13,7 @@ use crate::{ typedef::{Type, Unifier}, }, }; -use crate::{location::Location, typecheck::typedef::TypeEnum}; +use crate::typecheck::typedef::TypeEnum; use inkwell::values::{BasicValueEnum, FloatValue, IntValue, PointerValue}; use itertools::{chain, izip}; use nac3parser::ast::{Expr, StrRef}; @@ -113,7 +113,6 @@ pub trait SymbolResolver { ctx: &mut CodeGenContext<'ctx, 'a>, ) -> Option>; - fn get_symbol_location(&self, str: StrRef) -> Option; fn get_default_param_value(&self, expr: &nac3parser::ast::Expr) -> Option; fn get_string_id(&self, s: &str) -> i32; // handle function call etc. diff --git a/nac3core/src/toplevel/test.rs b/nac3core/src/toplevel/test.rs index 8021bf96..99a6ed2a 100644 --- a/nac3core/src/toplevel/test.rs +++ b/nac3core/src/toplevel/test.rs @@ -1,6 +1,5 @@ use crate::{ codegen::CodeGenContext, - location::Location, symbol_resolver::{SymbolResolver, ValueEnum}, toplevel::DefinitionId, typecheck::{ @@ -62,10 +61,6 @@ impl SymbolResolver for Resolver { unimplemented!() } - fn get_symbol_location(&self, _: StrRef) -> Option { - unimplemented!() - } - fn get_identifier_def(&self, id: StrRef) -> Option { self.0.id_to_def.lock().get(&id).cloned() } diff --git a/nac3core/src/typecheck/type_inferencer/test.rs b/nac3core/src/typecheck/type_inferencer/test.rs index d8156efd..e8459855 100644 --- a/nac3core/src/typecheck/type_inferencer/test.rs +++ b/nac3core/src/typecheck/type_inferencer/test.rs @@ -2,7 +2,6 @@ use super::super::typedef::*; use super::*; use crate::{ codegen::CodeGenContext, - location::Location, symbol_resolver::ValueEnum, toplevel::{DefinitionId, TopLevelDef}, }; @@ -41,10 +40,6 @@ impl SymbolResolver for Resolver { unimplemented!() } - fn get_symbol_location(&self, _: StrRef) -> Option { - unimplemented!() - } - fn get_identifier_def(&self, id: StrRef) -> Option { self.id_to_def.get(&id).cloned() } diff --git a/nac3standalone/src/basic_symbol_resolver.rs b/nac3standalone/src/basic_symbol_resolver.rs index 6e886fdf..0b079c80 100644 --- a/nac3standalone/src/basic_symbol_resolver.rs +++ b/nac3standalone/src/basic_symbol_resolver.rs @@ -1,6 +1,5 @@ use nac3core::{ codegen::CodeGenContext, - location::Location, symbol_resolver::{SymbolResolver, SymbolValue, ValueEnum}, toplevel::{DefinitionId, TopLevelDef}, typecheck::{ @@ -64,10 +63,6 @@ impl SymbolResolver for Resolver { unimplemented!() } - fn get_symbol_location(&self, _: StrRef) -> Option { - unimplemented!() - } - fn get_identifier_def(&self, id: StrRef) -> Option { self.0.id_to_def.lock().get(&id).cloned() }