mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-19 18:01:31 +00:00
Add CI
This commit is contained in:
@ -766,17 +766,18 @@ export class Compiler extends DiagnosticEmitter {
|
||||
const breaks: ExpressionRef[] = new Array(1 + k);
|
||||
breaks[0] = this.module.createSetLocal(local.index, this.compileExpression(statement.expression, Type.i32)); // initializer
|
||||
|
||||
// make one br_if per (possibly dynamic) labeled case
|
||||
// TODO: take advantage of br_table where labels are known to be (sequential) constant (ideally the optimizer would)
|
||||
// make one br_if per (possibly dynamic) labeled case (binaryen optimizes to br_table where possible)
|
||||
let breakIndex: i32 = 1;
|
||||
let defaultIndex: i32 = -1;
|
||||
for (i = 0; i < k; ++i) {
|
||||
const case_: SwitchCase = statement.cases[i];
|
||||
if (case_.label) {
|
||||
breaks[breakIndex++] = this.module.createBreak("case" + i.toString(10) + "$" + context, this.module.createBinary(BinaryOp.EqI32,
|
||||
this.module.createGetLocal(local.index, NativeType.I32),
|
||||
this.compileExpression(case_.label, Type.i32)
|
||||
));
|
||||
breaks[breakIndex++] = this.module.createBreak("case" + i.toString(10) + "$" + context,
|
||||
this.module.createBinary(BinaryOp.EqI32,
|
||||
this.module.createGetLocal(local.index, NativeType.I32),
|
||||
this.compileExpression(case_.label, Type.i32)
|
||||
)
|
||||
);
|
||||
} else
|
||||
defaultIndex = i;
|
||||
}
|
||||
|
@ -1118,8 +1118,7 @@ export class Parser extends DiagnosticEmitter {
|
||||
this.error(DiagnosticCode._0_expected, tn.range(), ":");
|
||||
|
||||
// 'default' ':' Statement*
|
||||
} else if (tn.nextToken == Token.DEFAULT) {
|
||||
tn.next();
|
||||
} else if (tn.skip(Token.DEFAULT)) {
|
||||
if (tn.skip(Token.COLON)) {
|
||||
const statements: Statement[] = new Array();
|
||||
while (tn.peek() != Token.CASE && tn.nextToken != Token.DEFAULT && tn.nextToken != Token.CLOSEBRACE) {
|
||||
|
@ -28,7 +28,7 @@
|
||||
"glue/js.d.ts",
|
||||
"glue/js.ts",
|
||||
"index.ts",
|
||||
"moddule.ts",
|
||||
"module.ts",
|
||||
"parser.ts",
|
||||
"program.ts",
|
||||
"tokenizer.ts",
|
||||
|
Reference in New Issue
Block a user