/// <summary> /// Creates a <see cref="MethodDeclarationTranslationUnit"/>. /// </summary> /// <returns>A <see cref="MethodDeclarationTranslationUnit"/>.</returns> public ITranslationUnit Create() { if (this.DoNotCreateTranslationUnit) { return(null); } AnonymousMethodDeclaration helper = new AnonymousMethodDeclaration(this.Node as AnonymousMethodExpressionSyntax, this.SemanticModel); var lambdaDeclaration = LambdaTranslationUnit.Create(null); //var lambdaDeclaration = LambdaTranslationUnit.Create(TypeIdentifierTranslationUnit.Create(helper.ReturnType.FullName.MapType())); foreach (Parameter parameter in helper.Parameters) { lambdaDeclaration.AddArgument(ArgumentDefinitionTranslationUnit.Create( TypeIdentifierTranslationUnit.Create(parameter.Type.TypeSyntaxNode.MapType()), IdentifierTranslationUnit.Create(parameter.IdentifierName))); } return(lambdaDeclaration); }
/// <summary> /// Creates the translation unit. /// </summary> /// <remarks> /// Must return a type inheriting from <see cref="MethodSignatureDeclarationTranslationUnit"/>. /// </remarks> /// <param name="visibility"></param> /// <param name="returnType"></param> /// <param name="name"></param> /// <returns></returns> protected virtual ITranslationUnit CreateTranslationUnit( VisibilityToken visibility, ITranslationUnit returnType, ITranslationUnit name) { return(LambdaTranslationUnit.Create(returnType)); }