Compare commits

...

2 Commits

Author SHA1 Message Date
z78078 cc99085403 move the changes to nac3artiq 2022-07-08 17:12:53 +08:00
z78078 74d39be59c add comment to the code block 2022-07-08 17:11:50 +08:00
2 changed files with 1 additions and 15 deletions

View File

@ -402,6 +402,7 @@ impl Nac3 {
} }
}) })
{ {
// This part check if __init__ method decorate with inappropriate decorator (rpc)
if name == &"__init__".into() { if name == &"__init__".into() {
return Err(CompileError::new_err(format!( return Err(CompileError::new_err(format!(
"compilation failed\n----------\nConstructor __init__ function should not decorated with rpc decorator (at {})", "compilation failed\n----------\nConstructor __init__ function should not decorated with rpc decorator (at {})",

View File

@ -1073,21 +1073,6 @@ impl TopLevelComposer {
let mut method_var_map: HashMap<u32, Type> = HashMap::new(); let mut method_var_map: HashMap<u32, Type> = HashMap::new();
// This part check if __init__ method decorate with inappropriate decorator (rpc)
if name == &"__init__".into() {
if let Some(_) = decorator_list
.iter()
.find(|ast::Located { node, .. }| match node {
&ast::ExprKind::Name { id, .. } => id == "rpc".into(),
_ => false
}) {
return Err(format!(
"class {} constructor {} (at {}) must not be decorated with rpc",
_class_name, name, b.location
));
}
}
let arg_types: Vec<FuncArg> = { let arg_types: Vec<FuncArg> = {
// check method parameters cannot have same name // check method parameters cannot have same name
let mut defined_parameter_name: HashSet<_> = HashSet::new(); let mut defined_parameter_name: HashSet<_> = HashSet::new();