mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-03 23:02:27 +00:00
compiler: support pointer dereferencing for structs
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
eb047b12a7
commit
d54c60ded3
2 changed files with 22 additions and 0 deletions
|
@ -16,3 +16,15 @@ func TestAddressOfLiteral(t *testing.T) {
|
|||
func setA(s *Foo, a int) { s.A = a }`
|
||||
eval(t, src, big.NewInt(3))
|
||||
}
|
||||
|
||||
func TestPointerDereference(t *testing.T) {
|
||||
src := `package foo
|
||||
type Foo struct { A int }
|
||||
func Main() int {
|
||||
f := &Foo{A: 4}
|
||||
setA(*f, 3)
|
||||
return f.A
|
||||
}
|
||||
func setA(s Foo, a int) { s.A = a }`
|
||||
eval(t, src, big.NewInt(4))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue