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

Side by Side Diff: lib/compiler/implementation/elements/elements.dart

Issue 10180001: Introduce typed selectors to do better tree shaking based on calls on 'this'. Getters and setters w… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
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('elements'); 5 #library('elements');
6 6
7 #import('../tree/tree.dart'); 7 #import('../tree/tree.dart');
8 #import('../scanner/scannerlib.dart'); 8 #import('../scanner/scannerlib.dart');
9 #import('../leg.dart'); // TODO(karlklose): we only need type. 9 #import('../leg.dart'); // TODO(karlklose): we only need type.
10 #import('../util/util.dart'); 10 #import('../util/util.dart');
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 bool implementsInterface(ClassElement intrface) { 839 bool implementsInterface(ClassElement intrface) {
840 for (Type implementedInterfaceType in allSupertypes) { 840 for (Type implementedInterfaceType in allSupertypes) {
841 ClassElement implementedInterface = implementedInterfaceType.element; 841 ClassElement implementedInterface = implementedInterfaceType.element;
842 if (implementedInterface === intrface) { 842 if (implementedInterface === intrface) {
843 return true; 843 return true;
844 } 844 }
845 } 845 }
846 return false; 846 return false;
847 } 847 }
848 848
849 /**
850 * Returns true if [cls] is a subclass of [this].
kasperl 2012/04/23 12:34:45 Shouldn't this be: if [this] is a subclass of [cls
ahe 2012/04/23 12:37:53 Good catch.
ngeoffray 2012/04/23 13:48:18 Done.
851 *
852 * This method is not to be used for checking type hierarchy and
floitsch 2012/04/23 13:58:30 Add explanation why, or contrast to it ("whereas a
ngeoffray 2012/04/23 14:09:33 Done.
853 * assignments.
854 */
855 bool isSubclassOf(ClassElement cls) {
856 for (ClassElement s = superclass; s != null; s = s.superclass) {
kasperl 2012/04/23 12:34:45 It is a bit surprising that you don't start at [th
ahe 2012/04/23 12:37:53 Good catch. I think this is a copy-and-paste erro
ngeoffray 2012/04/23 13:48:18 The method should start at this. Code fixed.
857 if (s === cls) return true;
858 }
859 return false;
860 }
861
849 bool isInterface() => false; 862 bool isInterface() => false;
850 bool isNative() => nativeName != null; 863 bool isNative() => nativeName != null;
851 SourceString nativeName; 864 SourceString nativeName;
852 } 865 }
853 866
854 class Elements { 867 class Elements {
855 static bool isLocal(Element element) { 868 static bool isLocal(Element element) {
856 return ((element !== null) 869 return ((element !== null)
857 && !element.isInstanceMember() 870 && !element.isInstanceMember()
858 && !isStaticOrTopLevelField(element) 871 && !isStaticOrTopLevelField(element)
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 final Node node; 1040 final Node node;
1028 Type bound; 1041 Type bound;
1029 Type type; 1042 Type type;
1030 TypeVariableElement(name, Element enclosing, this.node, this.type, 1043 TypeVariableElement(name, Element enclosing, this.node, this.type,
1031 [this.bound]) 1044 [this.bound])
1032 : super(name, ElementKind.TYPE_VARIABLE, enclosing); 1045 : super(name, ElementKind.TYPE_VARIABLE, enclosing);
1033 Type computeType(compiler) => type; 1046 Type computeType(compiler) => type;
1034 Node parseNode(compiler) => node; 1047 Node parseNode(compiler) => node;
1035 toString() => "${enclosingElement.toString()}.${name.slowToString()}"; 1048 toString() => "${enclosingElement.toString()}.${name.slowToString()}";
1036 } 1049 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698