Examples of GoTypes


Examples of ro.redeul.google.go.lang.psi.typing.GoTypes

        return Op.None;
    }

    @Override
    protected GoType computeConstant(@NotNull GoTypeConstant left, @NotNull GoTypeConstant right) {
        GoTypes types = GoTypes.getInstance(getProject());

        if ( left.getKind() == GoTypeConstant.Kind.Boolean || right.getKind() == GoTypeConstant.Kind.Boolean)
            return GoType.Unknown;

        if ( left.getKind() == GoTypeConstant.Kind.String || right.getKind() == GoTypeConstant.Kind.String)
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.typing.GoTypes

    }

    @Override
    protected GoType computeConstant(@NotNull GoTypeConstant left, @NotNull GoTypeConstant right) {

        GoTypes types = GoTypes.getInstance(getProject());

        if ( left.getKind() == GoTypeConstant.Kind.Boolean || right.getKind() == GoTypeConstant.Kind.Boolean)
            return GoType.Unknown;

        if ( left.getKind() == GoTypeConstant.Kind.String ) {
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.typing.GoTypes

    protected GoType[] resolveTypes() {
        GoLiteral literal = getLiteral();
        if (literal == null)
            return GoType.EMPTY_ARRAY;

        final GoTypes types = getInstance(getProject());
        GoNamesCache namesCache = GoNamesCache.getInstance(getProject());

        switch (literal.getType()) {
            case Bool:
                return new GoType[]{GoTypes.constant(GoTypeConstant.Kind.Boolean, literal.getValue())};
            case Int:
                return new GoType[]{GoTypes.constant(GoTypeConstant.Kind.Integer, literal.getValue())};
            case Float:
                return new GoType[]{GoTypes.constant(GoTypeConstant.Kind.Float, literal.getValue())};
            case Char:
                return new GoType[]{GoTypes.constant(GoTypeConstant.Kind.Rune, literal.getValue())};
            case ImaginaryInt:
            case ImaginaryFloat:
                return new GoType[]{GoTypes.constant(GoTypeConstant.Kind.Complex, literal.getValue())};

            case RawString:
            case InterpretedString:
                return new GoType[]{GoTypes.constant(GoTypeConstant.Kind.String, literal.getValue())};

            case Function:
                return new GoType[]{GoTypes.fromPsi((GoLiteralFunction) literal)};

            case Identifier:
                final GoLiteralIdentifier identifier = (GoLiteralIdentifier) literal;

                if (identifier.isNil())
                    return new GoType[]{GoType.Nil};

                if (identifier.isIota())
                    return new GoType[]{GoTypes.constant(GoTypeConstant.Kind.Integer, identifier.getIotaValue())};

                GoPsiElement resolved = GoPsiUtils.resolveSafely(identifier, GoPsiElement.class);
                if (resolved == null) {
                    return GoType.EMPTY_ARRAY;
                }

                return resolved.accept(new GoElementVisitorWithData<GoType[]>(GoType.EMPTY_ARRAY) {

                    GoLiteralIdentifier resolvedIdent = null;

                    @Override
                    public void visitImportDeclaration(GoImportDeclaration declaration) {
                        setData(GoTypes.getPackageType(declaration));
                    }

                    @Override
                    public void visitFunctionDeclaration(GoFunctionDeclaration declaration) {
                        setData(new GoType[]{GoTypes.fromPsi(declaration)});
                    }

                    @Override
                    public void visitTypeSpec(GoTypeSpec typeSpec) {
                        setData(new GoType[]{GoTypes.fromPsi(typeSpec.getTypeNameDeclaration())});
                    }

                    @Override
                    public void visitLiteralIdentifier(GoLiteralIdentifier identifier) {
                        this.resolvedIdent = identifier;
                        ((GoPsiElement) identifier.getParent()).accept(this);
                    }

                    @Override
                    public void visitVarDeclaration(GoVarDeclaration declaration) {
                        if (resolvedIdent != null) {
                            GoType identifierType = declaration.getIdentifierType(resolvedIdent);

                            if (identifierType != null)
                                setData(new GoType[]{identifierType});
                        }
                    }

                    @Override
                    public void visitConstDeclaration(GoConstDeclaration declaration) {
                        if (resolvedIdent != null) {
                            GoType declaredType = types.fromPsiType(declaration.getIdentifiersType());
                            GoExpr expr = declaration.getExpression(resolvedIdent);

                            if (expr != null) {
                                GoType[] exprType = expr.getType();
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.