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

Unified Diff: sdk/lib/_internal/compiler/js_lib/js_mirrors.dart

Issue 753113002: Encode super calls via extra properties on prototypes. (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: sdk/lib/_internal/compiler/js_lib/js_mirrors.dart
diff --git a/sdk/lib/_internal/compiler/js_lib/js_mirrors.dart b/sdk/lib/_internal/compiler/js_lib/js_mirrors.dart
index 5f613d37079abbf891ba64dff62a97645616f613..7a9aafac9f5003565c3110e42c5a7e31d5e17ea6 100644
--- a/sdk/lib/_internal/compiler/js_lib/js_mirrors.dart
+++ b/sdk/lib/_internal/compiler/js_lib/js_mirrors.dart
@@ -733,6 +733,8 @@ Map<Symbol, Mirror> filterMembers(List<MethodMirror> methods,
}
// Constructors aren't 'members'.
if (method.isConstructor) continue;
+ // Filter out synthetic tear-off stubs
+ if (JS('bool', r'#.$getterStub', method._jsFunction)) continue;
ahe 2014/11/25 09:33:03 Need to use r'!!#.$getterStub' to ensure that the
herhut 2014/11/25 14:03:20 Done.
// Use putIfAbsent to filter-out getters corresponding to variables.
result.putIfAbsent(method.simpleName, () => method);
}
@@ -1664,6 +1666,7 @@ class JsClassMirror extends JsTypeMirror with JsObjectMirror
if (simpleName == null) continue;
var function = JS('', '#[#]', prototype, key);
if (isNoSuchMethodStub(function)) continue;
+ if (isAliasedSuperMethod(function, key)) continue;
var mirror =
new JsMethodMirror.fromUnmangledName(
simpleName, function, false, false);
@@ -2905,6 +2908,13 @@ bool isNoSuchMethodStub(var jsFunction) {
return JS('bool', r'#.$reflectable == 2', jsFunction);
}
+/// Returns true if [key] is only an aliased entry for [function] in the
+/// prototype.
+bool isAliasedSuperMethod(var jsFunction, String key) {
ahe 2014/11/25 09:33:03 I can imagine wanting more than one alias for a fu
herhut 2014/11/25 14:03:20 Done.
+ var aliasName = JS('String', r'#.$aliasName', jsFunction);
ahe 2014/11/25 09:33:03 I think this has to be: JS('String|Null', r'#.$al
herhut 2014/11/25 14:03:20 Done.
+ return key == aliasName;
+}
+
class NoSuchStaticMethodError extends Error implements NoSuchMethodError {
static const int MISSING_CONSTRUCTOR = 0;
static const int MISSING_METHOD = 1;
« pkg/compiler/lib/src/ssa/codegen.dart ('K') | « pkg/compiler/lib/src/ssa/codegen.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698