23
_test/issue-1052.go
Normal file
23
_test/issue-1052.go
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
a, b := 1, 1
|
||||||
|
for i := 0; i < 10; i++ {
|
||||||
|
fmt.Println(a)
|
||||||
|
a, b = b, a+b
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Output:
|
||||||
|
// 1
|
||||||
|
// 1
|
||||||
|
// 2
|
||||||
|
// 3
|
||||||
|
// 5
|
||||||
|
// 8
|
||||||
|
// 13
|
||||||
|
// 21
|
||||||
|
// 34
|
||||||
|
// 55
|
||||||
@@ -733,7 +733,7 @@ func (interp *Interpreter) cfg(root *node, importPath string) ([]*node, error) {
|
|||||||
// by constOp and available in n.rval. Nothing else to do at execution.
|
// by constOp and available in n.rval. Nothing else to do at execution.
|
||||||
n.gen = nop
|
n.gen = nop
|
||||||
n.findex = notInFrame
|
n.findex = notInFrame
|
||||||
case n.anc.kind == assignStmt && n.anc.action == aAssign:
|
case n.anc.kind == assignStmt && n.anc.action == aAssign && n.anc.nleft == 1:
|
||||||
// To avoid a copy in frame, if the result is to be assigned, store it directly
|
// To avoid a copy in frame, if the result is to be assigned, store it directly
|
||||||
// at the frame location of destination.
|
// at the frame location of destination.
|
||||||
dest := n.anc.child[childPos(n)-n.anc.nright]
|
dest := n.anc.child[childPos(n)-n.anc.nright]
|
||||||
|
|||||||
Reference in New Issue
Block a user