This simply checks if the left-hand side is a constant and if so raises
an error.
Fixes bug 771626
basic-types/bug729907.vala \
basic-types/bug731017.vala \
basic-types/bug761307.vala \
+ basic-types/bug771626.test \
namespaces.vala \
methods/lambda.vala \
methods/closures.vala \
--- /dev/null
+Invalid Code
+
+const int FOO = 0;
+
+void main () {
+ FOO = 1;
+}
if (left is MemberAccess) {
var ma = (MemberAccess) left;
+ if (ma.symbol_reference is Constant) {
+ error = true;
+ Report.error (source_reference, "Assignment to constant after initialization");
+ return false;
+ }
+
if ((!(ma.symbol_reference is Signal || ma.symbol_reference is DynamicProperty) && ma.value_type == null) ||
(ma.inner == null && ma.member_name == "this" && context.analyzer.is_in_instance_method ())) {
error = true;