summaryrefslogtreecommitdiffstats
path: root/Sencha-lang/AST/Assignment.h
blob: a646af4d437cce986d42228547be739232966017 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
 * 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 set_name(std::string name);
	void execute();
	void execute_quietly();
	void add_lvalue(ASTExpression *);
	void add_rvalue(ASTExpression *);
	virtual std::string debug() ;
	Assignment(Context * context);
	virtual ~Assignment();
};

#endif /* ASSIGNMENT_H_ */