tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

FindFunction.cpp (870B)


      1 //
      2 // Copyright 2019 The ANGLE Project Authors. All rights reserved.
      3 // Use of this source code is governed by a BSD-style license that can be
      4 // found in the LICENSE file.
      5 //
      6 
      7 // FindFunction.cpp: Find functions.
      8 
      9 #include "compiler/translator/tree_util/FindFunction.h"
     10 
     11 #include "compiler/translator/IntermNode.h"
     12 #include "compiler/translator/Symbol.h"
     13 
     14 namespace sh
     15 {
     16 
     17 size_t FindFirstFunctionDefinitionIndex(TIntermBlock *root)
     18 {
     19    const TIntermSequence &sequence = *root->getSequence();
     20    for (size_t index = 0; index < sequence.size(); ++index)
     21    {
     22        TIntermNode *node                       = sequence[index];
     23        TIntermFunctionDefinition *nodeFunction = node->getAsFunctionDefinition();
     24        if (nodeFunction != nullptr)
     25        {
     26            return index;
     27        }
     28    }
     29    return std::numeric_limits<size_t>::max();
     30 }
     31 
     32 }  // namespace sh