updated npm modules
This commit is contained in:
29
node_modules/uglify-js/lib/parse.js
generated
vendored
29
node_modules/uglify-js/lib/parse.js
generated
vendored
@@ -758,17 +758,21 @@ function parse($TEXT, options) {
|
||||
croak(msg, token.line, token.col);
|
||||
}
|
||||
|
||||
function token_to_string(type, value) {
|
||||
return type + (value === undefined ? "" : " «" + value + "»");
|
||||
}
|
||||
|
||||
function unexpected(token) {
|
||||
if (token == null)
|
||||
token = S.token;
|
||||
token_error(token, "Unexpected token: " + token.type + " (" + token.value + ")");
|
||||
token_error(token, "Unexpected token: " + token_to_string(token.type, token.value));
|
||||
}
|
||||
|
||||
function expect_token(type, val) {
|
||||
if (is(type, val)) {
|
||||
return next();
|
||||
}
|
||||
token_error(S.token, "Unexpected token " + S.token.type + " «" + S.token.value + "»" + ", expected " + type + " «" + val + "»");
|
||||
token_error(S.token, "Unexpected token: " + token_to_string(S.token.type, S.token.value) + ", expected: " + token_to_string(type, val));
|
||||
}
|
||||
|
||||
function expect(punc) {
|
||||
@@ -788,7 +792,7 @@ function parse($TEXT, options) {
|
||||
|
||||
function semicolon(optional) {
|
||||
if (is("punc", ";")) next();
|
||||
else if (!optional && !can_insert_semicolon()) unexpected();
|
||||
else if (!optional && !can_insert_semicolon()) expect_token("punc", ";");
|
||||
}
|
||||
|
||||
function parenthesised() {
|
||||
@@ -1069,7 +1073,7 @@ function parse($TEXT, options) {
|
||||
var in_statement = ctor === AST_Defun;
|
||||
var name = is("name") ? as_symbol(in_statement ? AST_SymbolDefun : AST_SymbolLambda) : null;
|
||||
if (in_statement && !name)
|
||||
unexpected();
|
||||
expect_token("name");
|
||||
if (name && ctor !== AST_Accessor && !(name instanceof AST_SymbolDeclaration))
|
||||
unexpected(prev());
|
||||
expect("(");
|
||||
@@ -1119,7 +1123,7 @@ function parse($TEXT, options) {
|
||||
expect("{");
|
||||
var a = [];
|
||||
while (!is("punc", "}")) {
|
||||
if (is("eof")) unexpected();
|
||||
if (is("eof")) expect_token("punc", "}");
|
||||
a.push(statement(strict_defun));
|
||||
}
|
||||
next();
|
||||
@@ -1130,7 +1134,7 @@ function parse($TEXT, options) {
|
||||
expect("{");
|
||||
var a = [], cur = null, branch = null, tmp;
|
||||
while (!is("punc", "}")) {
|
||||
if (is("eof")) unexpected();
|
||||
if (is("eof")) expect_token("punc", "}");
|
||||
if (is("keyword", "case")) {
|
||||
if (branch) branch.end = prev();
|
||||
cur = [];
|
||||
@@ -1141,8 +1145,7 @@ function parse($TEXT, options) {
|
||||
});
|
||||
a.push(branch);
|
||||
expect(":");
|
||||
}
|
||||
else if (is("keyword", "default")) {
|
||||
} else if (is("keyword", "default")) {
|
||||
if (branch) branch.end = prev();
|
||||
cur = [];
|
||||
branch = new AST_Default({
|
||||
@@ -1150,8 +1153,7 @@ function parse($TEXT, options) {
|
||||
body : cur
|
||||
});
|
||||
a.push(branch);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (!cur) unexpected();
|
||||
cur.push(statement());
|
||||
}
|
||||
@@ -1420,10 +1422,10 @@ function parse($TEXT, options) {
|
||||
}
|
||||
|
||||
function as_name() {
|
||||
var tmp = S.token;
|
||||
if (tmp.type != "name") unexpected();
|
||||
if (!is("name")) expect_token("name");
|
||||
var name = S.token.value;
|
||||
next();
|
||||
return tmp.value;
|
||||
return name;
|
||||
}
|
||||
|
||||
function _make_symbol(type) {
|
||||
@@ -1625,6 +1627,7 @@ function parse($TEXT, options) {
|
||||
}
|
||||
|
||||
if (options.expression) {
|
||||
handle_regexp();
|
||||
return expression(true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user