Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(668)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/compiler.dart

Issue 11967010: Internal libraries supported. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update MockCompiler Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 part of dart2js; 5 part of dart2js;
6 6
7 /** 7 /**
8 * If true, print a warning for each method that was resolved, but not 8 * If true, print a warning for each method that was resolved, but not
9 * compiled. 9 * compiled.
10 */ 10 */
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 582
583 void importIsolateHelperLibrary(LibraryElement library) { 583 void importIsolateHelperLibrary(LibraryElement library) {
584 if (isolateHelperLibrary != null) { 584 if (isolateHelperLibrary != null) {
585 libraryLoader.importLibrary(library, isolateHelperLibrary, null); 585 libraryLoader.importLibrary(library, isolateHelperLibrary, null);
586 } 586 }
587 } 587 }
588 588
589 // TODO(karlklose,floitsch): move this to the javascript backend. 589 // TODO(karlklose,floitsch): move this to the javascript backend.
590 /** Enable the 'JS' helper for a library if needed. */ 590 /** Enable the 'JS' helper for a library if needed. */
591 void maybeEnableJSHelper(LibraryElement library) { 591 void maybeEnableJSHelper(LibraryElement library) {
592 String libraryName = library.uri.toString(); 592 String libraryName = library.canonicalUri.toString();
593 bool nativeTest = library.entryCompilationUnit.script.name.contains( 593 bool nativeTest = library.entryCompilationUnit.script.name.contains(
594 'dart/tests/compiler/dart2js_native'); 594 'dart/tests/compiler/dart2js_native');
595 if (nativeTest 595 if (nativeTest
596 || libraryName == 'dart:async' 596 || libraryName == 'dart:async'
597 || libraryName == 'dart:chrome' 597 || libraryName == 'dart:chrome'
598 || libraryName == 'dart:mirrors' 598 || libraryName == 'dart:mirrors'
599 || libraryName == 'dart:math' 599 || libraryName == 'dart:math'
600 || libraryName == 'dart:html' 600 || libraryName == 'dart:html'
601 || libraryName == 'dart:html_common' 601 || libraryName == 'dart:html_common'
602 || libraryName == 'dart:indexed_db' 602 || libraryName == 'dart:indexed_db'
(...skipping 13 matching lines...) Expand all
616 foreignLibrary.findLocal(const SourceString('JS')), this); 616 foreignLibrary.findLocal(const SourceString('JS')), this);
617 Element jsIndexingBehaviorInterface = 617 Element jsIndexingBehaviorInterface =
618 findHelper(const SourceString('JavaScriptIndexingBehavior')); 618 findHelper(const SourceString('JavaScriptIndexingBehavior'));
619 if (jsIndexingBehaviorInterface != null) { 619 if (jsIndexingBehaviorInterface != null) {
620 library.addToScope(jsIndexingBehaviorInterface, this); 620 library.addToScope(jsIndexingBehaviorInterface, this);
621 } 621 }
622 } 622 }
623 } 623 }
624 624
625 void maybeEnableIsolateHelper(LibraryElement library) { 625 void maybeEnableIsolateHelper(LibraryElement library) {
626 String libraryName = library.uri.toString(); 626 String libraryName = library.canonicalUri.toString();
627 if (libraryName == 'dart:isolate' 627 if (libraryName == 'dart:isolate'
628 || libraryName == 'dart:html' 628 || libraryName == 'dart:html'
629 // TODO(floitsch): create a separate async-helper library instead of 629 // TODO(floitsch): create a separate async-helper library instead of
630 // importing the isolate-library just for TimerImpl. 630 // importing the isolate-library just for TimerImpl.
631 || libraryName == 'dart:async') { 631 || libraryName == 'dart:async') {
632 importIsolateHelperLibrary(library); 632 importIsolateHelperLibrary(library);
633 } 633 }
634 } 634 }
635 635
636 void runCompiler(Uri uri) { 636 void runCompiler(Uri uri) {
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 Element element = instruction.sourceElement; 937 Element element = instruction.sourceElement;
938 if (element == null) element = currentElement; 938 if (element == null) element = currentElement;
939 var position = instruction.sourcePosition; 939 var position = instruction.sourcePosition;
940 if (position == null) return spanFromElement(element); 940 if (position == null) return spanFromElement(element);
941 Token token = position.token; 941 Token token = position.token;
942 if (token == null) return spanFromElement(element); 942 if (token == null) return spanFromElement(element);
943 Uri uri = element.getCompilationUnit().script.uri; 943 Uri uri = element.getCompilationUnit().script.uri;
944 return spanFromTokens(token, token, uri); 944 return spanFromTokens(token, token, uri);
945 } 945 }
946 946
947 Script readScript(Uri uri, [Node node]) { 947 /**
948 * Resolves the [absoluteUri] into a readable URI.
949 *
950 * The [importingLibrary] holds the library importing [absoluteUri] or
951 * [:null:] if [absoluteUri] is loaded as the main library. The
952 * [importingLibrary] is used to grant access to internal libraries from
953 * platform libraries and patch libraries.
954 *
955 * This method is responsible for reporting errors if the [absoluteUri] is
956 * not accessible from [importingLibrary] and returns [:null:] in this case.
ahe 2013/01/24 10:00:57 Depending on how you respond to my comment in apii
Johnni Winther 2013/01/24 13:04:59 Done.
957 *
958 * See [LibraryLoader] for terminology on URIs.
959 */
960 Uri resolveAbsoluteUri(LibraryElement importingLibrary,
961 Uri absoluteUri, Node node) {
962 unimplemented('Compiler.resolveAbsoluteUri');
963 }
964
965 /**
966 * Reads the script specified by the [readableUri].
967 *
968 * See [LibraryLoader] for terminology on URIs.
969 */
970 Script readScript(Uri readableUri, [Node node]) {
948 unimplemented('Compiler.readScript'); 971 unimplemented('Compiler.readScript');
949 } 972 }
950 973
951 String get legDirectory { 974 String get legDirectory {
952 unimplemented('Compiler.legDirectory'); 975 unimplemented('Compiler.legDirectory');
953 } 976 }
954 977
955 // TODO(karlklose): split into findHelperFunction and findHelperClass and 978 // TODO(karlklose): split into findHelperFunction and findHelperClass and
956 // add a check that the element has the expected kind. 979 // add a check that the element has the expected kind.
957 Element findHelper(SourceString name) 980 Element findHelper(SourceString name)
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 // TODO(johnniwinther): Use [spannable] and [message] to provide better 1102 // TODO(johnniwinther): Use [spannable] and [message] to provide better
1080 // information on assertion errors. 1103 // information on assertion errors.
1081 if (condition is Function){ 1104 if (condition is Function){
1082 condition = condition(); 1105 condition = condition();
1083 } 1106 }
1084 if (spannable == null || !condition) { 1107 if (spannable == null || !condition) {
1085 throw new SpannableAssertionFailure(spannable, message); 1108 throw new SpannableAssertionFailure(spannable, message);
1086 } 1109 }
1087 return true; 1110 return true;
1088 } 1111 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698