| 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 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 }); | 941 }); |
| 942 assert(type != null); | 942 assert(type != null); |
| 943 return type; | 943 return type; |
| 944 } | 944 } |
| 945 | 945 |
| 946 Token position() => cachedNode.getBeginToken(); | 946 Token position() => cachedNode.getBeginToken(); |
| 947 | 947 |
| 948 bool isInstanceMember() { | 948 bool isInstanceMember() { |
| 949 return isMember() && !modifiers.isStatic(); | 949 return isMember() && !modifiers.isStatic(); |
| 950 } | 950 } |
| 951 | |
| 952 // TODO(johnniwinther): Rewrite to avoid the optional argument. | |
| 953 Scope buildScope({bool patchScope: false}) { | |
| 954 Scope result = new VariableScope( | |
| 955 enclosingElement.buildScope(patchScope: patchScope), this); | |
| 956 if (enclosingElement.isClass()) { | |
| 957 Scope clsScope = result.parent; | |
| 958 clsScope.inStaticContext = !isInstanceMember(); | |
| 959 } | |
| 960 return result; | |
| 961 } | |
| 962 } | 951 } |
| 963 | 952 |
| 964 class ForeignElement extends Element { | 953 class ForeignElement extends Element { |
| 965 ForeignElement(SourceString name, ContainerElement enclosingElement) | 954 ForeignElement(SourceString name, ContainerElement enclosingElement) |
| 966 : super(name, ElementKind.FOREIGN, enclosingElement); | 955 : super(name, ElementKind.FOREIGN, enclosingElement); |
| 967 | 956 |
| 968 DartType computeType(Compiler compiler) { | 957 DartType computeType(Compiler compiler) { |
| 969 return compiler.types.dynamicType; | 958 return compiler.types.dynamicType; |
| 970 } | 959 } |
| 971 | 960 |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1199 | 1188 |
| 1200 String toString() { | 1189 String toString() { |
| 1201 if (isPatch) { | 1190 if (isPatch) { |
| 1202 return 'patch ${super.toString()}'; | 1191 return 'patch ${super.toString()}'; |
| 1203 } else if (isPatched) { | 1192 } else if (isPatched) { |
| 1204 return 'origin ${super.toString()}'; | 1193 return 'origin ${super.toString()}'; |
| 1205 } else { | 1194 } else { |
| 1206 return super.toString(); | 1195 return super.toString(); |
| 1207 } | 1196 } |
| 1208 } | 1197 } |
| 1209 | |
| 1210 // TODO(johnniwinther): Rewrite to avoid the optional argument. | |
| 1211 Scope buildScope({bool patchScope: false}) { | |
| 1212 Scope result = new MethodScope( | |
| 1213 enclosingElement.buildScope(patchScope: patchScope), this); | |
| 1214 if (enclosingElement.isClass()) { | |
| 1215 Scope clsScope = result.parent; | |
| 1216 clsScope.inStaticContext = !isInstanceMember() && !isConstructor(); | |
| 1217 } | |
| 1218 return result; | |
| 1219 } | |
| 1220 } | 1198 } |
| 1221 | 1199 |
| 1222 class ConstructorBodyElement extends FunctionElement { | 1200 class ConstructorBodyElement extends FunctionElement { |
| 1223 FunctionElement constructor; | 1201 FunctionElement constructor; |
| 1224 | 1202 |
| 1225 ConstructorBodyElement(FunctionElement constructor) | 1203 ConstructorBodyElement(FunctionElement constructor) |
| 1226 : this.constructor = constructor, | 1204 : this.constructor = constructor, |
| 1227 super(constructor.name, | 1205 super(constructor.name, |
| 1228 ElementKind.GENERATIVE_CONSTRUCTOR_BODY, | 1206 ElementKind.GENERATIVE_CONSTRUCTOR_BODY, |
| 1229 Modifiers.EMPTY, | 1207 Modifiers.EMPTY, |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1977 | 1955 |
| 1978 MetadataAnnotation ensureResolved(Compiler compiler) { | 1956 MetadataAnnotation ensureResolved(Compiler compiler) { |
| 1979 if (resolutionState == STATE_NOT_STARTED) { | 1957 if (resolutionState == STATE_NOT_STARTED) { |
| 1980 compiler.resolver.resolveMetadataAnnotation(this); | 1958 compiler.resolver.resolveMetadataAnnotation(this); |
| 1981 } | 1959 } |
| 1982 return this; | 1960 return this; |
| 1983 } | 1961 } |
| 1984 | 1962 |
| 1985 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | 1963 String toString() => 'MetadataAnnotation($value, $resolutionState)'; |
| 1986 } | 1964 } |
| OLD | NEW |