HLSL: Implement 'this' keyword.

This commit is contained in:
John Kessenich
2017-03-22 11:38:22 -06:00
parent 3778979cd4
commit 7a41f96d10
8 changed files with 435 additions and 9 deletions

View File

@@ -1538,15 +1538,14 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l
TVariable *variable = new TVariable(param.name, *param.type);
if (i == 0 && function.hasImplicitThis()) {
// 'this' members are already in a symbol-table level,
// and we need to know what function parameter to map them to
// Anonymous 'this' members are already in a symbol-table level,
// and we need to know what function parameter to map them to.
symbolTable.makeInternalVariable(*variable);
pushImplicitThis(variable);
} else {
// Insert the parameters with name in the symbol table.
if (! symbolTable.insert(*variable))
error(loc, "redefinition", variable->getName().c_str(), "");
}
// Insert the parameters with name in the symbol table.
if (! symbolTable.insert(*variable))
error(loc, "redefinition", variable->getName().c_str(), "");
// Add the parameter to the AST
paramNodes = intermediate.growAggregate(paramNodes,
intermediate.addSymbol(*variable, loc),