diff options
author | Jez Ng <me@jezng.com> | 2013-06-26 01:15:35 -0700 |
---|---|---|
committer | Jez Ng <me@jezng.com> | 2013-06-26 01:15:35 -0700 |
commit | 566447048806a59eb6e102fc364191ce292d7045 (patch) | |
tree | db472534dc0d8bf4c560348afd849f3563ef0253 /tools/eliminator/node_modules/uglify-js/lib/process.js | |
parent | 0c19e4051e497c9bd61459617768b9e3eaad5a44 (diff) |
Move line numbers to the AST node itself.
This allows us to use strict comparisons on the node type.
Diffstat (limited to 'tools/eliminator/node_modules/uglify-js/lib/process.js')
-rw-r--r-- | tools/eliminator/node_modules/uglify-js/lib/process.js | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/tools/eliminator/node_modules/uglify-js/lib/process.js b/tools/eliminator/node_modules/uglify-js/lib/process.js index 3fd99b79..e1d692b2 100644 --- a/tools/eliminator/node_modules/uglify-js/lib/process.js +++ b/tools/eliminator/node_modules/uglify-js/lib/process.js @@ -1511,8 +1511,8 @@ function gen_code(ast, options) { str.substr(str.indexOf("."))); } var best = best_of(a); - if (options.debug && this[0].start) - return new NodeWithLine(best, this[0].start.line); + if (options.debug && this.start) + return new NodeWithLine(best, this.start.line); return best; }; @@ -1546,8 +1546,8 @@ function gen_code(ast, options) { // hack: we don't support mapping one optimized line to more than one // generated line, so in case of multiple comma-separated var definitions, // just take the first - if (defs[0][1] && defs[0][1][0] && defs[0][1][0].start) - return s + (new NodeWithLine(s, defs[0][1][0].start.line)).lineComment(); + if (defs[0][1] && defs[0][1].start) + return s + (new NodeWithLine(s, defs[0][1].start.line)).lineComment(); } return s; }, @@ -1605,8 +1605,8 @@ function gen_code(ast, options) { if (op && op !== true) op += "="; else op = "="; var s = add_spaces([ make(lvalue), op, parenthesize(rvalue, "seq") ]); - if (options.debug && this[0].start) - return new NodeWithLine(s, this[0].start.line); + if (options.debug && this.start) + return new NodeWithLine(s, this.start.line); return s; }, "dot": function(expr) { @@ -1627,8 +1627,8 @@ function gen_code(ast, options) { var str = f + "(" + add_commas(MAP(args, function(expr){ return parenthesize(expr, "seq"); })) + ")"; - if (options.debug && this[0].start) - return new NodeWithLine(str, this[0].start.line) + if (options.debug && this.start) + return new NodeWithLine(str, this.start.line) return str; }, "function": make_function, @@ -1688,12 +1688,12 @@ function gen_code(ast, options) { } var str = add_spaces([ left, operator, right ]); if (options.debug) { - if (this[0].start) - return new NodeWithLine(str, this[0].start.line); - else if (lvalue[0].start) - return new NodeWithLine(str, lvalue[0].start.line); - else if (rvalue[0].start) - return new NodeWithLine(str, rvalue[0].start.line); + if (this.start) + return new NodeWithLine(str, this.start.line); + else if (lvalue.start) + return new NodeWithLine(str, lvalue.start.line); + else if (rvalue.start) + return new NodeWithLine(str, rvalue.start.line); } return str; }, |