mirror of
https://github.com/tc39/test262.git
synced 2025-07-25 15:04:43 +02:00
Removed invalid super access tests and created properly syntax error checks
This commit is contained in:
parent
642929b2a3
commit
185e590880
26
src/class-elements/grammar-private-field-super-access.case
Normal file
26
src/class-elements/grammar-private-field-super-access.case
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// Copyright (C) 2019 Caio Lima. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: Acessing private field from super is not a valid syntax
|
||||||
|
info: |
|
||||||
|
Updated Productions
|
||||||
|
|
||||||
|
MemberExpression[Yield]:
|
||||||
|
MemberExpression[?Yield].PrivateName
|
||||||
|
template: syntax/invalid
|
||||||
|
features: [class-fields-private]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- elements
|
||||||
|
#m = function() { return 'test262'; };
|
||||||
|
|
||||||
|
Child = class extends C {
|
||||||
|
access() {
|
||||||
|
return super.#m;
|
||||||
|
}
|
||||||
|
|
||||||
|
method() {
|
||||||
|
return super.#m();
|
||||||
|
}
|
||||||
|
}
|
@ -1,42 +0,0 @@
|
|||||||
// Copyright (C) 2019 Caio Lima. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
desc: Acessing private field from super should throw an error
|
|
||||||
info: |
|
|
||||||
Updated Productions
|
|
||||||
|
|
||||||
CallExpression[Yield, Await]:
|
|
||||||
CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
|
|
||||||
SuperCall[?Yield, ?Await]
|
|
||||||
CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
|
|
||||||
CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
|
|
||||||
CallExpression[?Yield, ?Await].IdentifierName
|
|
||||||
CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
|
|
||||||
CallExpression[?Yield, ?Await].PrivateName
|
|
||||||
template: default
|
|
||||||
features: [class-fields-private, class-fields-public]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
//- elements
|
|
||||||
#m = function() { return 'test262'; };
|
|
||||||
|
|
||||||
Child = class extends C {
|
|
||||||
access() {
|
|
||||||
return super.#m;
|
|
||||||
}
|
|
||||||
|
|
||||||
method() {
|
|
||||||
return super.#m();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//- assertions
|
|
||||||
assert.throws(TypeError, function() {
|
|
||||||
(new (new C()).Child()).method();
|
|
||||||
}, 'super.#m() throws TypeError');
|
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
|
||||||
(new (new C()).Child()).access();
|
|
||||||
}, 'super.#m throws TypeError');
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
|
||||||
// - src/class-elements/private-field-super-access-throws.case
|
|
||||||
// - src/class-elements/default/cls-expr.template
|
|
||||||
/*---
|
|
||||||
description: Acessing private field from super should throw an error (field definitions in a class expression)
|
|
||||||
esid: prod-FieldDefinition
|
|
||||||
features: [class-fields-private, class-fields-public, class]
|
|
||||||
flags: [generated]
|
|
||||||
info: |
|
|
||||||
Updated Productions
|
|
||||||
|
|
||||||
CallExpression[Yield, Await]:
|
|
||||||
CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
|
|
||||||
SuperCall[?Yield, ?Await]
|
|
||||||
CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
|
|
||||||
CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
|
|
||||||
CallExpression[?Yield, ?Await].IdentifierName
|
|
||||||
CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
|
|
||||||
CallExpression[?Yield, ?Await].PrivateName
|
|
||||||
|
|
||||||
---*/
|
|
||||||
|
|
||||||
|
|
||||||
var C = class {
|
|
||||||
#m = function() { return 'test262'; };
|
|
||||||
|
|
||||||
Child = class extends C {
|
|
||||||
access() {
|
|
||||||
return super.#m;
|
|
||||||
}
|
|
||||||
|
|
||||||
method() {
|
|
||||||
return super.#m();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
|
||||||
(new (new C()).Child()).method();
|
|
||||||
}, 'super.#m() throws TypeError');
|
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
|
||||||
(new (new C()).Child()).access();
|
|
||||||
}, 'super.#m throws TypeError');
|
|
||||||
|
|
@ -0,0 +1,35 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/class-elements/grammar-private-field-super-access.case
|
||||||
|
// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template
|
||||||
|
/*---
|
||||||
|
description: Acessing private field from super is not a valid syntax (class expression)
|
||||||
|
esid: prod-ClassElement
|
||||||
|
features: [class-fields-private, class]
|
||||||
|
flags: [generated]
|
||||||
|
negative:
|
||||||
|
phase: parse
|
||||||
|
type: SyntaxError
|
||||||
|
info: |
|
||||||
|
Updated Productions
|
||||||
|
|
||||||
|
MemberExpression[Yield]:
|
||||||
|
MemberExpression[?Yield].PrivateName
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
$DONOTEVALUATE();
|
||||||
|
|
||||||
|
var C = class {
|
||||||
|
#m = function() { return 'test262'; };
|
||||||
|
|
||||||
|
Child = class extends C {
|
||||||
|
access() {
|
||||||
|
return super.#m;
|
||||||
|
}
|
||||||
|
|
||||||
|
method() {
|
||||||
|
return super.#m();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
@ -1,46 +0,0 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
|
||||||
// - src/class-elements/private-field-super-access-throws.case
|
|
||||||
// - src/class-elements/default/cls-decl.template
|
|
||||||
/*---
|
|
||||||
description: Acessing private field from super should throw an error (field definitions in a class declaration)
|
|
||||||
esid: prod-FieldDefinition
|
|
||||||
features: [class-fields-private, class-fields-public, class]
|
|
||||||
flags: [generated]
|
|
||||||
info: |
|
|
||||||
Updated Productions
|
|
||||||
|
|
||||||
CallExpression[Yield, Await]:
|
|
||||||
CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
|
|
||||||
SuperCall[?Yield, ?Await]
|
|
||||||
CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
|
|
||||||
CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
|
|
||||||
CallExpression[?Yield, ?Await].IdentifierName
|
|
||||||
CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
|
|
||||||
CallExpression[?Yield, ?Await].PrivateName
|
|
||||||
|
|
||||||
---*/
|
|
||||||
|
|
||||||
|
|
||||||
class C {
|
|
||||||
#m = function() { return 'test262'; };
|
|
||||||
|
|
||||||
Child = class extends C {
|
|
||||||
access() {
|
|
||||||
return super.#m;
|
|
||||||
}
|
|
||||||
|
|
||||||
method() {
|
|
||||||
return super.#m();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
|
||||||
(new (new C()).Child()).method();
|
|
||||||
}, 'super.#m() throws TypeError');
|
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
|
||||||
(new (new C()).Child()).access();
|
|
||||||
}, 'super.#m throws TypeError');
|
|
||||||
|
|
@ -0,0 +1,35 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/class-elements/grammar-private-field-super-access.case
|
||||||
|
// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
|
||||||
|
/*---
|
||||||
|
description: Acessing private field from super is not a valid syntax (class declaration)
|
||||||
|
esid: prod-ClassElement
|
||||||
|
features: [class-fields-private, class]
|
||||||
|
flags: [generated]
|
||||||
|
negative:
|
||||||
|
phase: parse
|
||||||
|
type: SyntaxError
|
||||||
|
info: |
|
||||||
|
Updated Productions
|
||||||
|
|
||||||
|
MemberExpression[Yield]:
|
||||||
|
MemberExpression[?Yield].PrivateName
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
$DONOTEVALUATE();
|
||||||
|
|
||||||
|
class C {
|
||||||
|
#m = function() { return 'test262'; };
|
||||||
|
|
||||||
|
Child = class extends C {
|
||||||
|
access() {
|
||||||
|
return super.#m;
|
||||||
|
}
|
||||||
|
|
||||||
|
method() {
|
||||||
|
return super.#m();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user