Examples of GoTypeConstant


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

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

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

    @Nullable
    public static Number getNumberValueFromLiteralExpr(GoExpr expr) {
        GoType[] expressionType = expr.getType();
        if ( expressionType.length == 1 && expressionType[0] instanceof GoTypeConstant) {
            GoTypeConstant typeConstant = (GoTypeConstant) expressionType[0];
            switch (typeConstant.getKind()) {
                case Rune:
                    Character value = typeConstant.getValueAs(Character.class);
                    return value != null ? BigInteger.valueOf(value) : null;
            }

            return typeConstant.getValueAs(Number.class);
        }

        return null;
    }
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.