From 240cc6992ed02715583aa647b535b937aa8b8635 Mon Sep 17 00:00:00 2001 From: Kubilay Kahveci Date: Wed, 29 May 2019 11:00:19 +0100 Subject: [PATCH] Generate tests --- ...tter-before-super-return-in-constructor.js | 46 +++++++++++++++++++ ...efore-super-return-in-field-initializer.js | 44 ++++++++++++++++++ ...thod-before-super-return-in-constructor.js | 46 +++++++++++++++++++ ...efore-super-return-in-field-initializer.js | 44 ++++++++++++++++++ ...tter-before-super-return-in-constructor.js | 46 +++++++++++++++++++ ...efore-super-return-in-field-initializer.js | 44 ++++++++++++++++++ ...tter-before-super-return-in-constructor.js | 46 +++++++++++++++++++ ...efore-super-return-in-field-initializer.js | 44 ++++++++++++++++++ ...thod-before-super-return-in-constructor.js | 46 +++++++++++++++++++ ...efore-super-return-in-field-initializer.js | 44 ++++++++++++++++++ ...tter-before-super-return-in-constructor.js | 46 +++++++++++++++++++ ...efore-super-return-in-field-initializer.js | 44 ++++++++++++++++++ 12 files changed, 540 insertions(+) create mode 100644 test/language/expressions/class/elements/prod-private-getter-before-super-return-in-constructor.js create mode 100644 test/language/expressions/class/elements/prod-private-getter-before-super-return-in-field-initializer.js create mode 100644 test/language/expressions/class/elements/prod-private-method-before-super-return-in-constructor.js create mode 100644 test/language/expressions/class/elements/prod-private-method-before-super-return-in-field-initializer.js create mode 100644 test/language/expressions/class/elements/prod-private-setter-before-super-return-in-constructor.js create mode 100644 test/language/expressions/class/elements/prod-private-setter-before-super-return-in-field-initializer.js create mode 100644 test/language/statements/class/elements/prod-private-getter-before-super-return-in-constructor.js create mode 100644 test/language/statements/class/elements/prod-private-getter-before-super-return-in-field-initializer.js create mode 100644 test/language/statements/class/elements/prod-private-method-before-super-return-in-constructor.js create mode 100644 test/language/statements/class/elements/prod-private-method-before-super-return-in-field-initializer.js create mode 100644 test/language/statements/class/elements/prod-private-setter-before-super-return-in-constructor.js create mode 100644 test/language/statements/class/elements/prod-private-setter-before-super-return-in-field-initializer.js diff --git a/test/language/expressions/class/elements/prod-private-getter-before-super-return-in-constructor.js b/test/language/expressions/class/elements/prod-private-getter-before-super-return-in-constructor.js new file mode 100644 index 0000000000..37cd4f4d74 --- /dev/null +++ b/test/language/expressions/class/elements/prod-private-getter-before-super-return-in-constructor.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/prod-private-getter-before-super-return-in-constructor.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Private getters are installed "when super returns" and no earlier (call in constructor) (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + SuperCall: super Arguments + 1. Let newTarget be GetNewTarget(). + 2. If newTarget is undefined, throw a ReferenceError exception. + 3. Let func be ? GetSuperConstructor(). + 4. Let argList be ArgumentListEvaluation of Arguments. + 5. ReturnIfAbrupt(argList). + 6. Let result be ? Construct(func, argList, newTarget). + 7. Let thisER be GetThisEnvironment( ). + 8. Let F be thisER.[[FunctionObject]]. + 9. Assert: F is an ECMAScript function object. + 10. Perform ? InitializeInstanceElements(result, F). + + EDITOR'S NOTE: + Private fields are added to the object one by one, interspersed with + evaluation of the initializers, following the construction of the + receiver. These semantics allow for a later initializer to refer to + a previous private field. + +---*/ + + +var C = class { + constructor() { + this.f(); + } + +} + +class D extends C { + f() { this.#m; } + get #m() { return 42; } +} + +assert(D.prototype.hasOwnProperty('f')); +assert.throws(TypeError, function() { + var d = new D(); +}, 'private getters are not installed before super returns'); diff --git a/test/language/expressions/class/elements/prod-private-getter-before-super-return-in-field-initializer.js b/test/language/expressions/class/elements/prod-private-getter-before-super-return-in-field-initializer.js new file mode 100644 index 0000000000..60227cb654 --- /dev/null +++ b/test/language/expressions/class/elements/prod-private-getter-before-super-return-in-field-initializer.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/prod-private-getter-before-super-return-in-field-initializer.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Private getters are installed "when super returns" and no earlier (call in field initializer) (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + SuperCall: super Arguments + 1. Let newTarget be GetNewTarget(). + 2. If newTarget is undefined, throw a ReferenceError exception. + 3. Let func be ? GetSuperConstructor(). + 4. Let argList be ArgumentListEvaluation of Arguments. + 5. ReturnIfAbrupt(argList). + 6. Let result be ? Construct(func, argList, newTarget). + 7. Let thisER be GetThisEnvironment( ). + 8. Let F be thisER.[[FunctionObject]]. + 9. Assert: F is an ECMAScript function object. + 10. Perform ? InitializeInstanceElements(result, F). + + EDITOR'S NOTE: + Private fields are added to the object one by one, interspersed with + evaluation of the initializers, following the construction of the + receiver. These semantics allow for a later initializer to refer to + a previous private field. + +---*/ + + +var C = class { + f = this.g(); + +} + +class D extends C { + g() { this.#m; } + get #m() { return 42; } +} + +assert(D.prototype.hasOwnProperty('g')); +assert.throws(TypeError, function() { + var d = new D(); +}, 'private getters are not installed before super returns'); diff --git a/test/language/expressions/class/elements/prod-private-method-before-super-return-in-constructor.js b/test/language/expressions/class/elements/prod-private-method-before-super-return-in-constructor.js new file mode 100644 index 0000000000..4b5c49f97d --- /dev/null +++ b/test/language/expressions/class/elements/prod-private-method-before-super-return-in-constructor.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/prod-private-method-before-super-return-in-constructor.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Private methods are installed "when super returns" and no earlier (call in constructor) (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + SuperCall: super Arguments + 1. Let newTarget be GetNewTarget(). + 2. If newTarget is undefined, throw a ReferenceError exception. + 3. Let func be ? GetSuperConstructor(). + 4. Let argList be ArgumentListEvaluation of Arguments. + 5. ReturnIfAbrupt(argList). + 6. Let result be ? Construct(func, argList, newTarget). + 7. Let thisER be GetThisEnvironment( ). + 8. Let F be thisER.[[FunctionObject]]. + 9. Assert: F is an ECMAScript function object. + 10. Perform ? InitializeInstanceElements(result, F). + + EDITOR'S NOTE: + Private fields are added to the object one by one, interspersed with + evaluation of the initializers, following the construction of the + receiver. These semantics allow for a later initializer to refer to + a previous private field. + +---*/ + + +var C = class { + constructor() { + this.f(); + } + +} + +class D extends C { + f() { this.#m(); } + #m() { return 42; } +} + +assert(D.prototype.hasOwnProperty('f')); +assert.throws(TypeError, function() { + var d = new D(); +}, 'private methods are not installed before super returns'); diff --git a/test/language/expressions/class/elements/prod-private-method-before-super-return-in-field-initializer.js b/test/language/expressions/class/elements/prod-private-method-before-super-return-in-field-initializer.js new file mode 100644 index 0000000000..950b7b231e --- /dev/null +++ b/test/language/expressions/class/elements/prod-private-method-before-super-return-in-field-initializer.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/prod-private-method-before-super-return-in-field-initializer.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Private methods are installed "when super returns" and no earlier (call in field initializer) (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + SuperCall: super Arguments + 1. Let newTarget be GetNewTarget(). + 2. If newTarget is undefined, throw a ReferenceError exception. + 3. Let func be ? GetSuperConstructor(). + 4. Let argList be ArgumentListEvaluation of Arguments. + 5. ReturnIfAbrupt(argList). + 6. Let result be ? Construct(func, argList, newTarget). + 7. Let thisER be GetThisEnvironment( ). + 8. Let F be thisER.[[FunctionObject]]. + 9. Assert: F is an ECMAScript function object. + 10. Perform ? InitializeInstanceElements(result, F). + + EDITOR'S NOTE: + Private fields are added to the object one by one, interspersed with + evaluation of the initializers, following the construction of the + receiver. These semantics allow for a later initializer to refer to + a previous private field. + +---*/ + + +var C = class { + f = this.g(); + +} + +class D extends C { + g() { this.#m(); } + #m() { return 42; } +} + +assert(D.prototype.hasOwnProperty('g')); +assert.throws(TypeError, function() { + var d = new D(); +}, 'private methods are not installed before super returns'); diff --git a/test/language/expressions/class/elements/prod-private-setter-before-super-return-in-constructor.js b/test/language/expressions/class/elements/prod-private-setter-before-super-return-in-constructor.js new file mode 100644 index 0000000000..df35d3b1d0 --- /dev/null +++ b/test/language/expressions/class/elements/prod-private-setter-before-super-return-in-constructor.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/prod-private-setter-before-super-return-in-constructor.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Private setters are installed "when super returns" and no earlier (call in constructor) (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + SuperCall: super Arguments + 1. Let newTarget be GetNewTarget(). + 2. If newTarget is undefined, throw a ReferenceError exception. + 3. Let func be ? GetSuperConstructor(). + 4. Let argList be ArgumentListEvaluation of Arguments. + 5. ReturnIfAbrupt(argList). + 6. Let result be ? Construct(func, argList, newTarget). + 7. Let thisER be GetThisEnvironment( ). + 8. Let F be thisER.[[FunctionObject]]. + 9. Assert: F is an ECMAScript function object. + 10. Perform ? InitializeInstanceElements(result, F). + + EDITOR'S NOTE: + Private fields are added to the object one by one, interspersed with + evaluation of the initializers, following the construction of the + receiver. These semantics allow for a later initializer to refer to + a previous private field. + +---*/ + + +var C = class { + constructor() { + this.f(); + } + +} + +class D extends C { + f() { this.#m = 42; } + set #m(val) {} +} + +assert(D.prototype.hasOwnProperty('f')); +assert.throws(TypeError, function() { + var d = new D(); +}, 'private setters are not installed before super returns'); diff --git a/test/language/expressions/class/elements/prod-private-setter-before-super-return-in-field-initializer.js b/test/language/expressions/class/elements/prod-private-setter-before-super-return-in-field-initializer.js new file mode 100644 index 0000000000..89fdcd82d0 --- /dev/null +++ b/test/language/expressions/class/elements/prod-private-setter-before-super-return-in-field-initializer.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/prod-private-setter-before-super-return-in-field-initializer.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Private settters are installed "when super returns" and no earlier (call in field initializer) (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + SuperCall: super Arguments + 1. Let newTarget be GetNewTarget(). + 2. If newTarget is undefined, throw a ReferenceError exception. + 3. Let func be ? GetSuperConstructor(). + 4. Let argList be ArgumentListEvaluation of Arguments. + 5. ReturnIfAbrupt(argList). + 6. Let result be ? Construct(func, argList, newTarget). + 7. Let thisER be GetThisEnvironment( ). + 8. Let F be thisER.[[FunctionObject]]. + 9. Assert: F is an ECMAScript function object. + 10. Perform ? InitializeInstanceElements(result, F). + + EDITOR'S NOTE: + Private fields are added to the object one by one, interspersed with + evaluation of the initializers, following the construction of the + receiver. These semantics allow for a later initializer to refer to + a previous private field. + +---*/ + + +var C = class { + f = this.g(); + +} + +class D extends C { + g() { this.#m = 42; } + set #m(val) {} +} + +assert(D.prototype.hasOwnProperty('g')); +assert.throws(TypeError, function() { + var d = new D(); +}, 'private setters are not installed before super returns'); diff --git a/test/language/statements/class/elements/prod-private-getter-before-super-return-in-constructor.js b/test/language/statements/class/elements/prod-private-getter-before-super-return-in-constructor.js new file mode 100644 index 0000000000..44469c9600 --- /dev/null +++ b/test/language/statements/class/elements/prod-private-getter-before-super-return-in-constructor.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/prod-private-getter-before-super-return-in-constructor.case +// - src/class-elements/default/cls-decl.template +/*--- +description: Private getters are installed "when super returns" and no earlier (call in constructor) (field definitions in a class declaration) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + SuperCall: super Arguments + 1. Let newTarget be GetNewTarget(). + 2. If newTarget is undefined, throw a ReferenceError exception. + 3. Let func be ? GetSuperConstructor(). + 4. Let argList be ArgumentListEvaluation of Arguments. + 5. ReturnIfAbrupt(argList). + 6. Let result be ? Construct(func, argList, newTarget). + 7. Let thisER be GetThisEnvironment( ). + 8. Let F be thisER.[[FunctionObject]]. + 9. Assert: F is an ECMAScript function object. + 10. Perform ? InitializeInstanceElements(result, F). + + EDITOR'S NOTE: + Private fields are added to the object one by one, interspersed with + evaluation of the initializers, following the construction of the + receiver. These semantics allow for a later initializer to refer to + a previous private field. + +---*/ + + +class C { + constructor() { + this.f(); + } + +} + +class D extends C { + f() { this.#m; } + get #m() { return 42; } +} + +assert(D.prototype.hasOwnProperty('f')); +assert.throws(TypeError, function() { + var d = new D(); +}, 'private getters are not installed before super returns'); diff --git a/test/language/statements/class/elements/prod-private-getter-before-super-return-in-field-initializer.js b/test/language/statements/class/elements/prod-private-getter-before-super-return-in-field-initializer.js new file mode 100644 index 0000000000..509c3e9d2a --- /dev/null +++ b/test/language/statements/class/elements/prod-private-getter-before-super-return-in-field-initializer.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/prod-private-getter-before-super-return-in-field-initializer.case +// - src/class-elements/default/cls-decl.template +/*--- +description: Private getters are installed "when super returns" and no earlier (call in field initializer) (field definitions in a class declaration) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + SuperCall: super Arguments + 1. Let newTarget be GetNewTarget(). + 2. If newTarget is undefined, throw a ReferenceError exception. + 3. Let func be ? GetSuperConstructor(). + 4. Let argList be ArgumentListEvaluation of Arguments. + 5. ReturnIfAbrupt(argList). + 6. Let result be ? Construct(func, argList, newTarget). + 7. Let thisER be GetThisEnvironment( ). + 8. Let F be thisER.[[FunctionObject]]. + 9. Assert: F is an ECMAScript function object. + 10. Perform ? InitializeInstanceElements(result, F). + + EDITOR'S NOTE: + Private fields are added to the object one by one, interspersed with + evaluation of the initializers, following the construction of the + receiver. These semantics allow for a later initializer to refer to + a previous private field. + +---*/ + + +class C { + f = this.g(); + +} + +class D extends C { + g() { this.#m; } + get #m() { return 42; } +} + +assert(D.prototype.hasOwnProperty('g')); +assert.throws(TypeError, function() { + var d = new D(); +}, 'private getters are not installed before super returns'); diff --git a/test/language/statements/class/elements/prod-private-method-before-super-return-in-constructor.js b/test/language/statements/class/elements/prod-private-method-before-super-return-in-constructor.js new file mode 100644 index 0000000000..8f113aff87 --- /dev/null +++ b/test/language/statements/class/elements/prod-private-method-before-super-return-in-constructor.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/prod-private-method-before-super-return-in-constructor.case +// - src/class-elements/default/cls-decl.template +/*--- +description: Private methods are installed "when super returns" and no earlier (call in constructor) (field definitions in a class declaration) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + SuperCall: super Arguments + 1. Let newTarget be GetNewTarget(). + 2. If newTarget is undefined, throw a ReferenceError exception. + 3. Let func be ? GetSuperConstructor(). + 4. Let argList be ArgumentListEvaluation of Arguments. + 5. ReturnIfAbrupt(argList). + 6. Let result be ? Construct(func, argList, newTarget). + 7. Let thisER be GetThisEnvironment( ). + 8. Let F be thisER.[[FunctionObject]]. + 9. Assert: F is an ECMAScript function object. + 10. Perform ? InitializeInstanceElements(result, F). + + EDITOR'S NOTE: + Private fields are added to the object one by one, interspersed with + evaluation of the initializers, following the construction of the + receiver. These semantics allow for a later initializer to refer to + a previous private field. + +---*/ + + +class C { + constructor() { + this.f(); + } + +} + +class D extends C { + f() { this.#m(); } + #m() { return 42; } +} + +assert(D.prototype.hasOwnProperty('f')); +assert.throws(TypeError, function() { + var d = new D(); +}, 'private methods are not installed before super returns'); diff --git a/test/language/statements/class/elements/prod-private-method-before-super-return-in-field-initializer.js b/test/language/statements/class/elements/prod-private-method-before-super-return-in-field-initializer.js new file mode 100644 index 0000000000..1fbc16bfb0 --- /dev/null +++ b/test/language/statements/class/elements/prod-private-method-before-super-return-in-field-initializer.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/prod-private-method-before-super-return-in-field-initializer.case +// - src/class-elements/default/cls-decl.template +/*--- +description: Private methods are installed "when super returns" and no earlier (call in field initializer) (field definitions in a class declaration) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + SuperCall: super Arguments + 1. Let newTarget be GetNewTarget(). + 2. If newTarget is undefined, throw a ReferenceError exception. + 3. Let func be ? GetSuperConstructor(). + 4. Let argList be ArgumentListEvaluation of Arguments. + 5. ReturnIfAbrupt(argList). + 6. Let result be ? Construct(func, argList, newTarget). + 7. Let thisER be GetThisEnvironment( ). + 8. Let F be thisER.[[FunctionObject]]. + 9. Assert: F is an ECMAScript function object. + 10. Perform ? InitializeInstanceElements(result, F). + + EDITOR'S NOTE: + Private fields are added to the object one by one, interspersed with + evaluation of the initializers, following the construction of the + receiver. These semantics allow for a later initializer to refer to + a previous private field. + +---*/ + + +class C { + f = this.g(); + +} + +class D extends C { + g() { this.#m(); } + #m() { return 42; } +} + +assert(D.prototype.hasOwnProperty('g')); +assert.throws(TypeError, function() { + var d = new D(); +}, 'private methods are not installed before super returns'); diff --git a/test/language/statements/class/elements/prod-private-setter-before-super-return-in-constructor.js b/test/language/statements/class/elements/prod-private-setter-before-super-return-in-constructor.js new file mode 100644 index 0000000000..e1396b8165 --- /dev/null +++ b/test/language/statements/class/elements/prod-private-setter-before-super-return-in-constructor.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/prod-private-setter-before-super-return-in-constructor.case +// - src/class-elements/default/cls-decl.template +/*--- +description: Private setters are installed "when super returns" and no earlier (call in constructor) (field definitions in a class declaration) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + SuperCall: super Arguments + 1. Let newTarget be GetNewTarget(). + 2. If newTarget is undefined, throw a ReferenceError exception. + 3. Let func be ? GetSuperConstructor(). + 4. Let argList be ArgumentListEvaluation of Arguments. + 5. ReturnIfAbrupt(argList). + 6. Let result be ? Construct(func, argList, newTarget). + 7. Let thisER be GetThisEnvironment( ). + 8. Let F be thisER.[[FunctionObject]]. + 9. Assert: F is an ECMAScript function object. + 10. Perform ? InitializeInstanceElements(result, F). + + EDITOR'S NOTE: + Private fields are added to the object one by one, interspersed with + evaluation of the initializers, following the construction of the + receiver. These semantics allow for a later initializer to refer to + a previous private field. + +---*/ + + +class C { + constructor() { + this.f(); + } + +} + +class D extends C { + f() { this.#m = 42; } + set #m(val) {} +} + +assert(D.prototype.hasOwnProperty('f')); +assert.throws(TypeError, function() { + var d = new D(); +}, 'private setters are not installed before super returns'); diff --git a/test/language/statements/class/elements/prod-private-setter-before-super-return-in-field-initializer.js b/test/language/statements/class/elements/prod-private-setter-before-super-return-in-field-initializer.js new file mode 100644 index 0000000000..2243f7e9f7 --- /dev/null +++ b/test/language/statements/class/elements/prod-private-setter-before-super-return-in-field-initializer.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/prod-private-setter-before-super-return-in-field-initializer.case +// - src/class-elements/default/cls-decl.template +/*--- +description: Private settters are installed "when super returns" and no earlier (call in field initializer) (field definitions in a class declaration) +esid: prod-FieldDefinition +features: [class-methods-private, class] +flags: [generated] +info: | + SuperCall: super Arguments + 1. Let newTarget be GetNewTarget(). + 2. If newTarget is undefined, throw a ReferenceError exception. + 3. Let func be ? GetSuperConstructor(). + 4. Let argList be ArgumentListEvaluation of Arguments. + 5. ReturnIfAbrupt(argList). + 6. Let result be ? Construct(func, argList, newTarget). + 7. Let thisER be GetThisEnvironment( ). + 8. Let F be thisER.[[FunctionObject]]. + 9. Assert: F is an ECMAScript function object. + 10. Perform ? InitializeInstanceElements(result, F). + + EDITOR'S NOTE: + Private fields are added to the object one by one, interspersed with + evaluation of the initializers, following the construction of the + receiver. These semantics allow for a later initializer to refer to + a previous private field. + +---*/ + + +class C { + f = this.g(); + +} + +class D extends C { + g() { this.#m = 42; } + set #m(val) {} +} + +assert(D.prototype.hasOwnProperty('g')); +assert.throws(TypeError, function() { + var d = new D(); +}, 'private setters are not installed before super returns');