Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 342 } else { | 342 } else { |
| 343 type = new InterfaceType(classElement, typeArgument); | 343 type = new InterfaceType(classElement, typeArgument); |
| 344 } | 344 } |
| 345 return new JavaScriptMapConstant( | 345 return new JavaScriptMapConstant( |
| 346 type, keysList, values, protoValue, onlyStringKeys); | 346 type, keysList, values, protoValue, onlyStringKeys); |
| 347 } | 347 } |
| 348 | 348 |
| 349 @override | 349 @override |
| 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 InterfaceType type = compiler.coreTypes.symbolType; | 352 JavaScriptBackend backend = compiler.backend; |
| 353 ClassElement symbolClass = backend.helpers.symbolImplementationClass; | |
| 354 InterfaceType type = symbolClass.rawType; | |
|
Siggi Cherem (dart-lang)
2016/05/26 19:52:15
shouldn't symbolClass.rawType and coreTypes.symbol
Johnni Winther
2016/05/27 08:51:24
It's worse. `coreTypes.symbolType` is the one defi
Siggi Cherem (dart-lang)
2016/05/27 17:27:08
yikes - should we change the patch file to directl
Johnni Winther
2016/05/30 07:58:23
I think we want to share the implementation betwee
| |
| 353 ConstantValue argument = createString(new DartString.literal(text)); | 355 ConstantValue argument = createString(new DartString.literal(text)); |
| 354 Map<FieldElement, ConstantValue> fields = <FieldElement, ConstantValue>{}; | 356 Map<FieldElement, ConstantValue> fields = <FieldElement, ConstantValue>{}; |
| 355 JavaScriptBackend backend = compiler.backend; | 357 symbolClass.forEachInstanceField( |
| 356 backend.helpers.symbolImplementationClass.forEachInstanceField( | |
| 357 (ClassElement enclosingClass, FieldElement field) { | 358 (ClassElement enclosingClass, FieldElement field) { |
| 358 fields[field] = argument; | 359 fields[field] = argument; |
| 359 }); | 360 }); |
| 360 assert(fields.length == 1); | 361 assert(fields.length == 1); |
| 361 return new ConstructedConstantValue(type, fields); | 362 return new ConstructedConstantValue(type, fields); |
| 362 } | 363 } |
| 363 } | 364 } |
| 364 | 365 |
| 365 class JavaScriptMapConstant extends MapConstantValue { | 366 class JavaScriptMapConstant extends MapConstantValue { |
| 366 /** | 367 /** |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 397 result.add(keyList); | 398 result.add(keyList); |
| 398 } else { | 399 } else { |
| 399 // Add the keys individually to avoid generating an unused list constant | 400 // Add the keys individually to avoid generating an unused list constant |
| 400 // for the keys. | 401 // for the keys. |
| 401 result.addAll(keys); | 402 result.addAll(keys); |
| 402 } | 403 } |
| 403 result.addAll(values); | 404 result.addAll(values); |
| 404 return result; | 405 return result; |
| 405 } | 406 } |
| 406 } | 407 } |
| OLD | NEW |