This function tests for the type of the parameters to the structure or array constructor. Raises an error message if the expected type does not match the parameter passed to the constructor. Returns nullptr for an error or the input node itself if the expected and the given parameter types match.
| 10361 | // Returns nullptr for an error or the input node itself if the expected and the given parameter types match. |
| 10362 | // |
| 10363 | TIntermTyped* TParseContext::constructAggregate(TIntermNode* node, const TType& type, int paramCount, const TSourceLoc& loc) |
| 10364 | { |
| 10365 | TIntermTyped* converted = intermediate.addConversion(EOpConstructStruct, type, node->getAsTyped()); |
| 10366 | if (! converted || converted->getType() != type) { |
| 10367 | bool enhanced = intermediate.getEnhancedMsgs(); |
| 10368 | error(loc, "", "constructor", "cannot convert parameter %d from '%s' to '%s'", paramCount, |
| 10369 | node->getAsTyped()->getType().getCompleteString(enhanced).c_str(), type.getCompleteString(enhanced).c_str()); |
| 10370 | |
| 10371 | return nullptr; |
| 10372 | } |
| 10373 | |
| 10374 | return converted; |
| 10375 | } |
| 10376 | |
| 10377 | // If a memory qualifier is present in 'to', also make it present in 'from'. |
| 10378 | void TParseContext::inheritMemoryQualifiers(const TQualifier& from, TQualifier& to) |
nothing calls this directly
no test coverage detected