BuildModuleTranslationUnit() public static method

public static BuildModuleTranslationUnit ( string name ) : ITranslationUnit
name string
return ITranslationUnit
Example #1
0
        public string RenderSimpleEmptyClassInModule()
        {
            var translationUnit = TranslationUnitBuilder.BuildModuleTranslationUnit("MyNamespace") as ModuleTranslationUnit;

            translationUnit.AddClass("SimpleClass");

            return(translationUnit.Translate());
        }
Example #2
0
        public string RenderSimpleClassInModule()
        {
            var moduleTranslationUnit = TranslationUnitBuilder.BuildModuleTranslationUnit("MyNamespace") as ModuleTranslationUnit;

            var classTranslationUnit = moduleTranslationUnit.AddClass("MyClass", "MyBaseClass");

            var method1 = classTranslationUnit.AddMethod(null, "Method1");
            var method2 = classTranslationUnit.AddMethod("string", "Method2");
            var method3 = classTranslationUnit.AddMethod("int", "Method3");
            var method4 = classTranslationUnit.AddMethod(null, "Method4");

            method1.AddVariable(null, "var1");
            method1.AddVariable("string", "var1");
            method2.AddVariable(null, "var1");
            method1.AddVariable("int", "var2");
            method1.AddVariable("string", "var3");
            method3.AddVariable("int", "var1");
            method4.AddVariable(null, "var1");

            return(moduleTranslationUnit.Translate());
        }