Browse Source

fix(compiler): handle negative length in codeframe repeat

dev
Evan You 6 years ago
parent
commit
7a8de91cd7
  1. 12
      src/compiler/codeframe.js

12
src/compiler/codeframe.js

@ -38,11 +38,13 @@ export function generateCodeFrame (
function repeat (str, n) {
let result = ''
while (true) { // eslint-disable-line
if (n & 1) result += str
n >>>= 1
if (n <= 0) break
str += str
if (n > 0) {
while (true) { // eslint-disable-line
if (n & 1) result += str
n >>>= 1
if (n <= 0) break
str += str
}
}
return result
}

Loading…
Cancel
Save