aboutsummaryrefslogtreecommitdiff
path: root/tools/eliminator/node_modules/uglify-js/lib/parse-js.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/eliminator/node_modules/uglify-js/lib/parse-js.js')
-rw-r--r--tools/eliminator/node_modules/uglify-js/lib/parse-js.js32
1 files changed, 25 insertions, 7 deletions
diff --git a/tools/eliminator/node_modules/uglify-js/lib/parse-js.js b/tools/eliminator/node_modules/uglify-js/lib/parse-js.js
index a89163c6..c7c2025f 100644
--- a/tools/eliminator/node_modules/uglify-js/lib/parse-js.js
+++ b/tools/eliminator/node_modules/uglify-js/lib/parse-js.js
@@ -679,7 +679,28 @@ function NodeWithToken(str, start, end) {
this.end = end;
};
-NodeWithToken.prototype.toString = function() { return this.name; };
+NodeWithToken.prototype = {
+ get length() {
+ return this.name.length;
+ },
+ set length(v) {
+ return this.name.length = v;
+ },
+ replace: function() { return this.name.replace.apply(this.name, arguments); },
+ concat: function() { return this.name.concat.apply(this.name, arguments); },
+ indexOf: function() { return this.name.indexOf.apply(this.name, arguments); },
+ lastIndexOf: function() { return this.name.lastIndexOf.apply(this.name, arguments); },
+ lastIndexOf: function() { return this.name.lastIndexOf.apply(this.name, arguments); },
+ match: function() { return this.name.match.apply(this.name, arguments); },
+ search: function() { return this.name.search.apply(this.name, arguments); },
+ slice: function() { return this.name.slice.apply(this.name, arguments); },
+ split: function() { return this.name.split.apply(this.name, arguments); },
+ substr: function() { return this.name.substr.apply(this.name, arguments); },
+ substring: function() { return this.name.substring.apply(this.name, arguments); },
+ toString: function() { return this.name; },
+ toJSON: function() { return this.name; },
+ valueOf: function() { return this.name; },
+};
function parse($TEXT, exigent_mode, embed_tokens) {
@@ -765,15 +786,12 @@ function parse($TEXT, exigent_mode, embed_tokens) {
return ex;
};
- function add_tokens(str, start, end) {
- return str instanceof NodeWithToken ? str : new NodeWithToken(str, start, end);
- };
-
function maybe_embed_tokens(parser) {
if (embed_tokens) return function() {
var start = S.token;
var ast = parser.apply(this, arguments);
- ast[0] = add_tokens(ast[0], start, prev());
+ ast.start = start;
+ ast.end = prev;
return ast;
};
else return parser;
@@ -1314,7 +1332,7 @@ function characters(str) {
function member(name, array) {
for (var i = array.length; --i >= 0;)
- if (array[i] === name)
+ if (array[i] == name)
return true;
return false;
};