input.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. "use strict";
  2. class C {
  3. }
  4. class A extends C {
  5. field = 1;
  6. constructor() {
  7. super();
  8. class B extends C {
  9. constructor() {
  10. super();
  11. expect(this.field).toBeUndefined();
  12. }
  13. }
  14. expect(this.field).toBe(1)
  15. new B();
  16. }
  17. }
  18. new A();
  19. class Obj {
  20. constructor() {
  21. return {};
  22. }
  23. }
  24. // ensure superClass is still transformed
  25. class SuperClass extends Obj {
  26. field = 1;
  27. constructor() {
  28. class B extends (super(), Obj) {
  29. constructor() {
  30. super();
  31. expect(this.field).toBeUndefined()
  32. }
  33. }
  34. expect(this.field).toBe(1)
  35. new B();
  36. }
  37. }
  38. new SuperClass();
  39. // ensure ComputedKey Method is still transformed
  40. class ComputedMethod extends Obj {
  41. field = 1;
  42. constructor() {
  43. class B extends Obj {
  44. constructor() {
  45. super();
  46. expect(this.field).toBeUndefined()
  47. }
  48. [super()]() { }
  49. }
  50. expect(this.field).toBe(1)
  51. new B();
  52. }
  53. }
  54. new ComputedMethod();
  55. // ensure ComputedKey Field is still transformed
  56. class ComputedField extends Obj {
  57. field = 1;
  58. constructor() {
  59. class B extends Obj {
  60. constructor() {
  61. super();
  62. expect(this.field).toBeUndefined()
  63. }
  64. [super()] = 1;
  65. }
  66. expect(this.field).toBe(1)
  67. new B();
  68. }
  69. }
  70. new ComputedField();