This commit is contained in:
Mihai Bazon
2012-10-13 12:42:01 +03:00
parent 370d3e0917
commit 708abb1ab1

View File

@@ -1186,28 +1186,30 @@ function parse($TEXT, options) {
}); });
function as_property_name() { function as_property_name() {
var tmp; var tmp = S.token;
switch (S.token.type) { next();
switch (tmp.type) {
case "num": case "num":
case "string": case "string":
case "name": case "name":
case "operator": case "operator":
case "keyword": case "keyword":
case "atom": case "atom":
return (tmp = S.token.value, next(), tmp); return tmp.value;
default: default:
unexpected(); unexpected();
} }
}; };
function as_name() { function as_name() {
var tmp; var tmp = S.token;
switch (S.token.type) { next();
switch (tmp.type) {
case "name": case "name":
case "operator": case "operator":
case "keyword": case "keyword":
case "atom": case "atom":
return (tmp = S.token.value, next(), tmp); return tmp.value;
default: default:
unexpected(); unexpected();
} }
@@ -1263,11 +1265,10 @@ function parse($TEXT, options) {
}; };
var maybe_unary = function(allow_calls) { var maybe_unary = function(allow_calls) {
var start = S.token, tmp; var start = S.token;
if (is("operator") && UNARY_PREFIX(S.token.value)) { if (is("operator") && UNARY_PREFIX(start.value)) {
var ex = make_unary(AST_UnaryPrefix, next();
(tmp = S.token.value, next(), tmp), var ex = make_unary(AST_UnaryPrefix, start.value, maybe_unary(allow_calls));
maybe_unary(allow_calls));
ex.start = start; ex.start = start;
ex.end = prev(); ex.end = prev();
return ex; return ex;