From 59756d47e545837de1ba8138830a035e1b9fe8e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Fri, 3 May 2013 22:45:11 +0000 Subject: [PATCH] [COMPILER] * BUG: Now a FOR loop with no loop variable correctly raises a syntax error. git-svn-id: svn://localhost/gambas/trunk@5637 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- main/gbc/gbc_trans_ctrl.c | 3 ++- main/gbc/gbc_trans_expr.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/main/gbc/gbc_trans_ctrl.c b/main/gbc/gbc_trans_ctrl.c index 276e5c020..92b2d37d2 100644 --- a/main/gbc/gbc_trans_ctrl.c +++ b/main/gbc/gbc_trans_ctrl.c @@ -960,7 +960,8 @@ void TRANS_for(void) control_enter(RS_FOR); - TRANS_affectation(FALSE); + if (!TRANS_affectation(FALSE)) + THROW(E_SYNTAX); if (!CODE_check_pop_local_last(&local)) THROW("Loop variable must be local"); diff --git a/main/gbc/gbc_trans_expr.c b/main/gbc/gbc_trans_expr.c index c03532cdb..7f09531a6 100644 --- a/main/gbc/gbc_trans_expr.c +++ b/main/gbc/gbc_trans_expr.c @@ -698,7 +698,7 @@ bool TRANS_affectation(bool dup) look++; } - if (!equal) + if (!equal || look == JOB->current) return FALSE; left = JOB->current;