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

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

Issue 10879003: Const variables handled as final (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Comment shortened 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 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 visitChildren(Visitor visitor) => nodes.accept(visitor); 1133 visitChildren(Visitor visitor) => nodes.accept(visitor);
1134 1134
1135 bool isStatic() => (flags & FLAG_STATIC) != 0; 1135 bool isStatic() => (flags & FLAG_STATIC) != 0;
1136 bool isAbstract() => (flags & FLAG_ABSTRACT) != 0; 1136 bool isAbstract() => (flags & FLAG_ABSTRACT) != 0;
1137 bool isFinal() => (flags & FLAG_FINAL) != 0; 1137 bool isFinal() => (flags & FLAG_FINAL) != 0;
1138 bool isVar() => (flags & FLAG_VAR) != 0; 1138 bool isVar() => (flags & FLAG_VAR) != 0;
1139 bool isConst() => (flags & FLAG_CONST) != 0; 1139 bool isConst() => (flags & FLAG_CONST) != 0;
1140 bool isFactory() => (flags & FLAG_FACTORY) != 0; 1140 bool isFactory() => (flags & FLAG_FACTORY) != 0;
1141 bool isExternal() => (flags & FLAG_EXTERNAL) != 0; 1141 bool isExternal() => (flags & FLAG_EXTERNAL) != 0;
1142 1142
1143 /**
1144 * Use this to check if the declaration is either explicitly or implicitly
1145 * final.
1146 */
1147 bool isFinalOrConst() => isFinal() || isConst();
1148
1143 String toString() { 1149 String toString() {
1144 LinkBuilder<String> builder = new LinkBuilder<String>(); 1150 LinkBuilder<String> builder = new LinkBuilder<String>();
1145 if (isStatic()) builder.addLast('static'); 1151 if (isStatic()) builder.addLast('static');
1146 if (isAbstract()) builder.addLast('abstract'); 1152 if (isAbstract()) builder.addLast('abstract');
1147 if (isFinal()) builder.addLast('final'); 1153 if (isFinal()) builder.addLast('final');
1148 if (isVar()) builder.addLast('var'); 1154 if (isVar()) builder.addLast('var');
1149 if (isConst()) builder.addLast('const'); 1155 if (isConst()) builder.addLast('const');
1150 if (isFactory()) builder.addLast('factory'); 1156 if (isFactory()) builder.addLast('factory');
1151 if (isExternal()) builder.addLast('external'); 1157 if (isExternal()) builder.addLast('external');
1152 StringBuffer buffer = new StringBuffer(); 1158 StringBuffer buffer = new StringBuffer();
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
1756 * argument). 1762 * argument).
1757 * 1763 *
1758 * TODO(ahe): This method is controversial, the team needs to discuss 1764 * TODO(ahe): This method is controversial, the team needs to discuss
1759 * if top-level methods are acceptable and what naming conventions to 1765 * if top-level methods are acceptable and what naming conventions to
1760 * use. 1766 * use.
1761 */ 1767 */
1762 initializerDo(Node node, f(Node node)) { 1768 initializerDo(Node node, f(Node node)) {
1763 SendSet send = node.asSendSet(); 1769 SendSet send = node.asSendSet();
1764 if (send !== null) return f(send.arguments.head); 1770 if (send !== null) return f(send.arguments.head);
1765 } 1771 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698