* Can not use instanceof, consider different scope by * cross domain or es module import in ec extensions. * Mount a method "isInstance()" to Clz.
(Clz)
| 12287 | * Mount a method "isInstance()" to Clz. |
| 12288 | */ |
| 12289 | function enableClassCheck(Clz) { |
| 12290 | var classAttr = ['__\0is_clz', classBase++, Math.random().toFixed(3)].join('_'); |
| 12291 | Clz.prototype[classAttr] = true; |
| 12292 | |
| 12293 | if (__DEV__) { |
| 12294 | assert$1(!Clz.isInstance, 'The method "is" can not be defined.'); |
| 12295 | } |
| 12296 | |
| 12297 | Clz.isInstance = function (obj) { |
| 12298 | return !!(obj && obj[classAttr]); |
| 12299 | }; |
| 12300 | } |
| 12301 | |
| 12302 | // superCall should have class info, which can not be fetch from 'this'. |
| 12303 | // Consider this case: |
no test coverage detected