File tree 1 file changed +10
-6
lines changed
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 1
1
// 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.
3
3
// See the license.txt file in the project root for more information.
4
4
5
5
using System . Diagnostics . CodeAnalysis ;
@@ -174,10 +174,14 @@ public void PushIndent(string[] lineSpecific)
174
174
175
175
public void PopIndent ( )
176
176
{
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" ) ;
179
181
}
180
182
183
+ public void ClearIndent ( ) => indents . Clear ( ) ;
184
+
181
185
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
182
186
private protected void WriteIndent ( )
183
187
{
@@ -220,12 +224,12 @@ public T Write(string? content)
220
224
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
221
225
internal T Write ( char c , int count )
222
226
{
223
- WriteIndent ( ) ;
224
-
227
+ WriteIndent ( ) ;
228
+
225
229
for ( int i = 0 ; i < count ; i ++ )
226
230
{
227
231
Writer . Write ( c ) ;
228
- }
232
+ }
229
233
230
234
return ( T ) this ;
231
235
}
You can’t perform that action at this time.
0 commit comments