forked from swc-project/swc
/
index.tsx
104 lines (90 loc) · 3.32 KB
/
index.tsx
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
function exampleFunction1() {
return Math.random() > 0.5
? `<button
@click="${(): void => console.log('this line causes a syntax error')}"
></button>`
: `<button
@click="${(): void => console.log('this line does NOT causes a syntax error')}"
></button>`;
}
function exampleFunction2() {
return Math.random() > 0.5
? `<bar></bar>` + `<button
@click="${(): void => console.log('this line causes a syntax error')}"
></button>`
: `<bar></bar>` + `<button
@click="${(): void => console.log('this line does NOT causes a syntax error')}"
></button>`;
}
function exampleFunction3() {
return Math.random() > 0.5
? (): void => console.log('this line causes a syntax error')
: (): void => console.log('this line does NOT causes a syntax error');
}
function exampleFunction4() {
return Math.random() > 0.5
? function (): void { console.log('this line causes a syntax error') }
: function (): void { console.log('this line does NOT causes a syntax error') };
}
function exampleFunction5() {
return Math.random() > 0.5
? (function (): void { console.log('this line causes a syntax error') })
: (function (): void { console.log('this line does NOT causes a syntax error') });
}
function exampleFunction6() {
return Math.random() > 0.5
? "test" == "test"
? `<button @click="${(): void => console.log('this line causes a syntax error')}"></button>`
: "bar"
: `<button
@click="${(): void => console.log('this line does NOT causes a syntax error')}"
></button>`;
}
function exampleFunction6() {
return Math.random() > 0.5
? `<button @click="${(): void => console.log('this line causes a syntax error')}"></button>`
: "test" == "test"
? `<button @click="${(): void => console.log('this line causes a syntax error')}"></button>`
: "bar";
}
function exampleFunction7() {
return Math.random() > 0.5
? foo`<button @click="${(): void => console.log('this line causes a syntax error')}"></button>`
: bar`<button @click="${(): void => console.log('this line does NOT causes a syntax error')}"></button>`;
}
function exampleFunction8() {
return Math.random() > 0.5
? ((): void => console.log('this line causes a syntax error'))
: ((): void => console.log('this line does NOT causes a syntax error'));
}
function exampleFunction9() {
return Math.random() > 0.5
? async (): Promise<void> => console.log('this line causes a syntax error')
: async (): Promise<void> => console.log('this line causes a syntax error');
}
function exampleFunction10() {
const foo = "Oranges";
switch (foo) {
case 'Oranges': {
return `<button @click="${(): void => console.log('this line causes a syntax error')}" ></button>`;
}
default:
console.log(`Sorry, we are out of test.`);
}
}
function exampleFunction11() {
switch (true) {
case ((): boolean => true)(): {
console.log('This shape is a square.');
break;
}
}
}
function exampleFunction12() {
switch (((): boolean => true)()) {
case ((): boolean => true)(): {
console.log('This shape is a square.');
break;
}
}
}