/// Declares a built in function with the given name and type definition
/// The name is declared in the "current" scope which is at the top of the stack
/// The function is guaranteed to be called with arguments that match its given type signature
/// Functions that can be called on an instance of a type should have that type as the first
/// parameter as the "self" of that function
Declares a built in function with the given name and type definition
The name is declared in the "current" scope which is at the top of the stack
The function is guaranteed to be called with arguments that match its given type signature
Functions that can be called on an instance of a type should have that type as the first
parameter as the "self" of that function
Declares a built in function with the given name and type definition The name is declared in the " current " scope which is at the top of the stack The function is guaranteed to be called with arguments that match its given type signature Functions that can be called on an instance of a type should have that type as the first parameter as the " self " of that function
pub fn declare_builtin_function<F: 'static>(&mut self, name: Identifier, typ: ItemType, f: F)
        where F: Fn(&mut ScopeStack, FuncArgs, MemoryBlock) -> OperationsResult {
        // Make sure we are declaring the function as a function type
        debug_assert!(match typ {
            ItemType::Function { .. } => true,
            _ => false,
        });
        let type_id = self.insert_type(name.clone(), typ);
        self.insert_item_into_current(name, ScopeItem::BuiltInFunction {
            type_id: type_id,
            operations: Rc::new(f),
        });
    }
pub fn declare_builtin_function < F : ' static > ( & mut self , name : Identifier , typ : ItemType , f : F ) where F : Fn ( & mut ScopeStack , FuncArgs , MemoryBlock ) -> OperationsResult { // Make sure we are declaring the function as a function type debug_assert ! ( match typ { ItemType Function { } true false } ) ; let type_id = self . insert_type ( name . clone ( ) , typ ) ; self . insert_item_into_current ( name , ScopeItem :: BuiltInFunction { type_id : type_id , operations : Rc :: new ( f ) , } ) ; }
Declares a built in function with the given name and type definition
The name is declared in the "current" scope which is at the top of the stack
The function is guaranteed to be called with arguments that match its given type signature
Functions that can be called on an instance of a type should have that type as the first
parameter as the "self" of that function
Declares a built in function with the given name and type definition The name is declared in the " current " scope which is at the top of the stack The function is guaranteed to be called with arguments that match its given type signature Functions that can be called on an instance of a type should have that type as the first parameter as the " self " of that function
&mut self
name
Identifier
typ
ItemType
f
F