Files
harbour-core/harbour/tests/testwarn.prg
Ron Pinkas a10ec0d501 20000501-01:0 GMT-8 Ron Pinkas <Ron@Profit-Master.com>
* include/hbcomp.h
      + Added to COMSYMBOL :
         BYTE * cParamTypes;
         int    iParamCount;
      + Added :
        extern char * hb_comp_szDeclaredFun

    * source/compiler/harbour.y
      * Enhanced DECLARE FUNCTION parsing to properly maintain number and type of declared function parameters.

    * source/compiler/harbour.c
      + Added char * hb_comp_szDeclaredFun
      * Modified hb_compVariableAdd() to support dummy parameter vars in Function Decleration.

    * source/compiler/hbpcode.c
      * Enhancements to hb_compStrongType() to support parameter checks of declared function.

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

    * include/hberrors.h
      + Added :
        #define HB_COMP_PARAM_COUNT                     15
        #define HB_COMP_PARAM_TYPE                      16

    * source/compiler/hbgenerr.c
      + added :
        "3Invalid number of parameters: \'%s\' expected: \'%s\'"
        "3Incompatible parameter # %s expected: \'%s\'"
2000-05-01 08:00:25 +00:00

84 lines
1.2 KiB
Plaintext

//
// $Id$
//
// This file is OK to have warnings.
#ifdef __HARBOUR__
#pragma -es0
#endif
DECLARE FUNCTION nMyFunc( cVar AS CHARACTER, nVar AS NUMERIC ) AS NUMERIC
FUNCTION Main()
LOCAL n AS NUMERIC, cVar AS CHARACTER, a[5,5,5] AS ARRAY
n := &SomeFun( 2, 3 )
n := nMyFunc( a, cVar ) + 3
n := &(cVar)
n := "&SomeVar"
n := &Var.1
n := V&SomeVar.1
n[2] := 4
cVar := {|nb AS NUMERIC , cb AS CHARACTER, db AS DATE| n := .F., nb := 'A', cb := 1, db := 0, n := 'wrong type', 0 }
? "This is a compiler test."
n := 'C is Wrong Type for n'
n := {1,2,3}
n := a
IIF( n, 2, 3 )
RETURN NIL
FUNCTION Hex2Dec( lVar AS LOGICAL )
LOCAL nVar AS NUMERIC, cVar AS CHARACTER, lVar2 AS LOGICAL, nNoType := 3
PRIVATE cMemVar1 AS CHARACTER
nVar := .T.
nVar := 1
nVar := 'A'
cVar := 2
cVar := 'B'
cVar := 2
lVar := .T.
lVar := nNoType
cVar := nVar
M->cMemVar1 := 2
NondDeclared := 2
cVar := {|n AS NUMERIC , c AS CHARACTER, d AS DATE| n := nMyFunc( n,c,d ), c := 2 }
nVar := 8 + cVar
IF 1
ENDIF
RETURN NIL
Function nMyFunc( nParam )
return nParam * 2