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

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 [this] is a subclass of [cls].
851 *
852 * This method is not to be used for checking type hierarchy and
853 * assignments, because it does not take parameterized types into
854 * account.
855 */
856 bool isSubclassOf(ClassElement cls) {
857 for (ClassElement s = this; s != null; s = s.superclass) {
858 if (s === cls) return true;
859 }
860 return false;
861 }
862
849 bool isInterface() => false; 863 bool isInterface() => false;
850 bool isNative() => nativeName != null; 864 bool isNative() => nativeName != null;
851 SourceString nativeName; 865 SourceString nativeName;
852 } 866 }
853 867
854 class Elements { 868 class Elements {
855 static bool isLocal(Element element) { 869 static bool isLocal(Element element) {
856 return ((element !== null) 870 return ((element !== null)
857 && !element.isInstanceMember() 871 && !element.isInstanceMember()
858 && !isStaticOrTopLevelField(element) 872 && !isStaticOrTopLevelField(element)
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 final Node node; 1041 final Node node;
1028 Type bound; 1042 Type bound;
1029 Type type; 1043 Type type;
1030 TypeVariableElement(name, Element enclosing, this.node, this.type, 1044 TypeVariableElement(name, Element enclosing, this.node, this.type,
1031 [this.bound]) 1045 [this.bound])
1032 : super(name, ElementKind.TYPE_VARIABLE, enclosing); 1046 : super(name, ElementKind.TYPE_VARIABLE, enclosing);
1033 Type computeType(compiler) => type; 1047 Type computeType(compiler) => type;
1034 Node parseNode(compiler) => node; 1048 Node parseNode(compiler) => node;
1035 toString() => "${enclosingElement.toString()}.${name.slowToString()}"; 1049 toString() => "${enclosingElement.toString()}.${name.slowToString()}";
1036 } 1050 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/compile_time_constants.dart ('k') | lib/compiler/implementation/emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698