コード例 #1
0
 public function preVisitTree($tree)
 {
     $shouldVisitChildren = true;
     $callObject = OA_CodeBlockHelpers::findCallObject($this->callingContext, $tree, $tree->getName());
     if (null !== $callObject) {
         $this->functionCallObjects[] = $callObject;
     }
     // We need to look at everything in this tree.
     return $shouldVisitChildren;
 }
コード例 #2
0
ファイル: SymbolTableBuilder.php プロジェクト: jmdisher/p2pc
 public function preVisitTree($tree)
 {
     // By default, we will walk all children unless we identity a sub-tree of specialized interest to us.
     $shouldVisitChildren = true;
     // There is no calling context for the top-level global calls.
     $callingContext = null;
     $name = $tree->getName();
     switch ($name) {
         case OA_SymbolTableBuilder::kFunctionDecl:
             // We want to switch over to the function declaration walker so terminate our traversal of this tree.
             $shouldVisitChildren = false;
             $childWalker = new OA_FunctionDeclarationWalker($callingContext, $tree);
             $tree->visit($childWalker);
             $functionObject = $childWalker->getFunctionDeclarationObject();
             assert(null !== $functionObject);
             $this->functionObjects[] = $functionObject;
             break;
         case OA_SymbolTableBuilder::kClassDecl:
         case OA_SymbolTableBuilder::kAbstractClassDecl:
             // NOTE:  For the time being, we will parse interfaces as classes.
         // NOTE:  For the time being, we will parse interfaces as classes.
         case OA_SymbolTableBuilder::kInterfaceDecl:
             // We want to switch over to the class declaration walker so terminate our traversal of this tree.
             // Note that we also use this parser for abstract classes but any abstract function declarations will be
             //  skipped since they are a different parse tree shape than the other kinds of functions the class
             //  walks and processes.
             $shouldVisitChildren = false;
             $childWalker = new OA_ClassDeclarationWalker();
             $tree->visit($childWalker);
             $classObject = $childWalker->getClassDeclarationObject();
             assert(null !== $classObject);
             $this->classObjects[] = $classObject;
             break;
         default:
             $callObject = OA_CodeBlockHelpers::findCallObject($callingContext, $tree, $name);
             if (null !== $callObject) {
                 $this->functionCallObjects[] = $callObject;
             }
     }
     return $shouldVisitChildren;
 }