public function setMacro($name, Twig_Node_Macro $node) {
if (null === $this->reservedMacroNames) {
$this->reservedMacroNames = array();
$r = new ReflectionClass($this->env
->getBaseTemplateClass());
foreach ($r
->getMethods() as $method) {
$this->reservedMacroNames[] = $method
->getName();
}
}
if (in_array($name, $this->reservedMacroNames)) {
throw new Twig_Error_Syntax(sprintf('"%s" cannot be used as a macro name as it is a reserved keyword', $name), $node
->getLine());
}
$this->macros[$name] = $node;
}