Skip to content

Commit de0394b

Browse files
committed
Merge remote-tracking branch 'origin/feat/prototype-resolver-1317' into fix/proto-complexity-metrics-1340
2 parents aff5719 + 8ad9fb2 commit de0394b

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/domain/wasm-worker-protocol.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ export interface SerializedExtractorOutput {
7070
arrayCallbackBindings?: import('../types.js').ArrayCallbackBinding[];
7171
objectRestParamBindings?: import('../types.js').ObjectRestParamBinding[];
7272
objectPropBindings?: import('../types.js').ObjectPropBinding[];
73+
paramBindings?: import('../types.js').ParamBinding[];
7374
newExpressions?: readonly string[];
7475
returnTypeMap?: Array<[string, TypeMapEntry]>;
7576
callAssignments?: CallAssignment[];

src/extractors/javascript.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2070,7 +2070,14 @@ function extractObjectRestParamBindingsWalk(
20702070
if (depth >= MAX_WALK_DEPTH) return;
20712071
const t = node.type;
20722072
if (t === 'function_declaration' || t === 'function_expression' || t === 'arrow_function') {
2073-
const nameNode = node.childForFieldName('name');
2073+
// `function_declaration` has a `name` field; `arrow_function` and
2074+
// `function_expression` do not — get the name from the enclosing
2075+
// `variable_declarator` instead (e.g. `const f3 = ({ ...rest }) => {}`).
2076+
const nameNode =
2077+
node.childForFieldName('name') ??
2078+
(node.parent?.type === 'variable_declarator'
2079+
? node.parent.childForFieldName('name')
2080+
: null);
20742081
const funcName = nameNode?.text;
20752082
if (funcName) {
20762083
const paramsNode =

0 commit comments

Comments
 (0)