public static string ObjectCreationExpression(ObjectCreationExpressionSyntax expression) { if (expression.ArgumentList != null) { //Name all the arguments, since Swift usually requires named arguments when you create new objects. //Thanks! http://stackoverflow.com/questions/24174602/get-constructor-declaration-from-objectcreationexpressionsyntax-with-roslyn/24191494#24191494 var symbol = Model.GetSymbolInfo(expression).Symbol as IMethodSymbol; var namedArgumentsList = new SeparatedSyntaxList <ArgumentSyntax>(); for (var i = 0; i < expression.ArgumentList.Arguments.Count; i++) { var oldArgumentSyntax = expression.ArgumentList.Arguments[i]; var parameterName = symbol.Parameters[i].Name; var nameColonSyntax = SyntaxFactory .NameColon(SyntaxFactory.IdentifierName(parameterName)) .WithTrailingTrivia(SyntaxFactory.Whitespace(" ")); var namedArgumentSyntax = SyntaxFactory.Argument(nameColonSyntax, oldArgumentSyntax.RefOrOutKeyword, oldArgumentSyntax.Expression); namedArgumentsList = namedArgumentsList.Add(namedArgumentSyntax); } //NOTE: this takes out expression.parent and everything, and probably screws with SyntaxModel stuff to switch (Builder.Instance.Language) { case Languages.Php: if (expression.Type.IsTypeList() || expression.Type.IsTypeDictionary()) { return($"[{namedArgumentsList.ConvertSeparatedSyntaxList()}]"); } break; case Languages.Swift: case Languages.Kotlin: case Languages.TypeScript: default: break; } return(SyntaxTokenConvert(expression.NewKeyword) + SyntaxNode(expression.Type) + SyntaxNode(SyntaxFactory.ArgumentList(namedArgumentsList))); } else { return(SyntaxNode(expression.Initializer)); } }