KSeExpr 6.0.0.0
Public Member Functions | Private Attributes | List of all members
KSeExpr::ExprLocalFunctionNode Class Reference

Node that contains local function. More...

#include <ExprNode.h>

Inheritance diagram for KSeExpr::ExprLocalFunctionNode:
KSeExpr::ExprNode

Public Member Functions

 ExprLocalFunctionNode (const Expression *expr, ExprPrototypeNode *prototype, ExprNode *block)
 
ExprType prep (bool wantScalar, ExprVarEnvBuilder &envBuilder) override
 Preps the definition of this site.
 
virtual ExprType prep (ExprFuncNode *callerNode, bool scalarWanted, ExprVarEnvBuilder &envBuilder) const
 Preps a caller (i.e. we use callerNode to check arguments)
 
const ExprPrototypeNodeprototype () const
 TODO: Accessor for prototype (probably not needed when we use prep right)
 
int buildInterpreter (Interpreter *interpreter) const override
 Build the interpreter.
 
int buildInterpreterForCall (const ExprFuncNode *callerNode, Interpreter *interpreter) const
 Build interpreter if we are called.
 
LLVM_VALUE codegen (LLVM_BUILDER) LLVM_BODY
 
- Public Member Functions inherited from KSeExpr::ExprNode
 ExprNode (const Expression *expr)
 
 ExprNode (const Expression *expr, const ExprType &type)
 
virtual ~ExprNode ()
 
bool isVec () const
 True if node has a vector result.
 
const Expressionexpr () const
 Access expression.
 
std::string toString () const
 Access to original string representation of current expression.
 
const ExprTypetype () const
 The type of the node.
 
void addError (const ErrorCode error, const std::vector< std::string > &ids={}) const
 Register error. This will allow users and sophisticated editors to highlight where in code problem was.
 
 ExprNode (const Expression *expr, ExprNode *a)
 
 ExprNode (const Expression *expr, ExprNode *a, const ExprType &type)
 
 ExprNode (const Expression *expr, ExprNode *a, ExprNode *b)
 
 ExprNode (const Expression *expr, ExprNode *a, ExprNode *b, const ExprType &type)
 
 ExprNode (const Expression *expr, ExprNode *a, ExprNode *b, ExprNode *c)
 
 ExprNode (const Expression *expr, ExprNode *a, ExprNode *b, ExprNode *c, const ExprType &type)
 
const ExprNodeparent () const
 Access parent node - root node has no parent.
 
int numChildren () const
 Number of children.
 
const ExprNodechild (size_t i) const
 Get 0 indexed child.
 
ExprNodechild (size_t i)
 Get 0 indexed child.
 
void swapChildren (size_t i, size_t j)
 Swap children, do not use unless you know what you are doing.
 
void removeLastChild ()
 Remove last child and delete the entry.
 
void addChild (ExprNode *child)
 Add a child to the child list (for parser use only)
 
void addChildren (ExprNode *surrogate)
 Transfer children from surrogate parent (for parser use only)
 
void setPosition (const short int startPos, const short int endPos)
 Remember the line and column position in the input string.
 
unsigned short int startPos () const
 Access start position in input string.
 
unsigned short int endPos () const
 Access end position in input string.
 
unsigned short int length () const
 Access length of input string.
 
bool checkCondition (bool check, const ErrorCode message, const std::vector< std::string > &ids, bool &error) const
 Checks the boolean value and records an error string with node if it is false.
 
bool checkIsValue (const ExprType &type, bool &error) const
 Checks if the type is a value (i.e. string or float[d])
 
bool checkIsFP (const ExprType &type, bool &error) const
 Checks if the type is a float[d] for any d.
 
bool checkIsFP (int d, const ExprType &type, bool &error) const
 Checks if the type is a float[d] for a specific d.
 
bool checkTypesCompatible (const ExprType &first, const ExprType &second, bool &error) const
 types match (true if they do)
 

Private Attributes

int _procedurePC {}
 
int _returnedDataOp {}
 

Additional Inherited Members

- Protected Member Functions inherited from KSeExpr::ExprNode
void setType (const ExprType &t)
 Set type of parameter.
 
void setTypeWithChildLife (const ExprType &t)
 Set's the type to the argument but uses the children to determine lifetime.
 
- Protected Attributes inherited from KSeExpr::ExprNode
const Expression_expr {nullptr}
 Owning expression (node can't modify)
 
ExprNode_parent {nullptr}
 Parent node (null if this the the root)
 
std::vector< ExprNode * > _children
 List of children.
 
bool _isVec
 True if node has a vector result.
 
ExprType _type
 
int _maxChildDim {}
 
unsigned short int _startPos {}
 Position line and collumn.
 
unsigned short int _endPos {}
 

Detailed Description

Node that contains local function.

Definition at line 350 of file ExprNode.h.

Constructor & Destructor Documentation

◆ ExprLocalFunctionNode()

KSeExpr::ExprLocalFunctionNode::ExprLocalFunctionNode ( const Expression expr,
ExprPrototypeNode prototype,
ExprNode block 
)
inline

Definition at line 353 of file ExprNode.h.

Member Function Documentation

◆ buildInterpreter()

int KSeExpr::ExprLocalFunctionNode::buildInterpreter ( Interpreter interpreter) const
overridevirtual

Build the interpreter.

Reimplemented from KSeExpr::ExprNode.

Definition at line 464 of file Interpreter.cpp.

References _procedurePC, _returnedDataOp, KSeExpr::ExprNode::child(), and KSeExpr::ExprNode::numChildren().

◆ buildInterpreterForCall()

int KSeExpr::ExprLocalFunctionNode::buildInterpreterForCall ( const ExprFuncNode callerNode,
Interpreter interpreter 
) const

Build interpreter if we are called.

Definition at line 479 of file Interpreter.cpp.

References _procedurePC, _returnedDataOp, KSeExpr::ExprNode::child(), and prototype().

◆ codegen()

LLVM_VALUE KSeExpr::ExprLocalFunctionNode::codegen ( LLVM_BUILDER  )
virtual

Reimplemented from KSeExpr::ExprNode.

◆ prep() [1/2]

ExprType KSeExpr::ExprLocalFunctionNode::prep ( bool  wantScalar,
ExprVarEnvBuilder envBuilder 
)
overridevirtual

◆ prep() [2/2]

ExprType KSeExpr::ExprLocalFunctionNode::prep ( ExprFuncNode callerNode,
bool  scalarWanted,
ExprVarEnvBuilder envBuilder 
) const
virtual

Preps a caller (i.e. we use callerNode to check arguments)

Definition at line 263 of file ExprNode.cpp.

References KSeExpr::ExprType::Error(), KSeExpr::ExprNode::numChildren(), prototype(), and KSeExpr::Unknown.

◆ prototype()

const ExprPrototypeNode * KSeExpr::ExprLocalFunctionNode::prototype ( ) const
inline

TODO: Accessor for prototype (probably not needed when we use prep right)

Definition at line 363 of file ExprNode.h.

References KSeExpr::ExprNode::child().

Referenced by buildInterpreterForCall(), prep(), and prep().

Member Data Documentation

◆ _procedurePC

int KSeExpr::ExprLocalFunctionNode::_procedurePC {}
mutableprivate

Definition at line 375 of file ExprNode.h.

Referenced by buildInterpreter(), and buildInterpreterForCall().

◆ _returnedDataOp

int KSeExpr::ExprLocalFunctionNode::_returnedDataOp {}
mutableprivate

Definition at line 376 of file ExprNode.h.

Referenced by buildInterpreter(), and buildInterpreterForCall().


The documentation for this class was generated from the following files: