mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-03 23:02:27 +00:00
compiler: allow using OP= with struct fields and slice elements
Do it in a generic way, there is no need in restricting to only variables. Port of #954.
This commit is contained in:
parent
fdb217ec81
commit
1b105a9f1d
3 changed files with 40 additions and 15 deletions
|
@ -134,6 +134,17 @@ var structTestCases = []testCase{
|
|||
}`,
|
||||
big.NewInt(14),
|
||||
},
|
||||
{
|
||||
"increase struct field with +=",
|
||||
`package foo
|
||||
type token struct { x int }
|
||||
func Main() int {
|
||||
t := token{x: 2}
|
||||
t.x += 3
|
||||
return t.x
|
||||
}`,
|
||||
big.NewInt(5),
|
||||
},
|
||||
{
|
||||
"assign a struct field to a struct field",
|
||||
`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue