Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/code-map/__tests__/parse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ describe('parse module', () => {
() => multilineCode,
)

expect(result.numLines).toBe(2) // Due to operator precedence: .match(/\n/g)?.length ?? 0 + 1 becomes (2 ?? 1) = 2
expect(result.numLines).toBe(3)
})

it('should deduplicate identifiers and calls', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/code-map/src/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export function parseTokens(
calls: [] as string[],
}
}
const numLines = sourceCode.match(/\n/g)?.length ?? 0 + 1
const numLines = (sourceCode.match(/\n/g)?.length ?? 0) + 1
if (!parser || !query) {
throw new Error('Parser or query not found')
}
Expand Down
Loading