| 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:uri'); | 7 #import('dart:uri'); |
| 8 | 8 |
| 9 #import('../compiler.dart', prefix: 'api'); | 9 #import('../compiler.dart', prefix: 'api'); |
| 10 #import('leg.dart', prefix: 'leg'); | 10 #import('leg.dart', prefix: 'leg'); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 String lookupLibraryPath(String dartLibraryName) { | 41 String lookupLibraryPath(String dartLibraryName) { |
| 42 LibraryInfo info = LIBRARIES[dartLibraryName]; | 42 LibraryInfo info = LIBRARIES[dartLibraryName]; |
| 43 if (info === null) return null; | 43 if (info === null) return null; |
| 44 if (!info.isDart2jsLibrary) return null; | 44 if (!info.isDart2jsLibrary) return null; |
| 45 String path = info.dart2jsPath; | 45 String path = info.dart2jsPath; |
| 46 if (path === null) { | 46 if (path === null) { |
| 47 path = info.path; | 47 path = info.path; |
| 48 } | 48 } |
| 49 return "lib/$path"; | 49 return "lib/$path"; |
| 50 } | 50 } |
| 51 |
| 51 String lookupPatchPath(String dartLibraryName) { | 52 String lookupPatchPath(String dartLibraryName) { |
| 52 LibraryInfo info = LIBRARIES[dartLibraryName]; | 53 LibraryInfo info = LIBRARIES[dartLibraryName]; |
| 53 if (info === null) return null; | 54 if (info === null) return null; |
| 54 if (!info.isDart2jsLibrary) return null; | 55 if (!info.isDart2jsLibrary) return null; |
| 55 String path = info.dart2jsPatchPath; | 56 String path = info.dart2jsPatchPath; |
| 56 if (path === null) return null; | 57 if (path === null) return null; |
| 57 return "lib/$path"; | 58 return "lib/$path"; |
| 58 } | 59 } |
| 59 | 60 |
| 60 elements.LibraryElement scanBuiltinLibrary(String path) { | 61 elements.LibraryElement scanBuiltinLibrary(String path) { |
| 61 Uri uri = libraryRoot.resolve(lookupLibraryPath(path)); | 62 Uri uri = libraryRoot.resolve(lookupLibraryPath(path)); |
| 62 Uri canonicalUri; | 63 Uri canonicalUri = null; |
| 63 if (path.startsWith("_")) { | 64 if (!path.startsWith("_")) { |
| 64 canonicalUri = uri; | |
| 65 } else { | |
| 66 canonicalUri = new Uri.fromComponents(scheme: "dart", path: path); | 65 canonicalUri = new Uri.fromComponents(scheme: "dart", path: path); |
| 67 } | 66 } |
| 68 elements.LibraryElement library = | 67 elements.LibraryElement library = |
| 69 scanner.loadLibrary(uri, null, canonicalUri); | 68 scanner.loadLibrary(uri, null, canonicalUri); |
| 70 return library; | 69 return library; |
| 71 } | 70 } |
| 72 | 71 |
| 73 void log(message) { | 72 void log(message) { |
| 74 handler(null, null, null, message, api.Diagnostic.VERBOSE_INFO); | 73 handler(null, null, null, message, api.Diagnostic.VERBOSE_INFO); |
| 75 } | 74 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 handler(translateUri(span.uri, null), span.begin, span.end, | 144 handler(translateUri(span.uri, null), span.begin, span.end, |
| 146 message, kind); | 145 message, kind); |
| 147 } | 146 } |
| 148 } | 147 } |
| 149 | 148 |
| 150 bool get isMockCompilation { | 149 bool get isMockCompilation { |
| 151 return mockableLibraryUsed | 150 return mockableLibraryUsed |
| 152 && (options.indexOf('--allow-mock-compilation') !== -1); | 151 && (options.indexOf('--allow-mock-compilation') !== -1); |
| 153 } | 152 } |
| 154 } | 153 } |
| OLD | NEW |