Skip to content

Commit

Permalink
fix: loop protect breaking when no LOC
Browse files Browse the repository at this point in the history
  • Loading branch information
remy committed Jan 26, 2018
1 parent 357f74a commit 2ff3c86
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ const generateInside = ({ t, id, line, ch, timeout, extra } = {}) => {
};

const protect = (t, timeout, extra) => path => {
if (!path.node.loc) {
// I don't really know _how_ we get into this state
// but https://jsbin.com/mipesawapi/1/ triggers it
// and the node, I'm guessing after translation,
// doesn't have a line in the code, so this blows up.
return;
}
const id = path.scope.generateUidIdentifier('LP');
const before = generateBefore(t, id);
const inside = generateInside({
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "loop-protect",
"description": "Prevent infinite loops in dynamically eval'd JavaScript.",
"main": "dist/",
"version": "2.1.5",
"version": "2.1.6",
"homepage": "https://github.com/jsbin/loop-protect",
"repository": {
"type": "git",
Expand Down

0 comments on commit 2ff3c86

Please sign in to comment.