mirror of
https://github.com/github/codeql.git
synced 2026-04-29 18:55:14 +02:00
JS: Add test and fix bug in pipe parser
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
<other-component
|
||||
[prop]="foo | bar"
|
||||
[prop2]="foo | bar:'baz'"
|
||||
></other-component>
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Component } from "@angular/core";
|
||||
|
||||
@Component({
|
||||
selector: "foo-component",
|
||||
templateUrl: "./foo.component.html"
|
||||
})
|
||||
export class Foo {
|
||||
foo: string;
|
||||
|
||||
constructor() {
|
||||
this.foo = "hello";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
pipeRef
|
||||
| foo.component.html:2:19:2:21 | bar |
|
||||
| foo.component.html:3:20:3:28 | bar:'baz' |
|
||||
pipeCall
|
||||
| foo.component.html:2:13:2:21 | foo \| bar |
|
||||
| foo.component.html:3:14:3:28 | foo \| bar:'baz' |
|
||||
pipeCallArg
|
||||
| 0 | foo.component.html:2:13:2:15 | foo | foo.component.html:2:13:2:21 | foo \| bar |
|
||||
| 0 | foo.component.html:3:14:3:16 | foo | foo.component.html:3:14:3:28 | foo \| bar:'baz' |
|
||||
| 1 | foo.component.html:3:24:3:28 | 'baz' | foo.component.html:3:14:3:28 | foo \| bar:'baz' |
|
||||
12
javascript/ql/test/library-tests/frameworks/Angular2/test.ql
Normal file
12
javascript/ql/test/library-tests/frameworks/Angular2/test.ql
Normal file
@@ -0,0 +1,12 @@
|
||||
import javascript
|
||||
|
||||
query Angular2::PipeRefExpr pipeRef() { any() }
|
||||
|
||||
query CallExpr pipeCall() {
|
||||
result.getCallee() instanceof Angular2::PipeRefExpr
|
||||
}
|
||||
|
||||
query CallExpr pipeCallArg(int i, Expr arg) {
|
||||
result.getCallee() instanceof Angular2::PipeRefExpr and
|
||||
result.getArgument(i) = arg
|
||||
}
|
||||
Reference in New Issue
Block a user