@@ -30,7 +30,7 @@ class ModelLineBasedBuilder {
30
30
this . currLineIndex = 0 ;
31
31
}
32
32
33
- public acceptLines ( lines :string [ ] , linesLength : number ) : void {
33
+ public acceptLines ( lines :string [ ] ) : void {
34
34
if ( this . currLineIndex === 0 ) {
35
35
// Remove the BOM (if present)
36
36
if ( strings . startsWithUTF8BOM ( lines [ 0 ] ) ) {
@@ -39,10 +39,10 @@ class ModelLineBasedBuilder {
39
39
}
40
40
}
41
41
42
- for ( let i = 0 ; i < linesLength ; i ++ ) {
42
+ for ( let i = 0 , len = lines . length ; i < len ; i ++ ) {
43
43
this . lines [ this . currLineIndex ++ ] = lines [ i ] ;
44
- this . hash . update ( lines [ i ] + '\n' ) ;
45
44
}
45
+ this . hash . update ( lines . join ( '\n' ) + '\n' ) ;
46
46
}
47
47
48
48
public finish ( totalLength :number , carriageReturnCnt :number , opts :ITextModelCreationOptions ) : ModelBuilderResult {
@@ -178,7 +178,7 @@ export class ModelBuilder {
178
178
}
179
179
180
180
lines [ 0 ] = this . leftoverPrevChunk + lines [ 0 ] ;
181
- this . lineBasedBuilder . acceptLines ( lines , lines . length - 1 ) ;
181
+ this . lineBasedBuilder . acceptLines ( lines . slice ( 0 , lines . length - 1 ) ) ;
182
182
this . leftoverPrevChunk = lines [ lines . length - 1 ] ;
183
183
}
184
184
@@ -187,7 +187,7 @@ export class ModelBuilder {
187
187
if ( this . leftoverEndsInCR ) {
188
188
finalLines . push ( '' ) ;
189
189
}
190
- this . lineBasedBuilder . acceptLines ( finalLines , finalLines . length ) ;
190
+ this . lineBasedBuilder . acceptLines ( finalLines ) ;
191
191
return this . lineBasedBuilder . finish ( this . totalLength , this . totalCRCount , opts ) ;
192
192
}
193
193
}
0 commit comments