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

36 lines
1.1 KiB
C
Raw Normal View History

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"
#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"
*/
2012-12-09 10:29:08 +00:00
class Assignment : public ASTExpression {
2012-12-08 19:59:05 +00:00
public:
ContextManager * context_manager;
2012-12-09 10:29:08 +00:00
std::string name;
std::string name_of_context;
2012-12-09 10:29:08 +00:00
SenchaObject evaluate();
SenchaObject execute();
Assignment(ContextManager * context, std::string name, ASTExpression * left, ASTExpression * right);
2012-12-08 19:59:05 +00:00
virtual ~Assignment();
};
#endif /* ASSIGNMENT_H_ */