| 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 da57c4a7a32ad56c0d5fe16ba445588e199a2e2a..c90cfa092c59ff8682a08c6d0ff47a616af882e1 100644
|
| --- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
|
| +++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
|
| @@ -21,7 +21,8 @@ import '../io/source_information.dart';
|
| import '../js/js.dart' as js show
|
| js,
|
| LiteralStatement,
|
| - Template;
|
| + Template,
|
| + isIdentityTemplate;
|
| import '../native/native.dart' show
|
| NativeBehavior;
|
| import '../tree/tree.dart' as ast;
|
| @@ -2702,6 +2703,13 @@ class IrBuilder {
|
| {Element dependency}) {
|
| assert(behavior != null);
|
| TypeMask type = program.getTypeMaskForForeign(behavior);
|
| + if (js.isIdentityTemplate(codeTemplate) && !program.isArrayType(type)) {
|
| + // JS expression is just a refinement.
|
| + // Do not do this for arrays - those are special because array types can
|
| + // change at runtime. The input and output must therefore be modeled
|
| + // as distinct values.
|
| + return addPrimitive(new ir.Refinement(arguments.single, type));
|
| + }
|
| ir.Primitive result = addPrimitive(new ir.ForeignCode(
|
| codeTemplate,
|
| type,
|
|
|