当前位置: 首页>>代码示例>>C#>>正文


C# Driver.LoadReferences方法代码示例

本文整理汇总了C#中Mono.CSharp.Driver.LoadReferences方法的典型用法代码示例。如果您正苦于以下问题:C# Driver.LoadReferences方法的具体用法?C# Driver.LoadReferences怎么用?C# Driver.LoadReferences使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mono.CSharp.Driver的用法示例。


在下文中一共展示了Driver.LoadReferences方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitAndGetStartupFiles

		/// <summary>
		///   Optional initialization for the Evaluator.
		/// </summary>
		/// <remarks>
		///  Initializes the Evaluator with the command line
		///  options that would be processed by the command
		///  line compiler.  Only the first call to
		///  InitAndGetStartupFiles or Init will work, any future
		///  invocations are ignored.
		///
		///  You can safely avoid calling this method if your application
		///  does not need any of the features exposed by the command line
		///  interface.
		///
		///  This method return an array of strings that contains any
		///  files that were specified in `args'.
		/// </remarks>
		public static string [] InitAndGetStartupFiles (string [] args)
		{
			lock (evaluator_lock){
				if (inited)
					return new string [0];
				
				driver = Driver.Create (args, false, new ConsoleReportPrinter ());
				if (driver == null)
					throw new Exception ("Failed to create compiler driver with the given arguments");

				ctx = driver.ctx;

				RootContext.ToplevelTypes = new ModuleCompiled (ctx, true);
				
				driver.ProcessDefaultConfig ();

				var startup_files = new List<string> ();
				foreach (CompilationUnit file in Location.SourceFiles)
					startup_files.Add (file.Path);
				
				CompilerCallableEntryPoint.Reset ();
				RootContext.ToplevelTypes = new ModuleCompiled (ctx, true);
				var ctypes = TypeManager.InitCoreTypes ();

				ctx.MetaImporter.Initialize ();
				driver.LoadReferences ();
				TypeManager.InitCoreTypes (ctx, ctypes);
				TypeManager.InitOptionalCoreTypes (ctx);

				RootContext.EvalMode = true;
				inited = true;

				return startup_files.ToArray ();
			}
		}
开发者ID:silk,项目名称:monodevelop,代码行数:52,代码来源:eval.cs

示例2: InitAndGetStartupFiles

		/// <summary>
		///   Optional initialization for the Evaluator.
		/// </summary>
		/// <remarks>
		///  Initializes the Evaluator with the command line
		///  options that would be processed by the command
		///  line compiler.  Only the first call to
		///  InitAndGetStartupFiles or Init will work, any future
		///  invocations are ignored.
		///
		///  You can safely avoid calling this method if your application
		///  does not need any of the features exposed by the command line
		///  interface.
		///
		///  This method return an array of strings that contains any
		///  files that were specified in `args'.
		/// </remarks>
		public static string [] InitAndGetStartupFiles (string [] args)
		{
			lock (evaluator_lock){
				if (inited)
					return new string [0];
				
				driver = Driver.Create (args, false, new ConsoleReportPrinter ());
				if (driver == null)
					throw new Exception ("Failed to create compiler driver with the given arguments");

				RootContext.ToplevelTypes = new ModuleContainer (ctx, true);
				
				driver.ProcessDefaultConfig ();

				ArrayList startup_files = new ArrayList ();
				foreach (CompilationUnit file in Location.SourceFiles)
					startup_files.Add (file.Path);
				
				CompilerCallableEntryPoint.Reset ();
				RootContext.ToplevelTypes = new ModuleContainer (ctx, true);

				driver.LoadReferences ();
				RootContext.EvalMode = true;
				inited = true;

				return (string []) startup_files.ToArray (typeof (string));
			}
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:45,代码来源:eval.cs


注:本文中的Mono.CSharp.Driver.LoadReferences方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。