Exemplo n.º 1
0
        private static ITranslationUnit BuildObjectCreationExpressionTranslationUnit(ObjectCreationExpressionSyntax expression, SemanticModel semanticModel)
        {
            var helper = new ObjectCreationExpression(expression, semanticModel);

            var translationUnit = ObjectCreateExpressionTranslationUnit.Create(
                new ExpressionTranslationUnitBuilder(helper.Expression, semanticModel).Build());

            foreach (var argument in helper.Arguments)
            {
                var argumentTranslationUnit = new ExpressionTranslationUnitBuilder(argument.Expression, semanticModel).Build();
                translationUnit.AddArgument(argumentTranslationUnit);
            }

            return(translationUnit);
        }
Exemplo n.º 2
0
        private static ITranslationUnit BuildObjectCreationExpressionTranslationUnit(ObjectCreationExpressionSyntax expression, SemanticModel semanticModel)
        {
            ObjectCreationExpression helper = new ObjectCreationExpression(expression, semanticModel);

            var translationUnit = ObjectCreationExpressionTranslationUnit.Create(
                TypeIdentifierTranslationUnit.Create(helper.Type.FullName.MapType().MappedType.Translate())); // TODO: Create factory for TypeReference

            foreach (var argument in helper.Arguments)
            {
                var argumentTranslationUnit = new ExpressionTranslationUnitBuilder(argument.Expression, semanticModel).Build();

                translationUnit.AddArgument(argumentTranslationUnit);
            }

            return(translationUnit);
        }