Hide name of underlying let's block method

This prevent's defining a bang version of the let value with the same
name.
This commit is contained in:
Michael Miller 2018-09-11 12:54:47 -06:00
parent 2c0238d178
commit 95ec999bba

View file

@ -86,17 +86,17 @@ module Spectator
end end
macro let(name, &block) macro let(name, &block)
let!({{name}}!) {{block}} let!(%value) {{block}}
module Locals module Locals
@%wrapper : ValueWrapper? @%wrapper : ValueWrapper?
def {{name.id}} def {{name.id}}
if (wrapper = @%wrapper) if (wrapper = @%wrapper)
wrapper.as(TypedValueWrapper(typeof({{name.id}}!))).value wrapper.as(TypedValueWrapper(typeof(%value))).value
else else
{{name.id}}!.tap do |value| %value.tap do |value|
@%wrapper = TypedValueWrapper(typeof({{name.id}}!)).new(value) @%wrapper = TypedValueWrapper(typeof(%value)).new(value)
end end
end end
end end