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

Unified Diff: pkg/compiler/lib/src/js_backend/constant_system_javascript.dart

Issue 1927963002: Support compilation of Hello World (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fixes Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
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 {
« no previous file with comments | « pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart ('k') | pkg/compiler/lib/src/js_backend/js_backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698