| 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 |
| 11 import 'dart:io' show BytesBuilder, Directory, File, exitCode; | 11 import 'dart:io' show BytesBuilder, Directory, File, exitCode; |
| 12 | 12 |
| 13 import 'package:front_end/file_system.dart'; | 13 import 'package:front_end/file_system.dart'; |
| 14 import 'package:front_end/physical_file_system.dart'; | 14 import 'package:front_end/physical_file_system.dart'; |
| 15 import 'package:front_end/src/fasta/kernel/utils.dart'; | 15 import 'package:front_end/src/fasta/kernel/utils.dart'; |
| 16 import 'package:kernel/binary/ast_to_binary.dart' | 16 import 'package:kernel/binary/ast_to_binary.dart' |
| 17 show LibraryFilteringBinaryPrinter; | 17 show LibraryFilteringBinaryPrinter; |
| 18 | 18 |
| 19 import 'package:kernel/core_types.dart' show CoreTypes; |
| 20 |
| 19 import 'package:kernel/kernel.dart' show Library, Program, loadProgramFromBytes; | 21 import 'package:kernel/kernel.dart' show Library, Program, loadProgramFromBytes; |
| 20 | 22 |
| 21 import 'package:kernel/target/targets.dart' show Target, TargetFlags, getTarget; | 23 import 'package:kernel/target/targets.dart' show Target, TargetFlags, getTarget; |
| 22 | 24 |
| 23 import 'compiler_command_line.dart' show CompilerCommandLine; | 25 import 'compiler_command_line.dart' show CompilerCommandLine; |
| 24 | 26 |
| 25 import 'compiler_context.dart' show CompilerContext; | 27 import 'compiler_context.dart' show CompilerContext; |
| 26 | 28 |
| 27 import 'errors.dart' show InputError, formatUnexpected, inputError, reportCrash; | 29 import 'errors.dart' show InputError, formatUnexpected, inputError, reportCrash; |
| 28 | 30 |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 } on InputError catch (e) { | 215 } on InputError catch (e) { |
| 214 return new CompilationResult.error(e.format()); | 216 return new CompilationResult.error(e.format()); |
| 215 } | 217 } |
| 216 | 218 |
| 217 if (program.mainMethod == null) { | 219 if (program.mainMethod == null) { |
| 218 return new CompilationResult.error("No 'main' method found."); | 220 return new CompilationResult.error("No 'main' method found."); |
| 219 } | 221 } |
| 220 | 222 |
| 221 // Perform target-specific transformations. | 223 // Perform target-specific transformations. |
| 222 Target target = getTarget("vm", new TargetFlags(strongMode: false)); | 224 Target target = getTarget("vm", new TargetFlags(strongMode: false)); |
| 223 target.performModularTransformations(program); | 225 CoreTypes coreTypes = new CoreTypes(program); |
| 224 target.performGlobalTransformations(program); | 226 target.performModularTransformations(coreTypes, program); |
| 227 target.performGlobalTransformations(coreTypes, program); |
| 225 | 228 |
| 226 // Write the program to a list of bytes and return it. Do not include | 229 // Write the program to a list of bytes and return it. Do not include |
| 227 // libraries that have a dart: import URI. | 230 // libraries that have a dart: import URI. |
| 228 // | 231 // |
| 229 // TODO(kmillikin): This is intended to exclude platform libraries that are | 232 // TODO(kmillikin): This is intended to exclude platform libraries that are |
| 230 // included in the Kernel binary platform platform.dill. It does not | 233 // included in the Kernel binary platform platform.dill. It does not |
| 231 // necessarily exclude exactly the platform libraries. Use a better | 234 // necessarily exclude exactly the platform libraries. Use a better |
| 232 // predicate that knows what is included in platform.dill. | 235 // predicate that knows what is included in platform.dill. |
| 233 var sink = new ByteSink(); | 236 var sink = new ByteSink(); |
| 234 bool predicate(Library library) => !library.importUri.isScheme('dart'); | 237 bool predicate(Library library) => !library.importUri.isScheme('dart'); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 final BytesBuilder builder = new BytesBuilder(); | 304 final BytesBuilder builder = new BytesBuilder(); |
| 302 | 305 |
| 303 void add(List<int> data) { | 306 void add(List<int> data) { |
| 304 builder.add(data); | 307 builder.add(data); |
| 305 } | 308 } |
| 306 | 309 |
| 307 void close() { | 310 void close() { |
| 308 // Nothing to do. | 311 // Nothing to do. |
| 309 } | 312 } |
| 310 } | 313 } |
| OLD | NEW |