File: checkObjectDefineProperty.symbols

package info (click to toggle)
node-typescript 5.0.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 459,140 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (203 lines) | stat: -rw-r--r-- 9,500 bytes parent folder | download | duplicates (3)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
=== tests/cases/conformance/jsdoc/validate.ts ===
// Validate in TS as simple validations would usually be interpreted as more special assignments
import x = require("./");
>x : Symbol(x, Decl(validate.ts, 0, 0))

x.name;
>x.name : Symbol(x.name, Decl(index.js, 0, 13))
>x : Symbol(x, Decl(validate.ts, 0, 0))
>name : Symbol(x.name, Decl(index.js, 0, 13))

x.middleInit;
>x.middleInit : Symbol(x.middleInit, Decl(index.js, 1, 71))
>x : Symbol(x, Decl(validate.ts, 0, 0))
>middleInit : Symbol(x.middleInit, Decl(index.js, 1, 71))

x.lastName;
>x.lastName : Symbol(x.lastName, Decl(index.js, 2, 55))
>x : Symbol(x, Decl(validate.ts, 0, 0))
>lastName : Symbol(x.lastName, Decl(index.js, 2, 55))

x.zip;
>x.zip : Symbol(x.zip, Decl(index.js, 3, 74))
>x : Symbol(x, Decl(validate.ts, 0, 0))
>zip : Symbol(x.zip, Decl(index.js, 3, 74))

x.houseNumber;
>x.houseNumber : Symbol(x.houseNumber, Decl(index.js, 4, 83))
>x : Symbol(x, Decl(validate.ts, 0, 0))
>houseNumber : Symbol(x.houseNumber, Decl(index.js, 4, 83))

x.zipStr;
>x.zipStr : Symbol(x.zipStr, Decl(index.js, 5, 68))
>x : Symbol(x, Decl(validate.ts, 0, 0))
>zipStr : Symbol(x.zipStr, Decl(index.js, 5, 68))

x.name = "Another";
>x.name : Symbol(x.name, Decl(index.js, 0, 13))
>x : Symbol(x, Decl(validate.ts, 0, 0))
>name : Symbol(x.name, Decl(index.js, 0, 13))

x.zip = 98123;
>x.zip : Symbol(x.zip, Decl(index.js, 3, 74))
>x : Symbol(x, Decl(validate.ts, 0, 0))
>zip : Symbol(x.zip, Decl(index.js, 3, 74))

x.zipStr = "OK";
>x.zipStr : Symbol(x.zipStr, Decl(index.js, 5, 68))
>x : Symbol(x, Decl(validate.ts, 0, 0))
>zipStr : Symbol(x.zipStr, Decl(index.js, 5, 68))

x.lastName = "should fail";
>x.lastName : Symbol(x.lastName, Decl(index.js, 2, 55))
>x : Symbol(x, Decl(validate.ts, 0, 0))
>lastName : Symbol(x.lastName, Decl(index.js, 2, 55))

x.houseNumber = 12; // should also fail
>x.houseNumber : Symbol(x.houseNumber, Decl(index.js, 4, 83))
>x : Symbol(x, Decl(validate.ts, 0, 0))
>houseNumber : Symbol(x.houseNumber, Decl(index.js, 4, 83))

x.zipStr = 12; // should fail
>x.zipStr : Symbol(x.zipStr, Decl(index.js, 5, 68))
>x : Symbol(x, Decl(validate.ts, 0, 0))
>zipStr : Symbol(x.zipStr, Decl(index.js, 5, 68))

x.middleInit = "R"; // should also fail
>x.middleInit : Symbol(x.middleInit, Decl(index.js, 1, 71))
>x : Symbol(x, Decl(validate.ts, 0, 0))
>middleInit : Symbol(x.middleInit, Decl(index.js, 1, 71))

=== tests/cases/conformance/jsdoc/index.js ===
const x = {};
>x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more)

Object.defineProperty(x, "name", { value: "Charles", writable: true });
>Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --))
>x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more)
>"name" : Symbol(x.name, Decl(index.js, 0, 13))
>value : Symbol(value, Decl(index.js, 1, 34))
>writable : Symbol(writable, Decl(index.js, 1, 52))

Object.defineProperty(x, "middleInit", { value: "H" });
>Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --))
>x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more)
>"middleInit" : Symbol(x.middleInit, Decl(index.js, 1, 71))
>value : Symbol(value, Decl(index.js, 2, 40))

Object.defineProperty(x, "lastName", { value: "Smith", writable: false });
>Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --))
>x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more)
>"lastName" : Symbol(x.lastName, Decl(index.js, 2, 55))
>value : Symbol(value, Decl(index.js, 3, 38))
>writable : Symbol(writable, Decl(index.js, 3, 54))

Object.defineProperty(x, "zip", { get() { return 98122 }, set(_) { /*ignore*/ } });
>Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --))
>x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more)
>"zip" : Symbol(x.zip, Decl(index.js, 3, 74))
>get : Symbol(get, Decl(index.js, 4, 33))
>set : Symbol(set, Decl(index.js, 4, 57))
>_ : Symbol(_, Decl(index.js, 4, 62))

Object.defineProperty(x, "houseNumber", { get() { return 21.75 } });
>Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --))
>x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more)
>"houseNumber" : Symbol(x.houseNumber, Decl(index.js, 4, 83))
>get : Symbol(get, Decl(index.js, 5, 41))

Object.defineProperty(x, "zipStr", {
>Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --))
>x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more)
>"zipStr" : Symbol(x.zipStr, Decl(index.js, 5, 68))

    /** @param {string} str */
    set(str) {
>set : Symbol(set, Decl(index.js, 6, 36))
>str : Symbol(str, Decl(index.js, 8, 8))

        this.zip = Number(str) 
>zip : Symbol(zip, Decl(index.js, 8, 14))
>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>str : Symbol(str, Decl(index.js, 8, 8))
    }
});

/**
 * @param {{name: string}} named
 */
function takeName(named) { return named.name; }
>takeName : Symbol(takeName, Decl(index.js, 11, 3))
>named : Symbol(named, Decl(index.js, 16, 18))
>named.name : Symbol(name, Decl(index.js, 14, 12))
>named : Symbol(named, Decl(index.js, 16, 18))
>name : Symbol(name, Decl(index.js, 14, 12))

takeName(x);
>takeName : Symbol(takeName, Decl(index.js, 11, 3))
>x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more)

/**
 * @type {number}
 */
var a = x.zip;
>a : Symbol(a, Decl(index.js, 22, 3))
>x.zip : Symbol(x.zip, Decl(index.js, 3, 74))
>x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more)
>zip : Symbol(x.zip, Decl(index.js, 3, 74))

/**
 * @type {number}
 */
var b = x.houseNumber;
>b : Symbol(b, Decl(index.js, 27, 3))
>x.houseNumber : Symbol(x.houseNumber, Decl(index.js, 4, 83))
>x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more)
>houseNumber : Symbol(x.houseNumber, Decl(index.js, 4, 83))

const returnExemplar = () => x;
>returnExemplar : Symbol(returnExemplar, Decl(index.js, 29, 5))
>x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more)

const needsExemplar = (_ = x) => void 0;
>needsExemplar : Symbol(needsExemplar, Decl(index.js, 30, 5))
>_ : Symbol(_, Decl(index.js, 30, 23))
>x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more)

const expected = /** @type {{name: string, readonly middleInit: string, readonly lastName: string, zip: number, readonly houseNumber: number, zipStr: string}} */(/** @type {*} */(null));
>expected : Symbol(expected, Decl(index.js, 32, 5))

/**
 * 
 * @param {typeof returnExemplar} a 
 * @param {typeof needsExemplar} b 
 */
function match(a, b) {}
>match : Symbol(match, Decl(index.js, 32, 186))
>a : Symbol(a, Decl(index.js, 39, 15))
>b : Symbol(b, Decl(index.js, 39, 17))

match(() => expected, (x = expected) => void 0);
>match : Symbol(match, Decl(index.js, 32, 186))
>expected : Symbol(expected, Decl(index.js, 32, 5))
>x : Symbol(x, Decl(index.js, 41, 23))
>expected : Symbol(expected, Decl(index.js, 32, 5))

module.exports = x;
>module.exports : Symbol(module.exports, Decl(index.js, 0, 0))
>module : Symbol(export=, Decl(index.js, 41, 48))
>exports : Symbol(export=, Decl(index.js, 41, 48))
>x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more)