Skip to content

Commit

Permalink
[flow][match] Add test in Flow parser for export default of match exp…
Browse files Browse the repository at this point in the history
…ression

Summary:
Adds a test case for export default of a match - making sure it is parsed as a match expression and not a match statement.

Changelog: [internal]

Reviewed By: SamChou19815

Differential Revision: D65850112

fbshipit-source-id: d90374b3b7f6ff8cde7f16bee7b033d3bd17fb1a
  • Loading branch information
gkz authored and facebook-github-bot committed Nov 14, 2024
1 parent a7e42ee commit 870e4cc
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/parser/test/flow/match/export.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default match (a) {};
3 changes: 3 additions & 0 deletions src/parser/test/flow/match/export.options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"pattern_matching": true
}
28 changes: 28 additions & 0 deletions src/parser/test/flow/match/export.tree.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"type":"Program",
"loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}},
"range":[0,28],
"body":[
{
"type":"ExportDefaultDeclaration",
"loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}},
"range":[0,28],
"declaration":{
"type":"MatchExpression",
"loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":27}},
"range":[15,27],
"argument":{
"type":"Identifier",
"loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":23}},
"range":[22,23],
"name":"a",
"typeAnnotation":null,
"optional":false
},
"cases":[]
},
"exportKind":"value"
}
],
"comments":[]
}

0 comments on commit 870e4cc

Please sign in to comment.