Skip to content

Commit 50188a2

Browse files
committed
PS: Drive-by: Fix toString on Cmd.
1 parent 86a40b9 commit 50188a2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

powershell/ql/lib/semmle/code/powershell/Command.qll

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,14 @@ private predicate parseCommandName(Cmd cmd, string namespace, string name) {
1414

1515
/** A call to a command. */
1616
class Cmd extends @command, CmdBase {
17-
override string toString() { result = "call to " + this.getQualifiedCommandName() }
17+
override string toString() {
18+
exists(string name | name = this.getQualifiedCommandName() |
19+
if name = "" then result = "call" else result = "call to " + name
20+
)
21+
or
22+
not exists(this.getQualifiedCommandName()) and
23+
result = "call"
24+
}
1825

1926
override SourceLocation getLocation() { command_location(this, result) }
2027

0 commit comments

Comments
 (0)