@@ -247,40 +247,40 @@ function processScope(options, ctx, scope) {
247247 ctx .appendIndent ().appendText (" {\n " ).indent ()
248248 ctx .appendIndent ().appendText (` "type": "${ scope .type } ",\n ` )
249249 ctx .appendIndent ().appendText (` "variables": [\n ` ).indent ()
250- for ( const variable of scope .variables ) {
250+ scope .variables . forEach (( variable , index ) => {
251251 processVariable (options, ctx, variable)
252- if (scope .variables [ scope . variables . length - 1 ] !== variable ) {
252+ if (scope .variables . length - 1 !== index ) {
253253 ctx .appendText (" ," )
254254 }
255255 ctx .appendText (" \n " )
256- }
256+ })
257257 ctx .outdent ().appendIndent ().appendText (` ],\n ` )
258258 ctx .appendIndent ().appendText (` "references": [\n ` ).indent ()
259- for ( const reference of scope .references ) {
259+ scope .references . forEach (( reference , index ) => {
260260 processReference (options, ctx, reference)
261- if (scope .references [ scope . references . length - 1 ] !== reference ) {
261+ if (scope .references . length - 1 !== index ) {
262262 ctx .appendText (" ," )
263263 }
264264 ctx .appendText (" \n " )
265- }
265+ })
266266 ctx .outdent ().appendIndent ().appendText (` ],\n ` )
267267 ctx .appendIndent ().appendText (` "childScopes": [\n ` ).indent ()
268- for ( const childScope of scope .childScopes ) {
268+ scope .childScopes . forEach (( childScope , index ) => {
269269 processScope (options, ctx, childScope)
270- if (scope .childScopes [ scope . childScopes . length - 1 ] !== childScope ) {
270+ if (scope .childScopes . length - 1 !== index ) {
271271 ctx .appendText (" ," )
272272 }
273273 ctx .appendText (" \n " )
274- }
274+ })
275275 ctx .outdent ().appendIndent ().appendText (` ],\n ` )
276276 ctx .appendIndent ().appendText (` "through": [\n ` ).indent ()
277- for ( const through of scope .through ) {
277+ scope .through . forEach (( through , index ) => {
278278 processReference (options, ctx, through)
279- if (scope .through [ scope . through . length - 1 ] !== through ) {
279+ if (scope .through . length - 1 !== index ) {
280280 ctx .appendText (" ," )
281281 }
282282 ctx .appendText (" \n " )
283- }
283+ })
284284 ctx .outdent ().appendIndent ().appendText (` ]\n ` )
285285 ctx .outdent ().appendIndent ().appendText (" }" )
286286}
@@ -294,35 +294,33 @@ function processVariable(options, ctx, variable) {
294294 ctx .appendIndent ().appendText (" {\n " ).indent ()
295295 ctx .appendIndent ().appendText (` "name": "${ variable .name } ",\n ` )
296296 ctx .appendIndent ().appendText (` "identifiers": [\n ` ).indent ()
297- for ( const identifier of variable .identifiers ) {
297+ variable .identifiers . forEach (( identifier , index ) => {
298298 ctx .appendIndent ()
299299 processJsonValue (options, ctx, identifier)
300- if (
301- variable .identifiers [variable .identifiers .length - 1 ] !== identifier
302- ) {
300+ if (variable .identifiers .length - 1 !== index) {
303301 ctx .appendText (" ," )
304302 }
305303 ctx .appendText (" \n " )
306- }
304+ })
307305 ctx .outdent ().appendIndent ().appendText (` ],\n ` )
308306 ctx .appendIndent ().appendText (` "defs": [\n ` ).indent ()
309- for ( const def of variable .defs ) {
307+ variable .defs . forEach (( def , index ) => {
310308 ctx .appendIndent ()
311309 processJsonValue (options, ctx, def)
312- if (variable .defs [ variable . defs . length - 1 ] !== def ) {
310+ if (variable .defs . length - 1 !== index ) {
313311 ctx .appendText (" ," )
314312 }
315313 ctx .appendText (" \n " )
316- }
314+ })
317315 ctx .outdent ().appendIndent ().appendText (` ],\n ` )
318316 ctx .appendIndent ().appendText (` "references": [\n ` ).indent ()
319- for ( const reference of variable .references ) {
317+ variable .references . forEach (( reference , index ) => {
320318 processReference (options, ctx, reference)
321- if (variable .references [ variable . references . length - 1 ] !== reference ) {
319+ if (variable .references . length - 1 !== index ) {
322320 ctx .appendText (" ," )
323321 }
324322 ctx .appendText (" \n " )
325- }
323+ })
326324 ctx .outdent ().appendIndent ().appendText (` ]\n ` )
327325 ctx .outdent ().appendIndent ().appendText (" }" )
328326}
0 commit comments