-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace PlaceholderExpression with it
- Loading branch information
1 parent
4c3d2df
commit 5395193
Showing
35 changed files
with
279 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
z = match foo.bar() as y: | ||
| y < 1: "lt one" | ||
| y + 1 == 1: "eq zero" | ||
| y == 2: "eq two" | ||
| y~f(): "f(x) truthy" | ||
| y.prop: "has prop" | ||
| y.0: "has first child" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const z = (y => { | ||
if (y < 1) { | ||
return "lt one"; | ||
} else if (y + 1 === 1) { | ||
return "eq zero"; | ||
} else if (y === 2) { | ||
return "eq two"; | ||
} else if (f(y)) { | ||
return "f(x) truthy"; | ||
} else if (y.prop) { | ||
return "has prop"; | ||
} else if (y[0]) { | ||
return "has first child"; | ||
} | ||
})(foo.bar()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
match foo() as y: | ||
| y < 1: "lt one" | ||
| y + 1 == 1: "eq zero" | ||
| y == 2: "eq two" | ||
| y~f(): "f(y) truthy" | ||
| y.prop: "has prop" | ||
| y.0: "has first child" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const y = foo(); | ||
|
||
if (y < 1) { | ||
"lt one"; | ||
} else if (y + 1 === 1) { | ||
"eq zero"; | ||
} else if (y === 2) { | ||
"eq two"; | ||
} else if (f(y)) { | ||
"f(y) truthy"; | ||
} else if (y.prop) { | ||
"has prop"; | ||
} else if (y[0]) { | ||
"has first child"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
z = match x as y: | ||
| y < 1: "lt one" | ||
| y + 1 == 1: "eq zero" | ||
| y == 2: "eq two" | ||
| y~f(): "f(x) truthy" | ||
| y.prop: "has prop" | ||
| y.0: "has first child" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const z = (y => { | ||
if (y < 1) { | ||
return "lt one"; | ||
} else if (y + 1 === 1) { | ||
return "eq zero"; | ||
} else if (y === 2) { | ||
return "eq two"; | ||
} else if (f(y)) { | ||
return "f(x) truthy"; | ||
} else if (y.prop) { | ||
return "has prop"; | ||
} else if (y[0]) { | ||
return "has first child"; | ||
} | ||
})(x); |
3 changes: 3 additions & 0 deletions
3
test/fixtures/match/as-identifier-statement-body-reference/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
match x: | ||
| 1: "foo" | ||
| "1": it |
7 changes: 7 additions & 0 deletions
7
test/fixtures/match/as-identifier-statement-body-reference/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const it = x; | ||
|
||
if (it === 1) { | ||
"foo"; | ||
} else if (it === "1") { | ||
it; | ||
} |
3 changes: 3 additions & 0 deletions
3
test/fixtures/match/as-identifier-statement-not-referenced/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
match x: | ||
| 1: "foo" | ||
| "1": "bar" |
5 changes: 5 additions & 0 deletions
5
test/fixtures/match/as-identifier-statement-not-referenced/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
if (x === 1) { | ||
"foo"; | ||
} else if (x === "1") { | ||
"bar"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
match x as y: | ||
| y < 1: "lt one" | ||
| y + 1 == 1: "eq zero" | ||
| y == 2: "eq two" | ||
| y~f(): "f(x) truthy" | ||
| y.prop: "has prop" | ||
| y.0: "has first child" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const y = x; | ||
|
||
if (y < 1) { | ||
"lt one"; | ||
} else if (y + 1 === 1) { | ||
"eq zero"; | ||
} else if (y === 2) { | ||
"eq two"; | ||
} else if (f(y)) { | ||
"f(x) truthy"; | ||
} else if (y.prop) { | ||
"has prop"; | ||
} else if (y[0]) { | ||
"has first child"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
z = match foo.bar(): | ||
| it < 1: "lt one" | ||
| it + 1 == 1: "eq zero" | ||
| it == 2: "eq two" | ||
| it~f(): "f(x) truthy" | ||
| it.prop: "has prop" | ||
| it.0: "has first child" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const z = (it => { | ||
if (it < 1) { | ||
return "lt one"; | ||
} else if (it + 1 === 1) { | ||
return "eq zero"; | ||
} else if (it === 2) { | ||
return "eq two"; | ||
} else if (f(it)) { | ||
return "f(x) truthy"; | ||
} else if (it.prop) { | ||
return "has prop"; | ||
} else if (it[0]) { | ||
return "has first child"; | ||
} | ||
})(foo.bar()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
match foo(): | ||
| it < 1: "lt one" | ||
| it + 1 == 1: "eq zero" | ||
| it == 2: "eq two" | ||
| it~f(): "f(x) truthy" | ||
| it.prop: "has prop" | ||
| it.0: "has first child" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const it = foo(); | ||
|
||
if (it < 1) { | ||
"lt one"; | ||
} else if (it + 1 === 1) { | ||
"eq zero"; | ||
} else if (it === 2) { | ||
"eq two"; | ||
} else if (f(it)) { | ||
"f(x) truthy"; | ||
} else if (it.prop) { | ||
"has prop"; | ||
} else if (it[0]) { | ||
"has first child"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
z = match x: | ||
| it < 1: "lt one" | ||
| it + 1 == 1: "eq zero" | ||
| it == 2: "eq two" | ||
| it~f(): "f(x) truthy" | ||
| it.prop: "has prop" | ||
| it.0: "has first child" |
15 changes: 15 additions & 0 deletions
15
test/fixtures/match/as-it-identifier-expression/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const z = (it => { | ||
if (it < 1) { | ||
return "lt one"; | ||
} else if (it + 1 === 1) { | ||
return "eq zero"; | ||
} else if (it === 2) { | ||
return "eq two"; | ||
} else if (f(it)) { | ||
return "f(x) truthy"; | ||
} else if (it.prop) { | ||
return "has prop"; | ||
} else if (it[0]) { | ||
return "has first child"; | ||
} | ||
})(x); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
match x: | ||
| it < 1: "lt one" | ||
| it + 1 == 1: "eq zero" | ||
| it == 2: "eq two" | ||
| it~f(): "f(x) truthy" | ||
| it.prop: "has prop" | ||
| it.0: "has first child" |
15 changes: 15 additions & 0 deletions
15
test/fixtures/match/as-it-identifier-statement/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const it = x; | ||
|
||
if (it < 1) { | ||
"lt one"; | ||
} else if (it + 1 === 1) { | ||
"eq zero"; | ||
} else if (it === 2) { | ||
"eq two"; | ||
} else if (f(it)) { | ||
"f(x) truthy"; | ||
} else if (it.prop) { | ||
"has prop"; | ||
} else if (it[0]) { | ||
"has first child"; | ||
} |
Oops, something went wrong.