mirror of https://github.com/tc39/test262.git
Fix more issues in eval tests for class-fields
Changes: - Changed eval-err-contains-supercall-1.case to add a property access similar to eval-err-contains-supercall-2.case, without this property access eval-err-contains-supercall-1.case would be identical to eval-err-contains-supercall.case. - Remove unnecessary "earlyerror" and "executionerror" template arguments when the value is already clear from the context. - Fixed the description in eval-err-contains-supercall-2.case to refer to the correct early error rule. - Fixed a copy-paste error in eval-err-contains-superproperty-1.case and eval-err-contains-superproperty-2.case. - Split initializer-eval-super into initializer-eval-super-call and initializer-eval-super-property, because we actually need to test different behaviour for the super-call compared to the super-property case. - Split initializer-eval into initializer-eval-arguments and initializer-eval-newtarget, because `arguments` and `new.target` are differently handled in class-fields. - And fixed other copy-paste errors in the template files. Fixes #1325
This commit is contained in:
parent
2d6a356699
commit
5ec3bd7d03
|
@ -18,7 +18,7 @@ info: |
|
|||
...
|
||||
For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
|
||||
features: [class-fields]
|
||||
template: initializer-eval
|
||||
template: initializer-eval-arguments
|
||||
---*/
|
||||
|
||||
//- initializer
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
desc: error if `new.call` in StatementList of eval
|
||||
desc: error if `new.target` in StatementList of eval
|
||||
info: |
|
||||
Additional Early Error Rules for Eval Inside Initializer
|
||||
These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
|
||||
|
@ -17,12 +17,8 @@ info: |
|
|||
|
||||
It is a Syntax Error if StatementList Contains NewTarget.
|
||||
features: [class-fields]
|
||||
template: initializer-eval
|
||||
template: initializer-eval-newtarget
|
||||
---*/
|
||||
|
||||
//- initializer
|
||||
new.call
|
||||
//- earlyerror
|
||||
SyntaxError
|
||||
//- executionerror
|
||||
SyntaxError
|
||||
new.target
|
|
@ -2,7 +2,7 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
desc: error if `super()` in StatementList of eval
|
||||
desc: error if `super()['x']` in StatementList of eval
|
||||
info: |
|
||||
Additional Early Error Rules for Eval Inside Initializer
|
||||
These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
|
||||
|
@ -17,12 +17,8 @@ info: |
|
|||
|
||||
It is a Syntax Error if StatementList Contains SuperCall.
|
||||
features: [class-fields]
|
||||
template: initializer-eval-super
|
||||
template: initializer-eval-super-call
|
||||
---*/
|
||||
|
||||
//- initializer
|
||||
super()
|
||||
//- earlyerror
|
||||
SyntaxError
|
||||
//- executionerror
|
||||
SyntaxError
|
||||
super()['x']
|
||||
|
|
|
@ -11,18 +11,14 @@ info: |
|
|||
...
|
||||
The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
|
||||
|
||||
Additional Early Error Rules for Eval Outside Methods
|
||||
These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
|
||||
Additional Early Error Rules for Eval Outside Constructor Methods
|
||||
These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
|
||||
ScriptBody:StatementList
|
||||
|
||||
It is a Syntax Error if StatementList Contains SuperCall.
|
||||
features: [class-fields]
|
||||
template: initializer-eval-super
|
||||
template: initializer-eval-super-call
|
||||
---*/
|
||||
|
||||
//- initializer
|
||||
super().x
|
||||
//- earlyerror
|
||||
SyntaxError
|
||||
//- executionerror
|
||||
SyntaxError
|
||||
|
|
|
@ -17,12 +17,8 @@ info: |
|
|||
|
||||
It is a Syntax Error if StatementList Contains SuperCall.
|
||||
features: [class-fields]
|
||||
template: initializer-eval-super
|
||||
template: initializer-eval-super-call
|
||||
---*/
|
||||
|
||||
//- initializer
|
||||
super()
|
||||
//- earlyerror
|
||||
SyntaxError
|
||||
//- executionerror
|
||||
SyntaxError
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
desc: error if `super().x` in StatementList of eval
|
||||
desc: error if `super.x` in StatementList of eval
|
||||
info: |
|
||||
Additional Early Error Rules for Eval Inside Initializer
|
||||
These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
|
||||
|
@ -17,12 +17,8 @@ info: |
|
|||
|
||||
It is a Syntax Error if StatementList Contains SuperProperty.
|
||||
features: [class-fields]
|
||||
template: initializer-eval-super
|
||||
template: initializer-eval-super-property
|
||||
---*/
|
||||
|
||||
//- initializer
|
||||
super.x
|
||||
//- earlyerror
|
||||
SyntaxError
|
||||
//- executionerror
|
||||
SyntaxError
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
desc: error if `super().x` in StatementList of eval
|
||||
desc: error if `super['x']` in StatementList of eval
|
||||
info: |
|
||||
Additional Early Error Rules for Eval Inside Initializer
|
||||
These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
|
||||
|
@ -17,12 +17,8 @@ info: |
|
|||
|
||||
It is a Syntax Error if StatementList Contains SuperProperty.
|
||||
features: [class-fields]
|
||||
template: initializer-eval-super
|
||||
template: initializer-eval-super-property
|
||||
---*/
|
||||
|
||||
//- initializer
|
||||
super['x']
|
||||
//- earlyerror
|
||||
SyntaxError
|
||||
//- executionerror
|
||||
SyntaxError
|
||||
|
|
|
@ -8,7 +8,7 @@ name: direct eval
|
|||
---*/
|
||||
|
||||
var executed = false;
|
||||
class C = {
|
||||
class C {
|
||||
x = eval('executed = true; /*{ initializer }*/;');
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@ name: indirect eval
|
|||
---*/
|
||||
|
||||
var executed = false;
|
||||
class C = {
|
||||
class C {
|
||||
x = (0, eval)('executed = true; /*{ initializer }*/;');
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2017 Valerie Young. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-performeval-rules-in-initializer
|
||||
path: language/statements/class/fields-direct-
|
||||
name: direct eval
|
||||
---*/
|
||||
|
||||
var executed = false;
|
||||
class C {
|
||||
x = eval('executed = true; /*{ initializer }*/;');
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
||||
assert.sameValue(executed, true);
|
||||
assert.sameValue(c.x, undefined);
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (C) 2017 Valerie Young. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-performeval-rules-in-initializer
|
||||
path: language/statements/class/fields-indirect-
|
||||
name: indirect eval
|
||||
---*/
|
||||
|
||||
var executed = false;
|
||||
class C {
|
||||
x = (0, eval)('executed = true; /*{ initializer }*/;');
|
||||
}
|
||||
|
||||
assert.throws(SyntaxError, function() {
|
||||
new C();
|
||||
});
|
||||
|
||||
assert.sameValue(executed, false);
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2017 Valerie Young. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-performeval-rules-in-initializer
|
||||
path: language/expressions/class/fields-direct-
|
||||
name: direct eval
|
||||
---*/
|
||||
|
||||
var executed = false;
|
||||
var C = class {
|
||||
x = eval('executed = true; /*{ initializer }*/;');
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
||||
assert.sameValue(executed, true);
|
||||
assert.sameValue(c.x, undefined);
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (C) 2017 Valerie Young. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-performeval-rules-in-initializer
|
||||
path: language/expressions/class/fields-indirect-
|
||||
name: indirect eval
|
||||
---*/
|
||||
|
||||
var executed = false;
|
||||
var C = class {
|
||||
x = (0, eval)('executed = true; /*{ initializer }*/;');
|
||||
}
|
||||
|
||||
assert.throws(SyntaxError, function() {
|
||||
new C();
|
||||
});
|
||||
|
||||
assert.sameValue(executed, false);
|
|
@ -7,14 +7,14 @@ path: language/statements/class/fields-derived-cls-direct-
|
|||
name: direct eval
|
||||
---*/
|
||||
|
||||
class A = {}
|
||||
class A {}
|
||||
|
||||
var executed = false;
|
||||
class C extends A = {
|
||||
class C extends A {
|
||||
x = eval('executed = true; /*{ initializer }*/;');
|
||||
}
|
||||
|
||||
assert.throws(/*{ earlyerror }*/, function() {
|
||||
assert.throws(SyntaxError, function() {
|
||||
new C();
|
||||
});
|
||||
|
|
@ -7,15 +7,15 @@ path: language/statements/class/fields-derived-cls-indirect-
|
|||
name: indirect eval
|
||||
---*/
|
||||
|
||||
class A = {}
|
||||
class A {}
|
||||
|
||||
var executed = false;
|
||||
class C extends A = {
|
||||
class C extends A {
|
||||
x = (0, eval)('executed = true; /*{ initializer }*/;');
|
||||
}
|
||||
|
||||
assert.throws(/*{ executionerror }*/, function() {
|
||||
assert.throws(SyntaxError, function() {
|
||||
new C();
|
||||
});
|
||||
|
||||
assert.sameValue(executed, true);
|
||||
assert.sameValue(executed, false);
|
|
@ -14,7 +14,7 @@ var C = class extends A {
|
|||
x = eval('executed = true; /*{ initializer }*/;');
|
||||
}
|
||||
|
||||
assert.throws(/*{ earlyerror }*/, function() {
|
||||
assert.throws(SyntaxError, function() {
|
||||
new C();
|
||||
});
|
||||
|
|
@ -14,8 +14,8 @@ var C = class extends A {
|
|||
x = (0, eval)('executed = true; /*{ initializer }*/;');
|
||||
}
|
||||
|
||||
assert.throws(/*{ executionerror }*/, function() {
|
||||
assert.throws(SyntaxError, function() {
|
||||
new C();
|
||||
});
|
||||
|
||||
assert.sameValue(executed, true);
|
||||
assert.sameValue(executed, false);
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (C) 2017 Valerie Young. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-performeval-rules-in-initializer
|
||||
path: language/statements/class/fields-derived-cls-direct-
|
||||
name: direct eval
|
||||
---*/
|
||||
|
||||
class A {}
|
||||
|
||||
var executed = false;
|
||||
class C extends A {
|
||||
x = eval('executed = true; /*{ initializer }*/;');
|
||||
}
|
||||
|
||||
new C();
|
||||
|
||||
assert.sameValue(executed, true);
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2017 Valerie Young. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-performeval-rules-in-initializer
|
||||
path: language/statements/class/fields-derived-cls-indirect-
|
||||
name: indirect eval
|
||||
---*/
|
||||
|
||||
class A {}
|
||||
|
||||
var executed = false;
|
||||
class C extends A {
|
||||
x = (0, eval)('executed = true; /*{ initializer }*/;');
|
||||
}
|
||||
|
||||
assert.throws(SyntaxError, function() {
|
||||
new C();
|
||||
});
|
||||
|
||||
assert.sameValue(executed, false);
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (C) 2017 Valerie Young. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-performeval-rules-in-initializer
|
||||
path: language/expressions/class/fields-derived-cls-direct-
|
||||
name: direct eval
|
||||
---*/
|
||||
|
||||
var A = class {}
|
||||
|
||||
var executed = false;
|
||||
var C = class extends A {
|
||||
x = eval('executed = true; /*{ initializer }*/;');
|
||||
}
|
||||
|
||||
new C();
|
||||
|
||||
assert.sameValue(executed, true);
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2017 Valerie Young. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-performeval-rules-in-initializer
|
||||
path: language/expressions/class/fields-derived-cls-indirect-
|
||||
name: indirect eval
|
||||
---*/
|
||||
|
||||
var A = class {}
|
||||
|
||||
var executed = false;
|
||||
var C = class extends A {
|
||||
x = (0, eval)('executed = true; /*{ initializer }*/;');
|
||||
}
|
||||
|
||||
assert.throws(SyntaxError, function() {
|
||||
new C();
|
||||
});
|
||||
|
||||
assert.sameValue(executed, false);
|
Loading…
Reference in New Issue