| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9942117 commit 649fcbb
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,10 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + // Set root member | ||
| 4 | + let foo = true; | ||
| 5 | + foo = false; | ||
| 6 | + | ||
| 7 | + // Return outside of function | ||
| 8 | + if (!foo) { | ||
| 9 | + return; | ||
| 10 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,2 @@ | |||
| 1 | + { | ||
| 2 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -52,7 +52,9 @@ process.argv.slice(2).forEach((file) => { | |||
| 52 | 52 | ||
| 53 | 53 | // Parse source. | |
| 54 | 54 | const source = fs.readFileSync(file, 'utf8'); | |
| 55 | - const ast = acorn.parse(source, { ecmaVersion: 10, locations: true }); | ||
| 55 | + const ast = acorn.parse( | ||
| 56 | + source, | ||
| 57 | + { allowReturnOutsideFunction: true, ecmaVersion: 10, locations: true }); | ||
| 56 | 58 | const program = ast.body; | |
| 57 | 59 | ||
| 58 | 60 | // Build link | |
@@ -68,8 +70,8 @@ process.argv.slice(2).forEach((file) => { | |||
| 68 | 70 | if (expr.type !== 'AssignmentExpression') return; | |
| 69 | 71 | ||
| 70 | 72 | let lhs = expr.left; | |
| 71 | - if (expr.left.object.type === 'MemberExpression') lhs = lhs.object; | ||
| 72 | 73 | if (lhs.type !== 'MemberExpression') return; | |
| 74 | + if (lhs.object.type === 'MemberExpression') lhs = lhs.object; | ||
| 73 | 75 | if (lhs.object.name === 'exports') { | |
| 74 | 76 | const name = lhs.property.name; | |
| 75 | 77 | if (expr.right.type === 'FunctionExpression') { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments