nac3core: removed legacy location definition

This commit is contained in:
pca006132 2022-02-13 22:39:24 +08:00
parent 21d9182ba2
commit 352831b2ca
8 changed files with 1 additions and 56 deletions

View File

@ -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<Location> {
unimplemented!()
}
fn get_identifier_def(&self, id: StrRef) -> Option<DefinitionId> {
{
let id_to_def = self.0.id_to_def.read();

View File

@ -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<Location> {
unimplemented!()
}
fn get_identifier_def(&self, id: StrRef) -> Option<DefinitionId> {
self.id_to_def.read().get(&id).cloned()
}

View File

@ -2,7 +2,6 @@
#![allow(dead_code)]
pub mod codegen;
pub mod location;
pub mod symbol_resolver;
pub mod toplevel;
pub mod typecheck;

View File

@ -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<String>,
}
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]
}
}

View File

@ -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<ValueEnum<'ctx>>;
fn get_symbol_location(&self, str: StrRef) -> Option<Location>;
fn get_default_param_value(&self, expr: &nac3parser::ast::Expr) -> Option<SymbolValue>;
fn get_string_id(&self, s: &str) -> i32;
// handle function call etc.

View File

@ -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<Location> {
unimplemented!()
}
fn get_identifier_def(&self, id: StrRef) -> Option<DefinitionId> {
self.0.id_to_def.lock().get(&id).cloned()
}

View File

@ -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<Location> {
unimplemented!()
}
fn get_identifier_def(&self, id: StrRef) -> Option<DefinitionId> {
self.id_to_def.get(&id).cloned()
}

View File

@ -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<Location> {
unimplemented!()
}
fn get_identifier_def(&self, id: StrRef) -> Option<DefinitionId> {
self.0.id_to_def.lock().get(&id).cloned()
}