Skip to content
This repository was archived by the owner on Mar 10, 2021. It is now read-only.

Commit 7c2aa77

Browse files
authored
Merge pull request #1 from infinitered/fix-catch-blocks
Fixes console.tron.x replacement to play nice with catch blocks.
2 parents c97af80 + 02534d7 commit 7c2aa77

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,14 @@ module.exports = function (babel) {
7878
pppPath.replaceWith(pppPath.node.arguments[0])
7979
} else {
8080
// -=-=-=-=-=-=-=-=-=-=-=-=-=
81-
// console.tron.something -- like log, display, etc -- nuke it
81+
// console.tron.something -- like log, display, etc
82+
// replace it with a no-op expression so it doesn't break
83+
// catch() statements.
84+
//
85+
// TODO(steve): build our own functionDeclaration because
86+
// this isn't the nicest way to achieve this in babel.
8287
// -=-=-=-=-=-=-=-=-=-=-=-=-=
83-
pppPath.remove()
88+
pppPath.replaceWithSourceString('(() => false)()')
8489
}
8590
} // Identifier
8691
} // console.tron

0 commit comments

Comments
 (0)