Added util methods.
This commit is contained in:
@@ -552,7 +552,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
|||||||
final VariableDescriptor parameterDescriptor = bindingContext.get(BindingContext.VALUE_PARAMETER, loopParameter);
|
final VariableDescriptor parameterDescriptor = bindingContext.get(BindingContext.VALUE_PARAMETER, loopParameter);
|
||||||
@SuppressWarnings("ConstantConditions") final Type asmTypeForParameter = asmType(parameterDescriptor.getType());
|
@SuppressWarnings("ConstantConditions") final Type asmTypeForParameter = asmType(parameterDescriptor.getType());
|
||||||
loopParameterVar = myFrameMap.enter(parameterDescriptor, asmTypeForParameter);
|
loopParameterVar = myFrameMap.enter(parameterDescriptor, asmTypeForParameter);
|
||||||
afterLoopLeaveVariableTasks.add(new Runnable() {
|
runAfterLoop(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
myFrameMap.leave(parameterDescriptor);
|
myFrameMap.leave(parameterDescriptor);
|
||||||
@@ -570,7 +570,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
|||||||
// E tmp<e> = tmp<iterator>.next()
|
// E tmp<e> = tmp<iterator>.next()
|
||||||
final Type asmElementType = asmType(elementType);
|
final Type asmElementType = asmType(elementType);
|
||||||
loopParameterVar = myFrameMap.enterTemp(asmElementType);
|
loopParameterVar = myFrameMap.enterTemp(asmElementType);
|
||||||
afterLoopLeaveVariableTasks.add(new Runnable() {
|
runAfterLoop(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
myFrameMap.leaveTemp(asmElementType);
|
myFrameMap.leaveTemp(asmElementType);
|
||||||
@@ -601,7 +601,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
|||||||
|
|
||||||
@SuppressWarnings("ConstantConditions") final Type componentAsmType = asmType(componentDescriptor.getReturnType());
|
@SuppressWarnings("ConstantConditions") final Type componentAsmType = asmType(componentDescriptor.getReturnType());
|
||||||
final int componentVarIndex = myFrameMap.enter(componentDescriptor, componentAsmType);
|
final int componentVarIndex = myFrameMap.enter(componentDescriptor, componentAsmType);
|
||||||
afterBodyLeaveVariableTasks.add(new Runnable() {
|
runAfterBody(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
myFrameMap.leave(componentDescriptor);
|
myFrameMap.leave(componentDescriptor);
|
||||||
@@ -629,6 +629,14 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
|||||||
gen(forExpression.getBody(), Type.VOID_TYPE);
|
gen(forExpression.getBody(), Type.VOID_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void runAfterBody(Runnable runnable) {
|
||||||
|
afterBodyLeaveVariableTasks.add(runnable);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void runAfterLoop(Runnable runnable) {
|
||||||
|
afterLoopLeaveVariableTasks.add(runnable);
|
||||||
|
}
|
||||||
|
|
||||||
public void afterBody() {
|
public void afterBody() {
|
||||||
v.mark(bodyEnd);
|
v.mark(bodyEnd);
|
||||||
// e goes out of scope
|
// e goes out of scope
|
||||||
|
|||||||
Reference in New Issue
Block a user