Move translation state initialization into a method.

This commit is contained in:
Jakob Stoklund Olesen
2017-09-05 10:52:31 -07:00
parent ef3ea72422
commit 6f864f2926
2 changed files with 27 additions and 10 deletions

View File

@@ -108,17 +108,11 @@ pub fn translate_function_body(
}
}
let mut state = TranslationState::new();
// We initialize the control stack with the implicit function block
let mut state = TranslationState::new();
let end_ebb = builder.create_ebb();
state.push_block(
end_ebb,
sig.return_types
.iter()
.map(|argty| argty.value_type)
.collect(),
);
state.initialize(sig, end_ebb);
// Now the main loop that reads every wasm instruction and translates it
loop {
let parser_state = parser.read();