2012-12-08 19:59:05 +00:00
|
|
|
/*
|
|
|
|
* Assignment.h
|
|
|
|
*
|
|
|
|
* Created on: Dec 7, 2012
|
|
|
|
* Author: attero
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ASSIGNMENT_H_
|
|
|
|
#define ASSIGNMENT_H_
|
2012-12-09 10:29:08 +00:00
|
|
|
#include <string>
|
|
|
|
#include "ASTExpression.h"
|
2012-12-30 13:59:30 +00:00
|
|
|
#include "../ContextManager.h"
|
2012-12-28 10:41:43 +00:00
|
|
|
/**
|
|
|
|
* 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"
|
|
|
|
*/
|
2012-12-09 10:29:08 +00:00
|
|
|
class Assignment : public ASTExpression {
|
2012-12-08 19:59:05 +00:00
|
|
|
public:
|
2012-12-31 16:10:37 +00:00
|
|
|
ContextManager * context_manager;
|
2012-12-09 10:29:08 +00:00
|
|
|
|
2012-12-09 20:17:13 +00:00
|
|
|
std::string name;
|
2012-12-31 16:10:37 +00:00
|
|
|
std::string name_of_context;
|
2012-12-09 10:29:08 +00:00
|
|
|
SenchaObject evaluate();
|
2012-12-31 16:10:37 +00:00
|
|
|
SenchaObject execute();
|
2012-12-30 13:59:30 +00:00
|
|
|
Assignment(ContextManager * context, std::string name, ASTExpression * left, ASTExpression * right);
|
2012-12-08 19:59:05 +00:00
|
|
|
virtual ~Assignment();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* ASSIGNMENT_H_ */
|