20000430-21:30 GMT-8 Ron Pinkas <Ron@Profit-Master.com>

* source/compiler/harbour.c
      - Removed refrence to pFunc->iFunctionIndex.

    * source/compiler/hbpcode.c
      * Enhancements to hb_compStrongType()

    * tests/testwarn.prg
      + Added code to demonstrate more warnings.

    * include/hberrors.h
      - Removed pFunctionCalls and iFunctionIndex members of _FUNC structure.
This commit is contained in:
Ron Pinkas
2000-05-01 04:37:09 +00:00
parent f935e3bca5
commit e0201e2067
5 changed files with 40 additions and 25 deletions

View File

@@ -1,22 +1,35 @@
20000430-21:30 GMT-8 Ron Pinkas <Ron@Profit-Master.com>
* source/compiler/harbour.c
- Removed refrence to pFunc->iFunctionIndex.
* source/compiler/hbpcode.c
* Enhancements to hb_compStrongType()
* tests/testwarn.prg
+ Added code to demonstrate more warnings.
* include/hberrors.h
- Removed pFunctionCalls and iFunctionIndex members of _FUNC structure.
20000430-22:15 GMT-8 Ron Pinkas <Ron@Profit-Master.com>
* harbour/source/compiler/harbour.y
* source/compiler/harbour.y
! Fixed { hb_compVariableDim( $1, $2 ); } to { hb_comp_cVarType = 'A'; hb_compVariableDim( $1, $2 ); }
so that correct type is saved.
* harbour/source/compiler/hbpcode.c
* source/compiler/hbpcode.c
* Enhancements to hb_compStrongType()
* harbour/source/compiler/hbgenerr.c
* source/compiler/hbgenerr.c
+ added :
"3Can\'t use array index with NON Array"
"3Incompatible return value: \'%s\' expected: \'%s\'"
* harbour/include/hberrors.h
* include/hberrors.h
+ added :
#define HB_COMP_WARN_NOT_ARRAY 13
#define HB_COMP_RETURN_TYPE 14
* harbour/tests/testwarn.prg
* tests/testwarn.prg
+ Added code to demonstrate more warnings.
20000430-23:00 GMT+2 Maurilio Longo <maurilio.longo@libero.it>

View File

@@ -117,10 +117,8 @@ typedef struct __FUNC
ULONG * pJumps; /* pointer to the Jumps array */
int iNOOPs; /* NOOPs Counter */
BYTE iJumps; /* Jumps Counter */
BYTE pStack[256]; /* Compile Time Stack */
BYTE pStack[512]; /* Compile Time Stack */
SHORT iStackIndex; /* Compile Time Stack Index */
BYTE pFunctionCalls[256]; /* Array of Function Calls Compile Time Stack Postion */
SHORT iFunctionIndex; /* Index into Array of Function Calls Compile Time Stack Postion */
struct __FUNC * pOwner; /* pointer to the function/procedure that owns the codeblock */
struct __FUNC * pNext; /* pointer to the next defined function */
} _FUNC, * PFUNCTION;

View File

@@ -710,7 +710,6 @@ static PFUNCTION hb_compFunctionNew( char * szName, HB_SYMBOLSCOPE cScope )
pFunc->pNOOPs = NULL;
pFunc->pJumps = NULL;
pFunc->iStackIndex = 0;
pFunc->iFunctionIndex = 0;
return pFunc;
}
@@ -1649,7 +1648,6 @@ void hb_compLinePush( void ) /* generates the pcode with the currently compiled
/* Resting Compile Time Stack */
hb_comp_functions.pLast->iStackIndex = 0;
hb_comp_functions.pLast->iFunctionIndex = 0;
}
/* Generates the pcode with the currently compiled source code line

View File

@@ -239,16 +239,28 @@ void hb_compStrongType( int iSize )
}
break;
case HB_P_DO :
case HB_P_DOSHORT :
case HB_P_FUNCTION :
case HB_P_FUNCTIONSHORT :
/* TODO: Add support for Function Parameters Declaration. */
wVar = pFunc->pCode[ ulPos + 1 ];
/* Removing all the optional parameters. Rteurn type already pushed just prior to parameters */
pFunc->iStackIndex -= wVar;
/* Removing the NIL */
pFunc->iStackIndex--;
break;
case HB_P_DO :
case HB_P_FUNCTION :
/* TODO: Add support for Function Parameters Declaration. */
wVar = pFunc->pCode[ ulPos + 1 ] + pFunc->pCode[ ulPos + 2 ] * 256;
/* Removing all the optional parameters. */
pFunc->iStackIndex = pFunc->pFunctionCalls[ pFunc->iFunctionIndex--] ;
/* Function Type already on stack at this position. */
pFunc->iStackIndex -= wVar;
/* Removing the NIL */
pFunc->iStackIndex--;
break;
case HB_P_DEC :
@@ -485,8 +497,6 @@ void hb_compStrongType( int iSize )
case HB_P_PUSHSYM :
case HB_P_MPUSHSYM :
pFunc->pFunctionCalls[ pFunc->iFunctionIndex++ ] = pFunc->iStackIndex;
pSym = hb_compSymbolGetPos( pFunc->pCode[ ulPos + 1 ] + pFunc->pCode[ ulPos + 2 ] * 256 );
if ( pSym )
@@ -508,7 +518,6 @@ void hb_compStrongType( int iSize )
( pSym->cScope & HB_FS_EXIT ) == HB_FS_EXIT )
*/
/* Storing a Book Mark of the last pushed symbol so we know how many bytes to pop when encountering function call. */
pFunc->pFunctionCalls[ pFunc->iFunctionIndex++ ] = pFunc->iStackIndex;
pFunc->pStack[ pFunc->iStackIndex++ ] = pSym->cType;
}
@@ -646,15 +655,12 @@ void hb_compStrongType( int iSize )
case HB_P_MACROPUSHALIASED :
case HB_P_MACROPUSH :
/* Replace the value of the macro expression with unknown result of expanded macro. */
pFunc->pStack[ pFunc->iStackIndex ] = ' ';
pFunc->pStack[ pFunc->iStackIndex - 1 ] = ' ';
break;
case HB_P_MACROSYMBOL :
/* Replace Macro Variable Symbol Name type with unknown type of expanded macro Function Call */
pFunc->pStack[ pFunc->iStackIndex ] = ' ';
/* Storing a Book Mark of the last pushed symbol so we know how many bytes to pop when encountering function call. */
pFunc->pFunctionCalls[ pFunc->iFunctionIndex++ ] = pFunc->iStackIndex;
pFunc->pStack[ pFunc->iStackIndex - 1 ] = ' ';
break;
case HB_P_MACROTEXT :

View File

@@ -15,6 +15,8 @@ FUNCTION Main()
n := &SomeFun( 2, 3 )
n := nMyFunc( .F., 'A' )
n := &(cVar)
n := "&SomeVar"
@@ -35,8 +37,6 @@ FUNCTION Main()
n := a
n := nMyFunc()
IIF( n, 2, 3 )
RETURN NIL