ObjectLock olock(self);
BOOST_FOREACH(const Value& item, self) {
- ScriptFrame uframe;
std::vector<Value> args;
args.push_back(item);
result->Add(function->Invoke(args));
ObjectLock olock(self);
for (size_t i = 1; i < self->GetLength(); i++) {
- ScriptFrame uframe;
std::vector<Value> args;
args.push_back(result);
args.push_back(self->Get(i));
ObjectLock olock(self);
BOOST_FOREACH(const Value& item, self) {
- ScriptFrame uframe;
std::vector<Value> args;
args.push_back(item);
if (function->Invoke(args))
}
return prototype;
-}
-
+}
\ No newline at end of file
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
Function::Ptr self = static_cast<Function::Ptr>(vframe->Self);
- ScriptFrame uframe(args[0]);
std::vector<Value> uargs(args.begin() + 1, args.end());
- return self->Invoke(uargs);
+ return self->Invoke(args[0], uargs);
}
static Value FunctionCallV(const Value& thisArg, const Array::Ptr& args)
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
Function::Ptr self = static_cast<Function::Ptr>(vframe->Self);
- ScriptFrame uframe(thisArg);
std::vector<Value> uargs;
{
uargs = std::vector<Value>(args->Begin(), args->End());
}
- return self->Invoke(uargs);
+ return self->Invoke(thisArg, uargs);
}
#include "base/function.hpp"
#include "base/primitivetype.hpp"
#include "base/dictionary.hpp"
+#include "base/scriptframe.hpp"
using namespace icinga;
Value Function::Invoke(const std::vector<Value>& arguments)
{
+ ScriptFrame frame;
+ return m_Callback(arguments);
+}
+
+Value Function::Invoke(const Value& otherThis, const std::vector<Value>& arguments)
+{
+ ScriptFrame frame;
+ frame.Self = otherThis;
return m_Callback(arguments);
}
Function(const Callback& function, bool side_effect_free = false);
Value Invoke(const std::vector<Value>& arguments = std::vector<Value>());
+ Value Invoke(const Value& otherThis, const std::vector<Value>& arguments = std::vector<Value>());
bool IsSideEffectFree(void) const;
static Object::Ptr GetPrototype(void);
{
std::vector<Value> arguments;
arguments.push_back(object);
-
- ScriptFrame frame;
callback->Invoke(arguments);
}
if (!function)
BOOST_THROW_EXCEPTION(ScriptError("'function' argument must not be null."));
- {
- ScriptFrame frame;
- function->Invoke();
- }
+ function->Invoke();
WorkQueue upq(25000, Application::GetConcurrency());
upq.SetName("ConfigItem::RunWithActivationContext");
ScriptFrame vframe;
if (!self.IsEmpty() || self.IsString())
- vframe.Self = self;
+ return func->Invoke(self, arguments);
+ else
+ return func->Invoke(arguments);
- return func->Invoke(arguments);
}
static inline Value NewFunction(ScriptFrame& frame, const std::vector<String>& args,
_1, boost::cref(resolvers), cr, resolvedMacros, useResolvedMacros,
recursionLevel + 1)));
- ScriptFrame frame(resolvers_this);
- return func->Invoke();
+ std::vector<Value> args;
+ return func->Invoke(resolvers_this, args);
}
Value MacroProcessor::InternalResolveMacros(const String& str, const ResolverList& resolvers,