diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ac2ce8b8c5..6478f5273c 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,8 @@ +20000512-08:00 GMT-8 Ron Pinkas + + * source/compiler/harbour.y + + Added support for END to be used with FOR loops. + 20000512-13:31 GMT+2 Maurilio Longo + source/rtl/stringsx.c diff --git a/harbour/include/hberrors.h b/harbour/include/hberrors.h index 8764669840..e7a83f16fb 100644 --- a/harbour/include/hberrors.h +++ b/harbour/include/hberrors.h @@ -113,9 +113,10 @@ extern "C" { #define HB_COMP_WARN_VAL_NOT_USED 20 #define HB_COMP_WARN_ARRAY_ASSIGN_TYPE 21 #define HB_COMP_WARN_ARRAY_ASSIGN_SUSPECT 22 -#define HB_COMP_WARN_MEANINGLESS 23 -#define HB_COMP_WARN_UNREACHABLE 24 -#define HB_COMP_WARN_DUPL_ANNOUNCE 25 +#define HB_COMP_WARN_CLASS_NOT_FOUND 23 +#define HB_COMP_WARN_MEANINGLESS 24 +#define HB_COMP_WARN_UNREACHABLE 25 +#define HB_COMP_WARN_DUPL_ANNOUNCE 26 /* * Errors generated by Harbour preprocessor diff --git a/harbour/source/compiler/harbour.c b/harbour/source/compiler/harbour.c index e9109e69ca..42fe4c0efb 100644 --- a/harbour/source/compiler/harbour.c +++ b/harbour/source/compiler/harbour.c @@ -552,7 +552,10 @@ void hb_compVariableAdd( char * szVarName, BYTE cValueType ) if ( cValueType == '+' ) { //printf( "\nVariable %s is of Class: %s\n", szVarName, hb_comp_szClass ); + pVar->pClass = hb_compClassFind( hb_comp_szClass ); + if( ! pVar->pClass ) + hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_CLASS_NOT_FOUND, hb_comp_szClass, szVarName ); } if ( hb_comp_iVarScope & VS_PARAMETER ) @@ -800,7 +803,7 @@ PCOMCLASS hb_compClassAdd( char * szClassName ) { PCOMCLASS pClass; - printf( "\nDeclaring Class: %s\n", szClassName ); + //printf( "\nDeclaring Class: %s\n", szClassName ); if ( hb_comp_iWarnings < 3 ) return NULL; diff --git a/harbour/source/compiler/harbour.y b/harbour/source/compiler/harbour.y index fe1f6feaad..d3c24944f4 100644 --- a/harbour/source/compiler/harbour.y +++ b/harbour/source/compiler/harbour.y @@ -1382,7 +1382,9 @@ StepExpr : /* default step expression */ { $$ = NULL; } ; ForStatements : EmptyStats NEXT { --hb_comp_wForCounter; } - | EmptyStats NEXT IdentName { --hb_comp_wForCounter; } + | EmptyStats NEXT IdentName { --hb_comp_wForCounter; } + | EmptyStats END { --hb_comp_wForCounter; } + | EmptyStats END IdentName { --hb_comp_wForCounter; } ; BeginSeq : BEGINSEQ { ++hb_comp_wSeqCounter; $$ = hb_compSequenceBegin(); } Crlf { hb_compLinePush(); } diff --git a/harbour/source/compiler/hbgenerr.c b/harbour/source/compiler/hbgenerr.c index c9b846334b..cc7ed839e5 100644 --- a/harbour/source/compiler/hbgenerr.c +++ b/harbour/source/compiler/hbgenerr.c @@ -113,6 +113,7 @@ char * hb_comp_szWarnings[] = "3Value of Variable \'%s\' never used", "3Incompatible type in assignment to declared array element expected: \'%s\'", "4Suspicious type in assignment to declared array element expected: \'%s\'", + "3Class \'%s\' not known in declaration of variable \'%s\'", "0Meaningless use of expression: \'%s\'", "2Unreachable code", "1Redundant \'ANNOUNCE %s\' statement ignored" diff --git a/harbour/tests/testwarn.prg b/harbour/tests/testwarn.prg index 4dcb92b99a..d49316697c 100644 --- a/harbour/tests/testwarn.prg +++ b/harbour/tests/testwarn.prg @@ -76,7 +76,7 @@ STATIC lGlobal AS LOGICAL PROCEDURE THEMAIN( optional ) - STATIC lStatic := 0, oMyObj As Object From MyClass + STATIC lStatic := 0, oMyObj As Object From WrongClass LOCAL cVar AS CHAR := [declare function] oMyObj:MyMethod( 2, 3, 4 ) @@ -89,6 +89,10 @@ PROCEDURE THEMAIN( optional ) PRIVATE TEST AS CHAR + FOR Conter := 1 TO 10 + ? "For with End" + NEXT + IF optional ? 'Ok' ENDIF