-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flow][match] Get def for match patterns
Summary: Get def for match patterns. Already mostly worked, implemented for member patterns. Changelog: [internal] Reviewed By: panagosg7 Differential Revision: D67830343 fbshipit-source-id: ac6ff8f676b1d5a2f5f57012586b9afff0f1b8c9
- Loading branch information
1 parent
a8ea098
commit b9cc018
Showing
10 changed files
with
162 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[options] | ||
all=true | ||
experimental.pattern_matching_expressions=true |
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 @@ | ||
shell: test.sh |
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,16 @@ | ||
declare const x: mixed; | ||
|
||
const e = match (x) { | ||
1 as foo: foo, | ||
// ^ | ||
2 as const foo: foo, | ||
// ^ | ||
{const foo}: foo, | ||
// ^ | ||
{...const foo}: foo, | ||
// ^ | ||
[...const foo]: foo, | ||
// ^ | ||
const foo: foo, | ||
// ^ | ||
}; |
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,44 @@ | ||
bindings-introduced.js:4:13 | ||
Flags: | ||
bindings-introduced.js:4:8,4:10 | ||
|
||
bindings-introduced.js:6:19 | ||
Flags: | ||
bindings-introduced.js:6:14,6:16 | ||
|
||
bindings-introduced.js:8:16 | ||
Flags: | ||
bindings-introduced.js:8:10,8:12 | ||
|
||
bindings-introduced.js:10:19 | ||
Flags: | ||
bindings-introduced.js:10:13,10:15 | ||
|
||
bindings-introduced.js:12:19 | ||
Flags: | ||
bindings-introduced.js:12:13,12:15 | ||
|
||
bindings-introduced.js:14:14 | ||
Flags: | ||
bindings-introduced.js:14:9,14:11 | ||
|
||
pattern-identifier.js:6:5 | ||
Flags: | ||
pattern-identifier.js:3:15,3:17 | ||
|
||
pattern-identifier.js:8:6 | ||
Flags: | ||
pattern-identifier.js:3:15,3:17 | ||
|
||
pattern-member.js:6:5 | ||
Flags: | ||
pattern-member.js:3:15,3:17 | ||
|
||
pattern-member.js:8:9 | ||
Flags: | ||
pattern-member.js:3:21,3:23 | ||
|
||
pattern-object.js:6:6 | ||
Flags: | ||
pattern-object.js:6:6,6:8 | ||
|
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,11 @@ | ||
declare const x: mixed; | ||
|
||
declare const foo: 1; | ||
|
||
const e = match (x) { | ||
foo: 0, | ||
// ^ | ||
[foo]: 0, | ||
// ^ | ||
_: 0, | ||
}; |
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,11 @@ | ||
declare const x: mixed; | ||
|
||
declare const Obj: {bar: 1}; | ||
|
||
const e = match (x) { | ||
Obj.foo: 0, | ||
// ^ | ||
Obj.bar: 0, | ||
// ^ | ||
_: 0, | ||
}; |
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,9 @@ | ||
declare const x: mixed; | ||
|
||
declare const foo: 1; // Is not def | ||
|
||
const e = match (x) { | ||
{foo: true}: 0, | ||
// ^ | ||
_: 0, | ||
}; |
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,10 @@ | ||
#!/bin/bash | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# | ||
# This source code is licensed under the MIT license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
queries_in_file "get-def" "bindings-introduced.js" | ||
queries_in_file "get-def" "pattern-identifier.js" | ||
queries_in_file "get-def" "pattern-member.js" | ||
queries_in_file "get-def" "pattern-object.js" |