Skip to content

Commit

Permalink
Switch from version strings to schema versions
Browse files Browse the repository at this point in the history
Should help reduce some churn a bit!
  • Loading branch information
alexcrichton committed Mar 6, 2018
1 parent 1db5b3f commit 98030e0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/wasm-bindgen-cli-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ fn extract_programs(module: &mut Module) -> Vec<shared::Program> {
panic!("failed to decode what looked like wasm-bindgen data: {}", e)
}
};
if p.version != version {
if p.schema_version != shared::SCHEMA_VERSION {
panic!("
it looks like the Rust project used to create this wasm file was linked against
Expand Down
1 change: 1 addition & 0 deletions crates/wasm-bindgen-macro/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ impl Program {
})
}),
("version", &|a| a.str(&shared::version())),
("schema_version", &|a| a.str(&shared::SCHEMA_VERSION)),
]);
a.cnt
};
Expand Down
3 changes: 3 additions & 0 deletions crates/wasm-bindgen-shared/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ extern crate fnv;
use std::char;
use std::hash::{Hash, Hasher};

pub const SCHEMA_VERSION: &str = "0";

#[derive(Deserialize)]
pub struct Program {
pub exports: Vec<Export>,
pub enums: Vec<Enum>,
pub imports: Vec<Import>,
pub custom_type_names: Vec<CustomTypeName>,
pub version: String,
pub schema_version: String,
}

#[derive(Deserialize)]
Expand Down

0 comments on commit 98030e0

Please sign in to comment.