| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 Uri uri = Uri.base.resolve(argument); | 141 Uri uri = Uri.base.resolve(argument); |
| 142 String path = uriTranslator.translate(uri)?.path ?? argument; | 142 String path = uriTranslator.translate(uri)?.path ?? argument; |
| 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, libraryFilter: kernelTarget.isSourceLibrary); |
| 152 } | 152 } |
| 153 if (output != null) { | 153 if (output != null) { |
| 154 await writeProgramToFile(outline, output); | 154 await writeProgramToFile(outline, output); |
| 155 ticker.logMs("Wrote outline to ${output.toFilePath()}"); | 155 ticker.logMs("Wrote outline to ${output.toFilePath()}"); |
| 156 } | 156 } |
| 157 return kernelTarget; | 157 return kernelTarget; |
| 158 } | 158 } |
| 159 | 159 |
| 160 Future<Uri> compile() async { | 160 Future<Uri> compile() async { |
| 161 KernelTarget kernelTarget = await buildOutline(); | 161 KernelTarget kernelTarget = await buildOutline(); |
| 162 if (exitCode != 0) return null; | 162 if (exitCode != 0) return null; |
| 163 Uri uri = c.options.output; | 163 Uri uri = c.options.output; |
| 164 var program = await kernelTarget.buildProgram(verify: c.options.verify); | 164 var program = await kernelTarget.buildProgram(verify: c.options.verify); |
| 165 if (c.options.dumpIr) printProgramText(program); | 165 if (c.options.dumpIr) { |
| 166 printProgramText(program, libraryFilter: kernelTarget.isSourceLibrary); |
| 167 } |
| 166 await writeProgramToFile(program, uri); | 168 await writeProgramToFile(program, uri); |
| 167 ticker.logMs("Wrote program to ${uri.toFilePath()}"); | 169 ticker.logMs("Wrote program to ${uri.toFilePath()}"); |
| 168 return uri; | 170 return uri; |
| 169 } | 171 } |
| 170 } | 172 } |
| 171 | 173 |
| 172 Future<CompilationResult> parseScript( | 174 Future<CompilationResult> parseScript( |
| 173 Uri fileName, Uri packages, Uri patchedSdk, | 175 Uri fileName, Uri packages, Uri patchedSdk, |
| 174 {bool verbose: false, bool strongMode: false}) async { | 176 {bool verbose: false, bool strongMode: false}) async { |
| 175 return parseScriptInFileSystem( | 177 return parseScriptInFileSystem( |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 final BytesBuilder builder = new BytesBuilder(); | 299 final BytesBuilder builder = new BytesBuilder(); |
| 298 | 300 |
| 299 void add(List<int> data) { | 301 void add(List<int> data) { |
| 300 builder.add(data); | 302 builder.add(data); |
| 301 } | 303 } |
| 302 | 304 |
| 303 void close() { | 305 void close() { |
| 304 // Nothing to do. | 306 // Nothing to do. |
| 305 } | 307 } |
| 306 } | 308 } |
| OLD | NEW |