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

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

Issue 11817013: Do not apply optimizations based on an element if that element cannot be resolved. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 months 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 static const ElementKind LABEL = 113 static const ElementKind LABEL =
114 const ElementKind('label', ElementCategory.NONE); 114 const ElementKind('label', ElementCategory.NONE);
115 static const ElementKind VOID = 115 static const ElementKind VOID =
116 const ElementKind('void', ElementCategory.NONE); 116 const ElementKind('void', ElementCategory.NONE);
117 117
118 static const ElementKind AMBIGUOUS = 118 static const ElementKind AMBIGUOUS =
119 const ElementKind('ambiguous', ElementCategory.NONE); 119 const ElementKind('ambiguous', ElementCategory.NONE);
120 static const ElementKind ERROR = 120 static const ElementKind ERROR =
121 const ElementKind('error', ElementCategory.NONE); 121 const ElementKind('error', ElementCategory.NONE);
122 static const ElementKind MALFORMED_TYPE = 122 static const ElementKind MALFORMED_TYPE =
123 const ElementKind('malformed', ElementCategory.NONE); 123 const ElementKind('malformed', ElementCategory.NONE);
Johnni Winther 2013/01/10 07:09:55 I don't think this kind is used anymore.
ngeoffray 2013/01/10 09:41:48 As discussed, I'll leave it to you or another CL.
124 static const ElementKind UNRESOLVED =
ahe 2013/01/09 15:46:27 Could you use ErroneousElement instead?
Johnni Winther 2013/01/10 07:09:55 ErroneousElement has a different semantics in the
ahe 2013/01/10 07:32:07 I don't see why. The element is only used by the m
Johnni Winther 2013/01/10 08:19:47 You are right. I thought it was used by production
ngeoffray 2013/01/10 09:41:48 Yes, Done.
125 const ElementKind('unresolved', ElementCategory.NONE);
124 126
125 toString() => id; 127 toString() => id;
126 } 128 }
127 129
128 class Element implements Spannable { 130 class Element implements Spannable {
129 static int elementHashCode = 0; 131 static int elementHashCode = 0;
130 132
131 final SourceString name; 133 final SourceString name;
132 final ElementKind kind; 134 final ElementKind kind;
133 final Element enclosingElement; 135 final Element enclosingElement;
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 424
423 getLibrary() => enclosingElement.getLibrary(); 425 getLibrary() => enclosingElement.getLibrary();
424 426
425 String toString() { 427 String toString() {
426 String n = name.slowToString(); 428 String n = name.slowToString();
427 return '<$n: ${messageKind.message(messageArguments)}>'; 429 return '<$n: ${messageKind.message(messageArguments)}>';
428 } 430 }
429 } 431 }
430 432
431 /** 433 /**
432 * An ambiguous element represent multiple elements accessible by the same name. 434 * An unresolved element represents a selector we did not try to
435 * resolve.
436 */
437 class UnresolvedElement extends Element {
438 UnresolvedElement(SourceString name, Element enclosing)
439 : super(name, ElementKind.UNRESOLVED, enclosing);
440 }
441
442 /**
443 * An ambiguous element represents multiple elements accessible by the same name .
Johnni Winther 2013/01/10 07:09:55 Long line.
ngeoffray 2013/01/10 09:41:48 Done.
433 * 444 *
434 * Ambiguous elements are created during handling of import/export scopes. If an 445 * Ambiguous elements are created during handling of import/export scopes. If an
435 * ambiguous element is encountered during resolution a warning/error should be 446 * ambiguous element is encountered during resolution a warning/error should be
436 * reported. 447 * reported.
437 */ 448 */
438 class AmbiguousElement extends Element { 449 class AmbiguousElement extends Element {
439 /** 450 /**
440 * The message to report on resolving this element. 451 * The message to report on resolving this element.
441 */ 452 */
442 final MessageKind messageKind; 453 final MessageKind messageKind;
(...skipping 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after
2155 2166
2156 MetadataAnnotation ensureResolved(Compiler compiler) { 2167 MetadataAnnotation ensureResolved(Compiler compiler) {
2157 if (resolutionState == STATE_NOT_STARTED) { 2168 if (resolutionState == STATE_NOT_STARTED) {
2158 compiler.resolver.resolveMetadataAnnotation(this); 2169 compiler.resolver.resolveMetadataAnnotation(this);
2159 } 2170 }
2160 return this; 2171 return this;
2161 } 2172 }
2162 2173
2163 String toString() => 'MetadataAnnotation($value, $resolutionState)'; 2174 String toString() => 'MetadataAnnotation($value, $resolutionState)';
2164 } 2175 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698