Examples of GoPsiTypeStruct


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

                      "package main\n" +
                      "type T struct {\n" +
                      "    io.Reader\n" +
                      "}"));

        GoPsiTypeStruct structType =
            getAs(GoPsiTypeStruct.class,
                  childAt(0,
                          childAt(0,
                                  file.getTypeDeclarations()
                          ).getTypeSpecs()
                  ).getType()
            );

        assertEquals(0, structType.getFields().length);
        assertEquals(1, structType.getAnonymousFields().length);


        GoTypeStructAnonymousField anonymousField =
            childAt(0, structType.getAnonymousFields());


        assertEquals("Reader", anonymousField.getFieldName());

        getAs(GoPsiTypeName.class, anonymousField.getType());
View Full Code Here

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

                      "package main\n" +
                      "type T struct {\n" +
                      "    *io.Reader\n" +
                      "}"));

        GoPsiTypeStruct structType =
            getAs(GoPsiTypeStruct.class,
                  childAt(0,
                          childAt(0,
                                  file.getTypeDeclarations()
                          ).getTypeSpecs()
                  ).getType()
            );

        assertEquals(0, structType.getFields().length);
        assertEquals(1, structType.getAnonymousFields().length);

        GoTypeStructAnonymousField field =
            childAt(0, structType.getAnonymousFields());

        assertEquals("Reader", field.getFieldName());
    }
View Full Code Here

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

        if (struct.isEquivalentTo(typeDefinition)) {
            return true;
        }

        GoPsiTypeStruct newStruct = (GoPsiTypeStruct) typeDefinition;
        for (GoTypeStructField field : newStruct.getFields()) {
//            if (typeContainsStruct(field.getType(), struct)) {
//                return true;
//            }
        }

        for (GoTypeStructAnonymousField field : newStruct.getAnonymousFields()) {
            if (typeContainsStruct(field.getType(), struct)) {
                return true;
            }
        }
        return false;
View Full Code Here

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

        if (goType instanceof GoPsiTypeName) {
            goType = resolveToFinalType(goType);
        }
        if (!(goType instanceof GoPsiTypeStruct))
            return false;
        GoPsiTypeStruct otherStruct = (GoPsiTypeStruct) goType;

        PsiElement[] allFields = getAllFields();
        PsiElement[] otherStructAllFields = otherStruct.getAllFields();


        if (allFields.length != otherStructAllFields.length)
            return false;
View Full Code Here

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

            @Override
            public GoType visitStruct(GoTypeStruct type) {
                if (elementKey == null)
                    return GoType.Unknown;

                GoPsiTypeStruct structPsi = type.getPsiType();

                for (GoTypeStructField field : structPsi.getFields()) {
                    for (GoLiteralIdentifier fieldName : field.getIdentifiers()) {
                        if (fieldName.getName().equals(elementKey.getName()))
                            return GoTypes.fromPsi(field.getType());
                    }
                }

                for (GoTypeStructAnonymousField field : structPsi.getAnonymousFields()) {
                    if (field.getFieldName().equals(elementKey.getName()))
                        return GoTypes.fromPsi(field.getType());
                }

                return GoType.Unknown;
View Full Code Here

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

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

        GoTypeStruct typeStruct = (GoTypeStruct) type;

        GoPsiTypeStruct structTypePsi = typeStruct.getPsiType();
        if (structTypePsi == null)
            return;

        processStruct(structTypePsi);
    }
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.