public virtual S VisitIndexerDeclaration(IndexerDeclaration indexerDeclaration, T data) { return(VisitChildren(indexerDeclaration, data)); }
public override void VisitIndexerDeclaration(IndexerDeclaration indexerDeclaration) { FixAttributesAndDocComment(indexerDeclaration); ForceSpacesBefore(indexerDeclaration.LBracketToken, policy.SpaceBeforeIndexerDeclarationBracket); ForceSpacesAfter(indexerDeclaration.LBracketToken, policy.SpaceWithinIndexerDeclarationBracket); FormatArguments(indexerDeclaration); bool oneLine = false; bool fixClosingBrace = false; switch (policy.SimplePropertyFormatting) { case PropertyFormatting.AllowOneLine: bool isSimple = IsSimpleAccessor(indexerDeclaration.Getter) && IsSimpleAccessor(indexerDeclaration.Setter); int accessorLine = indexerDeclaration.RBraceToken.StartLocation.Line; if (!indexerDeclaration.Getter.IsNull && indexerDeclaration.Setter.IsNull) { accessorLine = indexerDeclaration.Getter.StartLocation.Line; } else if (indexerDeclaration.Getter.IsNull && !indexerDeclaration.Setter.IsNull) { accessorLine = indexerDeclaration.Setter.StartLocation.Line; } else { var acc = indexerDeclaration.Getter.StartLocation < indexerDeclaration.Setter.StartLocation ? indexerDeclaration.Getter : indexerDeclaration.Setter; accessorLine = acc.StartLocation.Line; } if (!isSimple || indexerDeclaration.LBraceToken.StartLocation.Line != accessorLine) { fixClosingBrace = true; FixOpenBrace(policy.PropertyBraceStyle, indexerDeclaration.LBraceToken); } else { ForceSpacesBefore(indexerDeclaration.Getter, true); ForceSpacesBefore(indexerDeclaration.Setter, true); ForceSpacesBeforeRemoveNewLines(indexerDeclaration.RBraceToken, true); oneLine = true; } break; case PropertyFormatting.ForceNewLine: fixClosingBrace = true; FixOpenBrace(policy.PropertyBraceStyle, indexerDeclaration.LBraceToken); break; case PropertyFormatting.ForceOneLine: isSimple = IsSimpleAccessor(indexerDeclaration.Getter) && IsSimpleAccessor(indexerDeclaration.Setter); if (isSimple) { int offset = this.document.GetOffset(indexerDeclaration.LBraceToken.StartLocation); int start = SearchWhitespaceStart(offset); int end = SearchWhitespaceEnd(offset); AddChange(start, offset - start, " "); AddChange(offset + 1, end - offset - 2, " "); offset = this.document.GetOffset(indexerDeclaration.RBraceToken.StartLocation); start = SearchWhitespaceStart(offset); AddChange(start, offset - start, " "); oneLine = true; } else { fixClosingBrace = true; FixOpenBrace(policy.PropertyBraceStyle, indexerDeclaration.LBraceToken); } break; } if (policy.IndentPropertyBody) { curIndent.Push(IndentType.Block); } FormatAccessor(indexerDeclaration.Getter, policy.PropertyGetBraceStyle, policy.SimpleGetBlockFormatting, oneLine); FormatAccessor(indexerDeclaration.Setter, policy.PropertySetBraceStyle, policy.SimpleSetBlockFormatting, oneLine); if (policy.IndentPropertyBody) { curIndent.Pop(); } if (fixClosingBrace) { FixClosingBrace(policy.PropertyBraceStyle, indexerDeclaration.RBraceToken); } }
public virtual S VisitIndexerDeclaration(IndexerDeclaration indexerDeclaration, T data) { throw new NotImplementedException(); }