HLSL: Implement basic "struct" grammar.

This commit is contained in:
John Kessenich
2016-06-11 16:43:14 -06:00
parent 41ebc42926
commit e6e7494e2a
8 changed files with 257 additions and 6 deletions

View File

@@ -282,10 +282,14 @@ void C_DECL HlslParseContext::ppWarn(const TSourceLoc& loc, const char* szReason
//
// Handle seeing a variable identifier in the grammar.
//
TIntermTyped* HlslParseContext::handleVariable(const TSourceLoc& loc, const TString* string)
TIntermTyped* HlslParseContext::handleVariable(const TSourceLoc& loc, TSymbol* symbol, const TString* string)
{
TSymbol* symbol = symbolTable.find(*string);
TIntermTyped* node = nullptr;
if (symbol == nullptr)
symbol = symbolTable.find(*string);
if (symbol && symbol->getAsVariable() && symbol->getAsVariable()->isUserType()) {
error(loc, "expected symbol, not user-defined type", string->c_str(), "");
return nullptr;
}
// Error check for requiring specific extensions present.
if (symbol && symbol->getNumExtensions())
@@ -306,6 +310,7 @@ TIntermTyped* HlslParseContext::handleVariable(const TSourceLoc& loc, const TStr
const TVariable* variable;
const TAnonMember* anon = symbol ? symbol->getAsAnonMember() : nullptr;
TIntermTyped* node = nullptr;
if (anon) {
// It was a member of an anonymous container.