зеркало из https://github.com/mozilla/pjs.git
Fixing bug 277935: now parser throws syntax error on assignments to descendants like x..y = 1
This commit is contained in:
Родитель
edc8e26615
Коммит
65bd8f3f3c
|
@ -1239,6 +1239,7 @@ final class IRFactory
|
|||
}
|
||||
case Token.GET_REF: {
|
||||
Node ref = left.getFirstChild();
|
||||
checkMutableReference(ref);
|
||||
return new Node(Token.SET_REF, ref, right);
|
||||
}
|
||||
}
|
||||
|
@ -1246,6 +1247,14 @@ final class IRFactory
|
|||
throw Kit.codeBug();
|
||||
}
|
||||
|
||||
private void checkMutableReference(Node n)
|
||||
{
|
||||
int memberTypeFlags = n.getIntProp(Node.MEMBER_TYPE_PROP, 0);
|
||||
if ((memberTypeFlags & Node.DESCENDANTS_FLAG) != 0) {
|
||||
parser.reportError("msg.bad.assign.left");
|
||||
}
|
||||
}
|
||||
|
||||
Node createAssignment(int assignType, Node left, Node right)
|
||||
{
|
||||
left = makeReference(left);
|
||||
|
@ -1297,6 +1306,7 @@ final class IRFactory
|
|||
}
|
||||
case Token.GET_REF: {
|
||||
Node ref = left.getFirstChild();
|
||||
checkMutableReference(ref);
|
||||
Node opLeft = new Node(Token.USE_STACK);
|
||||
Node op = new Node(assignOp, opLeft, right);
|
||||
return new Node(Token.SET_REF_OP, ref, op);
|
||||
|
|
Загрузка…
Ссылка в новой задаче