mirror of
https://github.com/jezhiggins/arabica
synced 2024-12-27 21:58:30 +01:00
increment changes with the aim of improviing performance of variables
This commit is contained in:
commit
aa518e3964
5 changed files with 50 additions and 3 deletions
|
@ -27,6 +27,26 @@ protected:
|
|||
} // declare
|
||||
}; // Param
|
||||
|
||||
|
||||
class GlobalParam : public Variable_impl
|
||||
{
|
||||
public:
|
||||
GlobalParam(const std::string& name,
|
||||
const Arabica::XPath::XPathExpressionPtr<std::string>& select,
|
||||
const Precedence& precedence) :
|
||||
Variable_impl(name, select, precedence)
|
||||
{
|
||||
} // GlobalParam
|
||||
|
||||
virtual ~GlobalParam() { }
|
||||
|
||||
protected:
|
||||
virtual void execute(const DOM::Node<std::string>& node, ExecutionContext& context) const
|
||||
{
|
||||
context.declareParam(node, *this);
|
||||
} // declare
|
||||
}; // GlobalParam
|
||||
|
||||
} // namespace XSLT
|
||||
} // namespace Arabica
|
||||
#endif
|
||||
|
|
|
@ -196,11 +196,11 @@ const ChildElement StylesheetHandler::allowedChildren[] =
|
|||
{ "key", CreateHandler<KeyHandler>},
|
||||
{ "namespace-alias", CreateHandler<NamespaceAliasHandler>},
|
||||
{ "output", CreateHandler<OutputHandler>},
|
||||
{ "param", CreateHandler<TopLevelVariableHandler<Param> >},
|
||||
{ "param", CreateHandler<TopLevelVariableHandler<GlobalParam> >},
|
||||
{ "preserve-space", CreateHandler<NotImplementedYetHandler>},
|
||||
{ "strip-space", CreateHandler<NotImplementedYetHandler>},
|
||||
{ "template", CreateHandler<TemplateHandler> },
|
||||
{ "variable", CreateHandler<TopLevelVariableHandler<Variable> > },
|
||||
{ "variable", CreateHandler<TopLevelVariableHandler<GlobalVariable> > },
|
||||
{ 0, 0 }
|
||||
}; // StylesheetHandler::allowedChildren
|
||||
|
||||
|
|
|
@ -26,6 +26,24 @@ public:
|
|||
} // declare
|
||||
}; // Variable
|
||||
|
||||
class GlobalVariable : public Variable_impl
|
||||
{
|
||||
public:
|
||||
GlobalVariable(const std::string& name,
|
||||
const Arabica::XPath::XPathExpressionPtr<std::string>& select,
|
||||
const Precedence precedence) :
|
||||
Variable_impl(name, select, precedence)
|
||||
{
|
||||
} // Variable
|
||||
|
||||
virtual ~GlobalVariable() { }
|
||||
|
||||
virtual void execute(const DOM::Node<std::string>& node, ExecutionContext& context) const
|
||||
{
|
||||
context.declareVariable(node, *this);
|
||||
} // declare
|
||||
}; // class GlobalVariable
|
||||
|
||||
} // namespace XSLT
|
||||
} // namespace Arabica
|
||||
#endif
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace XSLT
|
|||
{
|
||||
|
||||
class Variable_instance;
|
||||
typedef boost::shared_ptr<Variable_instance> Variable_instance_ptr;
|
||||
typedef Variable_instance* Variable_instance_ptr;
|
||||
typedef std::map<std::string, Variable_instance_ptr> Scope;
|
||||
|
||||
class Variable_instance
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
Introduce GlobalVariable and GlobalParam.
|
||||
Rename Variable_instance to DeclaredVariable.
|
||||
Get rid of Variable_declaration. Variables should implement Variable_instance.
|
||||
Normal variables don't bother with injectGlobalScope, GlobalVariables do.
|
||||
Variables become their own closures. Forget all the ref counting nonsense, it is not necessary.
|
||||
Normal variables resolve immediately and push themselves on the stack.
|
||||
GlobalVariables resolve on demand.
|
||||
|
||||
====================================================
|
||||
Elements test suite
|
||||
Errors test suite
|
||||
|
||||
|
|
Loading…
Reference in a new issue