From 8e6c77e643d59b9fd42d8794760b71a9d118d059 Mon Sep 17 00:00:00 2001 From: OmarTawfik <15987992+OmarTawfik@users.noreply.github.com> Date: Tue, 28 Nov 2023 14:57:27 -0800 Subject: [PATCH] rename `Cursor::path_rule_nodes` to `ancestors` matching the Rust API --- .changeset/stupid-jobs-decide.md | 5 +++++ crates/codegen/parser/runtime/src/napi/napi_cursor.rs | 2 +- .../outputs/cargo/crate/src/generated/napi/napi_cursor.rs | 2 +- .../outputs/npm/crate/src/generated/napi/napi_cursor.rs | 2 +- crates/solidity/outputs/npm/package/src/generated/index.d.ts | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 .changeset/stupid-jobs-decide.md diff --git a/.changeset/stupid-jobs-decide.md b/.changeset/stupid-jobs-decide.md new file mode 100644 index 0000000000..714d452e7b --- /dev/null +++ b/.changeset/stupid-jobs-decide.md @@ -0,0 +1,5 @@ +--- +"@nomicfoundation/slang": minor +--- + +rename `Cursor`'s `pathRuleNodes()` to `ancestors()` in the NodeJS API. diff --git a/crates/codegen/parser/runtime/src/napi/napi_cursor.rs b/crates/codegen/parser/runtime/src/napi/napi_cursor.rs index 153290358f..9b0966e484 100644 --- a/crates/codegen/parser/runtime/src/napi/napi_cursor.rs +++ b/crates/codegen/parser/runtime/src/napi/napi_cursor.rs @@ -63,7 +63,7 @@ impl Cursor { } #[napi(ts_return_type = "Array")] - pub fn path_rule_nodes(&self, env: Env) -> Vec { + pub fn ancestors(&self, env: Env) -> Vec { self.0 .ancestors() .map(|rust_rule_node| rust_rule_node.to_js(&env)) diff --git a/crates/solidity/outputs/cargo/crate/src/generated/napi/napi_cursor.rs b/crates/solidity/outputs/cargo/crate/src/generated/napi/napi_cursor.rs index 5cc54070d1..e012a2fc38 100644 --- a/crates/solidity/outputs/cargo/crate/src/generated/napi/napi_cursor.rs +++ b/crates/solidity/outputs/cargo/crate/src/generated/napi/napi_cursor.rs @@ -65,7 +65,7 @@ impl Cursor { } #[napi(ts_return_type = "Array")] - pub fn path_rule_nodes(&self, env: Env) -> Vec { + pub fn ancestors(&self, env: Env) -> Vec { self.0 .ancestors() .map(|rust_rule_node| rust_rule_node.to_js(&env)) diff --git a/crates/solidity/outputs/npm/crate/src/generated/napi/napi_cursor.rs b/crates/solidity/outputs/npm/crate/src/generated/napi/napi_cursor.rs index 5cc54070d1..e012a2fc38 100644 --- a/crates/solidity/outputs/npm/crate/src/generated/napi/napi_cursor.rs +++ b/crates/solidity/outputs/npm/crate/src/generated/napi/napi_cursor.rs @@ -65,7 +65,7 @@ impl Cursor { } #[napi(ts_return_type = "Array")] - pub fn path_rule_nodes(&self, env: Env) -> Vec { + pub fn ancestors(&self, env: Env) -> Vec { self.0 .ancestors() .map(|rust_rule_node| rust_rule_node.to_js(&env)) diff --git a/crates/solidity/outputs/npm/package/src/generated/index.d.ts b/crates/solidity/outputs/npm/package/src/generated/index.d.ts index f2262e1a2c..82af479e44 100644 --- a/crates/solidity/outputs/npm/package/src/generated/index.d.ts +++ b/crates/solidity/outputs/npm/package/src/generated/index.d.ts @@ -664,7 +664,7 @@ export namespace cursor { node(): cst.RuleNode | cst.TokenNode; get textOffset(): text_index.TextIndex; get textRange(): text_index.TextRange; - pathRuleNodes(): Array; + ancestors(): Array; goToNext(): boolean; goToNextNonDescendent(): boolean; goToPrevious(): boolean;