rokucommunity / brighterscript

A superset of Roku's BrightScript language
MIT License
158 stars 46 forks source link

cannot access protected members in v1.0.0-alpha29 #1130

Closed rdaci23 closed 4 months ago

rdaci23 commented 5 months ago

Cannot access protected member from subclasses image image

markwpearce commented 4 months ago

@rdaci23 I can't reproduce this issue.

This works for me in 1.0.0.alpha.29 ... If you can get a concise example of failure, please let me know.

namespace alpha
  class SuperKlass

    node as roSGNode
    protected name as string

    sub new(node as roSGNode)
      m.name = node.id
    end sub

    function getValue()
      return "Hello!"
    end function

  end class
end namespace

class SubKlass extends alpha.SuperKlass

  node as roSGNodeLabel

  sub new()
    super(createObject("roSGNode", "Label"))
  end sub

  sub setText(newText as string)
    m.node.text = newText + m.name
    print m.getValue()
    print super.getValue()
  end sub
end class
rdaci23 commented 4 months ago

@markwpearce I think it was something with my vscode, I just update it to the latest version and I can't reproduce it either now. Closing this issue for now.

rdaci23 commented 4 months ago

@markwpearce this is how I reproduced the issue Screenshot 2024-04-24 at 12 50 22 Screenshot 2024-04-24 at 12 51 55