diff --git a/gas/Cargo.lock b/gas/Cargo.lock index 7adb829..4353571 100644 --- a/gas/Cargo.lock +++ b/gas/Cargo.lock @@ -13,7 +13,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "parity-wasm" version = "0.2.0" -source = "git+https://github.com/nikvolf/parity-wasm#cafc5058357f6ea84daaec870057da8455bf74e8" +source = "git+https://github.com/nikvolf/parity-wasm#4011af4f75e9334a2a018fdb2f464d9c7eb21617" dependencies = [ "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/gas/src/main.rs b/gas/src/main.rs index 22a6149..95e272f 100644 --- a/gas/src/main.rs +++ b/gas/src/main.rs @@ -48,6 +48,8 @@ fn main() { // back to plain module let mut module = mbuilder.build(); + assert!(module.global_section().is_some()); + // calculate actual function index of the imported definition // (substract all imports that are NOT functions) diff --git a/samples/contract1.c b/samples/contract1.c new file mode 100644 index 0000000..3812354 --- /dev/null +++ b/samples/contract1.c @@ -0,0 +1,10 @@ +int ops = 0; + +void log(int block_ops) { + ops += block_ops; +} + +int call(int x) { + log(5); + return 2 * x; +} \ No newline at end of file