Fix blunder in reworking of how SpiderMonkey detects a label statement (reported by Steve Yegge).

This commit is contained in:
brendan@mozilla.org 2007-05-05 21:34:24 -07:00
parent df0899706b
commit fdc7388265

View File

@ -547,18 +547,23 @@ function Statement(t, x) {
return n;
default:
if (tt == IDENTIFIER && t.peek() == COLON) {
label = t.token.value;
ss = x.stmtStack;
for (i = ss.length-1; i >= 0; --i) {
if (ss[i].label == label)
throw t.newSyntaxError("Duplicate label");
if (tt == IDENTIFIER) {
t.scanOperand = false;
tt = t.peek();
t.scanOperand = true;
if (tt == COLON) {
label = t.token.value;
ss = x.stmtStack;
for (i = ss.length-1; i >= 0; --i) {
if (ss[i].label == label)
throw t.newSyntaxError("Duplicate label");
}
t.get();
n = new Node(t, LABEL);
n.label = label;
n.statement = nest(t, x, n, Statement);
return n;
}
t.get();
n = new Node(t, LABEL);
n.label = label;
n.statement = nest(t, x, n, Statement);
return n;
}
n = new Node(t, SEMICOLON);