crystal tool implementationの話HN: さっき作った (make now just)
crystal tool implementationとは?crystal tool implementationとは?crystal tool 何とかで使えるコマンドの 1 つ
crystal tool formatもこの仲間使い方:
$ crystal tool implementation -c ファイル:行:列 エントリーファイル
foo.cr
def foo(x)
p x
end
foo 42
$ crystal tool implementation -c foo.cr:5:1 foo.cr
1 implementation found
/Users/makenowjust/foo.cr:1:1
bar.cr
def bar(x : Int32)
end
def bar(x : String)
end
x = rand() < 0.5 ? 1 : "x"
bar x
$ crystal tool implementation -c bar.cr:8:1 bar.cr
2 implementations found
/Users/makenowjust/bar.cr:1:1
/Users/makenowjust/bar.cr:4:1
mac.cr
macro mac(x)
p {{x}}
end
mac 42
$ crystal tool implementation -c mac.cr:5:1 mac.cr
no implementations or method call found
in-call.cr
def foo
bar
end
def bar
end
$ crystal tool implementation -c in-call.cr:2:3 in-call.cr
no implementations or method call found
世知辛いのじゃ〜
ここ一週間くらいcrystal tool implementationを弄っていた。
色々直した。
cls.cr
class Foo
end
Foo.new
$ bin/crystal tool implementation -c cls.cr:4:1 cls.cr
Foo
1 implementation found
/Users/makenowjust/cls.cr:1:1
als.cr
class Foo
end
class Bar
end
alias Baz = Foo | Bar
Baz
$ bin/crystal tool implementation -c als.cr:9:1 als.cr
Baz
1 implementation found
/Users/makenowjust/als.cr:7:1