| 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; | 5 library fasta; |
| 6 | 6 |
| 7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
| 8 | 8 |
| 9 import 'dart:convert' show JSON; | 9 import 'dart:convert' show JSON; |
| 10 | 10 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 if (path.endsWith(".dart")) { | 143 if (path.endsWith(".dart")) { |
| 144 kernelTarget.read(uri); | 144 kernelTarget.read(uri); |
| 145 } else { | 145 } else { |
| 146 inputError(uri, -1, "Unexpected input: $uri"); | 146 inputError(uri, -1, "Unexpected input: $uri"); |
| 147 } | 147 } |
| 148 await dillTarget.buildOutlines(); | 148 await dillTarget.buildOutlines(); |
| 149 var outline = await kernelTarget.buildOutlines(); | 149 var outline = await kernelTarget.buildOutlines(); |
| 150 if (c.options.dumpIr && output != null) { | 150 if (c.options.dumpIr && output != null) { |
| 151 printProgramText(outline); | 151 printProgramText(outline); |
| 152 } | 152 } |
| 153 await kernelTarget.writeOutline(output); | 153 if (output != null) { |
| 154 await writeProgramToFileUri(ticker, output, outline, |
| 155 isFullProgram: false); |
| 156 } |
| 154 return kernelTarget; | 157 return kernelTarget; |
| 155 } | 158 } |
| 156 | 159 |
| 157 Future<Uri> compile() async { | 160 Future<Uri> compile() async { |
| 158 KernelTarget kernelTarget = await buildOutline(); | 161 KernelTarget kernelTarget = await buildOutline(); |
| 159 if (exitCode != 0) return null; | 162 if (exitCode != 0) return null; |
| 160 Uri uri = c.options.output; | 163 Uri uri = c.options.output; |
| 161 var program = await kernelTarget.buildProgram(verify: c.options.verify); | 164 var program = await kernelTarget.buildProgram(verify: c.options.verify); |
| 162 if (c.options.dumpIr) printProgramText(program); | 165 if (c.options.dumpIr) printProgramText(program); |
| 163 await kernelTarget.writeProgram(uri); | 166 await writeProgramToFileUri(ticker, uri, program, isFullProgram: true); |
| 164 return uri; | 167 return uri; |
| 165 } | 168 } |
| 166 } | 169 } |
| 167 | 170 |
| 168 Future<CompilationResult> parseScript( | 171 Future<CompilationResult> parseScript( |
| 169 Uri fileName, Uri packages, Uri patchedSdk, | 172 Uri fileName, Uri packages, Uri patchedSdk, |
| 170 {bool verbose: false, bool strongMode: false}) async { | 173 {bool verbose: false, bool strongMode: false}) async { |
| 171 return parseScriptInFileSystem( | 174 return parseScriptInFileSystem( |
| 172 fileName, PhysicalFileSystem.instance, packages, patchedSdk, | 175 fileName, PhysicalFileSystem.instance, packages, patchedSdk, |
| 173 verbose: verbose, strongMode: strongMode); | 176 verbose: verbose, strongMode: strongMode); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 final BytesBuilder builder = new BytesBuilder(); | 291 final BytesBuilder builder = new BytesBuilder(); |
| 289 | 292 |
| 290 void add(List<int> data) { | 293 void add(List<int> data) { |
| 291 builder.add(data); | 294 builder.add(data); |
| 292 } | 295 } |
| 293 | 296 |
| 294 void close() { | 297 void close() { |
| 295 // Nothing to do. | 298 // Nothing to do. |
| 296 } | 299 } |
| 297 } | 300 } |
| OLD | NEW |