File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 11// Copyright (c) Alexandre Mutel. All rights reserved.
2- // This file is licensed under the BSD-Clause 2 license.
2+ // This file is licensed under the BSD-Clause 2 license.
33// See the license.txt file in the project root for more information.
44
55using System . Diagnostics . CodeAnalysis ;
@@ -174,10 +174,14 @@ public void PushIndent(string[] lineSpecific)
174174
175175 public void PopIndent ( )
176176 {
177- // TODO: Check
178- indents . RemoveAt ( indents . Count - 1 ) ;
177+ if ( this . indents . Count > 0 )
178+ indents . RemoveAt ( indents . Count - 1 ) ;
179+ else
180+ throw new InvalidOperationException ( "No indent to pop" ) ;
179181 }
180182
183+ public void ClearIndent ( ) => indents . Clear ( ) ;
184+
181185 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
182186 private protected void WriteIndent ( )
183187 {
@@ -220,12 +224,12 @@ public T Write(string? content)
220224 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
221225 internal T Write ( char c , int count )
222226 {
223- WriteIndent ( ) ;
224-
227+ WriteIndent ( ) ;
228+
225229 for ( int i = 0 ; i < count ; i ++ )
226230 {
227231 Writer . Write ( c ) ;
228- }
232+ }
229233
230234 return ( T ) this ;
231235 }
You can’t perform that action at this time.
0 commit comments