| 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', prefix: 'api_e'); | 10 #import('../../compiler.dart', prefix: 'api_e'); |
| (...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 }); | 929 }); |
| 930 assert(type != null); | 930 assert(type != null); |
| 931 return type; | 931 return type; |
| 932 } | 932 } |
| 933 | 933 |
| 934 Token position() => cachedNode.getBeginToken(); | 934 Token position() => cachedNode.getBeginToken(); |
| 935 | 935 |
| 936 bool isInstanceMember() { | 936 bool isInstanceMember() { |
| 937 return isMember() && !modifiers.isStatic(); | 937 return isMember() && !modifiers.isStatic(); |
| 938 } | 938 } |
| 939 | |
| 940 // TODO(johnniwinther): Rewrite to avoid the optional argument. | |
| 941 Scope buildScope({bool patchScope: false}) { | |
| 942 Scope result = new VariableScope( | |
| 943 enclosingElement.buildScope(patchScope: patchScope), this); | |
| 944 if (enclosingElement.isClass()) { | |
| 945 Scope clsScope = result.parent; | |
| 946 clsScope.inStaticContext = !isInstanceMember(); | |
| 947 } | |
| 948 return result; | |
| 949 } | |
| 950 } | 939 } |
| 951 | 940 |
| 952 class ForeignElement extends Element { | 941 class ForeignElement extends Element { |
| 953 ForeignElement(SourceString name, ContainerElement enclosingElement) | 942 ForeignElement(SourceString name, ContainerElement enclosingElement) |
| 954 : super(name, ElementKind.FOREIGN, enclosingElement); | 943 : super(name, ElementKind.FOREIGN, enclosingElement); |
| 955 | 944 |
| 956 DartType computeType(Compiler compiler) { | 945 DartType computeType(Compiler compiler) { |
| 957 return compiler.types.dynamicType; | 946 return compiler.types.dynamicType; |
| 958 } | 947 } |
| 959 | 948 |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1187 | 1176 |
| 1188 String toString() { | 1177 String toString() { |
| 1189 if (isPatch) { | 1178 if (isPatch) { |
| 1190 return 'patch ${super.toString()}'; | 1179 return 'patch ${super.toString()}'; |
| 1191 } else if (isPatched) { | 1180 } else if (isPatched) { |
| 1192 return 'origin ${super.toString()}'; | 1181 return 'origin ${super.toString()}'; |
| 1193 } else { | 1182 } else { |
| 1194 return super.toString(); | 1183 return super.toString(); |
| 1195 } | 1184 } |
| 1196 } | 1185 } |
| 1197 | |
| 1198 // TODO(johnniwinther): Rewrite to avoid the optional argument. | |
| 1199 Scope buildScope({bool patchScope: false}) { | |
| 1200 Scope result = new MethodScope( | |
| 1201 enclosingElement.buildScope(patchScope: patchScope), this); | |
| 1202 if (enclosingElement.isClass()) { | |
| 1203 Scope clsScope = result.parent; | |
| 1204 clsScope.inStaticContext = !isInstanceMember() && !isConstructor(); | |
| 1205 } | |
| 1206 return result; | |
| 1207 } | |
| 1208 } | 1186 } |
| 1209 | 1187 |
| 1210 class ConstructorBodyElement extends FunctionElement { | 1188 class ConstructorBodyElement extends FunctionElement { |
| 1211 FunctionElement constructor; | 1189 FunctionElement constructor; |
| 1212 | 1190 |
| 1213 ConstructorBodyElement(FunctionElement constructor) | 1191 ConstructorBodyElement(FunctionElement constructor) |
| 1214 : this.constructor = constructor, | 1192 : this.constructor = constructor, |
| 1215 super(constructor.name, | 1193 super(constructor.name, |
| 1216 ElementKind.GENERATIVE_CONSTRUCTOR_BODY, | 1194 ElementKind.GENERATIVE_CONSTRUCTOR_BODY, |
| 1217 Modifiers.EMPTY, | 1195 Modifiers.EMPTY, |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1965 | 1943 |
| 1966 MetadataAnnotation ensureResolved(Compiler compiler) { | 1944 MetadataAnnotation ensureResolved(Compiler compiler) { |
| 1967 if (resolutionState == STATE_NOT_STARTED) { | 1945 if (resolutionState == STATE_NOT_STARTED) { |
| 1968 compiler.resolver.resolveMetadataAnnotation(this); | 1946 compiler.resolver.resolveMetadataAnnotation(this); |
| 1969 } | 1947 } |
| 1970 return this; | 1948 return this; |
| 1971 } | 1949 } |
| 1972 | 1950 |
| 1973 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | 1951 String toString() => 'MetadataAnnotation($value, $resolutionState)'; |
| 1974 } | 1952 } |
| OLD | NEW |