本文整理汇总了C#中VariableDeclarationStatement.GetChildrenByRole方法的典型用法代码示例。如果您正苦于以下问题:C# VariableDeclarationStatement.GetChildrenByRole方法的具体用法?C# VariableDeclarationStatement.GetChildrenByRole怎么用?C# VariableDeclarationStatement.GetChildrenByRole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VariableDeclarationStatement
的用法示例。
在下文中一共展示了VariableDeclarationStatement.GetChildrenByRole方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitVariableDeclarationStatement
public void VisitVariableDeclarationStatement(VariableDeclarationStatement variableDeclarationStatement)
{
StartNode(variableDeclarationStatement);
foreach (var v in variableDeclarationStatement.Variables) {
WriteModifiers(variableDeclarationStatement.GetChildrenByRole(VariableDeclarationStatement.ModifierRole));
WriteKeyword ("var");
v.NameToken.AcceptVisitor (this);
if (!variableDeclarationStatement.Type.IsNull) {
WriteToken (Roles.Colon);
Space ();
variableDeclarationStatement.Type.AcceptVisitor (this);
}
if (!v.Initializer.IsNull) {
Space(policy.SpaceAroundAssignment);
WriteToken(Roles.Assign);
Space(policy.SpaceAroundAssignment);
v.Initializer.AcceptVisitor(this);
}
Semicolon();
}
EndNode(variableDeclarationStatement);
}
示例2: VisitVariableDeclarationStatement
public void VisitVariableDeclarationStatement(VariableDeclarationStatement variableDeclarationStatement)
{
StartNode(variableDeclarationStatement);
WriteModifiers(variableDeclarationStatement.GetChildrenByRole(VariableDeclarationStatement.ModifierRole));
variableDeclarationStatement.Type.AcceptVisitor(this);
Space();
WriteCommaSeparatedList(variableDeclarationStatement.Variables);
Semicolon();
EndNode(variableDeclarationStatement);
}
示例3: VisitVariableDeclarationStatement
public void VisitVariableDeclarationStatement(VariableDeclarationStatement variableDeclarationStatement)
{
JsonObject statement = CreateJsonStatement(variableDeclarationStatement);
JsonValue modifier = GetModifiers(variableDeclarationStatement.GetChildrenByRole(VariableDeclarationStatement.ModifierRole));
if (modifier != null && modifier.ValueType != JsonValueType.Null)
{
statement.AddJsonValue("modifier", modifier);
}
statement.AddJsonValue("declaration-type-info", GenTypeInfo(variableDeclarationStatement.Type));
statement.AddJsonValue("variables-list", GetCommaSeparatedList(variableDeclarationStatement.Variables));
Push(statement);
}