OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 leg_apiimpl; | 5 library leg_apiimpl; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import '../compiler.dart' as api; | 9 import '../compiler.dart' as api; |
10 import 'dart2jslib.dart' as leg; | 10 import 'dart2jslib.dart' as leg; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 133 |
134 String lookupPatchPath(String dartLibraryName) { | 134 String lookupPatchPath(String dartLibraryName) { |
135 LibraryInfo info = LIBRARIES[dartLibraryName]; | 135 LibraryInfo info = LIBRARIES[dartLibraryName]; |
136 if (info == null) return null; | 136 if (info == null) return null; |
137 if (!info.isDart2jsLibrary) return null; | 137 if (!info.isDart2jsLibrary) return null; |
138 String path = info.dart2jsPatchPath; | 138 String path = info.dart2jsPatchPath; |
139 if (path == null) return null; | 139 if (path == null) return null; |
140 return "lib/$path"; | 140 return "lib/$path"; |
141 } | 141 } |
142 | 142 |
143 Future<elements.LibraryElement> scanBuiltinLibrary(String path) { | |
144 Uri uri = libraryRoot.resolve(lookupLibraryPath(path)); | |
145 Uri canonicalUri = new Uri(scheme: "dart", path: path); | |
146 return libraryLoader.loadLibrary(uri, null, canonicalUri); | |
147 } | |
148 | |
149 void log(message) { | 143 void log(message) { |
150 handler(null, null, null, message, api.Diagnostic.VERBOSE_INFO); | 144 handler(null, null, null, message, api.Diagnostic.VERBOSE_INFO); |
151 } | 145 } |
152 | 146 |
153 /// See [leg.Compiler.translateResolvedUri]. | 147 /// See [leg.Compiler.translateResolvedUri]. |
154 Uri translateResolvedUri(elements.LibraryElement importingLibrary, | 148 Uri translateResolvedUri(elements.LibraryElement importingLibrary, |
155 Uri resolvedUri, tree.Node node) { | 149 Uri resolvedUri, tree.Node node) { |
156 if (resolvedUri.scheme == 'dart') { | 150 if (resolvedUri.scheme == 'dart') { |
157 return translateDartUri(importingLibrary, resolvedUri, node); | 151 return translateDartUri(importingLibrary, resolvedUri, node); |
158 } | 152 } |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 } | 331 } |
338 | 332 |
339 void diagnoseCrashInUserCode(String message, exception, stackTrace) { | 333 void diagnoseCrashInUserCode(String message, exception, stackTrace) { |
340 hasCrashed = true; | 334 hasCrashed = true; |
341 print('$message: ${tryToString(exception)}'); | 335 print('$message: ${tryToString(exception)}'); |
342 print(tryToString(stackTrace)); | 336 print(tryToString(stackTrace)); |
343 } | 337 } |
344 | 338 |
345 fromEnvironment(String name) => environment[name]; | 339 fromEnvironment(String name) => environment[name]; |
346 } | 340 } |
OLD | NEW |