diff --git a/src/class-elements/grammar-static-ctor-accessor-meth-valid.case b/src/class-elements/grammar-static-ctor-accessor-meth-valid.case new file mode 100644 index 0000000000..d161900eb1 --- /dev/null +++ b/src/class-elements/grammar-static-ctor-accessor-meth-valid.case @@ -0,0 +1,25 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +desc: Static Accessor Methods can be named constructor +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true. + ClassElement : static MethodDefinition + It is a Syntax Error if HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "prototype". +template: syntax/valid +---*/ + +//- elements +static get constructor() {} +static set constructor() {} +constructor() {} // stacks with a valid constructor +//- teardown +assert(C.hasOwnProperty('constructor')); +assert(C.prototype.hasOwnProperty('constructor')); +assert.notSameValue(C.prototype.constructor, C.constructor); diff --git a/src/class-elements/grammar-static-ctor-async-gen-meth-valid.case b/src/class-elements/grammar-static-ctor-async-gen-meth-valid.case new file mode 100644 index 0000000000..78ce1c6952 --- /dev/null +++ b/src/class-elements/grammar-static-ctor-async-gen-meth-valid.case @@ -0,0 +1,25 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +desc: Static Async Generator Methods can be named constructor +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true. + ClassElement : static MethodDefinition + It is a Syntax Error if HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "prototype". +template: syntax/valid +features: [async-iteration] +---*/ + +//- elements +static async * constructor() {} +constructor() {} // stacks with a valid constructor +//- teardown +assert(C.hasOwnProperty('constructor')); +assert(C.prototype.hasOwnProperty('constructor')); +assert.notSameValue(C.prototype.constructor, C.constructor); diff --git a/src/class-elements/grammar-static-ctor-async-meth-valid.case b/src/class-elements/grammar-static-ctor-async-meth-valid.case new file mode 100644 index 0000000000..aafd327455 --- /dev/null +++ b/src/class-elements/grammar-static-ctor-async-meth-valid.case @@ -0,0 +1,25 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +desc: Static Methods can be named constructor +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true. + ClassElement : static MethodDefinition + It is a Syntax Error if HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "prototype". +template: syntax/valid +features: [async-functions] +---*/ + +//- elements +static async constructor() {} +constructor() {} // stacks with a valid constructor +//- teardown +assert(C.hasOwnProperty('constructor')); +assert(C.prototype.hasOwnProperty('constructor')); +assert.notSameValue(C.prototype.constructor, C.constructor); diff --git a/src/class-elements/grammar-static-ctor-gen-meth-valid.case b/src/class-elements/grammar-static-ctor-gen-meth-valid.case new file mode 100644 index 0000000000..33700f8cb8 --- /dev/null +++ b/src/class-elements/grammar-static-ctor-gen-meth-valid.case @@ -0,0 +1,25 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +desc: Static Generator Methods can be named constructor +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true. + ClassElement : static MethodDefinition + It is a Syntax Error if HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "prototype". +template: syntax/valid +features: [generators] +---*/ + +//- elements +static * constructor() {} +constructor() {} // stacks with a valid constructor +//- teardown +assert(C.hasOwnProperty('constructor')); +assert(C.prototype.hasOwnProperty('constructor')); +assert.notSameValue(C.prototype.constructor, C.constructor); diff --git a/src/class-elements/grammar-static-ctor-meth-valid.case b/src/class-elements/grammar-static-ctor-meth-valid.case new file mode 100644 index 0000000000..cbd3f023b9 --- /dev/null +++ b/src/class-elements/grammar-static-ctor-meth-valid.case @@ -0,0 +1,24 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +desc: Static Methods can be named constructor +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true. + ClassElement : static MethodDefinition + It is a Syntax Error if HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "prototype". +template: syntax/valid +---*/ + +//- elements +static constructor() {} +constructor() {} // stacks with a valid constructor +//- teardown +assert(C.hasOwnProperty('constructor')); +assert(C.prototype.hasOwnProperty('constructor')); +assert.notSameValue(C.prototype.constructor, C.constructor); diff --git a/src/class-elements/grammar-static-private-ctor-meth-valid.case b/src/class-elements/grammar-static-private-ctor-meth-valid.case new file mode 100644 index 0000000000..f4db2766d0 --- /dev/null +++ b/src/class-elements/grammar-static-private-ctor-meth-valid.case @@ -0,0 +1,16 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +desc: Static Methods can be named constructor +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is "prototype" +template: syntax/invalid +---*/ + +//- elements +static constructor() {} +constructor() {} // stacks with a valid constructor