lib/phlex/compiler/locals.rb

Lines

100%

8 of 8 covered

Branches

—

0 of 0 covered

Methods

100%

2 of 2 covered

1# frozen_string_literal: true
2
3# Names for the locals compiled code introduces. They all start with
4# `__phlex_`, and a method that already uses such a name isn't compiled.
51class Phlex::Compiler::Locals
61 STATE = :__phlex_state__
71 SELF = :__phlex_self__
81 EXCEPTION = :__phlex_exception__
9
101 def initialize
11240 @count = 0
12 end
13
141 def fresh(purpose)
15543 :"__phlex_#{purpose}_#{@count += 1}__"
16 end
17end