Skip to content

[X# 3] error in codeblock execution #1860

@hpetriffer

Description

@hpetriffer

In the following code, when the codeblock is created with an string var cb2 := &("{|osql| NTrim(osql:RecCount)}") the execution calls the setter of RecCount. Expected is only a call to the getter

class Test
    private _val := 1 as int
    public property RecCount as int
        get
            Console.WriteLine(ei"RecCount get: {_val}")
            return _val
        end get
        protected set
            Console.WriteLine(ei"RecCount set: {value}")
            _val := value
        end set
    end property

    method NoIVarPut(symField, xValue) as usual clipper
        Console.WriteLine(ei"NoIVarPut: {AsString(symField)},{AsString(xValue)}")
        return nil
end class


function Start() as void strict
    var osql := Test{}

    // Works fine
    var cb1 := {|osql| NTrim(osql:RecCount)}
    var res1 := Eval(cb1, osql)

    // Calls first the getter and then the setter of RecCount, which is not expected
    var cb2 := &("{|osql| NTrim(osql:RecCount)}")
    var res2 := Eval(cb2,osql)

	Console.ReadLine()
	return

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions