Simplify code.
This commit is contained in:
parent
9c6cea3c9f
commit
b6eac65601
10
src/parse.rs
10
src/parse.rs
@ -1683,15 +1683,9 @@ fn make_dot_expr(
|
|||||||
op_pos: Position,
|
op_pos: Position,
|
||||||
) -> Result<Expr, ParseError> {
|
) -> Result<Expr, ParseError> {
|
||||||
Ok(match (lhs, rhs) {
|
Ok(match (lhs, rhs) {
|
||||||
// lhs[???]...[???].rhs
|
|
||||||
(Expr::Index(mut x, false, pos), rhs) if !terminate_chaining => {
|
|
||||||
// Attach dot chain to the bottom level of indexing chain
|
|
||||||
x.rhs = make_dot_expr(state, x.rhs, false, rhs, op_pos)?;
|
|
||||||
Expr::Index(x, false, pos)
|
|
||||||
}
|
|
||||||
// lhs[idx_expr].rhs
|
// lhs[idx_expr].rhs
|
||||||
(Expr::Index(mut x, _, pos), rhs) => {
|
(Expr::Index(mut x, term, pos), rhs) => {
|
||||||
x.rhs = make_dot_expr(state, x.rhs, true, rhs, op_pos)?;
|
x.rhs = make_dot_expr(state, x.rhs, term || terminate_chaining, rhs, op_pos)?;
|
||||||
Expr::Index(x, false, pos)
|
Expr::Index(x, false, pos)
|
||||||
}
|
}
|
||||||
// lhs.id
|
// lhs.id
|
||||||
|
Loading…
Reference in New Issue
Block a user