mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-04 09:02:28 +00:00
compiler: initialize packages according to go spec
`init()` functions should be called during package initialization, after global variables were processed.
This commit is contained in:
parent
6f2759be3a
commit
439d9ff94d
4 changed files with 37 additions and 5 deletions
|
@ -80,4 +80,11 @@ func TestImportOrder(t *testing.T) {
|
|||
func Main() int { return pkg3.A }`
|
||||
eval(t, src, big.NewInt(1))
|
||||
})
|
||||
t.Run("InitializeOnce", func(t *testing.T) {
|
||||
src := `package foo
|
||||
import "github.com/nspcc-dev/neo-go/pkg/compiler/testdata/pkg3"
|
||||
var A = pkg3.A
|
||||
func Main() int { return A }`
|
||||
eval(t, src, big.NewInt(3))
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue