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

Function mergeTextTokens

packages/compiler/src/ml_parser/lexer.ts:1529–1549  ·  view source on GitHub ↗
(srcTokens: Token[])

Source from the content-addressed store, hash-verified

1527}
1528
1529function mergeTextTokens(srcTokens: Token[]): Token[] {
1530 const dstTokens: Token[] = [];
1531 let lastDstToken: Token | undefined = undefined;
1532 for (let i = 0; i < srcTokens.length; i++) {
1533 const token = srcTokens[i];
1534 if (
1535 (lastDstToken && lastDstToken.type === TokenType.TEXT && token.type === TokenType.TEXT) ||
1536 (lastDstToken &&
1537 lastDstToken.type === TokenType.ATTR_VALUE_TEXT &&
1538 token.type === TokenType.ATTR_VALUE_TEXT)
1539 ) {
1540 lastDstToken.parts[0]! += token.parts[0];
1541 lastDstToken.sourceSpan.end = token.sourceSpan.end;
1542 } else {
1543 lastDstToken = token;
1544 dstTokens.push(lastDstToken);
1545 }
1546 }
1547
1548 return dstTokens;
1549}
1550
1551/**
1552 * The _Tokenizer uses objects of this type to move through the input text,

Callers 1

tokenizeFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…