summaryrefslogtreecommitdiff
path: root/vala/valaexpressionstatement.vala
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2020-04-04 10:25:31 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2020-04-04 10:47:32 +0200
commit77aec5976dd55591c4b82603ac70ec9deb71f2fb (patch)
tree5edf91b10eea71ee210dc46c32b7d7c1fcd6e943 /vala/valaexpressionstatement.vala
parentd08837bd13043f1dbe0a198ad11499bb239abec7 (diff)
downloadvala-77aec5976dd55591c4b82603ac70ec9deb71f2fb.tar.gz
vala: Parse standalone integer/real literals as expression statement
Issue an error in the semantic check to forbid such statements. Parsing such an errornous expression-statement failed since 5464767cfa5a8dbbc5f46293693ca627b8fcc46d Fixes https://gitlab.gnome.org/GNOME/vala/issues/961
Diffstat (limited to 'vala/valaexpressionstatement.vala')
-rw-r--r--vala/valaexpressionstatement.vala4
1 files changed, 4 insertions, 0 deletions
diff --git a/vala/valaexpressionstatement.vala b/vala/valaexpressionstatement.vala
index 0de6571f2..ac435d081 100644
--- a/vala/valaexpressionstatement.vala
+++ b/vala/valaexpressionstatement.vala
@@ -78,6 +78,10 @@ public class Vala.ExpressionStatement : CodeNode, Statement {
// ignore inner error
error = true;
return false;
+ } else if (expression is Literal) {
+ Report.error (source_reference, "Literal expression not allowed as statement");
+ error = true;
+ return false;
}
return !error;