forked from lix-project/lix
parent
8c93a481af
commit
e41cf8511f
|
@ -1275,6 +1275,8 @@ void EvalState::callFunction(Value & fun, size_t nrArgs, Value * * args, Value &
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Attr * functor;
|
||||||
|
|
||||||
while (nrArgs > 0) {
|
while (nrArgs > 0) {
|
||||||
|
|
||||||
if (vCur.isLambda()) {
|
if (vCur.isLambda()) {
|
||||||
|
@ -1403,17 +1405,15 @@ void EvalState::callFunction(Value & fun, size_t nrArgs, Value * * args, Value &
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (vCur.type() == nAttrs) {
|
else if (vCur.type() == nAttrs && (functor = vCur.attrs->get(sFunctor))) {
|
||||||
if (auto functor = vCur.attrs->get(sFunctor)) {
|
|
||||||
/* 'vCur" may be allocated on the stack of the calling
|
/* 'vCur" may be allocated on the stack of the calling
|
||||||
function, but for functors we may keep a reference,
|
function, but for functors we may keep a reference, so
|
||||||
so heap-allocate a copy and use that instead. */
|
heap-allocate a copy and use that instead. */
|
||||||
Value * args2[] = {allocValue()};
|
Value * args2[] = {allocValue()};
|
||||||
*args2[0] = vCur;
|
*args2[0] = vCur;
|
||||||
/* !!! Should we use the attr pos here? */
|
/* !!! Should we use the attr pos here? */
|
||||||
callFunction(*functor->value, 1, args2, vCur, pos);
|
callFunction(*functor->value, 1, args2, vCur, pos);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
else
|
else
|
||||||
throwTypeError(pos, "attempt to call something which is not a function but %1%", vCur);
|
throwTypeError(pos, "attempt to call something which is not a function but %1%", vCur);
|
||||||
|
|
Loading…
Reference in a new issue