blob: eeac4b254172c69152b499720c034c186d2835a2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
var BUGNUMBER = 1185106;
var summary = "EarlyErrors for async function";
print(BUGNUMBER + ": " + summary);
function assertThrowsSE(code) {
assertThrowsInstanceOf(() => Reflect.parse(code), SyntaxError);
}
if (typeof Reflect !== "undefined" && Reflect.parse) {
// If FormalParameters Contains AwaitExpression is true.
assertThrowsSE("async function a(k = await 3) {}");
assertThrowsSE("(async function(k = await 3) {})");
assertThrowsSE("(async function a(k = await 3) {})");
// If BindingIdentifier is `eval` or `arguments`.
assertThrowsSE("'use strict'; async function eval() {}");
assertThrowsSE("'use strict'; (async function eval() {})");
assertThrowsSE("'use strict'; async function arguments() {}");
assertThrowsSE("'use strict'; (async function arguments() {})");
// If any element of the BoundNames of FormalParameters also occurs in the
// LexicallyDeclaredNames of AsyncFunctionBody.
assertThrowsSE("async function a(x) { let x; }");
assertThrowsSE("(async function(x) { let x; })");
assertThrowsSE("(async function a(x) { let x; })");
// If FormalParameters contains SuperProperty is true.
assertThrowsSE("async function a(k = super.prop) { }");
assertThrowsSE("(async function(k = super.prop) {})");
assertThrowsSE("(async function a(k = super.prop) {})");
// If AsyncFunctionBody contains SuperProperty is true.
assertThrowsSE("async function a() { super.prop(); }");
assertThrowsSE("(async function() { super.prop(); })");
assertThrowsSE("(async function a() { super.prop(); })");
// If FormalParameters contains SuperCall is true.
assertThrowsSE("async function a(k = super()) {}");
assertThrowsSE("(async function(k = super()) {})");
assertThrowsSE("(async function a(k = super()) {})");
// If AsyncFunctionBody contains SuperCall is true.
assertThrowsSE("async function a() { super(); }");
assertThrowsSE("(async function() { super(); })");
assertThrowsSE("(async function a() { super(); })");
}
if (typeof reportCompare === "function")
reportCompare(true, true);
|