forked from facebook/hermes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiagnode_errors.js
More file actions
53 lines (43 loc) · 2.28 KB
/
diagnode_errors.js
File metadata and controls
53 lines (43 loc) · 2.28 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
* 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: (! %hermes -strict -dump-ir %s) 2>&1 | %FileCheck %s --match-full-lines
function one() { return s; return s; }
//CHECK: {{.*}}diagnode_errors.js:10:25: warning: the variable "s" was not declared in function "one"
//CHECK-NEXT: function one() { return s; return s; }
//CHECK-NEXT: ^
function two() { return s; return t;}
//CHECK: {{.*}}diagnode_errors.js:15:35: warning: the variable "t" was not declared in function "two"
//CHECK-NEXT: function two() { return s; return t;}
//CHECK-NEXT: ^
function three() { return z; return z;}
//CHECK: {{.*}}diagnode_errors.js:20:27: warning: the variable "z" was not declared in function "three"
//CHECK-NEXT: function three() { return z; return z;}
//CHECK-NEXT: ^
function four() { with({}) {}; }
//CHECK: {{.*}}diagnode_errors.js:25:19: error: invalid statement encountered.
//CHECK-NEXT: function four() { with({}) {}; }
//CHECK-NEXT: ^~~~~~~~~~~
(function () { return inAnonymous; })()
//CHECK: {{.*}}warning: the variable "inAnonymous" was not declared in anonymous function ""
//CHECK-NEXT: (function () { return inAnonymous; })()
//CHECK-NEXT: ^~~~~~~~~~~
(() => { return inAnonymousArrow; })()
//CHECK: {{.*}}warning: the variable "inAnonymousArrow" was not declared in anonymous arrow function " 1#"
//CHECK-NEXT: (() => { return inAnonymousArrow; })()
//CHECK-NEXT: ^~~~~~~~~~~~~~~~
var inferredName = () => { return i }; inferredName();
//CHECK: {{.*}}warning: the variable "i" was not declared in arrow function "inferredName"
//CHECK-NEXT: var inferredName = () => { return i }; inferredName();
//CHECK-NEXT: ^
//CHECK:{{.*}}warning: the property "color" was set multiple times in the object definition.
//CHECK-NEXT:var x = { color: 10, color: 20 };
//CHECK-NEXT: ^~
//CHECK-NEXT:{{.*}} warning: The first definition was here.
//CHECK-NEXT:var x = { color: 10, color: 20 };
//CHECK-NEXT: ^~~~~~~~~
var x = { color: 10, color: 20 };
//CHECK: Emitted 1 errors. exiting.