本文整理汇总了C#中ICSharpCode.NRefactory.Ast.GetTypeForField方法的典型用法代码示例。如果您正苦于以下问题:C# Ast.GetTypeForField方法的具体用法?C# Ast.GetTypeForField怎么用?C# Ast.GetTypeForField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICSharpCode.NRefactory.Ast
的用法示例。
在下文中一共展示了Ast.GetTypeForField方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitFieldDeclaration
public override object VisitFieldDeclaration(NRefactoryAST.FieldDeclaration fieldDeclaration, object data)
{
DomRegion region = GetRegion(fieldDeclaration.StartLocation, fieldDeclaration.EndLocation);
DefaultClass c = GetCurrentClass();
ModifierEnum modifier = ConvertModifier(fieldDeclaration.Modifier,
(c.ClassType == ClassType.Struct && this.IsVisualBasic)
? ModifierEnum.Public : ModifierEnum.Private);
string doku = GetDocumentation(region.BeginLine, fieldDeclaration.Attributes);
if (currentClass.Count > 0) {
for (int i = 0; i < fieldDeclaration.Fields.Count; ++i) {
NRefactoryAST.VariableDeclaration field = (NRefactoryAST.VariableDeclaration)fieldDeclaration.Fields[i];
IReturnType retType;
if (c.ClassType == ClassType.Enum) {
retType = c.DefaultReturnType;
} else {
retType = CreateReturnType(fieldDeclaration.GetTypeForField(i));
if (!field.FixedArrayInitialization.IsNull)
retType = new ArrayReturnType(cu.ProjectContent, retType, 1);
}
DefaultField f = new DefaultField(retType, field.Name, modifier, region, c);
ConvertAttributes(fieldDeclaration, f);
f.Documentation = doku;
if (c.ClassType == ClassType.Enum) {
f.Modifiers = ModifierEnum.Const | ModifierEnum.Public;
}
c.Fields.Add(f);
mapField(fieldDeclaration, f);
}
}
return null;
}