about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorOliver Schneider <github35764891676564198441@oli-obk.de>2018-06-27 11:25:22 +0200
committerOliver Schneider <github35764891676564198441@oli-obk.de>2018-06-27 11:25:22 +0200
commit5bd9eaa1ad20c3a84b162a825350f7b4c532e7ae (patch)
tree90476fbb54f00eef93fef844c7dd7404cf391fc9 /src/libsyntax
parenta85b27915fe8d7b077535cd3fd8a7e1bafb1469d (diff)
downloadrust-5bd9eaa1ad20c3a84b162a825350f7b4c532e7ae.tar.gz
rust-5bd9eaa1ad20c3a84b162a825350f7b4c532e7ae.zip
Add a convenience method for getting the impl Trait `NodeId` of an `IsAysnc`
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index d38af6a6088..d767265ead9 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -1737,6 +1737,13 @@ impl IsAsync {
             false
         }
     }
+    /// In case this is an `Async` return the `NodeId` for the generated impl Trait item
+    pub fn opt_return_id(self) -> Option<NodeId> {
+        match self {
+            IsAsync::Async { return_impl_trait_id, .. } => Some(return_impl_trait_id),
+            IsAsync::NotAsync => None,
+        }
+    }
 }
 
 #[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]