neo-go/pkg/compiler
Anna Shaleva 0bca027f99 compiler: avoid panic on empty package list
An attempt to compile unexisting file via neo-go-vm CLI leads to the following
panic:
```
NEO-GO-VM > loadgo ./1-print.go
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/nspcc-dev/neo-go/pkg/compiler.codeGen(0xc000047300)
	github.com/nspcc-dev/neo-go/pkg/compiler/codegen.go:2188 +0x60c
github.com/nspcc-dev/neo-go/pkg/compiler.CompileWithOptions({0xc000047300, 0xf66c92}, {0x0, 0x0}, 0xc0003a0000)
	github.com/nspcc-dev/neo-go/pkg/compiler/compiler.go:218 +0x65
github.com/nspcc-dev/neo-go/pkg/vm/cli.handleLoadGo(0xc0000f5340)
	github.com/nspcc-dev/neo-go/pkg/vm/cli/cli.go:480 +0x1a5
github.com/urfave/cli.HandleAction({0xde74a0, 0x10d61d0}, 0x6)
	github.com/urfave/cli@v1.22.5/app.go:524 +0xa8
github.com/urfave/cli.Command.Run({{0xf632f0, 0x6}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0xf9915b, 0x38}, {0xf6a57b, ...}, ...}, ...)
	github.com/urfave/cli@v1.22.5/command.go:173 +0x652
github.com/urfave/cli.(*App).Run(0xc0002c2000, {0xc00036c330, 0x3, 0x3})
	github.com/urfave/cli@v1.22.5/app.go:277 +0x705
github.com/nspcc-dev/neo-go/pkg/vm/cli.(*VMCLI).Run(0xc000290890)
	github.com/nspcc-dev/neo-go/pkg/vm/cli/cli.go:694 +0x317
github.com/nspcc-dev/neo-go/cli/vm.startVMPrompt(0xc0001b9e40)
	github.com/nspcc-dev/neo-go/cli/vm/vm.go:29 +0x92
github.com/urfave/cli.HandleAction({0xde74a0, 0x10d5d10}, 0x2)
	github.com/urfave/cli@v1.22.5/app.go:524 +0xa8
github.com/urfave/cli.Command.Run({{0xf60a2f, 0x2}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0xf7880b, 0x19}, {0x0, ...}, ...}, ...)
	github.com/urfave/cli@v1.22.5/command.go:173 +0x652
github.com/urfave/cli.(*App).Run(0xc0001c8fc0, {0xc000116020, 0x2, 0x2})
	github.com/urfave/cli@v1.22.5/app.go:277 +0x705
main.main()
	./main.go:21 +0x33
```
2022-08-17 11:29:28 +03:00
..
testdata compiler: allow to use conditional returns in inlined functions 2022-07-12 12:43:31 +03:00
analysis.go *: apply go 1.19 formatter heuristics 2022-08-09 15:37:52 +03:00
assign_test.go compiler: group small tests in a single file 2022-03-04 17:55:33 +03:00
binary_expr_test.go compiler: group small tests in a single file 2022-03-04 17:55:33 +03:00
byte_conversion_test.go compiler: allow to convert string constants to []byte 2020-01-27 15:29:52 +03:00
codegen.go compiler: avoid panic on empty package list 2022-08-17 11:29:28 +03:00
codegen_test.go compiler: allow to use += on strings 2020-08-24 09:44:44 +03:00
compiler.go compiler: always ensure manifest passes base check 2022-08-02 17:37:43 +03:00
compiler_test.go compiler: always ensure manifest passes base check 2022-08-02 17:37:43 +03:00
constant_test.go compiler/interop: replace int64 with int 2021-03-04 13:20:43 +03:00
convert_test.go compiler: make interface{}() conversions possible 2022-07-07 15:10:29 +03:00
debug.go [#2442] English Check 2022-05-04 19:48:27 +03:00
debug_test.go compiler: emit bindings configuration 2022-02-28 15:36:14 +03:00
defer_test.go compiler: properly process defer in conditional statements 2022-02-04 11:04:03 +03:00
doc.go *: add more package-specific documentation 2021-03-19 16:18:45 +03:00
for_test.go compiler: group small tests in a single file 2022-03-04 17:55:33 +03:00
func_scope.go compiler: allow to call methods on return values 2022-07-11 19:28:15 +03:00
function_call_test.go compiler: allow to call methods on return values 2022-07-11 19:28:15 +03:00
global_test.go compiler: allow to use _ in constants 2022-01-20 13:52:58 +03:00
if_test.go compiler: do not DROP unary expression value inside IF stmt 2020-10-13 19:14:44 +03:00
import_test.go vm/emit: emit Boolean values correctly 2021-03-09 13:34:22 +03:00
init_test.go compiler: allow to use local variables in init() 2020-10-06 19:08:32 +03:00
inline.go *: apply go 1.19 formatter heuristics 2022-08-09 15:37:52 +03:00
inline_test.go compiler: remove jumps to the next instruction 2022-07-12 16:17:31 +03:00
interop_test.go interop: wrap contract.LoadToken in context.LoadToken 2022-06-06 21:53:03 +03:00
jumps_test.go compiler: reduce instructions in 2 stages 2022-07-12 13:16:33 +03:00
lambda_test.go compiler: support calling function literals 2020-08-27 10:28:50 +03:00
limit_test.go compiler: emit integers correctly 2020-01-28 16:39:19 +03:00
map_test.go compiler: support delete() builtin 2020-09-06 15:49:41 +03:00
native_test.go Revert "native/interop: revert management.hasMethod()" 2022-07-28 17:00:34 +03:00
nilcheck_test.go compiler: support nil checks 2020-06-24 10:43:58 +03:00
numeric_test.go compiler: move tests from vm/tests 2019-12-23 17:05:34 +03:00
panic_test.go compiler: do not log panic message 2020-08-27 10:28:50 +03:00
pointer_test.go compiler: copy structs when passing as arguments 2020-08-05 13:14:38 +03:00
return_test.go compiler: do not DROP return value with type assertion 2020-10-13 19:14:44 +03:00
slice_test.go compiler: group small tests in a single file 2022-03-04 17:55:33 +03:00
struct_test.go compiler: group small tests in a single file 2022-03-04 17:55:33 +03:00
switch_test.go compiler: group small tests in a single file 2022-03-04 17:55:33 +03:00
syscall_test.go interop: add equality helpers 2022-07-11 15:59:24 +03:00
type_test.go compiler: support non-struct methods 2020-05-19 16:40:26 +03:00
types.go compiler: update x/tools package 2022-01-20 13:21:26 +03:00
vars.go compiler: allow to use multiple underscores in func arguments 2021-10-09 13:23:11 +03:00
verify_test.go [#2442] English Check 2022-05-04 19:48:27 +03:00
vm_test.go compiler: speed up boolean expression short-circuit test 2022-01-20 13:21:26 +03:00