本文整理汇总了C#中FixedStatement.AddChild方法的典型用法代码示例。如果您正苦于以下问题:C# FixedStatement.AddChild方法的具体用法?C# FixedStatement.AddChild怎么用?C# FixedStatement.AddChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FixedStatement
的用法示例。
在下文中一共展示了FixedStatement.AddChild方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Visit
public override object Visit(Fixed fixedStatement)
{
var result = new FixedStatement();
var location = LocationsBag.GetLocations(fixedStatement);
result.AddChild(new CSharpTokenNode(Convert(fixedStatement.loc), FixedStatement.FixedKeywordRole), FixedStatement.FixedKeywordRole);
if (location != null)
result.AddChild(new CSharpTokenNode(Convert(location [0]), Roles.LPar), Roles.LPar);
if (fixedStatement.Variables != null) {
var blockVariableDeclaration = fixedStatement.Variables;
result.AddChild(ConvertToType(blockVariableDeclaration.TypeExpression), Roles.Type);
var varInit = new VariableInitializer();
var initLocation = LocationsBag.GetLocations(blockVariableDeclaration);
varInit.AddChild(Identifier.Create(blockVariableDeclaration.Variable.Name, Convert(blockVariableDeclaration.Variable.Location)), Roles.Identifier);
if (blockVariableDeclaration.Initializer != null) {
if (initLocation != null)
varInit.AddChild(new CSharpTokenNode(Convert(initLocation [0]), Roles.Assign), Roles.Assign);
varInit.AddChild((Expression)blockVariableDeclaration.Initializer.Accept(this), Roles.Expression);
}
result.AddChild(varInit, Roles.Variable);
if (blockVariableDeclaration.Declarators != null) {
foreach (var decl in blockVariableDeclaration.Declarators) {
var loc = LocationsBag.GetLocations(decl);
var init = new VariableInitializer();
if (loc != null && loc.Count > 0)
result.AddChild(new CSharpTokenNode(Convert(loc [0]), Roles.Comma), Roles.Comma);
init.AddChild(Identifier.Create(decl.Variable.Name, Convert(decl.Variable.Location)), Roles.Identifier);
if (decl.Initializer != null) {
if (loc != null && loc.Count > 1)
init.AddChild(new CSharpTokenNode(Convert(loc [1]), Roles.Assign), Roles.Assign);
init.AddChild((Expression)decl.Initializer.Accept(this), Roles.Expression);
}
result.AddChild(init, Roles.Variable);
}
}
}
if (location != null && location.Count > 1)
result.AddChild(new CSharpTokenNode(Convert(location [1]), Roles.RPar), Roles.RPar);
if (fixedStatement.Statement != null)
result.AddChild((Statement)fixedStatement.Statement.Accept(this), Roles.EmbeddedStatement);
return result;
}
示例2: Visit
public override object Visit (Fixed fixedStatement)
{
var result = new FixedStatement ();
var location = LocationsBag.GetLocations (fixedStatement);
result.AddChild (new CSharpTokenNode (Convert (fixedStatement.loc), "fixed".Length), FixedStatement.FixedKeywordRole);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[0]), 1), FixedStatement.Roles.LPar);
result.AddChild ((INode)fixedStatement.Type.Accept (this), FixedStatement.PointerDeclarationRole);
foreach (KeyValuePair<LocalInfo, Expression> declarator in fixedStatement.Declarators) {
result.AddChild ((INode)declarator.Value.Accept (this), FixedStatement.DeclaratorRole);
}
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), FixedStatement.Roles.RPar);
result.AddChild ((INode)fixedStatement.Statement.Accept (this), FixedStatement.Roles.EmbeddedStatement);
return result;
}
示例3: Visit
public override object Visit (Fixed fixedStatement)
{
var result = new FixedStatement ();
var location = LocationsBag.GetLocations (fixedStatement);
result.AddChild (new CSharpTokenNode (Convert (fixedStatement.loc), "fixed".Length), FixedStatement.FixedKeywordRole);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[0]), 1), FixedStatement.Roles.LPar);
if (fixedStatement.Variables != null) {
result.AddChild ((INode)fixedStatement.Variables.TypeExpression.Accept (this), UsingStatement.Roles.ReturnType);
result.AddChild (new Identifier (fixedStatement.Variables.Variable.Name, Convert (fixedStatement.Variables.Variable.Location)), UsingStatement.Roles.Identifier);
var loc = LocationsBag.GetLocations (fixedStatement.Variables);
if (loc != null)
result.AddChild (new CSharpTokenNode (Convert (loc[1]), 1), ContinueStatement.Roles.Assign);
if (fixedStatement.Variables.Initializer != null)
result.AddChild ((INode)fixedStatement.Variables.Initializer.Accept (this), UsingStatement.Roles.Initializer);
}
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), FixedStatement.Roles.RPar);
result.AddChild ((INode)fixedStatement.Statement.Accept (this), FixedStatement.Roles.EmbeddedStatement);
return result;
}