Skip to content

Commit

Permalink
Avoid (sliced string) (#30180)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdima committed Jul 6, 2017
1 parent eb1d2a5 commit bf3ea73
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { TPromise } from 'vs/base/common/winjs.base';
import { CharCode } from 'vs/base/common/charCode';
import { IRawTextSource } from 'vs/editor/common/model/textSource';

const AVOID_SLICED_STRINGS = true;

export interface ModelBuilderResult {
readonly hash: string;
readonly value: IRawTextSource;
Expand Down Expand Up @@ -40,7 +42,12 @@ class ModelLineBasedBuilder {
}

for (let i = 0, len = lines.length; i < len; i++) {
this.lines[this.currLineIndex++] = lines[i];
let line = lines[i];
if (AVOID_SLICED_STRINGS) {
// See https://bugs.chromium.org/p/v8/issues/detail?id=2869
line = Buffer.from(line).toString();
}
this.lines[this.currLineIndex++] = line;
}
this.hash.update(lines.join('\n') + '\n');
}
Expand Down

0 comments on commit bf3ea73

Please sign in to comment.