SeExpr
Public Member Functions | Private Attributes | List of all members
SeExpr2::ExprAssignNode Class Reference

Node that compute a local variable assignment. More...

#include <ExprNode.h>

Inheritance diagram for SeExpr2::ExprAssignNode:
SeExpr2::ExprNode

Public Member Functions

 ExprAssignNode (const Expression *expr, const char *name, ExprNode *e)
 
virtual ExprType prep (bool wantScalar, ExprVarEnvBuilder &envBuilder)
 
virtual int buildInterpreter (Interpreter *interpreter) const
 builds an interpreter. Returns the location index for the evaluated data
 
virtual LLVM_VALUE codegen (LLVM_BUILDER) LLVM_BODY
 
const std::string & name () const
 
const ExprTypeassignedType () const
 
const ExprLocalVarlocalVar () const
 
- Public Member Functions inherited from SeExpr2::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 std::string &error) 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.
 
short int startPos () const
 Access start position in input string.
 
short int endPos () const
 Access end position in input string.
 
short int length () const
 Access length of input string.
 
bool checkCondition (bool check, const std::string &message, bool &error)
 Checks the boolean value and records an error string with node if it is false.
 
bool checkIsValue (const ExprType &type, bool &error)
 Checks if the type is a value (i.e. string or float[d])
 
bool checkIsFP (const ExprType &type, bool &error)
 Checks if the type is a float[d] for any d.
 
bool checkIsFP (int d, const ExprType &type, bool &error)
 Checks if the type is a float[d] for a specific d.
 
bool checkTypesCompatible (const ExprType &first, const ExprType &second, bool &error)
 types match (true if they do)
 

Private Attributes

std::string _name
 
ExprLocalVar_localVar
 
ExprType _assignedType
 

Additional Inherited Members

- Protected Member Functions inherited from SeExpr2::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 SeExpr2::ExprNode
const Expression_expr
 Owning expression (node can't modify)
 
ExprNode_parent
 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 compute a local variable assignment.

Definition at line 355 of file ExprNode.h.

Constructor & Destructor Documentation

◆ ExprAssignNode()

SeExpr2::ExprAssignNode::ExprAssignNode ( const Expression expr,
const char name,
ExprNode e 
)
inline

Definition at line 357 of file ExprNode.h.

Member Function Documentation

◆ assignedType()

const ExprType & SeExpr2::ExprAssignNode::assignedType ( ) const
inline

Definition at line 368 of file ExprNode.h.

References _assignedType.

◆ buildInterpreter()

int SeExpr2::ExprAssignNode::buildInterpreter ( Interpreter interpreter) const
virtual

builds an interpreter. Returns the location index for the evaluated data

Reimplemented from SeExpr2::ExprNode.

Definition at line 743 of file Interpreter.cpp.

References _localVar, SeExpr2::ExprLocalVar::buildInterpreter(), and SeExpr2::ExprNode::child().

◆ codegen()

virtual LLVM_VALUE SeExpr2::ExprAssignNode::codegen ( LLVM_BUILDER  )
virtual

Reimplemented from SeExpr2::ExprNode.

◆ localVar()

const ExprLocalVar * SeExpr2::ExprAssignNode::localVar ( ) const
inline

Definition at line 371 of file ExprNode.h.

References _localVar.

Referenced by prep().

◆ name()

const std::string & SeExpr2::ExprAssignNode::name ( ) const
inline

Definition at line 365 of file ExprNode.h.

References _name.

◆ prep()

ExprType SeExpr2::ExprAssignNode::prep ( bool  dontNeedScalar,
ExprVarEnvBuilder envBuilder 
)
virtual

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 SeExpr2::ExprNode.

Definition at line 307 of file ExprNode.cpp.

References _assignedType, _localVar, _name, SeExpr2::ExprNode::_type, SeExpr2::ExprNode::checkCondition(), SeExpr2::ExprNode::child(), SeExpr2::ExprType::isValid(), localVar(), SeExpr2::ExprNode::setType(), SeExpr2::ExprNode::setTypeWithChildLife(), SeExpr2::ExprType::toString(), and SeExpr2::ExprNode::type().

Member Data Documentation

◆ _assignedType

ExprType SeExpr2::ExprAssignNode::_assignedType
private

Definition at line 376 of file ExprNode.h.

Referenced by assignedType(), and prep().

◆ _localVar

ExprLocalVar* SeExpr2::ExprAssignNode::_localVar
private

Definition at line 375 of file ExprNode.h.

Referenced by buildInterpreter(), localVar(), and prep().

◆ _name

std::string SeExpr2::ExprAssignNode::_name
private

Definition at line 374 of file ExprNode.h.

Referenced by name(), and prep().


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