MCPcopy Create free account
hub / github.com/KhronosGroup/glslang / getParamWithDefault

Method getParamWithDefault

glslang/MachineIndependent/ParseHelper.cpp:10338–10356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10336}
10337
10338TParameter 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.

Callers 1

yyparseFunction · 0.80

Calls 2

errorFunction · 0.85
c_strMethod · 0.80

Tested by

no test coverage detected