MCPcopy Index your code
hub / github.com/angular/angular / moveBy

Method moveBy

packages/compiler/src/parse_util.ts:23–55  ·  view source on GitHub ↗
(delta: number)

Source from the content-addressed store, hash-verified

21 }
22
23 moveBy(delta: number): ParseLocation {
24 const source = this.file.content;
25 const len = source.length;
26 let offset = this.offset;
27 let line = this.line;
28 let col = this.col;
29 while (offset > 0 && delta < 0) {
30 offset--;
31 delta++;
32 const ch = source.charCodeAt(offset);
33 if (ch == chars.$LF) {
34 line--;
35 const priorLine = source
36 .substring(0, offset - 1)
37 .lastIndexOf(String.fromCharCode(chars.$LF));
38 col = priorLine > 0 ? offset - priorLine : offset;
39 } else {
40 col--;
41 }
42 }
43 while (offset < len && delta > 0) {
44 const ch = source.charCodeAt(offset);
45 offset++;
46 delta--;
47 if (ch == chars.$LF) {
48 line++;
49 col = 0;
50 } else {
51 col++;
52 }
53 }
54 return new ParseLocation(this.file, offset, line, col);
55 }
56
57 // Return the source around the location
58 // Up to `maxChars` or `maxLines` on each side of the location

Callers 15

createSourceSpanFunction · 0.95
_consumeLetMethod · 0.80
_consumeIncompleteLetMethod · 0.80
parseForLoopParametersFunction · 0.80
parseLetParameterFunction · 0.80
parseNeverTriggerFunction · 0.80
parseWhenTriggerFunction · 0.80
parseOnTriggerFunction · 0.80
getPrefetchSpanFunction · 0.80
getHydrateSpanFunction · 0.80
consumeTriggerMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected