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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart

Issue 1198293002: dart2js: Use an abstract Name class for names in the generated JavaScript ast. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix tests Created 5 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
index e7353091daa31b8eabdef88e094c5435d6fad923..e30225bc1e6b381be89aaedb0984f4f54b15fa26 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
@@ -13,7 +13,8 @@ import '../elements/elements.dart';
import '../elements/modelx.dart' show SynthesizedConstructorElementX,
ConstructorBodyElementX, FunctionSignatureX;
import '../io/source_information.dart';
-import '../js_backend/js_backend.dart' show JavaScriptBackend;
+import '../js_backend/js_backend.dart' show JavaScriptBackend,
+ SyntheticConstantKind;
import '../resolution/semantic_visitor.dart';
import '../resolution/operators.dart' as op;
import '../tree/tree.dart' as ast;
@@ -24,7 +25,7 @@ import 'cps_ir_builder.dart';
import '../native/native.dart' show NativeBehavior;
// TODO(karlklose): remove.
-import '../js/js.dart' as js show js, Template, Expression;
+import '../js/js.dart' as js show js, Template, Expression, Name;
import '../ssa/ssa.dart' show TypeMaskFactory;
import '../types/types.dart' show TypeMask;
import '../util/util.dart';
@@ -3021,8 +3022,8 @@ class JsIrBuilderVisitor extends IrBuilderVisitor {
validateArgumentCount(minimum: 2);
ast.Node builtin = argumentNodes.tail.head;
- JsBuiltin value = getEnumValue(argumentNodes.tail.head,
- backend.jsBuiltinEnum, JsBuiltin.values);
+ JsBuiltin value = getEnumValue(builtin, backend.jsBuiltinEnum,
+ JsBuiltin.values);
js.Template template = backend.emitter.builtinTemplateFor(value);
List<ir.Primitive> arguments =
argumentNodes.skip(2).mapToList(visit, growable: false);
@@ -3061,8 +3062,12 @@ class JsIrBuilderVisitor extends IrBuilderVisitor {
ast.Node argument = argumentNodes.head;
JsGetName id = getEnumValue(argument, backend.jsGetNameEnum,
JsGetName.values);
- String name = backend.namer.getNameForJsGetName(argument, id);
- return irBuilder.buildStringConstant(name);
+ js.Name name = backend.namer.getNameForJsGetName(argument, id);
+ ConstantValue nameConstant =
+ new SyntheticConstantValue(SyntheticConstantKind.NAME,
+ js.js.quoteName(name));
+
+ return irBuilder.buildConstant(nameConstant);
case 'JS_GET_FLAG':
validateArgumentCount(exactly: 1);

Powered by Google App Engine
This is Rietveld 408576698