BuildMethodTranslationUnit() public static method

public static BuildMethodTranslationUnit ( VisibilityToken visibility, string returnType, string name, ITranslationUnit statements = null ) : ITranslationUnit
visibility VisibilityToken
returnType string
name string
statements ITranslationUnit
return ITranslationUnit
Example #1
0
        public string RenderEmptyProtectedInternalStaticMethod()
        {
            var translationUnit = TranslationUnitBuilder.BuildMethodTranslationUnit(
                ModifierTokens.Protected | ModifierTokens.Internal | ModifierTokens.Static, null, "EmptyProtectedInternalStatic") as MethodDeclarationTranslationUnit;

            return(translationUnit.Translate());
        }
Example #2
0
        public string RenderEmptyMethodWithReturn()
        {
            ITranslationUnit translationUnit = TranslationUnitBuilder.BuildMethodTranslationUnit(
                ModifierTokens.Public, Lexems.StringType, "EmptyMethodWithReturn");

            return(translationUnit.Translate());
        }
Example #3
0
        public string RenderSimpleEmptyMethod()
        {
            ITranslationUnit translationUnit = TranslationUnitBuilder.BuildMethodTranslationUnit(
                ModifierTokens.Public, null, "SimpleEmptyMethod");

            return(translationUnit.Translate());
        }
Example #4
0
        public string RenderEmptyPublicStaticMethod()
        {
            ITranslationUnit translationUnit = TranslationUnitBuilder.BuildMethodTranslationUnit(
                ModifierTokens.Public | ModifierTokens.Static, null, "EmptyPublicStaticMethod");

            return(translationUnit.Translate());
        }
Example #5
0
        public string RenderEmptyMethodWithReturn()
        {
            ITranslationUnit translationUnit = TranslationUnitBuilder.BuildMethodTranslationUnit(
                VisibilityToken.Public, "string", "EmptyMethodWithReturn");

            return(translationUnit.Translate());
        }
Example #6
0
        public string RenderSimpleEmptyMethod()
        {
            ITranslationUnit translationUnit = TranslationUnitBuilder.BuildMethodTranslationUnit(
                VisibilityToken.Public, null, "SimpleEmptyMethod");

            return(translationUnit.Translate());
        }
Example #7
0
        public string RenderEmptyProtectedInternalStaticMethod()
        {
            var translationUnit = TranslationUnitBuilder.BuildMethodTranslationUnit(
                VisibilityToken.Protected | VisibilityToken.Internal | VisibilityToken.Static, null, "EmptyProtectedInternalStatic") as MethodDeclarationTranslationUnit;

            return(translationUnit.Translate());
        }
Example #8
0
        public string RenderEmptyMethod1Argument()
        {
            var translationUnit = TranslationUnitBuilder.BuildMethodTranslationUnit(
                ModifierTokens.Public, null, "EmptyMethod1Argument") as MethodDeclarationTranslationUnit;

            translationUnit.AddArgument(ArgumentDefinitionTranslationUnit.Create(
                                            TypeIdentifierTranslationUnit.Number, IdentifierTranslationUnit.Create("param1")));

            return(translationUnit.Translate());
        }
Example #9
0
        public string RenderEmptyMethod2Arguments()
        {
            var translationUnit = TranslationUnitBuilder.BuildMethodTranslationUnit(
                VisibilityToken.Public, null, "EmptyMethod2Arguments") as MethodDeclarationTranslationUnit;

            translationUnit.AddArgument(ArgumentDefinitionTranslationUnit.Create(
                                            TypeIdentifierTranslationUnit.Number, IdentifierTranslationUnit.Create("param1")));
            translationUnit.AddArgument(ArgumentDefinitionTranslationUnit.Create(
                                            TypeIdentifierTranslationUnit.String, IdentifierTranslationUnit.Create("param2")));

            return(translationUnit.Translate());
        }
Example #10
0
        public string RenderSimpleMethod()
        {
            ITranslationUnit translationUnit = TranslationUnitBuilder.BuildMethodTranslationUnit(
                ModifierTokens.Public,
                null,
                "SimpleMethod",
                new ITranslationUnit[] {
                TranslationUnitBuilder.BuildVariableDeclarationTranslationUnit(Lexems.NumberType, "variable1"),
                TranslationUnitBuilder.BuildVariableDeclarationTranslationUnit(Lexems.StringType, "variable2"),
                TranslationUnitBuilder.BuildVariableDeclarationTranslationUnit(null, "variable3")
            });

            return(translationUnit.Translate());
        }
Example #11
0
        public string RenderSimpleMethod()
        {
            ITranslationUnit translationUnit = TranslationUnitBuilder.BuildMethodTranslationUnit(
                VisibilityToken.Public,
                null,
                "SimpleMethod",
                new ITranslationUnit[] {
                VariableDeclarationTranslationUnit.Create(IdentifierTranslationUnit.Create("int"), IdentifierTranslationUnit.Create("variable1")),
                VariableDeclarationTranslationUnit.Create(IdentifierTranslationUnit.Create("string"), IdentifierTranslationUnit.Create("variable2")),
                VariableDeclarationTranslationUnit.Create(null, IdentifierTranslationUnit.Create("variable3"))
            });

            return(translationUnit.Translate());
        }