File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -121,7 +121,11 @@ impl<'a> ParserImpl<'a> {
121121 let type_parameters = self . parse_ts_type_parameters ( ) ;
122122 let ( this_param, params) = self . parse_formal_parameters ( func_kind, param_kind) ;
123123 let return_type = if self . is_ts { self . parse_ts_return_type_annotation ( ) } else { None } ;
124- let body = if self . at ( Kind :: LCurly ) { Some ( self . parse_function_body ( ) ) } else { None } ;
124+ let body = if self . at ( Kind :: LCurly ) || func_kind == FunctionKind :: Expression {
125+ Some ( self . parse_function_body ( ) )
126+ } else {
127+ None
128+ } ;
125129 self . ctx =
126130 self . ctx . and_in ( ctx. has_in ( ) ) . and_await ( ctx. has_await ( ) ) . and_yield ( ctx. has_yield ( ) ) ;
127131 if !self . is_ts && body. is_none ( ) {
Original file line number Diff line number Diff line change 1+ const x = function foo ( ) ;
Original file line number Diff line number Diff line change 11parser_misc Summary :
22AST Parsed : 49 / 49 (100.00 % )
33Positive Passed : 49 / 49 (100.00 % )
4- Negative Passed : 92 / 92 (100.00 % )
4+ Negative Passed : 93 / 93 (100.00 % )
55
66 × Cannot assign to ' arguments' in strict mode
77 ╭─[misc / fail / arguments - eval .ts :1 :10 ]
@@ -2899,6 +2899,13 @@ Negative Passed: 92/92 (100.00%)
28992899 6 │ }
29002900 ╰────
29012901
2902+ × Expected ` { ` but found ` ;`
2903+ ╭─[misc/fail/oxc-14944.ts:1:25]
2904+ 1 │ const x = function foo();
2905+ · ┬
2906+ · ╰── ` {` expected
2907+ ╰────
2908+
29022909 × Unexpected token
29032910 ╭─[misc/fail/oxc-169.js:2 :1 ]
29042911 1 │ 1 < (V = 82 << t - j0 < (V = $ < LBI < (V = ut < I < (V = $ < LBI < (V = uIV = 82 << t - j0 < (V = $ < LBI < (V = ut < I < (V = $ < LBI < (V <II >
You can’t perform that action at this time.
0 commit comments