Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GET and SET in Property definition throws Error when containing Additional Logic #56

Closed
eglekaz opened this issue Sep 3, 2024 · 1 comment

Comments

@eglekaz
Copy link

eglekaz commented Sep 3, 2024

Example:

class TestClass:

    define public property m_Total as integer no-undo
        get.
        set.
  
    define public property Totals as integer no-undo
        get:
            if m_Total < 0 then
                return 0.
            else
                return m_Total.
            end.
        end get.
          
        set (newValue as integer):
            m_Total = newValue.
        end set.  
end class.
@jkbz64
Copy link
Member

jkbz64 commented Sep 4, 2024

Few things:

  • Getter did not have body variant, fixed that.
  • Your if else inside getter is invalid code, AFAIK you can't use 'end.' for else when using if else with (single) terminated statement, only when doing THEN DO: variant.
  • Setter broke because of name of the second variable, it contains NEW at the beginning and new keyword has priority over identifier name so it tried to parse new expression :( This is related to the same issue at Variable of two keywords got splited during parsing #53

@jkbz64 jkbz64 closed this as completed in 9fba9ea Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants