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

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

Issue 1185633003: cps-ir: Support foreign code. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Update test expectations. 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/js_backend/codegen/codegen.dart
diff --git a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
index 78ccd5829e5cb30eaef2996fc59e5e308f9eba5c..b95819bf05b32f69d7e06f6aa5c57e9683f57dd0 100644
--- a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
@@ -614,7 +614,7 @@ class CodeGenerator extends tree_ir.StatementVisitor
js.Expression argumentNames = new js.ArrayInitializer(
node.selector.namedArguments.map(js.string).toList(growable: false));
return buildStaticHelperInvocation(glue.createInvocationMirrorMethod,
- [name, internalName, kind, arguments, argumentNames]);
+ <js.Expression>[name, internalName, kind, arguments, argumentNames]);
}
@override
@@ -700,6 +700,21 @@ class CodeGenerator extends tree_ir.StatementVisitor
return glue.generateTypeRepresentation(node.dartType, arguments);
}
+ js.Node handleForeignCode(tree_ir.ForeignCode node) {
+ registry.registerStaticUse(node.dependency);
+ return node.codeTemplate.instantiate(visitExpressionList(node.arguments));
+ }
+
+ @override
+ js.Expression visitForeignExpression(tree_ir.ForeignExpression node) {
+ return handleForeignCode(node);
+ }
+
+ @override
+ visitForeignStatement(tree_ir.ForeignStatement node) {
+ return handleForeignCode(node);
+ }
+
@override
js.Expression visitApplyBuiltinOperator(tree_ir.ApplyBuiltinOperator node) {
List<js.Expression> args = visitExpressionList(node.arguments);
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/type_propagation.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/js_tree_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698