title | tags | keywords | |
---|---|---|---|
Code elements |
|
code, elements, ast, meta, model |
Figure at the end of this page shows the meta model for Java executable code.
There are two main kinds of code elements.
First, statements CtStatement
(javadoc)
are untyped top-level instructions that can be used directly in a block of code.
Second, expressions CtExpression
(javadoc)
are used inside the statements. For instance, a CtLoop
(javadoc)
(which is a statement) points to CtExpression
which expresses its boolean condition.
Some code elements such as invocations and assignments are both statements
and expressions (multiple inheritance links). Concretely, this is translated as an
interface CtInvocation
(javadoc)
inheriting from both interfaces CtStatement
and CtExpression
.
The generic type of CtExpression
is used to add static type-checking when transforming programs.
