forked from M-Labs/nac3
1
0
Fork 0
nac3/nac3core/src/symbol_resolver.rs

23 lines
680 B
Rust
Raw Normal View History

use crate::location::Location;
use crate::typecheck::typedef::Type;
2021-08-05 14:55:09 +08:00
use crate::top_level::DefinitionId;
2021-07-20 16:13:43 +08:00
use rustpython_parser::ast::Expr;
2021-06-28 14:48:04 +08:00
pub enum SymbolValue<'a> {
I32(i32),
I64(i64),
Double(f64),
Bool(bool),
Tuple(&'a [SymbolValue<'a>]),
Bytes(&'a [u8]),
}
pub trait SymbolResolver {
2021-07-20 16:13:43 +08:00
fn get_symbol_type(&mut self, str: &str) -> Option<Type>;
fn parse_type_name(&mut self, expr: &Expr<()>) -> Option<Type>;
2021-08-03 13:38:27 +08:00
fn get_function_def(&mut self, str: &str) -> DefinitionId;
2021-07-19 13:35:01 +08:00
fn get_symbol_value(&mut self, str: &str) -> Option<SymbolValue>;
fn get_symbol_location(&mut self, str: &str) -> Option<Location>;
2021-06-28 14:48:04 +08:00
// handle function call etc.
}