Assignment Expression

In the project specification, subsection 6.2.1, it is stated that:

In this function assignments shall only be used in ExpressionStatements and must be the outermost expression.

Does this mean that by tests of code generation, an assignment expression might be an inner expression, e.g. x = 3 + (y = 9); or if (x = 3) {} or such code is rejected from the parser?

an assignment expression might be an inner expression

yes. From the project description:

The result of an assignment is the new value of the object on the left side.

So both of your examples are valid and should be supported in code generation.

1 Like