diff --git a/test/language/computed-property-names/class/static/method-number.js b/test/language/computed-property-names/class/static/method-number.js index 1c553a193098641fe5d7b9156dbee02ed7f3ff5b..c00f3e020261f5b744b40b2bb22268a385ab3b17 100644 --- a/test/language/computed-property-names/class/static/method-number.js +++ b/test/language/computed-property-names/class/static/method-number.js @@ -21,6 +21,6 @@ assert( "`compareArray(Object.keys(C), [])` returns `true`" ); assert( - compareArray(Object.getOwnPropertyNames(C), ['1', '2', 'length', 'prototype', 'a', 'c', 'name']), - "`compareArray(Object.getOwnPropertyNames(C), ['1', '2', 'length', 'prototype', 'a', 'c', 'name'])` returns `true`" + compareArray(Object.getOwnPropertyNames(C), ['1', '2', 'length', 'prototype', 'name', 'a', 'c']), + "`compareArray(Object.getOwnPropertyNames(C), ['1', '2', 'length', 'prototype', 'name', 'a', 'c'])` returns `true`" ); diff --git a/test/language/computed-property-names/class/static/method-string.js b/test/language/computed-property-names/class/static/method-string.js index 2b5f09b83fd2f0ef09f72584b8178ccba0b7680c..8f383805b05e293991e8da3ba466a489909cf5f3 100644 --- a/test/language/computed-property-names/class/static/method-string.js +++ b/test/language/computed-property-names/class/static/method-string.js @@ -21,6 +21,6 @@ assert( "`compareArray(Object.keys(C), [])` returns `true`" ); assert( - compareArray(Object.getOwnPropertyNames(C), ['length', 'prototype', 'a', 'b', 'c', 'd', 'name']), - "`compareArray(Object.getOwnPropertyNames(C), ['length', 'prototype', 'a', 'b', 'c', 'd', 'name'])` returns `true`" + compareArray(Object.getOwnPropertyNames(C), ['length', 'prototype', 'name', 'a', 'b', 'c', 'd']), + "`compareArray(Object.getOwnPropertyNames(C), ['length', 'prototype', 'name', 'a', 'b', 'c', 'd'])` returns `true`" ); diff --git a/test/language/computed-property-names/class/static/method-symbol.js b/test/language/computed-property-names/class/static/method-symbol.js index 7d6506dcaf68b5fd56d652af287b2204d65e38b0..3eb710b78022af6512ff1aab58661a659024a54d 100644 --- a/test/language/computed-property-names/class/static/method-symbol.js +++ b/test/language/computed-property-names/class/static/method-symbol.js @@ -24,8 +24,8 @@ assert( "`compareArray(Object.keys(C), [])` returns `true`" ); assert( - compareArray(Object.getOwnPropertyNames(C), ['length', 'prototype', 'a', 'c', 'name']), - "`compareArray(Object.getOwnPropertyNames(C), ['length', 'prototype', 'a', 'c', 'name'])` returns `true`" + compareArray(Object.getOwnPropertyNames(C), ['length', 'prototype', 'name', 'a', 'c']), + "`compareArray(Object.getOwnPropertyNames(C), ['length', 'prototype', 'name', 'a', 'c'])` returns `true`" ); assert( compareArray(Object.getOwnPropertySymbols(C), [sym1, sym2]), diff --git a/test/language/expressions/class/elements/class-name-static-initializer-anonymous.js b/test/language/expressions/class/elements/class-name-static-initializer-anonymous.js new file mode 100644 index 0000000000000000000000000000000000000000..daca9b6ab2c0a65c0f57484334e2d9a32c62bfc9 --- /dev/null +++ b/test/language/expressions/class/elements/class-name-static-initializer-anonymous.js @@ -0,0 +1,26 @@ +// Copyright 2019 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-runtime-semantics-classdefinitionevaluation +description: > + The inferred class-name is present when executing static field initializers of anonymous class expressions. +info: | + 14.6.13 Runtime Semantics: ClassDefinitionEvaluation + + [...] + 17. Perform MakeClassConstructor(F). + 18. If className is not undefined, then + a. Perform SetFunctionName(F, className). + [...] + +features: [class-static-fields-public] +---*/ + +var className; + +var C = class { + static f = (className = this.name); +} + +assert.sameValue(className, "C"); diff --git a/test/language/expressions/class/elements/class-name-static-initializer-decl.js b/test/language/expressions/class/elements/class-name-static-initializer-decl.js new file mode 100644 index 0000000000000000000000000000000000000000..6f9ec9e077dc201be14240dc50816a02b671e782 --- /dev/null +++ b/test/language/expressions/class/elements/class-name-static-initializer-decl.js @@ -0,0 +1,26 @@ +// Copyright 2019 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-runtime-semantics-classdefinitionevaluation +description: > + The class-name is present when executing static field initializers of class declarations. +info: | + 14.6.13 Runtime Semantics: ClassDefinitionEvaluation + + [...] + 17. Perform MakeClassConstructor(F). + 18. If className is not undefined, then + a. Perform SetFunctionName(F, className). + [...] + +features: [class-static-fields-public] +---*/ + +var className; + +class C { + static f = (className = this.name); +} + +assert.sameValue(className, "C"); diff --git a/test/language/expressions/class/elements/class-name-static-initializer-default-export.js b/test/language/expressions/class/elements/class-name-static-initializer-default-export.js new file mode 100644 index 0000000000000000000000000000000000000000..5ce104f4b1cd44b22a6fe807ac8e2baae9008623 --- /dev/null +++ b/test/language/expressions/class/elements/class-name-static-initializer-default-export.js @@ -0,0 +1,27 @@ +// Copyright 2019 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-runtime-semantics-classdefinitionevaluation +description: > + The class-name is present when executing static field initializers of default-exported classes. +info: | + 14.6.13 Runtime Semantics: ClassDefinitionEvaluation + + [...] + 17. Perform MakeClassConstructor(F). + 18. If className is not undefined, then + a. Perform SetFunctionName(F, className). + [...] + +flags: [module] +features: [class-static-fields-public] +---*/ + +var className; + +export default class { + static f = (className = this.name); +} + +assert.sameValue(className, "default"); diff --git a/test/language/expressions/class/elements/class-name-static-initializer-expr.js b/test/language/expressions/class/elements/class-name-static-initializer-expr.js new file mode 100644 index 0000000000000000000000000000000000000000..1ff5f8d38aff91b5701c1d4b3582c665469a7dc4 --- /dev/null +++ b/test/language/expressions/class/elements/class-name-static-initializer-expr.js @@ -0,0 +1,26 @@ +// Copyright 2019 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-runtime-semantics-classdefinitionevaluation +description: > + The class-name is present when executing static field initializers of named class expressions. +info: | + 14.6.13 Runtime Semantics: ClassDefinitionEvaluation + + [...] + 17. Perform MakeClassConstructor(F). + 18. If className is not undefined, then + a. Perform SetFunctionName(F, className). + [...] + +features: [class-static-fields-public] +---*/ + +var className; + +var expr = class C { + static f = (className = this.name); +} + +assert.sameValue(className, "C");