forked from M-Labs/nac3
allows function ending with a number
This commit is contained in:
parent
1c170f5c41
commit
4fe643f45b
|
@ -150,7 +150,7 @@ impl<'ctx, 'a> CodeGenContext<'ctx, 'a> {
|
|||
} = &mut *definition.write()
|
||||
{
|
||||
instance_to_symbol.get(&key).cloned().unwrap_or_else(|| {
|
||||
let symbol = format!("{}_{}", name, instance_to_symbol.len());
|
||||
let symbol = format!("{}.{}", name, instance_to_symbol.len());
|
||||
instance_to_symbol.insert(key, symbol.clone());
|
||||
let key = self.get_subst_key(obj.map(|a| a.0), fun.0, Some(var_id));
|
||||
let instance = instance_to_stmt.get(&key).unwrap();
|
||||
|
|
|
@ -183,12 +183,6 @@ impl TopLevelComposer {
|
|||
if self.keyword_list.contains(method_name) {
|
||||
return Err("cannot use keyword as a method name".into());
|
||||
}
|
||||
if method_name.ends_with(|x: char| x.is_ascii_digit()) {
|
||||
return Err(format!(
|
||||
"function name `{}` must not end with numbers",
|
||||
method_name
|
||||
));
|
||||
}
|
||||
let global_class_method_name = {
|
||||
let mut n = mod_path.clone();
|
||||
n.push_str(
|
||||
|
@ -253,9 +247,6 @@ impl TopLevelComposer {
|
|||
if self.keyword_list.contains(name) {
|
||||
return Err("cannot use keyword as a top level function name".into());
|
||||
}
|
||||
if name.ends_with(|x: char| x.is_ascii_digit()) {
|
||||
return Err(format!("function name `{}` must not end with numbers", name));
|
||||
}
|
||||
let fun_name = name.to_string();
|
||||
let global_fun_name = {
|
||||
let mut n = mod_path;
|
||||
|
|
|
@ -57,7 +57,7 @@ pub enum TopLevelDef {
|
|||
constructor: Option<Type>,
|
||||
},
|
||||
Function {
|
||||
// prefix for symbol, should be unique globally, and not ending with numbers
|
||||
// prefix for symbol, should be unique globally
|
||||
name: String,
|
||||
// simple name, the same as in method/function definition
|
||||
simple_name: String,
|
||||
|
|
Loading…
Reference in New Issue