parseConst.cpp revision cc863da574ed5079b055574127fe5788a9a0fc33
1894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// 2d4ae863d01d5f448dbbba6be4ecc161971a2324fJohn Bauman// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved. 3894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// Use of this source code is governed by a BSD-style license that can be 4894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// found in the LICENSE file. 5894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// 6894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 7cc863da574ed5079b055574127fe5788a9a0fc33Nicolas Capens#include "ParseHelper.h" 8894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 9894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// 10894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// Use this class to carry along data from node to node in 11894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// the traversal 12894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// 13894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanclass TConstTraverser : public TIntermTraverser { 14894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanpublic: 15d4ae863d01d5f448dbbba6be4ecc161971a2324fJohn Bauman TConstTraverser(ConstantUnion* cUnion, bool singleConstParam, TOperator constructType, TInfoSink& sink, TType& t) 16894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman : error(false), 17894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman index(0), 18894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman unionArray(cUnion), 19894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman type(t), 20894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman constructorType(constructType), 21894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman singleConstantParam(singleConstParam), 22894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman infoSink(sink), 23894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman size(0), 24894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman isMatrix(false), 25894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman matrixSize(0) { 26894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman } 27894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 28894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman bool error; 29894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 30894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanprotected: 31894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman void visitSymbol(TIntermSymbol*); 32894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman void visitConstantUnion(TIntermConstantUnion*); 33894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman bool visitBinary(Visit visit, TIntermBinary*); 34894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman bool visitUnary(Visit visit, TIntermUnary*); 35894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman bool visitSelection(Visit visit, TIntermSelection*); 36894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman bool visitAggregate(Visit visit, TIntermAggregate*); 37894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman bool visitLoop(Visit visit, TIntermLoop*); 38894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman bool visitBranch(Visit visit, TIntermBranch*); 39894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 40894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman int index; 41894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman ConstantUnion *unionArray; 42894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman TType type; 43894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman TOperator constructorType; 44894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman bool singleConstantParam; 45894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman TInfoSink& infoSink; 46894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman int size; // size of the constructor ( 4 for vec4) 47894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman bool isMatrix; 48894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman int matrixSize; // dimension of the matrix (nominal size and not the instance size) 49894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman}; 50894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 51894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// 52894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// The rest of the file are the traversal functions. The last one 53894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// is the one that starts the traversal. 54894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// 55894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// Return true from interior nodes to have the external traversal 56894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// continue on to children. If you process children yourself, 57894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// return false. 58894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// 59894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 60894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanvoid TConstTraverser::visitSymbol(TIntermSymbol* node) 61894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman{ 62894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman infoSink.info.message(EPrefixInternalError, "Symbol Node found in constant constructor", node->getLine()); 63894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman return; 64894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman} 65894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 66894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanbool TConstTraverser::visitBinary(Visit visit, TIntermBinary* node) 67894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman{ 68894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman TQualifier qualifier = node->getType().getQualifier(); 69c3bfb403361ae6dc1174cb6d379d2cc599663c76Nicolas Capens 70894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman if (qualifier != EvqConst) { 71894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman TString buf; 72894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman buf.append("'constructor' : assigning non-constant to "); 73894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman buf.append(type.getCompleteString()); 74894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman infoSink.info.message(EPrefixError, buf.c_str(), node->getLine()); 75894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman error = true; 76c3bfb403361ae6dc1174cb6d379d2cc599663c76Nicolas Capens return false; 77894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman } 78894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 79c3bfb403361ae6dc1174cb6d379d2cc599663c76Nicolas Capens infoSink.info.message(EPrefixInternalError, "Binary Node found in constant constructor", node->getLine()); 80c3bfb403361ae6dc1174cb6d379d2cc599663c76Nicolas Capens 81894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman return false; 82894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman} 83894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 84894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanbool TConstTraverser::visitUnary(Visit visit, TIntermUnary* node) 85894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman{ 86894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman TString buf; 87894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman buf.append("'constructor' : assigning non-constant to "); 88894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman buf.append(type.getCompleteString()); 89894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman infoSink.info.message(EPrefixError, buf.c_str(), node->getLine()); 90894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman error = true; 91c3bfb403361ae6dc1174cb6d379d2cc599663c76Nicolas Capens return false; 92894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman} 93894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 94894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanbool TConstTraverser::visitAggregate(Visit visit, TIntermAggregate* node) 95894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman{ 96894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman if (!node->isConstructor() && node->getOp() != EOpComma) { 97894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman TString buf; 98894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman buf.append("'constructor' : assigning non-constant to "); 99894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman buf.append(type.getCompleteString()); 100894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman infoSink.info.message(EPrefixError, buf.c_str(), node->getLine()); 101894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman error = true; 102c3bfb403361ae6dc1174cb6d379d2cc599663c76Nicolas Capens return false; 103894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman } 104894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 105894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman if (node->getSequence().size() == 0) { 106894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman error = true; 107894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman return false; 108894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman } 109894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 110894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman bool flag = node->getSequence().size() == 1 && node->getSequence()[0]->getAsTyped()->getAsConstantUnion(); 111c3bfb403361ae6dc1174cb6d379d2cc599663c76Nicolas Capens if (flag) 112894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman { 113c3bfb403361ae6dc1174cb6d379d2cc599663c76Nicolas Capens singleConstantParam = true; 114894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman constructorType = node->getOp(); 115894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman size = node->getType().getObjectSize(); 116894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 117894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman if (node->getType().isMatrix()) { 118894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman isMatrix = true; 119894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman matrixSize = node->getType().getNominalSize(); 120894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman } 121c3bfb403361ae6dc1174cb6d379d2cc599663c76Nicolas Capens } 122894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 123c3bfb403361ae6dc1174cb6d379d2cc599663c76Nicolas Capens for (TIntermSequence::iterator p = node->getSequence().begin(); 124894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman p != node->getSequence().end(); p++) { 125894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 126894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman if (node->getOp() == EOpComma) 127c3bfb403361ae6dc1174cb6d379d2cc599663c76Nicolas Capens index = 0; 128894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 129894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman (*p)->traverse(this); 130c3bfb403361ae6dc1174cb6d379d2cc599663c76Nicolas Capens } 131c3bfb403361ae6dc1174cb6d379d2cc599663c76Nicolas Capens if (flag) 132894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman { 133c3bfb403361ae6dc1174cb6d379d2cc599663c76Nicolas Capens singleConstantParam = false; 134894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman constructorType = EOpNull; 135894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman size = 0; 136894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman isMatrix = false; 137894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman matrixSize = 0; 138894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman } 139894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman return false; 140894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman} 141894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 142894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanbool TConstTraverser::visitSelection(Visit visit, TIntermSelection* node) 143894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman{ 144894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman infoSink.info.message(EPrefixInternalError, "Selection Node found in constant constructor", node->getLine()); 145894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman error = true; 146894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman return false; 147894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman} 148894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 149894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanvoid TConstTraverser::visitConstantUnion(TIntermConstantUnion* node) 150894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman{ 151894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman ConstantUnion* leftUnionArray = unionArray; 152894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman int instanceSize = type.getObjectSize(); 153c3bfb403361ae6dc1174cb6d379d2cc599663c76Nicolas Capens TBasicType basicType = type.getBasicType(); 154894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 155894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman if (index >= instanceSize) 156894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman return; 157894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 158894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman if (!singleConstantParam) { 159894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman int size = node->getType().getObjectSize(); 160c3bfb403361ae6dc1174cb6d379d2cc599663c76Nicolas Capens 161894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman ConstantUnion *rightUnionArray = node->getUnionArrayPointer(); 162894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman for (int i=0; i < size; i++) { 163894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman if (index >= instanceSize) 164894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman return; 165c3bfb403361ae6dc1174cb6d379d2cc599663c76Nicolas Capens leftUnionArray[index].cast(basicType, rightUnionArray[i]); 166894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 167894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman (index)++; 168894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman } 169894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman } else { 170894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman int totalSize = index + size; 171894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman ConstantUnion *rightUnionArray = node->getUnionArrayPointer(); 172894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman if (!isMatrix) { 173894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman int count = 0; 174894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman for (int i = index; i < totalSize; i++) { 175894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman if (i >= instanceSize) 176894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman return; 177894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 178c3bfb403361ae6dc1174cb6d379d2cc599663c76Nicolas Capens leftUnionArray[i].cast(basicType, rightUnionArray[count]); 179894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 180894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman (index)++; 181c3bfb403361ae6dc1174cb6d379d2cc599663c76Nicolas Capens 182894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman if (node->getType().getObjectSize() > 1) 183894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman count++; 184894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman } 185894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman } else { // for matrix constructors 186894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman int count = 0; 187894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman int element = index; 188894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman for (int i = index; i < totalSize; i++) { 189894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman if (i >= instanceSize) 190894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman return; 191894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman if (element - i == 0 || (i - element) % (matrixSize + 1) == 0 ) 192c3bfb403361ae6dc1174cb6d379d2cc599663c76Nicolas Capens leftUnionArray[i].cast(basicType, rightUnionArray[0]); 193c3bfb403361ae6dc1174cb6d379d2cc599663c76Nicolas Capens else 194894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman leftUnionArray[i].setFConst(0.0f); 195894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 196894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman (index)++; 197894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 198894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman if (node->getType().getObjectSize() > 1) 199c3bfb403361ae6dc1174cb6d379d2cc599663c76Nicolas Capens count++; 200894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman } 201894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman } 202894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman } 203894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman} 204894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 205894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanbool TConstTraverser::visitLoop(Visit visit, TIntermLoop* node) 206894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman{ 207894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman infoSink.info.message(EPrefixInternalError, "Loop Node found in constant constructor", node->getLine()); 208894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman error = true; 209894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman return false; 210894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman} 211894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 212894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanbool TConstTraverser::visitBranch(Visit visit, TIntermBranch* node) 213894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman{ 214894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman infoSink.info.message(EPrefixInternalError, "Branch Node found in constant constructor", node->getLine()); 215894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman error = true; 216894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman return false; 217894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman} 218894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 219894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// 220894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// This function is the one to call externally to start the traversal. 221894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// Individual functions can be initialized to 0 to skip processing of that 222894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// type of node. It's children will still be processed. 223894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// 224d4ae863d01d5f448dbbba6be4ecc161971a2324fJohn Baumanbool TIntermediate::parseConstTree(TSourceLoc line, TIntermNode* root, ConstantUnion* unionArray, TOperator constructorType, TType t, bool singleConstantParam) 225894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman{ 226894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman if (root == 0) 227894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman return false; 228894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 229d4ae863d01d5f448dbbba6be4ecc161971a2324fJohn Bauman TConstTraverser it(unionArray, singleConstantParam, constructorType, infoSink, t); 230894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 231894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman root->traverse(&it); 232894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman if (it.error) 233894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman return true; 234894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman else 235894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman return false; 236894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman} 237