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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder.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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
index c92471617d0b4cb2bf3e551e5baa3f1d08a71e5e..131922e545b95df76a0074c7b19ea8c81daec713 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
@@ -19,6 +19,10 @@ import 'cps_ir_nodes.dart' as ir;
import 'cps_ir_builder_task.dart' show DartCapturedVariables,
GlobalProgramInformation;
+import '../common.dart' as types show TypeMask;
+import '../js/js.dart' as js show Template;
+import '../native/native.dart' show NativeBehavior;
+
/// A mapping from variable elements to their compile-time values.
///
/// Map elements denoted by parameters and local variables to the
@@ -2391,6 +2395,27 @@ class JsIrBuilder extends IrBuilder {
return addPrimitive(new ir.CreateInvocationMirror(selector, arguments));
}
+ ir.Primitive buildForeignCode(js.Template codeTemplate,
+ List<ir.Primitive> arguments,
+ NativeBehavior behavior,
+ {Element dependency}) {
+ types.TypeMask type = program.getTypeMaskForForeign(behavior);
+ if (codeTemplate.isExpression) {
+ return _continueWithExpression((k) => new ir.ForeignCode(
+ codeTemplate,
+ type,
+ arguments,
+ behavior,
+ continuation: k,
+ dependency: dependency));
+ } else {
+ assert(isOpen);
+ add(new ir.ForeignCode(codeTemplate, type, arguments, behavior,
+ dependency: dependency));
+ _current = null;
+ }
+ }
+
@override
ir.Primitive buildTypeOperator(ir.Primitive value,
DartType type,
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698