From fe0403b96323692d2ec3ebf2fc8c46fb76f8b49b Mon Sep 17 00:00:00 2001 From: TSUYUSATO Kitsune Date: Mon, 6 May 2019 08:46:59 +0900 Subject: [PATCH] Implementation: allow to lookup implementations of class and module Closes #4941 --- src/compiler/crystal/tools/implementations.cr | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/compiler/crystal/tools/implementations.cr b/src/compiler/crystal/tools/implementations.cr index 1ac2e49e4c1a..08c4c85a5d9b 100644 --- a/src/compiler/crystal/tools/implementations.cr +++ b/src/compiler/crystal/tools/implementations.cr @@ -116,6 +116,15 @@ module Crystal end end + def visit(node : Path) + return contains_target(node) unless (loc = node.location) && (end_loc = node.end_location) && @target_location.between?(loc, end_loc) + + target = node.target_const || node.type?.try &.instance_type + target.try &.locations.try &.each do |loc| + @locations << loc + end + end + def visit(node) contains_target(node) end