Add booleans and fix semicolon shortcircuit (#1620)

This commit is contained in:
Jonathan Turner
2020-04-21 12:30:01 +12:00
committed by GitHub
parent e4fdb36511
commit 72cf57dd99
4 changed files with 26 additions and 4 deletions

View File

@ -152,6 +152,14 @@ fn evaluate_reference(name: &hir::Variable, scope: &Scope, tag: Tag) -> Result<V
hir::Variable::It(_) => Ok(scope.it.value.clone().into_value(tag)),
hir::Variable::Other(name, _) => match name {
x if x == "$nu" => crate::evaluate::variables::nu(tag),
x if x == "$true" => Ok(Value {
value: UntaggedValue::boolean(true),
tag,
}),
x if x == "$false" => Ok(Value {
value: UntaggedValue::boolean(false),
tag,
}),
x => Ok(scope
.vars
.get(x)