Examples of GoFunctionDeclaration


Examples of ro.redeul.google.go.lang.psi.toplevel.GoFunctionDeclaration

        return otherMethodTypes.size() == 0 ;
    }

    protected Map<String, GoType> getMethodSetTypes() {
        GoFunctionDeclaration functions[] = getPsiType().getMethodSet();

        Map<String, GoType> methodsMap = new HashMap<String, GoType>();
        for (GoFunctionDeclaration function : functions) {
            GoType methodType = types().fromPsiType(function);
            if (methodType instanceof GoTypeFunction)
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.toplevel.GoFunctionDeclaration

        return 1;
    }

    private static int getFunctionResultCount(GoCallOrConvExpression call) {
        GoFunctionDeclaration function = resolveToFunctionDeclaration(call);
        return function == null ? UNKNOWN_COUNT : getFunctionResultCount(function);
    }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.toplevel.GoFunctionDeclaration

        return count;
    }


    public static int getFunctionParameterCount(GoCallOrConvExpression call) {
        GoFunctionDeclaration function = resolveToFunctionDeclaration(call);
        if (function == null) {
            return UNKNOWN_COUNT;
        }

        int count = 0;
        for (GoFunctionParameter p : function.getParameters()) {
            count += Math.max(p.getIdentifiers().length, 1);
            if (p.isVariadic()) {
                return VARIADIC_COUNT;
            }
        }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.toplevel.GoFunctionDeclaration

        if (reference == null) {
            return processArgumentsType(this.getBaseExpression().getText());
        }

        if (reference.getParent() instanceof GoFunctionDeclaration) {
            GoFunctionDeclaration declaration =
                    (GoFunctionDeclaration) reference.getParent();

            if (BUILTIN_FUNCTION.accepts(declaration))
                return processArgumentsType(declaration.getFunctionName());
        }

        return GoPsiType.EMPTY_ARRAY;
    }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.toplevel.GoFunctionDeclaration

    }

    public static SearchScope getLocalElementSearchScope(GoPsiElement element) {
        GoStatement statement = findParentOfType(element, GoStatement.class);
        if (statement == null) {
            GoFunctionDeclaration functionDeclaration = findParentOfType(element, GoFunctionDeclaration.class);
            if (functionDeclaration != null) {
                return new LocalSearchScope(functionDeclaration);
            }
            return new LocalSearchScope(element);
        }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.toplevel.GoFunctionDeclaration

        ArrayList<String> arguments = new ArrayList<String>();
        final String fnArguments = InspectionGenFuncArgs(startElement, arguments);
        if (workingFile == null) {
            wFile = file;
            e = startElement;
            GoFunctionDeclaration fd = findParentOfType(e, GoFunctionDeclaration.class);
            while (fd instanceof GoLiteralFunction) {
                fd = findParentOfType(fd.getParent(), GoFunctionDeclaration.class);
            }


            if (fd != null) {
                insertPoint = fd.getTextRange().getEndOffset();
            } else {
                insertPoint = file.getTextRange().getEndOffset();
            }

        } else {
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.toplevel.GoFunctionDeclaration

                }
                i++;
            }
        }

        GoFunctionDeclaration functionDeclaration = GoPsiUtils.findParentOfType(element, GoFunctionDeclaration.class);
        int startOffset;
        PsiElement result = GoPsiUtils.findChildOfType(functionDeclaration, GoElementTypes.FUNCTION_RESULT);
        if (result != null) {
            startOffset = result.getTextOffset();
            doc.replaceString(startOffset, result.getTextRange().getEndOffset(),
                    i > 1 ?
                            "(" + stringBuilder.toString() + ")" : stringBuilder.toString()
            );
        } else {
            startOffset = functionDeclaration.getBlock().getTextOffset();
            doc.insertString(startOffset,
                    i > 1 ?
                            "(" + stringBuilder.toString() + ")" : stringBuilder.toString()
            );
        }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.toplevel.GoFunctionDeclaration

    }

    @NotNull
    @Override
    public Object[] getVariants() {
        GoFunctionDeclaration function = findParentOfType(getElement(),
                GoFunctionDeclaration.class);
        if (function == null) {
            return new Object[0];
        }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.toplevel.GoFunctionDeclaration

                return testConfig.executeWhat == executionMode &&
                        StringUtil.isEmptyOrSpaces(testConfig.filter);
            } else if (target instanceof GoFunctionDeclaration) {

                GoFunctionDeclaration function = (GoFunctionDeclaration) target;

                if (!StringUtil.equals(testConfig.filter, "^" + function.getFunctionName() + "$"))
                    return false;

                if (FUNCTION_TEST.accepts(target))
                    return testConfig.executeWhat == GoTestConfiguration.Type.Test;
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.toplevel.GoFunctionDeclaration

    @Override
    protected GoType[] resolveTypes() {
        PsiElement target = resolveSafely(getIdentifier(), PsiElement.class);

        if (target instanceof GoFunctionDeclaration) {
            GoFunctionDeclaration functionDeclaration = (GoFunctionDeclaration) target;
            return new GoType[]{
                    types().fromPsiType(functionDeclaration)
            };
        }

        if (target != null && target.getParent() instanceof GoTypeStructField) {

            GoTypeStructField structField = (GoTypeStructField) target.getParent();

            return new GoType[]{types().fromPsiType(structField.getType())};
        }

        if (target instanceof GoTypeStructAnonymousField) {
            GoTypeStructAnonymousField structField =
                    (GoTypeStructAnonymousField) target;

            return new GoType[]{
                    types().fromPsiType(structField.getType())
            };
        }

        if (target instanceof GoLiteralIdentifier) {
            GoFunctionDeclaration functionDeclaration = GoIdentifierUtils.getFunctionDeclaration(target);
            if (functionDeclaration != null) {
                return new GoType[]{
                        types().fromPsiType(functionDeclaration)
                };
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.