* Note: an ast-representation using the comma-operator
* of the form: (a, b, c) = x should not assign to c...
*/
- (void)lvalue;
+ if (lvalue) {
+ asterror(ast_ctx(self), "not an l-value (code-block)");
+ return false;
+ }
+
if (self->expression.outr) {
*out = self->expression.outr;
return true;
ast_expression_codegen *cgen;
ir_value *left, *right;
- /* In the context of a binary operation, we can disregard
- * the lvalue flag.
- */
- (void)lvalue;
+ /* A binary operation cannot yield an l-value */
+ if (lvalue) {
+ asterror(ast_ctx(self), "not an l-value (binop)");
+ return false;
+ }
+
if (self->expression.outr) {
*out = self->expression.outr;
return true;
ast_expression_codegen *cgen;
ir_value *operand;
- /* In the context of a unary operation, we can disregard
- * the lvalue flag.
- */
- (void)lvalue;
+ /* An unary operation cannot yield an l-value */
+ if (lvalue) {
+ asterror(ast_ctx(self), "not an l-value (binop)");
+ return false;
+ }
+
if (self->expression.outr) {
*out = self->expression.outr;
return true;
ast_expression_codegen *cgen;
ir_value *operand;
- /* In the context of a return operation, we can disregard
- * the lvalue flag.
+ /* In the context of a return operation, we don't actually return
+ * anything...
*/
- (void)lvalue;
+ if (lvalue) {
+ asterror(ast_ctx(self), "return-expression is not an l-value");
+ return false;
+ }
+
if (self->expression.outr) {
asterror(ast_ctx(self), "internal error: ast_return cannot be reused, it bears no result!");
return false;
ir_value *funval = NULL;
/* return values are never lvalues */
- (void)lvalue;
+ if (lvalue) {
+ asterror(ast_ctx(self), "not an l-value (function call)");
+ return false;
+ }
if (self->expression.outr) {
*out = self->expression.outr;