Index: pkg/compiler/lib/src/js_backend/constant_system_javascript.dart |
diff --git a/pkg/compiler/lib/src/js_backend/constant_system_javascript.dart b/pkg/compiler/lib/src/js_backend/constant_system_javascript.dart |
index add75637e5d282b2acfb571c26721b598796a740..f3d2b4c98e072432885e863e6fbecc5aaf57e05e 100644 |
--- a/pkg/compiler/lib/src/js_backend/constant_system_javascript.dart |
+++ b/pkg/compiler/lib/src/js_backend/constant_system_javascript.dart |
@@ -10,7 +10,7 @@ import '../constants/values.dart'; |
import '../constant_system_dart.dart'; |
import '../core_types.dart' show CoreTypes; |
import '../dart_types.dart'; |
-import '../elements/elements.dart' show ClassElement; |
+import '../elements/elements.dart' show ClassElement, FieldElement; |
import '../tree/tree.dart' show DartString, LiteralDartString; |
import 'js_backend.dart'; |
@@ -345,6 +345,21 @@ class JavaScriptConstantSystem extends ConstantSystem { |
return new JavaScriptMapConstant( |
type, keysList, values, protoValue, onlyStringKeys); |
} |
+ |
+ @override |
+ ConstantValue createSymbol(Compiler compiler, String text) { |
+ // TODO(johnniwinther): Create a backend agnostic value. |
+ InterfaceType type = compiler.coreTypes.symbolType; |
+ ConstantValue argument = createString(new DartString.literal(text)); |
+ Map<FieldElement, ConstantValue> fields = <FieldElement, ConstantValue>{}; |
+ JavaScriptBackend backend = compiler.backend; |
+ backend.helpers.symbolImplementationClass.forEachInstanceField( |
+ (ClassElement enclosingClass, FieldElement field) { |
+ fields[field] = argument; |
+ }); |
+ assert(fields.length == 1); |
+ return new ConstructedConstantValue(type, fields); |
+ } |
} |
class JavaScriptMapConstant extends MapConstantValue { |