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, |