mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-29 06:13:20 +00: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
1 changed files with 9 additions and 0 deletions
|
@ -1952,6 +1952,9 @@ impl ArgumentOrRedirectionVariant {
|
||||||
pub fn typ(&self) -> Type {
|
pub fn typ(&self) -> Type {
|
||||||
self.embedded_node().typ()
|
self.embedded_node().typ()
|
||||||
}
|
}
|
||||||
|
pub fn try_source_range(&self) -> Option<SourceRange> {
|
||||||
|
self.embedded_node().try_source_range()
|
||||||
|
}
|
||||||
fn embedded_node(&self) -> &dyn NodeMut {
|
fn embedded_node(&self) -> &dyn NodeMut {
|
||||||
match self {
|
match self {
|
||||||
ArgumentOrRedirectionVariant::Argument(node) => node,
|
ArgumentOrRedirectionVariant::Argument(node) => node,
|
||||||
|
@ -2045,6 +2048,9 @@ impl StatementVariant {
|
||||||
pub fn typ(&self) -> Type {
|
pub fn typ(&self) -> Type {
|
||||||
self.embedded_node().typ()
|
self.embedded_node().typ()
|
||||||
}
|
}
|
||||||
|
pub fn try_source_range(&self) -> Option<SourceRange> {
|
||||||
|
self.embedded_node().try_source_range()
|
||||||
|
}
|
||||||
fn embedded_node(&self) -> &dyn NodeMut {
|
fn embedded_node(&self) -> &dyn NodeMut {
|
||||||
match self {
|
match self {
|
||||||
StatementVariant::None => panic!("cannot visit null statement"),
|
StatementVariant::None => panic!("cannot visit null statement"),
|
||||||
|
@ -2129,6 +2135,9 @@ impl BlockStatementHeaderVariant {
|
||||||
pub fn typ(&self) -> Type {
|
pub fn typ(&self) -> Type {
|
||||||
self.embedded_node().typ()
|
self.embedded_node().typ()
|
||||||
}
|
}
|
||||||
|
pub fn try_source_range(&self) -> Option<SourceRange> {
|
||||||
|
self.embedded_node().try_source_range()
|
||||||
|
}
|
||||||
fn embedded_node(&self) -> &dyn NodeMut {
|
fn embedded_node(&self) -> &dyn NodeMut {
|
||||||
match self {
|
match self {
|
||||||
BlockStatementHeaderVariant::None => panic!("cannot visit null block header"),
|
BlockStatementHeaderVariant::None => panic!("cannot visit null block header"),
|
||||||
|
|
Loading…
Reference in a new issue