Open
Description
Issue description:
In pawn-lang.pdf:
As a special syntax, when there are no names between the angle brackets, the function is linked to all states that are not attributed to other implementations of the function. The function that handles “all states not handled elsewhere” is the so-called fall-back function.
A state variable is a global variable with a state classifier appended at the end. The scope and the lifespan of the variable are restricted to the states that are listed in the classifier.
Fall-back state specifiers are not permitted for state variables.
Minimal complete verifiable example (MCVE):
#include <a_samp>
new var1 <my_state:state_a>;
new var2 <my_state:state_b>;
// error 085: no states are defined for symbol "var3"
new var3 <>;
// error 017: undefined symbol "var3"; did you mean "var1"?
// warning 203: symbol is never used: "var3"
new var3 <my_state>;
// error 001: expected token: "-identifier-", but found ">"
new var3 <my_state:>;
main() {
state my_state:state_a;
Func();
state my_state:state_b;
Func();
state my_state:state_c;
Func();
}
Func() <my_state:state_a> {
printf("%d", var1);
}
Func() <my_state:state_b> {
printf("%d", var2);
}
Func() <my_state:state_c, my_state:state_d> {
printf("%d", var3);
}
Why not one var3
can work?
Workspace Information:
- Compiler version: 3.10.9
- Command line arguments provided (or sampctl version): pawno
- Operating System: Windows 8