This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 660
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* fix(rome_js_parser): Crash at empty default export #4670 * fix(rome_js_parser): Crash at empty default export #4670
- Loading branch information
1 parent
2716986
commit ac69cfa
Showing
4 changed files
with
214 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
4 changes: 4 additions & 0 deletions
4
crates/rome_js_parser/test_data/inline/err/export_default_expression_broken.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,4 @@ | ||
export default ; | ||
export default @decorator | ||
export default | ||
export default @decorator |
203 changes: 203 additions & 0 deletions
203
crates/rome_js_parser/test_data/inline/err/export_default_expression_broken.rast
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,203 @@ | ||
JsModule { | ||
interpreter_token: missing (optional), | ||
directives: JsDirectiveList [], | ||
items: JsModuleItemList [ | ||
JsBogusStatement { | ||
items: [ | ||
JsDecoratorList [], | ||
[email protected] "export" [] [Whitespace(" ")], | ||
[email protected] "default" [] [Whitespace(" ")], | ||
], | ||
}, | ||
JsEmptyStatement { | ||
semicolon_token: [email protected] ";" [] [], | ||
}, | ||
JsBogusStatement { | ||
items: [ | ||
JsDecoratorList [], | ||
[email protected] "export" [Newline("\n")] [Whitespace(" ")], | ||
[email protected] "default" [] [Whitespace(" ")], | ||
JsBogusStatement { | ||
items: [ | ||
JsDecorator { | ||
at_token: [email protected] "@" [] [], | ||
expression: JsIdentifierExpression { | ||
name: JsReferenceIdentifier { | ||
value_token: [email protected] "decorator" [] [], | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
JsBogusStatement { | ||
items: [ | ||
JsDecoratorList [], | ||
[email protected] "export" [Newline("\n")] [Whitespace(" ")], | ||
[email protected] "default" [] [], | ||
], | ||
}, | ||
JsBogusStatement { | ||
items: [ | ||
JsDecoratorList [], | ||
[email protected] "export" [Newline("\n")] [Whitespace(" ")], | ||
[email protected] "default" [] [Whitespace(" ")], | ||
JsBogusStatement { | ||
items: [ | ||
JsDecorator { | ||
at_token: [email protected] "@" [] [], | ||
expression: JsIdentifierExpression { | ||
name: JsReferenceIdentifier { | ||
value_token: [email protected] "decorator" [] [], | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
eof_token: [email protected] "" [Newline("\n")] [], | ||
} | ||
|
||
0: [email protected] | ||
0: (empty) | ||
1: [email protected] | ||
2: [email protected] | ||
0: [email protected] | ||
0: [email protected] | ||
1: [email protected] "export" [] [Whitespace(" ")] | ||
2: [email protected] "default" [] [Whitespace(" ")] | ||
1: [email protected] | ||
0: [email protected] ";" [] [] | ||
2: [email protected] | ||
0: [email protected] | ||
1: [email protected] "export" [Newline("\n")] [Whitespace(" ")] | ||
2: [email protected] "default" [] [Whitespace(" ")] | ||
3: [email protected] | ||
0: [email protected] | ||
0: [email protected] "@" [] [] | ||
1: [email protected] | ||
0: [email protected] | ||
0: [email protected] "decorator" [] [] | ||
3: [email protected] | ||
0: [email protected] | ||
1: [email protected] "export" [Newline("\n")] [Whitespace(" ")] | ||
2: [email protected] "default" [] [] | ||
4: [email protected] | ||
0: [email protected] | ||
1: [email protected] "export" [Newline("\n")] [Whitespace(" ")] | ||
2: [email protected] "default" [] [Whitespace(" ")] | ||
3: [email protected] | ||
0: [email protected] | ||
0: [email protected] "@" [] [] | ||
1: [email protected] | ||
0: [email protected] | ||
0: [email protected] "decorator" [] [] | ||
3: [email protected] "" [Newline("\n")] [] | ||
-- | ||
export_default_expression_broken.js:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
|
||
× expected a class, a function, or a variable declaration but instead found ';' | ||
|
||
> 1 │ export default ; | ||
│ ^ | ||
2 │ export default @decorator | ||
3 │ export default | ||
|
||
i Expected a class, a function, or a variable declaration here | ||
|
||
> 1 │ export default ; | ||
│ ^ | ||
2 │ export default @decorator | ||
3 │ export default | ||
|
||
-- | ||
export_default_expression_broken.js:2:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
|
||
× Decorators are not valid here. | ||
|
||
1 │ export default ; | ||
> 2 │ export default @decorator | ||
│ ^^^^^^^^^^ | ||
3 │ export default | ||
4 │ export default @decorator | ||
|
||
i Decorators are only valid on class declarations, class expressions, and class methods. | ||
|
||
-- | ||
export_default_expression_broken.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
|
||
× expected a class, a function, or a variable declaration but instead found 'export' | ||
|
||
1 │ export default ; | ||
2 │ export default @decorator | ||
> 3 │ export default | ||
│ ^^^^^^ | ||
4 │ export default @decorator | ||
5 │ | ||
|
||
i Expected a class, a function, or a variable declaration here | ||
|
||
1 │ export default ; | ||
2 │ export default @decorator | ||
> 3 │ export default | ||
│ ^^^^^^ | ||
4 │ export default @decorator | ||
5 │ | ||
|
||
-- | ||
export_default_expression_broken.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
|
||
× expected a class, a function, or a variable declaration but instead found 'export' | ||
|
||
2 │ export default @decorator | ||
3 │ export default | ||
> 4 │ export default @decorator | ||
│ ^^^^^^ | ||
5 │ | ||
|
||
i Expected a class, a function, or a variable declaration here | ||
|
||
2 │ export default @decorator | ||
3 │ export default | ||
> 4 │ export default @decorator | ||
│ ^^^^^^ | ||
5 │ | ||
|
||
-- | ||
export_default_expression_broken.js:4:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
|
||
× Decorators are not valid here. | ||
|
||
2 │ export default @decorator | ||
3 │ export default | ||
> 4 │ export default @decorator | ||
│ ^^^^^^^^^^ | ||
5 │ | ||
|
||
i Decorators are only valid on class declarations, class expressions, and class methods. | ||
|
||
-- | ||
export_default_expression_broken.js:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
|
||
× expected a class, a function, or a variable declaration but instead found the end of the file | ||
|
||
3 │ export default | ||
4 │ export default @decorator | ||
> 5 │ | ||
│ | ||
|
||
i Expected a class, a function, or a variable declaration here | ||
|
||
3 │ export default | ||
4 │ export default @decorator | ||
> 5 │ | ||
│ | ||
|
||
-- | ||
export default ; | ||
export default @decorator | ||
export default | ||
export default @decorator |