failing tests for post-increment as statement
This commit is contained in:
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user