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

Side by Side Diff: lib/compiler/implementation/tree/nodes.dart

Issue 10855174: Lazy implementation of final variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase wrt CL 10832351. Created 8 years, 4 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 interface Visitor<R> { 5 interface Visitor<R> {
6 R visitBlock(Block node); 6 R visitBlock(Block node);
7 R visitBreakStatement(BreakStatement node); 7 R visitBreakStatement(BreakStatement node);
8 R visitCascade(Cascade node); 8 R visitCascade(Cascade node);
9 R visitCascadeReceiver(CascadeReceiver node); 9 R visitCascadeReceiver(CascadeReceiver node);
10 R visitCaseMatch(CaseMatch node); 10 R visitCaseMatch(CaseMatch node);
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 accept(Visitor visitor) => visitor.visitModifiers(this); 1129 accept(Visitor visitor) => visitor.visitModifiers(this);
1130 visitChildren(Visitor visitor) => nodes.accept(visitor); 1130 visitChildren(Visitor visitor) => nodes.accept(visitor);
1131 1131
1132 bool isStatic() => (flags & FLAG_STATIC) != 0; 1132 bool isStatic() => (flags & FLAG_STATIC) != 0;
1133 bool isAbstract() => (flags & FLAG_ABSTRACT) != 0; 1133 bool isAbstract() => (flags & FLAG_ABSTRACT) != 0;
1134 bool isFinal() => (flags & FLAG_FINAL) != 0; 1134 bool isFinal() => (flags & FLAG_FINAL) != 0;
1135 bool isVar() => (flags & FLAG_VAR) != 0; 1135 bool isVar() => (flags & FLAG_VAR) != 0;
1136 bool isConst() => (flags & FLAG_CONST) != 0; 1136 bool isConst() => (flags & FLAG_CONST) != 0;
1137 bool isFactory() => (flags & FLAG_FACTORY) != 0; 1137 bool isFactory() => (flags & FLAG_FACTORY) != 0;
1138 bool isExternal() => (flags & FLAG_EXTERNAL) != 0; 1138 bool isExternal() => (flags & FLAG_EXTERNAL) != 0;
1139 bool isFinalOrConst() => (flags & (FLAG_FINAL | FLAG_CONST)) != 0;
1139 1140
1140 String toString() { 1141 String toString() {
1141 LinkBuilder<String> builder = new LinkBuilder<String>(); 1142 LinkBuilder<String> builder = new LinkBuilder<String>();
1142 if (isStatic()) builder.addLast('static'); 1143 if (isStatic()) builder.addLast('static');
1143 if (isAbstract()) builder.addLast('abstract'); 1144 if (isAbstract()) builder.addLast('abstract');
1144 if (isFinal()) builder.addLast('final'); 1145 if (isFinal()) builder.addLast('final');
1145 if (isVar()) builder.addLast('var'); 1146 if (isVar()) builder.addLast('var');
1146 if (isConst()) builder.addLast('const'); 1147 if (isConst()) builder.addLast('const');
1147 if (isFactory()) builder.addLast('factory'); 1148 if (isFactory()) builder.addLast('factory');
1148 if (isExternal()) builder.addLast('external'); 1149 if (isExternal()) builder.addLast('external');
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
1671 } 1672 }
1672 1673
1673 class CatchBlock extends Node { 1674 class CatchBlock extends Node {
1674 final TypeAnnotation type; 1675 final TypeAnnotation type;
1675 final NodeList formals; 1676 final NodeList formals;
1676 final Block block; 1677 final Block block;
1677 1678
1678 final Token onKeyword; 1679 final Token onKeyword;
1679 final Token catchKeyword; 1680 final Token catchKeyword;
1680 1681
1681 CatchBlock(this.type, this.formals, this.block, 1682 CatchBlock(this.type, this.formals, this.block,
1682 this.onKeyword, this.catchKeyword); 1683 this.onKeyword, this.catchKeyword);
1683 1684
1684 CatchBlock asCatchBlock() => this; 1685 CatchBlock asCatchBlock() => this;
1685 1686
1686 accept(Visitor visitor) => visitor.visitCatchBlock(this); 1687 accept(Visitor visitor) => visitor.visitCatchBlock(this);
1687 1688
1688 Node get exception() { 1689 Node get exception() {
1689 if (formals.nodes.isEmpty()) return null; 1690 if (formals.nodes.isEmpty()) return null;
1690 VariableDefinitions declarations = formals.nodes.head; 1691 VariableDefinitions declarations = formals.nodes.head;
1691 return declarations.definitions.nodes.head; 1692 return declarations.definitions.nodes.head;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1753 * argument). 1754 * argument).
1754 * 1755 *
1755 * TODO(ahe): This method is controversial, the team needs to discuss 1756 * TODO(ahe): This method is controversial, the team needs to discuss
1756 * if top-level methods are acceptable and what naming conventions to 1757 * if top-level methods are acceptable and what naming conventions to
1757 * use. 1758 * use.
1758 */ 1759 */
1759 initializerDo(Node node, f(Node node)) { 1760 initializerDo(Node node, f(Node node)) {
1760 SendSet send = node.asSendSet(); 1761 SendSet send = node.asSendSet();
1761 if (send !== null) return f(send.arguments.head); 1762 if (send !== null) return f(send.arguments.head);
1762 } 1763 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698