trait AST transformation to change the receiver of a message on "this" into a static method call on the trait helper
class.
In a nutshell, code like the following method definition in a trait: void foo() { this.bar() } is
transformed into: void foo() { TraitHelper$bar(this) }
| Modifier and Type | Field and Description |
|---|---|
| private final ClassNode | |
| private boolean | |
| private final Collection | |
| private final ClassNode | |
| private final ClassNode | |
| private final SourceUnit | |
| private final VariableExpression |
| Access | Constructor and Description |
|---|---|
| public | TraitReceiverTransformer(final VariableExpression thisObject, final SourceUnit unit, final ClassNode traitClass, final ClassNode traitHelperClass, final ClassNode fieldHelper, final Collection<String> knownFields)
|
| Modifier and Type | Method and Description |
|---|---|
| private Expression | |
| private ArgumentListExpression | |
| private Expression | |
| protected SourceUnit | |
| private static void | |
| private void | |
| public Expression | transform(final Expression exp)
Overrides org. Implements org. |
| private Expression | |
| private Expression | |
| private Expression | |
| private Expression | |
| private static FieldNode |
| fieldHelper | back to summary |
|---|---|
| private final ClassNode fieldHelper | |
| inClosure | back to summary |
|---|---|
| private boolean inClosure | |
| knownFields | back to summary |
|---|---|
| private final Collection<String> knownFields | |
| traitClass | back to summary |
|---|---|
| private final ClassNode traitClass | |
| traitHelperClass | back to summary |
|---|---|
| private final ClassNode traitHelperClass | |
| unit | back to summary |
|---|---|
| private final SourceUnit unit | |
| weaved | back to summary |
|---|---|
| private final VariableExpression weaved | |
| TraitReceiverTransformer | back to summary |
|---|---|
| public TraitReceiverTransformer(final VariableExpression thisObject, final SourceUnit unit, final ClassNode traitClass, final ClassNode traitHelperClass, final ClassNode fieldHelper, final Collection<String> knownFields) | |
| asClass | back to summary |
|---|---|
| private Expression asClass(final Expression e) | |
| createArgumentList | back to summary |
|---|---|
| private ArgumentListExpression createArgumentList(final Expression self, final Expression arguments) | |
| createFieldHelperReceiver | back to summary |
|---|---|
| private Expression createFieldHelperReceiver() | |
| getSourceUnit | back to summary |
|---|---|
| protected SourceUnit getSourceUnit() Implements abstract org.
| |
| markDynamicCall | back to summary |
|---|---|
| private static void markDynamicCall(final MethodCallExpression mce, final FieldNode fn, final boolean isStatic) | |
| throwSuperError | back to summary |
|---|---|
| private void throwSuperError(final ASTNode node) | |
| transform | back to summary |
|---|---|
| public Expression transform(final Expression exp) Overrides org. Implements org. Doc from org. Transforms the given expression into another expression
| |
| transformBinaryExpression | back to summary |
|---|---|
| private Expression transformBinaryExpression(final BinaryExpression exp, final ClassNode weavedType) | |
| transformFieldReference | back to summary |
|---|---|
| private Expression transformFieldReference(final Expression exp, final FieldNode fn, final boolean isStatic) | |
| transformMethodCallOnThis | back to summary |
|---|---|
| private Expression transformMethodCallOnThis(final MethodCallExpression call) | |
| transformSuperMethodCall | back to summary |
|---|---|
| private Expression transformSuperMethodCall(final MethodCallExpression call) | |
| tryGetFieldNode | back to summary |
|---|---|
| private static FieldNode tryGetFieldNode(final ClassNode weavedType, final String fieldName) | |