Chromium Code Reviews| 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 #import('../tree/tree.dart'); | 9 #import('../tree/tree.dart'); |
| 10 #import('../scanner/scannerlib.dart'); | 10 #import('../scanner/scannerlib.dart'); |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 311 * e.g., the name of the element we were trying to resolve.) | 311 * e.g., the name of the element we were trying to resolve.) |
| 312 * | 312 * |
| 313 * Code that cannot not handle an [ErroneousElement] should use | 313 * Code that cannot not handle an [ErroneousElement] should use |
| 314 * [: Element.isInvalid(element) :] | 314 * [: Element.isInvalid(element) :] |
| 315 * to check for unresolvable elements instead of | 315 * to check for unresolvable elements instead of |
| 316 * [: element == null :]. | 316 * [: element == null :]. |
| 317 */ | 317 */ |
| 318 class ErroneousElement extends Element { | 318 class ErroneousElement extends Element { |
| 319 final Message errorMessage; | 319 final Message errorMessage; |
| 320 | 320 |
| 321 ErroneousElement(this.errorMessage, Element enclosing) | 321 ErroneousElement(this.errorMessage, Element enclosing) |
|
ngeoffray
2012/09/05 11:46:45
As discussed, you might want to pass a node to thi
karlklose
2012/09/05 14:53:42
For now, I changed internalError to report on the
| |
| 322 : super(const SourceString('erroneous element'), null, enclosing); | 322 : super(const SourceString('erroneous element'), null, enclosing); |
| 323 | 323 |
| 324 isErroneous() => true; | 324 isErroneous() => true; |
| 325 | 325 |
| 326 unsupported() { | 326 unsupported() { |
| 327 throw 'unsupported operation on erroneous element'; | 327 throw 'unsupported operation on erroneous element'; |
| 328 } | 328 } |
| 329 | 329 |
| 330 SourceString get name => unsupported(); | 330 SourceString get name => unsupported(); |
| 331 ElementKind get kind => unsupported(); | 331 ElementKind get kind => unsupported(); |
| 332 Link<MetadataAnnotation> get metadata => unsupported(); | 332 Link<MetadataAnnotation> get metadata => unsupported(); |
| 333 | |
| 334 getLibrary() => enclosingElement.getLibrary(); | |
|
ngeoffray
2012/09/05 11:46:45
I think you don't need this.
karlklose
2012/09/05 14:53:42
It is called from the Element constructor in an as
ngeoffray
2012/09/07 08:12:46
Bu how is this implementation different than Eleme
karlklose
2012/09/07 09:24:01
It does not check for the kind of itself, because
| |
| 333 } | 335 } |
| 334 | 336 |
| 335 class ErroneousFunctionElement extends ErroneousElement | 337 class ErroneousFunctionElement extends ErroneousElement |
| 336 implements FunctionElement { | 338 implements FunctionElement { |
| 337 ErroneousFunctionElement(errorMessage, Element enclosing) | 339 ErroneousFunctionElement(errorMessage, Element enclosing) |
| 338 : super(errorMessage, enclosing); | 340 : super(errorMessage, enclosing); |
| 339 | 341 |
| 340 get type => unsupported(); | 342 get type => unsupported(); |
| 341 get cachedNode => unsupported(); | 343 get cachedNode => unsupported(); |
| 342 get functionSignature => unsupported(); | 344 get functionSignature => unsupported(); |
| 343 get patch => unsupported(); | 345 get patch => unsupported(); |
| 344 get defaultImplementation => unsupported(); | 346 get defaultImplementation => unsupported(); |
| 345 bool get isPatched => unsupported(); | 347 bool get isPatched => unsupported(); |
| 346 setPatch(patch) => unsupported(); | 348 setPatch(patch) => unsupported(); |
| 347 computeSignature(compiler) => unsupported(); | 349 computeSignature(compiler) => unsupported(); |
| 348 requiredParameterCount(compiler) => unsupported(); | 350 requiredParameterCount(compiler) => unsupported(); |
| 349 optionalParameterCount(compiler) => unsupported(); | 351 optionalParameterCount(compiler) => unsupported(); |
| 350 parameterCount(copmiler) => unsupported(); | 352 parameterCount(copmiler) => unsupported(); |
| 351 | |
| 352 getLibrary() => enclosingElement.getLibrary(); | |
| 353 } | 353 } |
| 354 | 354 |
| 355 class ContainerElement extends Element { | 355 class ContainerElement extends Element { |
| 356 Link<Element> localMembers = const EmptyLink<Element>(); | 356 Link<Element> localMembers = const EmptyLink<Element>(); |
| 357 | 357 |
| 358 ContainerElement(name, kind, enclosingElement) | 358 ContainerElement(name, kind, enclosingElement) |
| 359 : super(name, kind, enclosingElement); | 359 : super(name, kind, enclosingElement); |
| 360 | 360 |
| 361 void addMember(Element element, DiagnosticListener listener) { | 361 void addMember(Element element, DiagnosticListener listener) { |
| 362 localMembers = localMembers.prepend(element); | 362 localMembers = localMembers.prepend(element); |
| (...skipping 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1652 | 1652 |
| 1653 MetadataAnnotation ensureResolved(Compiler compiler) { | 1653 MetadataAnnotation ensureResolved(Compiler compiler) { |
| 1654 if (resolutionState == STATE_NOT_STARTED) { | 1654 if (resolutionState == STATE_NOT_STARTED) { |
| 1655 compiler.resolver.resolveMetadataAnnotation(this); | 1655 compiler.resolver.resolveMetadataAnnotation(this); |
| 1656 } | 1656 } |
| 1657 return this; | 1657 return this; |
| 1658 } | 1658 } |
| 1659 | 1659 |
| 1660 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | 1660 String toString() => 'MetadataAnnotation($value, $resolutionState)'; |
| 1661 } | 1661 } |
| OLD | NEW |