use of com.goide.psi.GoCallExpr in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoRecursiveCallMarkerProvider method collectSlowLineMarkers.
@Override
public void collectSlowLineMarkers(@NotNull List<PsiElement> elements, @NotNull Collection<LineMarkerInfo> result) {
Set<Integer> lines = ContainerUtil.newHashSet();
for (PsiElement element : elements) {
if (element instanceof GoCallExpr) {
PsiElement resolve = GoPsiImplUtil.resolveCall((GoCallExpr) element);
if (resolve instanceof GoFunctionOrMethodDeclaration) {
if (isRecursiveCall(element, (GoFunctionOrMethodDeclaration) resolve)) {
PsiDocumentManager instance = PsiDocumentManager.getInstance(element.getProject());
Document document = instance.getDocument(element.getContainingFile());
int textOffset = element.getTextOffset();
if (document == null)
continue;
int lineNumber = document.getLineNumber(textOffset);
if (!lines.contains(lineNumber)) {
result.add(new RecursiveMethodCallMarkerInfo(element));
}
lines.add(lineNumber);
}
}
}
}
}
use of com.goide.psi.GoCallExpr in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoExpressionUtilTest method doTest.
@Override
protected void doTest() {
PsiFile file = myFixture.configureByText("a.go", "package main\n func foo(i interface{}, j interface{}){}\n" + vars + "\n func _(){\n fo<caret>o(" + left + ", " + right + ")\n}");
myFixture.checkHighlighting();
GoCallExpr call = PsiTreeUtil.getParentOfType(file.findElementAt(myFixture.getCaretOffset()), GoCallExpr.class);
assert call != null;
List<GoExpression> expressions = call.getArgumentList().getExpressionList();
assertTrue(left + " should " + (ok ? "" : "not ") + "be identical " + right, ok == GoExpressionUtil.identical(expressions.get(0), expressions.get(1)));
}
use of com.goide.psi.GoCallExpr in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoFunctionArgumentUnwrapper method doUnwrap.
@Override
protected void doUnwrap(PsiElement element, Context context) throws IncorrectOperationException {
PsiElement parent = element.getParent();
GoCallExpr call = parent != null ? ObjectUtils.tryCast(parent.getParent(), GoCallExpr.class) : null;
if (call != null) {
context.extractElement(element, call);
context.delete(call);
}
}
Aggregations