@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;
}