Coverage: async arrow in ClassHeritage. Fixes gh-1736

This commit is contained in:
Rick Waldron 2020-09-22 09:35:46 -04:00
parent fd92897147
commit b59bd307a8
4 changed files with 94 additions and 0 deletions

View File

@ -0,0 +1,16 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: It's a SyntaxError if an array literal evaluated on ClassHeritage uses a private name.
info: |
ClassTail : ClassHeritage { ClassBody }
ClassHeritage :
extends LeftHandSideExpression
template: syntax/invalid
---*/
//- heritage
extends () => {}

View File

@ -0,0 +1,16 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: It's a SyntaxError if an array literal evaluated on ClassHeritage uses a private name.
info: |
ClassTail : ClassHeritage { ClassBody }
ClassHeritage :
extends LeftHandSideExpression
template: syntax/invalid
---*/
//- heritage
extends async () => {}

View File

@ -0,0 +1,31 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-runtime-semantics-classdefinitionevaluation
description: >
Throw a TypeError exception if IsConstructor(superclass) is false (async arrow)
info: |
Runtime Semantics: ClassDefinitionEvaluation
ClassTail : ClassHeritage { ClassBody }
...
5. Else,
Set the running execution context's LexicalEnvironment to classScope.
Let superclassRef be the result of evaluating ClassHeritage.
Set the running execution context's LexicalEnvironment to env.
Let superclass be ? GetValue(superclassRef).
If superclass is null, then
Let protoParent be null.
Let constructorParent be %Function.prototype%.
Else if IsConstructor(superclass) is false, throw a TypeError exception.
...
features: [class]
---*/
assert.throws(TypeError, () => {
var C = class extends (async () => {}) {};
});

View File

@ -0,0 +1,31 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-runtime-semantics-classdefinitionevaluation
description: >
Throw a TypeError exception if IsConstructor(superclass) is false (async arrow)
info: |
Runtime Semantics: ClassDefinitionEvaluation
ClassTail : ClassHeritage { ClassBody }
...
5. Else,
Set the running execution context's LexicalEnvironment to classScope.
Let superclassRef be the result of evaluating ClassHeritage.
Set the running execution context's LexicalEnvironment to env.
Let superclass be ? GetValue(superclassRef).
If superclass is null, then
Let protoParent be null.
Let constructorParent be %Function.prototype%.
Else if IsConstructor(superclass) is false, throw a TypeError exception.
...
features: [class]
---*/
assert.throws(TypeError, () => {
var C = class extends (async () => {}) {};
});