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

Unified Diff: dart/frog/leg/elements/elements.dart

Issue 9241014: Generate AST nodes for field initializers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: changes Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | dart/frog/leg/resolver.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/frog/leg/elements/elements.dart
diff --git a/dart/frog/leg/elements/elements.dart b/dart/frog/leg/elements/elements.dart
index 378ca04bed4fb44e0c89222a51ecd4a7423a0177..9f7f864f28ded716a3632b58bd3d364f8fd87a4d 100644
--- a/dart/frog/leg/elements/elements.dart
+++ b/dart/frog/leg/elements/elements.dart
@@ -94,20 +94,32 @@ class CompilationUnitElement extends Element {
class VariableElement extends Element {
final VariableListElement variables;
- final Node node; // The send or the identifier in the variables list.
+ Expression node; // The send or the identifier in the variables list.
Modifiers get modifiers() => variables.modifiers;
VariableElement(SourceString name,
- Node this.node,
VariableListElement this.variables,
ElementKind kind,
Element enclosing)
: super(name, kind, enclosing);
Node parseNode(Canceler canceler, Logger logger) {
- assert(node != null);
- return node;
+ if (node !== null) return node;
+ VariableDefinitions definitions = variables.parseNode(canceler, logger);
+ for (Link<Node> link = definitions.definitions.nodes;
+ !link.isEmpty(); link = link.tail) {
+ Expression initializedIdentifier = link.head;
+ Identifier identifier = initializedIdentifier.asIdentifier();
+ if (identifier === null) {
+ identifier = initializedIdentifier.asSendSet().selector.asIdentifier();
+ }
+ if (name === identifier.source) {
+ node = initializedIdentifier;
+ return node;
+ }
+ }
+ canceler.cancel('internal error: could not find $name', node: variables);
}
Type computeType(Compiler compiler) {
« no previous file with comments | « no previous file | dart/frog/leg/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698