Sha256: cf3d6115019b53898430f33a7b453e07fd9a51206637ef5948f2583b42686954
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true module ThemeCheck module LanguageServer module VariableLookupFinder class AssignmentsFinder class ScopeVisitor attr_reader :global_scope, :current_scope def initialize @node_handler = NodeHandler.new @global_scope = Scope.new({}) @current_scope = Scope.new({}) end def visit_template(template) return unless template visit(liquid_node(template), global_scope) end private def visit(node, scope) return if node.type_name == :variable_lookup method = :"on_#{node.type_name}" scope = @node_handler.send(method, node, scope) if @node_handler.respond_to?(method) @current_scope = scope node.children.each { |child| visit(child, scope) } end def liquid_node(template) LiquidNode.new(template.root, nil, template) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
theme-check-1.12.0 | lib/theme_check/language_server/variable_lookup_finder/assignments_finder/scope_visitor.rb |