From fc3e2cab053ac274dd375deaf391c50a1054a92e Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Wed, 18 Mar 2015 18:50:05 -0400 Subject: [PATCH] computed-property-names: corrections. Fixes gh-198 --- .../class/method/constructor-cannot-be-getter.js | 2 +- .../class/method/constructor-cannot-be-setter.js | 2 +- .../class/method/constructor-no-duplicate-1.js | 3 +-- .../class/method/constructor-no-duplicate-2.js | 3 +-- .../class/method/constructor-no-duplicate-3.js | 3 +-- .../class/static/generator-prototype.js | 13 +++++++------ .../class/static/getter-prototype.js | 13 +++++++------ .../class/static/method-prototype.js | 14 ++++++++------ .../class/static/setter-prototype.js | 14 ++++++++------ 9 files changed, 35 insertions(+), 32 deletions(-) diff --git a/test/language/computed-property-names/class/method/constructor-cannot-be-getter.js b/test/language/computed-property-names/class/method/constructor-cannot-be-getter.js index 895b0e79ea..318b58b824 100644 --- a/test/language/computed-property-names/class/method/constructor-cannot-be-getter.js +++ b/test/language/computed-property-names/class/method/constructor-cannot-be-getter.js @@ -3,7 +3,7 @@ /*--- es6id: 14.5.3 description: > - computed property getter names cannot be "constructor" + computed property getter names can be called "constructor" negative: SyntaxError ---*/ class C4 { diff --git a/test/language/computed-property-names/class/method/constructor-cannot-be-setter.js b/test/language/computed-property-names/class/method/constructor-cannot-be-setter.js index dd99625d6e..0ae0295e64 100644 --- a/test/language/computed-property-names/class/method/constructor-cannot-be-setter.js +++ b/test/language/computed-property-names/class/method/constructor-cannot-be-setter.js @@ -3,7 +3,7 @@ /*--- es6id: 14.5.3 description: > - computed property setter names cannot be "constructor" + computed property setter names can be called "constructor" negative: SyntaxError ---*/ class C4 { diff --git a/test/language/computed-property-names/class/method/constructor-no-duplicate-1.js b/test/language/computed-property-names/class/method/constructor-no-duplicate-1.js index e762bfbb05..61c2f9d55a 100644 --- a/test/language/computed-property-names/class/method/constructor-no-duplicate-1.js +++ b/test/language/computed-property-names/class/method/constructor-no-duplicate-1.js @@ -3,8 +3,7 @@ /*--- es6id: 12.2.5 description: > - computed property names can be "constructor", but duplicates are not allowed, 1 -negative: SyntaxError + computed property names can be "constructor" ---*/ class C { constructor() {} diff --git a/test/language/computed-property-names/class/method/constructor-no-duplicate-2.js b/test/language/computed-property-names/class/method/constructor-no-duplicate-2.js index 79594ac15e..a08aa11cc5 100644 --- a/test/language/computed-property-names/class/method/constructor-no-duplicate-2.js +++ b/test/language/computed-property-names/class/method/constructor-no-duplicate-2.js @@ -3,8 +3,7 @@ /*--- es6id: 12.2.5 description: > - computed property names can be "constructor", but duplicates are not allowed, 2 -negative: SyntaxError + computed property names can be "constructor" ---*/ class C { ['constructor']() {} diff --git a/test/language/computed-property-names/class/method/constructor-no-duplicate-3.js b/test/language/computed-property-names/class/method/constructor-no-duplicate-3.js index 3e0297e89e..6dc02cedaf 100644 --- a/test/language/computed-property-names/class/method/constructor-no-duplicate-3.js +++ b/test/language/computed-property-names/class/method/constructor-no-duplicate-3.js @@ -3,8 +3,7 @@ /*--- es6id: 12.2.5 description: > - computed property names can be "constructor", but duplicates are not allowed, 2 -negative: SyntaxError + computed property names can be "constructor" ---*/ class C { ['constructor']() {} diff --git a/test/language/computed-property-names/class/static/generator-prototype.js b/test/language/computed-property-names/class/static/generator-prototype.js index 16c558217b..ded8fe7bf0 100644 --- a/test/language/computed-property-names/class/static/generator-prototype.js +++ b/test/language/computed-property-names/class/static/generator-prototype.js @@ -1,12 +1,13 @@ // Copyright (C) Copyright 2014 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 12.2.5 +es6id: 14.5.14 description: > In a class, computed property names for static - generators cannot be "prototype" -negative: SyntaxError + generators that are named "prototype" throw a TypeError ---*/ -class C { - static *['prototype']() {} -} +assert.throws(TypeError, function() { + class C { + static *['prototype']() {} + } +}); diff --git a/test/language/computed-property-names/class/static/getter-prototype.js b/test/language/computed-property-names/class/static/getter-prototype.js index f445ee0f3d..2754385d01 100644 --- a/test/language/computed-property-names/class/static/getter-prototype.js +++ b/test/language/computed-property-names/class/static/getter-prototype.js @@ -1,12 +1,13 @@ // Copyright (C) Copyright 2014 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 12.2.5 +es6id: 14.5.14 description: > In a class, computed property names for static - getters cannot be "prototype" -negative: SyntaxError + getters that are named "prototype" throw a TypeError ---*/ -class C { - static get ['prototype']() {} -} +assert.throws(TypeError, function() { + class C { + static get ['prototype']() {} + } +}); diff --git a/test/language/computed-property-names/class/static/method-prototype.js b/test/language/computed-property-names/class/static/method-prototype.js index df2f59af12..d87476a484 100644 --- a/test/language/computed-property-names/class/static/method-prototype.js +++ b/test/language/computed-property-names/class/static/method-prototype.js @@ -1,12 +1,14 @@ // Copyright (C) Copyright 2014 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 12.2.5 +es6id: 14.5.14 description: > In a class, computed property names for static - methods cannot be "prototype" -negative: SyntaxError + methods that are named "prototype" throw a TypeError ---*/ -class C { - static ['prototype']() {} -} + +assert.throws(TypeError, function() { + class C { + static ['prototype']() {} + } +}); diff --git a/test/language/computed-property-names/class/static/setter-prototype.js b/test/language/computed-property-names/class/static/setter-prototype.js index 56505eab05..abdbcae63a 100644 --- a/test/language/computed-property-names/class/static/setter-prototype.js +++ b/test/language/computed-property-names/class/static/setter-prototype.js @@ -1,12 +1,14 @@ // Copyright (C) Copyright 2014 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 12.2.5 +es6id: 14.5.14 description: > In a class, computed property names for static - setters cannot be "prototype" -negative: SyntaxError + setters that are named "prototype" throw a TypeError ---*/ -class C { - static set ['prototype'](x) {} -} + +assert.throws(TypeError, function() { + class C { + static set ['prototype'](x) {} + } +});