class Solargraph::Pin::LocalVariable
def initialize assignment: nil, presence: nil, **splat
-
splat(Hash) -- -
presence(Range, nil) -- -
assignment(AST::Node, nil) --
def initialize assignment: nil, presence: nil, **splat super(**splat) @assignment = assignment @presence = presence end
def match_named_closure needle, haystack
-
(Boolean)-
Parameters:
-
haystack(Pin::Base) -- -
needle(Pin::Base) --
def match_named_closure needle, haystack return true if needle == haystack || haystack.is_a?(Pin::Block) cursor = haystack until cursor.nil? return true if needle.path == cursor.path return false if cursor.path && !cursor.path.empty? cursor = cursor.closure end false end
def match_tags tag1, tag2
-
(Boolean)-
Parameters:
-
tag2(String) -- -
tag1(String) --
def match_tags tag1, tag2 # @todo This is an unfortunate hack made necessary by a discrepancy in # how tags indicate the root namespace. The long-term solution is to # standardize it, whether it's `Class<>`, an empty string, or # something else. tag1 == tag2 || (['', 'Class<>'].include?(tag1) && ['', 'Class<>'].include?(tag2)) end
def to_rbs
-
(String)-
def to_rbs (name || '(anon)') + ' ' + (return_type&.to_rbs || 'untyped') end
def try_merge! pin
-
pin(self) --
def try_merge! pin return false unless super @presence = pin.presence true end
def visible_at?(other_closure, other_loc)
-
other_loc(Location) -- -
other_closure(Pin::Closure) --
def visible_at?(other_closure, other_loc) location.filename == other_loc.filename && presence.include?(other_loc.range.start) && match_named_closure(other_closure, closure) end