mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-28 20:34:07 +08:00
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.
This commit is contained in:
parent
4c46faea99
commit
19fe0f6a91
|
@ -1952,6 +1952,9 @@ impl ArgumentOrRedirectionVariant {
|
|||
pub fn typ(&self) -> Type {
|
||||
self.embedded_node().typ()
|
||||
}
|
||||
pub fn try_source_range(&self) -> Option<SourceRange> {
|
||||
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<SourceRange> {
|
||||
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<SourceRange> {
|
||||
self.embedded_node().try_source_range()
|
||||
}
|
||||
fn embedded_node(&self) -> &dyn NodeMut {
|
||||
match self {
|
||||
BlockStatementHeaderVariant::None => panic!("cannot visit null block header"),
|
||||
|
|
Loading…
Reference in New Issue
Block a user