Sha256: 347d0ccedde4de74559e7ca5f904282b35cfdb558221f8e028035a1028bf4923
Contents?: true
Size: 785 Bytes
Versions: 33
Compression:
Stored size: 785 Bytes
Contents
# frozen_string_literal: true module Parser class StaticEnvironment FORWARD_ARGS = :FORWARD_ARGS def initialize reset end def reset @variables = Set[] @stack = [] end def extend_static @stack.push(@variables) @variables = Set[] self end def extend_dynamic @stack.push(@variables) @variables = @variables.dup self end def unextend @variables = @stack.pop self end def declare(name) @variables.add(name.to_sym) self end def declared?(name) @variables.include?(name.to_sym) end def declare_forward_args declare(FORWARD_ARGS) end def declared_forward_args? declared?(FORWARD_ARGS) end end end
Version data entries
33 entries across 30 versions & 6 rubygems