Move push_label under validation context.
This commit is contained in:
parent
628815ac0f
commit
eaa030afa7
|
@ -175,14 +175,6 @@ impl Compiler {
|
||||||
result_ty,
|
result_ty,
|
||||||
);
|
);
|
||||||
|
|
||||||
push_label(
|
|
||||||
StartedWith::Block,
|
|
||||||
result_ty,
|
|
||||||
context.position,
|
|
||||||
&context.value_stack,
|
|
||||||
&mut context.frame_stack,
|
|
||||||
)?;
|
|
||||||
|
|
||||||
let mut compiler = Compiler {
|
let mut compiler = Compiler {
|
||||||
sink: Sink::with_instruction_capacity(ins_size_estimate),
|
sink: Sink::with_instruction_capacity(ins_size_estimate),
|
||||||
label_stack: Vec::new(),
|
label_stack: Vec::new(),
|
||||||
|
@ -1115,14 +1107,25 @@ impl<'a> FunctionValidationContext<'a> {
|
||||||
frame_stack_limit: usize,
|
frame_stack_limit: usize,
|
||||||
return_type: BlockType,
|
return_type: BlockType,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
FunctionValidationContext {
|
let mut ctx = FunctionValidationContext {
|
||||||
module: module,
|
module: module,
|
||||||
position: 0,
|
position: 0,
|
||||||
locals: locals,
|
locals: locals,
|
||||||
value_stack: StackWithLimit::with_limit(value_stack_limit),
|
value_stack: StackWithLimit::with_limit(value_stack_limit),
|
||||||
frame_stack: StackWithLimit::with_limit(frame_stack_limit),
|
frame_stack: StackWithLimit::with_limit(frame_stack_limit),
|
||||||
return_type: return_type,
|
return_type: return_type,
|
||||||
}
|
};
|
||||||
|
// push_label overflows only if the frame stack overflow happens. We assume that
|
||||||
|
// the limit is greater than 0 here. We don't expect `push_label` getting any other
|
||||||
|
// new errors.
|
||||||
|
let _ = push_label(
|
||||||
|
StartedWith::Block,
|
||||||
|
return_type,
|
||||||
|
ctx.position,
|
||||||
|
&ctx.value_stack,
|
||||||
|
&mut ctx.frame_stack,
|
||||||
|
);
|
||||||
|
ctx
|
||||||
}
|
}
|
||||||
|
|
||||||
fn return_type(&self) -> BlockType {
|
fn return_type(&self) -> BlockType {
|
||||||
|
|
Loading…
Reference in New Issue