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. | |
| 5 | 1 | class Phlex::Compiler::Locals |
| 6 | 1 | STATE = :__phlex_state__ |
| 7 | 1 | SELF = :__phlex_self__ |
| 8 | 1 | EXCEPTION = :__phlex_exception__ |
| 9 | ||
| 10 | 1 | def initialize |
| 11 | 240 | @count = 0 |
| 12 | end | |
| 13 | ||
| 14 | 1 | def fresh(purpose) |
| 15 | 543 | :"__phlex_#{purpose}_#{@count += 1}__" |
| 16 | end | |
| 17 | end |