- changed status to resolved
Remove enum index side effects
Issue #137
resolved
ExtendJ 8.0.1-45-gedaf31d
ExtendJ adds one method and field for each switch statement with an enum-typed switch expression. This is done in order to transform the switch from an enum-indexed switch to an integer-indexed switch. However, the transformation is currently done using side effects. As usual this has several down-sides and it would thus be nice to remove these side effects.
I have been working on a refactoring to remove these side effects which works by using NTAs to compute the extra fields/methods. These NTAs are used during code generation, but only if there exist enum switch statements.
Comments (1)
-
reporter - Log in to comment
Replace enum index transformations
Enum indexed switch statements are transformed by ExtendJ to integer indexed switch statements during code generation. One extra field and method is generated per switch statement using an enum expression. These are called enum index fields/methods and they used to be inserted directly into the AST during the transformation phase using side effects.
This side-effect driven way of inserting enum index fields/methods has been replaced by using NTAs instead. Using NTAs enables computing the needed fields and methods on demand during code generation, fully declaratively without using side effects.
Some new helper attributes were added to complete this refactoring:
fixes
#137(bitbucket)→ <<cset 0f26e2672f6c>>