Front-end precise: Propagate noContraction up the AST when dereferencing structs.

This should be the last commit in this sequence to form the base of the work
in pull request #222.
This commit is contained in:
John Kessenich 2016-05-04 13:24:47 -06:00
parent 17f0786418
commit 3c1e08057e
2 changed files with 15 additions and 11 deletions

View File

@ -110,7 +110,7 @@ ERROR: node is still EOpNull!
0:161 'c' (in 4-component vector of float)
0:161 'd' (in 4-component vector of float)
0:162 move second child to first child (temp 3-component vector of float)
0:162 vector swizzle (temp 3-component vector of float)
0:162 vector swizzle (noContraction temp 3-component vector of float)
0:162 'v' (noContraction smooth out 4-component vector of float)
0:162 Sequence
0:162 Constant:
@ -123,7 +123,7 @@ ERROR: node is still EOpNull!
0:162 'r' (temp 3-component vector of float)
0:162 's' (temp 3-component vector of float)
0:163 move second child to first child (temp float)
0:163 direct index (temp float)
0:163 direct index (noContraction temp float)
0:163 'v' (noContraction smooth out 4-component vector of float)
0:163 Constant:
0:163 3 (const int)
@ -147,7 +147,7 @@ ERROR: node is still EOpNull!
0:163 Constant:
0:163 3 (const int)
0:164 move second child to first child (temp float)
0:164 direct index (temp float)
0:164 direct index (noContraction temp float)
0:164 'v' (noContraction smooth out 4-component vector of float)
0:164 Constant:
0:164 0 (const int)
@ -169,7 +169,7 @@ ERROR: node is still EOpNull!
0:164 Constant:
0:164 0 (const int)
0:166 move second child to first child (temp float)
0:166 direct index (temp float)
0:166 direct index (noContraction temp float)
0:166 'v' (noContraction smooth out 4-component vector of float)
0:166 Constant:
0:166 0 (const int)
@ -209,7 +209,7 @@ ERROR: node is still EOpNull!
0:167 'd' (in 4-component vector of float)
0:167 Constant:
0:167 0 (const int)
0:167 direct index (temp float)
0:167 direct index (noContraction temp float)
0:167 'v' (noContraction smooth out 4-component vector of float)
0:167 Constant:
0:167 0 (const int)
@ -394,7 +394,7 @@ ERROR: node is still EOpNull!
0:161 'c' (in 4-component vector of float)
0:161 'd' (in 4-component vector of float)
0:162 move second child to first child (temp 3-component vector of float)
0:162 vector swizzle (temp 3-component vector of float)
0:162 vector swizzle (noContraction temp 3-component vector of float)
0:162 'v' (noContraction smooth out 4-component vector of float)
0:162 Sequence
0:162 Constant:
@ -407,7 +407,7 @@ ERROR: node is still EOpNull!
0:162 'r' (temp 3-component vector of float)
0:162 's' (temp 3-component vector of float)
0:163 move second child to first child (temp float)
0:163 direct index (temp float)
0:163 direct index (noContraction temp float)
0:163 'v' (noContraction smooth out 4-component vector of float)
0:163 Constant:
0:163 3 (const int)
@ -431,7 +431,7 @@ ERROR: node is still EOpNull!
0:163 Constant:
0:163 3 (const int)
0:164 move second child to first child (temp float)
0:164 direct index (temp float)
0:164 direct index (noContraction temp float)
0:164 'v' (noContraction smooth out 4-component vector of float)
0:164 Constant:
0:164 0 (const int)
@ -453,7 +453,7 @@ ERROR: node is still EOpNull!
0:164 Constant:
0:164 0 (const int)
0:166 move second child to first child (temp float)
0:166 direct index (temp float)
0:166 direct index (noContraction temp float)
0:166 'v' (noContraction smooth out 4-component vector of float)
0:166 Constant:
0:166 0 (const int)
@ -493,7 +493,7 @@ ERROR: node is still EOpNull!
0:167 'd' (in 4-component vector of float)
0:167 Constant:
0:167 0 (const int)
0:167 direct index (temp float)
0:167 direct index (noContraction temp float)
0:167 'v' (noContraction smooth out 4-component vector of float)
0:167 Constant:
0:167 0 (const int)

View File

@ -781,7 +781,7 @@ TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TInterm
//
// .length() can't be resolved until we later see the function-calling syntax.
// Save away the name in the AST for now. Processing is compeleted in
// Save away the name in the AST for now. Processing is completed in
// handleLengthMethod().
//
if (field == "length") {
@ -879,6 +879,10 @@ TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TInterm
} else
error(loc, "does not apply to this type:", field.c_str(), base->getType().getCompleteString().c_str());
// Propagate noContraction up the dereference chain
if (base->getQualifier().noContraction)
result->getWritableType().getQualifier().noContraction = true;
return result;
}