-
Notifications
You must be signed in to change notification settings - Fork 475
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d93bee5
commit 228851f
Showing
41 changed files
with
1,204 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (C) 2017 Mike Pennisi. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
desc: Abrupt completion when evaluating expression | ||
template: error | ||
info: | | ||
12.2.6.7 Runtime Semantics: Evaluation | ||
|
||
ComputedPropertyName : [ AssignmentExpression ] | ||
|
||
1. Let exprValue be the result of evaluating AssignmentExpression. | ||
2. Let propName be ? GetValue(exprValue). | ||
---*/ | ||
|
||
//- setup | ||
var thrower = function() { | ||
throw new Test262Error(); | ||
}; | ||
|
||
//- error | ||
Test262Error | ||
//- name | ||
thrower() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (C) 2017 Mike Pennisi. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
desc: Abrupt completion when coercing to property key value | ||
template: error | ||
info: | | ||
12.2.6.7 Runtime Semantics: Evaluation | ||
|
||
[...] | ||
|
||
ComputedPropertyName : [ AssignmentExpression ] | ||
|
||
1. Let exprValue be the result of evaluating AssignmentExpression. | ||
2. Let propName be ? GetValue(exprValue). | ||
3. Return ? ToPropertyKey(propName). | ||
|
||
7.1.14 ToPropertyKey | ||
|
||
1. Let key be ? ToPrimitive(argument, hint String). | ||
|
||
7.1.1 ToPrimitive | ||
|
||
[...] | ||
7. Return ? OrdinaryToPrimitive(input, hint). | ||
|
||
7.1.1.1 OrdinaryToPrimitive | ||
|
||
5. For each name in methodNames in List order, do | ||
[...] | ||
6. Throw a TypeError exception. | ||
---*/ | ||
|
||
//- setup | ||
var badKey = Object.create(null); | ||
|
||
//- error | ||
TypeError | ||
//- name | ||
badKey |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (C) 2017 Mike Pennisi. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
desc: Abrupt completion when resolving reference value | ||
template: error | ||
info: | | ||
12.2.6.7 Runtime Semantics: Evaluation | ||
|
||
[...] | ||
|
||
ComputedPropertyName : [ AssignmentExpression ] | ||
|
||
1. Let exprValue be the result of evaluating AssignmentExpression. | ||
2. Let propName be ? GetValue(exprValue). | ||
---*/ | ||
|
||
//- error | ||
ReferenceError | ||
//- name | ||
test262unresolvable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (C) 2017 Mike Pennisi. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
desc: Computed values as accessor property names (AssignmentExpression) | ||
template: default | ||
info: | | ||
12.2.6.7 Runtime Semantics: Evaluation | ||
|
||
[...] | ||
|
||
ComputedPropertyName : [ AssignmentExpression ] | ||
|
||
1. Let exprValue be the result of evaluating AssignmentExpression. | ||
2. Let propName be ? GetValue(exprValue). | ||
3. Return ? ToPropertyKey(propName). | ||
---*/ | ||
|
||
//- setup | ||
var _; | ||
|
||
//- declareWith | ||
[_ = 'str' + 'ing'] | ||
//- referenceWith | ||
'string' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright (C) 2017 Mike Pennisi. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
path: language/statements/class/accessor-name-inst- | ||
name: Class declaration, instance method | ||
esid: sec-runtime-semantics-classdefinitionevaluation | ||
es6id: 14.5.14 | ||
info: | | ||
[...] | ||
21. For each ClassElement m in order from methods | ||
a. If IsStatic of m is false, then | ||
i. Let status be the result of performing PropertyDefinitionEvaluation | ||
for m with arguments proto and false. | ||
---*/ | ||
|
||
var stringSet; | ||
|
||
class C { | ||
get /*{ declareWith }*/() { return 'get string'; } | ||
set /*{ declareWith }*/(param) { stringSet = param; } | ||
} | ||
|
||
assert.sameValue(C.prototype[/*{ referenceWith }*/], 'get string'); | ||
|
||
C.prototype[/*{ referenceWith }*/] = 'set string'; | ||
assert.sameValue(stringSet, 'set string'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (C) 2017 Mike Pennisi. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
path: language/statements/class/accessor-name-static- | ||
name: Class declaration, static method | ||
esid: sec-runtime-semantics-classdefinitionevaluation | ||
es6id: 14.5.14 | ||
info: | | ||
[...] | ||
21. For each ClassElement m in order from methods | ||
a. If IsStatic of m is false, then | ||
[...] | ||
b. Else, | ||
a. Let status be the result of performing PropertyDefinitionEvaluation | ||
for m with arguments F and false. | ||
---*/ | ||
|
||
var stringSet; | ||
|
||
class C { | ||
static get /*{ declareWith }*/() { return 'get string'; } | ||
static set /*{ declareWith }*/(param) { stringSet = param; } | ||
} | ||
|
||
assert.sameValue(C[/*{ referenceWith }*/], 'get string'); | ||
|
||
C[/*{ referenceWith }*/] = 'set string'; | ||
assert.sameValue(stringSet, 'set string'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright (C) 2017 Mike Pennisi. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
path: language/expressions/class/accessor-name-inst- | ||
name: Class expression, instance method | ||
esid: sec-runtime-semantics-classdefinitionevaluation | ||
es6id: 14.5.14 | ||
info: | | ||
[...] | ||
21. For each ClassElement m in order from methods | ||
a. If IsStatic of m is false, then | ||
i. Let status be the result of performing PropertyDefinitionEvaluation | ||
for m with arguments proto and false. | ||
---*/ | ||
|
||
var stringSet; | ||
|
||
var C = class { | ||
get /*{ declareWith }*/() { return 'get string'; } | ||
set /*{ declareWith }*/(param) { stringSet = param; } | ||
}; | ||
|
||
assert.sameValue(C.prototype[/*{ referenceWith }*/], 'get string'); | ||
|
||
C.prototype[/*{ referenceWith }*/] = 'set string'; | ||
assert.sameValue(stringSet, 'set string'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (C) 2017 Mike Pennisi. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
path: language/expressions/class/accessor-name-static- | ||
name: Class expression, static method | ||
esid: sec-runtime-semantics-classdefinitionevaluation | ||
es6id: 14.5.14 | ||
info: | | ||
[...] | ||
21. For each ClassElement m in order from methods | ||
a. If IsStatic of m is false, then | ||
[...] | ||
b. Else, | ||
a. Let status be the result of performing PropertyDefinitionEvaluation | ||
for m with arguments F and false. | ||
---*/ | ||
|
||
var stringSet; | ||
|
||
var C = class { | ||
static get /*{ declareWith }*/() { return 'get string'; } | ||
static set /*{ declareWith }*/(param) { stringSet = param; } | ||
}; | ||
|
||
assert.sameValue(C[/*{ referenceWith }*/], 'get string'); | ||
|
||
C[/*{ referenceWith }*/] = 'set string'; | ||
assert.sameValue(stringSet, 'set string'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (C) 2017 Mike Pennisi. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
path: language/expressions/object/accessor-name- | ||
name: Object initializer | ||
esid: sec-object-initializer-runtime-semantics-evaluation | ||
es6id: 12.2.6.8 | ||
info: | | ||
ObjectLiteral : | ||
{ PropertyDefinitionList } | ||
{ PropertyDefinitionList , } | ||
|
||
1. Let obj be ObjectCreate(%ObjectPrototype%). | ||
2. Let status be the result of performing PropertyDefinitionEvaluation of | ||
PropertyDefinitionList with arguments obj and true. | ||
---*/ | ||
|
||
var stringSet; | ||
var obj = { | ||
get [/*{ declareWith }*/]() { return 'get string'; }, | ||
set [/*{ declareWith }*/](param) { stringSet = param; } | ||
}; | ||
|
||
assert.sameValue(obj[/*{ referenceWith }*/], 'get string'); | ||
|
||
obj[/*{ referenceWith }*/] = 'set string'; | ||
assert.sameValue(stringSet, 'set string'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright (C) 2017 Mike Pennisi. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
path: language/statements/class/accessor-name-inst- | ||
name: Class declaration, instance method | ||
esid: sec-runtime-semantics-classdefinitionevaluation | ||
es6id: 14.5.14 | ||
info: | | ||
[...] | ||
21. For each ClassElement m in order from methods | ||
a. If IsStatic of m is false, then | ||
i. Let status be the result of performing PropertyDefinitionEvaluation | ||
for m with arguments proto and false. | ||
---*/ | ||
|
||
assert.throws(/*{ error }*/, function() { | ||
class C { | ||
get [/*{ name }*/]() {} | ||
} | ||
}, '`get` accessor'); | ||
|
||
assert.throws(/*{ error }*/, function() { | ||
class C { | ||
set [/*{ name }*/](_) {} | ||
} | ||
}, '`set` accessor'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (C) 2017 Mike Pennisi. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
path: language/statements/class/accessor-name-static- | ||
name: Class declaration, static method | ||
esid: sec-runtime-semantics-classdefinitionevaluation | ||
es6id: 14.5.14 | ||
info: | | ||
[...] | ||
21. For each ClassElement m in order from methods | ||
a. If IsStatic of m is false, then | ||
[...] | ||
b. Else, | ||
a. Let status be the result of performing PropertyDefinitionEvaluation | ||
for m with arguments F and false. | ||
---*/ | ||
|
||
assert.throws(/*{ error }*/, function() { | ||
class C { | ||
static get [/*{ name }*/]() {} | ||
} | ||
}, '`get` accessor'); | ||
|
||
assert.throws(/*{ error }*/, function() { | ||
class C { | ||
static set [/*{ name }*/](_) {} | ||
} | ||
}, '`set` accessor'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright (C) 2017 Mike Pennisi. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
path: language/expressions/class/accessor-name-inst- | ||
name: Class expression, instance method | ||
esid: sec-runtime-semantics-classdefinitionevaluation | ||
es6id: 14.5.14 | ||
info: | | ||
[...] | ||
21. For each ClassElement m in order from methods | ||
a. If IsStatic of m is false, then | ||
i. Let status be the result of performing PropertyDefinitionEvaluation | ||
for m with arguments proto and false. | ||
---*/ | ||
|
||
assert.throws(/*{ error }*/, function() { | ||
0, class { | ||
get [/*{ name }*/]() {} | ||
}; | ||
}, '`get` accessor'); | ||
|
||
assert.throws(/*{ error }*/, function() { | ||
0, class { | ||
set [/*{ name }*/](_) {} | ||
}; | ||
}, '`set` accessor'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (C) 2017 Mike Pennisi. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
path: language/expressions/class/accessor-name-static- | ||
name: Class expression, static method | ||
esid: sec-runtime-semantics-classdefinitionevaluation | ||
es6id: 14.5.14 | ||
info: | | ||
[...] | ||
21. For each ClassElement m in order from methods | ||
a. If IsStatic of m is false, then | ||
[...] | ||
b. Else, | ||
a. Let status be the result of performing PropertyDefinitionEvaluation | ||
for m with arguments F and false. | ||
---*/ | ||
|
||
assert.throws(/*{ error }*/, function() { | ||
0, class { | ||
static get [/*{ name }*/]() {} | ||
}; | ||
}, '`get` accessor'); | ||
|
||
assert.throws(/*{ error }*/, function() { | ||
0, class { | ||
static set [/*{ name }*/](_) {} | ||
}; | ||
}, '`set` accessor'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (C) 2017 Mike Pennisi. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
path: language/expressions/object/accessor-name- | ||
name: Object initializer | ||
esid: sec-object-initializer-runtime-semantics-evaluation | ||
es6id: 12.2.6.8 | ||
info: | | ||
ObjectLiteral : | ||
{ PropertyDefinitionList } | ||
{ PropertyDefinitionList , } | ||
|
||
1. Let obj be ObjectCreate(%ObjectPrototype%). | ||
2. Let status be the result of performing PropertyDefinitionEvaluation of | ||
PropertyDefinitionList with arguments obj and true. | ||
---*/ | ||
|
||
assert.throws(/*{ error }*/, function() { | ||
({ | ||
get [/*{ name }*/]() {} | ||
}); | ||
}, '`get` accessor'); | ||
|
||
assert.throws(/*{ error }*/, function() { | ||
({ | ||
set [/*{ name }*/](_) {} | ||
}); | ||
}, '`set` accessor'); |
Oops, something went wrong.