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

Side by Side Diff: lib/compiler/implementation/js_backend/constant_emitter.dart

Issue 10905305: Patch refactoring. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased. Created 8 years, 2 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 class ConstantEmitter implements ConstantVisitor { 5 class ConstantEmitter implements ConstantVisitor {
6 final Compiler compiler; 6 final Compiler compiler;
7 final Namer namer; 7 final Namer namer;
8 8
9 CodeBuffer buffer; 9 CodeBuffer buffer;
10 bool shouldEmitCanonicalVersion; 10 bool shouldEmitCanonicalVersion;
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 199
200 shouldEmitCanonicalVersion = true; 200 shouldEmitCanonicalVersion = true;
201 201
202 ClassElement classElement = constant.type.element; 202 ClassElement classElement = constant.type.element;
203 buffer.add("new "); 203 buffer.add("new ");
204 buffer.add(getJsConstructor(classElement)); 204 buffer.add(getJsConstructor(classElement));
205 buffer.add("("); 205 buffer.add("(");
206 // The arguments of the JavaScript constructor for any given Dart class 206 // The arguments of the JavaScript constructor for any given Dart class
207 // are in the same order as the members of the class element. 207 // are in the same order as the members of the class element.
208 int emittedArgumentCount = 0; 208 int emittedArgumentCount = 0;
209 classElement.forEachInstanceField( 209 classElement.implementation.forEachInstanceField(
210 includeBackendMembers: true, 210 includeBackendMembers: true,
211 includeSuperMembers: true, 211 includeSuperMembers: true,
212 f: (ClassElement enclosing, Element field) { 212 f: (ClassElement enclosing, Element field) {
213 if (emittedArgumentCount != 0) buffer.add(", "); 213 if (emittedArgumentCount != 0) buffer.add(", ");
214 if (field.name == MapConstant.LENGTH_NAME) { 214 if (field.name == MapConstant.LENGTH_NAME) {
215 buffer.add(constant.keys.entries.length); 215 buffer.add(constant.keys.entries.length);
216 } else if (field.name == MapConstant.JS_OBJECT_NAME) { 216 } else if (field.name == MapConstant.JS_OBJECT_NAME) {
217 writeJsMap(); 217 writeJsMap();
218 } else if (field.name == MapConstant.KEYS_NAME) { 218 } else if (field.name == MapConstant.KEYS_NAME) {
219 emitCanonicalVersionOfConstant(constant.keys, buffer); 219 emitCanonicalVersionOfConstant(constant.keys, buffer);
(...skipping 23 matching lines...) Expand all
243 buffer.add(getJsConstructor(constant.type.element)); 243 buffer.add(getJsConstructor(constant.type.element));
244 buffer.add("("); 244 buffer.add("(");
245 for (int i = 0; i < constant.fields.length; i++) { 245 for (int i = 0; i < constant.fields.length; i++) {
246 if (i != 0) buffer.add(", "); 246 if (i != 0) buffer.add(", ");
247 _visit(constant.fields[i]); 247 _visit(constant.fields[i]);
248 } 248 }
249 buffer.add(")"); 249 buffer.add(")");
250 } 250 }
251 } 251 }
252 } 252 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698