Esempio n. 1
0
Environment* ConditionalExpression::evaluate(ContextProtected& context) {
	Environment* env = new Environment();
	
	Element* condition_element = this->condition->to_element(context);
	
	if (condition_element->is_false())
		env->add_element(this->false_result->to_element(context));
	else
		env->add_element(this->true_result->to_element(context));
		
	delete condition_element;
	return env;
}
Esempio n. 2
0
Environment* BasicExpression::create_environment(ContextProtected& context) {
	Environment* env = new Environment();
	for (unsigned int i = 0; i < this->args.size(); ++i)
		env->add_element(this->args[i]->to_element(context));
	return env;
}