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

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

Issue 2343193002: Do not add type information to constants with constructor taking type information (Closed)
Patch Set: Created 4 years, 3 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 | no next file » | 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 import '../common.dart'; 5 import '../common.dart';
6 import '../compiler.dart' show Compiler; 6 import '../compiler.dart' show Compiler;
7 import '../constants/values.dart'; 7 import '../constants/values.dart';
8 import '../dart_types.dart'; 8 import '../dart_types.dart';
9 import '../elements/elements.dart'; 9 import '../elements/elements.dart';
10 import '../io/code_output.dart'; 10 import '../io/code_output.dart';
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 jsAst.Expression constructor = 308 jsAst.Expression constructor =
309 backend.emitter.constructorAccess(constant.type.element); 309 backend.emitter.constructorAccess(constant.type.element);
310 List<jsAst.Expression> fields = <jsAst.Expression>[]; 310 List<jsAst.Expression> fields = <jsAst.Expression>[];
311 element.forEachInstanceField((_, FieldElement field) { 311 element.forEachInstanceField((_, FieldElement field) {
312 fields.add(constantReferenceGenerator(constant.fields[field])); 312 fields.add(constantReferenceGenerator(constant.fields[field]));
313 }, includeSuperAndInjectedMembers: true); 313 }, includeSuperAndInjectedMembers: true);
314 if (backend.classNeedsRtiField(constant.type.element)) { 314 if (backend.classNeedsRtiField(constant.type.element)) {
315 fields.add(_reifiedTypeArguments(constant.type)); 315 fields.add(_reifiedTypeArguments(constant.type));
316 } 316 }
317 jsAst.New instantiation = new jsAst.New(constructor, fields); 317 jsAst.New instantiation = new jsAst.New(constructor, fields);
318 return maybeAddTypeArguments(constant.type, instantiation); 318 return instantiation;
Siggi Cherem (dart-lang) 2016/09/16 18:39:02 to clarify: is this because the type-information i
sra1 2016/09/16 20:09:08 Exactly. Line 315.
319 } 319 }
320 320
321 String stripComments(String rawJavaScript) { 321 String stripComments(String rawJavaScript) {
322 return rawJavaScript.replaceAll(COMMENT_RE, ''); 322 return rawJavaScript.replaceAll(COMMENT_RE, '');
323 } 323 }
324 324
325 jsAst.Expression maybeAddTypeArguments( 325 jsAst.Expression maybeAddTypeArguments(
326 InterfaceType type, jsAst.Expression value) { 326 InterfaceType type, jsAst.Expression value) {
327 if (type is InterfaceType && 327 if (type is InterfaceType &&
328 !type.treatAsRaw && 328 !type.treatAsRaw &&
(...skipping 20 matching lines...) Expand all
349 arguments.add(rtiEncoder.getTypeRepresentation(argument, unexpected)); 349 arguments.add(rtiEncoder.getTypeRepresentation(argument, unexpected));
350 } 350 }
351 return new jsAst.ArrayInitializer(arguments); 351 return new jsAst.ArrayInitializer(arguments);
352 } 352 }
353 353
354 @override 354 @override
355 jsAst.Expression visitDeferred(DeferredConstantValue constant, [_]) { 355 jsAst.Expression visitDeferred(DeferredConstantValue constant, [_]) {
356 return constantReferenceGenerator(constant.referenced); 356 return constantReferenceGenerator(constant.referenced);
357 } 357 }
358 } 358 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698