is.js 682 B

12345678910111213141516171819202122232425262728293031323334
  1. var RTL$ = {
  2. extend: function (cons, base){
  3. function Type(){}
  4. Type.prototype = base.prototype;
  5. cons.prototype = new Type();
  6. cons.prototype.constructor = cons;
  7. }
  8. };
  9. var m = function (){
  10. function Base(){
  11. }
  12. RTL$.extend(Derived1, Base);
  13. function Derived1(){
  14. Base.call(this);
  15. this.field1 = 0;
  16. }
  17. RTL$.extend(Derived2, Derived1);
  18. function Derived2(){
  19. Derived1.call(this);
  20. this.field2 = 0;
  21. }
  22. var pb = null;
  23. var pd1 = null;
  24. var pd2 = null;
  25. var b = false;
  26. pd2 = new Derived2();
  27. pb = pd2;
  28. pd1 = pd2;
  29. b = pb instanceof Derived1;
  30. b = pb instanceof Derived1;
  31. b = pb instanceof Derived2;
  32. b = pd1 instanceof Derived2;
  33. b = !(pb instanceof Derived1);
  34. }();