Created
August 3, 2016 19:10
-
-
Save zoffixznet/23a9c85af59e775c2e020b296e5114c0 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
sub where (&c) { | |
my $wanted = &c.line; | |
my $line-num = 0; | |
my $file; | |
my $offset; | |
for $*EXECUTABLE.parent.parent.parent.child(&c.file).IO.lines -> $line { | |
$line-num++; | |
return "$file: {$line-num-$offset}" if $line-num == $wanted; | |
if $line ~~ /^ '#line 1 ' $<file>=\S+/ { | |
$file = $<file>; | |
$offset = $line-num+1; | |
} | |
}; | |
} | |
say "$_.name(): {where $_}" for Int.^methods; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment