@@ -35,7 +35,8 @@ impl Vm {
35
35
36
36
/// # Panics
37
37
///
38
- /// Panics if the current execution state is not [`ExecutionState::Advance`].
38
+ /// Panics if the current execution state is not
39
+ /// [`ExecutionState::Advance`].
39
40
pub fn set_execution_state ( & mut self , execution_state : ExecutionState ) {
40
41
assert_matches ! ( self . execution_state, ExecutionState :: Advance ) ;
41
42
self . execution_state = execution_state;
@@ -45,10 +46,11 @@ impl Vm {
45
46
mem:: take ( & mut self . execution_state )
46
47
}
47
48
48
- /// If the current execution state is an exception, reset it to [`ExecutionState::Advance`] and
49
- /// stash the exception value away so it may be [restored][Self::restore_hidden_exception()]
50
- /// later. If an exception has already been hidden, discard the exception value taken from the
51
- /// execution state.
49
+ /// If the current execution state is an exception, reset it to
50
+ /// [`ExecutionState::Advance`] and stash the exception value away so it
51
+ /// may be [restored][Self::restore_hidden_exception()] later. If an
52
+ /// exception has already been hidden, discard the exception value taken
53
+ /// from the execution state.
52
54
///
53
55
/// This is useful for allowing `finally` blocks to function properly.
54
56
///
@@ -102,9 +104,10 @@ impl Vm {
102
104
}
103
105
}
104
106
105
- /// If an exception was previously [hidden][Self::hide_current_exception()], restore it by
106
- /// putting it back into the execution state. If the execution state already contains an
107
- /// exception, discard the hidden exception.
107
+ /// If an exception was previously [hidden][Self::hide_current_exception()],
108
+ /// restore it by putting it back into the execution state. If the
109
+ /// execution state already contains an exception, discard the hidden
110
+ /// exception.
108
111
pub fn restore_hidden_exception ( & mut self ) {
109
112
if let Some ( exception) = self . hidden_exception . take ( ) {
110
113
if !matches ! ( self . execution_state( ) , ExecutionState :: Exception ( ..) ) {
@@ -113,8 +116,8 @@ impl Vm {
113
116
}
114
117
}
115
118
116
- /// Reset the execution state to [`ExecutionState::Advance`] if it contains an exception, and
117
- /// discard any hidden exception.
119
+ /// Reset the execution state to [`ExecutionState::Advance`] if it contains
120
+ /// an exception, and discard any hidden exception.
118
121
pub fn clear_exception ( & mut self ) -> Option < Value > {
119
122
self . hidden_exception . take ( ) ;
120
123
if matches ! ( self . execution_state( ) , ExecutionState :: Exception ( ..) ) {
@@ -131,20 +134,23 @@ impl Vm {
131
134
pub fn heap ( & self ) -> & Heap {
132
135
& self . heap
133
136
}
137
+
134
138
pub fn heap_mut ( & mut self ) -> & mut Heap {
135
139
& mut self . heap
136
140
}
137
141
138
142
pub fn runtime ( & self ) -> & Runtime {
139
143
& self . runtime
140
144
}
145
+
141
146
pub fn runtime_mut ( & mut self ) -> & mut Runtime {
142
147
& mut self . runtime
143
148
}
144
149
145
150
pub fn stack ( & self ) -> & CallStack {
146
151
& self . stack
147
152
}
153
+
148
154
pub fn stack_mut ( & mut self ) -> & mut CallStack {
149
155
& mut self . stack
150
156
}
0 commit comments