@@ -15,6 +15,7 @@ import 'package:yaml/yaml.dart';
15
15
16
16
const String _V8_BINARY_DEFAULT = 'node' ;
17
17
const bool _CLOSURE_DEFAULT = false ;
18
+ const bool _DESTRUCTURE_NAMED_PARAMS_DEFAULT = true ;
18
19
19
20
/// Options used to set up Source URI resolution in the analysis context.
20
21
class SourceResolverOptions {
@@ -69,6 +70,9 @@ class CodegenOptions {
69
70
/// Emit Closure Compiler-friendly code.
70
71
final bool closure;
71
72
73
+ /// Enable ES6 destructuring of named parameters.
74
+ final bool destructureNamedParams;
75
+
72
76
/// Whether to emit a workaround for missing arrow function bind-this in
73
77
/// other V8 builds
74
78
final bool arrowFnBindThisWorkaround;
@@ -81,6 +85,7 @@ class CodegenOptions {
81
85
{this .emitSourceMaps: true ,
82
86
this .forceCompile: false ,
83
87
this .closure: _CLOSURE_DEFAULT ,
88
+ this .destructureNamedParams: _DESTRUCTURE_NAMED_PARAMS_DEFAULT ,
84
89
this .outputDir,
85
90
this .arrowFnBindThisWorkaround: false ,
86
91
this .moduleFormat: 'dart' });
@@ -231,6 +236,7 @@ CompilerOptions parseOptions(List<String> argv, {bool forceOutDir: false}) {
231
236
emitSourceMaps: args['source-maps' ],
232
237
forceCompile: args['force-compile' ] || serverMode,
233
238
closure: args['closure' ],
239
+ destructureNamedParams: args['destructure-named-params' ],
234
240
outputDir: outputDir,
235
241
arrowFnBindThisWorkaround: args['arrow-fn-bind-this' ],
236
242
moduleFormat: args['modules' ]),
@@ -327,6 +333,9 @@ final ArgParser argParser = new ArgParser()
327
333
..addFlag ('closure' ,
328
334
help: 'Emit Closure Compiler-friendly code (experimental)' ,
329
335
defaultsTo: _CLOSURE_DEFAULT )
336
+ ..addFlag ('destructure-named-params' ,
337
+ help: 'Destructure named parameters (requires ES6-enabled runtime)' ,
338
+ defaultsTo: _DESTRUCTURE_NAMED_PARAMS_DEFAULT )
330
339
..addFlag ('force-compile' ,
331
340
abbr: 'f' , help: 'Compile code with static errors' , defaultsTo: false )
332
341
..addOption ('log' , abbr: 'l' , help: 'Logging level (defaults to warning)' )
0 commit comments