rename value -> generateInstructions
This commit is contained in:
@@ -101,8 +101,8 @@ public class JetControlFlowProcessor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitWhenConditionInRange(JetWhenConditionInRange condition) {
|
public void visitWhenConditionInRange(JetWhenConditionInRange condition) {
|
||||||
value(condition.getRangeExpression(), CFPVisitor.this.inCondition); // TODO : inCondition?
|
generateInstructions(condition.getRangeExpression(), CFPVisitor.this.inCondition); // TODO : inCondition?
|
||||||
value(condition.getOperationReference(), CFPVisitor.this.inCondition); // TODO : inCondition?
|
generateInstructions(condition.getOperationReference(), CFPVisitor.this.inCondition); // TODO : inCondition?
|
||||||
// TODO : read the call to contains()...
|
// TODO : read the call to contains()...
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ public class JetControlFlowProcessor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitWhenConditionWithExpression(JetWhenConditionWithExpression condition) {
|
public void visitWhenConditionWithExpression(JetWhenConditionWithExpression condition) {
|
||||||
value(condition.getExpression(), inCondition);
|
generateInstructions(condition.getExpression(), inCondition);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -133,7 +133,7 @@ public class JetControlFlowProcessor {
|
|||||||
this.inCondition = inCondition;
|
this.inCondition = inCondition;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void value(@Nullable JetElement element, boolean inCondition) {
|
private void generateInstructions(@Nullable JetElement element, boolean inCondition) {
|
||||||
if (element == null) return;
|
if (element == null) return;
|
||||||
CFPVisitor visitor;
|
CFPVisitor visitor;
|
||||||
if (this.inCondition == inCondition) {
|
if (this.inCondition == inCondition) {
|
||||||
@@ -151,7 +151,7 @@ public class JetControlFlowProcessor {
|
|||||||
|
|
||||||
JetExpression innerExpression = expression.getExpression();
|
JetExpression innerExpression = expression.getExpression();
|
||||||
if (innerExpression != null) {
|
if (innerExpression != null) {
|
||||||
value(innerExpression, inCondition);
|
generateInstructions(innerExpression, inCondition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,7 +188,7 @@ public class JetControlFlowProcessor {
|
|||||||
private void visitLabeledExpression(@NotNull String labelName, @NotNull JetExpression labeledExpression) {
|
private void visitLabeledExpression(@NotNull String labelName, @NotNull JetExpression labeledExpression) {
|
||||||
JetExpression deparenthesized = JetPsiUtil.deparenthesizeWithNoTypeResolution(labeledExpression);
|
JetExpression deparenthesized = JetPsiUtil.deparenthesizeWithNoTypeResolution(labeledExpression);
|
||||||
if (deparenthesized != null) {
|
if (deparenthesized != null) {
|
||||||
value(labeledExpression, inCondition);
|
generateInstructions(labeledExpression, inCondition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,11 +197,11 @@ public class JetControlFlowProcessor {
|
|||||||
IElementType operationType = expression.getOperationReference().getReferencedNameElementType();
|
IElementType operationType = expression.getOperationReference().getReferencedNameElementType();
|
||||||
JetExpression right = expression.getRight();
|
JetExpression right = expression.getRight();
|
||||||
if (operationType == JetTokens.ANDAND) {
|
if (operationType == JetTokens.ANDAND) {
|
||||||
value(expression.getLeft(), true);
|
generateInstructions(expression.getLeft(), true);
|
||||||
Label resultLabel = builder.createUnboundLabel();
|
Label resultLabel = builder.createUnboundLabel();
|
||||||
builder.jumpOnFalse(resultLabel);
|
builder.jumpOnFalse(resultLabel);
|
||||||
if (right != null) {
|
if (right != null) {
|
||||||
value(right, true);
|
generateInstructions(right, true);
|
||||||
}
|
}
|
||||||
builder.bindLabel(resultLabel);
|
builder.bindLabel(resultLabel);
|
||||||
if (!inCondition) {
|
if (!inCondition) {
|
||||||
@@ -209,11 +209,11 @@ public class JetControlFlowProcessor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (operationType == JetTokens.OROR) {
|
else if (operationType == JetTokens.OROR) {
|
||||||
value(expression.getLeft(), true);
|
generateInstructions(expression.getLeft(), true);
|
||||||
Label resultLabel = builder.createUnboundLabel();
|
Label resultLabel = builder.createUnboundLabel();
|
||||||
builder.jumpOnTrue(resultLabel);
|
builder.jumpOnTrue(resultLabel);
|
||||||
if (right != null) {
|
if (right != null) {
|
||||||
value(right, true);
|
generateInstructions(right, true);
|
||||||
}
|
}
|
||||||
builder.bindLabel(resultLabel);
|
builder.bindLabel(resultLabel);
|
||||||
if (!inCondition) {
|
if (!inCondition) {
|
||||||
@@ -223,7 +223,7 @@ public class JetControlFlowProcessor {
|
|||||||
else if (operationType == JetTokens.EQ) {
|
else if (operationType == JetTokens.EQ) {
|
||||||
JetExpression left = JetPsiUtil.deparenthesizeWithNoTypeResolution(expression.getLeft());
|
JetExpression left = JetPsiUtil.deparenthesizeWithNoTypeResolution(expression.getLeft());
|
||||||
if (right != null) {
|
if (right != null) {
|
||||||
value(right, false);
|
generateInstructions(right, false);
|
||||||
}
|
}
|
||||||
if (left instanceof JetSimpleNameExpression) {
|
if (left instanceof JetSimpleNameExpression) {
|
||||||
builder.write(expression, left);
|
builder.write(expression, left);
|
||||||
@@ -235,8 +235,8 @@ public class JetControlFlowProcessor {
|
|||||||
else if (left instanceof JetQualifiedExpression) {
|
else if (left instanceof JetQualifiedExpression) {
|
||||||
assert !(left instanceof JetHashQualifiedExpression) : left; // TODO
|
assert !(left instanceof JetHashQualifiedExpression) : left; // TODO
|
||||||
JetQualifiedExpression qualifiedExpression = (JetQualifiedExpression) left;
|
JetQualifiedExpression qualifiedExpression = (JetQualifiedExpression) left;
|
||||||
value(qualifiedExpression.getReceiverExpression(), false);
|
generateInstructions(qualifiedExpression.getReceiverExpression(), false);
|
||||||
value(expression.getOperationReference(), false);
|
generateInstructions(expression.getOperationReference(), false);
|
||||||
builder.write(expression, left);
|
builder.write(expression, left);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -246,13 +246,13 @@ public class JetControlFlowProcessor {
|
|||||||
else if (OperatorConventions.ASSIGNMENT_OPERATIONS.containsKey(operationType)) {
|
else if (OperatorConventions.ASSIGNMENT_OPERATIONS.containsKey(operationType)) {
|
||||||
JetExpression left = JetPsiUtil.deparenthesizeWithNoTypeResolution(expression.getLeft());
|
JetExpression left = JetPsiUtil.deparenthesizeWithNoTypeResolution(expression.getLeft());
|
||||||
if (left != null) {
|
if (left != null) {
|
||||||
value(left, false);
|
generateInstructions(left, false);
|
||||||
}
|
}
|
||||||
if (right != null) {
|
if (right != null) {
|
||||||
value(right, false);
|
generateInstructions(right, false);
|
||||||
}
|
}
|
||||||
if (left instanceof JetSimpleNameExpression || left instanceof JetArrayAccessExpression) {
|
if (left instanceof JetSimpleNameExpression || left instanceof JetArrayAccessExpression) {
|
||||||
value(expression.getOperationReference(), false);
|
generateInstructions(expression.getOperationReference(), false);
|
||||||
builder.write(expression, left);
|
builder.write(expression, left);
|
||||||
}
|
}
|
||||||
else if (left != null) {
|
else if (left != null) {
|
||||||
@@ -261,31 +261,31 @@ public class JetControlFlowProcessor {
|
|||||||
}
|
}
|
||||||
else if (operationType == JetTokens.ELVIS) {
|
else if (operationType == JetTokens.ELVIS) {
|
||||||
builder.read(expression);
|
builder.read(expression);
|
||||||
value(expression.getLeft(), false);
|
generateInstructions(expression.getLeft(), false);
|
||||||
value(expression.getOperationReference(), false);
|
generateInstructions(expression.getOperationReference(), false);
|
||||||
Label afterElvis = builder.createUnboundLabel();
|
Label afterElvis = builder.createUnboundLabel();
|
||||||
builder.jumpOnTrue(afterElvis);
|
builder.jumpOnTrue(afterElvis);
|
||||||
if (right != null) {
|
if (right != null) {
|
||||||
value(right, false);
|
generateInstructions(right, false);
|
||||||
}
|
}
|
||||||
builder.bindLabel(afterElvis);
|
builder.bindLabel(afterElvis);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
value(expression.getLeft(), false);
|
generateInstructions(expression.getLeft(), false);
|
||||||
if (right != null) {
|
if (right != null) {
|
||||||
value(right, false);
|
generateInstructions(right, false);
|
||||||
}
|
}
|
||||||
value(expression.getOperationReference(), false);
|
generateInstructions(expression.getOperationReference(), false);
|
||||||
builder.read(expression);
|
builder.read(expression);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void visitAssignToArrayAccess(JetBinaryExpression expression, JetArrayAccessExpression arrayAccessExpression) {
|
private void visitAssignToArrayAccess(JetBinaryExpression expression, JetArrayAccessExpression arrayAccessExpression) {
|
||||||
for (JetExpression index : arrayAccessExpression.getIndexExpressions()) {
|
for (JetExpression index : arrayAccessExpression.getIndexExpressions()) {
|
||||||
value(index, false);
|
generateInstructions(index, false);
|
||||||
}
|
}
|
||||||
value(arrayAccessExpression.getArrayExpression(), false);
|
generateInstructions(arrayAccessExpression.getArrayExpression(), false);
|
||||||
value(expression.getOperationReference(), false);
|
generateInstructions(expression.getOperationReference(), false);
|
||||||
builder.write(expression, arrayAccessExpression); // TODO : ???
|
builder.write(expression, arrayAccessExpression); // TODO : ???
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,8 +301,8 @@ public class JetControlFlowProcessor {
|
|||||||
visitLabeledExpression(referencedName.substring(1), baseExpression);
|
visitLabeledExpression(referencedName.substring(1), baseExpression);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
value(baseExpression, false);
|
generateInstructions(baseExpression, false);
|
||||||
value(operationSign, false);
|
generateInstructions(operationSign, false);
|
||||||
|
|
||||||
boolean incrementOrDecrement = isIncrementOrDecrement(operationType);
|
boolean incrementOrDecrement = isIncrementOrDecrement(operationType);
|
||||||
if (incrementOrDecrement) {
|
if (incrementOrDecrement) {
|
||||||
@@ -322,13 +322,13 @@ public class JetControlFlowProcessor {
|
|||||||
public void visitIfExpression(JetIfExpression expression) {
|
public void visitIfExpression(JetIfExpression expression) {
|
||||||
JetExpression condition = expression.getCondition();
|
JetExpression condition = expression.getCondition();
|
||||||
if (condition != null) {
|
if (condition != null) {
|
||||||
value(condition, true);
|
generateInstructions(condition, true);
|
||||||
}
|
}
|
||||||
Label elseLabel = builder.createUnboundLabel();
|
Label elseLabel = builder.createUnboundLabel();
|
||||||
builder.jumpOnFalse(elseLabel);
|
builder.jumpOnFalse(elseLabel);
|
||||||
JetExpression thenBranch = expression.getThen();
|
JetExpression thenBranch = expression.getThen();
|
||||||
if (thenBranch != null) {
|
if (thenBranch != null) {
|
||||||
value(thenBranch, inCondition);
|
generateInstructions(thenBranch, inCondition);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
builder.readUnit(expression);
|
builder.readUnit(expression);
|
||||||
@@ -338,7 +338,7 @@ public class JetControlFlowProcessor {
|
|||||||
builder.bindLabel(elseLabel);
|
builder.bindLabel(elseLabel);
|
||||||
JetExpression elseBranch = expression.getElse();
|
JetExpression elseBranch = expression.getElse();
|
||||||
if (elseBranch != null) {
|
if (elseBranch != null) {
|
||||||
value(elseBranch, inCondition);
|
generateInstructions(elseBranch, inCondition);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
builder.readUnit(expression);
|
builder.readUnit(expression);
|
||||||
@@ -365,7 +365,7 @@ public class JetControlFlowProcessor {
|
|||||||
}
|
}
|
||||||
startFinally = builder.createUnboundLabel("start finally");
|
startFinally = builder.createUnboundLabel("start finally");
|
||||||
builder.bindLabel(startFinally);
|
builder.bindLabel(startFinally);
|
||||||
value(finalExpression, inCondition);
|
generateInstructions(finalExpression, inCondition);
|
||||||
finishFinally = builder.createUnboundLabel("finish finally");
|
finishFinally = builder.createUnboundLabel("finish finally");
|
||||||
builder.bindLabel(finishFinally);
|
builder.bindLabel(finishFinally);
|
||||||
}
|
}
|
||||||
@@ -404,7 +404,7 @@ public class JetControlFlowProcessor {
|
|||||||
onExceptionToFinallyBlock = builder.createUnboundLabel("onExceptionToFinallyBlock");
|
onExceptionToFinallyBlock = builder.createUnboundLabel("onExceptionToFinallyBlock");
|
||||||
builder.nondeterministicJump(onExceptionToFinallyBlock);
|
builder.nondeterministicJump(onExceptionToFinallyBlock);
|
||||||
}
|
}
|
||||||
value(expression.getTryBlock(), inCondition);
|
generateInstructions(expression.getTryBlock(), inCondition);
|
||||||
|
|
||||||
Collection<Label> allowDeadLabels = Lists.newArrayList();
|
Collection<Label> allowDeadLabels = Lists.newArrayList();
|
||||||
if (hasCatches) {
|
if (hasCatches) {
|
||||||
@@ -435,7 +435,7 @@ public class JetControlFlowProcessor {
|
|||||||
}
|
}
|
||||||
JetExpression catchBody = catchClause.getCatchBody();
|
JetExpression catchBody = catchClause.getCatchBody();
|
||||||
if (catchBody != null) {
|
if (catchBody != null) {
|
||||||
value(catchBody, false);
|
generateInstructions(catchBody, false);
|
||||||
}
|
}
|
||||||
builder.jump(afterCatches);
|
builder.jump(afterCatches);
|
||||||
}
|
}
|
||||||
@@ -465,7 +465,7 @@ public class JetControlFlowProcessor {
|
|||||||
builder.bindLabel(loopInfo.getConditionEntryPoint());
|
builder.bindLabel(loopInfo.getConditionEntryPoint());
|
||||||
JetExpression condition = expression.getCondition();
|
JetExpression condition = expression.getCondition();
|
||||||
if (condition != null) {
|
if (condition != null) {
|
||||||
value(condition, true);
|
generateInstructions(condition, true);
|
||||||
}
|
}
|
||||||
boolean conditionIsTrueConstant = false;
|
boolean conditionIsTrueConstant = false;
|
||||||
if (condition instanceof JetConstantExpression && condition.getNode().getElementType() == JetNodeTypes.BOOLEAN_CONSTANT) {
|
if (condition instanceof JetConstantExpression && condition.getNode().getElementType() == JetNodeTypes.BOOLEAN_CONSTANT) {
|
||||||
@@ -480,7 +480,7 @@ public class JetControlFlowProcessor {
|
|||||||
builder.bindLabel(loopInfo.getBodyEntryPoint());
|
builder.bindLabel(loopInfo.getBodyEntryPoint());
|
||||||
JetExpression body = expression.getBody();
|
JetExpression body = expression.getBody();
|
||||||
if (body != null) {
|
if (body != null) {
|
||||||
value(body, false);
|
generateInstructions(body, false);
|
||||||
}
|
}
|
||||||
builder.jump(loopInfo.getEntryPoint());
|
builder.jump(loopInfo.getEntryPoint());
|
||||||
builder.exitLoop(expression);
|
builder.exitLoop(expression);
|
||||||
@@ -495,12 +495,12 @@ public class JetControlFlowProcessor {
|
|||||||
builder.bindLabel(loopInfo.getBodyEntryPoint());
|
builder.bindLabel(loopInfo.getBodyEntryPoint());
|
||||||
JetExpression body = expression.getBody();
|
JetExpression body = expression.getBody();
|
||||||
if (body != null) {
|
if (body != null) {
|
||||||
value(body, false);
|
generateInstructions(body, false);
|
||||||
}
|
}
|
||||||
builder.bindLabel(loopInfo.getConditionEntryPoint());
|
builder.bindLabel(loopInfo.getConditionEntryPoint());
|
||||||
JetExpression condition = expression.getCondition();
|
JetExpression condition = expression.getCondition();
|
||||||
if (condition != null) {
|
if (condition != null) {
|
||||||
value(condition, true);
|
generateInstructions(condition, true);
|
||||||
}
|
}
|
||||||
builder.jumpOnTrue(loopInfo.getEntryPoint());
|
builder.jumpOnTrue(loopInfo.getEntryPoint());
|
||||||
builder.exitLoop(expression);
|
builder.exitLoop(expression);
|
||||||
@@ -512,15 +512,15 @@ public class JetControlFlowProcessor {
|
|||||||
builder.read(expression);
|
builder.read(expression);
|
||||||
JetExpression loopRange = expression.getLoopRange();
|
JetExpression loopRange = expression.getLoopRange();
|
||||||
if (loopRange != null) {
|
if (loopRange != null) {
|
||||||
value(loopRange, false);
|
generateInstructions(loopRange, false);
|
||||||
}
|
}
|
||||||
JetParameter loopParameter = expression.getLoopParameter();
|
JetParameter loopParameter = expression.getLoopParameter();
|
||||||
if (loopParameter != null) {
|
if (loopParameter != null) {
|
||||||
value(loopParameter, inCondition);
|
generateInstructions(loopParameter, inCondition);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
JetMultiDeclaration multiParameter = expression.getMultiParameter();
|
JetMultiDeclaration multiParameter = expression.getMultiParameter();
|
||||||
value(multiParameter, inCondition);
|
generateInstructions(multiParameter, inCondition);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO : primitive cases
|
// TODO : primitive cases
|
||||||
@@ -535,7 +535,7 @@ public class JetControlFlowProcessor {
|
|||||||
builder.bindLabel(loopInfo.getBodyEntryPoint());
|
builder.bindLabel(loopInfo.getBodyEntryPoint());
|
||||||
JetExpression body = expression.getBody();
|
JetExpression body = expression.getBody();
|
||||||
if (body != null) {
|
if (body != null) {
|
||||||
value(body, false);
|
generateInstructions(body, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.nondeterministicJump(loopInfo.getEntryPoint());
|
builder.nondeterministicJump(loopInfo.getEntryPoint());
|
||||||
@@ -587,7 +587,7 @@ public class JetControlFlowProcessor {
|
|||||||
public void visitReturnExpression(JetReturnExpression expression) {
|
public void visitReturnExpression(JetReturnExpression expression) {
|
||||||
JetExpression returnedExpression = expression.getReturnedExpression();
|
JetExpression returnedExpression = expression.getReturnedExpression();
|
||||||
if (returnedExpression != null) {
|
if (returnedExpression != null) {
|
||||||
value(returnedExpression, false);
|
generateInstructions(returnedExpression, false);
|
||||||
}
|
}
|
||||||
JetSimpleNameExpression labelElement = expression.getTargetLabel();
|
JetSimpleNameExpression labelElement = expression.getTargetLabel();
|
||||||
JetElement subroutine;
|
JetElement subroutine;
|
||||||
@@ -626,7 +626,7 @@ public class JetControlFlowProcessor {
|
|||||||
builder.declare(parameter);
|
builder.declare(parameter);
|
||||||
JetExpression defaultValue = parameter.getDefaultValue();
|
JetExpression defaultValue = parameter.getDefaultValue();
|
||||||
if (defaultValue != null) {
|
if (defaultValue != null) {
|
||||||
value(defaultValue, inCondition);
|
generateInstructions(defaultValue, inCondition);
|
||||||
}
|
}
|
||||||
builder.write(parameter, parameter);
|
builder.write(parameter, parameter);
|
||||||
}
|
}
|
||||||
@@ -635,7 +635,7 @@ public class JetControlFlowProcessor {
|
|||||||
public void visitBlockExpression(JetBlockExpression expression) {
|
public void visitBlockExpression(JetBlockExpression expression) {
|
||||||
List<JetElement> statements = expression.getStatements();
|
List<JetElement> statements = expression.getStatements();
|
||||||
for (JetElement statement : statements) {
|
for (JetElement statement : statements) {
|
||||||
value(statement, false);
|
generateInstructions(statement, false);
|
||||||
}
|
}
|
||||||
if (statements.isEmpty()) {
|
if (statements.isEmpty()) {
|
||||||
builder.readUnit(expression);
|
builder.readUnit(expression);
|
||||||
@@ -656,10 +656,10 @@ public class JetControlFlowProcessor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitQualifiedExpression(JetQualifiedExpression expression) {
|
public void visitQualifiedExpression(JetQualifiedExpression expression) {
|
||||||
value(expression.getReceiverExpression(), false);
|
generateInstructions(expression.getReceiverExpression(), false);
|
||||||
JetExpression selectorExpression = expression.getSelectorExpression();
|
JetExpression selectorExpression = expression.getSelectorExpression();
|
||||||
if (selectorExpression != null) {
|
if (selectorExpression != null) {
|
||||||
value(selectorExpression, false);
|
generateInstructions(selectorExpression, false);
|
||||||
}
|
}
|
||||||
builder.read(expression);
|
builder.read(expression);
|
||||||
if (trace.get(BindingContext.PROCESSED, expression)) {
|
if (trace.get(BindingContext.PROCESSED, expression)) {
|
||||||
@@ -674,12 +674,12 @@ public class JetControlFlowProcessor {
|
|||||||
for (ValueArgument argument : call.getValueArguments()) {
|
for (ValueArgument argument : call.getValueArguments()) {
|
||||||
JetExpression argumentExpression = argument.getArgumentExpression();
|
JetExpression argumentExpression = argument.getArgumentExpression();
|
||||||
if (argumentExpression != null) {
|
if (argumentExpression != null) {
|
||||||
value(argumentExpression, false);
|
generateInstructions(argumentExpression, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (JetExpression functionLiteral : call.getFunctionLiteralArguments()) {
|
for (JetExpression functionLiteral : call.getFunctionLiteralArguments()) {
|
||||||
value(functionLiteral, false);
|
generateInstructions(functionLiteral, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -697,12 +697,12 @@ public class JetControlFlowProcessor {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
for (JetTypeProjection typeArgument : expression.getTypeArguments()) {
|
for (JetTypeProjection typeArgument : expression.getTypeArguments()) {
|
||||||
value(typeArgument, false);
|
generateInstructions(typeArgument, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
visitCall(expression);
|
visitCall(expression);
|
||||||
|
|
||||||
value(expression.getCalleeExpression(), false);
|
generateInstructions(expression.getCalleeExpression(), false);
|
||||||
builder.read(expression);
|
builder.read(expression);
|
||||||
if (trace.get(BindingContext.PROCESSED, expression)) {
|
if (trace.get(BindingContext.PROCESSED, expression)) {
|
||||||
JetType type = trace.getBindingContext().get(BindingContext.EXPRESSION_TYPE, expression);
|
JetType type = trace.getBindingContext().get(BindingContext.EXPRESSION_TYPE, expression);
|
||||||
@@ -725,11 +725,11 @@ public class JetControlFlowProcessor {
|
|||||||
builder.declare(property);
|
builder.declare(property);
|
||||||
JetExpression initializer = property.getInitializer();
|
JetExpression initializer = property.getInitializer();
|
||||||
if (initializer != null) {
|
if (initializer != null) {
|
||||||
value(initializer, false);
|
generateInstructions(initializer, false);
|
||||||
builder.write(property, property);
|
builder.write(property, property);
|
||||||
}
|
}
|
||||||
for (JetPropertyAccessor accessor : property.getAccessors()) {
|
for (JetPropertyAccessor accessor : property.getAccessors()) {
|
||||||
value(accessor, false);
|
generateInstructions(accessor, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -737,7 +737,7 @@ public class JetControlFlowProcessor {
|
|||||||
public void visitMultiDeclaration(JetMultiDeclaration declaration) {
|
public void visitMultiDeclaration(JetMultiDeclaration declaration) {
|
||||||
JetExpression initializer = declaration.getInitializer();
|
JetExpression initializer = declaration.getInitializer();
|
||||||
if (initializer != null) {
|
if (initializer != null) {
|
||||||
value(initializer, false);
|
generateInstructions(initializer, false);
|
||||||
}
|
}
|
||||||
List<JetMultiDeclarationEntry> entries = declaration.getEntries();
|
List<JetMultiDeclarationEntry> entries = declaration.getEntries();
|
||||||
for (JetMultiDeclarationEntry entry : entries) {
|
for (JetMultiDeclarationEntry entry : entries) {
|
||||||
@@ -754,7 +754,7 @@ public class JetControlFlowProcessor {
|
|||||||
@Override
|
@Override
|
||||||
public void visitTupleExpression(JetTupleExpression expression) {
|
public void visitTupleExpression(JetTupleExpression expression) {
|
||||||
for (JetExpression entry : expression.getEntries()) {
|
for (JetExpression entry : expression.getEntries()) {
|
||||||
value(entry, false);
|
generateInstructions(entry, false);
|
||||||
}
|
}
|
||||||
builder.read(expression);
|
builder.read(expression);
|
||||||
}
|
}
|
||||||
@@ -763,7 +763,7 @@ public class JetControlFlowProcessor {
|
|||||||
public void visitBinaryWithTypeRHSExpression(JetBinaryExpressionWithTypeRHS expression) {
|
public void visitBinaryWithTypeRHSExpression(JetBinaryExpressionWithTypeRHS expression) {
|
||||||
IElementType operationType = expression.getOperationSign().getReferencedNameElementType();
|
IElementType operationType = expression.getOperationSign().getReferencedNameElementType();
|
||||||
if (operationType == JetTokens.COLON || operationType == JetTokens.AS_KEYWORD || operationType == JetTokens.AS_SAFE) {
|
if (operationType == JetTokens.COLON || operationType == JetTokens.AS_KEYWORD || operationType == JetTokens.AS_SAFE) {
|
||||||
value(expression.getLeft(), false);
|
generateInstructions(expression.getLeft(), false);
|
||||||
builder.read(expression);
|
builder.read(expression);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -775,7 +775,7 @@ public class JetControlFlowProcessor {
|
|||||||
public void visitThrowExpression(JetThrowExpression expression) {
|
public void visitThrowExpression(JetThrowExpression expression) {
|
||||||
JetExpression thrownExpression = expression.getThrownExpression();
|
JetExpression thrownExpression = expression.getThrownExpression();
|
||||||
if (thrownExpression != null) {
|
if (thrownExpression != null) {
|
||||||
value(thrownExpression, false);
|
generateInstructions(thrownExpression, false);
|
||||||
}
|
}
|
||||||
builder.throwException(expression);
|
builder.throwException(expression);
|
||||||
}
|
}
|
||||||
@@ -783,16 +783,16 @@ public class JetControlFlowProcessor {
|
|||||||
@Override
|
@Override
|
||||||
public void visitArrayAccessExpression(JetArrayAccessExpression expression) {
|
public void visitArrayAccessExpression(JetArrayAccessExpression expression) {
|
||||||
for (JetExpression index : expression.getIndexExpressions()) {
|
for (JetExpression index : expression.getIndexExpressions()) {
|
||||||
value(index, false);
|
generateInstructions(index, false);
|
||||||
}
|
}
|
||||||
value(expression.getArrayExpression(), false);
|
generateInstructions(expression.getArrayExpression(), false);
|
||||||
// TODO : read 'get' or 'set' function
|
// TODO : read 'get' or 'set' function
|
||||||
builder.read(expression);
|
builder.read(expression);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitIsExpression(final JetIsExpression expression) {
|
public void visitIsExpression(final JetIsExpression expression) {
|
||||||
value(expression.getLeftHandSide(), inCondition);
|
generateInstructions(expression.getLeftHandSide(), inCondition);
|
||||||
// no CF for types
|
// no CF for types
|
||||||
// TODO : builder.read(expression.getPattern());
|
// TODO : builder.read(expression.getPattern());
|
||||||
builder.read(expression);
|
builder.read(expression);
|
||||||
@@ -802,7 +802,7 @@ public class JetControlFlowProcessor {
|
|||||||
public void visitWhenExpression(JetWhenExpression expression) {
|
public void visitWhenExpression(JetWhenExpression expression) {
|
||||||
JetExpression subjectExpression = expression.getSubjectExpression();
|
JetExpression subjectExpression = expression.getSubjectExpression();
|
||||||
if (subjectExpression != null) {
|
if (subjectExpression != null) {
|
||||||
value(subjectExpression, inCondition);
|
generateInstructions(subjectExpression, inCondition);
|
||||||
}
|
}
|
||||||
boolean hasElseOrIrrefutableBranch = false;
|
boolean hasElseOrIrrefutableBranch = false;
|
||||||
|
|
||||||
@@ -843,7 +843,7 @@ public class JetControlFlowProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
builder.bindLabel(bodyLabel);
|
builder.bindLabel(bodyLabel);
|
||||||
value(whenEntry.getExpression(), inCondition);
|
generateInstructions(whenEntry.getExpression(), inCondition);
|
||||||
builder.jump(doneLabel);
|
builder.jump(doneLabel);
|
||||||
|
|
||||||
if (!isIrrefutable) {
|
if (!isIrrefutable) {
|
||||||
@@ -860,7 +860,7 @@ public class JetControlFlowProcessor {
|
|||||||
@Override
|
@Override
|
||||||
public void visitObjectLiteralExpression(JetObjectLiteralExpression expression) {
|
public void visitObjectLiteralExpression(JetObjectLiteralExpression expression) {
|
||||||
JetObjectDeclaration declaration = expression.getObjectDeclaration();
|
JetObjectDeclaration declaration = expression.getObjectDeclaration();
|
||||||
value(declaration, inCondition);
|
generateInstructions(declaration, inCondition);
|
||||||
|
|
||||||
List<JetDeclaration> declarations = declaration.getDeclarations();
|
List<JetDeclaration> declarations = declaration.getDeclarations();
|
||||||
List<JetDeclaration> functions = Lists.newArrayList();
|
List<JetDeclaration> functions = Lists.newArrayList();
|
||||||
@@ -870,7 +870,7 @@ public class JetControlFlowProcessor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (JetDeclaration function : functions) {
|
for (JetDeclaration function : functions) {
|
||||||
value(function, inCondition);
|
generateInstructions(function, inCondition);
|
||||||
}
|
}
|
||||||
builder.read(expression);
|
builder.read(expression);
|
||||||
}
|
}
|
||||||
@@ -885,7 +885,7 @@ public class JetControlFlowProcessor {
|
|||||||
for (JetStringTemplateEntry entry : expression.getEntries()) {
|
for (JetStringTemplateEntry entry : expression.getEntries()) {
|
||||||
if (entry instanceof JetStringTemplateEntryWithExpression) {
|
if (entry instanceof JetStringTemplateEntryWithExpression) {
|
||||||
JetStringTemplateEntryWithExpression entryWithExpression = (JetStringTemplateEntryWithExpression) entry;
|
JetStringTemplateEntryWithExpression entryWithExpression = (JetStringTemplateEntryWithExpression) entry;
|
||||||
value(entryWithExpression.getExpression(), false);
|
generateInstructions(entryWithExpression.getExpression(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
builder.read(expression);
|
builder.read(expression);
|
||||||
@@ -898,22 +898,22 @@ public class JetControlFlowProcessor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitAnonymousInitializer(JetClassInitializer classInitializer) {
|
public void visitAnonymousInitializer(JetClassInitializer classInitializer) {
|
||||||
value(classInitializer.getBody(), inCondition);
|
generateInstructions(classInitializer.getBody(), inCondition);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void visitClassOrObject(JetClassOrObject classOrObject) {
|
private void visitClassOrObject(JetClassOrObject classOrObject) {
|
||||||
for (JetDelegationSpecifier specifier : classOrObject.getDelegationSpecifiers()) {
|
for (JetDelegationSpecifier specifier : classOrObject.getDelegationSpecifiers()) {
|
||||||
value(specifier, inCondition);
|
generateInstructions(specifier, inCondition);
|
||||||
}
|
}
|
||||||
List<JetDeclaration> declarations = classOrObject.getDeclarations();
|
List<JetDeclaration> declarations = classOrObject.getDeclarations();
|
||||||
List<JetProperty> properties = Lists.newArrayList();
|
List<JetProperty> properties = Lists.newArrayList();
|
||||||
for (JetDeclaration declaration : declarations) {
|
for (JetDeclaration declaration : declarations) {
|
||||||
if (declaration instanceof JetProperty) {
|
if (declaration instanceof JetProperty) {
|
||||||
value(declaration, inCondition);
|
generateInstructions(declaration, inCondition);
|
||||||
properties.add((JetProperty) declaration);
|
properties.add((JetProperty) declaration);
|
||||||
}
|
}
|
||||||
else if (declaration instanceof JetClassInitializer) {
|
else if (declaration instanceof JetClassInitializer) {
|
||||||
value(declaration, inCondition);
|
generateInstructions(declaration, inCondition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -922,7 +922,7 @@ public class JetControlFlowProcessor {
|
|||||||
public void visitClass(JetClass klass) {
|
public void visitClass(JetClass klass) {
|
||||||
List<JetParameter> parameters = klass.getPrimaryConstructorParameters();
|
List<JetParameter> parameters = klass.getPrimaryConstructorParameters();
|
||||||
for (JetParameter parameter : parameters) {
|
for (JetParameter parameter : parameters) {
|
||||||
value(parameter, inCondition);
|
generateInstructions(parameter, inCondition);
|
||||||
}
|
}
|
||||||
visitClassOrObject(klass);
|
visitClassOrObject(klass);
|
||||||
}
|
}
|
||||||
@@ -931,13 +931,13 @@ public class JetControlFlowProcessor {
|
|||||||
public void visitDelegationToSuperCallSpecifier(JetDelegatorToSuperCall call) {
|
public void visitDelegationToSuperCallSpecifier(JetDelegatorToSuperCall call) {
|
||||||
List<? extends ValueArgument> valueArguments = call.getValueArguments();
|
List<? extends ValueArgument> valueArguments = call.getValueArguments();
|
||||||
for (ValueArgument valueArgument : valueArguments) {
|
for (ValueArgument valueArgument : valueArguments) {
|
||||||
value(valueArgument.getArgumentExpression(), inCondition);
|
generateInstructions(valueArgument.getArgumentExpression(), inCondition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitDelegationByExpressionSpecifier(JetDelegatorByExpressionSpecifier specifier) {
|
public void visitDelegationByExpressionSpecifier(JetDelegatorByExpressionSpecifier specifier) {
|
||||||
value(specifier.getDelegateExpression(), inCondition);
|
generateInstructions(specifier.getDelegateExpression(), inCondition);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user