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

Unified Diff: pkg/compiler/lib/src/dart_backend/backend.dart

Issue 746993002: Avoid patching in dart2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/dart_backend/backend.dart
diff --git a/pkg/compiler/lib/src/dart_backend/backend.dart b/pkg/compiler/lib/src/dart_backend/backend.dart
index 174c58b99a97eb0f904308c538b12a60111466d9..9c04d6beb32f0bc30b03f1f47d27d001d917e73e 100644
--- a/pkg/compiler/lib/src/dart_backend/backend.dart
+++ b/pkg/compiler/lib/src/dart_backend/backend.dart
@@ -47,6 +47,11 @@ class DartBackend extends Backend {
final Set<ClassElement> usedTypeLiterals = new Set<ClassElement>();
+ /// The set of visible platform classes that are implementated by instantiated
floitsch 2014/11/21 12:14:49 implemented
Johnni Winther 2014/11/21 13:20:31 Done.
+ /// user classes.
+ final Set<ClassElement> _userImplementedPlatformClasses =
+ new Set<ClassElement>();
+
/**
* Tells whether it is safe to remove type declarations from variables,
* functions parameters. It becomes not safe if:
@@ -261,6 +266,7 @@ class DartBackend extends Backend {
log(String message) => compiler.log('[DartBackend] $message');
+ @override
Future onLibrariesLoaded(LoadedLibraries loadedLibraries) {
// All platform classes must be resolved to ensure that their member names
// are preserved.
@@ -287,6 +293,7 @@ class DartBackend extends Backend {
return new Future.value();
}
+ @override
void registerStaticUse(Element element, Enqueuer enqueuer) {
if (element == compiler.mirrorSystemGetNameFunction) {
FunctionElement getNameFunction = mirrorRenamer.getNameFunction;
@@ -295,6 +302,44 @@ class DartBackend extends Backend {
}
}
}
+
+ @override
+ void registerInstantiatedType(InterfaceType type, Registry registry) {
+ ClassElement cls = type.element;
+ if (!cls.library.isPlatformLibrary) {
+ for (Link<DartType> link = cls.allSupertypes;
floitsch 2014/11/21 12:14:49 Give a general description of what you trying to a
Johnni Winther 2014/11/21 13:20:31 Done.
+ !link.isEmpty;
+ link = link.tail) {
+ InterfaceType supertype = link.head;
+ ClassElement superclass = supertype.element;
+ LibraryElement library = superclass.library;
+ if (library.isPlatformLibrary) {
+ if (_userImplementedPlatformClasses.add(superclass)) {
+ // Register selectors for all instance methods since these might
+ // be called on user classes from within the platform
+ // implementation.
+ superclass.forEachLocalMember((Element element) {
+ if (element.isConstructor || element.isStatic) return;
+
+ FunctionElement function = element.asFunctionElement();
+ if (function != null) {
+ function.computeSignature(compiler);
+ }
+ Selector selector = new Selector.fromElement(element);
+ if (selector.isGetter) {
+ registry.registerDynamicGetter(selector);
+ } else if (selector.isSetter) {
+ registry.registerDynamicSetter(selector);
+ } else {
+ registry.registerDynamicInvocation(selector);
+ }
+ });
+ }
+ }
+ }
+ }
+
+ }
}
class DartResolutionCallbacks extends ResolutionCallbacks {
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart ('k') | pkg/compiler/lib/src/dart_backend/backend_ast_to_frontend_ast.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698