From 607918f3e3e19edb147f0a29b596519bc327fb9e Mon Sep 17 00:00:00 2001 From: Alex Rocha Date: Wed, 7 Jan 2026 15:39:00 -0800 Subject: [PATCH] Generate location() accessor for Node enum The individual node types got location() in a previous commit but the enum itself was missed. This delegates to each variant's location() method. --- rust/ruby-rbs/build.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/rust/ruby-rbs/build.rs b/rust/ruby-rbs/build.rs index 96170bcb1..517bc37dd 100644 --- a/rust/ruby-rbs/build.rs +++ b/rust/ruby-rbs/build.rs @@ -529,6 +529,20 @@ fn generate(config: &Config) -> Result<(), Box> { )?; writeln!(file, " }}")?; writeln!(file, " }}")?; + writeln!(file)?; + writeln!(file, " /// Returns the location of the entire node.")?; + writeln!(file, " #[must_use]")?; + writeln!(file, " pub fn location(&self) -> RBSLocation {{")?; + writeln!(file, " match self {{")?; + for node in &config.nodes { + writeln!( + file, + " Node::{}(node) => node.location(),", + node.variant_name() + )?; + } + writeln!(file, " }}")?; + writeln!(file, " }}")?; writeln!(file, "}}")?; writeln!(file)?;