BuildVariableDeclarationTranslationUnit() public static method

public static BuildVariableDeclarationTranslationUnit ( string type, string name, ITranslationUnit expression = null ) : ITranslationUnit
type string
name string
expression ITranslationUnit
return ITranslationUnit
Example #1
0
        public string RenderSimpleConstructor()
        {
            ITranslationUnit translationUnit = TranslationUnitBuilder.BuildConstructorTranslationUnit(
                VisibilityToken.Public,
                new ITranslationUnit[] {
                TranslationUnitBuilder.BuildVariableDeclarationTranslationUnit(Lexems.NumberType, "variable1"),
                TranslationUnitBuilder.BuildVariableDeclarationTranslationUnit(Lexems.StringType, "variable2"),
                TranslationUnitBuilder.BuildVariableDeclarationTranslationUnit(null, "variable3")
            });

            return(translationUnit.Translate());
        }
Example #2
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 #3
0
        public string RenderSimpleProperty()
        {
            ITranslationUnit translationUnit = TranslationUnitBuilder.BuildPropertyTranslationUnit(
                VisibilityToken.Public,
                "int",
                "SimpleProperty",
                new ITranslationUnit[] {
                TranslationUnitBuilder.BuildVariableDeclarationTranslationUnit(Lexems.NumberType, "variable1"),
                TranslationUnitBuilder.BuildVariableDeclarationTranslationUnit(Lexems.StringType, "variable2")
            },
                new ITranslationUnit[] {
                TranslationUnitBuilder.BuildVariableDeclarationTranslationUnit(Lexems.NumberType, "variable1"),
                TranslationUnitBuilder.BuildVariableDeclarationTranslationUnit(Lexems.StringType, "variable2")
            });

            return(translationUnit.Translate());
        }