forked from facebook/hermes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfor-error.js
More file actions
28 lines (23 loc) · 1 KB
/
for-error.js
File metadata and controls
28 lines (23 loc) · 1 KB
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
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// RUN: (! %hermesc -dump-ast -pretty-json %s 2>&1 ) | %FileCheck --match-full-lines %s
for (;false;) function foo() {}
// CHECK: {{.*}}:10:15: error: declaration not allowed as expression statement
// CHECK: for (;false;) function foo() {}
// CHECK: ^~~~~~~~
for (;false;) class bar {}
// CHECK: {{.*}}:15:15: error: declaration not allowed as expression statement
// CHECK: for (;false;) class bar {}
// CHECK: ^~~~~
for (;false;) let [x] = 3;
// CHECK: {{.*}}:20:15: error: ambiguous 'let [': either a 'let' binding or a member expression
// CHECK: for (;false;) let [x] = 3;
// CHECK: ^~~~~
for (;false;) async function foo() {}
// CHECK: {{.*}}:25:15: error: declaration not allowed as expression statement
// CHECK: for (;false;) async function foo() {}
// CHECK: ^~~~~