aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast/generated.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/ast/generated.rs')
-rw-r--r--crates/ra_syntax/src/ast/generated.rs559
1 files changed, 297 insertions, 262 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index 9c5789701..90480b6ca 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -307,6 +307,33 @@ impl BlockExpr {
307 } 307 }
308} 308}
309#[derive(Debug, Clone, PartialEq, Eq, Hash)] 309#[derive(Debug, Clone, PartialEq, Eq, Hash)]
310pub struct BoxPat {
311 pub(crate) syntax: SyntaxNode,
312}
313impl AstNode for BoxPat {
314 fn can_cast(kind: SyntaxKind) -> bool {
315 match kind {
316 BOX_PAT => true,
317 _ => false,
318 }
319 }
320 fn cast(syntax: SyntaxNode) -> Option<Self> {
321 if Self::can_cast(syntax.kind()) {
322 Some(Self { syntax })
323 } else {
324 None
325 }
326 }
327 fn syntax(&self) -> &SyntaxNode {
328 &self.syntax
329 }
330}
331impl BoxPat {
332 pub fn pat(&self) -> Option<Pat> {
333 AstChildren::new(&self.syntax).next()
334 }
335}
336#[derive(Debug, Clone, PartialEq, Eq, Hash)]
310pub struct BreakExpr { 337pub struct BreakExpr {
311 pub(crate) syntax: SyntaxNode, 338 pub(crate) syntax: SyntaxNode,
312} 339}
@@ -607,7 +634,7 @@ pub enum Expr {
607 BlockExpr(BlockExpr), 634 BlockExpr(BlockExpr),
608 ReturnExpr(ReturnExpr), 635 ReturnExpr(ReturnExpr),
609 MatchExpr(MatchExpr), 636 MatchExpr(MatchExpr),
610 StructLit(StructLit), 637 RecordLit(RecordLit),
611 CallExpr(CallExpr), 638 CallExpr(CallExpr),
612 IndexExpr(IndexExpr), 639 IndexExpr(IndexExpr),
613 MethodCallExpr(MethodCallExpr), 640 MethodCallExpr(MethodCallExpr),
@@ -698,9 +725,9 @@ impl From<MatchExpr> for Expr {
698 Expr::MatchExpr(node) 725 Expr::MatchExpr(node)
699 } 726 }
700} 727}
701impl From<StructLit> for Expr { 728impl From<RecordLit> for Expr {
702 fn from(node: StructLit) -> Expr { 729 fn from(node: RecordLit) -> Expr {
703 Expr::StructLit(node) 730 Expr::RecordLit(node)
704 } 731 }
705} 732}
706impl From<CallExpr> for Expr { 733impl From<CallExpr> for Expr {
@@ -778,7 +805,7 @@ impl AstNode for Expr {
778 match kind { 805 match kind {
779 TUPLE_EXPR | ARRAY_EXPR | PAREN_EXPR | PATH_EXPR | LAMBDA_EXPR | IF_EXPR 806 TUPLE_EXPR | ARRAY_EXPR | PAREN_EXPR | PATH_EXPR | LAMBDA_EXPR | IF_EXPR
780 | LOOP_EXPR | FOR_EXPR | WHILE_EXPR | CONTINUE_EXPR | BREAK_EXPR | LABEL 807 | LOOP_EXPR | FOR_EXPR | WHILE_EXPR | CONTINUE_EXPR | BREAK_EXPR | LABEL
781 | BLOCK_EXPR | RETURN_EXPR | MATCH_EXPR | STRUCT_LIT | CALL_EXPR | INDEX_EXPR 808 | BLOCK_EXPR | RETURN_EXPR | MATCH_EXPR | RECORD_LIT | CALL_EXPR | INDEX_EXPR
782 | METHOD_CALL_EXPR | FIELD_EXPR | AWAIT_EXPR | TRY_EXPR | TRY_BLOCK_EXPR 809 | METHOD_CALL_EXPR | FIELD_EXPR | AWAIT_EXPR | TRY_EXPR | TRY_BLOCK_EXPR
783 | CAST_EXPR | REF_EXPR | PREFIX_EXPR | RANGE_EXPR | BIN_EXPR | LITERAL | MACRO_CALL => { 810 | CAST_EXPR | REF_EXPR | PREFIX_EXPR | RANGE_EXPR | BIN_EXPR | LITERAL | MACRO_CALL => {
784 true 811 true
@@ -803,7 +830,7 @@ impl AstNode for Expr {
803 BLOCK_EXPR => Expr::BlockExpr(BlockExpr { syntax }), 830 BLOCK_EXPR => Expr::BlockExpr(BlockExpr { syntax }),
804 RETURN_EXPR => Expr::ReturnExpr(ReturnExpr { syntax }), 831 RETURN_EXPR => Expr::ReturnExpr(ReturnExpr { syntax }),
805 MATCH_EXPR => Expr::MatchExpr(MatchExpr { syntax }), 832 MATCH_EXPR => Expr::MatchExpr(MatchExpr { syntax }),
806 STRUCT_LIT => Expr::StructLit(StructLit { syntax }), 833 RECORD_LIT => Expr::RecordLit(RecordLit { syntax }),
807 CALL_EXPR => Expr::CallExpr(CallExpr { syntax }), 834 CALL_EXPR => Expr::CallExpr(CallExpr { syntax }),
808 INDEX_EXPR => Expr::IndexExpr(IndexExpr { syntax }), 835 INDEX_EXPR => Expr::IndexExpr(IndexExpr { syntax }),
809 METHOD_CALL_EXPR => Expr::MethodCallExpr(MethodCallExpr { syntax }), 836 METHOD_CALL_EXPR => Expr::MethodCallExpr(MethodCallExpr { syntax }),
@@ -839,7 +866,7 @@ impl AstNode for Expr {
839 Expr::BlockExpr(it) => &it.syntax, 866 Expr::BlockExpr(it) => &it.syntax,
840 Expr::ReturnExpr(it) => &it.syntax, 867 Expr::ReturnExpr(it) => &it.syntax,
841 Expr::MatchExpr(it) => &it.syntax, 868 Expr::MatchExpr(it) => &it.syntax,
842 Expr::StructLit(it) => &it.syntax, 869 Expr::RecordLit(it) => &it.syntax,
843 Expr::CallExpr(it) => &it.syntax, 870 Expr::CallExpr(it) => &it.syntax,
844 Expr::IndexExpr(it) => &it.syntax, 871 Expr::IndexExpr(it) => &it.syntax,
845 Expr::MethodCallExpr(it) => &it.syntax, 872 Expr::MethodCallExpr(it) => &it.syntax,
@@ -946,64 +973,6 @@ impl FieldExpr {
946 } 973 }
947} 974}
948#[derive(Debug, Clone, PartialEq, Eq, Hash)] 975#[derive(Debug, Clone, PartialEq, Eq, Hash)]
949pub struct FieldPat {
950 pub(crate) syntax: SyntaxNode,
951}
952impl AstNode for FieldPat {
953 fn can_cast(kind: SyntaxKind) -> bool {
954 match kind {
955 FIELD_PAT => true,
956 _ => false,
957 }
958 }
959 fn cast(syntax: SyntaxNode) -> Option<Self> {
960 if Self::can_cast(syntax.kind()) {
961 Some(Self { syntax })
962 } else {
963 None
964 }
965 }
966 fn syntax(&self) -> &SyntaxNode {
967 &self.syntax
968 }
969}
970impl ast::NameOwner for FieldPat {}
971impl FieldPat {
972 pub fn pat(&self) -> Option<Pat> {
973 AstChildren::new(&self.syntax).next()
974 }
975}
976#[derive(Debug, Clone, PartialEq, Eq, Hash)]
977pub struct FieldPatList {
978 pub(crate) syntax: SyntaxNode,
979}
980impl AstNode for FieldPatList {
981 fn can_cast(kind: SyntaxKind) -> bool {
982 match kind {
983 FIELD_PAT_LIST => true,
984 _ => false,
985 }
986 }
987 fn cast(syntax: SyntaxNode) -> Option<Self> {
988 if Self::can_cast(syntax.kind()) {
989 Some(Self { syntax })
990 } else {
991 None
992 }
993 }
994 fn syntax(&self) -> &SyntaxNode {
995 &self.syntax
996 }
997}
998impl FieldPatList {
999 pub fn field_pats(&self) -> AstChildren<FieldPat> {
1000 AstChildren::new(&self.syntax)
1001 }
1002 pub fn bind_pats(&self) -> AstChildren<BindPat> {
1003 AstChildren::new(&self.syntax)
1004 }
1005}
1006#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1007pub struct FnDef { 976pub struct FnDef {
1008 pub(crate) syntax: SyntaxNode, 977 pub(crate) syntax: SyntaxNode,
1009} 978}
@@ -1942,121 +1911,6 @@ impl AstNode for NameRef {
1942} 1911}
1943impl NameRef {} 1912impl NameRef {}
1944#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1913#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1945pub struct NamedField {
1946 pub(crate) syntax: SyntaxNode,
1947}
1948impl AstNode for NamedField {
1949 fn can_cast(kind: SyntaxKind) -> bool {
1950 match kind {
1951 NAMED_FIELD => true,
1952 _ => false,
1953 }
1954 }
1955 fn cast(syntax: SyntaxNode) -> Option<Self> {
1956 if Self::can_cast(syntax.kind()) {
1957 Some(Self { syntax })
1958 } else {
1959 None
1960 }
1961 }
1962 fn syntax(&self) -> &SyntaxNode {
1963 &self.syntax
1964 }
1965}
1966impl NamedField {
1967 pub fn name_ref(&self) -> Option<NameRef> {
1968 AstChildren::new(&self.syntax).next()
1969 }
1970 pub fn expr(&self) -> Option<Expr> {
1971 AstChildren::new(&self.syntax).next()
1972 }
1973}
1974#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1975pub struct NamedFieldDef {
1976 pub(crate) syntax: SyntaxNode,
1977}
1978impl AstNode for NamedFieldDef {
1979 fn can_cast(kind: SyntaxKind) -> bool {
1980 match kind {
1981 NAMED_FIELD_DEF => true,
1982 _ => false,
1983 }
1984 }
1985 fn cast(syntax: SyntaxNode) -> Option<Self> {
1986 if Self::can_cast(syntax.kind()) {
1987 Some(Self { syntax })
1988 } else {
1989 None
1990 }
1991 }
1992 fn syntax(&self) -> &SyntaxNode {
1993 &self.syntax
1994 }
1995}
1996impl ast::VisibilityOwner for NamedFieldDef {}
1997impl ast::NameOwner for NamedFieldDef {}
1998impl ast::AttrsOwner for NamedFieldDef {}
1999impl ast::DocCommentsOwner for NamedFieldDef {}
2000impl ast::TypeAscriptionOwner for NamedFieldDef {}
2001impl NamedFieldDef {}
2002#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2003pub struct NamedFieldDefList {
2004 pub(crate) syntax: SyntaxNode,
2005}
2006impl AstNode for NamedFieldDefList {
2007 fn can_cast(kind: SyntaxKind) -> bool {
2008 match kind {
2009 NAMED_FIELD_DEF_LIST => true,
2010 _ => false,
2011 }
2012 }
2013 fn cast(syntax: SyntaxNode) -> Option<Self> {
2014 if Self::can_cast(syntax.kind()) {
2015 Some(Self { syntax })
2016 } else {
2017 None
2018 }
2019 }
2020 fn syntax(&self) -> &SyntaxNode {
2021 &self.syntax
2022 }
2023}
2024impl NamedFieldDefList {
2025 pub fn fields(&self) -> AstChildren<NamedFieldDef> {
2026 AstChildren::new(&self.syntax)
2027 }
2028}
2029#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2030pub struct NamedFieldList {
2031 pub(crate) syntax: SyntaxNode,
2032}
2033impl AstNode for NamedFieldList {
2034 fn can_cast(kind: SyntaxKind) -> bool {
2035 match kind {
2036 NAMED_FIELD_LIST => true,
2037 _ => false,
2038 }
2039 }
2040 fn cast(syntax: SyntaxNode) -> Option<Self> {
2041 if Self::can_cast(syntax.kind()) {
2042 Some(Self { syntax })
2043 } else {
2044 None
2045 }
2046 }
2047 fn syntax(&self) -> &SyntaxNode {
2048 &self.syntax
2049 }
2050}
2051impl NamedFieldList {
2052 pub fn fields(&self) -> AstChildren<NamedField> {
2053 AstChildren::new(&self.syntax)
2054 }
2055 pub fn spread(&self) -> Option<Expr> {
2056 AstChildren::new(&self.syntax).next()
2057 }
2058}
2059#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2060pub struct NeverType { 1914pub struct NeverType {
2061 pub(crate) syntax: SyntaxNode, 1915 pub(crate) syntax: SyntaxNode,
2062} 1916}
@@ -2236,10 +2090,11 @@ impl ParenType {
2236#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2090#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2237pub enum Pat { 2091pub enum Pat {
2238 RefPat(RefPat), 2092 RefPat(RefPat),
2093 BoxPat(BoxPat),
2239 BindPat(BindPat), 2094 BindPat(BindPat),
2240 PlaceholderPat(PlaceholderPat), 2095 PlaceholderPat(PlaceholderPat),
2241 PathPat(PathPat), 2096 PathPat(PathPat),
2242 StructPat(StructPat), 2097 RecordPat(RecordPat),
2243 TupleStructPat(TupleStructPat), 2098 TupleStructPat(TupleStructPat),
2244 TuplePat(TuplePat), 2099 TuplePat(TuplePat),
2245 SlicePat(SlicePat), 2100 SlicePat(SlicePat),
@@ -2251,6 +2106,11 @@ impl From<RefPat> for Pat {
2251 Pat::RefPat(node) 2106 Pat::RefPat(node)
2252 } 2107 }
2253} 2108}
2109impl From<BoxPat> for Pat {
2110 fn from(node: BoxPat) -> Pat {
2111 Pat::BoxPat(node)
2112 }
2113}
2254impl From<BindPat> for Pat { 2114impl From<BindPat> for Pat {
2255 fn from(node: BindPat) -> Pat { 2115 fn from(node: BindPat) -> Pat {
2256 Pat::BindPat(node) 2116 Pat::BindPat(node)
@@ -2266,9 +2126,9 @@ impl From<PathPat> for Pat {
2266 Pat::PathPat(node) 2126 Pat::PathPat(node)
2267 } 2127 }
2268} 2128}
2269impl From<StructPat> for Pat { 2129impl From<RecordPat> for Pat {
2270 fn from(node: StructPat) -> Pat { 2130 fn from(node: RecordPat) -> Pat {
2271 Pat::StructPat(node) 2131 Pat::RecordPat(node)
2272 } 2132 }
2273} 2133}
2274impl From<TupleStructPat> for Pat { 2134impl From<TupleStructPat> for Pat {
@@ -2299,18 +2159,19 @@ impl From<LiteralPat> for Pat {
2299impl AstNode for Pat { 2159impl AstNode for Pat {
2300 fn can_cast(kind: SyntaxKind) -> bool { 2160 fn can_cast(kind: SyntaxKind) -> bool {
2301 match kind { 2161 match kind {
2302 REF_PAT | BIND_PAT | PLACEHOLDER_PAT | PATH_PAT | STRUCT_PAT | TUPLE_STRUCT_PAT 2162 REF_PAT | BOX_PAT | BIND_PAT | PLACEHOLDER_PAT | PATH_PAT | RECORD_PAT
2303 | TUPLE_PAT | SLICE_PAT | RANGE_PAT | LITERAL_PAT => true, 2163 | TUPLE_STRUCT_PAT | TUPLE_PAT | SLICE_PAT | RANGE_PAT | LITERAL_PAT => true,
2304 _ => false, 2164 _ => false,
2305 } 2165 }
2306 } 2166 }
2307 fn cast(syntax: SyntaxNode) -> Option<Self> { 2167 fn cast(syntax: SyntaxNode) -> Option<Self> {
2308 let res = match syntax.kind() { 2168 let res = match syntax.kind() {
2309 REF_PAT => Pat::RefPat(RefPat { syntax }), 2169 REF_PAT => Pat::RefPat(RefPat { syntax }),
2170 BOX_PAT => Pat::BoxPat(BoxPat { syntax }),
2310 BIND_PAT => Pat::BindPat(BindPat { syntax }), 2171 BIND_PAT => Pat::BindPat(BindPat { syntax }),
2311 PLACEHOLDER_PAT => Pat::PlaceholderPat(PlaceholderPat { syntax }), 2172 PLACEHOLDER_PAT => Pat::PlaceholderPat(PlaceholderPat { syntax }),
2312 PATH_PAT => Pat::PathPat(PathPat { syntax }), 2173 PATH_PAT => Pat::PathPat(PathPat { syntax }),
2313 STRUCT_PAT => Pat::StructPat(StructPat { syntax }), 2174 RECORD_PAT => Pat::RecordPat(RecordPat { syntax }),
2314 TUPLE_STRUCT_PAT => Pat::TupleStructPat(TupleStructPat { syntax }), 2175 TUPLE_STRUCT_PAT => Pat::TupleStructPat(TupleStructPat { syntax }),
2315 TUPLE_PAT => Pat::TuplePat(TuplePat { syntax }), 2176 TUPLE_PAT => Pat::TuplePat(TuplePat { syntax }),
2316 SLICE_PAT => Pat::SlicePat(SlicePat { syntax }), 2177 SLICE_PAT => Pat::SlicePat(SlicePat { syntax }),
@@ -2323,10 +2184,11 @@ impl AstNode for Pat {
2323 fn syntax(&self) -> &SyntaxNode { 2184 fn syntax(&self) -> &SyntaxNode {
2324 match self { 2185 match self {
2325 Pat::RefPat(it) => &it.syntax, 2186 Pat::RefPat(it) => &it.syntax,
2187 Pat::BoxPat(it) => &it.syntax,
2326 Pat::BindPat(it) => &it.syntax, 2188 Pat::BindPat(it) => &it.syntax,
2327 Pat::PlaceholderPat(it) => &it.syntax, 2189 Pat::PlaceholderPat(it) => &it.syntax,
2328 Pat::PathPat(it) => &it.syntax, 2190 Pat::PathPat(it) => &it.syntax,
2329 Pat::StructPat(it) => &it.syntax, 2191 Pat::RecordPat(it) => &it.syntax,
2330 Pat::TupleStructPat(it) => &it.syntax, 2192 Pat::TupleStructPat(it) => &it.syntax,
2331 Pat::TuplePat(it) => &it.syntax, 2193 Pat::TuplePat(it) => &it.syntax,
2332 Pat::SlicePat(it) => &it.syntax, 2194 Pat::SlicePat(it) => &it.syntax,
@@ -2551,13 +2413,13 @@ impl PointerType {
2551 } 2413 }
2552} 2414}
2553#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2415#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2554pub struct PosFieldDef { 2416pub struct PrefixExpr {
2555 pub(crate) syntax: SyntaxNode, 2417 pub(crate) syntax: SyntaxNode,
2556} 2418}
2557impl AstNode for PosFieldDef { 2419impl AstNode for PrefixExpr {
2558 fn can_cast(kind: SyntaxKind) -> bool { 2420 fn can_cast(kind: SyntaxKind) -> bool {
2559 match kind { 2421 match kind {
2560 POS_FIELD_DEF => true, 2422 PREFIX_EXPR => true,
2561 _ => false, 2423 _ => false,
2562 } 2424 }
2563 } 2425 }
@@ -2572,21 +2434,19 @@ impl AstNode for PosFieldDef {
2572 &self.syntax 2434 &self.syntax
2573 } 2435 }
2574} 2436}
2575impl ast::VisibilityOwner for PosFieldDef {} 2437impl PrefixExpr {
2576impl ast::AttrsOwner for PosFieldDef {} 2438 pub fn expr(&self) -> Option<Expr> {
2577impl PosFieldDef {
2578 pub fn type_ref(&self) -> Option<TypeRef> {
2579 AstChildren::new(&self.syntax).next() 2439 AstChildren::new(&self.syntax).next()
2580 } 2440 }
2581} 2441}
2582#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2442#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2583pub struct PosFieldDefList { 2443pub struct RangeExpr {
2584 pub(crate) syntax: SyntaxNode, 2444 pub(crate) syntax: SyntaxNode,
2585} 2445}
2586impl AstNode for PosFieldDefList { 2446impl AstNode for RangeExpr {
2587 fn can_cast(kind: SyntaxKind) -> bool { 2447 fn can_cast(kind: SyntaxKind) -> bool {
2588 match kind { 2448 match kind {
2589 POS_FIELD_DEF_LIST => true, 2449 RANGE_EXPR => true,
2590 _ => false, 2450 _ => false,
2591 } 2451 }
2592 } 2452 }
@@ -2601,19 +2461,38 @@ impl AstNode for PosFieldDefList {
2601 &self.syntax 2461 &self.syntax
2602 } 2462 }
2603} 2463}
2604impl PosFieldDefList { 2464impl RangeExpr {}
2605 pub fn fields(&self) -> AstChildren<PosFieldDef> { 2465#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2606 AstChildren::new(&self.syntax) 2466pub struct RangePat {
2467 pub(crate) syntax: SyntaxNode,
2468}
2469impl AstNode for RangePat {
2470 fn can_cast(kind: SyntaxKind) -> bool {
2471 match kind {
2472 RANGE_PAT => true,
2473 _ => false,
2474 }
2475 }
2476 fn cast(syntax: SyntaxNode) -> Option<Self> {
2477 if Self::can_cast(syntax.kind()) {
2478 Some(Self { syntax })
2479 } else {
2480 None
2481 }
2482 }
2483 fn syntax(&self) -> &SyntaxNode {
2484 &self.syntax
2607 } 2485 }
2608} 2486}
2487impl RangePat {}
2609#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2488#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2610pub struct PrefixExpr { 2489pub struct RecordField {
2611 pub(crate) syntax: SyntaxNode, 2490 pub(crate) syntax: SyntaxNode,
2612} 2491}
2613impl AstNode for PrefixExpr { 2492impl AstNode for RecordField {
2614 fn can_cast(kind: SyntaxKind) -> bool { 2493 fn can_cast(kind: SyntaxKind) -> bool {
2615 match kind { 2494 match kind {
2616 PREFIX_EXPR => true, 2495 RECORD_FIELD => true,
2617 _ => false, 2496 _ => false,
2618 } 2497 }
2619 } 2498 }
@@ -2628,19 +2507,22 @@ impl AstNode for PrefixExpr {
2628 &self.syntax 2507 &self.syntax
2629 } 2508 }
2630} 2509}
2631impl PrefixExpr { 2510impl RecordField {
2511 pub fn name_ref(&self) -> Option<NameRef> {
2512 AstChildren::new(&self.syntax).next()
2513 }
2632 pub fn expr(&self) -> Option<Expr> { 2514 pub fn expr(&self) -> Option<Expr> {
2633 AstChildren::new(&self.syntax).next() 2515 AstChildren::new(&self.syntax).next()
2634 } 2516 }
2635} 2517}
2636#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2518#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2637pub struct RangeExpr { 2519pub struct RecordFieldDef {
2638 pub(crate) syntax: SyntaxNode, 2520 pub(crate) syntax: SyntaxNode,
2639} 2521}
2640impl AstNode for RangeExpr { 2522impl AstNode for RecordFieldDef {
2641 fn can_cast(kind: SyntaxKind) -> bool { 2523 fn can_cast(kind: SyntaxKind) -> bool {
2642 match kind { 2524 match kind {
2643 RANGE_EXPR => true, 2525 RECORD_FIELD_DEF => true,
2644 _ => false, 2526 _ => false,
2645 } 2527 }
2646 } 2528 }
@@ -2655,15 +2537,20 @@ impl AstNode for RangeExpr {
2655 &self.syntax 2537 &self.syntax
2656 } 2538 }
2657} 2539}
2658impl RangeExpr {} 2540impl ast::VisibilityOwner for RecordFieldDef {}
2541impl ast::NameOwner for RecordFieldDef {}
2542impl ast::AttrsOwner for RecordFieldDef {}
2543impl ast::DocCommentsOwner for RecordFieldDef {}
2544impl ast::TypeAscriptionOwner for RecordFieldDef {}
2545impl RecordFieldDef {}
2659#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2546#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2660pub struct RangePat { 2547pub struct RecordFieldDefList {
2661 pub(crate) syntax: SyntaxNode, 2548 pub(crate) syntax: SyntaxNode,
2662} 2549}
2663impl AstNode for RangePat { 2550impl AstNode for RecordFieldDefList {
2664 fn can_cast(kind: SyntaxKind) -> bool { 2551 fn can_cast(kind: SyntaxKind) -> bool {
2665 match kind { 2552 match kind {
2666 RANGE_PAT => true, 2553 RECORD_FIELD_DEF_LIST => true,
2667 _ => false, 2554 _ => false,
2668 } 2555 }
2669 } 2556 }
@@ -2678,7 +2565,159 @@ impl AstNode for RangePat {
2678 &self.syntax 2565 &self.syntax
2679 } 2566 }
2680} 2567}
2681impl RangePat {} 2568impl RecordFieldDefList {
2569 pub fn fields(&self) -> AstChildren<RecordFieldDef> {
2570 AstChildren::new(&self.syntax)
2571 }
2572}
2573#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2574pub struct RecordFieldList {
2575 pub(crate) syntax: SyntaxNode,
2576}
2577impl AstNode for RecordFieldList {
2578 fn can_cast(kind: SyntaxKind) -> bool {
2579 match kind {
2580 RECORD_FIELD_LIST => true,
2581 _ => false,
2582 }
2583 }
2584 fn cast(syntax: SyntaxNode) -> Option<Self> {
2585 if Self::can_cast(syntax.kind()) {
2586 Some(Self { syntax })
2587 } else {
2588 None
2589 }
2590 }
2591 fn syntax(&self) -> &SyntaxNode {
2592 &self.syntax
2593 }
2594}
2595impl RecordFieldList {
2596 pub fn fields(&self) -> AstChildren<RecordField> {
2597 AstChildren::new(&self.syntax)
2598 }
2599 pub fn spread(&self) -> Option<Expr> {
2600 AstChildren::new(&self.syntax).next()
2601 }
2602}
2603#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2604pub struct RecordFieldPat {
2605 pub(crate) syntax: SyntaxNode,
2606}
2607impl AstNode for RecordFieldPat {
2608 fn can_cast(kind: SyntaxKind) -> bool {
2609 match kind {
2610 RECORD_FIELD_PAT => true,
2611 _ => false,
2612 }
2613 }
2614 fn cast(syntax: SyntaxNode) -> Option<Self> {
2615 if Self::can_cast(syntax.kind()) {
2616 Some(Self { syntax })
2617 } else {
2618 None
2619 }
2620 }
2621 fn syntax(&self) -> &SyntaxNode {
2622 &self.syntax
2623 }
2624}
2625impl ast::NameOwner for RecordFieldPat {}
2626impl RecordFieldPat {
2627 pub fn pat(&self) -> Option<Pat> {
2628 AstChildren::new(&self.syntax).next()
2629 }
2630}
2631#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2632pub struct RecordFieldPatList {
2633 pub(crate) syntax: SyntaxNode,
2634}
2635impl AstNode for RecordFieldPatList {
2636 fn can_cast(kind: SyntaxKind) -> bool {
2637 match kind {
2638 RECORD_FIELD_PAT_LIST => true,
2639 _ => false,
2640 }
2641 }
2642 fn cast(syntax: SyntaxNode) -> Option<Self> {
2643 if Self::can_cast(syntax.kind()) {
2644 Some(Self { syntax })
2645 } else {
2646 None
2647 }
2648 }
2649 fn syntax(&self) -> &SyntaxNode {
2650 &self.syntax
2651 }
2652}
2653impl RecordFieldPatList {
2654 pub fn record_field_pats(&self) -> AstChildren<RecordFieldPat> {
2655 AstChildren::new(&self.syntax)
2656 }
2657 pub fn bind_pats(&self) -> AstChildren<BindPat> {
2658 AstChildren::new(&self.syntax)
2659 }
2660}
2661#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2662pub struct RecordLit {
2663 pub(crate) syntax: SyntaxNode,
2664}
2665impl AstNode for RecordLit {
2666 fn can_cast(kind: SyntaxKind) -> bool {
2667 match kind {
2668 RECORD_LIT => true,
2669 _ => false,
2670 }
2671 }
2672 fn cast(syntax: SyntaxNode) -> Option<Self> {
2673 if Self::can_cast(syntax.kind()) {
2674 Some(Self { syntax })
2675 } else {
2676 None
2677 }
2678 }
2679 fn syntax(&self) -> &SyntaxNode {
2680 &self.syntax
2681 }
2682}
2683impl RecordLit {
2684 pub fn path(&self) -> Option<Path> {
2685 AstChildren::new(&self.syntax).next()
2686 }
2687 pub fn record_field_list(&self) -> Option<RecordFieldList> {
2688 AstChildren::new(&self.syntax).next()
2689 }
2690}
2691#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2692pub struct RecordPat {
2693 pub(crate) syntax: SyntaxNode,
2694}
2695impl AstNode for RecordPat {
2696 fn can_cast(kind: SyntaxKind) -> bool {
2697 match kind {
2698 RECORD_PAT => true,
2699 _ => false,
2700 }
2701 }
2702 fn cast(syntax: SyntaxNode) -> Option<Self> {
2703 if Self::can_cast(syntax.kind()) {
2704 Some(Self { syntax })
2705 } else {
2706 None
2707 }
2708 }
2709 fn syntax(&self) -> &SyntaxNode {
2710 &self.syntax
2711 }
2712}
2713impl RecordPat {
2714 pub fn record_field_pat_list(&self) -> Option<RecordFieldPatList> {
2715 AstChildren::new(&self.syntax).next()
2716 }
2717 pub fn path(&self) -> Option<Path> {
2718 AstChildren::new(&self.syntax).next()
2719 }
2720}
2682#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2721#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2683pub struct RefExpr { 2722pub struct RefExpr {
2684 pub(crate) syntax: SyntaxNode, 2723 pub(crate) syntax: SyntaxNode,
@@ -3018,13 +3057,13 @@ impl ast::AttrsOwner for StructDef {}
3018impl ast::DocCommentsOwner for StructDef {} 3057impl ast::DocCommentsOwner for StructDef {}
3019impl StructDef {} 3058impl StructDef {}
3020#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3059#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3021pub struct StructLit { 3060pub struct TokenTree {
3022 pub(crate) syntax: SyntaxNode, 3061 pub(crate) syntax: SyntaxNode,
3023} 3062}
3024impl AstNode for StructLit { 3063impl AstNode for TokenTree {
3025 fn can_cast(kind: SyntaxKind) -> bool { 3064 fn can_cast(kind: SyntaxKind) -> bool {
3026 match kind { 3065 match kind {
3027 STRUCT_LIT => true, 3066 TOKEN_TREE => true,
3028 _ => false, 3067 _ => false,
3029 } 3068 }
3030 } 3069 }
@@ -3039,22 +3078,15 @@ impl AstNode for StructLit {
3039 &self.syntax 3078 &self.syntax
3040 } 3079 }
3041} 3080}
3042impl StructLit { 3081impl TokenTree {}
3043 pub fn path(&self) -> Option<Path> {
3044 AstChildren::new(&self.syntax).next()
3045 }
3046 pub fn named_field_list(&self) -> Option<NamedFieldList> {
3047 AstChildren::new(&self.syntax).next()
3048 }
3049}
3050#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3082#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3051pub struct StructPat { 3083pub struct TraitDef {
3052 pub(crate) syntax: SyntaxNode, 3084 pub(crate) syntax: SyntaxNode,
3053} 3085}
3054impl AstNode for StructPat { 3086impl AstNode for TraitDef {
3055 fn can_cast(kind: SyntaxKind) -> bool { 3087 fn can_cast(kind: SyntaxKind) -> bool {
3056 match kind { 3088 match kind {
3057 STRUCT_PAT => true, 3089 TRAIT_DEF => true,
3058 _ => false, 3090 _ => false,
3059 } 3091 }
3060 } 3092 }
@@ -3069,22 +3101,25 @@ impl AstNode for StructPat {
3069 &self.syntax 3101 &self.syntax
3070 } 3102 }
3071} 3103}
3072impl StructPat { 3104impl ast::VisibilityOwner for TraitDef {}
3073 pub fn field_pat_list(&self) -> Option<FieldPatList> { 3105impl ast::NameOwner for TraitDef {}
3074 AstChildren::new(&self.syntax).next() 3106impl ast::AttrsOwner for TraitDef {}
3075 } 3107impl ast::DocCommentsOwner for TraitDef {}
3076 pub fn path(&self) -> Option<Path> { 3108impl ast::TypeParamsOwner for TraitDef {}
3109impl ast::TypeBoundsOwner for TraitDef {}
3110impl TraitDef {
3111 pub fn item_list(&self) -> Option<ItemList> {
3077 AstChildren::new(&self.syntax).next() 3112 AstChildren::new(&self.syntax).next()
3078 } 3113 }
3079} 3114}
3080#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3115#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3081pub struct TokenTree { 3116pub struct TryBlockExpr {
3082 pub(crate) syntax: SyntaxNode, 3117 pub(crate) syntax: SyntaxNode,
3083} 3118}
3084impl AstNode for TokenTree { 3119impl AstNode for TryBlockExpr {
3085 fn can_cast(kind: SyntaxKind) -> bool { 3120 fn can_cast(kind: SyntaxKind) -> bool {
3086 match kind { 3121 match kind {
3087 TOKEN_TREE => true, 3122 TRY_BLOCK_EXPR => true,
3088 _ => false, 3123 _ => false,
3089 } 3124 }
3090 } 3125 }
@@ -3099,15 +3134,16 @@ impl AstNode for TokenTree {
3099 &self.syntax 3134 &self.syntax
3100 } 3135 }
3101} 3136}
3102impl TokenTree {} 3137impl ast::TryBlockBodyOwner for TryBlockExpr {}
3138impl TryBlockExpr {}
3103#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3139#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3104pub struct TraitDef { 3140pub struct TryExpr {
3105 pub(crate) syntax: SyntaxNode, 3141 pub(crate) syntax: SyntaxNode,
3106} 3142}
3107impl AstNode for TraitDef { 3143impl AstNode for TryExpr {
3108 fn can_cast(kind: SyntaxKind) -> bool { 3144 fn can_cast(kind: SyntaxKind) -> bool {
3109 match kind { 3145 match kind {
3110 TRAIT_DEF => true, 3146 TRY_EXPR => true,
3111 _ => false, 3147 _ => false,
3112 } 3148 }
3113 } 3149 }
@@ -3122,25 +3158,19 @@ impl AstNode for TraitDef {
3122 &self.syntax 3158 &self.syntax
3123 } 3159 }
3124} 3160}
3125impl ast::VisibilityOwner for TraitDef {} 3161impl TryExpr {
3126impl ast::NameOwner for TraitDef {} 3162 pub fn expr(&self) -> Option<Expr> {
3127impl ast::AttrsOwner for TraitDef {}
3128impl ast::DocCommentsOwner for TraitDef {}
3129impl ast::TypeParamsOwner for TraitDef {}
3130impl ast::TypeBoundsOwner for TraitDef {}
3131impl TraitDef {
3132 pub fn item_list(&self) -> Option<ItemList> {
3133 AstChildren::new(&self.syntax).next() 3163 AstChildren::new(&self.syntax).next()
3134 } 3164 }
3135} 3165}
3136#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3166#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3137pub struct TryBlockExpr { 3167pub struct TupleExpr {
3138 pub(crate) syntax: SyntaxNode, 3168 pub(crate) syntax: SyntaxNode,
3139} 3169}
3140impl AstNode for TryBlockExpr { 3170impl AstNode for TupleExpr {
3141 fn can_cast(kind: SyntaxKind) -> bool { 3171 fn can_cast(kind: SyntaxKind) -> bool {
3142 match kind { 3172 match kind {
3143 TRY_BLOCK_EXPR => true, 3173 TUPLE_EXPR => true,
3144 _ => false, 3174 _ => false,
3145 } 3175 }
3146 } 3176 }
@@ -3155,16 +3185,19 @@ impl AstNode for TryBlockExpr {
3155 &self.syntax 3185 &self.syntax
3156 } 3186 }
3157} 3187}
3158impl ast::TryBlockBodyOwner for TryBlockExpr {} 3188impl TupleExpr {
3159impl TryBlockExpr {} 3189 pub fn exprs(&self) -> AstChildren<Expr> {
3190 AstChildren::new(&self.syntax)
3191 }
3192}
3160#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3193#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3161pub struct TryExpr { 3194pub struct TupleFieldDef {
3162 pub(crate) syntax: SyntaxNode, 3195 pub(crate) syntax: SyntaxNode,
3163} 3196}
3164impl AstNode for TryExpr { 3197impl AstNode for TupleFieldDef {
3165 fn can_cast(kind: SyntaxKind) -> bool { 3198 fn can_cast(kind: SyntaxKind) -> bool {
3166 match kind { 3199 match kind {
3167 TRY_EXPR => true, 3200 TUPLE_FIELD_DEF => true,
3168 _ => false, 3201 _ => false,
3169 } 3202 }
3170 } 3203 }
@@ -3179,19 +3212,21 @@ impl AstNode for TryExpr {
3179 &self.syntax 3212 &self.syntax
3180 } 3213 }
3181} 3214}
3182impl TryExpr { 3215impl ast::VisibilityOwner for TupleFieldDef {}
3183 pub fn expr(&self) -> Option<Expr> { 3216impl ast::AttrsOwner for TupleFieldDef {}
3217impl TupleFieldDef {
3218 pub fn type_ref(&self) -> Option<TypeRef> {
3184 AstChildren::new(&self.syntax).next() 3219 AstChildren::new(&self.syntax).next()
3185 } 3220 }
3186} 3221}
3187#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3222#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3188pub struct TupleExpr { 3223pub struct TupleFieldDefList {
3189 pub(crate) syntax: SyntaxNode, 3224 pub(crate) syntax: SyntaxNode,
3190} 3225}
3191impl AstNode for TupleExpr { 3226impl AstNode for TupleFieldDefList {
3192 fn can_cast(kind: SyntaxKind) -> bool { 3227 fn can_cast(kind: SyntaxKind) -> bool {
3193 match kind { 3228 match kind {
3194 TUPLE_EXPR => true, 3229 TUPLE_FIELD_DEF_LIST => true,
3195 _ => false, 3230 _ => false,
3196 } 3231 }
3197 } 3232 }
@@ -3206,8 +3241,8 @@ impl AstNode for TupleExpr {
3206 &self.syntax 3241 &self.syntax
3207 } 3242 }
3208} 3243}
3209impl TupleExpr { 3244impl TupleFieldDefList {
3210 pub fn exprs(&self) -> AstChildren<Expr> { 3245 pub fn fields(&self) -> AstChildren<TupleFieldDef> {
3211 AstChildren::new(&self.syntax) 3246 AstChildren::new(&self.syntax)
3212 } 3247 }
3213} 3248}