本文整理汇总了C#中Mono.CSharp.ModuleContainer.CloseType方法的典型用法代码示例。如果您正苦于以下问题:C# ModuleContainer.CloseType方法的具体用法?C# ModuleContainer.CloseType怎么用?C# ModuleContainer.CloseType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.CSharp.ModuleContainer
的用法示例。
在下文中一共展示了ModuleContainer.CloseType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Compile
//.........这里部分代码省略.........
return false;
// System.Object was not loaded, use compiled assembly as corlib
if (loader.Corlib == null)
loader.Corlib = assembly.Builder;
loader.LoadModules (assembly, module.GlobalRootNamespace);
#else
var assembly = new AssemblyDefinitionDynamic (module, output_file_name, output_file);
module.SetDeclaringAssembly (assembly);
var importer = new ReflectionImporter (ctx.BuildinTypes);
assembly.Importer = importer;
var loader = new DynamicLoader (importer, ctx);
loader.LoadReferences (module);
ShowTime ("Imporing referenced assemblies");
if (!ctx.BuildinTypes.CheckDefinitions (module))
return false;
ShowTime ("Initializing predefined types");
if (!assembly.Create (AppDomain.CurrentDomain, AssemblyBuilderAccess.Save))
return false;
loader.LoadModules (assembly, module.GlobalRootNamespace);
#endif
module.Define ();
ShowTime ("Types definition");
if (Report.Errors > 0)
return false;
if (Report.Errors == 0 &&
RootContext.Documentation != null &&
!RootContext.Documentation.OutputDocComment (
output_file, Report))
return false;
//
// Verify using aliases now
//
NamespaceEntry.VerifyAllUsing ();
if (Report.Errors > 0){
return false;
}
assembly.Resolve ();
if (Report.Errors > 0)
return false;
//
// The code generator
//
if (timestamps)
stopwatch = Stopwatch.StartNew ();
assembly.Emit ();
ShowTime ("Resolving and emitting members blocks");
if (Report.Errors > 0){
return false;
}
module.CloseType ();
ShowTime ("Closing types");
if (timestamps)
stopwatch = Stopwatch.StartNew ();
assembly.EmbedResources ();
ShowTime ("Embedding resources");
if (Report.Errors > 0)
return false;
if (timestamps)
stopwatch = Stopwatch.StartNew ();
assembly.Save ();
#if STATIC
loader.Dispose ();
#endif
ShowTime ("Saving output assembly");
ShowTotalTime ("Total");
Timer.ShowTimers ();
return (Report.Errors == 0);
}
示例2: Compile
//.........这里部分代码省略.........
tr.Start (TimeReporter.TimerType.AssemblyBuilderSetup);
var assembly = new AssemblyDefinitionStatic (module, references_loader, output_file_name, output_file);
assembly.Create (references_loader.Domain);
tr.Stop (TimeReporter.TimerType.AssemblyBuilderSetup);
// Create compiler types first even before any referenced
// assembly is loaded to allow forward referenced types from
// loaded assembly into compiled builder to be resolved
// correctly
tr.Start (TimeReporter.TimerType.CreateTypeTotal);
module.CreateType ();
importer.AddCompiledAssembly (assembly);
tr.Stop (TimeReporter.TimerType.CreateTypeTotal);
references_loader.LoadReferences (module);
tr.Start (TimeReporter.TimerType.PredefinedTypesInit);
if (!ctx.BuildinTypes.CheckDefinitions (module))
return false;
tr.Stop (TimeReporter.TimerType.PredefinedTypesInit);
references_loader.LoadModules (assembly, module.GlobalRootNamespace);
#else
var assembly = new AssemblyDefinitionDynamic (module, output_file_name, output_file);
module.SetDeclaringAssembly (assembly);
var importer = new ReflectionImporter (module, ctx.BuildinTypes);
assembly.Importer = importer;
var loader = new DynamicLoader (importer, ctx);
loader.LoadReferences (module);
if (!ctx.BuildinTypes.CheckDefinitions (module))
return false;
if (!assembly.Create (AppDomain.CurrentDomain, AssemblyBuilderAccess.Run))
return false;
module.CreateType ();
loader.LoadModules (assembly, module.GlobalRootNamespace);
#endif
tr.Start (TimeReporter.TimerType.ModuleDefinitionTotal);
module.Define ();
tr.Stop (TimeReporter.TimerType.ModuleDefinitionTotal);
if (Report.Errors > 0)
return false;
//if (settings.Documentation != null &&
// !settings.Documentation.OutputDocComment (
// output_file, Report))
// return false;
//
// Verify using aliases now
//
tr.Start (TimeReporter.TimerType.UsingVerification);
NamespaceEntry.VerifyAllUsing ();
tr.Stop (TimeReporter.TimerType.UsingVerification);
if (Report.Errors > 0){
return false;
}
assembly.Resolve ();
if (Report.Errors > 0)
return false;
tr.Start (TimeReporter.TimerType.EmitTotal);
assembly.Emit ();
tr.Stop (TimeReporter.TimerType.EmitTotal);
if (Report.Errors > 0){
return false;
}
tr.Start (TimeReporter.TimerType.CloseTypes);
module.CloseType ();
tr.Stop (TimeReporter.TimerType.CloseTypes);
tr.Start (TimeReporter.TimerType.Resouces);
assembly.EmbedResources ();
tr.Stop (TimeReporter.TimerType.Resouces);
if (Report.Errors > 0)
return false;
assembly.Save ();
#if STATIC
references_loader.Dispose ();
#endif
tr.StopTotal ();
tr.ShowStats ();
return Report.Errors == 0;
}
示例3: Compile
//.........这里部分代码省略.........
}
//
// Load assemblies required
//
if (timestamps)
stopwatch = Stopwatch.StartNew ();
var assembly = module.MakeExecutable (output_file, output_file);
var importer = new ReflectionImporter (ctx.BuildinTypes);
assembly.Importer = importer;
var loader = new DynamicLoader (importer, ctx);
loader.LoadReferences (module);
ShowTime ("Imporing referenced assemblies");
if (!ctx.BuildinTypes.CheckDefinitions (module))
return false;
ShowTime ("Initializing predefined types");
if (!assembly.Create (AppDomain.CurrentDomain, AssemblyBuilderAccess.Save))
return false;
loader.LoadModules (assembly);
module.Define ();
ShowTime ("Types definition");
if (Report.Errors > 0)
return false;
if (Report.Errors == 0 &&
RootContext.Documentation != null &&
!RootContext.Documentation.OutputDocComment (
output_file, Report))
return false;
//
// Verify using aliases now
//
NamespaceEntry.VerifyAllUsing ();
if (Report.Errors > 0){
return false;
}
assembly.Resolve ();
if (Report.Errors > 0)
return false;
//
// The code generator
//
if (timestamps)
stopwatch = Stopwatch.StartNew ();
assembly.Emit ();
ShowTime ("Resolving and emitting members blocks");
if (Report.Errors > 0){
return false;
}
module.CloseType ();
ShowTime ("Closing types");
if (timestamps)
stopwatch = Stopwatch.StartNew ();
assembly.EmbedResources ();
ShowTime ("Embedding resources");
if (Report.Errors > 0)
return false;
if (timestamps)
stopwatch = Stopwatch.StartNew ();
assembly.Save ();
ShowTime ("Saving output assembly");
if (RootContext.GenerateDebugInfo) {
SymbolWriter.WriteSymbolFile ();
ShowTime ("Saving debug symbols");
}
ShowTotalTime ("Total");
Timer.ShowTimers ();
return (Report.Errors == 0);
}