| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 String lookupLibraryPath(String dartLibraryName) { | 49 String lookupLibraryPath(String dartLibraryName) { |
| 50 LibraryInfo info = LIBRARIES[dartLibraryName]; | 50 LibraryInfo info = LIBRARIES[dartLibraryName]; |
| 51 if (info === null) return null; | 51 if (info === null) return null; |
| 52 if (!info.isDart2jsLibrary) return null; | 52 if (!info.isDart2jsLibrary) return null; |
| 53 String path = info.dart2jsPath; | 53 String path = info.dart2jsPath; |
| 54 if (path === null) { | 54 if (path === null) { |
| 55 path = info.path; | 55 path = info.path; |
| 56 } | 56 } |
| 57 return "lib/$path"; | 57 return "lib/$path"; |
| 58 } | 58 } |
| 59 |
| 59 String lookupPatchPath(String dartLibraryName) { | 60 String lookupPatchPath(String dartLibraryName) { |
| 60 LibraryInfo info = LIBRARIES[dartLibraryName]; | 61 LibraryInfo info = LIBRARIES[dartLibraryName]; |
| 61 if (info === null) return null; | 62 if (info === null) return null; |
| 62 if (!info.isDart2jsLibrary) return null; | 63 if (!info.isDart2jsLibrary) return null; |
| 63 String path = info.dart2jsPatchPath; | 64 String path = info.dart2jsPatchPath; |
| 64 if (path === null) return null; | 65 if (path === null) return null; |
| 65 return "lib/$path"; | 66 return "lib/$path"; |
| 66 } | 67 } |
| 67 | 68 |
| 68 elements.LibraryElement scanBuiltinLibrary(String path) { | 69 elements.LibraryElement scanBuiltinLibrary(String path) { |
| 69 Uri uri = libraryRoot.resolve(lookupLibraryPath(path)); | 70 Uri uri = libraryRoot.resolve(lookupLibraryPath(path)); |
| 70 Uri canonicalUri; | 71 Uri canonicalUri = null; |
| 71 if (path.startsWith("_")) { | 72 if (!path.startsWith("_")) { |
| 72 canonicalUri = uri; | |
| 73 } else { | |
| 74 canonicalUri = new Uri.fromComponents(scheme: "dart", path: path); | 73 canonicalUri = new Uri.fromComponents(scheme: "dart", path: path); |
| 75 } | 74 } |
| 76 elements.LibraryElement library = | 75 elements.LibraryElement library = |
| 77 scanner.loadLibrary(uri, null, canonicalUri); | 76 scanner.loadLibrary(uri, null, canonicalUri); |
| 78 return library; | 77 return library; |
| 79 } | 78 } |
| 80 | 79 |
| 81 void log(message) { | 80 void log(message) { |
| 82 handler(null, null, null, message, api.Diagnostic.VERBOSE_INFO); | 81 handler(null, null, null, message, api.Diagnostic.VERBOSE_INFO); |
| 83 } | 82 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 handler(translateUri(span.uri, null), span.begin, span.end, | 152 handler(translateUri(span.uri, null), span.begin, span.end, |
| 154 message, kind); | 153 message, kind); |
| 155 } | 154 } |
| 156 } | 155 } |
| 157 | 156 |
| 158 bool get isMockCompilation { | 157 bool get isMockCompilation { |
| 159 return mockableLibraryUsed | 158 return mockableLibraryUsed |
| 160 && (options.indexOf('--allow-mock-compilation') !== -1); | 159 && (options.indexOf('--allow-mock-compilation') !== -1); |
| 161 } | 160 } |
| 162 } | 161 } |
| OLD | NEW |