File tree Expand file tree Collapse file tree 3 files changed +258
-231
lines changed Expand file tree Collapse file tree 3 files changed +258
-231
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ mod peephole;
5
5
use oxc_allocator:: Allocator ;
6
6
use oxc_codegen:: { CodeGenerator , CodegenOptions } ;
7
7
use oxc_minifier:: { CompressOptions , Compressor } ;
8
- use oxc_parser:: Parser ;
8
+ use oxc_parser:: { ParseOptions , Parser } ;
9
9
use oxc_span:: SourceType ;
10
10
11
11
pub ( crate ) fn test ( source_text : & str , expected : & str , options : CompressOptions ) {
@@ -28,7 +28,12 @@ pub(crate) fn run(
28
28
options : Option < CompressOptions > ,
29
29
) -> String {
30
30
let allocator = Allocator :: default ( ) ;
31
- let ret = Parser :: new ( & allocator, source_text, source_type) . parse ( ) ;
31
+ let ret = Parser :: new ( & allocator, source_text, source_type)
32
+ . with_options ( ParseOptions {
33
+ allow_return_outside_function : true ,
34
+ ..ParseOptions :: default ( )
35
+ } )
36
+ . parse ( ) ;
32
37
assert ! ( !ret. panicked, "{source_text}" ) ;
33
38
assert ! ( ret. errors. is_empty( ) , "{source_text}" ) ;
34
39
let mut program = ret. program ;
You can’t perform that action at this time.
0 commit comments