* Implements `CheckableConstructor` for `target`. * Can not use instanceof, consider different scope by * cross domain or es module import in ec extensions. * Mount a method "isInstance()" to Clz. * * @usage * ```ts * class Xxx {} * type XxxConstructor = typeo
(target)
| 8076 | */ |
| 8077 | |
| 8078 | function enableClassCheck(target) { |
| 8079 | var classAttr = ['__\0is_clz', classBase++].join('_'); |
| 8080 | target.prototype[classAttr] = true; |
| 8081 | |
| 8082 | if ("development" !== 'production') { |
| 8083 | assert(!target.isInstance, 'The method "is" can not be defined.'); |
| 8084 | } |
| 8085 | |
| 8086 | target.isInstance = function (obj) { |
| 8087 | return !!(obj && obj[classAttr]); |
| 8088 | }; |
| 8089 | } // superCall should have class info, which can not be fetch from 'this'. |
| 8090 | // Consider this case: |
| 8091 | // class A has method f, |
| 8092 | // class B inherits class A, overrides method f, f call superApply('f'), |
no test coverage detected
searching dependent graphs…