1 // 2 // Copyright (c) 2002-2013 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 // UnfoldShortCircuitAST is an AST traverser to replace short-circuiting 7 // operations with ternary operations. 8 // 9 10 #ifndef COMPILER_TRANSLATOR_UNFOLDSHORTCIRCUITAST_H_ 11 #define COMPILER_TRANSLATOR_UNFOLDSHORTCIRCUITAST_H_ 12 13 #include "common/angleutils.h" 14 #include "compiler/translator/IntermTraverse.h" 15 16 namespace sh 17 { 18 19 // This traverser identifies all the short circuit binary nodes that need to 20 // be replaced, and creates the corresponding replacement nodes. However, 21 // the actual replacements happen after the traverse through updateTree(). 22 23 class UnfoldShortCircuitAST : public TIntermTraverser 24 { 25 public: UnfoldShortCircuitAST()26 UnfoldShortCircuitAST() : TIntermTraverser(true, false, false) {} 27 28 bool visitBinary(Visit visit, TIntermBinary *) override; 29 }; 30 31 } // namespace sh 32 33 #endif // COMPILER_TRANSLATOR_UNFOLDSHORTCIRCUITAST_H_ 34