aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/syntax
diff options
context:
space:
mode:
authorGravatar laurentlb <laurentlb@google.com>2017-07-05 14:19:22 -0400
committerGravatar John Cater <jcater@google.com>2017-07-06 07:13:22 -0400
commit2db52703129b010bb864d7ee4180c7c598239f69 (patch)
tree11e74e809bcbbc5537bf9a7c195449f47c8c9a31 /src/main/java/com/google/devtools/build/lib/syntax
parent26e5a47ef355fd7eb10d7dcb803e662784ea0e21 (diff)
Require LValues to have at least one variable.
In other words, we now forbid these: [] = [] () = () _, [] = f() RELNOTES[INC]: lvalues must have define at least one variable (i.e. we forbid `[] = f()`). PiperOrigin-RevId: 160981283
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/syntax')
-rw-r--r--src/main/java/com/google/devtools/build/lib/syntax/LValue.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/LValue.java b/src/main/java/com/google/devtools/build/lib/syntax/LValue.java
index 31918ce792..a409447f78 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/LValue.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/LValue.java
@@ -134,6 +134,9 @@ public final class LValue extends ASTNode {
throw new EvalException(loc, String.format(
"lvalue has length %d, but rvalue has has length %d", len, rvalue.size()));
}
+ if (len == 0) {
+ throw new EvalException(loc, "invalid lvalue, expected at least one item");
+ }
int i = 0;
for (Object o : rvalue) {
doAssign(env, loc, variables.getElements().get(i), o);