Skip to content

Commit 98030e0

Browse files
committed
Switch from version strings to schema versions
Should help reduce some churn a bit!
1 parent 1db5b3f commit 98030e0

File tree

3 files changed

+5
-1
lines changed
  • crates
    • wasm-bindgen-cli-support/src
    • wasm-bindgen-macro/src
    • wasm-bindgen-shared/src

3 files changed

+5
-1
lines changed

crates/wasm-bindgen-cli-support/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ fn extract_programs(module: &mut Module) -> Vec<shared::Program> {
163163
panic!("failed to decode what looked like wasm-bindgen data: {}", e)
164164
}
165165
};
166-
if p.version != version {
166+
if p.schema_version != shared::SCHEMA_VERSION {
167167
panic!("
168168
169169
it looks like the Rust project used to create this wasm file was linked against

crates/wasm-bindgen-macro/src/ast.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ impl Program {
351351
})
352352
}),
353353
("version", &|a| a.str(&shared::version())),
354+
("schema_version", &|a| a.str(&shared::SCHEMA_VERSION)),
354355
]);
355356
a.cnt
356357
};

crates/wasm-bindgen-shared/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@ extern crate fnv;
55
use std::char;
66
use std::hash::{Hash, Hasher};
77

8+
pub const SCHEMA_VERSION: &str = "0";
9+
810
#[derive(Deserialize)]
911
pub struct Program {
1012
pub exports: Vec<Export>,
1113
pub enums: Vec<Enum>,
1214
pub imports: Vec<Import>,
1315
pub custom_type_names: Vec<CustomTypeName>,
1416
pub version: String,
17+
pub schema_version: String,
1518
}
1619

1720
#[derive(Deserialize)]

0 commit comments

Comments
 (0)