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

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

Issue 2072223002: Enforce use of the forEachInstanceField ordering for constructed constants. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Remove tab Created 4 years, 6 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
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 dart2js.constant_system.js; 5 library dart2js.constant_system.js;
6 6
7 import '../compiler.dart' show Compiler; 7 import '../compiler.dart' show Compiler;
8 import '../constants/constant_system.dart'; 8 import '../constants/constant_system.dart';
9 import '../constants/values.dart'; 9 import '../constants/values.dart';
10 import '../constant_system_dart.dart'; 10 import '../constant_system_dart.dart';
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 ConstantValue createSymbol(Compiler compiler, String text) { 350 ConstantValue createSymbol(Compiler compiler, String text) {
351 // TODO(johnniwinther): Create a backend agnostic value. 351 // TODO(johnniwinther): Create a backend agnostic value.
352 JavaScriptBackend backend = compiler.backend; 352 JavaScriptBackend backend = compiler.backend;
353 ClassElement symbolClass = backend.helpers.symbolImplementationClass; 353 ClassElement symbolClass = backend.helpers.symbolImplementationClass;
354 InterfaceType type = symbolClass.rawType; 354 InterfaceType type = symbolClass.rawType;
355 ConstantValue argument = createString(new DartString.literal(text)); 355 ConstantValue argument = createString(new DartString.literal(text));
356 Map<FieldElement, ConstantValue> fields = <FieldElement, ConstantValue>{}; 356 Map<FieldElement, ConstantValue> fields = <FieldElement, ConstantValue>{};
357 symbolClass.forEachInstanceField( 357 symbolClass.forEachInstanceField(
358 (ClassElement enclosingClass, FieldElement field) { 358 (ClassElement enclosingClass, FieldElement field) {
359 fields[field] = argument; 359 fields[field] = argument;
360 }); 360 }, includeSuperAndInjectedMembers: true);
361 assert(fields.length == 1); 361 assert(fields.length == 1);
362 return new ConstructedConstantValue(type, fields); 362 return new ConstructedConstantValue(type, fields);
363 } 363 }
364 } 364 }
365 365
366 class JavaScriptMapConstant extends MapConstantValue { 366 class JavaScriptMapConstant extends MapConstantValue {
367 /** 367 /**
368 * The [PROTO_PROPERTY] must not be used as normal property in any JavaScript 368 * The [PROTO_PROPERTY] must not be used as normal property in any JavaScript
369 * object. It would change the prototype chain. 369 * object. It would change the prototype chain.
370 */ 370 */
(...skipping 27 matching lines...) Expand all
398 result.add(keyList); 398 result.add(keyList);
399 } else { 399 } else {
400 // Add the keys individually to avoid generating an unused list constant 400 // Add the keys individually to avoid generating an unused list constant
401 // for the keys. 401 // for the keys.
402 result.addAll(keys); 402 result.addAll(keys);
403 } 403 }
404 result.addAll(values); 404 result.addAll(values);
405 return result; 405 return result;
406 } 406 }
407 } 407 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart ('k') | pkg/compiler/lib/src/js_backend/namer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698