Streamline code.

This commit is contained in:
Stephen Chung
2021-03-24 10:02:50 +08:00
parent 6d1700728a
commit 3d0d5d1708
10 changed files with 99 additions and 105 deletions

View File

@@ -997,11 +997,11 @@ impl Engine {
// Check if the variable is `this`
if name.as_str() == KEYWORD_THIS {
if let Some(val) = this_ptr {
return Ok(((*val).into(), *pos));
return if let Some(val) = this_ptr {
Ok(((*val).into(), *pos))
} else {
return EvalAltResult::ErrorUnboundThis(*pos).into();
}
EvalAltResult::ErrorUnboundThis(*pos).into()
};
}
// Check if it is directly indexed