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

Side by Side Diff: lib/compiler/implementation/elements/elements.dart

Issue 10855174: Lazy implementation of final variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix tests. 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 #library('elements'); 5 #library('elements');
6 6
7 #import('../tree/tree.dart'); 7 #import('../tree/tree.dart');
8 #import('../scanner/scannerlib.dart'); 8 #import('../scanner/scannerlib.dart');
9 #import('../leg.dart'); // TODO(karlklose): we only need type. 9 #import('../leg.dart'); // TODO(karlklose): we only need type.
10 #import('../util/util.dart'); 10 #import('../util/util.dart');
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 bool impliesType() => (kind.category & ElementCategory.IMPLIES_TYPE) != 0; 152 bool impliesType() => (kind.category & ElementCategory.IMPLIES_TYPE) != 0;
153 bool isExtendable() => (kind.category & ElementCategory.IS_EXTENDABLE) != 0; 153 bool isExtendable() => (kind.category & ElementCategory.IS_EXTENDABLE) != 0;
154 154
155 // TODO(johnniwinther): This breaks for libraries (for which enclosing 155 // TODO(johnniwinther): This breaks for libraries (for which enclosing
156 // elements are null) and is invalid for top level variable declarations for 156 // elements are null) and is invalid for top level variable declarations for
157 // which the enclosing element is a VariableDeclarations and not a compilation 157 // which the enclosing element is a VariableDeclarations and not a compilation
158 // unit. 158 // unit.
159 bool isTopLevel() => enclosingElement.isCompilationUnit(); 159 bool isTopLevel() => enclosingElement.isCompilationUnit();
160 160
161 bool isAssignable() { 161 bool isAssignable() {
162 if (modifiers != null && modifiers.isFinal()) return false; 162 if (modifiers != null
163 && (modifiers.isFinal() || modifiers.isConst())) return false;
kasperl 2012/08/16 14:41:37 Maybe introduce a modifiers.isFinalOrConst()?
floitsch 2012/08/16 22:52:33 Done.
163 if (isFunction() || isGenerativeConstructor()) return false; 164 if (isFunction() || isGenerativeConstructor()) return false;
164 return true; 165 return true;
165 } 166 }
166 167
167 Token position() => null; 168 Token position() => null;
168 169
169 Token findMyName(Token token) { 170 Token findMyName(Token token) {
170 for (Token t = token; t.kind !== EOF_TOKEN; t = t.next) { 171 for (Token t = token; t.kind !== EOF_TOKEN; t = t.next) {
171 if (t.value == name) return t; 172 if (t.value == name) return t;
172 } 173 }
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 TypeVariableElement(name, Element enclosing, this.cachedNode, 1285 TypeVariableElement(name, Element enclosing, this.cachedNode,
1285 [this.type, this.bound]) 1286 [this.type, this.bound])
1286 : super(name, ElementKind.TYPE_VARIABLE, enclosing); 1287 : super(name, ElementKind.TYPE_VARIABLE, enclosing);
1287 1288
1288 TypeVariableType computeType(compiler) => type; 1289 TypeVariableType computeType(compiler) => type;
1289 1290
1290 Node parseNode(compiler) => cachedNode; 1291 Node parseNode(compiler) => cachedNode;
1291 1292
1292 String toString() => "${enclosingElement.toString()}.${name.slowToString()}"; 1293 String toString() => "${enclosingElement.toString()}.${name.slowToString()}";
1293 } 1294 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698