Sha256: 0407cedc986d0f91ca3f05fa710e5a4ca9f754fea60e539c99e36147da1c152a

Contents?: true

Size: 474 Bytes

Versions: 4

Compression:

Stored size: 474 Bytes

Contents

# frozen_string_literal: true

module Phlex::Compiler::Visitors
	class File < Base
		def initialize(compiler)
			@scope = []
			super
		end

		visit_method def visit_class(node)
			@scope.push(node)

			if node.location.start_line == @compiler.line
				@compiler.scope = @scope
				View.new(@compiler).visit_all(node.child_nodes)
			else
				super
			end

			@scope.pop
		end

		visit_method def visit_module(node)
			@scope.push(node)
			super
			@scope.pop
		end
	end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
phlex-0.5.3 lib/phlex/compiler/visitors/file.rb
phlex-0.5.2 lib/phlex/compiler/visitors/file.rb
phlex-0.5.1 lib/phlex/compiler/visitors/file.rb
phlex-0.5.0 lib/phlex/compiler/visitors/file.rb