From 13881df1b2a188b1505b50fde47dfdd8c95a99ee Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Tue, 17 Mar 2015 17:42:20 +0530 Subject: [PATCH] Clarify Expr --- src/libsyntax/ast.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index ccccc3bfb04ec..26e10a351504d 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -784,15 +784,19 @@ pub enum Expr_ { ExprBox(Option>, P), /// An array (`[a, b, c, d]`) ExprVec(Vec>), - /// A function cal + /// A function call + /// The first field resolves to the function itself, + /// and the second field is the list of arguments ExprCall(P, Vec>), /// A method call (`x.foo::(a, b, c, d)`) /// The `SpannedIdent` is the identifier for the method name /// The vector of `Ty`s are the ascripted type parameters for the method /// (within the angle brackets) /// The first element of the vector of `Expr`s is the expression that evaluates - /// to the object on which the method is being called on, and the remaining elements - /// are the arguments + /// to the object on which the method is being called on (the receiver), + /// and the remaining elements are the rest of the arguments. + /// Thus, `x.foo::(a, b, c, d)` is represented as + /// `ExprMethodCall(foo, [Bar, Baz], [x, a, b, c, d])` ExprMethodCall(SpannedIdent, Vec>, Vec>), /// A tuple (`(a, b, c ,d)`) ExprTup(Vec>), @@ -829,7 +833,8 @@ pub enum Expr_ { /// `'label loop { block }` // FIXME #6993: change to Option ... or not, if these are hygienic. ExprLoop(P, Option), - /// A `match` block, with a desugar source + /// A `match` block, with a source that indicates whether or not it is + /// the result of a desugaring, and if so, which kind ExprMatch(P, Vec, MatchSource), /// A closure (for example, `move |a, b, c| {a + b + c}`) ExprClosure(CaptureClause, P, P), @@ -1094,7 +1099,7 @@ pub enum Mac_ { #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum StrStyle { - /// A regular string, like `"fooo"` + /// A regular string, like `"foo"` CookedStr, /// A raw string, like `r##"foo"##` /// The uint is the number of `#` symbols used