aboutsummaryrefslogtreecommitdiff
path: root/xtask/src
diff options
context:
space:
mode:
authorveetaha <[email protected]>2020-05-12 21:31:37 +0100
committerveetaha <[email protected]>2020-05-12 21:31:37 +0100
commit24b27abf9f3a57268d0fb7c9a1aa2ede2980195f (patch)
treea017fbf3780dfea221c721fbb6ce870a7aa7abfb /xtask/src
parent2a5ab9f5ddc2f60a9229904c412ac943e894c4b7 (diff)
Add a doc comment on the difference between Name and NameRef ast nodes
Diffstat (limited to 'xtask/src')
-rw-r--r--xtask/src/ast_src.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs
index d1e34e299..79e5a608d 100644
--- a/xtask/src/ast_src.rs
+++ b/xtask/src/ast_src.rs
@@ -1522,7 +1522,20 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
1522 struct Visibility { T![pub], T![super], T![self], T![crate] } 1522 struct Visibility { T![pub], T![super], T![self], T![crate] }
1523 1523
1524 /// Single identifier. 1524 /// Single identifier.
1525 /// // TODO: clarify the difference between Name and NameRef 1525 /// Note(@matklad): `Name` is for things that install a new name into the scope,
1526 /// `NameRef` is a usage of a name. Most of the time, this definition/reference
1527 /// distinction can be determined purely syntactically, ie in
1528 /// ```
1529 /// fn foo() { foo() }
1530 /// ```
1531 /// the first foo is `Name`, the second one is `NameRef`.
1532 /// The notable exception are patterns, where in
1533 /// ``
1534 /// let x = 92
1535 /// ```
1536 /// `x` can be semantically either a name or a name ref, depeding on
1537 /// wether there's an `x` constant in scope.
1538 /// We use `Name` for patterns, and disambiguate semantically (see `NameClass` in ide_db).
1526 /// 1539 ///
1527 /// ``` 1540 /// ```
1528 /// let ❰ foo ❱ = bar; 1541 /// let ❰ foo ❱ = bar;
@@ -1534,6 +1547,8 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
1534 struct Name { T![ident] } 1547 struct Name { T![ident] }
1535 1548
1536 /// Reference to a name. 1549 /// Reference to a name.
1550 /// See the explanation on the difference between `Name` and `NameRef`
1551 /// in `Name` ast node docs.
1537 /// 1552 ///
1538 /// ``` 1553 /// ```
1539 /// let foo = ❰ bar ❱(❰ Baz(❰ bruh ❱) ❱; 1554 /// let foo = ❰ bar ❱(❰ Baz(❰ bruh ❱) ❱;