Fix, and add missing tests for, error catching for applying swizzles to arrays.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@26858 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2014-05-27 01:34:38 +00:00
parent 6e62d92cfb
commit 974258d88f
4 changed files with 61 additions and 4 deletions

View file

@ -697,6 +697,17 @@ TIntermTyped* TParseContext::handleDotDereference(TSourceLoc loc, TIntermTyped*
return intermediate.addMethod(base, TType(EbtInt), &field, loc);
}
// It's not .length() if we get to here.
if (base->isArray()) {
error(loc, "cannot apply to an array:", ".", field.c_str());
return base;
}
// It's neither an array nor .length() if we get here,
// leaving swizzles and struct/block dereferences.
TIntermTyped* result = base;
if (base->isVector() || base->isScalar()) {
if (base->isScalar()) {