MCPcopy Create free account
hub / github.com/CashScript/cashscript / fromCtx

Method fromCtx

packages/cashc/src/ast/Location.ts:7–15  ·  view source on GitHub ↗
(ctx: ParserRuleContext)

Source from the content-addressed store, hash-verified

5 constructor(public start: Point, public end: Point) {}
6
7 static fromCtx(ctx: ParserRuleContext): Location {
8 const stop = ctx.stop?.text ? ctx.stop : ctx.start;
9 const textLength = (stop.text ?? '').length;
10
11 const start = new Point(ctx.start.line, ctx.start.column);
12 const end = new Point(stop.line, stop.column + textLength);
13
14 return new Location(start, end);
15 }
16
17 static fromToken(token: Token): Location {
18 const textLength = (token.text ?? '').length;

Callers 15

visitSourceFileMethod · 0.80
visitFunctionBodyMethod · 0.80
visitParameterMethod · 0.80
visitStatementMethod · 0.80
visitTupleAssignmentMethod · 0.80
visitAssignStatementMethod · 0.80
visitTimeOpStatementMethod · 0.80
visitRequireStatementMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected