translator: fix variable defenition via another variable

This commit is contained in:
Alexey Stepanov
2016-08-11 12:42:33 +03:00
parent 7faa437c7a
commit a8e843a10c
3 changed files with 8 additions and 1 deletions
@@ -911,7 +911,7 @@ abstract class BlockCodegen(val state: TranslationState, val variableManager: Va
when (assignExpression) {
is LLVMVariable -> {
if (assignExpression.pointer == 0) {
if (assignExpression.pointer < 2) {
val allocVar = variableManager.receiveVariable(identifier, assignExpression.type, LLVMRegisterScope(), pointer = 0)
codeBuilder.allocStackVar(allocVar)
allocVar.pointer++
@@ -0,0 +1 @@
variables_assigment_1_Int(56789) == 56789
@@ -0,0 +1,6 @@
fun variables_assigment_1(x: Int): Int {
var z = x
z++
return x
}