- All Superinterfaces:
ASTNode,ExpressionNode,ForLoopInitializerNode,InitializerNode,SizeableNode
This represents a GNU C statement expression.
Section 6.1, GNU C language reference
A compound statement enclosed in parentheses may appear as an expression in
GNU C. This allows you to use loops, switches, and local variables within an
expression.
Recall that a compound statement is a sequence of statements surrounded by
braces; in this construct, parentheses go around the braces. For example:
({ int y = foo (); int z; if (y > 0) z = y; else z = - y; z; })
is a valid (though slightly more complex than necessary) expression for the
absolute value of foo ().
The last thing in the compound statement should be an expression followed by
a semicolon; the value of this subexpression serves as the value of the
entire construct. (If you use some other kind of statement last within the
braces, the construct has type void, and thus effectively no value.)-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.civl.abc.ast.node.IF.ASTNode
ASTNode.NodeKindNested classes/interfaces inherited from interface dev.civl.abc.ast.node.IF.expression.ExpressionNode
ExpressionNode.ExpressionKind -
Method Summary
Modifier and TypeMethodDescriptionThe last thing in the compound statement should be an expression followed by a semicolon; the value of this subexpression serves as the value of the entire construct.Methods inherited from interface dev.civl.abc.ast.node.IF.ASTNode
addAllTransformAnnotations, addTransformAnnotation, child, childIndex, children, diff, equiv, getAttribute, getOwner, getScope, getSource, id, keepOnly, nextDFS, nodeKind, numChildren, parent, prettyPrint, prettyRepresentation, prettyRepresentation, print, remove, removeChild, removeTransformAnnotation, setAttribute, setChild, setId, setOwner, setScope, toString, transformAnnotationsMethods inherited from interface dev.civl.abc.ast.node.IF.expression.ExpressionNode
addConversion, copy, expressionKind, getConversion, getConvertedType, getInitialType, getNumConversions, isConstantExpression, isLvalue, removeConversions, setInitialTypeMethods inherited from interface dev.civl.abc.ast.node.IF.declaration.InitializerNode
isSideEffectFreeMethods inherited from interface dev.civl.abc.ast.node.IF.expression.SizeableNode
getType
-
Method Details
-
getCompoundStatement
CompoundStatementNode getCompoundStatement() -
getExpression
ExpressionNode getExpression()The last thing in the compound statement should be an expression followed by a semicolon; the value of this subexpression serves as the value of the entire construct.- Returns:
- the expression at the end of this construct
-