Line data Source code
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/IntermNode.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 0 : class UnfoldShortCircuitAST : public TIntermTraverser
24 : {
25 : public:
26 0 : UnfoldShortCircuitAST()
27 0 : : TIntermTraverser(true, false, false)
28 : {
29 0 : }
30 :
31 : bool visitBinary(Visit visit, TIntermBinary *) override;
32 : };
33 :
34 : } // namespace sh
35 :
36 : #endif // COMPILER_TRANSLATOR_UNFOLDSHORTCIRCUITAST_H_
|