public function FunctionToAST(Object\IEntityMap $EntityMap, callable $Function, $ResolveVariables = true)
 {
     $Reflection = $this->Reader->GetReflection($Function);
     $ClosureHash = $this->FunctionHash($Reflection);
     $AST = null;
     if ($this->Cache->Contains($ClosureHash)) {
         $AST = $this->Cache->Retrieve($ClosureHash);
     }
     if (!$AST instanceof Closure\IAST) {
         $AST = parent::FunctionToAST($EntityMap, $Function, false);
         //$AST->ExpandVariables();
         $AST->Simplify();
         $this->Cache->Save('ClosureAST-' . $ClosureHash, $AST);
     }
     if ($ResolveVariables) {
         $AST->Resolve($Reflection->getStaticVariables());
         $AST->Simplify();
     }
     return $AST;
 }