@@ -1146,9 +1146,9 @@ exports.composeAttributes = (att1, att2, resultIsMutation, pool) => {
1146
1146
} ) ;
1147
1147
atts . sort ( ) ;
1148
1148
const buf = exports . stringAssembler ( ) ;
1149
- for ( let i = 0 ; i < atts . length ; i ++ ) {
1149
+ for ( const att of atts ) {
1150
1150
buf . append ( '*' ) ;
1151
- buf . append ( exports . numToString ( pool . putAttrib ( atts [ i ] ) ) ) ;
1151
+ buf . append ( exports . numToString ( pool . putAttrib ( att ) ) ) ;
1152
1152
}
1153
1153
return buf . toString ( ) ;
1154
1154
} ;
@@ -1306,8 +1306,7 @@ exports.mutateAttributionLines = (cs, lines, pool) => {
1306
1306
*/
1307
1307
exports . joinAttributionLines = ( theAlines ) => {
1308
1308
const assem = exports . mergingOpAssembler ( ) ;
1309
- for ( let i = 0 ; i < theAlines . length ; i ++ ) {
1310
- const aline = theAlines [ i ] ;
1309
+ for ( const aline of theAlines ) {
1311
1310
const iter = exports . opIterator ( aline ) ;
1312
1311
while ( iter . hasNext ( ) ) {
1313
1312
assem . append ( iter . next ( ) ) ;
@@ -1507,10 +1506,8 @@ const toSplices = (cs) => {
1507
1506
exports . characterRangeFollow = ( cs , startChar , endChar , insertionsAfter ) => {
1508
1507
let newStartChar = startChar ;
1509
1508
let newEndChar = endChar ;
1510
- const splices = toSplices ( cs ) ;
1511
1509
let lengthChangeSoFar = 0 ;
1512
- for ( let i = 0 ; i < splices . length ; i ++ ) {
1513
- const splice = splices [ i ] ;
1510
+ for ( const splice of toSplices ( cs ) ) {
1514
1511
const spliceStart = splice [ 0 ] + lengthChangeSoFar ;
1515
1512
const spliceEnd = splice [ 1 ] + lengthChangeSoFar ;
1516
1513
const newTextLength = splice [ 2 ] . length ;
@@ -1906,8 +1903,7 @@ exports.makeAttribsString = (opcode, attribs, pool) => {
1906
1903
attribs . sort ( ) ;
1907
1904
}
1908
1905
const result = [ ] ;
1909
- for ( let i = 0 ; i < attribs . length ; i ++ ) {
1910
- const pair = attribs [ i ] ;
1906
+ for ( const pair of attribs ) {
1911
1907
if ( opcode === '=' || ( opcode === '+' && pair [ 1 ] ) ) {
1912
1908
result . push ( `*${ exports . numToString ( pool . putAttrib ( pair ) ) } ` ) ;
1913
1909
}
@@ -2072,23 +2068,15 @@ exports.inverse = (cs, lines, alines, pool) => {
2072
2068
} ;
2073
2069
} ;
2074
2070
2075
- const attribKeys = [ ] ;
2076
- const attribValues = [ ] ;
2077
2071
while ( csIter . hasNext ( ) ) {
2078
2072
const csOp = csIter . next ( ) ;
2079
2073
if ( csOp . opcode === '=' ) {
2080
2074
if ( csOp . attribs ) {
2081
- attribKeys . length = 0 ;
2082
- attribValues . length = 0 ;
2083
- exports . eachAttribNumber ( csOp . attribs , ( n ) => {
2084
- attribKeys . push ( pool . getAttribKey ( n ) ) ;
2085
- attribValues . push ( pool . getAttribValue ( n ) ) ;
2086
- } ) ;
2075
+ const csAttribs = [ ] ;
2076
+ exports . eachAttribNumber ( csOp . attribs , ( n ) => csAttribs . push ( pool . getAttrib ( n ) ) ) ;
2087
2077
const undoBackToAttribs = cachedStrFunc ( ( attribs ) => {
2088
2078
const backAttribs = [ ] ;
2089
- for ( let i = 0 ; i < attribKeys . length ; i ++ ) {
2090
- const appliedKey = attribKeys [ i ] ;
2091
- const appliedValue = attribValues [ i ] ;
2079
+ for ( const [ appliedKey , appliedValue ] of csAttribs ) {
2092
2080
const oldValue = exports . attribsAttributeValue ( attribs , appliedKey , pool ) ;
2093
2081
if ( appliedValue !== oldValue ) {
2094
2082
backAttribs . push ( [ appliedKey , oldValue ] ) ;
@@ -2289,9 +2277,9 @@ const followAttributes = (att1, att2, pool) => {
2289
2277
} ) ;
2290
2278
// we've only removed attributes, so they're already sorted
2291
2279
const buf = exports . stringAssembler ( ) ;
2292
- for ( let i = 0 ; i < atts . length ; i ++ ) {
2280
+ for ( const att of atts ) {
2293
2281
buf . append ( '*' ) ;
2294
- buf . append ( exports . numToString ( pool . putAttrib ( atts [ i ] ) ) ) ;
2282
+ buf . append ( exports . numToString ( pool . putAttrib ( att ) ) ) ;
2295
2283
}
2296
2284
return buf . toString ( ) ;
2297
2285
} ;
0 commit comments