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

Side by Side Diff: pkg/compiler/lib/src/js_backend/constant_emitter.dart

Issue 1140703006: dart2js: Construct the entire output as a single AST before printing. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Comments Created 5 years, 7 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/runtime_types.dart » ('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 part of js_backend; 5 part of js_backend;
6 6
7 typedef jsAst.Expression _ConstantReferenceGenerator(ConstantValue constant); 7 typedef jsAst.Expression _ConstantReferenceGenerator(ConstantValue constant);
8 8
9 /** 9 /**
10 * Generates the JavaScript expressions for constants. 10 * Generates the JavaScript expressions for constants.
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 return rawJavaScript.replaceAll(COMMENT_RE, ''); 289 return rawJavaScript.replaceAll(COMMENT_RE, '');
290 } 290 }
291 291
292 jsAst.Expression maybeAddTypeArguments(InterfaceType type, 292 jsAst.Expression maybeAddTypeArguments(InterfaceType type,
293 jsAst.Expression value) { 293 jsAst.Expression value) {
294 if (type is InterfaceType && 294 if (type is InterfaceType &&
295 !type.treatAsRaw && 295 !type.treatAsRaw &&
296 backend.classNeedsRti(type.element)) { 296 backend.classNeedsRti(type.element)) {
297 InterfaceType interface = type; 297 InterfaceType interface = type;
298 RuntimeTypes rti = backend.rti; 298 RuntimeTypes rti = backend.rti;
299 Iterable<String> arguments = interface.typeArguments 299 Iterable<jsAst.Expression> arguments = interface.typeArguments
300 .map((DartType type) => 300 .map((DartType type) =>
301 rti.getTypeRepresentationWithHashes(type, (_){})); 301 rti.getTypeRepresentationWithPlaceholders(type, (_){}));
302 jsAst.Expression argumentList = 302 jsAst.Expression argumentList =
303 new jsAst.LiteralString('[${arguments.join(', ')}]'); 303 new jsAst.ArrayInitializer(arguments.toList());
304 return new jsAst.Call(getHelperProperty(backend.getSetRuntimeTypeInfo()), 304 return new jsAst.Call(getHelperProperty(backend.getSetRuntimeTypeInfo()),
305 [value, argumentList]); 305 [value, argumentList]);
306 } 306 }
307 return value; 307 return value;
308 } 308 }
309 309
310 @override 310 @override
311 jsAst.Expression visitDeferred(DeferredConstantValue constant, [_]) { 311 jsAst.Expression visitDeferred(DeferredConstantValue constant, [_]) {
312 return constantReferenceGenerator(constant.referenced); 312 return constantReferenceGenerator(constant.referenced);
313 } 313 }
314 } 314 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/runtime_types.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698