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