use of org.jetbrains.plugins.ruby.ruby.lang.psi.RPossibleCall in project intellij-plugins by JetBrains.
the class RubyMotionTypeProvider method createTypeForRef.
@Nullable
private static RType createTypeForRef(@NotNull RReference ref, @NotNull Module module) {
final RPsiElement value = ref.getValue();
// method name may be identifier on constant
if (value instanceof RPossibleCall) {
final String shortName = ((RPossibleCall) value).getPossibleCommand();
final String sdkVersion = RubyMotionUtil.getInstance().getSdkVersion(module);
final String[] frameworks = RubyMotionUtil.getInstance().getRequiredFrameworks(module);
boolean isIdSelector = false;
for (String framework : frameworks) {
if (BridgeSupportLoader.getInstance().isIdSelector(shortName, sdkVersion, framework)) {
isIdSelector = true;
break;
}
}
if (isIdSelector) {
final Symbol callSymbol = ResolveUtil.resolveToSymbolWithCaching(ref.getReference());
if (callSymbol instanceof FunctionSymbol) {
final Function function = ((FunctionSymbol) callSymbol).getFunction();
if (function.isId()) {
return RTypeUtil.createTypeSameAsReceiverInstance(ref);
}
}
}
}
return null;
}
Aggregations