Skip to content

Commit 7d9a77a

Browse files
authored
Merge pull request #286 from microsoft/powershell-add-qldoc
PS: Add QLDoc to a bunch of public AST classes
2 parents 4e690b7 + 4f21586 commit 7d9a77a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+780
-4
lines changed

powershell/ql/lib/semmle/code/powershell/ast/internal/ArrayExpression.qll

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
private import AstImport
22

3+
/**
4+
* An array expression. For example:
5+
* ```
6+
* $myArray = @("text", 42, $true)
7+
* ```
8+
*
9+
* An array expression is an expression of the form `@(...)` where `...` is
10+
* a `StmtBlock` that computes the elements of the array. Often, that
11+
* `StmtBlock` is an `ArrayLiteral`, but that is not necessarily the case. For
12+
* example in:
13+
* ```
14+
* $squares = @(foreach ($n in 1..5) { $n * $n })
15+
* ```
16+
*/
317
class ArrayExpr extends Expr, TArrayExpr {
418
StmtBlock getStmtBlock() {
519
exists(Raw::Ast r | r = getRawAst(this) |

powershell/ql/lib/semmle/code/powershell/ast/internal/ArrayLiteral.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
private import AstImport
22

3+
/**
4+
* An array literal. For example:
5+
* ```
6+
* 1, 2, 3, 4
7+
* ```
8+
*/
39
class ArrayLiteral extends Expr, TArrayLiteral {
410
Expr getExpr(int index) {
511
exists(ChildIndex i, Raw::Ast r | i = arrayLiteralExpr(index) and r = getRawAst(this) |

powershell/ql/lib/semmle/code/powershell/ast/internal/AssignmentStatement.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
private import AstImport
22

3+
/**
4+
* An assignment statement. For example:
5+
* ```
6+
* $name = "John"
7+
* ```
8+
*/
39
class AssignStmt extends Stmt, TAssignStmt {
410
Expr getRightHandSide() {
511
exists(Raw::Ast r | r = getRawAst(this) |

powershell/ql/lib/semmle/code/powershell/ast/internal/Ast.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
private import AstImport
22

3+
/**
4+
* A PowerShell AST (Abstract Syntax Tree) element.
5+
*
6+
* This is the root of the PowerShell AST class hierarchy.
7+
*/
38
class Ast extends TAst {
49
string toString() { none() }
510

powershell/ql/lib/semmle/code/powershell/ast/internal/AutomaticVariable.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
private import AstImport
22

3+
/**
4+
* A PowerShell automatic variable (for example, `$PSVersionTable` or `$MyInvocation`).
5+
*/
36
class AutomaticVariable extends Expr, TAutomaticVariable {
47
final override string toString() { result = this.getLowerCaseName() }
58

0 commit comments

Comments
 (0)