| 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; | 5 import 'dart:collection' show HashSet; |
| 6 import 'package:args/args.dart' show ArgParser, ArgResults; | 6 import 'package:args/args.dart' show ArgParser, ArgResults; |
| 7 import 'package:args/src/usage_exception.dart' show UsageException; | 7 import 'package:args/src/usage_exception.dart' show UsageException; |
| 8 import 'package:analyzer/analyzer.dart' | 8 import 'package:analyzer/analyzer.dart' |
| 9 show | 9 show |
| 10 AnalysisError, | 10 AnalysisError, |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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) |
| 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 /// Build 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 buildRoot; | 296 final String libraryRoot; |
| 297 | 297 |
| 298 /// The list of sources in this module. | 298 /// The list of sources in this module. |
| 299 /// | 299 /// |
| 300 /// The set of Dart files can be arbitrarily large, but it must contain | 300 /// The set of Dart files can be arbitrarily large, but it must contain |
| 301 /// complete libraries including all of their parts, as well as all libraries | 301 /// complete libraries including all of their parts, as well as all libraries |
| 302 /// that are part of a library cycle. | 302 /// that are part of a library cycle. |
| 303 final List<String> sources; | 303 final List<String> sources; |
| 304 | 304 |
| 305 /// Given an imported library URI, this will determine to what Dart/JS module | 305 /// Given an imported library URI, this will determine to what Dart/JS module |
| 306 /// it belongs to. | 306 /// it belongs to. |
| 307 // TODO(jmesserly): we should replace this with another way of tracking | 307 // TODO(jmesserly): we should replace this with another way of tracking |
| 308 // build units. | 308 // build units. |
| 309 final Func1<Source, String> libraryToModule; | 309 final Func1<Source, String> libraryToModule; |
| 310 | 310 |
| 311 BuildUnit(this.name, this.buildRoot, this.sources, this.libraryToModule); | 311 BuildUnit(this.name, this.libraryRoot, this.sources, this.libraryToModule); |
| 312 } | 312 } |
| 313 | 313 |
| 314 /// The output of Dart->JS compilation. | 314 /// The output of Dart->JS compilation. |
| 315 /// | 315 /// |
| 316 /// This contains the file contents of the JS module, as well as a list of | 316 /// This contains the file contents of the JS module, as well as a list of |
| 317 /// Dart libraries that are contained in this module. | 317 /// Dart libraries that are contained in this module. |
| 318 class JSModuleFile { | 318 class JSModuleFile { |
| 319 /// The name of this module. | 319 /// The name of this module. |
| 320 final String name; | 320 final String name; |
| 321 | 321 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 } | 366 } |
| 367 } | 367 } |
| 368 | 368 |
| 369 /// (Public for tests) the error code used when a part is missing. | 369 /// (Public for tests) the error code used when a part is missing. |
| 370 final missingPartErrorCode = const CompileTimeErrorCode( | 370 final missingPartErrorCode = const CompileTimeErrorCode( |
| 371 'MISSING_PART', 'The part was not supplied as an input to the compiler.'); | 371 'MISSING_PART', 'The part was not supplied as an input to the compiler.'); |
| 372 | 372 |
| 373 /// (Public for tests) the error code used when a part is unused. | 373 /// (Public for tests) the error code used when a part is unused. |
| 374 final unusedPartWarningCode = const StaticWarningCode('UNUSED_PART', | 374 final unusedPartWarningCode = const StaticWarningCode('UNUSED_PART', |
| 375 'The part was not used by any libraries being compiled.', null, false); | 375 'The part was not used by any libraries being compiled.', null, false); |
| OLD | NEW |