public class StaticTypesStatementWriter
extends StatementWriter
A class to write out the optimized statements.
| Fields inherited from class | Fields |
|---|---|
class StatementWriter |
controller |
| Constructor and description |
|---|
StaticTypesStatementWriter(StaticTypesWriterController controller)Creates a statement writer that favors statically typed loop and block generation. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public void |
writeBlockStatement(BlockStatement statement)* Generates bytecode for a block statement by visiting each contained statement. * Pushes the block's variable scope, emits the statements, and pops afterward. * Named labels on the block create a breakable region so that break label
* within the block jumps to the end of it.
*
*
|
|
protected void |
writeForInLoop(ForStatement loop)* Generates bytecode for a for-in loop by calling iterator() on the
* collection expression and delegating loop control to
* writeForInLoopControlAndBlock.
*
*
|
|
protected void |
writeIsCaseComparison(CaseStatement caseStatement, int selectorIndex, ClassNode selectorType)Emits the isCase call the type checker selected, so a label in
statement position resolves the same method it would in a switch
expression (GROOVY-12407). |
|
public void |
writeSwitch(SwitchStatement statement)Emits a jump table when the selector and labels are constants of a type javac would switch on, matching what a statically compiled switch
expression already gets (GROOVY-12405). |
Creates a statement writer that favors statically typed loop and block generation.
* Generates bytecode for a block statement by visiting each contained statement.
* Pushes the block's variable scope, emits the statements, and pops afterward.
* Named labels on the block create a breakable region so that break label
* within the block jumps to the end of it.
*
*
block - the block statement to compile
* Generates bytecode for a for-in loop by calling iterator() on the
* collection expression and delegating loop control to
* writeForInLoopControlAndBlock.
*
*
statement - the for-in statement to compile Emits the isCase call the type checker selected, so a label in
statement position resolves the same method it would in a switch
expression (GROOVY-12407). Arms with no selected target, including
case null and anything under TypeCheckingMode.SKIP,
keep the dynamic comparison.
Emits a jump table when the selector and labels are constants of a type
javac would switch on, matching what a statically compiled switch
expression already gets (GROOVY-12405). Anything else, including repeated
labels, falls back to the sequential isCase chain.
Copyright © 2003-2026 The Apache Software Foundation. All rights reserved.