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

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

Issue 11299009: Support type literals as compile-time constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 1709 matching lines...) Expand 10 before | Expand all | Expand 10 after
1720 } else { 1720 } else {
1721 return super.toString(); 1721 return super.toString();
1722 } 1722 }
1723 } 1723 }
1724 } 1724 }
1725 1725
1726 class Elements { 1726 class Elements {
1727 static bool isUnresolved(Element e) => e == null || e.isErroneous(); 1727 static bool isUnresolved(Element e) => e == null || e.isErroneous();
1728 static bool isErroneousElement(Element e) => e != null && e.isErroneous(); 1728 static bool isErroneousElement(Element e) => e != null && e.isErroneous();
1729 1729
1730 static bool isClass(Element e) => e != null && e.kind == ElementKind.CLASS;
1731 static bool isTypedef(Element e) {
1732 return e != null && e.kind == ElementKind.TYPEDEF;
1733 }
1734
1730 static bool isLocal(Element element) { 1735 static bool isLocal(Element element) {
1731 return !Elements.isUnresolved(element) 1736 return !Elements.isUnresolved(element)
1732 && !element.isInstanceMember() 1737 && !element.isInstanceMember()
1733 && !isStaticOrTopLevelField(element) 1738 && !isStaticOrTopLevelField(element)
1734 && !isStaticOrTopLevelFunction(element) 1739 && !isStaticOrTopLevelFunction(element)
1735 && (identical(element.kind, ElementKind.VARIABLE) || 1740 && (identical(element.kind, ElementKind.VARIABLE) ||
1736 identical(element.kind, ElementKind.PARAMETER) || 1741 identical(element.kind, ElementKind.PARAMETER) ||
1737 identical(element.kind, ElementKind.FUNCTION)); 1742 identical(element.kind, ElementKind.FUNCTION));
1738 } 1743 }
1739 1744
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
2039 2044
2040 MetadataAnnotation ensureResolved(Compiler compiler) { 2045 MetadataAnnotation ensureResolved(Compiler compiler) {
2041 if (resolutionState == STATE_NOT_STARTED) { 2046 if (resolutionState == STATE_NOT_STARTED) {
2042 compiler.resolver.resolveMetadataAnnotation(this); 2047 compiler.resolver.resolveMetadataAnnotation(this);
2043 } 2048 }
2044 return this; 2049 return this;
2045 } 2050 }
2046 2051
2047 String toString() => 'MetadataAnnotation($value, $resolutionState)'; 2052 String toString() => 'MetadataAnnotation($value, $resolutionState)';
2048 } 2053 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698