use of org.jetbrains.plugins.ruby.motion.RubyMotionUtilImpl in project intellij-plugins by JetBrains.
the class MotionSymbolUtil method doGetTypeByName.
@NotNull
private static RType doGetTypeByName(@Nullable Module module, String typeName) {
if (module == null) {
return REmptyType.INSTANCE;
}
final Project project = module.getProject();
if (typeName.endsWith("*")) {
final RType type = doGetTypeByName(module, dereferencePointerType(typeName));
if (type != REmptyType.INSTANCE || "void".equals(dereferencePointerType(typeName))) {
return new RArrayType(project, type);
}
}
final RType primitiveType = getPrimitiveType(project, typeName);
if (primitiveType != null) {
return primitiveType;
}
final Collection<Framework> frameworks = ((RubyMotionUtilImpl) RubyMotionUtil.getInstance()).getFrameworks(module);
if (!typeName.endsWith("*")) {
final Symbol symbol = RubyMotionSymbolProvider.findClassOrStruct(module, frameworks, FQN.Builder.fromString(typeName).asList());
return symbol instanceof StructSymbol || (symbol != null && RubyMotionUtil.getInstance().isAndroid(module)) ? new RSymbolTypeImpl(symbol, Context.INSTANCE) : REmptyType.INSTANCE;
}
typeName = dereferencePointerType(typeName);
final Symbol symbol = RubyMotionSymbolProvider.findClassOrStruct(module, frameworks, Collections.singletonList(typeName));
return symbol != null ? new RSymbolTypeImpl(symbol, Context.INSTANCE) : REmptyType.INSTANCE;
}
Aggregations