mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-22 11:11:43 +00:00
Fixed for-loop parsing
This commit is contained in:
3
tests/parser/fixtures/do.ts
Normal file
3
tests/parser/fixtures/do.ts
Normal file
@ -0,0 +1,3 @@
|
||||
do {
|
||||
;
|
||||
} while (a != b);
|
9
tests/parser/fixtures/for.ts
Normal file
9
tests/parser/fixtures/for.ts
Normal file
@ -0,0 +1,9 @@
|
||||
for (let i: i32 = 0; i < 10; ++i) {
|
||||
;
|
||||
}
|
||||
for (i = 0; i < 10; ++i) {
|
||||
;
|
||||
}
|
||||
for (;;) {
|
||||
;
|
||||
}
|
42
tests/parser/fixtures/literals.ts
Normal file
42
tests/parser/fixtures/literals.ts
Normal file
@ -0,0 +1,42 @@
|
||||
0;
|
||||
1;
|
||||
2;
|
||||
3;
|
||||
4;
|
||||
5;
|
||||
6;
|
||||
7;
|
||||
8;
|
||||
9;
|
||||
// 0x0;
|
||||
// 0x1;
|
||||
// 0x2;
|
||||
// 0x3;
|
||||
// 0x4;
|
||||
// 0x5;
|
||||
// 0x6;
|
||||
// 0x7;
|
||||
// 0x8;
|
||||
// 0x9;
|
||||
// 0xA;
|
||||
// 0xB;
|
||||
// 0xC;
|
||||
// 0xD;
|
||||
// 0xE;
|
||||
// 0xF;
|
||||
// 0xa;
|
||||
// 0xb;
|
||||
// 0xc;
|
||||
// 0xd;
|
||||
// 0xe;
|
||||
// 0xf;
|
||||
// 0o0;
|
||||
// 0o1;
|
||||
// 0o2;
|
||||
// 0o3;
|
||||
// 0o4;
|
||||
// 0o5;
|
||||
// 0o6;
|
||||
// 0o7;
|
||||
// 0b0;
|
||||
// 0b1;
|
9
tests/parser/fixtures/while.ts
Normal file
9
tests/parser/fixtures/while.ts
Normal file
@ -0,0 +1,9 @@
|
||||
while (1) {
|
||||
;
|
||||
}
|
||||
while (true) {
|
||||
;
|
||||
}
|
||||
while ("str") {
|
||||
;
|
||||
}
|
@ -1,12 +1,15 @@
|
||||
import * as fs from "fs";
|
||||
import * as diff from "diff";
|
||||
import * as chalk from "chalk";
|
||||
import * as glob from "glob";
|
||||
|
||||
import "../../src/glue/js";
|
||||
import { NodeKind, ExpressionStatement } from "../../src/ast";
|
||||
import { Parser } from "../../src/parser";
|
||||
|
||||
const files = fs.readdirSync(__dirname + "/fixtures");
|
||||
const filter = process.argv.length > 2 ? "*" + process.argv[2] + "*.ts" : "**.ts";
|
||||
|
||||
const files = glob.sync(filter, { cwd: __dirname + "/fixtures" });
|
||||
files.forEach(filename => {
|
||||
if (filename.charAt(0) == "_") return;
|
||||
const isTree = filename.indexOf(".tree.") >= 0;
|
||||
|
Reference in New Issue
Block a user