當前位置: 首頁>>代碼示例>>Java>>正文


Java DotNetExpression類代碼示例

本文整理匯總了Java中consulo.dotnet.psi.DotNetExpression的典型用法代碼示例。如果您正苦於以下問題:Java DotNetExpression類的具體用法?Java DotNetExpression怎麽用?Java DotNetExpression使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DotNetExpression類屬於consulo.dotnet.psi包,在下文中一共展示了DotNetExpression類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: check

import consulo.dotnet.psi.DotNetExpression; //導入依賴的package包/類
@RequiredReadAction
@NotNull
@Override
public List<HighlightInfoFactory> check(@NotNull CSharpLanguageVersion languageVersion, @NotNull CSharpHighlightContext highlightContext, @NotNull CSharpIndexAccessExpressionImpl expression)
{
	DotNetExpression qualifier = expression.getQualifier();
	if(qualifier.toTypeRef(false) instanceof CSharpDynamicTypeRef)
	{
		return Collections.emptyList();
	}
	List<PsiElement> ranges = new ArrayList<>(2);
	CSharpCallArgumentList parameterList = expression.getParameterList();
	if(parameterList != null)
	{
		ContainerUtil.addIfNotNull(ranges, parameterList.getOpenElement());
		ContainerUtil.addIfNotNull(ranges, parameterList.getCloseElement());
	}

	if(ranges.isEmpty())
	{
		return Collections.emptyList();
	}
	return CC0001.checkReference(expression, ranges);
}
 
開發者ID:consulo,項目名稱:consulo-csharp,代碼行數:25,代碼來源:CC0003.java

示例2: visitBinaryExpression

import consulo.dotnet.psi.DotNetExpression; //導入依賴的package包/類
@Override
public void visitBinaryExpression(CSharpBinaryExpressionImpl expression)
{
	DotNetExpression leftExpression = expression.getLeftExpression();
	DotNetExpression rightExpression = expression.getRightExpression();
	if(leftExpression == null || rightExpression == null)
	{
		return;
	}

	Object leftValue = new ConstantExpressionEvaluator(leftExpression).getValue();
	Object rightValue = new ConstantExpressionEvaluator(rightExpression).getValue();
	if(leftValue == null || rightValue == null)
	{
		return;
	}

	myValue = OperatorEvaluator.calcBinary(expression.getOperatorElement().getOperatorElementType(), leftValue, rightValue);
}
 
開發者ID:consulo,項目名稱:consulo-csharp,代碼行數:20,代碼來源:ConstantExpressionEvaluator.java

示例3: getResult

import consulo.dotnet.psi.DotNetExpression; //導入依賴的package包/類
@Nullable
@RequiredReadAction
public DotNetExpression getResult()
{
	PsiElement[] children = getChildren();
	for(PsiElement child : children)
	{
		if(child == getCondition())
		{
			continue;
		}
		if(child instanceof DotNetExpression)
		{
			return (DotNetExpression) child;
		}
	}
	return null;
}
 
開發者ID:consulo,項目名稱:consulo-csharp,代碼行數:19,代碼來源:CSharpNullCoalescingExpressionImpl.java

示例4: checkImpl

import consulo.dotnet.psi.DotNetExpression; //導入依賴的package包/類
@RequiredReadAction
@Nullable
@Override
public HighlightInfoFactory checkImpl(@NotNull CSharpLanguageVersion languageVersion, @NotNull CSharpHighlightContext highlightContext, @NotNull CSharpOutRefWrapExpressionImpl element)
{
	DotNetExpression innerExpression = element.getInnerExpression();
	if(innerExpression instanceof CSharpIndexAccessExpressionImpl)
	{
		DotNetExpression qualifier = ((CSharpIndexAccessExpressionImpl) innerExpression).getQualifier();

		DotNetTypeRef typeRef = qualifier.toTypeRef(true);
		if(!(typeRef instanceof CSharpArrayTypeRef))
		{
			return newBuilder(innerExpression);
		}
	}
	return null;
}
 
開發者ID:consulo,項目名稱:consulo-csharp,代碼行數:19,代碼來源:CS0206.java

示例5: checkImpl

import consulo.dotnet.psi.DotNetExpression; //導入依賴的package包/類
@RequiredReadAction
@Nullable
@Override
public HighlightInfoFactory checkImpl(@NotNull CSharpLanguageVersion languageVersion, @NotNull CSharpHighlightContext highlightContext, @NotNull DotNetExpression element)
{
	if(element.getParent() instanceof CSharpSwitchStatementImpl)
	{
		DotNetTypeRef typeRef = element.toTypeRef(true);

		if(isValidTypeRef(typeRef))
		{
			return null;
		}

		return newBuilder(element, formatTypeRef(typeRef, element));
	}

	return null;
}
 
開發者ID:consulo,項目名稱:consulo-csharp,代碼行數:20,代碼來源:CS0151.java

示例6: toTypeRefImpl

import consulo.dotnet.psi.DotNetExpression; //導入依賴的package包/類
@RequiredReadAction
@NotNull
@Override
public DotNetTypeRef toTypeRefImpl(boolean resolveFromParent)
{
	DotNetExpression innerExpression = getInnerExpression();
	if(innerExpression == null)
	{
		return DotNetTypeRef.ERROR_TYPE;
	}

	DotNetTypeRef typeRef = innerExpression.toTypeRef(resolveFromParent);
	PsiElement startElement = getStartElement();
	CSharpRefTypeRef.Type type = CSharpRefTypeRef.Type.ref;
	if(startElement.getNode().getElementType() == CSharpTokens.OUT_KEYWORD)
	{
		type = CSharpRefTypeRef.Type.out;
	}
	return new CSharpRefTypeRef(getProject(), type, typeRef);
}
 
開發者ID:consulo,項目名稱:consulo-csharp,代碼行數:21,代碼來源:CSharpOutRefWrapExpressionImpl.java

示例7: isApplicable

import consulo.dotnet.psi.DotNetExpression; //導入依賴的package包/類
@Override
@RequiredReadAction
public boolean isApplicable(@NotNull PsiElement context, @NotNull Document copyDocument, int newOffset)
{
	DotNetExpression expression = PsiTreeUtil.getParentOfType(context, DotNetExpression.class);
	if(expression == null)
	{
		return false;
	}
	PsiElement parent = expression.getParent();
	if(parent instanceof CSharpNamespaceDeclaration || parent instanceof CSharpUsingListChild)
	{
		return false;
	}
	if(expression instanceof CSharpReferenceExpression && ((CSharpReferenceExpression) expression).kind() ==  CSharpReferenceExpression.ResolveToKind.THIS)
	{
		return false;
	}
	return true;
}
 
開發者ID:consulo,項目名稱:consulo-csharp,代碼行數:21,代碼來源:CSharpParenthesesPostfixTemplate.java

示例8: checkImpl

import consulo.dotnet.psi.DotNetExpression; //導入依賴的package包/類
@RequiredReadAction
@Nullable
@Override
public HighlightInfoFactory checkImpl(@NotNull CSharpLanguageVersion languageVersion, @NotNull CSharpHighlightContext highlightContext, @NotNull DotNetParameter element)
{
	DotNetExpression initializer = element.getInitializer();
	if(initializer == null)
	{
		return null;
	}

	if(!CSharpConstantUtil.isCompileTimeConstant(initializer))
	{
		String name = element.getName();
		if(name == null)
		{
			return null;
		}
		return newBuilder(getNameIdentifier(element), name);
	}

	return null;
}
 
開發者ID:consulo,項目名稱:consulo-csharp,代碼行數:24,代碼來源:CS1736.java

示例9: invoke

import consulo.dotnet.psi.DotNetExpression; //導入依賴的package包/類
@Override
@RequiredWriteAction
public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException
{
	DotNetVariable element = myPointer.getElement();
	if(element == null)
	{
		return;
	}
	PsiDocumentManager.getInstance(project).commitAllDocuments();

	DotNetExpression initializer = element.getInitializer();
	if(initializer == null)
	{
		return;
	}

	initializer.delete();

	ASTNode node = element.getNode();
	ASTNode childByType = node.findChildByType(CSharpTokenSets.EQ);
	if(childByType != null)
	{
		node.removeChild(childByType);
	}
}
 
開發者ID:consulo,項目名稱:consulo-csharp,代碼行數:27,代碼來源:RemoveVariableInitializer.java

示例10: resolve

import consulo.dotnet.psi.DotNetExpression; //導入依賴的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);
}
 
開發者ID:consulo,項目名稱:consulo-csharp,代碼行數:21,代碼來源:CSharpIndexAccessExpressionImpl.java

示例11: checkImpl

import consulo.dotnet.psi.DotNetExpression; //導入依賴的package包/類
@RequiredReadAction
@Nullable
@Override
public HighlightInfoFactory checkImpl(@NotNull CSharpLanguageVersion languageVersion, @NotNull CSharpHighlightContext highlightContext, @NotNull CSharpLocalVariable localVariable)
{
	DotNetTypeRef dotNetTypeRef = localVariable.toTypeRef(false);
	if(dotNetTypeRef == DotNetTypeRef.AUTO_TYPE)
	{
		DotNetExpression initializer = localVariable.getInitializer();
		if(initializer == null)
		{
			return null;
		}
		if(CS0023.isNullConstant(initializer))
		{
			return newBuilder(localVariable.getInitializer(), "null");
		}
		DotNetTypeRef initializerType = initializer.toTypeRef(false);
		DotNetTypeResolveResult typeResolveResult = initializerType.resolve();
		if(typeResolveResult instanceof CSharpLambdaResolveResult && ((CSharpLambdaResolveResult) typeResolveResult).getTarget() == null)
		{
			return newBuilder(localVariable.getInitializer(), "anonymous method");
		}
	}
	return null;
}
 
開發者ID:consulo,項目名稱:consulo-csharp,代碼行數:27,代碼來源:CS0815.java

示例12: getCallArguments

import consulo.dotnet.psi.DotNetExpression; //導入依賴的package包/類
@NotNull
public CSharpCallArgument[] getCallArguments(DotNetTypeRef originalTypeRef, DotNetExpression wrapExpression, DotNetTypeRef toTypeRef)
{
	DotNetExpression[] parameterExpressions = getParameterExpressions();
	CSharpCallArgument[] array = new CSharpCallArgument[parameterExpressions.length];
	for(int i = 0; i < parameterExpressions.length; i++)
	{
		DotNetExpression parameterExpression = parameterExpressions[i];
		if(parameterExpression == wrapExpression)
		{
			ImplicitOperatorArgumentAsCallArgumentWrapper wrapper = new ImplicitOperatorArgumentAsCallArgumentWrapper(wrapExpression, toTypeRef);

			wrapper.putUserData(ImplicitCastInfo.IMPLICIT_CAST_INFO, new ImplicitCastInfo(originalTypeRef, toTypeRef));
			array[i] = wrapper;
		}
		else
		{
			array[i] = new CSharpLightCallArgument(parameterExpression);
		}
	}
	return array;
}
 
開發者ID:consulo,項目名稱:consulo-csharp,代碼行數:23,代碼來源:CSharpOperatorReferenceImpl.java

示例13: pushNArguments

import consulo.dotnet.psi.DotNetExpression; //導入依賴的package包/類
@RequiredReadAction
private void pushNArguments(MethodResolveResult resolveResult)
{
	List<NCallArgument> arguments = resolveResult.getCalcResult().getArguments();
	for(NCallArgument argument : arguments)
	{
		CSharpCallArgument callArgument = argument.getCallArgument();
		if(callArgument == null)
		{
			cantEvaluateExpression();
		}
		DotNetExpression argumentExpression = callArgument.getArgumentExpression();
		if(argumentExpression == null)
		{
			cantEvaluateExpression();
		}

		argumentExpression.accept(this);
	}
}
 
開發者ID:consulo,項目名稱:consulo-csharp,代碼行數:21,代碼來源:CSharpExpressionEvaluator.java

示例14: expand

import consulo.dotnet.psi.DotNetExpression; //導入依賴的package包/類
@Override
public void expand(@NotNull PsiElement context, @NotNull Editor editor)
{
	DotNetExpression newExpression = CSharpFileFactory.createExpression(context.getProject(), "(" + context.getText() + ")");

	context.replace(newExpression);
}
 
開發者ID:consulo,項目名稱:consulo-csharp,代碼行數:8,代碼來源:CSharpParenthesesPostfixTemplate.java

示例15: checkImpl

import consulo.dotnet.psi.DotNetExpression; //導入依賴的package包/類
@RequiredReadAction
@Nullable
@Override
public HighlightInfoFactory checkImpl(@NotNull CSharpLanguageVersion languageVersion, @NotNull CSharpHighlightContext highlightContext, @NotNull CSharpOutRefWrapExpressionImpl element)
{
	DotNetExpression innerExpression = element.getInnerExpression();
	if(innerExpression == null || innerExpression instanceof CSharpIndexAccessExpressionImpl)  // ignore index access see CS0206
	{
		return null;
	}

	if(!(innerExpression instanceof CSharpReferenceExpression))
	{
		return newBuilder(innerExpression);
	}

	PsiElement psiElement = ((CSharpReferenceExpression) innerExpression).resolve();
	// reference already highlighted by error
	if(psiElement == null)
	{
		return null;
	}
	if(!(psiElement instanceof DotNetVariable) || ((DotNetVariable) psiElement).isConstant() || ((DotNetVariable) psiElement).hasModifier(CSharpModifier.READONLY))
	{
		return newBuilder(innerExpression);
	}
	return null;
}
 
開發者ID:consulo,項目名稱:consulo-csharp,代碼行數:29,代碼來源:CS1510.java


注:本文中的consulo.dotnet.psi.DotNetExpression類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。