| 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 4974de815f4dbd02632ef49f88de9fff71559418..9fa4144d97de32d5bcde8ffad1ccf2f8efdaca6a 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;
|
| @@ -2639,6 +2640,13 @@ class IrBuilder {
|
| if (type == null) {
|
| 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 after creation. 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,
|
|
|