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 | 5 |
6 /** | 6 /** |
7 * If true, print a warning for each method that was resolved, but not | 7 * If true, print a warning for each method that was resolved, but not |
8 * compiled. | 8 * compiled. |
9 */ | 9 */ |
10 final bool REPORT_EXCESS_RESOLUTION = false; | 10 final bool REPORT_EXCESS_RESOLUTION = false; |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 | 372 |
373 //patchDartLibrary(coreLibrary, 'core'); | 373 //patchDartLibrary(coreLibrary, 'core'); |
374 //patchDartLibrary(coreImplLibrary, 'coreimpl'); | 374 //patchDartLibrary(coreImplLibrary, 'coreimpl'); |
375 } | 375 } |
376 | 376 |
377 void patchDartLibrary(LibraryElement library, String dartLibraryPath) { | 377 void patchDartLibrary(LibraryElement library, String dartLibraryPath) { |
378 if (library.isPatched) return; | 378 if (library.isPatched) return; |
379 Uri patchUri = resolvePatchUri(dartLibraryPath); | 379 Uri patchUri = resolvePatchUri(dartLibraryPath); |
380 if (patchUri !== null) { | 380 if (patchUri !== null) { |
381 patchParser.patchLibrary(patchUri, library); | 381 patchParser.patchLibrary(patchUri, library); |
382 // We allow foreign functions in patched libraries. | |
383 addForeignFunctions(library); // Is safe even if already added. | |
384 // TODO(lrn): Make this lazy. | 382 // TODO(lrn): Make this lazy. |
385 applyClassPatches(library); | 383 applyClassPatches(library); |
386 } | 384 } |
387 } | 385 } |
388 | 386 |
389 void applyClassPatches(LibraryElement library) { | 387 void applyClassPatches(LibraryElement library) { |
390 for (Element element in library.localMembers) { | 388 for (Element element in library.localMembers) { |
391 if (element.isClass()) { | 389 if (element.isClass()) { |
392 ClassElement classElement = element; | 390 ClassElement classElement = element; |
393 if (classElement.isPatched) { | 391 if (classElement.isPatched) { |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 final endOffset = end.charOffset + end.slowCharCount; | 933 final endOffset = end.charOffset + end.slowCharCount; |
936 | 934 |
937 // [begin] and [end] might be the same for the same empty token. This | 935 // [begin] and [end] might be the same for the same empty token. This |
938 // happens for instance when scanning '$$'. | 936 // happens for instance when scanning '$$'. |
939 assert(endOffset >= beginOffset); | 937 assert(endOffset >= beginOffset); |
940 return f(beginOffset, endOffset); | 938 return f(beginOffset, endOffset); |
941 } | 939 } |
942 | 940 |
943 String toString() => 'SourceSpan($uri, $begin, $end)'; | 941 String toString() => 'SourceSpan($uri, $begin, $end)'; |
944 } | 942 } |
OLD | NEW |