Examples of GoTypeStructField


Examples of ro.redeul.google.go.lang.psi.types.struct.GoTypeStructField

        return otherNamedFieldsMap.size() == 0;
    }

    protected Map<String, GoType> getFieldTypeMap() {
        GoTypeStructField fields[] = getPsiType().getFields();

        Map<String, GoType> typeMap = new HashMap<String, GoType>();
        for (GoTypeStructField field : fields) {
            GoType type = types().fromPsiType(field.getType());
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.types.struct.GoTypeStructField

                    else
                        needsSemi = true;

                    boolean needsComma = false;
                    if (element instanceof GoTypeStructField) {
                        GoTypeStructField field = (GoTypeStructField) element;
                        for (GoLiteralIdentifier identifier : field.getIdentifiers()) {
                            if (needsComma)
                                data.append(",");
                            else
                                needsComma = true;

                            data.append(identifier.getName());
                        }

                        GoTypes.fromPsi(field.getType()).accept(visitor);

                        if (field.getTag() != null) {
                            data.append(" ").append(field.getTag());
                        }
                    } else if (element instanceof GoTypeStructAnonymousField) {
                        GoTypeStructAnonymousField field = (GoTypeStructAnonymousField) element;
                        GoTypes.fromPsi(field.getType()).accept(visitor);

                        if (field.getTag() != null) {
                            data.append(" ").append(field.getTag());
                        }
                    }
                }

                data.append("}");
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.types.struct.GoTypeStructField

            if (allFields[0] instanceof GoTypeStructField) {
                if (!(otherStructAllFields[i] instanceof GoTypeStructField)) {
                    return false;
                }

                GoTypeStructField field = (GoTypeStructField) allFields[i];
                GoTypeStructField otherField = (GoTypeStructField) otherStructAllFields[i];
                PsiElementBase tag = field.getTag();
                PsiElementBase otherTag = otherField.getTag();
                if ((tag == null && otherTag != null) || (otherTag == null && tag != null))
                    return false;
                if (tag != null && !tag.getText().equals(otherTag.getText()))
                    return false;

                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 {
                //Check anonymous fields
                if (!(otherStructAllFields[i] instanceof GoTypeStructAnonymousField))
                    return false;
                GoTypeStructAnonymousField field = (GoTypeStructAnonymousField) allFields[i];
                GoTypeStructAnonymousField otherField = (GoTypeStructAnonymousField) otherStructAllFields[i];
                if (!field.getFieldName().equals(otherField.getFieldName()))
                    return false;
                if (!field.getType().isIdentical(otherField.getType()))
                    return false;
                PsiElementBase tag = field.getTag();
                PsiElementBase otherTag = otherField.getTag();
                if ((tag == null && otherTag != null) || (otherTag == null && tag != null))
                    return false;
                if (tag != null && !tag.getText().equals(otherTag.getText()))
                    return false;
            }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.types.struct.GoTypeStructField

            };
        }

        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);
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.types.struct.GoTypeStructField

        LookupElementBuilder builder = LookupElementBuilder.create(id, name);

        GoPsiType ownerType = null;
        if (id.getParent() != null && id.getParent() instanceof GoTypeStructField) {
            GoTypeStructField structField = (GoTypeStructField) id.getParent();
            ownerType = (GoPsiType) structField.getParent();
        }

        if (ownerType == null) {
            return builder;
        }
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.