Skip to content

Commit

Permalink
Added util methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeny Gerashchenko authored and Evgeny Gerashchenko committed Feb 13, 2013
1 parent da48a11 commit d6bc5a8
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ public void beforeLoop() {
final VariableDescriptor parameterDescriptor = bindingContext.get(BindingContext.VALUE_PARAMETER, loopParameter);
@SuppressWarnings("ConstantConditions") final Type asmTypeForParameter = asmType(parameterDescriptor.getType());
loopParameterVar = myFrameMap.enter(parameterDescriptor, asmTypeForParameter);
afterLoopLeaveVariableTasks.add(new Runnable() {
runAfterLoop(new Runnable() {
@Override
public void run() {
myFrameMap.leave(parameterDescriptor);
Expand All @@ -570,7 +570,7 @@ public void run() {
// E tmp<e> = tmp<iterator>.next()
final Type asmElementType = asmType(elementType);
loopParameterVar = myFrameMap.enterTemp(asmElementType);
afterLoopLeaveVariableTasks.add(new Runnable() {
runAfterLoop(new Runnable() {
@Override
public void run() {
myFrameMap.leaveTemp(asmElementType);
Expand Down Expand Up @@ -601,7 +601,7 @@ private void generateMultiVariables(List<JetMultiDeclarationEntry> entries) {

@SuppressWarnings("ConstantConditions") final Type componentAsmType = asmType(componentDescriptor.getReturnType());
final int componentVarIndex = myFrameMap.enter(componentDescriptor, componentAsmType);
afterBodyLeaveVariableTasks.add(new Runnable() {
runAfterBody(new Runnable() {
@Override
public void run() {
myFrameMap.leave(componentDescriptor);
Expand Down Expand Up @@ -629,6 +629,14 @@ public void body() {
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() {
v.mark(bodyEnd);
// e goes out of scope
Expand Down

0 comments on commit d6bc5a8

Please sign in to comment.