bool TDependencyGraphBuilder::visitAggregate(Visit visit, TIntermAggregate* intermAggregate) { switch (intermAggregate->getOp()) { case EOpFunction: visitFunctionDefinition(intermAggregate); break; case EOpFunctionCall: visitFunctionCall(intermAggregate); break; default: visitAggregateChildren(intermAggregate); break; } return false; }
// Traverse a function definition node. void TIntermTraverser::traverseFunctionDefinition(TIntermFunctionDefinition *node) { bool visit = true; if (preVisit) visit = visitFunctionDefinition(PreVisit, node); if (visit) { incrementDepth(node); mInGlobalScope = false; node->getFunctionParameters()->traverse(this); if (inVisit) visit = visitFunctionDefinition(InVisit, node); node->getBody()->traverse(this); mInGlobalScope = true; decrementDepth(); } if (visit && postVisit) visitFunctionDefinition(PostVisit, node); }
bool Parser::visitExternalDeclaration( TranslationUnitAST *tunit ) { PrototypeAST *proto = visitFunctionDeclaration(); if (proto) { tunit->addPrototype(proto); return true; } FunctionAST *func_def = visitFunctionDefinition(); if (func_def) { tunit->addFunction(fnc_def); return true; } return false; }