OSDN Git Service

fix the operation for binary operator with the same variable (#16)
[bytom/equity.git] / compiler / compile.go
index c3d277f..7145274 100644 (file)
@@ -498,7 +498,9 @@ func compileStatement(b *builder, stk stack, contract *Contract, env *environ, c
                }
 
                // restore the defined variable counts
-               counts[stmt.variable.Name] = varCount
+               if tmpCounts[stmt.variable.Name] > 0 {
+                       counts[stmt.variable.Name] = varCount
+               }
 
                // modify stack name
                stk.str = stmt.variable.Name