sencha-lang/Sencha-lang/AST/Assignment.h

36 lines
1.1 KiB
C++

/*
* Assignment.h
*
* Created on: Dec 7, 2012
* Author: attero
*/
#ifndef ASSIGNMENT_H_
#define ASSIGNMENT_H_
#include <string>
#include "ASTExpression.h"
#include "../ContextManager.h"
/**
* Assignment is an abstraction of assignment.
* It is different from i.e BasicExpression so that it change value of the lvalue
* and has to forward this change to whole system. Assignment does it thanks to its
* fellowship with right context
* if expression is assigned not to variable, it doesn't update value of variable of course
* it just gives value of rvalue...
* mmm... maybe it'd be better to return InvalidExpression with appropriate error message such
* as: "Invalid assignment, values cannot be assigned to constant values"
*/
class Assignment : public ASTExpression {
public:
ContextManager * context_manager;
std::string name;
std::string name_of_context;
SenchaObject evaluate();
SenchaObject execute();
Assignment(ContextManager * context, std::string name, ASTExpression * left, ASTExpression * right);
virtual ~Assignment();
};
#endif /* ASSIGNMENT_H_ */