HLSL: Error if funcion with return type doesn't return a value.

This commit is contained in:
John Kessenich
2016-09-02 19:13:36 -06:00
parent 1a4b775cd5
commit a305166ea4
15 changed files with 73 additions and 53 deletions

View File

@@ -1496,20 +1496,16 @@ bool HlslGrammar::acceptParameterDeclaration(TFunction& function)
// parsing the body (compound_statement).
bool HlslGrammar::acceptFunctionDefinition(TFunction& function, TIntermNode*& node)
{
TFunction* functionDeclarator = parseContext.handleFunctionDeclarator(token.loc, function, false /* not prototype */);
TFunction& functionDeclarator = parseContext.handleFunctionDeclarator(token.loc, function, false /* not prototype */);
TSourceLoc loc = token.loc;
// This does a pushScope()
node = parseContext.handleFunctionDefinition(loc, *functionDeclarator);
node = parseContext.handleFunctionDefinition(loc, functionDeclarator);
// compound_statement
TIntermNode* functionBody = nullptr;
if (acceptCompoundStatement(functionBody)) {
node = intermediate.growAggregate(node, functionBody);
intermediate.setAggregateOperator(node, EOpFunction, functionDeclarator->getType(), loc);
node->getAsAggregate()->setName(functionDeclarator->getMangledName().c_str());
parseContext.popScope();
parseContext.handleFunctionBody(loc, functionDeclarator, functionBody, node);
return true;
}