Repository navigation
feat(node-loader): disambiguate ObjectPattern and ArrayPattern parameters for signature discovery - #950
Merged
viferga merged 3 commits intoNov 15, 2026
Conversation
TheDoomBoy-jab
force-pushed
the
fix/node-loader-object-pattern
branch
from
November 6, 2026 14:13
f2b3181 to
681c61a
Compare
Member
|
I ran the CI, I have a question, what's the array that you left as TODO? Can you implement it too? |
Contributor
Author
|
@viferga so like an arraypattern is when the args map into an array for the ast, example args when passed like this |
Member
|
Can you add a call to each function to validate it also works? |
Contributor
Author
|
on it |
Contributor
Author
|
added the function calls in the test |
Member
|
Excellent mate, running the CI. |
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.
This PR implements parameter disambiguation for destructured objects (
ObjectPattern) and arrays (ArrayPattern) vs positional parameters in the Node.js loader reflection mechanism.•
bootstrap.js:• Detects
ObjectPatternand default-assignedObjectPatternin the AST and marks their parameter type as'Map'.• Detects
ArrayPatternand default-assignedArrayPatternin the AST and marks their parameter type as'Array'.• Maintains 1-to-1 index alignment between
argsandtypes, pushingnullfor regular positional parameters.• Exposes
typeson the discovery descriptor only when typed parameters are present.•
node_loader_impl.cpp:• Adds
napi_typeofcheck onparameter_typebefore attempting string conversion.• If
valuetype == napi_string, retrieves the type string and callssignature_set(...)withloader_impl_type(...).• If
valuetype != napi_string(e.g.nullfor positional parameters in mixed signatures likefoo(x, { a, b })), gracefully registers the parameter as untyped (NULL) without throwing N-API type errors.•
metacall_node_test.cpp:• Tests parameter type inspection (
METACALL_MAP,METACALL_ARRAY) and validates end-to-end function invocation and return values for both destructured map and array functions.