Skip to content

[VFP] Problem with /fox3 and "this" in codeblock #2054

Description

@cpyrgas

Using of this.expfld in the FOR expression causes a runtime exception. When using "SELF:" or "THIS:" it works fine. Also when replacing the code with what I see in the .ppo file, then the code executes fine, guess in this case the .ppo is not accurate.

#pragma options("fox3", enable)
#pragma options("allowdot", enable)
#pragma options("lb", enable)
#pragma options("memvar", enable)
#pragma options("undeclared", enable)

CLASS TestClass
	EXPORT expfld AS INT
	METHOD Test() AS VOID
	cDbf := "c:\test\testcb"
	DbCreate( cDbf, {{"FLD","N",10,0}} )
	DbUseArea( , , cdbf )
	DbAppend( )
	DbGoTop()

	LOCAL n AS INT
	COUNT TO n FOR this.expfld == 0
	? n
END CLASS

FUNCTION Start() AS VOID
	TestClass{}:Test()
---------------------------
ERROR
---------------------------
Description :	Variable does not exist: THIS
Subsystem :	DBFVFP
GenCode :	EG_SYNTAX Syntax error
SubCode :	1022 Index Expression incorrect.
FuncSym :	DbEval
Severity :	ES_ERROR
Can Default :	True
Can Retry :	False
Can Substitute :	False
FileName :	c:\test\testcb.DBF
Argument Number :	2
Argument :	wa
Arguments :	{THIS,expfld}
Stack Trace :	
   at XSharp.RT.Functions.__FieldGetWa2(String wa, String fldName, Boolean lAllowUndeclared)
   at TestClass.<>c.<Test>b__1_1() in C:\xSharp\Dev\src\CompilerTests\Applications\C978\Prg\C978.prg:line 17
   at <>f__AnonymousType0.Eval(__Usual[] Xs$Args)
   at XSharp.Codeblock.EvalBlock(Object[] args)
   at XSharp.RDD.Workarea.EvalBlock(ICodeblock oBlock)
   at XSharp.RDD.DBF.EvalBlock(ICodeblock cbBlock)
   at XSharp.RDD.Workarea.DbEval(DbEvalInfo info)
   at XSharp.RDD.DBF.DbEval(DbEvalInfo info)
   at XSharp.CoreDb.<>c__DisplayClass40_0.<Eval>b__0()
   at XSharp.CoreDb.Do[T](Func`1 action)
   at XSharp.CoreDb.Eval(ICodeblock uBlock, ICodeblock uCobFor, ICodeblock uCobWhile, Object uNext, Object nRecno, Boolean lRest)
   at XSharp.RT.Functions.DbEval(__Usual[] Xs$Args)

Metadata

Metadata

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions