org.jetbrains.kotlin.codegen.when
Class SwitchCodegen

java.lang.Object
  extended by org.jetbrains.kotlin.codegen.when.SwitchCodegen
Direct Known Subclasses:
EnumSwitchCodegen, IntegralConstantsSwitchCodegen, StringSwitchCodegen

public abstract class SwitchCodegen
extends java.lang.Object


Field Summary
protected  BindingContext bindingContext
           
protected  ExpressionCodegen codegen
           
protected  org.jetbrains.org.objectweb.asm.Label defaultLabel
           
protected  org.jetbrains.org.objectweb.asm.Label elseLabel
           
protected  org.jetbrains.org.objectweb.asm.Label endLabel
           
protected  java.util.List<org.jetbrains.org.objectweb.asm.Label> entryLabels
           
protected  KtWhenExpression expression
           
protected  boolean isStatement
           
protected  org.jetbrains.org.objectweb.asm.Type resultType
           
protected  org.jetbrains.org.objectweb.asm.Type subjectType
           
protected  java.util.NavigableMap<java.lang.Integer,org.jetbrains.org.objectweb.asm.Label> transitionsTable
           
protected  org.jetbrains.org.objectweb.asm.commons.InstructionAdapter v
           
 
Constructor Summary
SwitchCodegen(KtWhenExpression expression, boolean isStatement, ExpressionCodegen codegen)
           
 
Method Summary
 void generate()
          Generates bytecode for entire when expression
protected  void generateEntries()
           
protected  void generateNullCheckIfNeeded()
           
protected  void generateSubject()
          Should generate int subject on top of the stack Default implementation just run codegen for actual subject of expression May also gen nullability check if needed
protected abstract  void processConstant( constant, org.jetbrains.org.objectweb.asm.Label entryLabel)
           
protected  void putTransitionOnce(int value, org.jetbrains.org.objectweb.asm.Label entryLabel)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

expression

protected final KtWhenExpression expression

isStatement

protected final boolean isStatement

codegen

protected final ExpressionCodegen codegen

bindingContext

protected final BindingContext bindingContext

subjectType

protected final org.jetbrains.org.objectweb.asm.Type subjectType

resultType

protected final org.jetbrains.org.objectweb.asm.Type resultType

v

protected final org.jetbrains.org.objectweb.asm.commons.InstructionAdapter v

transitionsTable

protected final java.util.NavigableMap<java.lang.Integer,org.jetbrains.org.objectweb.asm.Label> transitionsTable

entryLabels

protected final java.util.List<org.jetbrains.org.objectweb.asm.Label> entryLabels

elseLabel

protected org.jetbrains.org.objectweb.asm.Label elseLabel

endLabel

protected org.jetbrains.org.objectweb.asm.Label endLabel

defaultLabel

protected org.jetbrains.org.objectweb.asm.Label defaultLabel
Constructor Detail

SwitchCodegen

public SwitchCodegen(@NotNull
                     KtWhenExpression expression,
                     boolean isStatement,
                     @NotNull
                     ExpressionCodegen codegen)
Method Detail

generate

public void generate()
Generates bytecode for entire when expression


processConstant

protected abstract void processConstant(@NotNull
                                         constant,
                                        @NotNull
                                        org.jetbrains.org.objectweb.asm.Label entryLabel)

putTransitionOnce

protected void putTransitionOnce(int value,
                                 @NotNull
                                 org.jetbrains.org.objectweb.asm.Label entryLabel)

generateSubject

protected void generateSubject()
Should generate int subject on top of the stack Default implementation just run codegen for actual subject of expression May also gen nullability check if needed


generateNullCheckIfNeeded

protected void generateNullCheckIfNeeded()

generateEntries

protected void generateEntries()