Examples of GoType


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

        processStruct(struct);
    }

    private void processAnonymousField(GoTypeStructAnonymousField field) {

        GoType type = GoTypes.fromPsi(field.getType());

        // we look at the field type and we dereference it once if necessary
        if (type instanceof GoTypePointer)
            type = ((GoTypePointer)type).getTargetType();

        // we should have a type name now
        if (!(type instanceof GoTypeName))
            return;

        type = type.underlyingType();
        if ( type == null || !(type instanceof GoTypeStruct))
            return;

        GoTypeStruct typeStruct = (GoTypeStruct) type;
View Full Code Here

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

                if (isReferenceTo(declaration))
                    addTarget(declaration);
            }

            boolean isReferenceTo(GoMethodDeclaration declaration) {
                GoType receiverType = GoTypes.fromPsi(declaration.getMethodReceiver().getType());

                if (receiverType instanceof GoTypePointer)
                    receiverType = ((GoTypePointer) receiverType).getTargetType();

                if (!(receiverType instanceof GoTypeName))
View Full Code Here

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

        return ServiceManager.getService(project, GoPsiManager.class);
    }

    @NotNull
    public <T extends GoPsiElement, V> GoType getOrCompute(T element, Function<T, GoType> valueCalculator) {
        GoType type = myComputedType.get(element);
//        GoType type = null;
        if (type == null) {
            RecursionGuard.StackStamp stamp = outSecondGuard.markStack();
            type = valueCalculator.fun(element);
            if ( type != null ) {
                if (stamp.mayCacheNow()) {
                    type = ConcurrencyUtil.cacheOrGet(myComputedType, element, type);
                } else {
                    final GoType alreadyInferred = myComputedType.get(element);
                    if (alreadyInferred != null) {
                        type = alreadyInferred;
                    }
                }
            }
View Full Code Here

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

        return resolveTypes();
    }

    @Override
    public boolean isConstantExpression() {
        GoType types[] = getType();

        if ( types.length == 0 )
            return false;

        for (GoType type : types) {
View Full Code Here

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

    protected GoType[] resolveTypes() {
        GoPrimaryExpression baseExpr = getBaseExpression();
        if (baseExpr == null)
            return GoType.EMPTY_ARRAY;

        GoType baseCallType[] = baseExpr.getType();

        GoType[] goTypes = GoTypes.visitFirstType(baseCallType, new TypeVisitor<GoType[]>(GoType.EMPTY_ARRAY) {

            @Override
            public GoType[] visitFunction(GoTypeFunction type) {
                return type.getResultTypes();
            }

            @Override
            public GoType[] visitName(GoTypeName type) {
                GoExpr args[] = getArguments();
                if ( args.length != 1 )
                    return new GoType[]{type};

                GoType argType[] = args[0].getType();
                if ( argType.length != 1)
                    return new GoType[] { type };

                return new GoType[]{argType[0].castAs(type)};
            }
View Full Code Here

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

//        return GoType.EMPTY_ARRAY;
    }

    private GoType[] resolveVarTypes(GoVarDeclaration parent, GoLiteralIdentifier identifier, int i) {

        GoType identifierType = parent.getIdentifierType(identifier);
        if (identifierType != null && identifierType instanceof GoTypePsiBacked) {
            GoPsiType goPsiType = GoTypeUtils.resolveToFinalType(((GoTypePsiBacked) identifierType).getPsiType());
            if (goPsiType instanceof GoPsiTypeFunction) {
                return GoUtil.getFuncCallTypes((GoPsiTypeFunction) goPsiType);
            }
        }

        GoExpr[] expressions = parent.getExpressions();
        if (expressions.length == 1 && expressions[0] instanceof GoCallOrConvExpression) {
            GoType[] types = expressions[0].getType();
            if (i < types.length) {
                GoType type = types[i];
                if (type instanceof GoTypePsiBacked) {
                    GoPsiType goPsiType = GoTypeUtils.resolveToFinalType(((GoTypePsiBacked) type).getPsiType());
                    if (goPsiType instanceof GoPsiTypeFunction) {
                        return GoUtil.getFuncCallTypes((GoPsiTypeFunction) goPsiType);
                    }
View Full Code Here

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

    public GoType getType() {
        GoLiteralCompositeValue parentValue = GoPsiUtils.findParentOfType(this, GoLiteralCompositeValue.class);
        if (parentValue == null)
            return GoType.Unknown;

        GoType parentType = parentValue.getType();

        final GoLiteralIdentifier elementKey = getKey();

        return parentType.underlyingType().accept(new TypeVisitor<GoType>(GoType.Unknown) {
            @Override
            public GoType visitArray(GoTypeArray type) {
                return type.getElementType();
            }
View Full Code Here

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

                return new GoType[]{
                        types().fromPsiType(functionDeclaration)
                };
            }
            if (target.getParent() instanceof GoVarDeclaration){
                GoType output = ((GoVarDeclaration)target.getParent()).getIdentifierType((GoLiteralIdentifier)target);
                if (output==null){
                    return GoType.EMPTY_ARRAY;
                }
                return new GoType[]{
                        output
View Full Code Here

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

        GoType[] baseTypes = baseExpression.getType();
        if (baseTypes.length == 0) {
            return PsiReference.EMPTY_ARRAY;
        }

        GoType type = baseTypes[0];

//        if (type instanceof GoTypePackage) {
//            GoPackage goPackage = ((GoTypePackage) type).getPackage();
//            return getIdentifier() != null
//                    ? new PsiReference[]{new PackageSymbolReference(getIdentifier(), goPackage)}
//                    : PsiReference.EMPTY_ARRAY;
//        }

        if (type instanceof GoTypePointer)
            type = ((GoTypePointer) type).getTargetType();

        GoType x = type.underlyingType();

//        if (x instanceof GoUnderlyingTypeInterface)
//            return new PsiReference[]{new InterfaceMethodReference(this)};

        if (x instanceof GoTypeStruct && getIdentifier() != null)
View Full Code Here

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

        expr = statement.getExpression();
        if (expr == null) return false;

        for (GoType type : expr.getType()) {
            if (type == null) continue;
            GoType underlyingType = type.underlyingType();
            return underlyingType.accept(new TypeVisitor<Boolean>(false) {
                @Override
                public Boolean visitPrimitive(GoTypePrimitive type) {
                    return type.getType() == GoTypes.Builtin.Error;
                }
            });
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.