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
macro let(name, &block)
let!({{name}}!) {{block}}
let!(%value) {{block}}
module Locals
@%wrapper : ValueWrapper?
def {{name.id}}
if (wrapper = @%wrapper)
wrapper.as(TypedValueWrapper(typeof({{name.id}}!))).value
wrapper.as(TypedValueWrapper(typeof(%value))).value
else
{{name.id}}!.tap do |value|
@%wrapper = TypedValueWrapper(typeof({{name.id}}!)).new(value)
%value.tap do |value|
@%wrapper = TypedValueWrapper(typeof(%value)).new(value)
end
end
end