Exemplo n.º 1
0
        private ExpressionSyntax GenerateJValueExpressionFor(ParameterDescription parameter)
        {
            var isPrimitive = JavaUtils.IsPrimitive(parameter.Type);
            ExpressionSyntax jValueParameter = SyntaxFactory.IdentifierName(isPrimitive
                ? parameter.Name
                : $"{SyntaxFactory.IdentifierName(parameter.Name)}_using");

            if (!isPrimitive)
            {
                jValueParameter = jValueParameter.MemberAccessExpression("Ptr");
            }

            return(RoslynUtils.NewExpression(
                       "JValue",
                       RoslynUtils.CollectionInitExpression(new[]
            {
                RoslynUtils.AssignmentExpression(
                    JavaUtils.GetTypeName(parameter.Type),
                    jValueParameter)
            })));
        }