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

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

Issue 10837025: Properly emit variable declarations. (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
« no previous file with comments | « lib/compiler/implementation/dart_backend/emitter.dart ('k') | tests/language/language.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 return token; 166 return token;
167 } 167 }
168 168
169 Element(this.name, this.kind, this.enclosingElement) { 169 Element(this.name, this.kind, this.enclosingElement) {
170 assert(getLibrary() !== null); 170 assert(getLibrary() !== null);
171 } 171 }
172 172
173 // TODO(kasperl): This is a very bad hash code for the element and 173 // TODO(kasperl): This is a very bad hash code for the element and
174 // there's no reason why two elements with the same name should have 174 // there's no reason why two elements with the same name should have
175 // the same hash code. Replace this with a simple id in the element? 175 // the same hash code. Replace this with a simple id in the element?
176 int hashCode() => name.hashCode(); 176 int hashCode() => name === null ? 0 : name.hashCode();
177 177
178 CompilationUnitElement getCompilationUnit() { 178 CompilationUnitElement getCompilationUnit() {
179 Element element = this; 179 Element element = this;
180 while (element !== null && !element.isCompilationUnit()) { 180 while (element !== null && !element.isCompilationUnit()) {
181 element = element.enclosingElement; 181 element = element.enclosingElement;
182 } 182 }
183 return element; 183 return element;
184 } 184 }
185 185
186 LibraryElement getLibrary() { 186 LibraryElement getLibrary() {
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
1182 final Node node; 1182 final Node node;
1183 Type bound; 1183 Type bound;
1184 Type type; 1184 Type type;
1185 TypeVariableElement(name, Element enclosing, this.node, this.type, 1185 TypeVariableElement(name, Element enclosing, this.node, this.type,
1186 [this.bound]) 1186 [this.bound])
1187 : super(name, ElementKind.TYPE_VARIABLE, enclosing); 1187 : super(name, ElementKind.TYPE_VARIABLE, enclosing);
1188 Type computeType(compiler) => type; 1188 Type computeType(compiler) => type;
1189 Node parseNode(compiler) => node; 1189 Node parseNode(compiler) => node;
1190 toString() => "${enclosingElement.toString()}.${name.slowToString()}"; 1190 toString() => "${enclosingElement.toString()}.${name.slowToString()}";
1191 } 1191 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/dart_backend/emitter.dart ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698