working hir
This commit is contained in:
+15
-2
@@ -5,6 +5,7 @@ use crate::top_level::{FunctionSymbol, StructSymbol, TopLevelSymbolScope, TypeSy
|
|||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum TypeRef {
|
pub enum TypeRef {
|
||||||
Struct(StructRef),
|
Struct(StructRef),
|
||||||
|
Int,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
@@ -61,7 +62,7 @@ impl TopLevelHirScope {
|
|||||||
if let Some(rf) = self.functions.get(&symbol.name) {
|
if let Some(rf) = self.functions.get(&symbol.name) {
|
||||||
rf.clone()
|
rf.clone()
|
||||||
} else {
|
} else {
|
||||||
if let Some(tlss_rf) = tlss.functions.get(&symbol.name) {
|
if let Some(_) = tlss.functions.get(&symbol.name) {
|
||||||
let rf = Arc::new(FunctionRef {
|
let rf = Arc::new(FunctionRef {
|
||||||
export: symbol.export,
|
export: symbol.export,
|
||||||
name: symbol.name.clone(),
|
name: symbol.name.clone(),
|
||||||
@@ -141,7 +142,19 @@ impl TopLevelHirScope {
|
|||||||
|
|
||||||
rf
|
rf
|
||||||
} else {
|
} else {
|
||||||
unimplemented!()
|
match symbol.0.as_str() {
|
||||||
|
"int" => {
|
||||||
|
let rf = Arc::new(TypeRef::Int);
|
||||||
|
|
||||||
|
self.types.insert(symbol.0.clone(), rf.clone());
|
||||||
|
|
||||||
|
rf
|
||||||
|
}
|
||||||
|
|
||||||
|
_ => {
|
||||||
|
unimplemented!("{:?}", symbol)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user