/// <inheritdoc/> public override void VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration) { IType type = propertyDeclaration.ReturnType.GetResolveResult().Type; if (propertyDeclaration.Getter != null) { Formatter.AppendIndented(String.Empty); TypeVisitor.FormatTypeDelaration(type); Formatter.Append(" get_"); Formatter.Append(propertyDeclaration.NameToken.Name); Formatter.AppendLine("();"); } if (propertyDeclaration.Setter != null) { Formatter.AppendIndented("void set_"); Formatter.Append(propertyDeclaration.NameToken.Name); Formatter.Append("("); TypeVisitor.FormatTypeDelaration(type); Formatter.AppendLine(" x_value );"); } ICSharpCode.Decompiler.IL.ILFunction inst = propertyDeclaration.Getter.Annotation <ICSharpCode.Decompiler.IL.ILFunction>(); String hiddenName = MyIlVisitor.GetHiddenPropertyName(inst.Body as ICSharpCode.Decompiler.IL.BlockContainer); if (!String.IsNullOrEmpty(hiddenName)) { Formatter.AppendIndented(String.Empty); TypeVisitor.FormatTypeDelaration(type); Formatter.Append(" "); Formatter.Append(hiddenName); Formatter.AppendLine(";"); } }
private void CreateDefaultConstructor(TypeDeclaration typeDeclaration) { IType type = typeDeclaration.Annotation <TypeResolveResult>().Type; Formatter.AppendIndented(String.Empty); TypeVisitor.FormatTypeDelaration(type); Formatter.Append("(){};"); }
/// <inheritdoc/> public override void VisitMethodDeclaration(MethodDeclaration methodDeclaration) { Formatter.AppendIndented(String.Empty); WriteModifiers(methodDeclaration.ModifierTokens); IType type = methodDeclaration.ReturnType.GetResolveResult().Type; TypeVisitor.FormatTypeDelaration(type); Formatter.Append(" "); WriteMethodHeader(methodDeclaration.NameToken.Name, methodDeclaration.Parameters); if (methodDeclaration.Body.IsNull) { Formatter.Append(" = 0"); } Formatter.AppendLine(";"); }
/// <inheritdoc/> public override void VisitFieldDeclaration(FieldDeclaration fieldDeclaration) { VariableInitializer variable = fieldDeclaration.Variables.First <VariableInitializer>(); Formatter.AppendIndented(String.Empty); var sym = fieldDeclaration.GetSymbol() as IEntity; if (sym != null && sym.IsStatic) { Formatter.Append("static "); } IType type = fieldDeclaration.ReturnType.GetResolveResult().Type; TypeVisitor.FormatTypeDelaration(type); Formatter.Append(" "); WriteCommaSeparatedList(fieldDeclaration.Variables); Formatter.AppendLine(";"); }