aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2018-12-20 20:56:28 +0000
committerFlorian Diebold <[email protected]>2018-12-23 12:48:04 +0000
commit3ac605e6876056fa56098231cc2f96553faab8f0 (patch)
tree82294448f696bae2ba640c4fb74dac9b929265a3 /crates/ra_syntax
parentd77520fde3c953968beb09a3da80a0e7b17bbc04 (diff)
Add beginnings of type infrastructure
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/src/ast/generated.rs44
-rw-r--r--crates/ra_syntax/src/grammar.ron14
2 files changed, 45 insertions, 13 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index bf056131e..91f27fb26 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -523,7 +523,15 @@ impl<R: TreeRoot<RaTypes>> CastExprNode<R> {
523} 523}
524 524
525 525
526impl<'a> CastExpr<'a> {} 526impl<'a> CastExpr<'a> {
527 pub fn expr(self) -> Option<Expr<'a>> {
528 super::child_opt(self)
529 }
530
531 pub fn type_ref(self) -> Option<TypeRef<'a>> {
532 super::child_opt(self)
533 }
534}
527 535
528// Char 536// Char
529#[derive(Debug, Clone, Copy,)] 537#[derive(Debug, Clone, Copy,)]
@@ -2312,6 +2320,10 @@ impl<'a> Param<'a> {
2312 pub fn pat(self) -> Option<Pat<'a>> { 2320 pub fn pat(self) -> Option<Pat<'a>> {
2313 super::child_opt(self) 2321 super::child_opt(self)
2314 } 2322 }
2323
2324 pub fn type_ref(self) -> Option<TypeRef<'a>> {
2325 super::child_opt(self)
2326 }
2315} 2327}
2316 2328
2317// ParamList 2329// ParamList
@@ -2394,7 +2406,11 @@ impl<R: TreeRoot<RaTypes>> ParenExprNode<R> {
2394} 2406}
2395 2407
2396 2408
2397impl<'a> ParenExpr<'a> {} 2409impl<'a> ParenExpr<'a> {
2410 pub fn expr(self) -> Option<Expr<'a>> {
2411 super::child_opt(self)
2412 }
2413}
2398 2414
2399// ParenType 2415// ParenType
2400#[derive(Debug, Clone, Copy,)] 2416#[derive(Debug, Clone, Copy,)]
@@ -2829,7 +2845,11 @@ impl<R: TreeRoot<RaTypes>> PrefixExprNode<R> {
2829} 2845}
2830 2846
2831 2847
2832impl<'a> PrefixExpr<'a> {} 2848impl<'a> PrefixExpr<'a> {
2849 pub fn expr(self) -> Option<Expr<'a>> {
2850 super::child_opt(self)
2851 }
2852}
2833 2853
2834// RangeExpr 2854// RangeExpr
2835#[derive(Debug, Clone, Copy,)] 2855#[derive(Debug, Clone, Copy,)]
@@ -2940,7 +2960,11 @@ impl<R: TreeRoot<RaTypes>> RefExprNode<R> {
2940} 2960}
2941 2961
2942 2962
2943impl<'a> RefExpr<'a> {} 2963impl<'a> RefExpr<'a> {
2964 pub fn expr(self) -> Option<Expr<'a>> {
2965 super::child_opt(self)
2966 }
2967}
2944 2968
2945// RefPat 2969// RefPat
2946#[derive(Debug, Clone, Copy,)] 2970#[derive(Debug, Clone, Copy,)]
@@ -3088,7 +3112,11 @@ impl<R: TreeRoot<RaTypes>> ReturnExprNode<R> {
3088} 3112}
3089 3113
3090 3114
3091impl<'a> ReturnExpr<'a> {} 3115impl<'a> ReturnExpr<'a> {
3116 pub fn expr(self) -> Option<Expr<'a>> {
3117 super::child_opt(self)
3118 }
3119}
3092 3120
3093// SelfParam 3121// SelfParam
3094#[derive(Debug, Clone, Copy,)] 3122#[derive(Debug, Clone, Copy,)]
@@ -3578,7 +3606,11 @@ impl<R: TreeRoot<RaTypes>> TryExprNode<R> {
3578} 3606}
3579 3607
3580 3608
3581impl<'a> TryExpr<'a> {} 3609impl<'a> TryExpr<'a> {
3610 pub fn expr(self) -> Option<Expr<'a>> {
3611 super::child_opt(self)
3612 }
3613}
3582 3614
3583// TupleExpr 3615// TupleExpr
3584#[derive(Debug, Clone, Copy,)] 3616#[derive(Debug, Clone, Copy,)]
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron
index eed67637e..c43db51b6 100644
--- a/crates/ra_syntax/src/grammar.ron
+++ b/crates/ra_syntax/src/grammar.ron
@@ -346,7 +346,7 @@ Grammar(
346 346
347 "TupleExpr": (), 347 "TupleExpr": (),
348 "ArrayExpr": (), 348 "ArrayExpr": (),
349 "ParenExpr": (), 349 "ParenExpr": (options: ["Expr"]),
350 "PathExpr": (options: ["Path"]), 350 "PathExpr": (options: ["Path"]),
351 "LambdaExpr": ( 351 "LambdaExpr": (
352 options: [ 352 options: [
@@ -377,7 +377,7 @@ Grammar(
377 "BlockExpr": ( 377 "BlockExpr": (
378 options: [ "Block" ] 378 options: [ "Block" ]
379 ), 379 ),
380 "ReturnExpr": (), 380 "ReturnExpr": (options: ["Expr"]),
381 "MatchExpr": ( 381 "MatchExpr": (
382 options: [ "Expr", "MatchArmList" ], 382 options: [ "Expr", "MatchArmList" ],
383 ), 383 ),
@@ -405,10 +405,10 @@ Grammar(
405 ), 405 ),
406 "IndexExpr": (), 406 "IndexExpr": (),
407 "FieldExpr": (), 407 "FieldExpr": (),
408 "TryExpr": (), 408 "TryExpr": (options: ["Expr"]),
409 "CastExpr": (), 409 "CastExpr": (options: ["Expr", "TypeRef"]),
410 "RefExpr": (), 410 "RefExpr": (options: ["Expr"]),
411 "PrefixExpr": (), 411 "PrefixExpr": (options: ["Expr"]),
412 "RangeExpr": (), 412 "RangeExpr": (),
413 "BinExpr": (), 413 "BinExpr": (),
414 "String": (), 414 "String": (),
@@ -521,7 +521,7 @@ Grammar(
521 ), 521 ),
522 "SelfParam": (), 522 "SelfParam": (),
523 "Param": ( 523 "Param": (
524 options: [ "Pat" ], 524 options: [ "Pat", "TypeRef" ],
525 ), 525 ),
526 "UseItem": ( 526 "UseItem": (
527 options: [ "UseTree" ] 527 options: [ "UseTree" ]