]> git.proxmox.com Git - pve-eslint.git/blob - eslint/tests/fixtures/parsers/type-annotations/function-return-type-annotation.js
first commit
[pve-eslint.git] / eslint / tests / fixtures / parsers / type-annotations / function-return-type-annotation.js
1 /**
2 * Source code:
3 * function foo(): Bar { }
4 */
5
6 exports.parse = () => ({
7 "type": "Program",
8 "range": [
9 0,
10 23
11 ],
12 "loc": {
13 "start": {
14 "line": 1,
15 "column": 0
16 },
17 "end": {
18 "line": 1,
19 "column": 23
20 }
21 },
22 "body": [
23 {
24 "type": "FunctionDeclaration",
25 "range": [
26 0,
27 23
28 ],
29 "loc": {
30 "start": {
31 "line": 1,
32 "column": 0
33 },
34 "end": {
35 "line": 1,
36 "column": 23
37 }
38 },
39 "id": {
40 "type": "Identifier",
41 "range": [
42 9,
43 12
44 ],
45 "loc": {
46 "start": {
47 "line": 1,
48 "column": 9
49 },
50 "end": {
51 "line": 1,
52 "column": 12
53 }
54 },
55 "name": "foo"
56 },
57 "generator": false,
58 "expression": false,
59 "async": false,
60 "params": [],
61 "body": {
62 "type": "BlockStatement",
63 "range": [
64 20,
65 23
66 ],
67 "loc": {
68 "start": {
69 "line": 1,
70 "column": 20
71 },
72 "end": {
73 "line": 1,
74 "column": 23
75 }
76 },
77 "body": []
78 },
79 "returnType": {
80 "type": "TypeAnnotation",
81 "loc": {
82 "start": {
83 "line": 1,
84 "column": 16
85 },
86 "end": {
87 "line": 1,
88 "column": 19
89 }
90 },
91 "range": [
92 16,
93 19
94 ],
95 "typeAnnotation": {
96 "type": "TypeReference",
97 "range": [
98 16,
99 19
100 ],
101 "loc": {
102 "start": {
103 "line": 1,
104 "column": 16
105 },
106 "end": {
107 "line": 1,
108 "column": 19
109 }
110 },
111 "typeName": {
112 "type": "Identifier",
113 "range": [
114 16,
115 19
116 ],
117 "loc": {
118 "start": {
119 "line": 1,
120 "column": 16
121 },
122 "end": {
123 "line": 1,
124 "column": 19
125 }
126 },
127 "name": "Bar"
128 }
129 }
130 }
131 }
132 ],
133 "sourceType": "script",
134 "tokens": [
135 {
136 "type": "Keyword",
137 "value": "function",
138 "start": 0,
139 "end": 8,
140 "range": [
141 0,
142 8
143 ],
144 "loc": {
145 "start": {
146 "line": 1,
147 "column": 0
148 },
149 "end": {
150 "line": 1,
151 "column": 8
152 }
153 }
154 },
155 {
156 "type": "Identifier",
157 "value": "foo",
158 "start": 9,
159 "end": 12,
160 "range": [
161 9,
162 12
163 ],
164 "loc": {
165 "start": {
166 "line": 1,
167 "column": 9
168 },
169 "end": {
170 "line": 1,
171 "column": 12
172 }
173 }
174 },
175 {
176 "type": "Punctuator",
177 "value": "(",
178 "start": 12,
179 "end": 13,
180 "range": [
181 12,
182 13
183 ],
184 "loc": {
185 "start": {
186 "line": 1,
187 "column": 12
188 },
189 "end": {
190 "line": 1,
191 "column": 13
192 }
193 }
194 },
195 {
196 "type": "Punctuator",
197 "value": ")",
198 "start": 13,
199 "end": 14,
200 "range": [
201 13,
202 14
203 ],
204 "loc": {
205 "start": {
206 "line": 1,
207 "column": 13
208 },
209 "end": {
210 "line": 1,
211 "column": 14
212 }
213 }
214 },
215 {
216 "type": "Punctuator",
217 "value": ":",
218 "start": 14,
219 "end": 15,
220 "range": [
221 14,
222 15
223 ],
224 "loc": {
225 "start": {
226 "line": 1,
227 "column": 14
228 },
229 "end": {
230 "line": 1,
231 "column": 15
232 }
233 }
234 },
235 {
236 "type": "Identifier",
237 "value": "Bar",
238 "start": 16,
239 "end": 19,
240 "range": [
241 16,
242 19
243 ],
244 "loc": {
245 "start": {
246 "line": 1,
247 "column": 16
248 },
249 "end": {
250 "line": 1,
251 "column": 19
252 }
253 }
254 },
255 {
256 "type": "Punctuator",
257 "value": "{",
258 "start": 20,
259 "end": 21,
260 "range": [
261 20,
262 21
263 ],
264 "loc": {
265 "start": {
266 "line": 1,
267 "column": 20
268 },
269 "end": {
270 "line": 1,
271 "column": 21
272 }
273 }
274 },
275 {
276 "type": "Punctuator",
277 "value": "}",
278 "start": 22,
279 "end": 23,
280 "range": [
281 22,
282 23
283 ],
284 "loc": {
285 "start": {
286 "line": 1,
287 "column": 22
288 },
289 "end": {
290 "line": 1,
291 "column": 23
292 }
293 }
294 }
295 ],
296 "comments": []
297 });