simple user function

This commit is contained in:
NikVolf
2017-05-15 15:40:08 +03:00
parent 21ff1509f6
commit b7ff4d92d4
6 changed files with 108 additions and 37 deletions

View File

@ -62,8 +62,11 @@ pub struct ModuleInstance {
/// Caller context.
pub struct CallerContext<'a> {
/// Value stack limit
pub value_stack_limit: usize,
/// Frame stack limit
pub frame_stack_limit: usize,
/// Stack of the input parameters
pub value_stack: &'a mut StackWithLimit<RuntimeValue>,
}
@ -315,6 +318,7 @@ impl ModuleInstanceInterface for ModuleInstance {
}
impl<'a> CallerContext<'a> {
/// Top most args
pub fn topmost(args: &'a mut StackWithLimit<RuntimeValue>) -> Self {
CallerContext {
value_stack_limit: 1024,
@ -323,6 +327,7 @@ impl<'a> CallerContext<'a> {
}
}
/// Nested context
pub fn nested(outer: &'a mut FunctionContext) -> Self {
CallerContext {
value_stack_limit: outer.value_stack().limit() - outer.value_stack().len(),