From 19fe0f6a9161e35d1415203b574b033327699a03 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 22 Apr 2023 00:47:07 +0200 Subject: [PATCH] AST: implement try_source_range for union fields Still not sure where the union fields are going. I don't think they should implement Node. --- fish-rust/src/ast.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fish-rust/src/ast.rs b/fish-rust/src/ast.rs index 992ee4daf..95c46383a 100644 --- a/fish-rust/src/ast.rs +++ b/fish-rust/src/ast.rs @@ -1952,6 +1952,9 @@ impl ArgumentOrRedirectionVariant { pub fn typ(&self) -> Type { self.embedded_node().typ() } + pub fn try_source_range(&self) -> Option { + self.embedded_node().try_source_range() + } fn embedded_node(&self) -> &dyn NodeMut { match self { ArgumentOrRedirectionVariant::Argument(node) => node, @@ -2045,6 +2048,9 @@ impl StatementVariant { pub fn typ(&self) -> Type { self.embedded_node().typ() } + pub fn try_source_range(&self) -> Option { + self.embedded_node().try_source_range() + } fn embedded_node(&self) -> &dyn NodeMut { match self { StatementVariant::None => panic!("cannot visit null statement"), @@ -2129,6 +2135,9 @@ impl BlockStatementHeaderVariant { pub fn typ(&self) -> Type { self.embedded_node().typ() } + pub fn try_source_range(&self) -> Option { + self.embedded_node().try_source_range() + } fn embedded_node(&self) -> &dyn NodeMut { match self { BlockStatementHeaderVariant::None => panic!("cannot visit null block header"),