rusty
rusty copied to clipboard
Validate "wrapped" assignment statements OR treat assignments as expressions
The following example of statements currently fails during codegen:
PROGRAM exp
VAR
x, y : INT;
END_VAR
+x := 1 + 4; // codegen err | `UnaryExpression { op+, Assignment {...}`
x + y := 1; // codegen err | `BinaryExpression { op+, Reference,, Assignment {...} }`
END_PROGRAM
Trying to compile this will fail during the codegen stage, with e.g. :
no type hint available for Assignment {
left: ReferenceExpr {
kind: Member(
Identifier {
name: "y",
},
),
base: None,
},
right: LiteralInteger {
value: 1,
},
}
We should either properly validate against these statements or start treating assignments as expressions (rel.: https://github.com/PLC-lang/rusty/issues/1173).