KSeExpr
4.0.4.0
|
Node that contains prototype of function. More...
#include <ExprNode.h>
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 ExprNode * | arg (int i) const |
const std::string & | name () const |
int | buildInterpreter (Interpreter *interpreter) const override |
Build the interpreter. More... | |
LLVM_VALUE | codegen (LLVM_BUILDER) LLVM_BODY |
int | interpreterOps (int c) const |
Return op for interpreter. More... | |
![]() | |
ExprNode (const Expression *expr) | |
ExprNode (const Expression *expr, const ExprType &type) | |
virtual | ~ExprNode () |
bool | isVec () const |
True if node has a vector result. More... | |
const Expression * | expr () const |
Access expression. More... | |
std::string | toString () const |
Access to original string representation of current expression. More... | |
const ExprType & | type () const |
The type of the node. More... | |
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. More... | |
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 ExprNode * | parent () const |
Access parent node - root node has no parent. More... | |
int | numChildren () const |
Number of children. More... | |
const ExprNode * | child (size_t i) const |
Get 0 indexed child. More... | |
ExprNode * | child (size_t i) |
Get 0 indexed child. More... | |
void | swapChildren (size_t i, size_t j) |
Swap children, do not use unless you know what you are doing. More... | |
void | removeLastChild () |
Remove last child and delete the entry. More... | |
void | addChild (ExprNode *child) |
Add a child to the child list (for parser use only) More... | |
void | addChildren (ExprNode *surrogate) |
Transfer children from surrogate parent (for parser use only) More... | |
void | setPosition (const short int startPos, const short int endPos) |
Remember the line and column position in the input string. More... | |
unsigned short int | startPos () const |
Access start position in input string. More... | |
unsigned short int | endPos () const |
Access end position in input string. More... | |
unsigned short int | length () const |
Access length of input string. More... | |
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. More... | |
bool | checkIsValue (const ExprType &type, bool &error) const |
Checks if the type is a value (i.e. string or float[d]) More... | |
bool | checkIsFP (const ExprType &type, bool &error) const |
Checks if the type is a float[d] for any d. More... | |
bool | checkIsFP (int d, const ExprType &type, bool &error) const |
Checks if the type is a float[d] for a specific d. More... | |
bool | checkTypesCompatible (const ExprType &first, const ExprType &second, bool &error) const |
types match (true if they do) More... | |
Private Attributes | |
std::string | _name |
bool | _retTypeSet |
ExprType | _retType |
std::vector< ExprType > | _argTypes |
std::vector< int > | _interpreterOps |
Additional Inherited Members | |
![]() | |
void | setType (const ExprType &t) |
Set type of parameter. More... | |
void | setTypeWithChildLife (const ExprType &t) |
Set's the type to the argument but uses the children to determine lifetime. More... | |
![]() | |
const Expression * | _expr {nullptr} |
Owning expression (node can't modify) More... | |
ExprNode * | _parent {nullptr} |
Parent node (null if this the the root) More... | |
std::vector< ExprNode * > | _children |
List of children. More... | |
bool | _isVec |
True if node has a vector result. More... | |
ExprType | _type |
int | _maxChildDim {} |
unsigned short int | _startPos {} |
Position line and collumn. More... | |
unsigned short int | _endPos {} |
Node that contains prototype of function.
Definition at line 275 of file ExprNode.h.
|
inline |
Definition at line 278 of file ExprNode.h.
|
inline |
Definition at line 287 of file ExprNode.h.
void KSeExpr::ExprPrototypeNode::addArgs | ( | ExprNode * | surrogate | ) |
Definition at line 196 of file ExprNode.cpp.
References _argTypes, KSeExpr::ExprNode::addChildren(), KSeExpr::ExprNode::child(), name(), KSeExpr::ExprNode::numChildren(), and KSeExpr::ExprNode::type().
void KSeExpr::ExprPrototypeNode::addArgTypes | ( | ExprNode * | surrogate | ) |
Definition at line 188 of file ExprNode.cpp.
References _argTypes, KSeExpr::ExprNode::addChildren(), KSeExpr::ExprNode::child(), KSeExpr::ExprNode::numChildren(), and KSeExpr::ExprNode::type().
|
inline |
Definition at line 320 of file ExprNode.h.
References KSeExpr::ExprNode::child().
|
inline |
Definition at line 316 of file ExprNode.h.
References _argTypes.
|
overridevirtual |
Build the interpreter.
Reimplemented from KSeExpr::ExprNode.
Definition at line 907 of file Interpreter.cpp.
|
virtual |
Reimplemented from KSeExpr::ExprNode.
|
inline |
|
inline |
Definition at line 306 of file ExprNode.h.
References _retTypeSet.
Referenced by KSeExpr::ExprLocalFunctionNode::prep().
|
inline |
Definition at line 325 of file ExprNode.h.
References _name.
Referenced by addArgs(), prep(), and KSeExpr::ExprLocalFunctionNode::prep().
|
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(), KSeExpr::ExprType::isValid(), name(), KSeExpr::None, KSeExpr::ExprNode::numChildren(), KSeExpr::ExprNode::prep(), returnType(), KSeExpr::ExprNode::setType(), KSeExpr::ExprNode::type(), and KSeExpr::Unknown.
Referenced by KSeExpr::ExprLocalFunctionNode::prep().
|
inline |
Definition at line 311 of file ExprNode.h.
References _retType, and _retTypeSet.
Referenced by prep(), and KSeExpr::ExprLocalFunctionNode::prep().
|
inline |
Definition at line 300 of file ExprNode.h.
References _retType, _retTypeSet, and KSeExpr::ExprNode::type().
Referenced by KSeExpr::ExprLocalFunctionNode::prep().
|
private |
Definition at line 343 of file ExprNode.h.
Referenced by addArgs(), addArgTypes(), argType(), and prep().
|
mutableprivate |
Definition at line 344 of file ExprNode.h.
Referenced by interpreterOps().
|
private |
Definition at line 340 of file ExprNode.h.
Referenced by name().
|
private |
Definition at line 342 of file ExprNode.h.
Referenced by returnType(), and setReturnType().
|
private |
Definition at line 341 of file ExprNode.h.
Referenced by isReturnTypeSet(), prep(), returnType(), and setReturnType().