KSeExpr 4.0.4.0
KSeExpr::ExprPrototypeNode Class Reference

Node that contains prototype of function. More...

#include <ExprNode.h>

Inheritance diagram for KSeExpr::ExprPrototypeNode:
KSeExpr::ExprNode

Public Member Functions

 ExprPrototypeNode (const Expression *expr, const std::string &name, const ExprType &retType)
 ExprPrototypeNode (const Expression *expr, const std::string &name)
ExprType prep (bool wantScalar, ExprVarEnvBuilder &envBuilder) override
void addArgTypes (ExprNode *surrogate)
void addArgs (ExprNode *surrogate)
void setReturnType (const ExprType &type)
bool isReturnTypeSet () const
ExprType returnType () const
ExprType argType (int i) const
const ExprNodearg (int i) const
const std::string & name () const
int buildInterpreter (Interpreter *interpreter) const override
 Build the interpreter.
LLVM_VALUE codegen (LLVM_BUILDER) LLVM_BODY
int interpreterOps (int c) const
 Return op for interpreter.
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

std::string _name
bool _retTypeSet
ExprType _retType
std::vector< ExprType_argTypes
std::vector< int > _interpreterOps

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 prototype of function.

Definition at line 275 of file ExprNode.h.

Constructor & Destructor Documentation

◆ ExprPrototypeNode() [1/2]

KSeExpr::ExprPrototypeNode::ExprPrototypeNode ( const Expression * expr,
const std::string & name,
const ExprType & retType )
inline

◆ ExprPrototypeNode() [2/2]

KSeExpr::ExprPrototypeNode::ExprPrototypeNode ( const Expression * expr,
const std::string & name )
inline

Member Function Documentation

◆ addArgs()

◆ addArgTypes()

void KSeExpr::ExprPrototypeNode::addArgTypes ( ExprNode * surrogate)

◆ arg()

const ExprNode * KSeExpr::ExprPrototypeNode::arg ( int i) const
inline

Definition at line 320 of file ExprNode.h.

References KSeExpr::ExprNode::child(), and KSeExpr::ExprNode::ExprNode().

◆ argType()

ExprType KSeExpr::ExprPrototypeNode::argType ( int i) const
inline

Definition at line 316 of file ExprNode.h.

References _argTypes.

◆ buildInterpreter()

int KSeExpr::ExprPrototypeNode::buildInterpreter ( Interpreter * interpreter) const
overridevirtual

◆ codegen()

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

Reimplemented from KSeExpr::ExprNode.

References LLVM_BODY.

◆ interpreterOps()

int KSeExpr::ExprPrototypeNode::interpreterOps ( int c) const
inline

Return op for interpreter.

Definition at line 334 of file ExprNode.h.

References _interpreterOps.

◆ isReturnTypeSet()

bool KSeExpr::ExprPrototypeNode::isReturnTypeSet ( ) const
inline

Definition at line 306 of file ExprNode.h.

References _retTypeSet.

◆ name()

const std::string & KSeExpr::ExprPrototypeNode::name ( ) const
inline

Definition at line 325 of file ExprNode.h.

References _name.

Referenced by addArgs(), ExprPrototypeNode(), ExprPrototypeNode(), and prep().

◆ prep()

ExprType KSeExpr::ExprPrototypeNode::prep ( bool dontNeedScalar,
ExprVarEnvBuilder & envBuilder )
overridevirtual

Prepare the node (for parser use only). See the discussion at the start of SeExprNode.cpp for more info.

Default is to call prep on children (giving AnyType as desired type). If all children return valid types, returns NoneType. Otherwise, returns ErrorType. Note: Ignores wanted type.

Reimplemented from KSeExpr::ExprNode.

Definition at line 160 of file ExprNode.cpp.

References _argTypes, _retTypeSet, KSeExpr::ExprNode::_type, KSeExpr::ExprNode::checkCondition(), KSeExpr::ExprNode::child(), KSeExpr::ExprLocalVar::getPhi(), name(), KSeExpr::None, KSeExpr::ExprNode::numChildren(), KSeExpr::ExprNode::prep(), returnType(), KSeExpr::ExprNode::setType(), KSeExpr::ExprNode::type(), and KSeExpr::Unknown.

◆ returnType()

ExprType KSeExpr::ExprPrototypeNode::returnType ( ) const
inline

Definition at line 311 of file ExprNode.h.

References _retType, and _retTypeSet.

Referenced by KSeExpr::ExprLocalFunctionNode::prep(), and prep().

◆ setReturnType()

void KSeExpr::ExprPrototypeNode::setReturnType ( const ExprType & type)
inline

Definition at line 300 of file ExprNode.h.

References _retType, _retTypeSet, and KSeExpr::ExprNode::type().

Member Data Documentation

◆ _argTypes

std::vector<ExprType> KSeExpr::ExprPrototypeNode::_argTypes
private

Definition at line 343 of file ExprNode.h.

Referenced by addArgs(), addArgTypes(), argType(), ExprPrototypeNode(), ExprPrototypeNode(), and prep().

◆ _interpreterOps

std::vector<int> KSeExpr::ExprPrototypeNode::_interpreterOps
mutableprivate

Definition at line 344 of file ExprNode.h.

Referenced by buildInterpreter(), and interpreterOps().

◆ _name

std::string KSeExpr::ExprPrototypeNode::_name
private

Definition at line 340 of file ExprNode.h.

Referenced by ExprPrototypeNode(), ExprPrototypeNode(), and name().

◆ _retType

ExprType KSeExpr::ExprPrototypeNode::_retType
private

Definition at line 342 of file ExprNode.h.

Referenced by ExprPrototypeNode(), returnType(), and setReturnType().

◆ _retTypeSet

bool KSeExpr::ExprPrototypeNode::_retTypeSet
private

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