Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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() { | |
|
karlklose
2012/10/19 12:05:38
I find it confusing, that getEnclosingMember may r
ahe
2012/10/19 12:22:40
I find the behavior really useful. So I would rath
Johnni Winther
2012/10/22 09:03:32
[getEnclosingMember] is only used by [isInStaticMe
| |
| 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); |
| 169 bool isStatement() => identical(kind, ElementKind.STATEMENT); | 179 bool isStatement() => identical(kind, ElementKind.STATEMENT); |
| 170 bool isTypedef() => identical(kind, ElementKind.TYPEDEF); | 180 bool isTypedef() => identical(kind, ElementKind.TYPEDEF); |
| (...skipping 1793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1964 | 1974 |
| 1965 MetadataAnnotation ensureResolved(Compiler compiler) { | 1975 MetadataAnnotation ensureResolved(Compiler compiler) { |
| 1966 if (resolutionState == STATE_NOT_STARTED) { | 1976 if (resolutionState == STATE_NOT_STARTED) { |
| 1967 compiler.resolver.resolveMetadataAnnotation(this); | 1977 compiler.resolver.resolveMetadataAnnotation(this); |
| 1968 } | 1978 } |
| 1969 return this; | 1979 return this; |
| 1970 } | 1980 } |
| 1971 | 1981 |
| 1972 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | 1982 String toString() => 'MetadataAnnotation($value, $resolutionState)'; |
| 1973 } | 1983 } |
| OLD | NEW |