Examples of GoPsiType


Examples of ro.redeul.google.go.lang.psi.types.GoPsiType

        assertNotNull(expression);
        assertInstanceOf(expression.getLiteral(), GoLiteralIdentifier.class);

        GoFunctionDeclaration goFunctionDeclaration = GoExpressionUtils.resolveToFunctionDeclaration(expression);
        assertNotNull(goFunctionDeclaration);
        final GoPsiType type = goFunctionDeclaration.getParameters()[1].getType();

        CommandProcessor.getInstance().executeCommand(project, new Runnable() {
            @Override
            public void run() {
                new CastTypeFix(expression, GoTypes.fromPsi(type)).invoke(project, file, editor, expression, expression);
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.types.GoPsiType

        int start = 0;
        int currentIndex = 0;
        StringBuilder sb = new StringBuilder();
        for (GoFunctionParameter fp : parameters) {
            GoLiteralIdentifier[] ids = fp.getIdentifiers();
            GoPsiType type = fp.getType();
            String variadic = fp.isVariadic() ? "..." : "";
            String typeName = variadic + String.valueOf(type != null ? type.getText() : null);
            start = sb.length();
            if (ids.length == 0) {
                sb.append(typeName).append(", ");
                if (currentIndex++ == expectedIndex) {
                    return new TextRange(start, sb.length() - 2);
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.types.GoPsiType

        }

        StringBuilder sb = new StringBuilder();
        for (GoFunctionParameter fp : parameters) {
            GoLiteralIdentifier[] ids = fp.getIdentifiers();
            GoPsiType type = fp.getType();
            String variadic = fp.isVariadic() ? "..." : "";
            String typeName = variadic + String.valueOf(type != null ? type.getText() : null);
            if (ids.length == 0) {
                sb.append(typeName).append(", ");
                continue;
            } else if (ids.length == 1) {
                sb.append(ids[0].getName()).append(" ").append(typeName).append(", ");
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.types.GoPsiType

        GoTypeSpec resolve = resolveTypeSpec((GoPsiTypeName) type);
        if (resolve == null) {
            return false;
        }

        GoPsiType typeDefinition = resolve.getType();
        if (!(typeDefinition instanceof GoPsiTypeStruct)) {
            return false;
        }

        if (struct.isEquivalentTo(typeDefinition)) {
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.types.GoPsiType

                }
            }
        }

        for (GoTypeStructAnonymousField field : struct.getAnonymousFields()) {
            GoPsiType type = field.getType();

            if (type instanceof GoPsiTypeName) {
                GoPsiTypeName typeName = (GoPsiTypeName) type;

                if (typeContainsStruct(type, struct)) {
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.types.GoPsiType

        for (GoFunctionDeclaration fd : file.getFunctions()) {
            variables.put(fd.getFunctionName(), new VariableUsage(fd));
        }

        for (GoTypeSpec spec : GoFileUtils.getTypeSpecs(file)) {
            GoPsiType type = spec.getType();
            if (type != null) {
                variables.put(type.getName(), new VariableUsage(type));
            }
        }
    }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.types.GoPsiType

    public boolean isIdentical(GoPsiType goType) {
        if (!(goType instanceof GoPsiTypeChannel))
            return false;

        GoPsiTypeChannel otherChannel = (GoPsiTypeChannel) goType;
        GoPsiType elementType = this.getElementType();
        if (elementType == null)
            return false;
        GoTypeChannel.ChannelType chanType = this.getChannelType();
        GoTypeChannel.ChannelType otherChanType = otherChannel.getChannelType();
        return (chanType == otherChanType || chanType == GoTypeChannel.ChannelType.Bidirectional) &&
                elementType.isIdentical(otherChannel.getElementType());
    }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.types.GoPsiType

                    result[0] = appendedSlice;
                    if (isCallWithVariadicParameter()){
                        result[1] = appendedSlice;
                        return result;
                    }
                    GoPsiType elem = appendedSlice.getElementType();
                    for (int i = 1; i < args.length; i++) {
                        result[i] = elem;
                    }
                    return result;
                }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.types.GoPsiType

    private GoType[] processBuiltinFunction(String functionName) {

        GoNamesCache namesCache = GoNamesCache.getInstance(getProject());

        GoExpr[] args = getArguments();
        GoPsiType typeArg = getTypeArgument();

        if (functionName.equals("new")) {
            if (typeArg != null) {
                return new GoType[]{
                        GoTypes.makePointer(typeArg)
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.types.GoPsiType

            return true;
        }
        else {
            if (goType instanceof GoPsiTypeMap || goType instanceof GoPsiTypeSlice || goType instanceof GoPsiTypeArray) {
                GoPsiType resolved = resolveToFinalType(this);
                if (resolved != null && resolved != this)
                    return resolved.isIdentical(goType);
            }
        }


        return false;
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.