compiler: do not emit code for unnamed unused variables
If variable is unnamed and does not contain function call then it's treated as unused and code generation may be omitted for it initialization/declaration.
This commit is contained in:
parent
1dcbdb011a
commit
91b36657d6
8 changed files with 151 additions and 18 deletions
|
@ -100,7 +100,7 @@ func TestInitWithNoGlobals(t *testing.T) {
|
|||
func Main() int {
|
||||
return 42
|
||||
}`
|
||||
v, s := vmAndCompileInterop(t, src)
|
||||
v, s, _ := vmAndCompileInterop(t, src)
|
||||
require.NoError(t, v.Run())
|
||||
assertResult(t, v, big.NewInt(42))
|
||||
require.True(t, len(s.events) == 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue