backend: when complaining about setter names, show the name we are complaining about

This commit is contained in:
Nick Fitzgerald 2018-08-10 13:15:12 -07:00
parent 178a5e89df
commit 016449ab3c

View File

@ -346,7 +346,9 @@ impl ImportFunction {
/// for a setter in javascript (in this case `xxx`, so you can write `obj.xxx = val`)
fn infer_setter_property(&self) -> String {
let name = self.function.name.to_string();
assert!(name.starts_with("set_"), "setters must start with `set_`");
if !name.starts_with("set_") {
panic!("error: setters must start with `set_`, found: {}", name);
}
name[4..].to_string()
}