aboutsummaryrefslogtreecommitdiff
path: root/src/z/parser/js/test_fixture.js
blob: 378ceb3f62469725480731e8153a3d4b5101e73f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env node
// comment line
/* block
   comment */
var x = 42;
let y = "hello";
const z = `template ${x} literal`;
let a = 0b1010;
let b = 0xFF;
let c = 0o77;
let d = 123n;
let e = /pattern/gi;
let f = true;
let g = null;
function hello(a, b) {
	if (a > b) {
		return a;
	} else {
		return b;
	}
}
const arrow = (x) => x * 2;
const obj = {
	a: 1,
	b: "two",
	c,
	[d]: 4,
	method() { return 5; },
	get prop() { return 6; },
	set prop(v) { },
};
const arr = [1, 2, ...rest, 4];
for (var i = 0; i < 10; i++) {
	continue;
}
for (const key in obj) {
	break;
}
for (const val of arr) {
	;
}
while (x < 10) {
	x++;
}
do {
	x--;
} while (x > 0);
try {
	throw "err";
} catch (e) {
	console.log(e);
} finally {
	cleanup();
}
switch (x) {
	case 1:
		break;
	case 2:
		return;
	default:
		break;
}
class Foo extends Bar {
	constructor() { super(); }
	static method() { }
	get prop() { return 1; }
	set prop(v) { }
}
const { a: p, b: q } = obj;
const [head, ...tail] = arr;
import { something } from "module";
export default x;
export const named = 1;
export function exported() { }
import "side-effect";
import * as ns from "module";
export { x as y } from "module";
export * from "module";
delete obj.a;
typeof x;
void x;
x ?? y;
x?.y?.z;
x ??= y;
x &&= y;
x ||= y;