pr 58
This commit is contained in:
@@ -130,6 +130,13 @@ pub enum InstrKind {
|
||||
/// Calls a function by ID with the specified number of arguments.
|
||||
/// Arguments should be pushed onto the stack before calling.
|
||||
Call { func_id: FunctionId, arg_count: u32 },
|
||||
/// Calls a function from another project.
|
||||
ImportCall {
|
||||
dep_alias: String,
|
||||
module_path: String,
|
||||
symbol_name: String,
|
||||
arg_count: u32,
|
||||
},
|
||||
/// Returns from the current function. The return value (if any) should be on top of the stack.
|
||||
Ret,
|
||||
|
||||
@@ -238,6 +245,12 @@ mod tests {
|
||||
InstrKind::JmpIfFalse(Label("target".to_string())),
|
||||
InstrKind::Label(Label("target".to_string())),
|
||||
InstrKind::Call { func_id: FunctionId(0), arg_count: 0 },
|
||||
InstrKind::ImportCall {
|
||||
dep_alias: "std".to_string(),
|
||||
module_path: "math".to_string(),
|
||||
symbol_name: "abs".to_string(),
|
||||
arg_count: 1,
|
||||
},
|
||||
InstrKind::Ret,
|
||||
InstrKind::Syscall(0),
|
||||
InstrKind::FrameSync,
|
||||
@@ -324,6 +337,14 @@ mod tests {
|
||||
"arg_count": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"ImportCall": {
|
||||
"dep_alias": "std",
|
||||
"module_path": "math",
|
||||
"symbol_name": "abs",
|
||||
"arg_count": 1
|
||||
}
|
||||
},
|
||||
"Ret",
|
||||
{
|
||||
"Syscall": 0
|
||||
|
||||
Reference in New Issue
Block a user