From 989bf3288e24ad721c4dcacf1f7bb854679df271 Mon Sep 17 00:00:00 2001 From: NikVolf Date: Tue, 25 Apr 2017 16:33:17 +0300 Subject: [PATCH 01/18] export section --- src/elements/module.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/elements/module.rs b/src/elements/module.rs index cf87296..ce3e408 100644 --- a/src/elements/module.rs +++ b/src/elements/module.rs @@ -3,6 +3,7 @@ use super::{Deserialize, Serialize, Error, Uint32}; use super::section::{ Section, CodeSection, TypeSection, ImportSection, FunctionsSection, GlobalSection, TableSection, ElementSection, DataSection, MemorySection, + ExportSection, }; /// WebAssembly module @@ -121,6 +122,14 @@ impl Module { } None } + + /// Export section, if any. + pub fn export_section(&self) -> Option<&ExportSection> { + for section in self.sections() { + if let &Section::Export(ref sect) = section { return Some(sect); } + } + None + } } impl Deserialize for Module { From 825169d34ea6d9c3909fe762e36ccc3ba5ae98cf Mon Sep 17 00:00:00 2001 From: NikVolf Date: Tue, 25 Apr 2017 16:33:40 +0300 Subject: [PATCH 02/18] bump version --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 2a8e9fc..6d7d8f2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "parity-wasm" -version = "0.3.0" +version = "0.3.1" authors = ["NikVolf "] license = "MIT/Apache-2.0" readme = "README.md" From c52ccb7cd3c54cb0dbf9495dec550b5848737dcb Mon Sep 17 00:00:00 2001 From: NikVolf Date: Wed, 26 Apr 2017 15:46:30 +0300 Subject: [PATCH 03/18] mutable global entries --- src/elements/section.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/elements/section.rs b/src/elements/section.rs index 19162fb..09c3a71 100644 --- a/src/elements/section.rs +++ b/src/elements/section.rs @@ -399,6 +399,11 @@ impl GlobalSection { pub fn entries(&self) -> &[GlobalEntry] { &self.0 } + + /// List of all global entries in the section (mutable) + pub fn entries_mut(&mut self) -> &mut Vec { + &mut self.0 + } } impl Deserialize for GlobalSection { From aeae465b9ecaa24b4a7bd00294a26aedc9750ea9 Mon Sep 17 00:00:00 2001 From: NikVolf Date: Wed, 26 Apr 2017 22:59:31 +0300 Subject: [PATCH 04/18] add mutable refs --- src/elements/global_entry.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/elements/global_entry.rs b/src/elements/global_entry.rs index 9fb23bb..9a79f4d 100644 --- a/src/elements/global_entry.rs +++ b/src/elements/global_entry.rs @@ -12,6 +12,10 @@ impl GlobalEntry { pub fn global_type(&self) -> &GlobalType { &self.global_type } /// Initialization expression (opcodes) for global. pub fn init_expr(&self) -> &InitExpr { &self.init_expr } + /// Global type (mutable) + pub fn global_type_mut(&mut self) -> &mut GlobalType { &mut self.global_type } + /// Initialization expression (opcodes) for global (mutable) + pub fn init_expr_mut(&mut self) -> &mut InitExpr { &mut self.init_expr } } impl Deserialize for GlobalEntry { From 62e331c98c49d9f120840e10d23478c0b9f33e4c Mon Sep 17 00:00:00 2001 From: NikVolf Date: Wed, 26 Apr 2017 23:01:21 +0300 Subject: [PATCH 05/18] add mutable init_expr code --- src/elements/ops.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/elements/ops.rs b/src/elements/ops.rs index d73b26c..3318700 100644 --- a/src/elements/ops.rs +++ b/src/elements/ops.rs @@ -66,6 +66,11 @@ impl InitExpr { pub fn code(&self) -> &[Opcode] { &self.0 } + + /// List of opcodes used in the expression. + pub fn code_mut(&mut self) -> &mut Vec { + &mut self.0 + } } // todo: check if kind of opcode sequence is valid as an expression From d54f093a5c3897cb7c7e082412868313086cbab6 Mon Sep 17 00:00:00 2001 From: NikVolf Date: Wed, 26 Apr 2017 23:09:57 +0300 Subject: [PATCH 06/18] also mutable interior for elem/data segments --- src/elements/segment.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/elements/segment.rs b/src/elements/segment.rs index fd399b1..0ce4c76 100644 --- a/src/elements/segment.rs +++ b/src/elements/segment.rs @@ -17,11 +17,17 @@ impl ElementSegment { /// Sequence of function indices. pub fn members(&self) -> &[u32] { &self.members } + /// Sequence of function indices (mutable) + pub fn members_mut(&mut self) -> &mut Vec { &mut self.members } + /// Table index (currently valid only value of `0`) pub fn index(&self) -> u32 { self.index } /// An i32 initializer expression that computes the offset at which to place the elements. pub fn offset(&self) -> &InitExpr { &self.offset } + + /// An i32 initializer expression that computes the offset at which to place the elements (mutable) + pub fn offset_mut(&mut self) -> &mut InitExpr { &mut self.offset } } impl Deserialize for ElementSegment { @@ -79,10 +85,18 @@ impl DataSegment { /// Linear memory index (currently the only valid value is `0`). pub fn index(&self) -> u32 { self.index } + /// An i32 initializer expression that computes the offset at which to place the data. pub fn offset(&self) -> &InitExpr { &self.offset } + + /// An i32 initializer expression that computes the offset at which to place the data (mutable) + pub fn offset_mut(&mut self) -> &mut InitExpr { &mut self.offset } + /// Initial value of the data segment. pub fn value(&self) -> &[u8] { &self.value } + + /// Initial value of the data segment. + pub fn value_mut(&mut self) -> &mut Vec { &mut self.value } } impl Deserialize for DataSegment { From 445ae26b65a2108e3773050da65bfb65d60cea95 Mon Sep 17 00:00:00 2001 From: NikVolf Date: Wed, 26 Apr 2017 23:10:37 +0300 Subject: [PATCH 07/18] fix doc comment --- src/elements/segment.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/elements/segment.rs b/src/elements/segment.rs index 0ce4c76..9a43cce 100644 --- a/src/elements/segment.rs +++ b/src/elements/segment.rs @@ -95,7 +95,7 @@ impl DataSegment { /// Initial value of the data segment. pub fn value(&self) -> &[u8] { &self.value } - /// Initial value of the data segment. + /// Initial value of the data segment (mutable). pub fn value_mut(&mut self) -> &mut Vec { &mut self.value } } From 8a7afa35650a3fa15d8665eb2c2d53b63d189598 Mon Sep 17 00:00:00 2001 From: NikVolf Date: Wed, 26 Apr 2017 23:10:59 +0300 Subject: [PATCH 08/18] bump version --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 6d7d8f2..7bd6a2e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "parity-wasm" -version = "0.3.1" +version = "0.3.2" authors = ["NikVolf "] license = "MIT/Apache-2.0" readme = "README.md" From b11f34f2e5410d0773dcf32699d767d7359e4ca9 Mon Sep 17 00:00:00 2001 From: NikVolf Date: Wed, 26 Apr 2017 23:15:31 +0300 Subject: [PATCH 09/18] mutable for code/data sections themselves --- src/elements/section.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/elements/section.rs b/src/elements/section.rs index 09c3a71..d2baf69 100644 --- a/src/elements/section.rs +++ b/src/elements/section.rs @@ -538,6 +538,11 @@ impl ElementSection { pub fn entries(&self) -> &[ElementSegment] { &self.0 } + + /// List of all data entries in the section (mutable) + pub fn entries_mut(&mut self) -> &mut Vec { + &mut self.0 + } } impl Deserialize for ElementSection { @@ -581,6 +586,11 @@ impl DataSection { pub fn entries(&self) -> &[DataSegment] { &self.0 } + + /// List of all data entries in the section (mutable) + pub fn entries_mut(&mut self) -> &mut Vec { + &mut self.0 + } } impl Deserialize for DataSection { From c82afccfda2d94756f2475ec5253d8e9809872fb Mon Sep 17 00:00:00 2001 From: NikVolf Date: Thu, 4 May 2017 11:44:22 +0300 Subject: [PATCH 10/18] mutable typeref --- src/elements/func.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/elements/func.rs b/src/elements/func.rs index fcef2ad..d2015db 100644 --- a/src/elements/func.rs +++ b/src/elements/func.rs @@ -15,6 +15,11 @@ impl Func { pub fn type_ref(&self) -> u32 { self.0 } + + /// Function signature type reference (mutable). + pub fn type_ref_mut(&mut self) -> &mut u32 { + &mut self.0 + } } /// Local definition inside the function body. From 26450d47058a3728f3b497565573de3f8fa16636 Mon Sep 17 00:00:00 2001 From: NikVolf Date: Thu, 4 May 2017 11:44:44 +0300 Subject: [PATCH 11/18] bump version --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 7bd6a2e..5978f2b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "parity-wasm" -version = "0.3.2" +version = "0.3.3" authors = ["NikVolf "] license = "MIT/Apache-2.0" readme = "README.md" From ce40e22ef3ba0a4cf1ac7006228e0b64d3f28fdf Mon Sep 17 00:00:00 2001 From: NikVolf Date: Thu, 4 May 2017 12:13:59 +0300 Subject: [PATCH 12/18] mutable signature --- src/elements/import_entry.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/elements/import_entry.rs b/src/elements/import_entry.rs index 83328d3..915fcc1 100644 --- a/src/elements/import_entry.rs +++ b/src/elements/import_entry.rs @@ -266,7 +266,7 @@ impl ImportEntry { pub fn external(&self) -> &External { &self.external } /// Local binidng of the import entry (mutable) - pub fn external_mut(&mut self) -> &External { &mut self.external } + pub fn external_mut(&mut self) -> &mut External { &mut self.external } } impl Deserialize for ImportEntry { From 5d7c7b4094c18e71c394e83a097cd634d36f74b2 Mon Sep 17 00:00:00 2001 From: NikVolf Date: Thu, 4 May 2017 12:14:24 +0300 Subject: [PATCH 13/18] new version --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 5978f2b..4794865 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "parity-wasm" -version = "0.3.3" +version = "0.4.0" authors = ["NikVolf "] license = "MIT/Apache-2.0" readme = "README.md" From 9345ef5f22e083fab3d3a101d879cbdef9ae9a9b Mon Sep 17 00:00:00 2001 From: NikVolf Date: Tue, 9 May 2017 15:23:05 +0300 Subject: [PATCH 14/18] export builder --- src/builder/export.rs | 102 +++++++++++++++++++++++++++++++++++ src/builder/mod.rs | 4 +- src/builder/module.rs | 31 ++++++++++- src/elements/export_entry.rs | 11 ++++ 4 files changed, 146 insertions(+), 2 deletions(-) create mode 100644 src/builder/export.rs diff --git a/src/builder/export.rs b/src/builder/export.rs new file mode 100644 index 0000000..379aacb --- /dev/null +++ b/src/builder/export.rs @@ -0,0 +1,102 @@ +use super::invoke::{Invoke, Identity}; +use elements; + +pub struct ExportBuilder { + callback: F, + field: String, + binding: elements::Internal, +} + +impl ExportBuilder { + pub fn new() -> Self { + ExportBuilder::with_callback(Identity) + } +} + +impl ExportBuilder { + + pub fn with_callback(callback: F) -> Self { + ExportBuilder { + callback: callback, + field: String::new(), + binding: elements::Internal::Function(0), + } + } + + pub fn field(mut self, field: &str) -> Self { + self.field = field.to_owned(); + self + } + + pub fn with_internal(mut self, external: elements::Internal) -> Self { + self.binding = external; + self + } + + pub fn internal(self) -> ExportInternalBuilder { + ExportInternalBuilder::with_callback(self) + } +} + +impl ExportBuilder where F: Invoke { + pub fn build(self) -> F::Result { + self.callback.invoke(elements::ExportEntry::new(self.field, self.binding)) + } +} + +impl Invoke for ExportBuilder { + type Result = Self; + fn invoke(self, val: elements::Internal) -> Self { + self.with_internal(val) + } +} + +pub struct ExportInternalBuilder { + callback: F, + binding: elements::Internal, +} + +impl ExportInternalBuilder where F: Invoke { + pub fn with_callback(callback: F) -> Self { + ExportInternalBuilder{ + callback: callback, + binding: elements::Internal::Function(0), + } + } + + pub fn func(mut self, index: u32) -> F::Result { + self.binding = elements::Internal::Function(index); + self.callback.invoke(self.binding) + } + + pub fn memory(mut self, index: u32) -> F::Result { + self.binding = elements::Internal::Memory(index); + self.callback.invoke(self.binding) + } + + pub fn table(mut self, index: u32) -> F::Result { + self.binding = elements::Internal::Table(index); + self.callback.invoke(self.binding) + } + + pub fn global(mut self, index: u32) -> F::Result { + self.binding = elements::Internal::Global(index); + self.callback.invoke(self.binding) + } +} + +/// New builder for export entry +pub fn export() -> ExportBuilder { + ExportBuilder::new() +} + +#[cfg(test)] +mod tests { + use super::export; + + #[test] + fn example() { + let entry = export().field("memory").internal().memory(0).build(); + assert_eq!(entry.field(), "memory"); + } +} \ No newline at end of file diff --git a/src/builder/mod.rs b/src/builder/mod.rs index 06766b8..f77ed5c 100644 --- a/src/builder/mod.rs +++ b/src/builder/mod.rs @@ -5,7 +5,9 @@ mod module; mod code; mod misc; mod import; +mod export; pub use self::module::{module, from_module, ModuleBuilder}; pub use self::code::{signatures, signature, function}; -pub use self::import::import; \ No newline at end of file +pub use self::import::import; +pub use self::export::export; \ No newline at end of file diff --git a/src/builder/module.rs b/src/builder/module.rs index 9902d46..cccb521 100644 --- a/src/builder/module.rs +++ b/src/builder/module.rs @@ -1,6 +1,6 @@ use super::invoke::{Invoke, Identity}; use super::code::{self, SignaturesBuilder, FunctionBuilder}; -use super::import; +use super::{import, export}; use elements; /// Module builder @@ -248,11 +248,22 @@ impl ModuleBuilder where F: Invoke { self } + /// With inserted import entry + pub fn with_export(mut self, entry: elements::ExportEntry) -> Self { + self.module.export.entries_mut().push(entry); + self + } + /// Import entry builder pub fn import(self) -> import::ImportBuilder { import::ImportBuilder::with_callback(self) } + /// Export entry builder + pub fn export(self) -> export::ExportBuilder { + export::ExportBuilder::with_callback(self) + } + /// Build module (final step) pub fn build(self) -> F::Result { self.callback.invoke(self.module.into()) @@ -302,6 +313,16 @@ impl Invoke for ModuleBuilder } } +impl Invoke for ModuleBuilder + where F: Invoke +{ + type Result = Self; + + fn invoke(self, entry: elements::ExportEntry) -> Self::Result { + self.with_export(entry) + } +} + /// Start new module builder pub fn module() -> ModuleBuilder { ModuleBuilder::new() @@ -337,4 +358,12 @@ mod tests { assert_eq!(module.code_section().expect("code section to exist").bodies().len(), 1); } + #[test] + fn export() { + let module = module() + .export().field("call").internal().func(0).build() + .build(); + + assert_eq!(module.export_section().expect("export section to exist").entries().len(), 1); + } } diff --git a/src/elements/export_entry.rs b/src/elements/export_entry.rs index b119ac4..7ff78f2 100644 --- a/src/elements/export_entry.rs +++ b/src/elements/export_entry.rs @@ -53,12 +53,23 @@ pub struct ExportEntry { } impl ExportEntry { + /// New export entry + pub fn new(field: String, internal: Internal) -> Self { + ExportEntry { + field_str: field, + internal: internal + } + } + /// Public name pub fn field(&self) -> &str { &self.field_str } + /// Public name (mutable) pub fn field_mut(&mut self) -> &mut str { &mut self.field_str } + /// Internal reference of the export entry. pub fn internal(&self) -> &Internal { &self.internal } + /// Internal reference of the export entry (mutable). pub fn internal_mut(&mut self) -> &mut Internal { &mut self.internal } } From 1fae5952e10da3e7ab390a5e8fd61dc8e3c25fbb Mon Sep 17 00:00:00 2001 From: NikVolf Date: Tue, 9 May 2017 15:23:33 +0300 Subject: [PATCH 15/18] bump version --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 4794865..e41f376 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "parity-wasm" -version = "0.4.0" +version = "0.4.1" authors = ["NikVolf "] license = "MIT/Apache-2.0" readme = "README.md" From 81f79e84e78345fa8911382860921cf7865dce72 Mon Sep 17 00:00:00 2001 From: NikVolf Date: Tue, 9 May 2017 17:34:36 +0300 Subject: [PATCH 16/18] global builder --- src/builder/code.rs | 1 - src/builder/global.rs | 83 ++++++++++++++++++++++++++++++++++++ src/builder/mod.rs | 4 +- src/elements/global_entry.rs | 7 +++ 4 files changed, 93 insertions(+), 2 deletions(-) create mode 100644 src/builder/global.rs diff --git a/src/builder/code.rs b/src/builder/code.rs index 710a377..a863938 100644 --- a/src/builder/code.rs +++ b/src/builder/code.rs @@ -202,7 +202,6 @@ impl FuncBodyBuilder { } impl FuncBodyBuilder where F: Invoke { - pub fn with_func(mut self, func: elements::FuncBody) -> Self { self.body = func; self diff --git a/src/builder/global.rs b/src/builder/global.rs new file mode 100644 index 0000000..2cae4ba --- /dev/null +++ b/src/builder/global.rs @@ -0,0 +1,83 @@ +use super::invoke::{Invoke, Identity}; +use super::misc::ValueTypeBuilder; +use elements; + +pub struct GlobalBuilder { + callback: F, + value_type: elements::ValueType, + is_mutable: bool, + init_expr: elements::InitExpr, +} + +impl GlobalBuilder { + pub fn new() -> Self { + GlobalBuilder::with_callback(Identity) + } +} + +impl GlobalBuilder { + pub fn with_callback(callback: F) -> Self { + GlobalBuilder { + callback: callback, + value_type: elements::ValueType::I32, + init_expr: elements::InitExpr::empty(), + is_mutable: false, + } + } + + pub fn with_type(mut self, value_type: elements::ValueType) -> Self { + self.value_type = value_type; + self + } + + pub fn mutable(mut self) -> Self { + self.is_mutable = true; + self + } + + pub fn init_expr(mut self, opcode: elements::Opcode) -> Self { + self.init_expr = elements::InitExpr::new(vec![opcode, elements::Opcode::End]); + self + } + + pub fn value_type(self) -> ValueTypeBuilder { + ValueTypeBuilder::with_callback(self) + } +} + +impl GlobalBuilder where F: Invoke { + pub fn build(self) -> F::Result { + self.callback.invoke( + elements::GlobalEntry::new( + elements::GlobalType::new(self.value_type, self.is_mutable), + self.init_expr, + ) + ) + } +} + + +impl Invoke for GlobalBuilder { + type Result = Self; + fn invoke(self, the_type: elements::ValueType) -> Self { + self.with_type(the_type) + } +} + +/// New builder for export entry +pub fn global() -> GlobalBuilder { + GlobalBuilder::new() +} + +#[cfg(test)] +mod tests { + use super::global; + use elements; + + #[test] + fn example() { + let entry = global().value_type().i32().build(); + assert_eq!(entry.global_type().content_type(), elements::ValueType::I32); + assert_eq!(entry.global_type().is_mutable(), false); + } +} \ No newline at end of file diff --git a/src/builder/mod.rs b/src/builder/mod.rs index f77ed5c..8ecea0e 100644 --- a/src/builder/mod.rs +++ b/src/builder/mod.rs @@ -6,8 +6,10 @@ mod code; mod misc; mod import; mod export; +mod global; pub use self::module::{module, from_module, ModuleBuilder}; pub use self::code::{signatures, signature, function}; pub use self::import::import; -pub use self::export::export; \ No newline at end of file +pub use self::export::export; +pub use self::global::global; \ No newline at end of file diff --git a/src/elements/global_entry.rs b/src/elements/global_entry.rs index 9a79f4d..1f27b21 100644 --- a/src/elements/global_entry.rs +++ b/src/elements/global_entry.rs @@ -8,6 +8,13 @@ pub struct GlobalEntry { } impl GlobalEntry { + /// New global entry + pub fn new(global_type: GlobalType, init_expr: InitExpr) -> Self { + GlobalEntry { + global_type: global_type, + init_expr: init_expr, + } + } /// Global type. pub fn global_type(&self) -> &GlobalType { &self.global_type } /// Initialization expression (opcodes) for global. From 5f98122fbc90600bb5c4be435261aab0cedcd298 Mon Sep 17 00:00:00 2001 From: NikVolf Date: Tue, 9 May 2017 17:38:51 +0300 Subject: [PATCH 17/18] global builder to module --- src/builder/module.rs | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/src/builder/module.rs b/src/builder/module.rs index cccb521..4557d56 100644 --- a/src/builder/module.rs +++ b/src/builder/module.rs @@ -1,6 +1,6 @@ use super::invoke::{Invoke, Identity}; use super::code::{self, SignaturesBuilder, FunctionBuilder}; -use super::{import, export}; +use super::{import, export, global}; use elements; /// Module builder @@ -248,12 +248,18 @@ impl ModuleBuilder where F: Invoke { self } - /// With inserted import entry + /// With inserted export entry pub fn with_export(mut self, entry: elements::ExportEntry) -> Self { self.module.export.entries_mut().push(entry); self } + /// With inserted global entry + pub fn with_global(mut self, entry: elements::GlobalEntry) -> Self { + self.module.global.entries_mut().push(entry); + self + } + /// Import entry builder pub fn import(self) -> import::ImportBuilder { import::ImportBuilder::with_callback(self) @@ -264,6 +270,11 @@ impl ModuleBuilder where F: Invoke { export::ExportBuilder::with_callback(self) } + /// Glboal entry builder + pub fn global(self) -> global::GlobalBuilder { + global::GlobalBuilder::with_callback(self) + } + /// Build module (final step) pub fn build(self) -> F::Result { self.callback.invoke(self.module.into()) @@ -323,6 +334,16 @@ impl Invoke for ModuleBuilder } } +impl Invoke for ModuleBuilder + where F: Invoke +{ + type Result = Self; + + fn invoke(self, entry: elements::GlobalEntry) -> Self::Result { + self.with_global(entry) + } +} + /// Start new module builder pub fn module() -> ModuleBuilder { ModuleBuilder::new() @@ -366,4 +387,13 @@ mod tests { assert_eq!(module.export_section().expect("export section to exist").entries().len(), 1); } -} + + #[test] + fn global() { + let module = module() + .global().value_type().i64().mutable().init_expr(::elements::Opcode::I64Const(5)).build() + .build(); + + assert_eq!(module.global_section().expect("global section to exist").entries().len(), 1); + } + } From 26dd173767a5b5b4c4a4aba292d46fc2369cbed1 Mon Sep 17 00:00:00 2001 From: NikVolf Date: Tue, 9 May 2017 17:39:12 +0300 Subject: [PATCH 18/18] bump version --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index e41f376..7d080a1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "parity-wasm" -version = "0.4.1" +version = "0.4.2" authors = ["NikVolf "] license = "MIT/Apache-2.0" readme = "README.md"