Skip to content
Snippets Groups Projects
Commit 185e5908 authored by Caio Lima's avatar Caio Lima Committed by Rick Waldron
Browse files

Removed invalid super access tests and created properly syntax error checks

parent 642929b2
No related branches found
No related tags found
No related merge requests found
// 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();
}
}
// 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');
// 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');
// 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();
}
}
};
// 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');
// 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();
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment