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

Function isWithinNode

packages/language-service/src/template_target.ts:770–784  ·  view source on GitHub ↗

Checks whether a position is within an AST node.

(position: number, node: TmplAstNode)

Source from the content-addressed store, hash-verified

768
769/** Checks whether a position is within an AST node. */
770function isWithinNode(position: number, node: TmplAstNode): boolean {
771 if (!(node instanceof TmplAstHostElement)) {
772 return isWithin(position, getSpanIncludingEndTag(node));
773 }
774
775 // Host elements are special in that they don't have a contiguous source span. E.g. some bindings
776 // can be in the `host` literal in the decorator while others are on class members. That's why we
777 // need to check each binding, rather than the host element itself.
778 return (
779 (node.bindings.length > 0 &&
780 node.bindings.some((binding) => isWithin(position, binding.sourceSpan))) ||
781 (node.listeners.length > 0 &&
782 node.listeners.some((listener) => isWithin(position, listener.sourceSpan)))
783 );
784}
785
786/** Checks whether a position is within the body or the start syntax of a node. */
787function isWithinTagBody(position: number, node: TmplAstElement | TmplAstComponent): boolean {

Callers 1

visitMethod · 0.85

Calls 3

isWithinFunction · 0.90
getSpanIncludingEndTagFunction · 0.85
someMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…