1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use crate::priv_prelude::*;
#[derive(Clone, Debug)]
pub enum Assignable {
Var(Ident),
Index {
target: Box<Assignable>,
arg: SquareBrackets<Box<Expr>>,
},
FieldProjection {
target: Box<Assignable>,
dot_token: DotToken,
name: Ident,
},
TupleFieldProjection {
target: Box<Assignable>,
dot_token: DotToken,
field: BigUint,
field_span: Span,
},
}
impl Spanned for Assignable {
fn span(&self) -> Span {
match self {
Assignable::Var(name) => name.span(),
Assignable::Index { target, arg } => Span::join(target.span(), arg.span()),
Assignable::FieldProjection { target, name, .. } => {
Span::join(target.span(), name.span())
}
Assignable::TupleFieldProjection {
target, field_span, ..
} => Span::join(target.span(), field_span.clone()),
}
}
}