updated compile_fun() to check attribute list after having found class_name, fun_name, arg_list

This commit is contained in:
2024-10-02 19:14:10 +09:00
parent 506b8fd9d7
commit bcaae10bef
3 changed files with 111 additions and 50 deletions

View File

@ -134,23 +134,6 @@ printf if; ##ERROR: syntax error - 'if' prohibited in this context
---
fun :: fun1() { ##ERROR: syntax error - invalid function name '::' for 'fun'
return 10;
};
---
fun fun fun1() { ##ERROR: syntax error - invalid function name 'fun' for 'fun'
return 10;
};
---
fun(#ci) fun1() { ##ERROR: syntax error - unsupported attribute list for plain function 'fun1'
}
---
(10 + 20 30) ##ERROR: syntax error - redundant operand '30'
---

View File

@ -64,3 +64,37 @@ fun x (... a) { ##ERROR: syntax error - unexpected token 'a' after '...' for 'fu
fun x (... : a) { ##ERROR: syntax error - : disallowed
}
---
fun :: fun1() { ##ERROR: syntax error - invalid function name '::' for 'fun'
return 10;
};
---
fun fun fun1() { ##ERROR: syntax error - invalid function name 'fun' for 'fun'
return 10;
};
---
fun(#ci) fun1() { ##ERROR: syntax error - unsupported attribute list for plain function 'fun1'
}
---
fun() () { ##ERROR: syntax error - unsupported attribute list for unamed function for 'fun'
}
---
fun() X:y() { ##ERROR: syntax error - empty attribute list for 'X:y' for 'fun'
}
---
class X {
fun() y() { ##ERROR: syntax error - empty attribute list for 'y' for 'fun'
}
}