Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
private import AstImport

/**
* An array expression. For example:
* ```
* $myArray = @("text", 42, $true)
* ```
*
* An array expression is an expression of the form `@(...)` where `...` is
* a `StmtBlock` that computes the elements of the array. Often, that
* `StmtBlock` is an `ArrayLiteral`, but that is not necessarily the case. For
* example in:
* ```
* $squares = @(foreach ($n in 1..5) { $n * $n })
* ```
*/
class ArrayExpr extends Expr, TArrayExpr {
StmtBlock getStmtBlock() {
exists(Raw::Ast r | r = getRawAst(this) |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
private import AstImport

/**
* An array literal. For example:
* ```
* 1, 2, 3, 4
* ```
*/
class ArrayLiteral extends Expr, TArrayLiteral {
Expr getExpr(int index) {
exists(ChildIndex i, Raw::Ast r | i = arrayLiteralExpr(index) and r = getRawAst(this) |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
private import AstImport

/**
* An assignment statement. For example:
* ```
* $name = "John"
* ```
*/
class AssignStmt extends Stmt, TAssignStmt {
Expr getRightHandSide() {
exists(Raw::Ast r | r = getRawAst(this) |
Expand Down
5 changes: 5 additions & 0 deletions powershell/ql/lib/semmle/code/powershell/ast/internal/Ast.qll
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
private import AstImport

/**
* A PowerShell AST (Abstract Syntax Tree) element.
*
* This is the root of the PowerShell AST class hierarchy.
*/
class Ast extends TAst {
string toString() { none() }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
private import AstImport

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

Expand Down
Loading
Loading