Add logic for checking if callee is platform fn.
This commit is contained in:
parent
b7b495178b
commit
506e260c75
@ -22,7 +22,7 @@ mod smoke_tests {
|
|||||||
fn multiple_statements() {
|
fn multiple_statements() {
|
||||||
let asm_functions = assemble(
|
let asm_functions = assemble(
|
||||||
"
|
"
|
||||||
fn println() end
|
extern fn println()
|
||||||
fn main()
|
fn main()
|
||||||
let x = 42
|
let x = 42
|
||||||
println(x)
|
println(x)
|
||||||
|
|||||||
@ -143,14 +143,25 @@ impl Call {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let function_name = match self.callee() {
|
|
||||||
Expression::Identifier(identifier) => identifier.name(),
|
let function_symbol = match self.callee() {
|
||||||
|
Expression::Identifier(identifier) => {
|
||||||
|
let expressible_symbol = identifier.expressible_symbol();
|
||||||
|
match expressible_symbol {
|
||||||
|
ExpressibleSymbol::Function(function_symbol) => function_symbol.clone(),
|
||||||
|
_ => panic!("Calling things other than functions not yet supported."),
|
||||||
|
}
|
||||||
|
}
|
||||||
_ => panic!("Calling things other than identifiers not yet supported."),
|
_ => panic!("Calling things other than identifiers not yet supported."),
|
||||||
};
|
};
|
||||||
|
|
||||||
context.instruction(AsmInstruction::InvokePlatformStatic(
|
if function_symbol.is_platform() {
|
||||||
InvokePlatformStatic::new(function_name),
|
context.instruction(AsmInstruction::InvokePlatformStatic(
|
||||||
));
|
InvokePlatformStatic::new(function_symbol.name()),
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
todo!("non-platform invoke")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn source_range(&self) -> &SourceRange {
|
pub fn source_range(&self) -> &SourceRange {
|
||||||
|
|||||||
@ -32,6 +32,10 @@ impl FunctionSymbol {
|
|||||||
pub fn return_type(&self) -> TypeInfo {
|
pub fn return_type(&self) -> TypeInfo {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_platform(&self) -> bool {
|
||||||
|
self.is_platform
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ParameterSymbol {
|
pub struct ParameterSymbol {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user