mirror of https://github.com/tc39/test262.git
Templates and cases for invalid private names
This commit is contained in:
parent
6986a9166d
commit
8b2b4c35ca
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
desc: bad reference in call expression
|
||||
info: |
|
||||
Static Semantics: AllPrivateNamesValid
|
||||
|
||||
MemberExpression : MemberExpression . PrivateName
|
||||
|
||||
1. If StringValue of PrivateName is in names, return true.
|
||||
2. Return false.
|
||||
|
||||
CallExpression : CallExpression . PrivateName
|
||||
|
||||
1. If StringValue of PrivateName is in names, return true.
|
||||
2. Return false.
|
||||
template: default
|
||||
features: [class-fields-private]
|
||||
---*/
|
||||
|
||||
//- body
|
||||
(() => {})().#x
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
desc: this evaluated in call expression
|
||||
info: |
|
||||
Static Semantics: AllPrivateNamesValid
|
||||
|
||||
MemberExpression : MemberExpression . PrivateName
|
||||
|
||||
1. If StringValue of PrivateName is in names, return true.
|
||||
2. Return false.
|
||||
|
||||
CallExpression : CallExpression . PrivateName
|
||||
|
||||
1. If StringValue of PrivateName is in names, return true.
|
||||
2. Return false.
|
||||
template: default
|
||||
features: [class-fields-private]
|
||||
---*/
|
||||
|
||||
//- body
|
||||
(() => this)().#x
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/statements/block/early-errors/invalid-names-
|
||||
name: >
|
||||
Invalid private names should throw a SyntaxError,
|
||||
block statement
|
||||
esid: sec-static-semantics-early-errors
|
||||
info: |
|
||||
ScriptBody:StatementList
|
||||
It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
|
||||
as an argument is false unless the source code is eval code that is being
|
||||
processed by a direct eval.
|
||||
|
||||
ModuleBody:ModuleItemList
|
||||
It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
|
||||
as an argument is false.
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
{ /*{ body }*/ }
|
|
@ -0,0 +1,29 @@
|
|||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/statements/class/syntax/early-errors/invalid-names/field-init-fn-
|
||||
name: >
|
||||
Invalid private names should throw a SyntaxError,
|
||||
function in class field initializer in class declaration
|
||||
features: [class, class-fields-public]
|
||||
esid: sec-static-semantics-early-errors
|
||||
info: |
|
||||
ScriptBody:StatementList
|
||||
It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
|
||||
as an argument is false unless the source code is eval code that is being
|
||||
processed by a direct eval.
|
||||
|
||||
ModuleBody:ModuleItemList
|
||||
It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
|
||||
as an argument is false.
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
class C {
|
||||
f = function() { /*{ body }*/ }
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/statements/class/syntax/early-errors/invalid-names/fields-init-heritage-
|
||||
name: >
|
||||
Invalid private names should throw a SyntaxError,
|
||||
class field initializer in class declaration
|
||||
features: [class, class-fields-private]
|
||||
esid: sec-static-semantics-early-errors
|
||||
info: |
|
||||
ScriptBody:StatementList
|
||||
It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
|
||||
as an argument is false unless the source code is eval code that is being
|
||||
processed by a direct eval.
|
||||
|
||||
ModuleBody:ModuleItemList
|
||||
It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
|
||||
as an argument is false.
|
||||
|
||||
Static Semantics: AllPrivateNamesValid
|
||||
|
||||
ClassBody : ClassElementList
|
||||
1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody.
|
||||
2. Return AllPrivateNamesValid of ClassElementList with the argument newNames.
|
||||
|
||||
For all other grammatical productions, recurse on subexpressions/substatements,
|
||||
passing in the names of the caller. If all pieces return true, then return true.
|
||||
If any returns false, return false.
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
class Parent {
|
||||
#x = 42;
|
||||
}
|
||||
|
||||
class C extends Parent {
|
||||
f = /*{ body }*/
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/statements/class/syntax/early-errors/invalid-names/field-init-
|
||||
name: >
|
||||
Invalid private names should throw a SyntaxError,
|
||||
class field initializer in class declaration
|
||||
features: [class, class-fields-public]
|
||||
esid: sec-static-semantics-early-errors
|
||||
info: |
|
||||
ScriptBody:StatementList
|
||||
It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
|
||||
as an argument is false unless the source code is eval code that is being
|
||||
processed by a direct eval.
|
||||
|
||||
ModuleBody:ModuleItemList
|
||||
It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
|
||||
as an argument is false.
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
class C {
|
||||
f = /*{ body }*/
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/statements/class/syntax/early-errors/invalid-names/method-inner-
|
||||
name: >
|
||||
Invalid private names should throw a SyntaxError,
|
||||
method in inner class declaration
|
||||
features: [class, class-fields-private]
|
||||
esid: sec-static-semantics-early-errors
|
||||
info: |
|
||||
ScriptBody:StatementList
|
||||
It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
|
||||
as an argument is false unless the source code is eval code that is being
|
||||
processed by a direct eval.
|
||||
|
||||
ModuleBody:ModuleItemList
|
||||
It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
|
||||
as an argument is false.
|
||||
|
||||
Static Semantics: AllPrivateNamesValid
|
||||
|
||||
ClassBody : ClassElementList
|
||||
1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody.
|
||||
2. Return AllPrivateNamesValid of ClassElementList with the argument newNames.
|
||||
|
||||
For all other grammatical productions, recurse on subexpressions/substatements,
|
||||
passing in the names of the caller. If all pieces return true, then return true.
|
||||
If any returns false, return false.
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
class C {
|
||||
#x = 42;
|
||||
m() {
|
||||
class Inner {
|
||||
z() { /*{ body }*/ }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/statements/class/syntax/early-errors/invalid-names/method-fn-
|
||||
name: >
|
||||
Invalid private names should throw a SyntaxError,
|
||||
inner function in method in class declaration
|
||||
features: [class]
|
||||
esid: sec-static-semantics-early-errors
|
||||
info: |
|
||||
ScriptBody:StatementList
|
||||
It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
|
||||
as an argument is false unless the source code is eval code that is being
|
||||
processed by a direct eval.
|
||||
|
||||
ModuleBody:ModuleItemList
|
||||
It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
|
||||
as an argument is false.
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
class C {
|
||||
m() {
|
||||
function fn() { /*{ body }*/ }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/statements/class/syntax/early-errors/invalid-names/method-heritage-
|
||||
name: >
|
||||
Invalid private names should throw a SyntaxError,
|
||||
method in class declaration
|
||||
features: [class, class-fields-private]
|
||||
esid: sec-static-semantics-early-errors
|
||||
info: |
|
||||
ScriptBody:StatementList
|
||||
It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
|
||||
as an argument is false unless the source code is eval code that is being
|
||||
processed by a direct eval.
|
||||
|
||||
ModuleBody:ModuleItemList
|
||||
It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
|
||||
as an argument is false.
|
||||
|
||||
Static Semantics: AllPrivateNamesValid
|
||||
|
||||
ClassBody : ClassElementList
|
||||
1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody.
|
||||
2. Return AllPrivateNamesValid of ClassElementList with the argument newNames.
|
||||
|
||||
For all other grammatical productions, recurse on subexpressions/substatements,
|
||||
passing in the names of the caller. If all pieces return true, then return true.
|
||||
If any returns false, return false.
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
class Parent {
|
||||
#x = 42;
|
||||
}
|
||||
|
||||
class C extends Parent {
|
||||
m() {
|
||||
/*{ body }*/
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/statements/class/syntax/early-errors/invalid-names/method-
|
||||
name: >
|
||||
Invalid private names should throw a SyntaxError,
|
||||
method in class declaration
|
||||
features: [class]
|
||||
esid: sec-static-semantics-early-errors
|
||||
info: |
|
||||
ScriptBody:StatementList
|
||||
It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
|
||||
as an argument is false unless the source code is eval code that is being
|
||||
processed by a direct eval.
|
||||
|
||||
ModuleBody:ModuleItemList
|
||||
It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
|
||||
as an argument is false.
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
class C {
|
||||
m() { /*{ body }*/ }
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/statements/class/syntax/early-errors/invalid-names/method-outter-
|
||||
name: >
|
||||
Invalid private names should throw a SyntaxError,
|
||||
method in outter class declaration
|
||||
features: [class, class-fields-private]
|
||||
esid: sec-static-semantics-early-errors
|
||||
info: |
|
||||
ScriptBody:StatementList
|
||||
It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
|
||||
as an argument is false unless the source code is eval code that is being
|
||||
processed by a direct eval.
|
||||
|
||||
ModuleBody:ModuleItemList
|
||||
It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
|
||||
as an argument is false.
|
||||
|
||||
Static Semantics: AllPrivateNamesValid
|
||||
|
||||
ClassBody : ClassElementList
|
||||
1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody.
|
||||
2. Return AllPrivateNamesValid of ClassElementList with the argument newNames.
|
||||
|
||||
For all other grammatical productions, recurse on subexpressions/substatements,
|
||||
passing in the names of the caller. If all pieces return true, then return true.
|
||||
If any returns false, return false.
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
class C {
|
||||
m() {
|
||||
class Outter {
|
||||
#x = 42;
|
||||
}
|
||||
|
||||
this.#x;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/expressions/class/syntax/early-errors/invalid-names/field-init-fn-
|
||||
name: >
|
||||
Invalid private names should throw a SyntaxError,
|
||||
function in class field initializer in class expression
|
||||
info: |
|
||||
ScriptBody:StatementList
|
||||
It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
|
||||
as an argument is false unless the source code is eval code that is being
|
||||
processed by a direct eval.
|
||||
|
||||
ModuleBody:ModuleItemList
|
||||
It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
|
||||
as an argument is false.
|
||||
|
||||
Static Semantics: AllPrivateNamesValid
|
||||
|
||||
ClassBody : ClassElementList
|
||||
1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody.
|
||||
2. Return AllPrivateNamesValid of ClassElementList with the argument newNames.
|
||||
|
||||
For all other grammatical productions, recurse on subexpressions/substatements,
|
||||
passing in the names of the caller. If all pieces return true, then return true.
|
||||
If any returns false, return false.
|
||||
features: [class, class-fields-public]
|
||||
esid: sec-static-semantics-early-errors
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
var C = class {
|
||||
f = function() { /*{ body }*/ }
|
||||
};
|
|
@ -0,0 +1,43 @@
|
|||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/expressions/class/syntax/early-errors/invalid-names/field-init-heritage-
|
||||
name: >
|
||||
Invalid private names should throw a SyntaxError,
|
||||
field initializer in inner class expression
|
||||
features: [class, class-fields-private]
|
||||
info: |
|
||||
ScriptBody:StatementList
|
||||
It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
|
||||
as an argument is false unless the source code is eval code that is being
|
||||
processed by a direct eval.
|
||||
|
||||
ModuleBody:ModuleItemList
|
||||
It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
|
||||
as an argument is false.
|
||||
|
||||
Static Semantics: AllPrivateNamesValid
|
||||
|
||||
ClassBody : ClassElementList
|
||||
1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody.
|
||||
2. Return AllPrivateNamesValid of ClassElementList with the argument newNames.
|
||||
|
||||
For all other grammatical productions, recurse on subexpressions/substatements,
|
||||
passing in the names of the caller. If all pieces return true, then return true.
|
||||
If any returns false, return false.
|
||||
esid: sec-static-semantics-early-errors
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
class Parent {
|
||||
#x = 42;
|
||||
}
|
||||
|
||||
var C = class extends Parent {
|
||||
f = /*{ body }*/
|
||||
};
|
|
@ -0,0 +1,39 @@
|
|||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/expressions/class/syntax/early-errors/invalid-names/field-init-
|
||||
name: >
|
||||
Invalid private names should throw a SyntaxError,
|
||||
class field initializer in class expression
|
||||
info: |
|
||||
ScriptBody:StatementList
|
||||
It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
|
||||
as an argument is false unless the source code is eval code that is being
|
||||
processed by a direct eval.
|
||||
|
||||
ModuleBody:ModuleItemList
|
||||
It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
|
||||
as an argument is false.
|
||||
|
||||
Static Semantics: AllPrivateNamesValid
|
||||
|
||||
ClassBody : ClassElementList
|
||||
1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody.
|
||||
2. Return AllPrivateNamesValid of ClassElementList with the argument newNames.
|
||||
|
||||
For all other grammatical productions, recurse on subexpressions/substatements,
|
||||
passing in the names of the caller. If all pieces return true, then return true.
|
||||
If any returns false, return false.
|
||||
features: [class, class-fields-public]
|
||||
esid: sec-static-semantics-early-errors
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
var C = class {
|
||||
f = /*{ body }*/
|
||||
};
|
|
@ -0,0 +1,44 @@
|
|||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/expressions/class/syntax/early-errors/invalid-names/method-inner-
|
||||
name: >
|
||||
Invalid private names should throw a SyntaxError,
|
||||
method in inner class expression
|
||||
features: [class, class-fields-private]
|
||||
info: |
|
||||
ScriptBody:StatementList
|
||||
It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
|
||||
as an argument is false unless the source code is eval code that is being
|
||||
processed by a direct eval.
|
||||
|
||||
ModuleBody:ModuleItemList
|
||||
It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
|
||||
as an argument is false.
|
||||
|
||||
Static Semantics: AllPrivateNamesValid
|
||||
|
||||
ClassBody : ClassElementList
|
||||
1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody.
|
||||
2. Return AllPrivateNamesValid of ClassElementList with the argument newNames.
|
||||
|
||||
For all other grammatical productions, recurse on subexpressions/substatements,
|
||||
passing in the names of the caller. If all pieces return true, then return true.
|
||||
If any returns false, return false.
|
||||
esid: sec-static-semantics-early-errors
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
var C = class {
|
||||
#x = 42;
|
||||
m() {
|
||||
class Inner {
|
||||
z() { /*{ body }*/ }
|
||||
}
|
||||
}
|
||||
};
|
|
@ -0,0 +1,41 @@
|
|||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/expressions/class/syntax/early-errors/invalid-names/method-fn-
|
||||
name: >
|
||||
Invalid private names should throw a SyntaxError,
|
||||
inner function in method in class expression
|
||||
info: |
|
||||
ScriptBody:StatementList
|
||||
It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
|
||||
as an argument is false unless the source code is eval code that is being
|
||||
processed by a direct eval.
|
||||
|
||||
ModuleBody:ModuleItemList
|
||||
It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
|
||||
as an argument is false.
|
||||
|
||||
Static Semantics: AllPrivateNamesValid
|
||||
|
||||
ClassBody : ClassElementList
|
||||
1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody.
|
||||
2. Return AllPrivateNamesValid of ClassElementList with the argument newNames.
|
||||
|
||||
For all other grammatical productions, recurse on subexpressions/substatements,
|
||||
passing in the names of the caller. If all pieces return true, then return true.
|
||||
If any returns false, return false.
|
||||
features: [class]
|
||||
esid: sec-static-semantics-early-errors
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
var C = class {
|
||||
m() {
|
||||
function fn() { /*{ body }*/ }
|
||||
}
|
||||
};
|
|
@ -0,0 +1,45 @@
|
|||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/expressions/class/syntax/early-errors/invalid-names/method-heritage-
|
||||
name: >
|
||||
Invalid private names should throw a SyntaxError,
|
||||
method in inner class expression
|
||||
features: [class, class-fields-private]
|
||||
info: |
|
||||
ScriptBody:StatementList
|
||||
It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
|
||||
as an argument is false unless the source code is eval code that is being
|
||||
processed by a direct eval.
|
||||
|
||||
ModuleBody:ModuleItemList
|
||||
It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
|
||||
as an argument is false.
|
||||
|
||||
Static Semantics: AllPrivateNamesValid
|
||||
|
||||
ClassBody : ClassElementList
|
||||
1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody.
|
||||
2. Return AllPrivateNamesValid of ClassElementList with the argument newNames.
|
||||
|
||||
For all other grammatical productions, recurse on subexpressions/substatements,
|
||||
passing in the names of the caller. If all pieces return true, then return true.
|
||||
If any returns false, return false.
|
||||
esid: sec-static-semantics-early-errors
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
class Parent {
|
||||
#x = 42;
|
||||
}
|
||||
|
||||
var C = class extends Parent {
|
||||
m() {
|
||||
/*{ body }*/
|
||||
}
|
||||
};
|
|
@ -0,0 +1,39 @@
|
|||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/expressions/class/syntax/early-errors/invalid-names/method-
|
||||
name: >
|
||||
Invalid private names should throw a SyntaxError,
|
||||
method in class expression
|
||||
info: |
|
||||
ScriptBody:StatementList
|
||||
It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
|
||||
as an argument is false unless the source code is eval code that is being
|
||||
processed by a direct eval.
|
||||
|
||||
ModuleBody:ModuleItemList
|
||||
It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
|
||||
as an argument is false.
|
||||
|
||||
Static Semantics: AllPrivateNamesValid
|
||||
|
||||
ClassBody : ClassElementList
|
||||
1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody.
|
||||
2. Return AllPrivateNamesValid of ClassElementList with the argument newNames.
|
||||
|
||||
For all other grammatical productions, recurse on subexpressions/substatements,
|
||||
passing in the names of the caller. If all pieces return true, then return true.
|
||||
If any returns false, return false.
|
||||
features: [class]
|
||||
esid: sec-static-semantics-early-errors
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
var C = class {
|
||||
m() { /*{ body }*/ }
|
||||
};
|
|
@ -0,0 +1,45 @@
|
|||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/expressions/class/syntax/early-errors/invalid-names/method-outter-
|
||||
name: >
|
||||
Invalid private names should throw a SyntaxError,
|
||||
method in outter class expression
|
||||
features: [class, class-fields-private]
|
||||
info: |
|
||||
ScriptBody:StatementList
|
||||
It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
|
||||
as an argument is false unless the source code is eval code that is being
|
||||
processed by a direct eval.
|
||||
|
||||
ModuleBody:ModuleItemList
|
||||
It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
|
||||
as an argument is false.
|
||||
|
||||
Static Semantics: AllPrivateNamesValid
|
||||
|
||||
ClassBody : ClassElementList
|
||||
1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody.
|
||||
2. Return AllPrivateNamesValid of ClassElementList with the argument newNames.
|
||||
|
||||
For all other grammatical productions, recurse on subexpressions/substatements,
|
||||
passing in the names of the caller. If all pieces return true, then return true.
|
||||
If any returns false, return false.
|
||||
esid: sec-static-semantics-early-errors
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
var C = class {
|
||||
m() {
|
||||
class Outter {
|
||||
#x = 42;
|
||||
}
|
||||
|
||||
this.#x;
|
||||
}
|
||||
};
|
|
@ -0,0 +1 @@
|
|||
Cases conventionally use #x as the private name reference to be flagged as invalid.
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/statements/function/early-errors/invalid-names-
|
||||
name: >
|
||||
Invalid private names should throw a SyntaxError,
|
||||
inside function declaration
|
||||
esid: sec-static-semantics-early-errors
|
||||
info: |
|
||||
ScriptBody:StatementList
|
||||
It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
|
||||
as an argument is false unless the source code is eval code that is being
|
||||
processed by a direct eval.
|
||||
|
||||
ModuleBody:ModuleItemList
|
||||
It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
|
||||
as an argument is false.
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
function fn() { /*{ body }*/ }
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/expressions/function/early-errors/invalid-names-
|
||||
name: >
|
||||
Invalid private names should throw a SyntaxError,
|
||||
inside function expression
|
||||
esid: sec-static-semantics-early-errors
|
||||
info: |
|
||||
ScriptBody:StatementList
|
||||
It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
|
||||
as an argument is false unless the source code is eval code that is being
|
||||
processed by a direct eval.
|
||||
|
||||
ModuleBody:ModuleItemList
|
||||
It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
|
||||
as an argument is false.
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
var fn = function() { /*{ body }*/ };
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/module-code/invalid-private-names-
|
||||
name: >
|
||||
Invalid private names should throw a SyntaxError,
|
||||
top level of module body
|
||||
esid: sec-static-semantics-early-errors
|
||||
info: |
|
||||
ScriptBody:StatementList
|
||||
It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
|
||||
as an argument is false unless the source code is eval code that is being
|
||||
processed by a direct eval.
|
||||
|
||||
ModuleBody:ModuleItemList
|
||||
It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
|
||||
as an argument is false.
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
/*{ body }*/
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/global-code/invalid-private-names-
|
||||
name: >
|
||||
Invalid private names should throw a SyntaxError,
|
||||
top level of script body
|
||||
esid: sec-static-semantics-early-errors
|
||||
info: |
|
||||
ScriptBody:StatementList
|
||||
It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
|
||||
as an argument is false unless the source code is eval code that is being
|
||||
processed by a direct eval.
|
||||
|
||||
ModuleBody:ModuleItemList
|
||||
It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
|
||||
as an argument is false.
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
/*{ body }*/
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
desc: bad reference in member expression
|
||||
info: |
|
||||
Static Semantics: AllPrivateNamesValid
|
||||
|
||||
MemberExpression : MemberExpression . PrivateName
|
||||
|
||||
1. If StringValue of PrivateName is in names, return true.
|
||||
2. Return false.
|
||||
|
||||
CallExpression : CallExpression . PrivateName
|
||||
|
||||
1. If StringValue of PrivateName is in names, return true.
|
||||
2. Return false.
|
||||
template: default
|
||||
features: [class-fields-private]
|
||||
---*/
|
||||
|
||||
//- body
|
||||
something.#x
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
desc: this reference in member expression
|
||||
info: |
|
||||
Static Semantics: AllPrivateNamesValid
|
||||
|
||||
MemberExpression : MemberExpression . PrivateName
|
||||
|
||||
1. If StringValue of PrivateName is in names, return true.
|
||||
2. Return false.
|
||||
|
||||
CallExpression : CallExpression . PrivateName
|
||||
|
||||
1. If StringValue of PrivateName is in names, return true.
|
||||
2. Return false.
|
||||
template: default
|
||||
features: [class-fields-private]
|
||||
---*/
|
||||
|
||||
//- body
|
||||
this.#x
|
Loading…
Reference in New Issue