@@ -375,14 +375,16 @@ Rti instanceType(object) {
375
375
var rti = JS ('' , r'#[#]' , object, JS_GET_NAME (JsGetName .RTI_NAME ));
376
376
if (rti != null ) return _castToRti (rti);
377
377
378
- // Subclasses of Closure are synthetic classes, so make them appear to be
379
- // the 'Closure' class.
378
+ // Subclasses of Closure are synthetic classes. The synthetic classes all
379
+ // extend a 'normal' class (Closure, BoundClosure, StaticClosure), so make
380
+ // them appear to be the superclass.
380
381
// TODO(sra): Can this be done less expensively, e.g. by putting $ti on the
381
- // prototype of Closure class ?
382
+ // prototype of Closure/BoundClosure/StaticClosure classes ?
382
383
var closureClassConstructor = JS_BUILTIN (
383
384
'depends:none;effects:none;' , JsBuiltin .dartClosureConstructor);
384
385
if (_Utils .instanceOf (object, closureClassConstructor)) {
385
- return _instanceTypeFromConstructor (closureClassConstructor);
386
+ return _instanceTypeFromConstructor (
387
+ JS ('' , '#.__proto__.__proto__.constructor' , object));
386
388
}
387
389
388
390
return _instanceTypeFromConstructor (JS ('' , '#.constructor' , object));
@@ -441,7 +443,7 @@ Rti getTypeFromTypesTable(/*int*/ _index) {
441
443
}
442
444
443
445
Type getRuntimeType (object) {
444
- Rti rti = instanceType (object);
446
+ Rti rti = _instanceFunctionType (object) ?? instanceType (object);
445
447
return _createRuntimeType (rti);
446
448
}
447
449
0 commit comments