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

Side by Side Diff: pkg/compiler/lib/src/universe/universe.dart

Issue 1184853002: Cleanup TypedSelector.appliesUnnamed (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Emit top level and static getters/setters for mirrors. Created 5 years, 6 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
« no previous file with comments | « pkg/compiler/lib/src/types/type_mask.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 library universe; 5 library universe;
6 6
7 import '../elements/elements.dart'; 7 import '../elements/elements.dart';
8 import '../dart2jslib.dart'; 8 import '../dart2jslib.dart';
9 import '../dart_types.dart'; 9 import '../dart_types.dart';
10 import '../types/types.dart'; 10 import '../types/types.dart';
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 => new TypedSelector(new TypeMask.subclass(base, world), 837 => new TypedSelector(new TypeMask.subclass(base, world),
838 selector, world); 838 selector, world);
839 839
840 factory TypedSelector.subtype( 840 factory TypedSelector.subtype(
841 ClassElement base, Selector selector, World world) 841 ClassElement base, Selector selector, World world)
842 => new TypedSelector(new TypeMask.subtype(base, world), 842 => new TypedSelector(new TypeMask.subtype(base, world),
843 selector, world); 843 selector, world);
844 844
845 bool appliesUnnamed(Element element, World world) { 845 bool appliesUnnamed(Element element, World world) {
846 assert(sameNameHack(element, world)); 846 assert(sameNameHack(element, world));
847 // [TypedSelector] are only used after resolution.
848 if (!element.isClassMember) return false;
849
850 // A closure can be called through any typed selector:
851 // class A {
852 // get foo => () => 42;
853 // bar() => foo(); // The call to 'foo' is a typed selector.
854 // }
855 if (element.enclosingClass.isClosure) {
856 return appliesUntyped(element, world);
857 }
858
859 if (!mask.canHit(element, this, world)) return false; 847 if (!mask.canHit(element, this, world)) return false;
860 return appliesUntyped(element, world); 848 return appliesUntyped(element, world);
861 } 849 }
862 850
863 Selector extendIfReachesAll(Compiler compiler) { 851 Selector extendIfReachesAll(Compiler compiler) {
864 bool canReachAll = compiler.enabledInvokeOn 852 bool canReachAll = compiler.enabledInvokeOn
865 && mask.needsNoSuchMethodHandling(this, compiler.world); 853 && mask.needsNoSuchMethodHandling(this, compiler.world);
866 return canReachAll 854 return canReachAll
867 ? new TypedSelector( 855 ? new TypedSelector(
868 compiler.typesTask.dynamicType, this, compiler.world) 856 compiler.typesTask.dynamicType, this, compiler.world)
869 : this; 857 : this;
870 } 858 }
871 } 859 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/types/type_mask.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698