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

Unified Diff: compiler/java/com/google/dart/compiler/backend/js/DollarMangler.java

Issue 8479049: Allow for instance checking of methods and function aliases. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 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: compiler/java/com/google/dart/compiler/backend/js/DollarMangler.java
diff --git a/compiler/java/com/google/dart/compiler/backend/js/DollarMangler.java b/compiler/java/com/google/dart/compiler/backend/js/DollarMangler.java
index 08d55ace75430cb105aa578b47028ebccb653ae0..e10131f73c92f96d9c266f856170ff9abb701fff 100644
--- a/compiler/java/com/google/dart/compiler/backend/js/DollarMangler.java
+++ b/compiler/java/com/google/dart/compiler/backend/js/DollarMangler.java
@@ -44,6 +44,7 @@ public class DollarMangler implements DartMangler {
private static final String FIELD_SUFFIX = "$field";
private static final String METHOD_SUFFIX = "$member";
private static final String NAMED_SUFFIX = "$named";
+ private static final String RTT_LOOKUP_SUFFIX = "$lookupRTT";
private static final String CONSTRUCTOR_SUFFIX = "$Constructor";
private static final String FACTORY_SUFFIX = "$Factory";
private static final String INITIALIZER_SUFFIX = "$Initializer";
@@ -328,6 +329,24 @@ public class DollarMangler implements DartMangler {
}
@Override
+ public String mangleLookupMethod(MethodElement method, LibraryElement currentLibrary) {
+ // There can be no named shims for operators, getters, or setters.
+ String methodName = method.getName();
+ methodName = attachSuffix(methodName, RTT_LOOKUP_SUFFIX, currentLibrary);
+
+ String prefix = "";
+ if (ElementKind.of(method.getEnclosingElement()).equals(ElementKind.LIBRARY)) {
+ prefix = mangleLibraryName((LibraryElement) method.getEnclosingElement());
+ }
+ return prefix + methodName;
+ }
+
+ @Override
+ public String mangleLookupMethod(String methodName, LibraryElement currentLibrary) {
+ return attachSuffix(methodName, RTT_LOOKUP_SUFFIX, currentLibrary);
+ }
+
+ @Override
public String mangleEntryPoint(MethodElement method, LibraryElement library) {
Element holder = method.getEnclosingElement();
switch (ElementKind.of(holder)) {

Powered by Google App Engine
This is Rietveld 408576698