本文整理汇总了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 ());
}
示例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 ());
}