compiler: support creating pointers to struct

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2020-08-02 14:42:29 +03:00
parent 00671deb8f
commit eb047b12a7
2 changed files with 52 additions and 5 deletions

View file

@ -0,0 +1,18 @@
package compiler_test
import (
"math/big"
"testing"
)
func TestAddressOfLiteral(t *testing.T) {
src := `package foo
type Foo struct { A int }
func Main() int {
f := &Foo{}
setA(f, 3)
return f.A
}
func setA(s *Foo, a int) { s.A = a }`
eval(t, src, big.NewInt(3))
}