1
Fork 0

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

@ -467,7 +467,8 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
ast::ExprCast(e, _) |
ast::ExprUnary(_, e) |
ast::ExprParen(e) |
ast::ExprField(e, _, _) => {
ast::ExprField(e, _, _) |
ast::ExprTupField(e, _, _) => {
self.straightline(expr, pred, [e])
}