Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property '_walk' of null #1609

Closed
jsopenrb opened this issue Mar 16, 2017 · 1 comment · Fixed by #1610
Closed

TypeError: Cannot read property '_walk' of null #1609

jsopenrb opened this issue Mar 16, 2017 · 1 comment · Fixed by #1610

Comments

@jsopenrb
Copy link

Version: uglify-js 2.8.12
CLI: uglifyjs test.js -c -m

Minimal example:

(function(){
  var C = 'something';

  (function() {
    var v1 = C, v2;
    v2 = somefn(v1);
    v2.prop = v1;
  })();
})();

Error output:

WARN: Dropping unused variable v1 [test.js:5,8]
WARN: Collapsing constant C [test.js:5,13]
undefined:1104
            this.right._walk(visitor);
                      ^

TypeError: Cannot read property '_walk' of null
    at AST_Node.eval (eval at <anonymous> (/usr/lib/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:1104:23)
    at Object._visit (eval at <anonymous> (/usr/lib/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:1340:21)
    at AST_Node._walk (eval at <anonymous> (/usr/lib/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:1102:24)
    at AST_Node.eval (eval at <anonymous> (/usr/lib/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:1041:36)
    at Object._visit (eval at <anonymous> (/usr/lib/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:1340:21)
    at AST_Node._walk (eval at <anonymous> (/usr/lib/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:1039:24)
    at AST_Node.eval (eval at <anonymous> (/usr/lib/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:517:23)
    at Object._visit (eval at <anonymous> (/usr/lib/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:1340:21)
    at AST_Node._walk (eval at <anonymous> (/usr/lib/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:516:24)
    at walk_body (eval at <anonymous> (/usr/lib/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:528:17)
@alexlamsl
Copy link
Collaborator

Interesting - disabling either collapse_vars or reduce_vars would avoid this crash - investigating.

alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue Mar 16, 2017
`reduce_vars` enables substitution of variables but did not clone the value's `AST_Node`.

This confuses `collapse_vars` and result in invalid AST and subsequent crash.

fixes mishoo#1609
alexlamsl added a commit that referenced this issue Mar 16, 2017
`reduce_vars` enables substitution of variables but did not clone the value's `AST_Node`.

This confuses `collapse_vars` and result in invalid AST and subsequent crash.

fixes #1609
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants