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/core_types.dart'; |
15 import 'package:kernel/verifier.dart'; | 16 import 'package:kernel/verifier.dart'; |
16 import 'package:kernel/kernel.dart'; | 17 import 'package:kernel/kernel.dart'; |
17 import 'package:kernel/log.dart'; | 18 import 'package:kernel/log.dart'; |
18 import 'package:kernel/target/targets.dart'; | 19 import 'package:kernel/target/targets.dart'; |
19 import 'package:kernel/transformations/treeshaker.dart'; | 20 import 'package:kernel/transformations/treeshaker.dart'; |
20 import 'package:path/path.dart' as path; | 21 import 'package:path/path.dart' as path; |
21 | 22 |
22 // Returns the path to the current sdk based on `Platform.resolvedExecutable`. | 23 // Returns the path to the current sdk based on `Platform.resolvedExecutable`. |
23 String currentSdk() { | 24 String currentSdk() { |
24 // The dart executable should be inside dart-sdk/bin/dart. | 25 // The dart executable should be inside dart-sdk/bin/dart. |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 if (canContinueCompilation) { | 399 if (canContinueCompilation) { |
399 runVerifier(); | 400 runVerifier(); |
400 } | 401 } |
401 | 402 |
402 if (options['link'] && program.mainMethodName == null) { | 403 if (options['link'] && program.mainMethodName == null) { |
403 fail('[error] The program has no main method.'); | 404 fail('[error] The program has no main method.'); |
404 } | 405 } |
405 | 406 |
406 // Apply target-specific transformations. | 407 // Apply target-specific transformations. |
407 if (target != null && canContinueCompilation) { | 408 if (target != null && canContinueCompilation) { |
408 target.performModularTransformations(program); | 409 CoreTypes coreTypes = new CoreTypes(program); |
| 410 target.performModularTransformations(coreTypes, program); |
409 runVerifier(); | 411 runVerifier(); |
410 if (options['link']) { | 412 if (options['link']) { |
411 target.performGlobalTransformations(program); | 413 target.performGlobalTransformations(coreTypes, program); |
412 runVerifier(); | 414 runVerifier(); |
413 } | 415 } |
414 } | 416 } |
415 | 417 |
416 if (options['no-output']) { | 418 if (options['no-output']) { |
417 return CompilerOutcome.Ok; | 419 return CompilerOutcome.Ok; |
418 } | 420 } |
419 | 421 |
420 watch.reset(); | 422 watch.reset(); |
421 | 423 |
(...skipping 23 matching lines...) Expand all Loading... |
445 int flushTime = watch.elapsedMilliseconds - time; | 447 int flushTime = watch.elapsedMilliseconds - time; |
446 print('writer.flush_time = $flushTime ms'); | 448 print('writer.flush_time = $flushTime ms'); |
447 } | 449 } |
448 | 450 |
449 if (options['tolerant']) { | 451 if (options['tolerant']) { |
450 return CompilerOutcome.Ok; | 452 return CompilerOutcome.Ok; |
451 } | 453 } |
452 | 454 |
453 return errors.length > 0 ? CompilerOutcome.Fail : CompilerOutcome.Ok; | 455 return errors.length > 0 ? CompilerOutcome.Fail : CompilerOutcome.Ok; |
454 } | 456 } |
OLD | NEW |