summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/fields/literal.js
blob: d8b46bd0a94dc594753024278b36a6b6d3f1a5f3 (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
load(libdir + "asserts.js");

source = `var y = {
    x;
}`;
assertErrorMessage(() => eval(source), SyntaxError, /./);

// This is legal, and is equivalent to `var y = { x: x };`
// source = `var y = {
//     x
// }`;
// assertThrowsInstanceOf(() => eval(source), SyntaxError);

source = `var y = {
    #x;
}`;
assertErrorMessage(() => eval(source), SyntaxError, /./);

source = `var y = {
    #x
}`;
assertThrowsInstanceOf(() => eval(source), SyntaxError);

source = `var y = {
    x = 2;
}`;
assertErrorMessage(() => eval(source), SyntaxError, /./);

source = `var y = {
    x = 2
}`;
assertErrorMessage(() => eval(source), SyntaxError, /./);

source = `var y = {
    #x = 2;
}`;
assertErrorMessage(() => eval(source), SyntaxError, /./);

source = `var y = {
    #x = 2
}`;
assertErrorMessage(() => eval(source), SyntaxError, /./);

if (typeof reportCompare === "function")
  reportCompare(true, true);