Skip to content

Commit 13881df

Browse files
committed
Clarify Expr
1 parent edf65c4 commit 13881df

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/libsyntax/ast.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -784,15 +784,19 @@ pub enum Expr_ {
784784
ExprBox(Option<P<Expr>>, P<Expr>),
785785
/// An array (`[a, b, c, d]`)
786786
ExprVec(Vec<P<Expr>>),
787-
/// A function cal
787+
/// A function call
788+
/// The first field resolves to the function itself,
789+
/// and the second field is the list of arguments
788790
ExprCall(P<Expr>, Vec<P<Expr>>),
789791
/// A method call (`x.foo::<Bar, Baz>(a, b, c, d)`)
790792
/// The `SpannedIdent` is the identifier for the method name
791793
/// The vector of `Ty`s are the ascripted type parameters for the method
792794
/// (within the angle brackets)
793795
/// The first element of the vector of `Expr`s is the expression that evaluates
794-
/// to the object on which the method is being called on, and the remaining elements
795-
/// are the arguments
796+
/// to the object on which the method is being called on (the receiver),
797+
/// and the remaining elements are the rest of the arguments.
798+
/// Thus, `x.foo::<Bar, Baz>(a, b, c, d)` is represented as
799+
/// `ExprMethodCall(foo, [Bar, Baz], [x, a, b, c, d])`
796800
ExprMethodCall(SpannedIdent, Vec<P<Ty>>, Vec<P<Expr>>),
797801
/// A tuple (`(a, b, c ,d)`)
798802
ExprTup(Vec<P<Expr>>),
@@ -829,7 +833,8 @@ pub enum Expr_ {
829833
/// `'label loop { block }`
830834
// FIXME #6993: change to Option<Name> ... or not, if these are hygienic.
831835
ExprLoop(P<Block>, Option<Ident>),
832-
/// A `match` block, with a desugar source
836+
/// A `match` block, with a source that indicates whether or not it is
837+
/// the result of a desugaring, and if so, which kind
833838
ExprMatch(P<Expr>, Vec<Arm>, MatchSource),
834839
/// A closure (for example, `move |a, b, c| {a + b + c}`)
835840
ExprClosure(CaptureClause, P<FnDecl>, P<Block>),
@@ -1094,7 +1099,7 @@ pub enum Mac_ {
10941099

10951100
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
10961101
pub enum StrStyle {
1097-
/// A regular string, like `"fooo"`
1102+
/// A regular string, like `"foo"`
10981103
CookedStr,
10991104
/// A raw string, like `r##"foo"##`
11001105
/// The uint is the number of `#` symbols used

0 commit comments

Comments
 (0)