failing tests for post-increment as statement

This commit is contained in:
Dmitry Jemerov
2011-04-14 18:26:02 +02:00
parent 1d01d519b9
commit 2711d3fcd7
2 changed files with 10 additions and 6 deletions
@@ -720,11 +720,15 @@ public class ExpressionCodegen extends JetVisitor {
final Type asmType = expressionType(expression); final Type asmType = expressionType(expression);
DeclarationDescriptor cls = op.getContainingDeclaration(); DeclarationDescriptor cls = op.getContainingDeclaration();
if (isNumberPrimitive(cls) && (op.getName().equals("inc") || op.getName().equals("dec"))) { if (isNumberPrimitive(cls) && (op.getName().equals("inc") || op.getName().equals("dec"))) {
int oldStackSize = myStack.size(); if (bindingContext.isStatement(expression)) {
gen(expression.getBaseExpression(), asmType); generateIncrement(op, asmType, expression.getBaseExpression());
generateIncrement(op, asmType, expression.getBaseExpression()); }
myStack.push(StackValue.onStack(asmType)); else {
assert myStack.size() == oldStackSize+1; int oldStackSize = myStack.size();
gen(expression.getBaseExpression(), asmType);
myStack.push(StackValue.onStack(asmType));
assert myStack.size() == oldStackSize+1;
}
return; return;
} }
} }
@@ -478,7 +478,7 @@ public class NamespaceGenTest extends LightCodeInsightFixtureTestCase {
assertTrue(hadException); assertTrue(hadException);
} }
public void _testBottlesNeedToDistinguishExpressionsStatements() throws Exception { public void testDecrementAsStatement() throws Exception {
loadFile("bottles.jet"); loadFile("bottles.jet");
System.out.println(generateToText()); System.out.println(generateToText());
final Method main = generateFunction(); final Method main = generateFunction();