本文整理汇总了Java中consulo.dotnet.resolve.DotNetPointerTypeRef类的典型用法代码示例。如果您正苦于以下问题:Java DotNetPointerTypeRef类的具体用法?Java DotNetPointerTypeRef怎么用?Java DotNetPointerTypeRef使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DotNetPointerTypeRef类属于consulo.dotnet.resolve包,在下文中一共展示了DotNetPointerTypeRef类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolve
import consulo.dotnet.resolve.DotNetPointerTypeRef; //导入依赖的package包/类
@RequiredReadAction
@NotNull
@Override
public ResolveResult[] resolve(@NotNull CSharpIndexAccessExpressionImpl expression, boolean incompleteCode)
{
DotNetExpression qualifier = expression.getQualifier();
DotNetTypeRef typeRef = qualifier.toTypeRef(true);
if(typeRef instanceof DotNetPointerTypeRef)
{
DotNetTypeRef innerTypeRef = ((DotNetPointerTypeRef) typeRef).getInnerTypeRef();
CSharpLightIndexMethodDeclarationBuilder builder = new CSharpLightIndexMethodDeclarationBuilder(expression.getProject(), 0);
builder.withReturnType(innerTypeRef);
builder.addParameter(new CSharpLightParameterBuilder(expression.getProject()).withName("p").withTypeRef(new CSharpTypeRefByQName(expression, DotNetTypes.System.Int32)));
return new ResolveResult[]{new CSharpResolveResult(builder)};
}
ResolveResult[] resolveResults = CSharpReferenceExpressionImplUtil.multiResolveImpl(CSharpReferenceExpression.ResolveToKind.ARRAY_METHOD, expression, expression, true);
return !incompleteCode ? resolveResults : CSharpResolveUtil.filterValidResults(resolveResults);
}
示例2: typeToDocName
import consulo.dotnet.resolve.DotNetPointerTypeRef; //导入依赖的package包/类
@RequiredReadAction
private String typeToDocName(PsiElement element, DotNetTypeRef typeRef)
{
if(typeRef instanceof DotNetArrayTypeRef)
{
return typeToDocName(element, ((DotNetArrayTypeRef) typeRef).getInnerTypeRef()) + "[]";
}
else if(typeRef instanceof DotNetPointerTypeRef)
{
return typeToDocName(element, ((DotNetPointerTypeRef) typeRef).getInnerTypeRef()) + "*";
}
else
{
PsiElement resolve = typeRef.resolve().getElement();
if(resolve == null)
{
return "<error>";
}
if(resolve instanceof DotNetGenericParameter)
{
DotNetGenericParameterListOwner generic = PsiTreeUtil.getParentOfType(resolve, DotNetGenericParameterListOwner.class);
if(element == generic)
{
return "`" + ArrayUtil.indexOf(generic.getGenericParameters(), resolve);
}
else
{
// handle class parameter - in method
return ((DotNetGenericParameter) resolve).getName();
}
}
else
{
return getDocName0(resolve);
}
}
}
示例3: normalizeType
import consulo.dotnet.resolve.DotNetPointerTypeRef; //导入依赖的package包/类
@NotNull
public PsiType normalizeType(DotNetTypeRef type)
{
String qName = type.getQualifiedText();
if(Comparing.equal(qName, "System.Void"))
{
return PsiType.VOID;
}
else if(Comparing.equal(qName, "System.Byte"))
{
return PsiType.BYTE;
}
else if(Comparing.equal(qName, "System.Int32"))
{
return PsiType.INT;
}
else if(Comparing.equal(qName, "System.Int16"))
{
return PsiType.SHORT;
}
else if(Comparing.equal(qName, "System.Boolean"))
{
return PsiType.BOOLEAN;
}
else if(Comparing.equal(qName, "System.Int64"))
{
return PsiType.LONG;
}
else if(Comparing.equal(qName, "System.Single"))
{
return PsiType.FLOAT;
}
else if(Comparing.equal(qName, "System.Double"))
{
return PsiType.DOUBLE;
}
else if(Comparing.equal(qName, "System.Char"))
{
return PsiType.CHAR;
}
else if(Comparing.equal(qName, "System.String"))
{
return fromQName(JavaClassNames.JAVA_LANG_STRING);
}
else if(Comparing.equal(qName, "System.Object"))
{
return fromQName(JavaClassNames.JAVA_LANG_OBJECT);
}
else if(type instanceof DotNetArrayTypeRef)
{
return new PsiArrayType(normalizeType(((DotNetArrayTypeRef) type).getInnerTypeRef()));
}
//TODO [VISTALL]
if(type instanceof DotNetPointerTypeRef)
{
return fromText("Pointer");
}
else if(type == DotNetTypeRef.ERROR_TYPE)
{
return fromText("error");
}
String qualifiedText = type.getQualifiedText();
if(Comparing.equal(qualifiedText, "<error>"))
{
return fromText("error");
}
qualifiedText = normalize(qualifiedText);
return fromText(qualifiedText);
}
示例4: resolveElements
import consulo.dotnet.resolve.DotNetPointerTypeRef; //导入依赖的package包/类
@Nullable
@RequiredReadAction
private Set<PsiElement> resolveElements(@NotNull IElementType elementType, @NotNull DotNetTypeRef typeRef)
{
if(typeRef instanceof DotNetPointerTypeRef)
{
if(elementType != CSharpTokens.PLUS && elementType != CSharpTokens.MINUS)
{
return Collections.emptySet();
}
Set<PsiElement> elements = new HashSet<>();
for(String pointerArgumentType : ourPointerArgumentTypes)
{
elements.add(buildOperatorForPointer(elementType, typeRef, pointerArgumentType));
}
return elements;
}
else
{
DotNetTypeResolveResult typeResolveResult = typeRef.resolve();
PsiElement element = typeResolveResult.getElement();
if(element == null)
{
return null;
}
AsPsiElementProcessor psiElementProcessor = new AsPsiElementProcessor();
MemberResolveScopeProcessor processor = new MemberResolveScopeProcessor(CSharpResolveOptions.build().element(this), psiElementProcessor, new ExecuteTarget[]{ExecuteTarget.ELEMENT_GROUP});
ResolveState state = ResolveState.initial();
state = state.put(CSharpResolveUtil.SELECTOR, new OperatorByTokenSelector(elementType));
state = state.put(CSharpResolveUtil.EXTRACTOR, typeResolveResult.getGenericExtractor());
CSharpResolveUtil.walkChildren(processor, element, false, true, state);
Set<PsiElement> psiElements = psiElementProcessor.getElements();
if(psiElements.isEmpty())
{
return null;
}
return psiElements;
}
}
示例5: generateLinksForType
import consulo.dotnet.resolve.DotNetPointerTypeRef; //导入依赖的package包/类
@RequiredReadAction
private static String generateLinksForType(DotNetTypeRef typeRef, PsiElement element, boolean qualified)
{
StringBuilder builder = new StringBuilder();
if(typeRef == DotNetTypeRef.AUTO_TYPE)
{
builder.append("var");
}
else if(typeRef instanceof DotNetArrayTypeRef)
{
builder.append(generateLinksForType(((DotNetArrayTypeRef) typeRef).getInnerTypeRef(), element, qualified));
builder.append("[]");
}
else if(typeRef instanceof CSharpRefTypeRef)
{
builder.append(((CSharpRefTypeRef) typeRef).getType().name());
builder.append(" ");
builder.append(generateLinksForType(((CSharpRefTypeRef) typeRef).getInnerTypeRef(), element, qualified));
}
else if(typeRef instanceof DotNetPointerTypeRef)
{
builder.append(generateLinksForType(((DotNetPointerTypeRef) typeRef).getInnerTypeRef(), element, qualified));
builder.append("*");
}
else
{
DotNetTypeResolveResult dotNetTypeResolveResult = typeRef.resolve();
PsiElement resolved = dotNetTypeResolveResult.getElement();
if(resolved instanceof DotNetQualifiedElement)
{
if(resolved instanceof DotNetGenericParameterListOwner)
{
wrapToLink(resolved, builder, qualified);
DotNetGenericParameter[] genericParameters = ((DotNetGenericParameterListOwner) resolved).getGenericParameters();
if(genericParameters.length > 0)
{
DotNetGenericExtractor genericExtractor = dotNetTypeResolveResult.getGenericExtractor();
builder.append(XmlStringUtil.escapeString("<"));
for(int i = 0; i < genericParameters.length; i++)
{
if(i != 0)
{
builder.append(", ");
}
DotNetGenericParameter parameter = genericParameters[i];
DotNetTypeRef extractedTypeRef = genericExtractor.extract(parameter);
if(extractedTypeRef != null)
{
builder.append(generateLinksForType(extractedTypeRef, element, qualified));
}
else
{
builder.append(parameter.getName());
}
}
builder.append(XmlStringUtil.escapeString(">"));
}
}
else
{
builder.append(((DotNetQualifiedElement) resolved).getName());
}
}
else
{
builder.append(CSharpTypeRefPresentationUtil.buildShortText(typeRef, element));
}
}
return builder.toString();
}