OLD | NEW |
1 #!/usr/bin/env dart | 1 #!/usr/bin/env dart |
2 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
5 | 5 |
6 import 'dart:async'; | 6 import 'dart:async'; |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 | 8 |
9 import '../bin/batch_util.dart'; | 9 import '../bin/batch_util.dart'; |
10 import '../bin/util.dart'; | 10 import '../bin/util.dart'; |
11 | 11 |
12 import 'package:args/args.dart'; | 12 import 'package:args/args.dart'; |
13 import 'package:analyzer/src/kernel/loader.dart'; | 13 import 'package:analyzer/src/kernel/loader.dart'; |
14 import 'package:kernel/application_root.dart'; | 14 import 'package:kernel/application_root.dart'; |
| 15 import 'package:kernel/class_hierarchy.dart'; |
15 import 'package:kernel/core_types.dart'; | 16 import 'package:kernel/core_types.dart'; |
16 import 'package:kernel/verifier.dart'; | 17 import 'package:kernel/verifier.dart'; |
17 import 'package:kernel/kernel.dart'; | 18 import 'package:kernel/kernel.dart'; |
18 import 'package:kernel/log.dart'; | 19 import 'package:kernel/log.dart'; |
19 import 'package:kernel/target/targets.dart'; | 20 import 'package:kernel/target/targets.dart'; |
20 import 'package:kernel/transformations/treeshaker.dart'; | 21 import 'package:kernel/transformations/treeshaker.dart'; |
21 import 'package:path/path.dart' as path; | 22 import 'package:path/path.dart' as path; |
22 | 23 |
23 // Returns the path to the current sdk based on `Platform.resolvedExecutable`. | 24 // Returns the path to the current sdk based on `Platform.resolvedExecutable`. |
24 String currentSdk() { | 25 String currentSdk() { |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 runVerifier(); | 401 runVerifier(); |
401 } | 402 } |
402 | 403 |
403 if (options['link'] && program.mainMethodName == null) { | 404 if (options['link'] && program.mainMethodName == null) { |
404 fail('[error] The program has no main method.'); | 405 fail('[error] The program has no main method.'); |
405 } | 406 } |
406 | 407 |
407 // Apply target-specific transformations. | 408 // Apply target-specific transformations. |
408 if (target != null && canContinueCompilation) { | 409 if (target != null && canContinueCompilation) { |
409 CoreTypes coreTypes = new CoreTypes(program); | 410 CoreTypes coreTypes = new CoreTypes(program); |
410 target.performModularTransformations(coreTypes, program); | 411 ClassHierarchy hierarchy = new ClosedWorldClassHierarchy(program); |
| 412 target.performModularTransformations(coreTypes, hierarchy, program); |
411 runVerifier(); | 413 runVerifier(); |
412 if (options['link']) { | 414 if (options['link']) { |
413 target.performGlobalTransformations(coreTypes, program); | 415 target.performGlobalTransformations(coreTypes, program); |
414 runVerifier(); | 416 runVerifier(); |
415 } | 417 } |
416 } | 418 } |
417 | 419 |
418 if (options['no-output']) { | 420 if (options['no-output']) { |
419 return CompilerOutcome.Ok; | 421 return CompilerOutcome.Ok; |
420 } | 422 } |
(...skipping 26 matching lines...) Expand all Loading... |
447 int flushTime = watch.elapsedMilliseconds - time; | 449 int flushTime = watch.elapsedMilliseconds - time; |
448 print('writer.flush_time = $flushTime ms'); | 450 print('writer.flush_time = $flushTime ms'); |
449 } | 451 } |
450 | 452 |
451 if (options['tolerant']) { | 453 if (options['tolerant']) { |
452 return CompilerOutcome.Ok; | 454 return CompilerOutcome.Ok; |
453 } | 455 } |
454 | 456 |
455 return errors.length > 0 ? CompilerOutcome.Fail : CompilerOutcome.Ok; | 457 return errors.length > 0 ? CompilerOutcome.Fail : CompilerOutcome.Ok; |
456 } | 458 } |
OLD | NEW |