Examples of GoLiteralCompositeValue


Examples of ro.redeul.google.go.lang.psi.expressions.literals.composite.GoLiteralCompositeValue

        GoFile file = get(
            parse("" +
                      "package main\n" +
                      "var e = Line{key:1, 2:1)"));

        GoLiteralCompositeValue value =
            get(
                getAs(GoLiteralComposite.class,
                      castAs(GoLiteralExpression.class, 0,
                             childAt(0,
                                     childAt(0,
                                             file.getGlobalVariables()
                                     ).getDeclarations()
                             ).getExpressions()
                      ).getLiteral()
                ).getValue());

        GoLiteralCompositeElement element;
        element = childAt(0, value.getElements());

        assertEquals("key", get(element.getKey()).getName());
        get(element.getIndex());
        assertNull(element.getLiteralValue());
        assertEquals("1",
                     getAs(GoLiteralInteger.class,
                           getAs(GoLiteralExpression.class,
                                 element.getExpressionValue()
                           ).getLiteral()
                     ).getText());

        element = childAt(1, value.getElements());

        assertNull(element.getKey());
        assertEquals("2",
                     getAs(GoLiteralInteger.class,
                           getAs(GoLiteralExpression.class,
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.expressions.literals.composite.GoLiteralCompositeValue

        assertEquals("Line",
                     getAs(GoPsiTypeName.class,
                           composite.getLiteralType()
                     ).getName());

        GoLiteralCompositeValue value = get(composite.getValue());

        GoLiteralCompositeElement valueElement;
        valueElement = childAt(0, value.getElements());

        assertNull(valueElement.getKey());
        assertNull(valueElement.getIndex());
        assertNull(valueElement.getLiteralValue());

        assertEquals("origin",
                     getAs(GoLiteralIdentifier.class,
                           getAs(GoLiteralExpression.class,
                                 valueElement.getExpressionValue()
                           ).getLiteral()
                     ).getName());

        valueElement = childAt(1, value.getElements());
        assertNull(valueElement.getKey());
        assertNull(valueElement.getIndex());
        assertNull(valueElement.getLiteralValue());
        getAs(GoLiteralComposite.class,
              getAs(GoLiteralExpression.class,
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.expressions.literals.composite.GoLiteralCompositeValue

//        if (ShortVarDeclarationReference.MATCHER.accepts(this))
//            return refs(new ShortVarDeclarationReference(this));

        if (INSIDE_COMPOSITE_KEY.accepts(this)) {
            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>>() {
                                                                                   @Override
                                                                                   public void visitStruct(GoTypeStruct type, List<Reference> data, TypeVisitor<List<Reference>> visitor) {
                                                                                       data.add(new StructFieldReference(identifier, type));
                                                                                   }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.expressions.literals.composite.GoLiteralCompositeValue

            if (value != null && (value instanceof Integer || value.intValue() == value.floatValue()))
                return value.intValue();

        } else {
            // for this case [...]type{el1, el2, el3}
            GoLiteralCompositeValue compositeValue = GoPsiUtils.findChildOfClass(this.getParent(), GoLiteralCompositeValueImpl.class);
            if (compositeValue != null)
                return compositeValue.getChildren().length;
        }
        return InspectionUtil.UNKNOWN_COUNT;
    }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.expressions.literals.composite.GoLiteralCompositeValue

    }

    @NotNull
    @Override
    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
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.