JS: Add AngularPipeRef

This commit is contained in:
Asger Feldthaus
2020-12-09 13:01:36 +00:00
parent 928a382ad5
commit 16a2a60b9a
9 changed files with 79 additions and 3 deletions

View File

@@ -218,4 +218,25 @@ module Angular2 {
private class DomAdapterLocation extends DOM::LocationSource::Range {
DomAdapterLocation() { this = domAdapter().getAMethodCall("getLocation") }
}
/**
* A reference to a pipe function, occurring in an Angular pipe expression
* that has been desugared to a function call.
*
* For example, the expression `x | f: y` is desugared to `f(x, y)` where
* `f` is a `PipeRefExpr`.
*/
class PipeRefExpr extends Expr, @angular_pipe_ref {
/** Gets the identifier node naming the pipe. */
Identifier getIdentifier() {
result = getChildExpr(0)
}
/** Gets the name of the pipe being referenced. */
string getName() { result = getIdentifier().getName() }
override string getAPrimaryQlClass() {
result = "Angular2::PipeRefExpr"
}
}
}

View File

@@ -354,6 +354,7 @@ case @expr.kind of
| 116 = @assignlogandexpr
| 117 = @assignlogorexpr
| 118 = @assignnullishcoalescingexpr
| 119 = @angular_pipe_ref
;
@varaccess = @proper_varaccess | @export_varaccess;