use of org.jetbrains.kotlin.psi.KtWhenEntry in project kotlin by JetBrains.
the class SwitchCodegen method generateEntries.
protected void generateEntries() {
// resolving entries' entryLabels and generating entries' code
Iterator<Label> entryLabelsIterator = entryLabels.iterator();
for (KtWhenEntry entry : expression.getEntries()) {
v.visitLabel(entryLabelsIterator.next());
FrameMap.Mark mark = codegen.myFrameMap.mark();
codegen.gen(entry.getExpression(), resultType);
mark.dropTo();
if (!entry.isElse()) {
v.goTo(endLabel);
}
}
}
use of org.jetbrains.kotlin.psi.KtWhenEntry in project kotlin by JetBrains.
the class SwitchCodegen method prepareConfiguration.
/**
* Sets up transitionsTable and maybe something else needed in a special case
* Behaviour may be changed by overriding processConstant
*/
private void prepareConfiguration() {
for (KtWhenEntry entry : expression.getEntries()) {
Label entryLabel = new Label();
for (ConstantValue<?> constant : SwitchCodegenUtil.getConstantsFromEntry(entry, bindingContext, codegen.getState().getShouldInlineConstVals())) {
if (constant instanceof NullValue)
continue;
processConstant(constant, entryLabel);
}
if (entry.isElse()) {
elseLabel = entryLabel;
}
entryLabels.add(entryLabel);
}
}
Aggregations