Package de.fraunhofer.aisec.cpg.graph
Interface StatementHolder
- All Known Implementing Classes:
CompoundStatement,NamespaceDeclaration,RecordDeclaration,TranslationUnitDeclaration
public interface StatementHolder
This interface denotes an AST-Node that can contain code. This code is stored as statements. This
includes Translation units namespaces and classes as some languages, mainly scripting languages
allow code placement outside of explicit functions.
The reason for not only using a statement property that encapsulates all code in an implicit compound statements is that code can be distributed between functions and an encapsulating compound statement would imply a block of code with a code region containing only the statements.
-
Method Summary
Modifier and Type Method Description default voidaddStatement(Statement s)Adds the specified statement to this statement holder.@NonNull java.util.List<de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge<Statement>>getStatementEdges()Getter to be implemented by implementing classes to gain read access to the classes member.default @NonNull java.util.List<Statement>getStatements()Returns the list of contained statements.default @NonNull java.util.List<de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge<Statement>>getStatementsPropertyEdge()voidsetStatementEdges(@NonNull java.util.List<de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge<Statement>> statements)default voidsetStatements(@NonNull java.util.List<Statement> statements)
-
Method Details
-
getStatementEdges
@NonNull java.util.List<de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge<Statement>> getStatementEdges()Getter to be implemented by implementing classes to gain read access to the classes member.- Returns:
- List of property Edge statements
-
setStatementEdges
void setStatementEdges(@NonNull java.util.List<de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge<Statement>> statements) -
getStatements
Returns the list of contained statements.- Returns:
- contained statements
-
getStatementsPropertyEdge
default @NonNull java.util.List<de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge<Statement>> getStatementsPropertyEdge() -
setStatements
-
addStatement
Adds the specified statement to this statement holder. The statements have to be stored as a list of statements as we try to avoid adding new AST-nodes that do not exist, e.g. a code body to hold statements- Parameters:
s- the statement
-