HLSL: Correct line numbers for function definitions.

This commit is contained in:
John Kessenich
2016-09-02 19:05:24 -06:00
parent 4bf7155051
commit 1a4b775cd5
98 changed files with 421 additions and 420 deletions

View File

@@ -1497,15 +1497,16 @@ bool HlslGrammar::acceptParameterDeclaration(TFunction& function)
bool HlslGrammar::acceptFunctionDefinition(TFunction& function, TIntermNode*& node)
{
TFunction* functionDeclarator = parseContext.handleFunctionDeclarator(token.loc, function, false /* not prototype */);
TSourceLoc loc = token.loc;
// This does a pushScope()
node = parseContext.handleFunctionDefinition(token.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(), token.loc);
intermediate.setAggregateOperator(node, EOpFunction, functionDeclarator->getType(), loc);
node->getAsAggregate()->setName(functionDeclarator->getMangledName().c_str());
parseContext.popScope();