Index: sdk/lib/_internal/js_runtime/lib/js_mirrors.dart |
diff --git a/sdk/lib/_internal/js_runtime/lib/js_mirrors.dart b/sdk/lib/_internal/js_runtime/lib/js_mirrors.dart |
index fc78e7287cbdbf3f445e2dc5c9dfafb7ff2420fa..4cbb163b760ca63d9b38a0c1118c1c055ad58658 100644 |
--- a/sdk/lib/_internal/js_runtime/lib/js_mirrors.dart |
+++ b/sdk/lib/_internal/js_runtime/lib/js_mirrors.dart |
@@ -2245,19 +2245,25 @@ class JsClosureMirror extends JsInstanceMirror implements ClosureMirror { |
disableTreeShaking(); |
// TODO(ahe): What about optional parameters (named or not). |
String callPrefix = "${JS_GET_NAME(JsGetName.CALL_PREFIX)}\$"; |
- var extractCallName = JS('', r''' |
-function(reflectee) { |
- var properties = Object.keys(reflectee.constructor.prototype); |
- for (var i = 0; i < properties.length; i++) { |
- var property = properties[i]; |
- if (# == property.substring(0, #) && |
- property[#] >= '0' && |
- property[#] <= '9') return property; |
- } |
- return null; |
-} |
-''', callPrefix, callPrefix.length, callPrefix.length, callPrefix.length); |
- String callName = JS('String|Null', '#(#)', extractCallName, reflectee); |
+ |
+ String callName = JS( |
+ 'String|Null', |
+ r''' |
+ (function(reflectee, callPrefix) { |
+ var properties = Object.keys(reflectee.constructor.prototype); |
+ var callPrefixLength = callPrefix.length; |
+ for (var i = 0; i < properties.length; i++) { |
+ var property = properties[i]; |
+ if (callPrefix == property.substring(0, callPrefixLength) && |
+ property[callPrefixLength] >= "0" && |
+ property[callPrefixLength] <= "9") { |
+ return property; |
+ } |
+ } |
+ return null; |
+ })(#, #)''', |
+ reflectee, callPrefix); |
+ |
if (callName == null) { |
throw new RuntimeError('Cannot find callName on "$reflectee"'); |
} |