| Index: sdk/lib/_internal/js_runtime/lib/js_rti.dart
|
| diff --git a/sdk/lib/_internal/js_runtime/lib/js_rti.dart b/sdk/lib/_internal/js_runtime/lib/js_rti.dart
|
| index 60af58d2331934fe80ff2803951787b68ab29902..65ae2576c9ee0b882bfd868eeb21c4371b3ebbf0 100644
|
| --- a/sdk/lib/_internal/js_runtime/lib/js_rti.dart
|
| +++ b/sdk/lib/_internal/js_runtime/lib/js_rti.dart
|
| @@ -237,11 +237,17 @@ substitute(var substitution, var arguments) {
|
| assert(arguments == null || isJsArray(arguments));
|
| if (isJsFunction(substitution)) {
|
| substitution = invoke(substitution, arguments);
|
| - if (substitution == null || isJsArray(substitution)) {
|
| - arguments = substitution;
|
| - } else if (isJsFunction(substitution)) {
|
| + if (substitution == null) return substitution;
|
| + if (isJsArray(substitution)) {
|
| + // Substitutions are generated too late to mark Array as used, so use a
|
| + // tautological JS 'cast' to mark Array as used. This is needed only in
|
| + // some tiny tests where the substition is the only thing that creates an
|
| + // Array.
|
| + return JS('JSArray', '#', substitution);
|
| + }
|
| + if (isJsFunction(substitution)) {
|
| // TODO(johnniwinther): Check if this is still needed.
|
| - arguments = invoke(substitution, arguments);
|
| + return invoke(substitution, arguments);
|
| }
|
| }
|
| return arguments;
|
|
|