MCPcopy Create free account
hub / github.com/arktypeio/arktype / getCallLocationFromCallExpression

Function getCallLocationFromCallExpression

ark/attest/cache/utils.ts:16–39  ·  view source on GitHub ↗
(
	callExpression: ts.CallExpression
)

Source from the content-addressed store, hash-verified

14} from "./ts.ts"
15
16export const getCallLocationFromCallExpression = (
17 callExpression: ts.CallExpression
18): LinePositionRange => {
19 const start = ts.getLineAndCharacterOfPosition(
20 callExpression.getSourceFile(),
21 callExpression.getStart()
22 )
23 const end = ts.getLineAndCharacterOfPosition(
24 callExpression.getSourceFile(),
25 callExpression.getEnd()
26 )
27 // Add 1 to everything, since trace positions are 1-based and TS positions are 0-based.
28 const location: LinePositionRange = {
29 start: {
30 line: start.line + 1,
31 char: start.character + 1
32 },
33 end: {
34 line: end.line + 1,
35 char: end.character + 1
36 }
37 }
38 return location
39}
40
41/**
42 * Processes inline instantiations from an attest call

Callers 2

analyzeAssertCallFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected