Class: ThemeCheck::LanguageServer::VariableLookupFinder::AssignmentsFinder::Scope

Inherits:
Struct
  • Object
show all
Includes:
TypeHelper
Defined in:
lib/theme_check/language_server/variable_lookup_finder/assignments_finder/scope.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TypeHelper

#input_type_of

Instance Attribute Details

#parentObject

Returns the value of attribute parent

Returns:

  • (Object)

    the current value of parent



7
8
9
# File 'lib/theme_check/language_server/variable_lookup_finder/assignments_finder/scope.rb', line 7

def parent
  @parent
end

#variablesObject

Returns the value of attribute variables

Returns:

  • (Object)

    the current value of variables



7
8
9
# File 'lib/theme_check/language_server/variable_lookup_finder/assignments_finder/scope.rb', line 7

def variables
  @variables
end

Instance Method Details

#<<(node) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/theme_check/language_server/variable_lookup_finder/assignments_finder/scope.rb', line 17

def <<(node)
  tag = node.value

  case tag
  when Liquid::Assign
    variable_name = tag.to
    variables[variable_name] = as_potential_lookup(tag.from.name)
  when Liquid::For, Liquid::TableRow
    variable_name = tag.variable_name
    variables[variable_name] = as_potential_lookup(tag.collection_name, ['first'])
  end
end

#new_childObject



10
11
12
13
14
15
# File 'lib/theme_check/language_server/variable_lookup_finder/assignments_finder/scope.rb', line 10

def new_child
  child_scope = dup
  child_scope.variables = variables.dup
  child_scope.parent = self
  child_scope
end