@@ -247,40 +247,40 @@ function processScope(options, ctx, scope) {
247
247
ctx .appendIndent ().appendText (" {\n " ).indent ()
248
248
ctx .appendIndent ().appendText (` "type": "${ scope .type } ",\n ` )
249
249
ctx .appendIndent ().appendText (` "variables": [\n ` ).indent ()
250
- for ( const variable of scope .variables ) {
250
+ scope .variables . forEach (( variable , index ) => {
251
251
processVariable (options, ctx, variable)
252
- if (scope .variables [ scope . variables . length - 1 ] !== variable ) {
252
+ if (scope .variables . length - 1 !== index ) {
253
253
ctx .appendText (" ," )
254
254
}
255
255
ctx .appendText (" \n " )
256
- }
256
+ })
257
257
ctx .outdent ().appendIndent ().appendText (` ],\n ` )
258
258
ctx .appendIndent ().appendText (` "references": [\n ` ).indent ()
259
- for ( const reference of scope .references ) {
259
+ scope .references . forEach (( reference , index ) => {
260
260
processReference (options, ctx, reference)
261
- if (scope .references [ scope . references . length - 1 ] !== reference ) {
261
+ if (scope .references . length - 1 !== index ) {
262
262
ctx .appendText (" ," )
263
263
}
264
264
ctx .appendText (" \n " )
265
- }
265
+ })
266
266
ctx .outdent ().appendIndent ().appendText (` ],\n ` )
267
267
ctx .appendIndent ().appendText (` "childScopes": [\n ` ).indent ()
268
- for ( const childScope of scope .childScopes ) {
268
+ scope .childScopes . forEach (( childScope , index ) => {
269
269
processScope (options, ctx, childScope)
270
- if (scope .childScopes [ scope . childScopes . length - 1 ] !== childScope ) {
270
+ if (scope .childScopes . length - 1 !== index ) {
271
271
ctx .appendText (" ," )
272
272
}
273
273
ctx .appendText (" \n " )
274
- }
274
+ })
275
275
ctx .outdent ().appendIndent ().appendText (` ],\n ` )
276
276
ctx .appendIndent ().appendText (` "through": [\n ` ).indent ()
277
- for ( const through of scope .through ) {
277
+ scope .through . forEach (( through , index ) => {
278
278
processReference (options, ctx, through)
279
- if (scope .through [ scope . through . length - 1 ] !== through ) {
279
+ if (scope .through . length - 1 !== index ) {
280
280
ctx .appendText (" ," )
281
281
}
282
282
ctx .appendText (" \n " )
283
- }
283
+ })
284
284
ctx .outdent ().appendIndent ().appendText (` ]\n ` )
285
285
ctx .outdent ().appendIndent ().appendText (" }" )
286
286
}
@@ -294,35 +294,33 @@ function processVariable(options, ctx, variable) {
294
294
ctx .appendIndent ().appendText (" {\n " ).indent ()
295
295
ctx .appendIndent ().appendText (` "name": "${ variable .name } ",\n ` )
296
296
ctx .appendIndent ().appendText (` "identifiers": [\n ` ).indent ()
297
- for ( const identifier of variable .identifiers ) {
297
+ variable .identifiers . forEach (( identifier , index ) => {
298
298
ctx .appendIndent ()
299
299
processJsonValue (options, ctx, identifier)
300
- if (
301
- variable .identifiers [variable .identifiers .length - 1 ] !== identifier
302
- ) {
300
+ if (variable .identifiers .length - 1 !== index) {
303
301
ctx .appendText (" ," )
304
302
}
305
303
ctx .appendText (" \n " )
306
- }
304
+ })
307
305
ctx .outdent ().appendIndent ().appendText (` ],\n ` )
308
306
ctx .appendIndent ().appendText (` "defs": [\n ` ).indent ()
309
- for ( const def of variable .defs ) {
307
+ variable .defs . forEach (( def , index ) => {
310
308
ctx .appendIndent ()
311
309
processJsonValue (options, ctx, def)
312
- if (variable .defs [ variable . defs . length - 1 ] !== def ) {
310
+ if (variable .defs . length - 1 !== index ) {
313
311
ctx .appendText (" ," )
314
312
}
315
313
ctx .appendText (" \n " )
316
- }
314
+ })
317
315
ctx .outdent ().appendIndent ().appendText (` ],\n ` )
318
316
ctx .appendIndent ().appendText (` "references": [\n ` ).indent ()
319
- for ( const reference of variable .references ) {
317
+ variable .references . forEach (( reference , index ) => {
320
318
processReference (options, ctx, reference)
321
- if (variable .references [ variable . references . length - 1 ] !== reference ) {
319
+ if (variable .references . length - 1 !== index ) {
322
320
ctx .appendText (" ," )
323
321
}
324
322
ctx .appendText (" \n " )
325
- }
323
+ })
326
324
ctx .outdent ().appendIndent ().appendText (` ]\n ` )
327
325
ctx .outdent ().appendIndent ().appendText (" }" )
328
326
}
0 commit comments