| 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 library fasta.compile_platform; | 5 library fasta.compile_platform; |
| 6 | 6 |
| 7 import 'dart:async' show | 7 import 'dart:async' show |
| 8 Future; | 8 Future; |
| 9 | 9 |
| 10 import 'package:kernel/verifier.dart' show | 10 import 'package:kernel/verifier.dart' show |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 Future compilePlatform(CompilerContext c, Ticker ticker) async { | 56 Future compilePlatform(CompilerContext c, Ticker ticker) async { |
| 57 ticker.isVerbose = c.options.verbose; | 57 ticker.isVerbose = c.options.verbose; |
| 58 Uri output = Uri.base.resolveUri(new Uri.file(c.options.arguments[1])); | 58 Uri output = Uri.base.resolveUri(new Uri.file(c.options.arguments[1])); |
| 59 Uri patchedSdk = | 59 Uri patchedSdk = |
| 60 Uri.base.resolveUri(new Uri.file(c.options.arguments[0])); | 60 Uri.base.resolveUri(new Uri.file(c.options.arguments[0])); |
| 61 ticker.logMs("Parsed arguments"); | 61 ticker.logMs("Parsed arguments"); |
| 62 if (ticker.isVerbose) { | 62 if (ticker.isVerbose) { |
| 63 print("Compiling $patchedSdk to $output"); | 63 print("Compiling $patchedSdk to $output"); |
| 64 } | 64 } |
| 65 | 65 |
| 66 TranslateUri uriTranslator = await TranslateUri.parse(patchedSdk); | 66 TranslateUri uriTranslator = await TranslateUri.parse( |
| 67 patchedSdk, c.options.packages); |
| 67 ticker.logMs("Read packages file"); | 68 ticker.logMs("Read packages file"); |
| 68 | 69 |
| 69 DillTarget dillTarget = new DillTarget(ticker, uriTranslator); | 70 DillTarget dillTarget = new DillTarget(ticker, uriTranslator); |
| 70 KernelTarget kernelTarget = new KernelTarget( | 71 KernelTarget kernelTarget = new KernelTarget( |
| 71 dillTarget, uriTranslator, c.uriToSource); | 72 dillTarget, uriTranslator, c.uriToSource); |
| 72 | 73 |
| 73 kernelTarget.read(Uri.parse("dart:core")); | 74 kernelTarget.read(Uri.parse("dart:core")); |
| 74 await dillTarget.writeOutline(null); | 75 await dillTarget.writeOutline(null); |
| 75 await kernelTarget.writeOutline(output); | 76 await kernelTarget.writeOutline(output); |
| 76 | 77 |
| 77 if (exitCode != 0) return null; | 78 if (exitCode != 0) return null; |
| 78 await kernelTarget.writeProgram(output, AstKind.Kernel); | 79 await kernelTarget.writeProgram(output, AstKind.Kernel); |
| 79 if (c.options.dumpIr) { | 80 if (c.options.dumpIr) { |
| 80 kernelTarget.dumpIr(); | 81 kernelTarget.dumpIr(); |
| 81 } | 82 } |
| 82 if (c.options.verify) { | 83 if (c.options.verify) { |
| 83 try { | 84 try { |
| 84 verifyProgram(kernelTarget.program); | 85 verifyProgram(kernelTarget.program); |
| 85 ticker.logMs("Verified program"); | 86 ticker.logMs("Verified program"); |
| 86 } catch (e, s) { | 87 } catch (e, s) { |
| 87 exitCode = 1; | 88 exitCode = 1; |
| 88 print("Verification of program failed: $e"); | 89 print("Verification of program failed: $e"); |
| 89 if (s != null && c.options.verbose) { | 90 if (s != null && c.options.verbose) { |
| 90 print(s); | 91 print(s); |
| 91 } | 92 } |
| 92 } | 93 } |
| 93 } | 94 } |
| 94 } | 95 } |
| OLD | NEW |