(Expression lhs)
| 594 | } |
| 595 | |
| 596 | private void assign(Expression lhs) { |
| 597 | if (lhs instanceof Identifier) { |
| 598 | // Bindings are created by the first pass (createBindings), |
| 599 | // so there's nothing to do here. |
| 600 | } else if (lhs instanceof IndexExpression) { |
| 601 | visit(lhs); |
| 602 | } else if (lhs instanceof ListExpression) { |
| 603 | for (Expression elem : ((ListExpression) lhs).getElements()) { |
| 604 | assign(elem); |
| 605 | } |
| 606 | } else if (lhs instanceof DotExpression) { |
| 607 | visit(((DotExpression) lhs).getObject()); |
| 608 | // Do not visit the field. It is an identifier but does not correspond to a binding. |
| 609 | } else { |
| 610 | errorf(lhs, "cannot assign to '%s'", lhs); |
| 611 | } |
| 612 | } |
| 613 | |
| 614 | @Override |
| 615 | public void visit(Identifier id) { |
no test coverage detected