Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 'dart:collection' show HashSet, Queue; | 5 import 'dart:collection' show HashSet, Queue; |
| 6 import 'package:analyzer/dart/element/element.dart' show LibraryElement; | 6 import 'package:analyzer/dart/element/element.dart' show LibraryElement; |
| 7 import 'package:analyzer/analyzer.dart' | 7 import 'package:analyzer/analyzer.dart' |
| 8 show AnalysisError, CompilationUnit, ErrorSeverity; | 8 show AnalysisError, CompilationUnit, ErrorSeverity; |
| 9 import 'package:analyzer/file_system/file_system.dart' show ResourceProvider; | 9 import 'package:analyzer/file_system/file_system.dart' show ResourceProvider; |
| 10 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext; | 10 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext; |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 241 moduleFormat = parseModuleFormat(args['modules']), | 241 moduleFormat = parseModuleFormat(args['modules']), |
| 242 hoistInstanceCreation = args['hoist-instance-creation'], | 242 hoistInstanceCreation = args['hoist-instance-creation'], |
| 243 hoistSignatureTypes = args['hoist-signature-types'], | 243 hoistSignatureTypes = args['hoist-signature-types'], |
| 244 nameTypeTests = args['name-type-tests'], | 244 nameTypeTests = args['name-type-tests'], |
| 245 hoistTypeTests = args['hoist-type-tests'], | 245 hoistTypeTests = args['hoist-type-tests'], |
| 246 useAngular2Whitelist = args['unsafe-angular2-whitelist']; | 246 useAngular2Whitelist = args['unsafe-angular2-whitelist']; |
| 247 | 247 |
| 248 static ArgParser addArguments(ArgParser parser) => parser | 248 static ArgParser addArguments(ArgParser parser) => parser |
| 249 ..addFlag('summarize', help: 'emit an API summary file', defaultsTo: true) | 249 ..addFlag('summarize', help: 'emit an API summary file', defaultsTo: true) |
| 250 ..addOption('summary-extension', | 250 ..addOption('summary-extension', |
| 251 help: 'file extension for Dart summary files', defaultsTo: 'sum') | 251 help: 'file extension for Dart summary files', defaultsTo: 'sum', hide: true) |
|
nweiz
2016/08/12 20:30:57
Long line.
Jennifer Messerly
2016/08/12 21:08:01
Done.
| |
| 252 ..addFlag('source-map', help: 'emit source mapping', defaultsTo: true) | 252 ..addFlag('source-map', help: 'emit source mapping', defaultsTo: true) |
| 253 ..addFlag('source-map-comment', | 253 ..addFlag('source-map-comment', |
| 254 help: 'adds a sourceMappingURL comment to the end of the JS,\n' | 254 help: 'adds a sourceMappingURL comment to the end of the JS,\n' |
| 255 'disable if using X-SourceMap header', | 255 'disable if using X-SourceMap header', |
| 256 defaultsTo: true) | 256 defaultsTo: true, hide: true) |
| 257 ..addOption('modules', | 257 ..addOption('modules', |
| 258 help: 'module pattern to emit', | 258 help: 'module pattern to emit', |
| 259 allowed: ['es6', 'legacy', 'node'], | 259 allowed: ['es6', 'legacy', 'node'], |
| 260 allowedHelp: { | 260 allowedHelp: { |
| 261 'es6': 'es6 modules', | 261 'es6': 'es6 modules', |
| 262 'legacy': 'a custom format used by dartdevc, similar to AMD', | 262 'legacy': 'a custom format used by dartdevc, similar to AMD', |
| 263 'node': 'node.js modules (https://nodejs.org/api/modules.html)' | 263 'node': 'node.js modules (https://nodejs.org/api/modules.html)' |
| 264 }, | 264 }, |
| 265 defaultsTo: 'legacy') | 265 defaultsTo: 'legacy') |
| 266 ..addFlag('emit-metadata', | 266 ..addFlag('emit-metadata', |
| 267 help: 'emit metadata annotations queriable via mirrors', | 267 help: 'emit metadata annotations queriable via mirrors', |
| 268 defaultsTo: false) | 268 defaultsTo: false) |
| 269 ..addFlag('closure-experimental', | 269 ..addFlag('closure-experimental', |
| 270 help: 'emit Closure Compiler-friendly code (experimental)', | 270 help: 'emit Closure Compiler-friendly code (experimental)', |
| 271 defaultsTo: false) | 271 defaultsTo: false) |
| 272 ..addFlag('destructure-named-params', | 272 ..addFlag('destructure-named-params', |
| 273 help: 'Destructure named parameters', defaultsTo: false) | 273 help: 'Destructure named parameters', defaultsTo: false, hide: true) |
| 274 ..addFlag('unsafe-force-compile', | 274 ..addFlag('unsafe-force-compile', |
| 275 help: 'Compile code even if it has errors. ಠ_ಠ\n' | 275 help: 'Compile code even if it has errors. ಠ_ಠ\n' |
| 276 'This has undefined behavior!', | 276 'This has undefined behavior!', |
| 277 defaultsTo: false) | 277 defaultsTo: false, hide: true) |
| 278 ..addFlag('hoist-instance-creation', | 278 ..addFlag('hoist-instance-creation', |
| 279 help: 'Hoist the class type from generic instance creations', | 279 help: 'Hoist the class type from generic instance creations', |
| 280 defaultsTo: true) | 280 defaultsTo: true, hide: true) |
| 281 ..addFlag('hoist-signature-types', | 281 ..addFlag('hoist-signature-types', |
| 282 help: 'Hoist types from class signatures', defaultsTo: false) | 282 help: 'Hoist types from class signatures', defaultsTo: false, hide: true ) |
|
nweiz
2016/08/12 20:30:57
Long line.
Jennifer Messerly
2016/08/12 21:08:01
Done.
| |
| 283 ..addFlag('name-type-tests', | 283 ..addFlag('name-type-tests', |
| 284 help: 'Name types used in type tests', defaultsTo: true) | 284 help: 'Name types used in type tests', defaultsTo: true, hide: true) |
| 285 ..addFlag('hoist-type-tests', | 285 ..addFlag('hoist-type-tests', |
| 286 help: 'Hoist types used in type tests', defaultsTo: true) | 286 help: 'Hoist types used in type tests', defaultsTo: true, hide: true) |
| 287 ..addFlag('unsafe-angular2-whitelist', defaultsTo: false, hide: true); | 287 ..addFlag('unsafe-angular2-whitelist', defaultsTo: false, hide: true); |
| 288 } | 288 } |
| 289 | 289 |
| 290 /// A unit of Dart code that can be built into a single JavaScript module. | 290 /// A unit of Dart code that can be built into a single JavaScript module. |
| 291 class BuildUnit { | 291 class BuildUnit { |
| 292 /// The name of this module. | 292 /// The name of this module. |
| 293 final String name; | 293 final String name; |
| 294 | 294 |
| 295 /// Library root. All library names are relative to this path/prefix. | 295 /// Library root. All library names are relative to this path/prefix. |
| 296 final String libraryRoot; | 296 final String libraryRoot; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 358 | 358 |
| 359 var map = new Map.from(this.sourceMap); | 359 var map = new Map.from(this.sourceMap); |
| 360 List list = new List.from(map['sources']); | 360 List list = new List.from(map['sources']); |
| 361 map['sources'] = list; | 361 map['sources'] = list; |
| 362 for (int i = 0; i < list.length; i++) { | 362 for (int i = 0; i < list.length; i++) { |
| 363 list[i] = path.relative(list[i], from: dir); | 363 list[i] = path.relative(list[i], from: dir); |
| 364 } | 364 } |
| 365 return map; | 365 return map; |
| 366 } | 366 } |
| 367 } | 367 } |
| OLD | NEW |