compiler: set type information during traversal, fix #2231
Set all necessary context before file traversal, not only import maps. Also, we can skip restoring import maps because all our code is processed via `For*` iterators which set necessary context. We can also refactor this a bit to have all context in one place, this will be done in #2086. Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
eea728b986
commit
8a0429036b
3 changed files with 32 additions and 2 deletions
|
@ -350,4 +350,17 @@ func TestUnusedFunctions(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
eval(t, src, big.NewInt(65))
|
||||
})
|
||||
t.Run("method inside of an imported package", func(t *testing.T) {
|
||||
// Check that import map is set correctly during package traversal.
|
||||
src := `package foo
|
||||
import inner "github.com/nspcc-dev/neo-go/pkg/compiler/testdata/nestedcall"
|
||||
func Main() int {
|
||||
var t inner.Token
|
||||
return t.Method()
|
||||
}`
|
||||
|
||||
_, err := compiler.Compile("foo", strings.NewReader(src))
|
||||
require.NoError(t, err)
|
||||
eval(t, src, big.NewInt(2231))
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue