Implement tuple and tuple struct indexing

This allows code to access the fields of tuples and tuple structs:

    let x = (1i, 2i);
    assert_eq!(x.1, 2);

    struct Point(int, int);
    let origin = Point(0, 0);
    assert_eq!(origin.0, 0);
    assert_eq!(origin.1, 0);
This commit is contained in:
P1start 2014-08-10 15:54:33 +12:00
parent 651106462c
commit bf274bc18b
34 changed files with 549 additions and 14 deletions

View file

@ -540,6 +540,7 @@ pub enum Expr_ {
ExprAssign(Gc<Expr>, Gc<Expr>),
ExprAssignOp(BinOp, Gc<Expr>, Gc<Expr>),
ExprField(Gc<Expr>, SpannedIdent, Vec<P<Ty>>),
ExprTupField(Gc<Expr>, Spanned<uint>, Vec<P<Ty>>),
ExprIndex(Gc<Expr>, Gc<Expr>),
/// Variable reference, possibly containing `::` and/or