HLSL: non-static member functions: track and find active anonymous 'this' scopes and members.

Thanks to @steve-lunarg for his input and discussions on handling member functions.
This commit is contained in:
John Kessenich
2017-03-21 23:56:40 -06:00
parent f4ba25e009
commit 3778979cd4
11 changed files with 500 additions and 172 deletions

View File

@@ -1842,12 +1842,13 @@ bool HlslGrammar::acceptStruct(TType& type, TIntermNode*& nodeList)
for (int b = 0; b < (int)functionDeclarators.size(); ++b) {
// update signature
if (functionDeclarators[b].function->hasImplicitThis())
functionDeclarators[b].function->addThisParameter(type);
functionDeclarators[b].function->addThisParameter(type, intermediate.implicitThisName);
}
// All member functions get parsed inside the class/struct namespace and with the
// class/struct members in a symbol-table level.
parseContext.pushNamespace(structName);
parseContext.pushThisScope(type);
bool deferredSuccess = true;
for (int b = 0; b < (int)functionDeclarators.size() && deferredSuccess; ++b) {
// parse body
@@ -1856,6 +1857,7 @@ bool HlslGrammar::acceptStruct(TType& type, TIntermNode*& nodeList)
deferredSuccess = false;
popTokenStream();
}
parseContext.popThisScope();
parseContext.popNamespace();
return deferredSuccess;
@@ -2075,6 +2077,8 @@ bool HlslGrammar::acceptMemberFunctionDefinition(TIntermNode*& nodeList, const T
declarator.function = new TFunction(functionName, type);
if (type.getQualifier().storage == EvqTemporary)
declarator.function->setImplicitThis();
else
declarator.function->setIllegalImplicitThis();
// function_parameters
if (acceptFunctionParameters(*declarator.function)) {