Replies: 1 comment
-
| 
         IIUC, defining  ---@param self toknzr.Virtual
---@return string char
local function cursor_next(self)
    ---@class toknzr.Virtual # need this line, to mark `cursor` variable with the `class` attribute
    local cursor = self
    local c = cursor.source[cursor.source_pos] --> no more warning
    return c
endYou may wonder why a standard  ---@class MyClass
---@field protected a string
local MyClass = {}
function MyClass:f1()
    print(self.a)   -- ok
end
---@param self MyClass
local function f2(self)
    print(self.a)   -- warning
end
---@param self MyClass
local function f3(self)
    ---@class MyClass
    local self = self
    print(self.a)   -- ok
end | 
  
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
I has define
selfastoknzr.Virtual(at line 26)but I getting warn at line 30
Why?
Beta Was this translation helpful? Give feedback.
All reactions