fixed expression.rs and renamed to expression_inference

This commit is contained in:
pca006132 2020-12-31 16:36:01 +08:00
parent dea987dfde
commit 8ade8c7b1f
4 changed files with 1014 additions and 1025 deletions

View File

@ -113,10 +113,15 @@ impl<'a> InferenceContext<'a> {
}
}
/// check if an identifier is already defined
pub fn defined(&self, name: &str) -> bool {
self.sym_table.get(name).is_some()
}
/// get the type of an identifier
/// may return error if the identifier is not defined, and cannot be resolved with the
/// resolution function.
pub fn resolve(&mut self, name: &'a str) -> Result<Type, String> {
pub fn resolve(&mut self, name: & str) -> Result<Type, String> {
if let Some((t, x)) = self.sym_table.get(name) {
if *x {
Ok(t.clone())

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@ extern crate num_bigint;
extern crate inkwell;
extern crate rustpython_parser;
// pub mod expression;
pub mod expression_inference;
pub mod inference_core;
mod magic_methods;
pub mod primitives;