File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,15 @@ public partial class AbstractHypervisor<TSelf>
1919
2020 protected void ClearStack ( ) => _stack . Clear ( ) ;
2121
22- public Value Peek ( ) => _stack . Peek ( ) ;
23- public Value Peek ( int offset ) => _stack . Peek ( offset ) ;
22+ public Value Peek ( )
23+ => _stack . Count is 0
24+ ? Value . Null
25+ : _stack . Peek ( ) ;
26+
27+ public Value Peek ( int offset )
28+ => _stack . Count <= offset
29+ ? Value . Null
30+ : _stack . Peek ( offset ) ;
2431
2532 public bool PopBoolean ( string error )
2633 {
Original file line number Diff line number Diff line change @@ -37,4 +37,6 @@ public T Pop()
3737 public T Peek ( ) => _buffer [ _buffer . CurrentSize - 1 ] ;
3838
3939 public T Peek ( int offset ) => _buffer [ _buffer . CurrentSize - 1 - offset ] ;
40+
41+ public int Count => _buffer . CurrentSize ;
4042}
You can’t perform that action at this time.
0 commit comments