-
-
Save RomanHargrave/caea726269872be1100c225850829243 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proto method declare(@, @, :$tag = Nil, |) { ... } | |
multi method declare([], [$name], :$tag = Nil) { | |
say " → leaf $name"; | |
%.children{$name} //= Node[ClassTag].new( | |
:parent(self), | |
:tag($tag // ClassTag.new), | |
:$name | |
) | |
} | |
# This ^ | |
# Appears to shadow this v | |
multi method declare([], [$name, *@class], :$tag = Nil) { | |
given %.children{$name} //= Node[ClassTag].new: :parent(self), :$name { | |
say " → declare({@class.gist}) [ClassTag]"; | |
.declare(@class, :$tag); | |
} | |
} | |
# Also, @class here doesn't match array params unless it's marked as greedy (*) | |
multi method declare([$name, *@package], *@class, :$tag = Nil) { | |
given %.children{$name} //= Node[PackageTag].new: :parent(self), :$name { | |
say " → declare({@package.gist}, {@class.gist})"; | |
.declare(@package, |@class, :$tag); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment