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 'dart:io' show | 10 import 'dart:io' show |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 dartSdk: createDartSdk(options.sdk, strongMode: options.strongMode)); | 91 dartSdk: createDartSdk(options.sdk, strongMode: options.strongMode)); |
92 Target target = getTarget( | 92 Target target = getTarget( |
93 "vm", new TargetFlags(strongMode: options.strongMode)); | 93 "vm", new TargetFlags(strongMode: options.strongMode)); |
94 Library dummyLibrary = repository.getLibraryReference(Uri.parse("dummy:")) | 94 Library dummyLibrary = repository.getLibraryReference(Uri.parse("dummy:")) |
95 ..isExternal = false; | 95 ..isExternal = false; |
96 Program program = | 96 Program program = |
97 loader.loadProgram(dummyLibrary.importUri, target: target); | 97 loader.loadProgram(dummyLibrary.importUri, target: target); |
98 program = new Program( | 98 program = new Program( |
99 program.libraries.where( | 99 program.libraries.where( |
100 (Library l) => l.importUri.scheme == "dart").toList(), | 100 (Library l) => l.importUri.scheme == "dart").toList(), |
101 program.uriToLineStarts); | 101 program.uriToSource); |
102 if (loader.errors.isNotEmpty) { | 102 if (loader.errors.isNotEmpty) { |
103 inputError(null, null, loader.errors.join("\n")); | 103 inputError(null, null, loader.errors.join("\n")); |
104 } | 104 } |
105 target.transformProgram(program); | 105 target.transformProgram(program); |
106 for (LibraryElement analyzerLibrary in loader.libraryElements) { | 106 for (LibraryElement analyzerLibrary in loader.libraryElements) { |
107 Library library = loader.getLibraryReference(analyzerLibrary); | 107 Library library = loader.getLibraryReference(analyzerLibrary); |
108 StringBuffer sb = new StringBuffer(); | 108 StringBuffer sb = new StringBuffer(); |
109 if (analyzerLibrary.exports.isNotEmpty) { | 109 if (analyzerLibrary.exports.isNotEmpty) { |
110 Source source; | 110 Source source; |
111 int offset; | 111 int offset; |
(...skipping 16 matching lines...) Expand all Loading... |
128 library.addMember(new Field(exports, isStatic: true, isConst: true, | 128 library.addMember(new Field(exports, isStatic: true, isConst: true, |
129 initializer: literal, fileUri: "${new Uri.file(source.fullName)}") | 129 initializer: literal, fileUri: "${new Uri.file(source.fullName)}") |
130 ..fileOffset = offset); | 130 ..fileOffset = offset); |
131 } | 131 } |
132 } | 132 } |
133 | 133 |
134 IOSink sink = new File.fromUri(output).openWrite(); | 134 IOSink sink = new File.fromUri(output).openWrite(); |
135 new BinaryPrinter(sink).writeProgramFile(program); | 135 new BinaryPrinter(sink).writeProgramFile(program); |
136 await sink.close(); | 136 await sink.close(); |
137 } | 137 } |
OLD | NEW |