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

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

Issue 11273034: Make unmatched static call a runtime error. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Refactored resolution code. Created 8 years, 1 month 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 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 // TODO(johnniwinther): Find a (better) way to decouple [typeVariables] from 1256 // TODO(johnniwinther): Find a (better) way to decouple [typeVariables] from
1257 // [Compiler]. 1257 // [Compiler].
1258 abstract Link<DartType> get typeVariables; 1258 abstract Link<DartType> get typeVariables;
1259 1259
1260 /** 1260 /**
1261 * Creates the type variables, their type and corresponding element, for the 1261 * Creates the type variables, their type and corresponding element, for the
1262 * type variables declared in [parameter] on [element]. The bounds of the type 1262 * type variables declared in [parameter] on [element]. The bounds of the type
1263 * variables are not set until [element] has been resolved. 1263 * variables are not set until [element] has been resolved.
1264 */ 1264 */
1265 static Link<DartType> createTypeVariables(TypeDeclarationElement element, 1265 static Link<DartType> createTypeVariables(TypeDeclarationElement element,
1266 NodeList parameters) { 1266 NodeList parameters) {
1267 if (parameters == null) return const Link<DartType>(); 1267 if (parameters == null) return const Link<DartType>();
1268 1268
1269 // Create types and elements for type variable. 1269 // Create types and elements for type variable.
1270 var arguments = new LinkBuilder<DartType>(); 1270 var arguments = new LinkBuilder<DartType>();
1271 for (Link link = parameters.nodes; !link.isEmpty; link = link.tail) { 1271 for (Link link = parameters.nodes; !link.isEmpty; link = link.tail) {
1272 TypeVariable node = link.head; 1272 TypeVariable node = link.head;
1273 SourceString variableName = node.name.source; 1273 SourceString variableName = node.name.source;
1274 TypeVariableElement variableElement = 1274 TypeVariableElement variableElement =
1275 new TypeVariableElement(variableName, element, node); 1275 new TypeVariableElement(variableName, element, node);
1276 TypeVariableType variableType = new TypeVariableType(variableElement); 1276 TypeVariableType variableType = new TypeVariableType(variableElement);
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1644 } else { 1644 } else {
1645 return super.toString(); 1645 return super.toString();
1646 } 1646 }
1647 } 1647 }
1648 } 1648 }
1649 1649
1650 class Elements { 1650 class Elements {
1651 static bool isUnresolved(Element e) => e == null || e.isErroneous(); 1651 static bool isUnresolved(Element e) => e == null || e.isErroneous();
1652 static bool isErroneousElement(Element e) => e != null && e.isErroneous(); 1652 static bool isErroneousElement(Element e) => e != null && e.isErroneous();
1653 1653
1654 /**
1655 * A valid element represents something in the program (as opposed to a
1656 * failure or problem in the resolution).
1657 *
1658 * Currently elements are valid if they are not null and they are not
1659 * erroneuous elements.
ngeoffray 2012/10/26 12:15:57 erroneuous -> erroneous
1660 */
1661 static bool isValid(Element e) => !isUnresolved(e);
ngeoffray 2012/10/26 12:15:57 I'd really prefer not to have this method. isValid
karlklose 2012/10/26 12:39:43 Done, removed it.
1662
1654 static bool isLocal(Element element) { 1663 static bool isLocal(Element element) {
1655 return !Elements.isUnresolved(element) 1664 return !Elements.isUnresolved(element)
1656 && !element.isInstanceMember() 1665 && !element.isInstanceMember()
1657 && !isStaticOrTopLevelField(element) 1666 && !isStaticOrTopLevelField(element)
1658 && !isStaticOrTopLevelFunction(element) 1667 && !isStaticOrTopLevelFunction(element)
1659 && (identical(element.kind, ElementKind.VARIABLE) || 1668 && (identical(element.kind, ElementKind.VARIABLE) ||
1660 identical(element.kind, ElementKind.PARAMETER) || 1669 identical(element.kind, ElementKind.PARAMETER) ||
1661 identical(element.kind, ElementKind.FUNCTION)); 1670 identical(element.kind, ElementKind.FUNCTION));
1662 } 1671 }
1663 1672
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1933 1942
1934 MetadataAnnotation ensureResolved(Compiler compiler) { 1943 MetadataAnnotation ensureResolved(Compiler compiler) {
1935 if (resolutionState == STATE_NOT_STARTED) { 1944 if (resolutionState == STATE_NOT_STARTED) {
1936 compiler.resolver.resolveMetadataAnnotation(this); 1945 compiler.resolver.resolveMetadataAnnotation(this);
1937 } 1946 }
1938 return this; 1947 return this;
1939 } 1948 }
1940 1949
1941 String toString() => 'MetadataAnnotation($value, $resolutionState)'; 1950 String toString() => 'MetadataAnnotation($value, $resolutionState)';
1942 } 1951 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698