Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: pkg/dev_compiler/lib/src/compiler/module_builder.dart

Issue 2569783003: add verbose option to show hidden args (Closed)
Patch Set: merge Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/dev_compiler/lib/src/compiler/compiler.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'package:args/args.dart' show ArgParser, ArgResults; 5 import 'package:args/args.dart' show ArgParser, ArgResults;
6 import 'package:path/path.dart' as path; 6 import 'package:path/path.dart' as path;
7 7
8 import '../js_ast/js_ast.dart'; 8 import '../js_ast/js_ast.dart';
9 import 'js_names.dart'; 9 import 'js_names.dart';
10 10
(...skipping 27 matching lines...) Expand all
38 var format = argResults['modules']; 38 var format = argResults['modules'];
39 if (format is String) { 39 if (format is String) {
40 return [parseModuleFormat(format)]; 40 return [parseModuleFormat(format)];
41 } 41 }
42 return (format as List<String>).map(parseModuleFormat).toList(); 42 return (format as List<String>).map(parseModuleFormat).toList();
43 } 43 }
44 44
45 /// Adds an option to the [argParser] for choosing the module format, optionally 45 /// Adds an option to the [argParser] for choosing the module format, optionally
46 /// [allowMultiple] formats to be specified, with each emitted into a separate 46 /// [allowMultiple] formats to be specified, with each emitted into a separate
47 /// file. 47 /// file.
48 void addModuleFormatOptions(ArgParser argParser, {bool allowMultiple: false}) { 48 void addModuleFormatOptions(ArgParser argParser,
49 {bool allowMultiple: false, bool hide: true}) {
49 argParser 50 argParser
50 ..addOption('modules', 51 ..addOption('modules',
51 help: 'module pattern to emit', 52 help: 'module pattern to emit',
52 allowed: [ 53 allowed: [
53 'es6', 54 'es6',
54 'common', 55 'common',
55 'amd', 56 'amd',
56 'legacy', // deprecated 57 'legacy', // deprecated
57 'node', // renamed to commonjs 58 'node', // renamed to commonjs
58 'all' // to emit all flavors for the SDK 59 'all' // to emit all flavors for the SDK
59 ], 60 ],
60 allowedHelp: { 61 allowedHelp: {
61 'es6': 'ECMAScript 6 modules', 62 'es6': 'ECMAScript 6 modules',
62 'common': 'CommonJS/Node.js modules', 63 'common': 'CommonJS/Node.js modules',
63 'amd': 'AMD/RequireJS modules' 64 'amd': 'AMD/RequireJS modules'
64 }, 65 },
65 allowMultiple: allowMultiple, 66 allowMultiple: allowMultiple,
66 defaultsTo: 'amd') 67 defaultsTo: 'amd')
67 ..addFlag('single-out-file', 68 ..addFlag('single-out-file',
68 help: 'emit modules that can be concatenated into one file.\n' 69 help: 'emit modules that can be concatenated into one file.\n'
69 'Only compatible with legacy and amd module formats.', 70 'Only compatible with legacy and amd module formats.',
70 defaultsTo: false, 71 defaultsTo: false,
71 hide: true); 72 hide: hide);
72 } 73 }
73 74
74 /// Transforms an ES6 [module] into a given module [format]. 75 /// Transforms an ES6 [module] into a given module [format].
75 /// 76 ///
76 /// If the format is [ModuleFormat.es6] this will return [module] unchanged. 77 /// If the format is [ModuleFormat.es6] this will return [module] unchanged.
77 /// 78 ///
78 /// Because JS ASTs are immutable the resulting module will share as much 79 /// Because JS ASTs are immutable the resulting module will share as much
79 /// structure as possible with the original. The transformation is a shallow one 80 /// structure as possible with the original. The transformation is a shallow one
80 /// that affects the top-level module items, especially [ImportDeclaration]s and 81 /// that affects the top-level module items, especially [ImportDeclaration]s and
81 /// [ExportDeclaration]s. 82 /// [ExportDeclaration]s.
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 // Ensure the identifier first character is not numeric and that the whole 334 // Ensure the identifier first character is not numeric and that the whole
334 // identifier is not a keyword. 335 // identifier is not a keyword.
335 if (result.startsWith(new RegExp('[0-9]')) || invalidVariableName(result)) { 336 if (result.startsWith(new RegExp('[0-9]')) || invalidVariableName(result)) {
336 return '\$$result'; 337 return '\$$result';
337 } 338 }
338 return result; 339 return result;
339 } 340 }
340 341
341 // Invalid characters for identifiers, which would need to be escaped. 342 // Invalid characters for identifiers, which would need to be escaped.
342 final _invalidCharInIdentifier = new RegExp(r'[^A-Za-z_$0-9]'); 343 final _invalidCharInIdentifier = new RegExp(r'[^A-Za-z_$0-9]');
OLDNEW
« no previous file with comments | « pkg/dev_compiler/lib/src/compiler/compiler.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698