forked from M-Labs/nac3
added syscall annotation
and temporarily disabled the keyword check for top-level functions
This commit is contained in:
parent
013e7cfc2a
commit
a508baae20
|
@ -244,9 +244,9 @@ impl TopLevelComposer {
|
||||||
}
|
}
|
||||||
|
|
||||||
ast::StmtKind::FunctionDef { name, .. } => {
|
ast::StmtKind::FunctionDef { name, .. } => {
|
||||||
if self.keyword_list.contains(name) {
|
// if self.keyword_list.contains(name) {
|
||||||
return Err("cannot use keyword as a top level function name".into());
|
// return Err("cannot use keyword as a top level function name".into());
|
||||||
}
|
// }
|
||||||
let fun_name = name.to_string();
|
let fun_name = name.to_string();
|
||||||
let global_fun_name = {
|
let global_fun_name = {
|
||||||
let mut n = mod_path;
|
let mut n = mod_path;
|
||||||
|
@ -608,6 +608,7 @@ impl TopLevelComposer {
|
||||||
let function_ast = if let Some(x) = function_ast.as_ref() {
|
let function_ast = if let Some(x) = function_ast.as_ref() {
|
||||||
x
|
x
|
||||||
} else {
|
} else {
|
||||||
|
// if let TopLevelDef::Function { name, .. } = ``
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1223,8 +1224,9 @@ impl TopLevelComposer {
|
||||||
let mut function_def = def.write();
|
let mut function_def = def.write();
|
||||||
if let TopLevelDef::Function {
|
if let TopLevelDef::Function {
|
||||||
instance_to_stmt,
|
instance_to_stmt,
|
||||||
|
instance_to_symbol,
|
||||||
name,
|
name,
|
||||||
simple_name: _,
|
simple_name,
|
||||||
signature,
|
signature,
|
||||||
resolver,
|
resolver,
|
||||||
..
|
..
|
||||||
|
@ -1342,9 +1344,15 @@ impl TopLevelComposer {
|
||||||
calls: &mut calls,
|
calls: &mut calls,
|
||||||
};
|
};
|
||||||
|
|
||||||
let fun_body = if let ast::StmtKind::FunctionDef { body, .. } =
|
let fun_body = if let ast::StmtKind::FunctionDef { body, decorator_list, .. } =
|
||||||
ast.clone().unwrap().node
|
ast.clone().unwrap().node
|
||||||
{
|
{
|
||||||
|
if !decorator_list.is_empty() &&
|
||||||
|
matches!(&decorator_list[0].node,
|
||||||
|
ast::ExprKind::Name{ id, .. } if id == "syscall") {
|
||||||
|
instance_to_symbol.insert("".to_string(), simple_name.clone());
|
||||||
|
continue
|
||||||
|
}
|
||||||
body
|
body
|
||||||
} else {
|
} else {
|
||||||
unreachable!("must be function def ast")
|
unreachable!("must be function def ast")
|
||||||
|
|
Loading…
Reference in New Issue