| 10336 | } |
| 10337 | |
| 10338 | TParameter TParseContext::getParamWithDefault(const TPublicType& ty, TString* identifier, TIntermTyped* initializer, |
| 10339 | const TSourceLoc& loc) |
| 10340 | { |
| 10341 | if (!parsingBuiltins) { |
| 10342 | error(loc, "default argument values are only available for builtins", "=", ""); |
| 10343 | initializer = nullptr; |
| 10344 | } |
| 10345 | if (ty.arraySizes) { |
| 10346 | error(loc, "array arguments cannot be default-initialized", identifier->c_str(), ""); |
| 10347 | initializer = nullptr; |
| 10348 | } |
| 10349 | if (ty.basicType == EbtVoid) { |
| 10350 | error(loc, "illegal use of type 'void'", identifier->c_str(), ""); |
| 10351 | initializer = nullptr; |
| 10352 | } |
| 10353 | reservedErrorCheck(loc, *identifier); |
| 10354 | TParameter param = {identifier, new TType(ty), initializer}; |
| 10355 | return param; |
| 10356 | } |
| 10357 | |
| 10358 | // This function tests for the type of the parameters to the structure or array constructor. Raises |
| 10359 | // an error message if the expected type does not match the parameter passed to the constructor. |