Examples of GoLiteralIdentifier


Examples of ro.redeul.google.go.lang.psi.expressions.literals.GoLiteralIdentifier

        if (NIL_TYPE.accepts(this))
            return PsiReference.EMPTY_ARRAY;

        GoPackage goPackage = null;
        if (findChildByType(GoTokenTypes.oDOT) != null) {
            GoLiteralIdentifier identifiers[] = findChildrenByClass(GoLiteralIdentifier.class);
            GoImportDeclaration importDeclaration = GoPsiUtils.resolveSafely(identifiers[0], GoImportDeclaration.class);
            goPackage = importDeclaration != null ? importDeclaration.getPackage() : null;
        }

        if ( goPackage != null && goPackage == GoPackages.C )
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.expressions.literals.GoLiteralIdentifier

            GoLiteralCompositeValue compositeValue = GoPsiUtils.findParentOfType(this, GoLiteralCompositeValue.class);

            if (compositeValue == null)
                return PsiReference.EMPTY_ARRAY;

            final GoLiteralIdentifier identifier = this;

            compositeValue.getType();

            GoType enclosingType = compositeValue.getType();
            List<Reference> references = enclosingType.underlyingType().accept(new UpdatingTypeVisitor<List<Reference>>() {
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.expressions.literals.GoLiteralIdentifier

            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();

                                if ((exprType.length != 1 || !(exprType[0] instanceof GoTypeConstant)))
                                    setData(new GoType[]{declaredType});

                                if (exprType.length == 1 && exprType[0] instanceof GoTypeConstant) {
                                    GoTypeConstant constant = (GoTypeConstant) exprType[0];
                                    if (declaredType != GoType.Unknown)
                                        setData(new GoType[]{GoTypes.constant(constant.getKind(), constant.getValue(), declaredType)});
                                    else
                                        setData(new GoType[]{constant});
                                }
                            }
                        }
                    }

                    @Override
                    public void visitFunctionParameter(GoFunctionParameter parameter) {
                        GoPsiType typeForBody = parameter.getTypeForBody();
                        if (typeForBody != null)
                            setData(new GoType[]{GoTypes.fromPsi(typeForBody)});
                    }

                    @Override
                    public void visitMethodReceiver(GoMethodReceiver receiver) {
                        GoPsiType type = receiver.getType();
                        if (type != null)
                            setData(new GoType[]{GoTypes.fromPsi(type)});
                    }


                    @Override
                    public void visitSwitchTypeGuard(GoSwitchTypeGuard typeGuard) {
                        GoSwitchTypeStatement switchStatement = (GoSwitchTypeStatement) typeGuard.getParent();

                        TextRange litRange = identifier.getTextRange();
                        for (GoSwitchTypeClause clause : switchStatement.getClauses()) {
                            TextRange clauseTextRange = clause.getTextRange();
                            if (clauseTextRange.contains(litRange)) {
                                setData(GoTypes.fromPsiType(clause.getTypes()));
                            }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.expressions.literals.GoLiteralIdentifier

    }

    public static GoType[] getParameterTypes(GoFunctionParameter[] params) {
        List<GoPsiType> types = new ArrayList<GoPsiType>();
        for (GoFunctionParameter result : params) {
            GoLiteralIdentifier identifiers[] = result.getIdentifiers();

            if (identifiers.length == 0 && result.getType() != null) {
                types.add(result.getType());
            } else {
                for (GoLiteralIdentifier identifier : identifiers) {
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.expressions.literals.GoLiteralIdentifier

    public String getLookupTailText() {
        StringBuilder presentationText = new StringBuilder();

        GoLiteralIdentifier[] identifiers = getIdentifiers();
        for (int i = 0; i < identifiers.length; i++) {
            GoLiteralIdentifier identifier = identifiers[i];

            presentationText.append(identifier.getName());
            if (i < identifiers.length - 1) {
                presentationText.append(",");
            }
            presentationText.append(" ");
        }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.expressions.literals.GoLiteralIdentifier

                GoTypeName methodTypeName = (GoTypeName) receiverType;

                Set<GoTypeName> receiverTypes = reference.resolveBaseReceiverTypes();

                GoLiteralIdentifier identifier = reference.getElement();
                if (identifier == null)
                    return false;

                for (GoTypeName type : receiverTypes) {
                    if ( type.getName().equals(methodTypeName.getName())) {
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.expressions.literals.GoLiteralIdentifier

    public void applyFix(@NotNull PsiElement element) {
        if (!(element instanceof GoLiteralIdentifier)) {
            return;
        }

        GoLiteralIdentifier id = (GoLiteralIdentifier) element;
        PsiElement parent = id.getParent();
        if (parent instanceof GoVarDeclaration) {
            GoVarDeclaration gsvd = (GoVarDeclaration) parent;
            removeIdentifier(id, parent, gsvd.getIdentifiers(), gsvd.getExpressions());
        } else if (parent instanceof GoConstDeclaration) {
            GoConstDeclaration gcd = (GoConstDeclaration) parent;
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.expressions.literals.GoLiteralIdentifier

        for (GoExpr expression : expressions) {
            Collections.addAll(types, expression.getType());
        }

        for (int i = 0; i < identifiers.length; i++) {
            GoLiteralIdentifier ident = identifiers[i];
            if (ident.isEquivalentTo(identifier) && types.size() > i)
                return types.get(i);
        }

        return null;
    }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.expressions.literals.GoLiteralIdentifier

//                    addTarget(declaration);
//            }
//
            @Override
            public void visitShortVarDeclaration(GoShortVarDeclaration declaration) {
                GoLiteralIdentifier ids[] = declaration.getDeclarations();
                checkIdentifiers(reference.name(), ids);
            }

            @Override
            public void visitFunctionParameter(GoFunctionParameter parameter) {
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.expressions.literals.GoLiteralIdentifier

                GoLiteralIdentifier[] identifiers = field.getIdentifiers();
                GoLiteralIdentifier[] otherIdentifiers = otherField.getIdentifiers();
                if (identifiers.length != otherIdentifiers.length)
                    return false;
                for (int j = 0; j < identifiers.length; j++) {
                    GoLiteralIdentifier identifier = identifiers[j];
                    GoLiteralIdentifier otherIdentifier = otherIdentifiers[j];
                    if (!identifier.getName().equals(otherIdentifier.getName()))
                        return false;
                    if (!field.getType().isIdentical(otherField.getType()))
                        return false;
                }
            } else {
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.