Matches a sequence of statements enclosed by curly braces.
This pattern only matches nodes of type statement.
Properties
blockStatement produces a record that contains the following properties:
| Name | Type | Description |
|---|---|---|
containedStatements |
list<statement> |
An ordered list of the statements that the block contains |
Inherits properties from:
Example
For the following blockStatement, .containedStatements contains only a
simpleStatement—specifically, an assignmentOperator,
x = 1; in the target code:
{
x = 1;
}
The following code shows a blockStatement whose
.containedStatements contains only an empty list:
{
}
The following CodeXM pattern matches blocks that contain only an empty statement (for example,
{ ; }):
pattern emptyBlockStatement {
blockStatement as bstmt where
bstmt.containedStatements.length == 1 &&
bstmt.containedStatements matches emptyStatement
};