SmartPointer<js::Value> Javascript::eval(const InputSource &source) {
    SmartFunctor<Javascript> popPath(this, &Javascript::popPath, false);

    if (!source.getName().empty() && source.getName()[0] != '<') {
        pushPath(source.getName());
        popPath.setEngaged(true);
    }

    SmartPointer<Scope> scope = impl->enterScope();
    scope->getGlobalObject()->copyProperties(*nativeProps);

    return scope->eval(source);
}
Exemple #2
0
void InputDevice::find(const String& pattern, vector<InputSource*>::type& outResults)
{
	for (Sources::iterator itr = _sources.begin(), end = _sources.end(); itr != end; ++itr)
	{
		InputSource* source = *itr;
		if (Wildcard::match(pattern, source->getName()))
			outResults.push_back(source);
	}
}
Exemple #3
0
Script::Script(Context &context, const InputSource &source) : context(context) {
  load(source.toString(), source.getName());
}