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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart

Issue 23225004: Fix a bug where we would emit a noSuchMethod handler in the Object class for Object methods because… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/types/concrete_types_inferrer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart (revision 26305)
+++ sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart (working copy)
@@ -2811,57 +2811,12 @@
DartType objectType = objectClass.computeType(compiler);
for (Selector selector in selectors) {
- // If the selector is typed, we check to see if that type may
- // have a user-defined noSuchMethod implementation. If not, we
- // skip the selector altogether.
-
TypeMask mask = selector.mask;
if (mask == null) {
mask = new TypeMask.subclass(compiler.objectClass.rawType);
}
- // If the receiver is guaranteed to have a member that
- // matches what we're looking for, there's no need to
- // introduce a noSuchMethod handler. It will never be called.
- //
- // As an example, consider this class hierarchy:
- //
- // A <-- noSuchMethod
- // / \
- // C B <-- foo
- //
- // If we know we're calling foo on an object of type B we
- // don't have to worry about the noSuchMethod method in A
- // because objects of type B implement foo. On the other hand,
- // if we end up calling foo on something of type C we have to
- // add a handler for it.
-
- // If the holders of all user-defined noSuchMethod
- // implementations that might be applicable to the receiver
- // type have a matching member for the current name and
- // selector, we avoid introducing a noSuchMethod handler.
- //
- // As an example, consider this class hierarchy:
- //
- // A <-- foo
- // / \
- // noSuchMethod --> B C <-- bar
- // | |
- // C D <-- noSuchMethod
- //
- // When calling foo on an object of type A, we know that the
- // implementations of noSuchMethod are in the classes B and D
- // that also (indirectly) implement foo, so we do not need a
- // handler for it.
- //
- // If we're calling bar on an object of type D, we don't need
- // the handler either because all objects of type D implement
- // bar through inheritance.
- //
- // If we're calling bar on an object of type A we do need the
- // handler because we may have to call B.noSuchMethod since B
- // does not implement bar.
- if (mask.willHit(selector, compiler)) continue;
+ if (!mask.needsNoSuchMethodHandling(selector, compiler)) continue;
String jsName = namer.invocationMirrorInternalName(selector);
addedJsNames[jsName] = selector;
String reflectionName = getReflectionName(selector, jsName);
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/types/concrete_types_inferrer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698