Format.
This commit is contained in:
parent
1c0b2964af
commit
6508cc9078
|
@ -586,8 +586,7 @@ pub fn compile(module: &Module<'_>) -> anyhow::Result<Vec<u8>> {
|
|||
for (func, func_decl) in module.funcs.entries().skip(num_func_imports) {
|
||||
match func_decl {
|
||||
FuncDecl::Import(_, _) => anyhow::bail!("Import comes after func with body: {}", func),
|
||||
FuncDecl::Lazy(sig, _, _)
|
||||
| FuncDecl::Body(sig, _, _) => {
|
||||
FuncDecl::Lazy(sig, _, _) | FuncDecl::Body(sig, _, _) => {
|
||||
funcs.function(sig.index() as u32);
|
||||
}
|
||||
FuncDecl::None => panic!("FuncDecl::None at compilation time"),
|
||||
|
|
|
@ -75,18 +75,18 @@ impl<'a> FuncDecl<'a> {
|
|||
|
||||
pub fn name(&self) -> &str {
|
||||
match self {
|
||||
FuncDecl::Body(_, name, _)
|
||||
| FuncDecl::Lazy(_, name, _)
|
||||
| FuncDecl::Import(_, name) => &name[..],
|
||||
FuncDecl::Body(_, name, _) | FuncDecl::Lazy(_, name, _) | FuncDecl::Import(_, name) => {
|
||||
&name[..]
|
||||
}
|
||||
FuncDecl::None => panic!("No name for FuncDecl::None"),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_name(&mut self, new_name: &str) {
|
||||
match self {
|
||||
FuncDecl::Body(_, name, _)
|
||||
| FuncDecl::Lazy(_, name, _)
|
||||
| FuncDecl::Import(_, name) => *name = new_name.to_owned(),
|
||||
FuncDecl::Body(_, name, _) | FuncDecl::Lazy(_, name, _) | FuncDecl::Import(_, name) => {
|
||||
*name = new_name.to_owned()
|
||||
}
|
||||
FuncDecl::None => panic!("No name for FuncDecl::None"),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue