Chromium Code Reviews| Index: sdk/lib/_internal/compiler/js_lib/js_helper.dart |
| diff --git a/sdk/lib/_internal/compiler/js_lib/js_helper.dart b/sdk/lib/_internal/compiler/js_lib/js_helper.dart |
| index 97b1a9d9ef1a2dcf9162f8dd4af58573679c137d..7d06ee2634b52a072e4fd40fb372663c3f44b6e1 100644 |
| --- a/sdk/lib/_internal/compiler/js_lib/js_helper.dart |
| +++ b/sdk/lib/_internal/compiler/js_lib/js_helper.dart |
| @@ -1964,7 +1964,7 @@ abstract class Closure implements Function { |
| */ |
| static fromTearOff(receiver, |
| List functions, |
| - List reflectionInfo, |
| + var reflectionInfo, |
| bool isStatic, |
| jsArguments, |
| String propertyName) { |
| @@ -1978,10 +1978,15 @@ abstract class Closure implements Function { |
| String name = JS('String|Null', '#.\$stubName', function); |
| String callName = JS('String|Null', '#.\$callName', function); |
| - JS('', '#.\$reflectionInfo = #', function, reflectionInfo); |
| - ReflectionInfo info = new ReflectionInfo(function); |
| + var functionType; |
| + if (reflectionInfo is List) { |
| + JS('', '#.\$reflectionInfo = #', function, reflectionInfo); |
| + ReflectionInfo info = new ReflectionInfo(function); |
| + functionType = info.functionType; |
| + } else { |
| + functionType = reflectionInfo; |
| + } |
| - var functionType = info.functionType; |
| // function tmp() {}; |
| // tmp.prototype = BC.prototype; |
| @@ -2064,7 +2069,8 @@ abstract class Closure implements Function { |
| 'return f.apply({\$receiver:r(this)},arguments)' |
| '}' |
| '}(#,#)', functionType, getReceiver); |
| - } else { |
| + } else if (functionType != null) { |
| + // TODO(herhut): Disallow null again once we have function types. |
| throw 'Error in reflectionInfo.'; |
| } |
| @@ -2323,7 +2329,7 @@ closureFromTearOff(receiver, |
| return Closure.fromTearOff( |
| receiver, |
| JSArray.markFixedList(functions), |
| - JSArray.markFixedList(reflectionInfo), |
| + reflectionInfo is List ? JSArray.markFixedList(reflectionInfo) : reflectionInfo, |
|
zarah
2015/02/02 08:20:11
long line.
|
| JS('bool', '!!#', isStatic), |
| jsArguments, |
| JS('String', '#', name)); |