Ejemplo n.º 1
0
bool
QuasiStack::SetValue(Block *b)
{
	QDBMSG_STK("stack %s set value %x\n", stackable->sym->name, b);
	if (!b)
		return true;
	if (b->type == Block::C_CALL) {
		if (b->crap.call.crap.lambda->sym != stackable->sym) {
			return false;
		}
	} else if (b->type == Block::C_WAKE) {
		if (b->crap.call.crap.sym != stackable->sym) {
			return false;
		}
	} else if (b->type == Block::C_UNLINKED_CALL) {
		if (b->name == stackable->sym->name)
			return false;
	} else {
		return false;
	}
	
	Block *par = b->crap.call.parameters;
	int		i;
	for (i=0; i<stackable->countControllers() && par!=nullptr; i++, par=par->next) {
/*		ControllerBridge(i)->SetValue(par);*/
		StabEnt	*sym = stackable->controller(i);
		ResultValue v = EvaluateExpression(par);
		LValue	lval;
		sym->SetLValue(lval, 0, stacker, stackerSym, this);
		lval.StoreValue(&v);
	}
	
	if (par && par->type == Block::C_LIST) {
		Block	*stk = par->crap.list.block;
		for (short i=0; i<higherFrame.size() && stk!=nullptr; i++, stk=stk->next) {
			higherFrame[i]->SetValue(stk);
		}
	}
	return true;
}