mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
Adds: - ast/CaseDispatchDefaultSelector: AST node for a "default:" selector - ast/CaseDispatchGroup: AST node for a collection of selectors and the code to execute - ast/CaseDispatchGroups: AST node holding all groups in a case statement - ast/CaseDispatchSelectors: AST node holding all selectors for one group - ast/CaseStatement: AST node for a whole case statement - codegen/CaseDispatchGroupVisitor: knows what to put in a case jump dispatch table - codegen/CaseJumpDataBlock: knows how to build the entries in the data block Also, detect multiple case selectors with the same value (or default). This is different from the OG compiler, which only detected duplicate `default:` selectors.
13 lines
195 B
Text
13 lines
195 B
Text
var x;
|
|
case (x)
|
|
"abc":
|
|
print("first");
|
|
"abc":
|
|
print("second");
|
|
endcase
|
|
|
|
// The OG compiler does not detect the above as an error.
|
|
function foo()
|
|
a;
|
|
endfunction
|
|
foo();
|