mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Compiler error if stub defined in a method
This commit is contained in:
parent
94872a498d
commit
291b4c75a8
1 changed files with 2 additions and 0 deletions
|
@ -45,6 +45,7 @@ module Spectator
|
||||||
#
|
#
|
||||||
# Stubbed methods will call `#_spectator_find_stub` with the method call information.
|
# Stubbed methods will call `#_spectator_find_stub` with the method call information.
|
||||||
private macro stub(method)
|
private macro stub(method)
|
||||||
|
{% raise "Cannot define a stub inside a method" if @def %}
|
||||||
{% raise "stub requires a method definition" if !method.is_a?(Def) %}
|
{% raise "stub requires a method definition" if !method.is_a?(Def) %}
|
||||||
{% raise "Cannot stub method with reserved keyword as name - #{method.name}" if method.name.starts_with?("_spectator") || ::Spectator::DSL::RESERVED_KEYWORDS.includes?(method.name.symbolize) %}
|
{% raise "Cannot stub method with reserved keyword as name - #{method.name}" if method.name.starts_with?("_spectator") || ::Spectator::DSL::RESERVED_KEYWORDS.includes?(method.name.symbolize) %}
|
||||||
|
|
||||||
|
@ -108,6 +109,7 @@ module Spectator
|
||||||
#
|
#
|
||||||
# Stubbed methods will call `#_spectator_find_stub` with the method call information.
|
# Stubbed methods will call `#_spectator_find_stub` with the method call information.
|
||||||
private macro abstract_stub(method)
|
private macro abstract_stub(method)
|
||||||
|
{% raise "Cannot define a stub inside a method" if @def %}
|
||||||
{% raise "abstract_stub requires a method definition" if !method.is_a?(Def) %}
|
{% raise "abstract_stub requires a method definition" if !method.is_a?(Def) %}
|
||||||
{% raise "Cannot stub method with reserved keyword as name - #{method.name}" if method.name.starts_with?("_spectator") || ::Spectator::DSL::RESERVED_KEYWORDS.includes?(method.name.symbolize) %}
|
{% raise "Cannot stub method with reserved keyword as name - #{method.name}" if method.name.starts_with?("_spectator") || ::Spectator::DSL::RESERVED_KEYWORDS.includes?(method.name.symbolize) %}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue