Skip to content

Commit

Permalink
fix(compiler): handle negative length in codeframe repeat
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Feb 21, 2019
1 parent 173042b commit 7a8de91
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/compiler/codeframe.js
Expand Up @@ -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
}

0 comments on commit 7a8de91

Please sign in to comment.