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

37 lines
1.0 KiB
C++

/*
* Assignment.h
*
* Created on: Dec 7, 2012
* Author: attero
*/
#ifndef ASSIGNMENT_H_
#define ASSIGNMENT_H_
#include <string>
#include "ASTExpression.h"
#include "../Context.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:
Context * context;
std::string name;
SenchaObject evaluate();
void execute();
void execute_quietly();
Assignment(Context * context, std::string name, ASTExpression * left, ASTExpression * right);
virtual ~Assignment();
};
#endif /* ASSIGNMENT_H_ */