Class: ThemeCheck::LanguageServer::VariableLookupFinder::AssignmentsFinder::ScopeVisitor

Inherits:
Object
  • Object
show all
Defined in:
lib/theme_check/language_server/variable_lookup_finder/assignments_finder/scope_visitor.rb

Constant Summary collapse

SCOPE_UNAWARE_NODES =
%i(range range_lookup variable variable_lookup)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeScopeVisitor

Returns a new instance of ScopeVisitor.



12
13
14
15
16
# File 'lib/theme_check/language_server/variable_lookup_finder/assignments_finder/scope_visitor.rb', line 12

def initialize
  @node_handler = NodeHandler.new
  @global_scope = Scope.new({})
  @current_scope = Scope.new({})
end

Instance Attribute Details

#current_scopeObject (readonly)

Returns the value of attribute current_scope.



10
11
12
# File 'lib/theme_check/language_server/variable_lookup_finder/assignments_finder/scope_visitor.rb', line 10

def current_scope
  @current_scope
end

#global_scopeObject (readonly)

Returns the value of attribute global_scope.



10
11
12
# File 'lib/theme_check/language_server/variable_lookup_finder/assignments_finder/scope_visitor.rb', line 10

def global_scope
  @global_scope
end

Instance Method Details

#visit_template(template) ⇒ Object



18
19
20
21
22
# File 'lib/theme_check/language_server/variable_lookup_finder/assignments_finder/scope_visitor.rb', line 18

def visit_template(template)
  return unless template

  visit(liquid_node(template), global_scope)
end