Fix that readonly buffer variable can be assigned
This change will add memory qualifier checking for binaryNode in case the
memory qualifier information is lost.
BUG=angleproject:1951
TEST=angle_unittests
Change-Id: I3f0cfd7d8a059753cf3c982ee0a977b4b0fd0128
Reviewed-on: https://chromium-review.googlesource.com/929877
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index bdfafa4..ccf6c54 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -496,6 +496,11 @@
case EOpIndexIndirect:
case EOpIndexDirectStruct:
case EOpIndexDirectInterfaceBlock:
+ if (node->getMemoryQualifier().readonly)
+ {
+ error(line, "can't modify a readonly variable", op);
+ return false;
+ }
return checkCanBeLValue(line, op, binaryNode->getLeft());
default:
break;