提交 898affa6 编写于 作者: A Andrey Breslav

Merge remote branch 'origin/master'

......@@ -720,11 +720,15 @@ public class ExpressionCodegen extends JetVisitor {
final Type asmType = expressionType(expression);
DeclarationDescriptor cls = op.getContainingDeclaration();
if (isNumberPrimitive(cls) && (op.getName().equals("inc") || op.getName().equals("dec"))) {
int oldStackSize = myStack.size();
gen(expression.getBaseExpression(), asmType);
generateIncrement(op, asmType, expression.getBaseExpression());
myStack.push(StackValue.onStack(asmType));
assert myStack.size() == oldStackSize+1;
if (bindingContext.isStatement(expression)) {
generateIncrement(op, asmType, expression.getBaseExpression());
}
else {
int oldStackSize = myStack.size();
gen(expression.getBaseExpression(), asmType);
myStack.push(StackValue.onStack(asmType));
assert myStack.size() == oldStackSize+1;
}
return;
}
}
......
......@@ -478,7 +478,7 @@ public class NamespaceGenTest extends LightCodeInsightFixtureTestCase {
assertTrue(hadException);
}
public void _testBottlesNeedToDistinguishExpressionsStatements() throws Exception {
public void testDecrementAsStatement() throws Exception {
loadFile("bottles.jet");
System.out.println(generateToText());
final Method main = generateFunction();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册