mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-26 19:42:23 +00:00
compiler: adjust TestInline template
Move all auxiliary function declaration after Main, so that INITSLOT instructions counter works properly. `vmAndCompileInterop` loads program and moves nextIP to the Main function offset if there's no _init function. If _init is there, then nextIP will be moved to the start of _init. In TestInline we don't handle instructions properly (CALL/JMP don't change nextIP), we just perform instruction traversal from the start point via Next(), thus INITSLOT counter value depends on the starting instruction, which depends on _init presence.
This commit is contained in:
parent
91b36657d6
commit
1e6b70d570
1 changed files with 4 additions and 4 deletions
|
@ -55,13 +55,13 @@ func TestInline(t *testing.T) {
|
||||||
a int
|
a int
|
||||||
b pair
|
b pair
|
||||||
}
|
}
|
||||||
// local alias
|
|
||||||
func sum(a, b int) int {
|
|
||||||
return 42
|
|
||||||
}
|
|
||||||
var Num = 1
|
var Num = 1
|
||||||
func Main() int {
|
func Main() int {
|
||||||
%s
|
%s
|
||||||
|
}
|
||||||
|
// local alias
|
||||||
|
func sum(a, b int) int {
|
||||||
|
return 42
|
||||||
}`
|
}`
|
||||||
t.Run("no return", func(t *testing.T) {
|
t.Run("no return", func(t *testing.T) {
|
||||||
src := fmt.Sprintf(srcTmpl, `inline.NoArgsNoReturn()
|
src := fmt.Sprintf(srcTmpl, `inline.NoArgsNoReturn()
|
||||||
|
|
Loading…
Reference in a new issue