@@ -14,7 +14,9 @@ if (a && b) {
1414bar ();
1515```
1616
17+ ::: img-container
1718![ Code Path Example] ( ../assets/images/code-path-analysis/helo.svg )
19+ :::
1820
1921## Objects
2022
@@ -143,17 +145,23 @@ bar();
143145
1441461 . First, the analysis advances to the end of loop.
145147
148+ ::: img-container
146149 ![ Loop Event's Example 1] ( ../assets/images/code-path-analysis/loop-event-example-while-1.svg )
150+ :::
147151
1481522 . Second, it creates the looping path.
149153 At this time, the next segment has existed already, so the ` onCodePathSegmentStart ` event is not fired.
150154 It fires ` onCodePathSegmentLoop ` instead.
151155
156+ ::: img-container
152157 ![ Loop Event's Example 2] ( ../assets/images/code-path-analysis/loop-event-example-while-2.svg )
158+ :::
153159
1541603 . Last, it advances to the end.
155161
162+ ::: img-container
156163 ![ Loop Event's Example 3] ( ../assets/images/code-path-analysis/loop-event-example-while-3.svg )
164+ :::
157165
158166For example 2:
159167
@@ -168,29 +176,39 @@ bar();
168176 First, the analysis advances to ` ForStatement.update ` .
169177 The ` update ` segment is hovered at first.
170178
179+ ::: img-container
171180 ![ Loop Event's Example 1] ( ../assets/images/code-path-analysis/loop-event-example-for-1.svg )
181+ :::
172182
1731832 . Second, it advances to ` ForStatement.body ` .
174184 Of course the ` body ` segment is preceded by the ` test ` segment.
175185 It keeps the ` update ` segment hovering.
176186
187+ ::: img-container
177188 ![ Loop Event's Example 2] ( ../assets/images/code-path-analysis/loop-event-example-for-2.svg )
189+ :::
178190
1791913 . Third, it creates the looping path from ` body ` segment to ` update ` segment.
180192 At this time, the next segment has existed already, so the ` onCodePathSegmentStart ` event is not fired.
181193 It fires ` onCodePathSegmentLoop ` instead.
182194
195+ ::: img-container
183196 ![ Loop Event's Example 3] ( ../assets/images/code-path-analysis/loop-event-example-for-3.svg )
197+ :::
184198
1851994 . Fourth, also it creates the looping path from ` update ` segment to ` test ` segment.
186200 At this time, the next segment has existed already, so the ` onCodePathSegmentStart ` event is not fired.
187201 It fires ` onCodePathSegmentLoop ` instead.
188202
203+ ::: img-container
189204 ![ Loop Event's Example 4] ( ../assets/images/code-path-analysis/loop-event-example-for-4.svg )
205+ :::
190206
1912075 . Last, it advances to the end.
192208
209+ ::: img-container
193210 ![ Loop Event's Example 5] ( ../assets/images/code-path-analysis/loop-event-example-for-5.svg )
211+ :::
194212
195213## Usage Examples
196214
@@ -336,7 +354,9 @@ See Also:
336354console .log (" Hello world!" );
337355```
338356
357+ ::: img-container
339358![ Hello World] ( ../assets/images/code-path-analysis/example-hello-world.svg )
359+ :::
340360
341361### ` IfStatement `
342362
@@ -348,7 +368,9 @@ if (a) {
348368}
349369```
350370
371+ ::: img-container
351372![ ` IfStatement ` ] ( ../assets/images/code-path-analysis/example-ifstatement.svg )
373+ :::
352374
353375### ` IfStatement ` (chain)
354376
@@ -362,7 +384,9 @@ if (a) {
362384}
363385```
364386
387+ ::: img-container
365388![ ` IfStatement ` (chain)] ( ../assets/images/code-path-analysis/example-ifstatement-chain.svg )
389+ :::
366390
367391### ` SwitchStatement `
368392
@@ -383,7 +407,9 @@ switch (a) {
383407}
384408```
385409
410+ ::: img-container
386411![ ` SwitchStatement ` ] ( ../assets/images/code-path-analysis/example-switchstatement.svg )
412+ :::
387413
388414### ` SwitchStatement ` (has ` default ` )
389415
@@ -408,7 +434,9 @@ switch (a) {
408434}
409435```
410436
437+ ::: img-container
411438![ ` SwitchStatement ` (has ` default ` )] ( ../assets/images/code-path-analysis/example-switchstatement-has-default.svg )
439+ :::
412440
413441### ` TryStatement ` (try-catch)
414442
@@ -431,7 +459,9 @@ It creates the paths from `try` block to `catch` block at:
431459* The first throwable node (e.g. a function call) in the ` try ` block.
432460* The end of the ` try ` block.
433461
462+ ::: img-container
434463![ ` TryStatement ` (try-catch)] ( ../assets/images/code-path-analysis/example-trystatement-try-catch.svg )
464+ :::
435465
436466### ` TryStatement ` (try-finally)
437467
@@ -449,7 +479,9 @@ If there is not `catch` block, `finally` block has two current segments.
449479At this time, ` CodePath.currentSegments.length ` is ` 2 ` .
450480One is the normal path, and another is the leaving path (` throw ` or ` return ` ).
451481
482+ ::: img-container
452483![ ` TryStatement ` (try-finally)] ( ../assets/images/code-path-analysis/example-trystatement-try-finally.svg )
484+ :::
453485
454486### ` TryStatement ` (try-catch-finally)
455487
@@ -465,7 +497,9 @@ try {
465497last ();
466498```
467499
500+ ::: img-container
468501![ ` TryStatement ` (try-catch-finally)] ( ../assets/images/code-path-analysis/example-trystatement-try-catch-finally.svg )
502+ :::
469503
470504### ` WhileStatement `
471505
@@ -479,7 +513,9 @@ while (a) {
479513}
480514```
481515
516+ ::: img-container
482517![ ` WhileStatement ` ] ( ../assets/images/code-path-analysis/example-whilestatement.svg )
518+ :::
483519
484520### ` DoWhileStatement `
485521
490526} while (a);
491527```
492528
529+ ::: img-container
493530![ ` DoWhileStatement ` ] ( ../assets/images/code-path-analysis/example-dowhilestatement.svg )
531+ :::
494532
495533### ` ForStatement `
496534
@@ -504,7 +542,9 @@ for (let i = 0; i < 10; ++i) {
504542}
505543```
506544
545+ ::: img-container
507546![ ` ForStatement ` ] ( ../assets/images/code-path-analysis/example-forstatement.svg )
547+ :::
508548
509549### ` ForStatement ` (for ever)
510550
@@ -515,7 +555,9 @@ for (;;) {
515555bar ();
516556```
517557
558+ ::: img-container
518559![ ` ForStatement ` (for ever)] ( ../assets/images/code-path-analysis/example-forstatement-for-ever.svg )
560+ :::
519561
520562### ` ForInStatement `
521563
@@ -525,7 +567,9 @@ for (let key in obj) {
525567}
526568```
527569
570+ ::: img-container
528571![ ` ForInStatement ` ] ( ../assets/images/code-path-analysis/example-forinstatement.svg )
572+ :::
529573
530574### When there is a function
531575
@@ -544,8 +588,12 @@ It creates two code paths.
544588
545589* The global's
546590
591+ ::: img-container
547592 ![ When there is a function] ( ../assets/images/code-path-analysis/example-when-there-is-a-function-g.svg )
593+ :::
548594
549595* The function's
550596
597+ ::: img-container
551598 ![ When there is a function] ( ../assets/images/code-path-analysis/example-when-there-is-a-function-f.svg )
599+ :::
0 commit comments