fix(native): remove unused source param from get_first_call_arg#1960
Open
carlos-alm wants to merge 1 commit into
Conversation
The JS/TS extractor's get_first_call_arg helper never used its source parameter — it only needs node structure (child kinds) to locate the first non-punctuation call argument, matching the WASM/TS mirror (getFirstCallArg in src/extractors/javascript.ts), which never took a source parameter at all. Removed it and updated the three call sites (eval() key_expr capture, Reflect.apply, Reflect.construct), silencing the dead-parameter compiler warning. Added native unit tests covering all three call sites so a future change to this helper's signature or behavior is caught by cargo test.
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get_first_call_argincrates/codegraph-core/src/extractors/javascript.rstook asource: &[u8]parameter it never used — it only inspects node structure (child kinds viachild_by_field_name/find_child) to locate the first non-punctuation call argument, never callingnode_texton it internally.getFirstCallArginsrc/extractors/javascript.ts, has never taken a source parameter at all — it doesn't need one becauseTreeSitterNodealready carries.textinline (a web-tree-sitter API difference from nativetree_sitter::Node, which needs a separate source buffer only when extracting text, not when just returning a node handle).get_first_call_argand updated its three call sites (eval()string-literalkey_exprcapture,Reflect.apply,Reflect.construct) to match. No behavior change — callers already had their ownsourcein scope for their ownnode_textcalls on the returned node.Fixes #1817
Test plan
cargo testincrates/codegraph-core— 522 passed, 0 failed (including 5 new tests:eval_captures_string_literal_key_expr,eval_with_non_literal_arg_has_no_key_expr,reflect_apply_extracts_first_arg_as_callee,reflect_construct_extracts_first_arg_as_callee,reflect_apply_member_expression_arg_extracts_property_with_receiver)cargo check --release/cargo clippy --release— the original dead-parameter warning is gone; no new warnings introducedtests/engines/dynamic-call-ffi.test.tsandtests/integration/build-parity.test.ts(native vs WASM parity)npm run lint— cleanStacked on #1815 (base branch
fix/issue-1815-same-f-file-array-vs-string-native-crash) — only thecrates/codegraph-core/src/extractors/javascript.rsdiff is this issue's change.