Skip to content

Commit

Permalink
create scope for parenL case
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson committed Nov 18, 2018
1 parent 99f7c75 commit 1d61f86
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/transformers/CJSImportTransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export default class CJSImportTransformer extends Transformer {
// use `Function.prototype.call` when the identifier is a guaranteed
// function call. When using `call`, pass undefined as the context.
switch (this.tokens.tokenAtRelativeIndex(1).type) {
case tt.parenL:
case tt.parenL: {
// We can use `(0, f)` when the previous token is an open brace,
// semicolon, or equal operator.
const prevToken = this.tokens.tokenAtRelativeIndex(-1);
Expand All @@ -204,6 +204,7 @@ export default class CJSImportTransformer extends Transformer {
this.rootTransformer.processBalancedCode(0, 1);
return true;
}
}
case tt.parenR:
// See here: http://2ality.com/2015/12/references.html
this.tokens.replaceToken(`(0, ${replacement})`);
Expand Down

0 comments on commit 1d61f86

Please sign in to comment.