This commit is contained in:
Sergey Pepyakin 2019-04-05 23:56:55 +02:00
parent 05527b05db
commit 628815ac0f
2 changed files with 14 additions and 14 deletions

View File

@ -211,12 +211,13 @@ impl Compiler {
loop {
let instruction = &body[context.position];
self.compile_instruction(context, instruction).map_err(|err| {
Error(format!(
"At instruction {:?}(@{}): {}",
instruction, context.position, err
))
})?;
self.compile_instruction(context, instruction)
.map_err(|err| {
Error(format!(
"At instruction {:?}(@{}): {}",
instruction, context.position, err
))
})?;
context.position += 1;
if context.position == body_len {

View File

@ -265,14 +265,13 @@ pub fn validate_module(module: Module) -> Result<ValidatedModule, Error> {
.bodies()
.get(index as usize)
.ok_or(Error(format!("Missing body for function {}", index)))?;
let code =
Compiler::compile(&context, function, function_body).map_err(|e| {
let Error(ref msg) = e;
Error(format!(
"Function #{} reading/validation error: {}",
index, msg
))
})?;
let code = Compiler::compile(&context, function, function_body).map_err(|e| {
let Error(ref msg) = e;
Error(format!(
"Function #{} reading/validation error: {}",
index, msg
))
})?;
code_map.push(code);
}
}