From 852e6a335b8c60847d29bfba36b6b33c5a96fe2c Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Tue, 3 Dec 2019 18:18:14 +0300 Subject: [PATCH] compiler: move it up from vm It really deserves it, I think. Especially given that it doesn't have any direct usage of `vm` package now. --- .gitignore | 3 --- cli/smartcontract/smart_contract.go | 2 +- docs/cli.md | 6 ++---- pkg/{vm => }/compiler/analysis.go | 0 pkg/{vm => }/compiler/codegen.go | 0 pkg/{vm => }/compiler/compiler.go | 0 pkg/{vm => }/compiler/compiler_test.go | 4 ++-- pkg/{vm => }/compiler/emit.go | 0 pkg/{vm => }/compiler/func_scope.go | 0 pkg/{vm => }/compiler/syscall.go | 0 pkg/vm/cli/cli.go | 2 +- pkg/vm/tests/vm_test.go | 2 +- 12 files changed, 7 insertions(+), 12 deletions(-) rename pkg/{vm => }/compiler/analysis.go (100%) rename pkg/{vm => }/compiler/codegen.go (100%) rename pkg/{vm => }/compiler/compiler.go (100%) rename pkg/{vm => }/compiler/compiler_test.go (90%) rename pkg/{vm => }/compiler/emit.go (100%) rename pkg/{vm => }/compiler/func_scope.go (100%) rename pkg/{vm => }/compiler/syscall.go (100%) diff --git a/.gitignore b/.gitignore index 78297164b..cb8e5a620 100644 --- a/.gitignore +++ b/.gitignore @@ -28,9 +28,6 @@ bin/ *~ TAGS -# anthdm todolists -/pkg/vm/compiler/todo.md - # leveldb chains/ chain/ diff --git a/cli/smartcontract/smart_contract.go b/cli/smartcontract/smart_contract.go index 526ceaf6e..f80c93ce2 100644 --- a/cli/smartcontract/smart_contract.go +++ b/cli/smartcontract/smart_contract.go @@ -11,13 +11,13 @@ import ( "os" "path/filepath" + "github.com/CityOfZion/neo-go/pkg/compiler" "github.com/CityOfZion/neo-go/pkg/crypto/hash" "github.com/CityOfZion/neo-go/pkg/crypto/keys" "github.com/CityOfZion/neo-go/pkg/rpc" "github.com/CityOfZion/neo-go/pkg/smartcontract" "github.com/CityOfZion/neo-go/pkg/util" "github.com/CityOfZion/neo-go/pkg/vm" - "github.com/CityOfZion/neo-go/pkg/vm/compiler" "github.com/go-yaml/yaml" "github.com/pkg/errors" "github.com/urfave/cli" diff --git a/docs/cli.md b/docs/cli.md index 3748401aa..d8a224b88 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -166,7 +166,7 @@ INDEX OPCODE DESC ``` In depth documentation about the **neo-go** compiler and smart contract examples can be found inside -the [compiler package](https://github.com/nspcc-dev/neo-go/tree/master/pkg/vm/compiler). +the [compiler package](https://github.com/nspcc-dev/neo-go/tree/master/pkg/compiler). ## VM run To run VM use @@ -182,10 +182,8 @@ There is a small subset of commands: - `ops` -- show the opcodes of currently loaded contract - `run` -- executes currently loaded contract -More details can be found in - [vm package]([compiler package](https://github.com/nspcc-dev/neo-go/tree/master/pkg/vm/compiler)) ## Wallet operations - `./bin/neo-go wallet create -p newWallet` to create new wallet in the path `newWallet` - `./bin/neo-go wallet open -p newWallet` to open created wallet in the path `newWallet` -- `./bin/neo-go wallet create -p newWallet -a` to create new account \ No newline at end of file +- `./bin/neo-go wallet create -p newWallet -a` to create new account diff --git a/pkg/vm/compiler/analysis.go b/pkg/compiler/analysis.go similarity index 100% rename from pkg/vm/compiler/analysis.go rename to pkg/compiler/analysis.go diff --git a/pkg/vm/compiler/codegen.go b/pkg/compiler/codegen.go similarity index 100% rename from pkg/vm/compiler/codegen.go rename to pkg/compiler/codegen.go diff --git a/pkg/vm/compiler/compiler.go b/pkg/compiler/compiler.go similarity index 100% rename from pkg/vm/compiler/compiler.go rename to pkg/compiler/compiler.go diff --git a/pkg/vm/compiler/compiler_test.go b/pkg/compiler/compiler_test.go similarity index 90% rename from pkg/vm/compiler/compiler_test.go rename to pkg/compiler/compiler_test.go index 5ddd11824..e49a31f30 100644 --- a/pkg/vm/compiler/compiler_test.go +++ b/pkg/compiler/compiler_test.go @@ -6,10 +6,10 @@ import ( "path" "testing" - "github.com/CityOfZion/neo-go/pkg/vm/compiler" + "github.com/CityOfZion/neo-go/pkg/compiler" ) -const examplePath = "../../../examples" +const examplePath = "../../examples" func TestExamplesFolder(t *testing.T) { infos, err := ioutil.ReadDir(examplePath) diff --git a/pkg/vm/compiler/emit.go b/pkg/compiler/emit.go similarity index 100% rename from pkg/vm/compiler/emit.go rename to pkg/compiler/emit.go diff --git a/pkg/vm/compiler/func_scope.go b/pkg/compiler/func_scope.go similarity index 100% rename from pkg/vm/compiler/func_scope.go rename to pkg/compiler/func_scope.go diff --git a/pkg/vm/compiler/syscall.go b/pkg/compiler/syscall.go similarity index 100% rename from pkg/vm/compiler/syscall.go rename to pkg/compiler/syscall.go diff --git a/pkg/vm/cli/cli.go b/pkg/vm/cli/cli.go index e4e2115ba..3054df427 100644 --- a/pkg/vm/cli/cli.go +++ b/pkg/vm/cli/cli.go @@ -10,8 +10,8 @@ import ( "strconv" "strings" + "github.com/CityOfZion/neo-go/pkg/compiler" "github.com/CityOfZion/neo-go/pkg/vm" - "github.com/CityOfZion/neo-go/pkg/vm/compiler" "gopkg.in/abiosoft/ishell.v2" ) diff --git a/pkg/vm/tests/vm_test.go b/pkg/vm/tests/vm_test.go index deb18eaa7..011103934 100644 --- a/pkg/vm/tests/vm_test.go +++ b/pkg/vm/tests/vm_test.go @@ -5,8 +5,8 @@ import ( "strings" "testing" + "github.com/CityOfZion/neo-go/pkg/compiler" "github.com/CityOfZion/neo-go/pkg/vm" - "github.com/CityOfZion/neo-go/pkg/vm/compiler" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" )