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

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

Issue 11229002: Handle type variable in static member. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Test update removed. Created 8 years, 2 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 'dart:uri'; 7 import 'dart:uri';
8 8
9 // TODO(ahe): Rename prefix to 'api' when VM bug is fixed. 9 // TODO(ahe): Rename prefix to 'api' when VM bug is fixed.
10 import '../../compiler.dart' as api_e; 10 import '../../compiler.dart' as api_e;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 149 }
150 150
151 bool isFunction() => identical(kind, ElementKind.FUNCTION); 151 bool isFunction() => identical(kind, ElementKind.FUNCTION);
152 bool isConstructor() => isFactoryConstructor() || isGenerativeConstructor(); 152 bool isConstructor() => isFactoryConstructor() || isGenerativeConstructor();
153 bool isClosure() => false; 153 bool isClosure() => false;
154 bool isMember() { 154 bool isMember() {
155 // Check that this element is defined in the scope of a Class. 155 // Check that this element is defined in the scope of a Class.
156 return enclosingElement != null && enclosingElement.isClass(); 156 return enclosingElement != null && enclosingElement.isClass();
157 } 157 }
158 bool isInstanceMember() => false; 158 bool isInstanceMember() => false;
159
160 /**
161 * Returns [:true:] if this element is enclosed in a static member or is
162 * itself a static member.
163 */
164 bool isInStaticMember() {
165 Element member = getEnclosingMember();
166 return member != null && member.modifiers.isStatic();
167 }
168
159 bool isFactoryConstructor() => modifiers.isFactory(); 169 bool isFactoryConstructor() => modifiers.isFactory();
160 bool isGenerativeConstructor() => 170 bool isGenerativeConstructor() =>
161 identical(kind, ElementKind.GENERATIVE_CONSTRUCTOR); 171 identical(kind, ElementKind.GENERATIVE_CONSTRUCTOR);
162 bool isGenerativeConstructorBody() => 172 bool isGenerativeConstructorBody() =>
163 identical(kind, ElementKind.GENERATIVE_CONSTRUCTOR_BODY); 173 identical(kind, ElementKind.GENERATIVE_CONSTRUCTOR_BODY);
164 bool isCompilationUnit() => identical(kind, ElementKind.COMPILATION_UNIT); 174 bool isCompilationUnit() => identical(kind, ElementKind.COMPILATION_UNIT);
165 bool isClass() => identical(kind, ElementKind.CLASS); 175 bool isClass() => identical(kind, ElementKind.CLASS);
166 bool isPrefix() => identical(kind, ElementKind.PREFIX); 176 bool isPrefix() => identical(kind, ElementKind.PREFIX);
167 bool isVariable() => identical(kind, ElementKind.VARIABLE); 177 bool isVariable() => identical(kind, ElementKind.VARIABLE);
168 bool isParameter() => identical(kind, ElementKind.PARAMETER); 178 bool isParameter() => identical(kind, ElementKind.PARAMETER);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 return null; 301 return null;
292 } 302 }
293 303
294 Element getEnclosingClassOrCompilationUnit() { 304 Element getEnclosingClassOrCompilationUnit() {
295 for (Element e = this; e != null; e = e.enclosingElement) { 305 for (Element e = this; e != null; e = e.enclosingElement) {
296 if (e.isClass() || e.isCompilationUnit()) return e; 306 if (e.isClass() || e.isCompilationUnit()) return e;
297 } 307 }
298 return null; 308 return null;
299 } 309 }
300 310
311 /**
312 * Returns the member enclosing this element or the element itself if it is a
313 * member. If no enclosing element is found, [:null:] is returned.
314 */
301 Element getEnclosingMember() { 315 Element getEnclosingMember() {
302 for (Element e = this; e != null; e = e.enclosingElement) { 316 for (Element e = this; e != null; e = e.enclosingElement) {
303 if (e.isMember()) return e; 317 if (e.isMember()) return e;
304 } 318 }
305 return null; 319 return null;
306 } 320 }
307 321
308 Element getOutermostEnclosingMemberOrTopLevel() { 322 Element getOutermostEnclosingMemberOrTopLevel() {
309 // TODO(lrn): Why is this called "Outermost"? 323 // TODO(lrn): Why is this called "Outermost"?
310 for (Element e = this; e != null; e = e.enclosingElement) { 324 for (Element e = this; e != null; e = e.enclosingElement) {
(...skipping 1624 matching lines...) Expand 10 before | Expand all | Expand 10 after
1935 1949
1936 MetadataAnnotation ensureResolved(Compiler compiler) { 1950 MetadataAnnotation ensureResolved(Compiler compiler) {
1937 if (resolutionState == STATE_NOT_STARTED) { 1951 if (resolutionState == STATE_NOT_STARTED) {
1938 compiler.resolver.resolveMetadataAnnotation(this); 1952 compiler.resolver.resolveMetadataAnnotation(this);
1939 } 1953 }
1940 return this; 1954 return this;
1941 } 1955 }
1942 1956
1943 String toString() => 'MetadataAnnotation($value, $resolutionState)'; 1957 String toString() => 'MetadataAnnotation($value, $resolutionState)';
1944 } 1958 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698