[fine] Rebuild main, it's probably broken
This commit is contained in:
parent
a9c1b04920
commit
b205ebcb4c
4 changed files with 24 additions and 892 deletions
|
|
@ -126,7 +126,7 @@ pub struct Semantics<'a> {
|
|||
syntax_tree: &'a SyntaxTree<'a>,
|
||||
lines: &'a Lines,
|
||||
errors: RefCell<Vec<Error>>,
|
||||
types: RefCell<HashMap<TreeRef, Type>>,
|
||||
types: RefCell<HashMap<(TreeRef, bool), Type>>,
|
||||
}
|
||||
|
||||
impl<'a> Semantics<'a> {
|
||||
|
|
@ -210,7 +210,7 @@ impl<'a> Semantics<'a> {
|
|||
}
|
||||
|
||||
pub fn type_of(&self, t: TreeRef, value_required: bool) -> Option<Type> {
|
||||
if let Some(existing) = self.types.borrow().get(&t) {
|
||||
if let Some(existing) = self.types.borrow().get(&(t, value_required)) {
|
||||
return Some(existing.clone());
|
||||
}
|
||||
|
||||
|
|
@ -239,7 +239,9 @@ impl<'a> Semantics<'a> {
|
|||
// NOTE: These return `None` if they encounter some problem.
|
||||
let result = result.unwrap_or(Type::Error);
|
||||
|
||||
self.types.borrow_mut().insert(t, result.clone());
|
||||
self.types
|
||||
.borrow_mut()
|
||||
.insert((t, value_required), result.clone());
|
||||
Some(result)
|
||||
}
|
||||
|
||||
|
|
@ -509,6 +511,6 @@ impl<'a> Semantics<'a> {
|
|||
|
||||
fn type_of_identifier(&self, tree: &Tree) -> Option<Type> {
|
||||
assert_eq!(tree.kind, TreeKind::Identifier);
|
||||
todo!()
|
||||
Some(Type::Error)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue