Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 57aa0a5

Browse files
JamesHenrynzakas
authored andcommittedOct 29, 2016
Chore: Added test for non-null assertion operator (refs #105) (#110)
1 parent d469064 commit 57aa0a5

File tree

2 files changed

+715
-0
lines changed

2 files changed

+715
-0
lines changed
 
Lines changed: 711 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,711 @@
1+
module.exports = {
2+
"type": "Program",
3+
"range": [
4+
0,
5+
82
6+
],
7+
"loc": {
8+
"start": {
9+
"line": 1,
10+
"column": 0
11+
},
12+
"end": {
13+
"line": 4,
14+
"column": 1
15+
}
16+
},
17+
"body": [
18+
{
19+
"type": "FunctionDeclaration",
20+
"range": [
21+
0,
22+
82
23+
],
24+
"loc": {
25+
"start": {
26+
"line": 1,
27+
"column": 0
28+
},
29+
"end": {
30+
"line": 4,
31+
"column": 1
32+
}
33+
},
34+
"id": {
35+
"type": "Identifier",
36+
"range": [
37+
9,
38+
22
39+
],
40+
"loc": {
41+
"start": {
42+
"line": 1,
43+
"column": 9
44+
},
45+
"end": {
46+
"line": 1,
47+
"column": 22
48+
}
49+
},
50+
"name": "processEntity"
51+
},
52+
"generator": false,
53+
"expression": false,
54+
"params": [
55+
{
56+
"type": "Identifier",
57+
"range": [
58+
23,
59+
24
60+
],
61+
"loc": {
62+
"start": {
63+
"line": 1,
64+
"column": 23
65+
},
66+
"end": {
67+
"line": 1,
68+
"column": 24
69+
}
70+
},
71+
"name": "e"
72+
}
73+
],
74+
"body": {
75+
"type": "BlockStatement",
76+
"range": [
77+
35,
78+
82
79+
],
80+
"loc": {
81+
"start": {
82+
"line": 1,
83+
"column": 35
84+
},
85+
"end": {
86+
"line": 4,
87+
"column": 1
88+
}
89+
},
90+
"body": [
91+
{
92+
"type": "ExpressionStatement",
93+
"range": [
94+
41,
95+
59
96+
],
97+
"loc": {
98+
"start": {
99+
"line": 2,
100+
"column": 4
101+
},
102+
"end": {
103+
"line": 2,
104+
"column": 22
105+
}
106+
},
107+
"expression": {
108+
"type": "CallExpression",
109+
"range": [
110+
41,
111+
58
112+
],
113+
"loc": {
114+
"start": {
115+
"line": 2,
116+
"column": 4
117+
},
118+
"end": {
119+
"line": 2,
120+
"column": 21
121+
}
122+
},
123+
"callee": {
124+
"type": "Identifier",
125+
"range": [
126+
41,
127+
55
128+
],
129+
"loc": {
130+
"start": {
131+
"line": 2,
132+
"column": 4
133+
},
134+
"end": {
135+
"line": 2,
136+
"column": 18
137+
}
138+
},
139+
"name": "validateEntity"
140+
},
141+
"arguments": [
142+
{
143+
"type": "Identifier",
144+
"range": [
145+
56,
146+
57
147+
],
148+
"loc": {
149+
"start": {
150+
"line": 2,
151+
"column": 19
152+
},
153+
"end": {
154+
"line": 2,
155+
"column": 20
156+
}
157+
},
158+
"name": "e"
159+
}
160+
]
161+
}
162+
},
163+
{
164+
"type": "VariableDeclaration",
165+
"range": [
166+
64,
167+
80
168+
],
169+
"loc": {
170+
"start": {
171+
"line": 3,
172+
"column": 4
173+
},
174+
"end": {
175+
"line": 3,
176+
"column": 20
177+
}
178+
},
179+
"declarations": [
180+
{
181+
"type": "VariableDeclarator",
182+
"range": [
183+
68,
184+
79
185+
],
186+
"loc": {
187+
"start": {
188+
"line": 3,
189+
"column": 8
190+
},
191+
"end": {
192+
"line": 3,
193+
"column": 19
194+
}
195+
},
196+
"id": {
197+
"type": "Identifier",
198+
"range": [
199+
68,
200+
69
201+
],
202+
"loc": {
203+
"start": {
204+
"line": 3,
205+
"column": 8
206+
},
207+
"end": {
208+
"line": 3,
209+
"column": 9
210+
}
211+
},
212+
"name": "s"
213+
},
214+
"init": {
215+
"type": "MemberExpression",
216+
"range": [
217+
72,
218+
79
219+
],
220+
"loc": {
221+
"start": {
222+
"line": 3,
223+
"column": 12
224+
},
225+
"end": {
226+
"line": 3,
227+
"column": 19
228+
}
229+
},
230+
"object": {
231+
"type": "TSNonNullExpression",
232+
"range": [
233+
72,
234+
74
235+
],
236+
"loc": {
237+
"start": {
238+
"line": 3,
239+
"column": 12
240+
},
241+
"end": {
242+
"line": 3,
243+
"column": 14
244+
}
245+
},
246+
"flags": 0,
247+
"expression": {
248+
"type": "Identifier",
249+
"range": [
250+
72,
251+
73
252+
],
253+
"loc": {
254+
"start": {
255+
"line": 3,
256+
"column": 12
257+
},
258+
"end": {
259+
"line": 3,
260+
"column": 13
261+
}
262+
},
263+
"name": "e"
264+
}
265+
},
266+
"property": {
267+
"type": "Identifier",
268+
"range": [
269+
75,
270+
79
271+
],
272+
"loc": {
273+
"start": {
274+
"line": 3,
275+
"column": 15
276+
},
277+
"end": {
278+
"line": 3,
279+
"column": 19
280+
}
281+
},
282+
"name": "name"
283+
},
284+
"computed": false
285+
}
286+
}
287+
],
288+
"kind": "let"
289+
}
290+
]
291+
}
292+
}
293+
],
294+
"sourceType": "script",
295+
"tokens": [
296+
{
297+
"type": "Keyword",
298+
"value": "function",
299+
"range": [
300+
0,
301+
8
302+
],
303+
"loc": {
304+
"start": {
305+
"line": 1,
306+
"column": 0
307+
},
308+
"end": {
309+
"line": 1,
310+
"column": 8
311+
}
312+
}
313+
},
314+
{
315+
"type": "Identifier",
316+
"value": "processEntity",
317+
"range": [
318+
9,
319+
22
320+
],
321+
"loc": {
322+
"start": {
323+
"line": 1,
324+
"column": 9
325+
},
326+
"end": {
327+
"line": 1,
328+
"column": 22
329+
}
330+
}
331+
},
332+
{
333+
"type": "Punctuator",
334+
"value": "(",
335+
"range": [
336+
22,
337+
23
338+
],
339+
"loc": {
340+
"start": {
341+
"line": 1,
342+
"column": 22
343+
},
344+
"end": {
345+
"line": 1,
346+
"column": 23
347+
}
348+
}
349+
},
350+
{
351+
"type": "Identifier",
352+
"value": "e",
353+
"range": [
354+
23,
355+
24
356+
],
357+
"loc": {
358+
"start": {
359+
"line": 1,
360+
"column": 23
361+
},
362+
"end": {
363+
"line": 1,
364+
"column": 24
365+
}
366+
}
367+
},
368+
{
369+
"type": "Punctuator",
370+
"value": "?",
371+
"range": [
372+
24,
373+
25
374+
],
375+
"loc": {
376+
"start": {
377+
"line": 1,
378+
"column": 24
379+
},
380+
"end": {
381+
"line": 1,
382+
"column": 25
383+
}
384+
}
385+
},
386+
{
387+
"type": "Punctuator",
388+
"value": ":",
389+
"range": [
390+
25,
391+
26
392+
],
393+
"loc": {
394+
"start": {
395+
"line": 1,
396+
"column": 25
397+
},
398+
"end": {
399+
"line": 1,
400+
"column": 26
401+
}
402+
}
403+
},
404+
{
405+
"type": "Identifier",
406+
"value": "Entity",
407+
"range": [
408+
27,
409+
33
410+
],
411+
"loc": {
412+
"start": {
413+
"line": 1,
414+
"column": 27
415+
},
416+
"end": {
417+
"line": 1,
418+
"column": 33
419+
}
420+
}
421+
},
422+
{
423+
"type": "Punctuator",
424+
"value": ")",
425+
"range": [
426+
33,
427+
34
428+
],
429+
"loc": {
430+
"start": {
431+
"line": 1,
432+
"column": 33
433+
},
434+
"end": {
435+
"line": 1,
436+
"column": 34
437+
}
438+
}
439+
},
440+
{
441+
"type": "Punctuator",
442+
"value": "{",
443+
"range": [
444+
35,
445+
36
446+
],
447+
"loc": {
448+
"start": {
449+
"line": 1,
450+
"column": 35
451+
},
452+
"end": {
453+
"line": 1,
454+
"column": 36
455+
}
456+
}
457+
},
458+
{
459+
"type": "Identifier",
460+
"value": "validateEntity",
461+
"range": [
462+
41,
463+
55
464+
],
465+
"loc": {
466+
"start": {
467+
"line": 2,
468+
"column": 4
469+
},
470+
"end": {
471+
"line": 2,
472+
"column": 18
473+
}
474+
}
475+
},
476+
{
477+
"type": "Punctuator",
478+
"value": "(",
479+
"range": [
480+
55,
481+
56
482+
],
483+
"loc": {
484+
"start": {
485+
"line": 2,
486+
"column": 18
487+
},
488+
"end": {
489+
"line": 2,
490+
"column": 19
491+
}
492+
}
493+
},
494+
{
495+
"type": "Identifier",
496+
"value": "e",
497+
"range": [
498+
56,
499+
57
500+
],
501+
"loc": {
502+
"start": {
503+
"line": 2,
504+
"column": 19
505+
},
506+
"end": {
507+
"line": 2,
508+
"column": 20
509+
}
510+
}
511+
},
512+
{
513+
"type": "Punctuator",
514+
"value": ")",
515+
"range": [
516+
57,
517+
58
518+
],
519+
"loc": {
520+
"start": {
521+
"line": 2,
522+
"column": 20
523+
},
524+
"end": {
525+
"line": 2,
526+
"column": 21
527+
}
528+
}
529+
},
530+
{
531+
"type": "Punctuator",
532+
"value": ";",
533+
"range": [
534+
58,
535+
59
536+
],
537+
"loc": {
538+
"start": {
539+
"line": 2,
540+
"column": 21
541+
},
542+
"end": {
543+
"line": 2,
544+
"column": 22
545+
}
546+
}
547+
},
548+
{
549+
"type": "Keyword",
550+
"value": "let",
551+
"range": [
552+
64,
553+
67
554+
],
555+
"loc": {
556+
"start": {
557+
"line": 3,
558+
"column": 4
559+
},
560+
"end": {
561+
"line": 3,
562+
"column": 7
563+
}
564+
}
565+
},
566+
{
567+
"type": "Identifier",
568+
"value": "s",
569+
"range": [
570+
68,
571+
69
572+
],
573+
"loc": {
574+
"start": {
575+
"line": 3,
576+
"column": 8
577+
},
578+
"end": {
579+
"line": 3,
580+
"column": 9
581+
}
582+
}
583+
},
584+
{
585+
"type": "Punctuator",
586+
"value": "=",
587+
"range": [
588+
70,
589+
71
590+
],
591+
"loc": {
592+
"start": {
593+
"line": 3,
594+
"column": 10
595+
},
596+
"end": {
597+
"line": 3,
598+
"column": 11
599+
}
600+
}
601+
},
602+
{
603+
"type": "Identifier",
604+
"value": "e",
605+
"range": [
606+
72,
607+
73
608+
],
609+
"loc": {
610+
"start": {
611+
"line": 3,
612+
"column": 12
613+
},
614+
"end": {
615+
"line": 3,
616+
"column": 13
617+
}
618+
}
619+
},
620+
{
621+
"type": "Punctuator",
622+
"value": "!",
623+
"range": [
624+
73,
625+
74
626+
],
627+
"loc": {
628+
"start": {
629+
"line": 3,
630+
"column": 13
631+
},
632+
"end": {
633+
"line": 3,
634+
"column": 14
635+
}
636+
}
637+
},
638+
{
639+
"type": "Punctuator",
640+
"value": ".",
641+
"range": [
642+
74,
643+
75
644+
],
645+
"loc": {
646+
"start": {
647+
"line": 3,
648+
"column": 14
649+
},
650+
"end": {
651+
"line": 3,
652+
"column": 15
653+
}
654+
}
655+
},
656+
{
657+
"type": "Identifier",
658+
"value": "name",
659+
"range": [
660+
75,
661+
79
662+
],
663+
"loc": {
664+
"start": {
665+
"line": 3,
666+
"column": 15
667+
},
668+
"end": {
669+
"line": 3,
670+
"column": 19
671+
}
672+
}
673+
},
674+
{
675+
"type": "Punctuator",
676+
"value": ";",
677+
"range": [
678+
79,
679+
80
680+
],
681+
"loc": {
682+
"start": {
683+
"line": 3,
684+
"column": 19
685+
},
686+
"end": {
687+
"line": 3,
688+
"column": 20
689+
}
690+
}
691+
},
692+
{
693+
"type": "Punctuator",
694+
"value": "}",
695+
"range": [
696+
81,
697+
82
698+
],
699+
"loc": {
700+
"start": {
701+
"line": 4,
702+
"column": 0
703+
},
704+
"end": {
705+
"line": 4,
706+
"column": 1
707+
}
708+
}
709+
}
710+
]
711+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
function processEntity(e?: Entity) {
2+
validateEntity(e);
3+
let s = e!.name;
4+
}

0 commit comments

Comments
 (0)
This repository has been archived.