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


C# ModuleContainer.Accept方法代码示例

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


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

示例1: Simple

		public void Simple ()
		{
			//string content = @"class A { }";
			string content = @"

class Foo
{
	void Bar ()
	{
completionList.Add (""delegate"" + sb, ""md-keyword"", GettextCatalog.GetString (""Creates anonymous delegate.""), ""delegate"" + sb + "" {"" + Document.Editor.EolMarker + stateTracker.Engine.ThisLineIndent + TextEditorProperties.IndentString + ""|"" + Document.Editor.EolMarker + stateTracker.Engine.ThisLineIndent +""};"");
	}
}"
	;


			var stream = new MemoryStream (Encoding.UTF8.GetBytes (content));

			var ctx = new CompilerContext (new CompilerSettings (), new AssertReportPrinter ());

			ModuleContainer module = new ModuleContainer (ctx);
			var file = new SourceFile ("test", "asdfas", 0);
			CSharpParser parser = new CSharpParser (
				new SeekableStreamReader (stream, Encoding.UTF8),
				new CompilationSourceFile (module, file),
				ctx.Report,
				new ParserSession ());

			RootContext.ToplevelTypes = module;
			Location.Initialize (new List<SourceFile> { file });
			parser.parse ();

			Assert.AreEqual (0, ctx.Report.Errors);

			module.Accept (new TestVisitor ());
		}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:35,代码来源:ASTVisitorTest.cs

示例2: Simple

		public void Simple ()
		{
			//string content = @"class A { }";
			string content = @"

class Foo
{
	void Bar ()
	{
completionList.Add (""delegate"" + sb, ""md-keyword"", GettextCatalog.GetString (""Creates anonymous delegate.""), ""delegate"" + sb + "" {"" + Document.Editor.EolMarker + stateTracker.Engine.ThisLineIndent + TextEditorProperties.IndentString + ""|"" + Document.Editor.EolMarker + stateTracker.Engine.ThisLineIndent +""};"");
	}
}"
	;


			var stream = new MemoryStream (Encoding.UTF8.GetBytes (content));

			var ctx = new CompilerContext (new CompilerSettings (), new Report (new AssertReportPrinter ()));

			ModuleContainer module = new ModuleContainer (ctx);
			CSharpParser parser = new CSharpParser (
				new SeekableStreamReader (stream, Encoding.UTF8),
				new CompilationUnit ("name", "path", 0),
				module);

			RootContext.ToplevelTypes = module;
			Location.AddFile (ctx.Report, "asdfas");
			Location.Initialize ();
			parser.LocationsBag = new LocationsBag ();
			parser.parse ();

			var m = module.Types[0].Methods[0] as Method;
			var s = m.Block.FirstStatement;
			var o = s.loc.Column;
			

			module.Accept (new TestVisitor ());
		}
开发者ID:nlhepler,项目名称:mono,代码行数:38,代码来源:ASTVisitorTest.cs


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