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

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: 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 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 1139
1140 /**
1141 * Returns [:true:] iff the modifiers contain either [:final:] or [:const:],
ahe 2012/08/22 14:07:46 The phrase "iff" is not standard vocabulary, so it
Johnni Winther 2012/08/22 14:23:20 The documentation was added to explain the semanti
1142 * that is, that the declaration is either explicitly or implicitly final.
1143 */
1144 bool isFinalOrConst() => isFinal() || isConst();
1145
1140 String toString() { 1146 String toString() {
1141 LinkBuilder<String> builder = new LinkBuilder<String>(); 1147 LinkBuilder<String> builder = new LinkBuilder<String>();
1142 if (isStatic()) builder.addLast('static'); 1148 if (isStatic()) builder.addLast('static');
1143 if (isAbstract()) builder.addLast('abstract'); 1149 if (isAbstract()) builder.addLast('abstract');
1144 if (isFinal()) builder.addLast('final'); 1150 if (isFinal()) builder.addLast('final');
1145 if (isVar()) builder.addLast('var'); 1151 if (isVar()) builder.addLast('var');
1146 if (isConst()) builder.addLast('const'); 1152 if (isConst()) builder.addLast('const');
1147 if (isFactory()) builder.addLast('factory'); 1153 if (isFactory()) builder.addLast('factory');
1148 if (isExternal()) builder.addLast('external'); 1154 if (isExternal()) builder.addLast('external');
1149 StringBuffer buffer = new StringBuffer(); 1155 StringBuffer buffer = new StringBuffer();
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
1753 * argument). 1759 * argument).
1754 * 1760 *
1755 * TODO(ahe): This method is controversial, the team needs to discuss 1761 * TODO(ahe): This method is controversial, the team needs to discuss
1756 * if top-level methods are acceptable and what naming conventions to 1762 * if top-level methods are acceptable and what naming conventions to
1757 * use. 1763 * use.
1758 */ 1764 */
1759 initializerDo(Node node, f(Node node)) { 1765 initializerDo(Node node, f(Node node)) {
1760 SendSet send = node.asSendSet(); 1766 SendSet send = node.asSendSet();
1761 if (send !== null) return f(send.arguments.head); 1767 if (send !== null) return f(send.arguments.head);
1762 } 1768 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698