mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-04 19:02:28 +00:00
compiler: fix global constant traversal
There can be no global variables, but some global constants.
Introduced in 0b44a430
.
This commit is contained in:
parent
b807fd9e7f
commit
ec58bec803
3 changed files with 37 additions and 14 deletions
|
@ -202,12 +202,22 @@ func TestExportedVariable(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestExportedConst(t *testing.T) {
|
||||
src := `package foo
|
||||
import "github.com/nspcc-dev/neo-go/pkg/compiler/testdata/multi"
|
||||
func Main() int {
|
||||
return multi.SomeConst
|
||||
}`
|
||||
eval(t, src, big.NewInt(42))
|
||||
t.Run("with vars", func(t *testing.T) {
|
||||
src := `package foo
|
||||
import "github.com/nspcc-dev/neo-go/pkg/compiler/testdata/multi"
|
||||
func Main() int {
|
||||
return multi.SomeConst
|
||||
}`
|
||||
eval(t, src, big.NewInt(42))
|
||||
})
|
||||
t.Run("const only", func(t *testing.T) {
|
||||
src := `package foo
|
||||
import "github.com/nspcc-dev/neo-go/pkg/compiler/testdata/constonly"
|
||||
func Main() int {
|
||||
return constonly.Answer
|
||||
}`
|
||||
eval(t, src, big.NewInt(42))
|
||||
})
|
||||
}
|
||||
|
||||
func TestMultipleFuncSameName(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue