Skip to content

Commit

Permalink
Use integer instead of actual stack
Browse files Browse the repository at this point in the history
  • Loading branch information
danez committed Nov 18, 2018
1 parent 8ee970e commit be59169
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/babel-parser/src/plugins/typescript.js
Expand Up @@ -755,14 +755,14 @@ export default (superClass: Class<Parser>): Class<Parser> =>
}

if (this.match(tt.braceL)) {
const braceStack = [tt.braceL];
let braceStackCounter = 1;
this.next();

while (braceStack.length > 0) {
while (braceStackCounter > 0) {
if (this.match(tt.braceL)) {
braceStack.push(tt.braceL);
++braceStackCounter;
} else if (this.match(tt.braceR)) {
braceStack.pop();
--braceStackCounter;
}
this.next();
}
Expand Down

0 comments on commit be59169

Please sign in to comment.