mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Rework let and subject to allow super
This addresses https://gitlab.com/arctic-fox/spectator/issues/32
This commit is contained in:
parent
3dd691a990
commit
e035afa85f
1 changed files with 6 additions and 6 deletions
|
@ -1,17 +1,17 @@
|
||||||
module Spectator
|
module Spectator
|
||||||
module DSL
|
module DSL
|
||||||
macro let(name, &block)
|
macro let(name, &block)
|
||||||
def %value
|
|
||||||
{{block.body}}
|
|
||||||
end
|
|
||||||
|
|
||||||
@%wrapper : ::Spectator::ValueWrapper?
|
@%wrapper : ::Spectator::ValueWrapper?
|
||||||
|
|
||||||
|
def {{name.id}}
|
||||||
|
{{block.body}}
|
||||||
|
end
|
||||||
|
|
||||||
def {{name.id}}
|
def {{name.id}}
|
||||||
if (wrapper = @%wrapper)
|
if (wrapper = @%wrapper)
|
||||||
wrapper.as(::Spectator::TypedValueWrapper(typeof(%value))).value
|
wrapper.as(::Spectator::TypedValueWrapper(typeof(previous_def))).value
|
||||||
else
|
else
|
||||||
%value.tap do |value|
|
previous_def.tap do |value|
|
||||||
@%wrapper = ::Spectator::TypedValueWrapper.new(value)
|
@%wrapper = ::Spectator::TypedValueWrapper.new(value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue