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

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: Fix a bug. 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 DartType computeType(Compiler compiler) { 141 DartType computeType(Compiler compiler) {
142 compiler.internalError("$this.computeType.", token: position()); 142 compiler.internalError("$this.computeType.", token: position());
143 } 143 }
144 144
145 void addMetadata(MetadataAnnotation annotation) { 145 void addMetadata(MetadataAnnotation annotation) {
146 assert(annotation.annotatedElement == null); 146 assert(annotation.annotatedElement == null);
147 annotation.annotatedElement = this; 147 annotation.annotatedElement = this;
148 metadata = metadata.prepend(annotation); 148 metadata = metadata.prepend(annotation);
149 } 149 }
150 150
151 bool hasSignature() => isFunction() || isConstructor();
ahe 2012/10/25 14:07:27 Let's try to add documentation comments to these m
karlklose 2012/10/26 11:08:48 Done.
151 bool isFunction() => identical(kind, ElementKind.FUNCTION); 152 bool isFunction() => identical(kind, ElementKind.FUNCTION);
152 bool isConstructor() => isFactoryConstructor() || isGenerativeConstructor(); 153 bool isConstructor() => isFactoryConstructor() || isGenerativeConstructor();
153 bool isClosure() => false; 154 bool isClosure() => false;
154 bool isMember() { 155 bool isMember() {
155 // Check that this element is defined in the scope of a Class. 156 // Check that this element is defined in the scope of a Class.
156 return enclosingElement != null && enclosingElement.isClass(); 157 return enclosingElement != null && enclosingElement.isClass();
157 } 158 }
158 bool isInstanceMember() => false; 159 bool isInstanceMember() => false;
159 bool isFactoryConstructor() => modifiers.isFactory(); 160 bool isFactoryConstructor() => modifiers.isFactory();
160 bool isGenerativeConstructor() => 161 bool isGenerativeConstructor() =>
(...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after
1645 return 'origin ${super.toString()}'; 1646 return 'origin ${super.toString()}';
1646 } else { 1647 } else {
1647 return super.toString(); 1648 return super.toString();
1648 } 1649 }
1649 } 1650 }
1650 } 1651 }
1651 1652
1652 class Elements { 1653 class Elements {
1653 static bool isUnresolved(Element e) => e == null || e.isErroneous(); 1654 static bool isUnresolved(Element e) => e == null || e.isErroneous();
1654 static bool isErroneousElement(Element e) => e != null && e.isErroneous(); 1655 static bool isErroneousElement(Element e) => e != null && e.isErroneous();
1656 static bool isValid(Element e) => !isUnresolved(e);
ahe 2012/10/25 14:07:27 A documentation comment would also be great here.
karlklose 2012/10/26 11:08:48 Done.
1655 1657
1656 static bool isLocal(Element element) { 1658 static bool isLocal(Element element) {
1657 return !Elements.isUnresolved(element) 1659 return !Elements.isUnresolved(element)
1658 && !element.isInstanceMember() 1660 && !element.isInstanceMember()
1659 && !isStaticOrTopLevelField(element) 1661 && !isStaticOrTopLevelField(element)
1660 && !isStaticOrTopLevelFunction(element) 1662 && !isStaticOrTopLevelFunction(element)
1661 && (identical(element.kind, ElementKind.VARIABLE) || 1663 && (identical(element.kind, ElementKind.VARIABLE) ||
1662 identical(element.kind, ElementKind.PARAMETER) || 1664 identical(element.kind, ElementKind.PARAMETER) ||
1663 identical(element.kind, ElementKind.FUNCTION)); 1665 identical(element.kind, ElementKind.FUNCTION));
1664 } 1666 }
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1935 1937
1936 MetadataAnnotation ensureResolved(Compiler compiler) { 1938 MetadataAnnotation ensureResolved(Compiler compiler) {
1937 if (resolutionState == STATE_NOT_STARTED) { 1939 if (resolutionState == STATE_NOT_STARTED) {
1938 compiler.resolver.resolveMetadataAnnotation(this); 1940 compiler.resolver.resolveMetadataAnnotation(this);
1939 } 1941 }
1940 return this; 1942 return this;
1941 } 1943 }
1942 1944
1943 String toString() => 'MetadataAnnotation($value, $resolutionState)'; 1945 String toString() => 'MetadataAnnotation($value, $resolutionState)';
1944 } 1946 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/lib/js_helper.dart » ('j') | lib/compiler/implementation/resolution/members.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698