feat(compiler): add name spans for property reads and method calls (#36826)
ASTs for property read and method calls contain information about the entire span of the expression, including its receiver. Use cases like a language service and compile error messages may be more interested in the span of the direct identifier for which the expression is constructed (i.e. an accessed property). To support this, this commit adds a `nameSpan` property on - `PropertyRead`s - `SafePropertyRead`s - `PropertyWrite`s - `MethodCall`s - `SafeMethodCall`s The `nameSpan` property already existed for `BindingPipe`s. This commit also updates usages of these expressions' `sourceSpan`s in Ngtsc and the langauge service to use `nameSpan`s where appropriate. PR Close #36826
This commit is contained in:
@ -1428,7 +1428,7 @@ export class ValueConverter extends AstMemoryEfficientTransformer {
|
||||
// Allocate one slot for the result plus one slot per pipe argument
|
||||
const pureFunctionSlot = this.allocatePureFunctionSlots(2 + pipe.args.length);
|
||||
const target = new PropertyRead(
|
||||
pipe.span, pipe.sourceSpan, new ImplicitReceiver(pipe.span, pipe.sourceSpan),
|
||||
pipe.span, pipe.sourceSpan, pipe.nameSpan, new ImplicitReceiver(pipe.span, pipe.sourceSpan),
|
||||
slotPseudoLocal);
|
||||
const {identifier, isVarLength} = pipeBindingCallInfo(pipe.args);
|
||||
this.definePipe(pipe.name, slotPseudoLocal, slot, o.importExpr(identifier));
|
||||
|
Reference in New Issue
Block a user