Fix T and F builtins to be values, not functions
* T and F were builtins that were created as functions. They have been changed to just be global values instead, so you don't need to suffix them with ! to get the creamy value inside. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -1,7 +1,10 @@
|
|||||||
0 [ "fail - 0 is not truthy" println! ] [ "OK" println! ] if!
|
0 [ "fail - 0 is not truthy" ] [ "OK" ] if! println!
|
||||||
1 [ "OK" println! ] [ "fail - 1 is truthy" println! ] if!
|
1 [ "OK" ] [ "fail - 1 is truthy" ] if! println!
|
||||||
1.1 [ "OK" println! ] [ "fail - 1.1 is truthy" println! ] if!
|
1.1 [ "OK" ] [ "fail - 1.1 is truthy" ] if! println!
|
||||||
0.1 [ "OK" println! ] [ "fail - 0.1 is truthy" println! ] if!
|
0.1 [ "OK" ] [ "fail - 0.1 is truthy" ] if! println!
|
||||||
-0.1 [ "OK" println! ] [ "fail - -0.1 is truthy" println! ] if!
|
-0.1 [ "OK" ] [ "fail - -0.1 is truthy" ] if! println!
|
||||||
-0.0 [ "fail - -0.0 is not truthy" println! ] [ "OK" println! ] if!
|
-0.0 [ "fail - -0.0 is not truthy" ] [ "OK" ] if! println!
|
||||||
0.0 [ "fail - 0.0 is not truthy" println! ] [ "OK" println! ] if!
|
0.0 [ "fail - 0.0 is not truthy" ] [ "OK" ] if! println!
|
||||||
|
|
||||||
|
T [ "OK" ] [ "fail - T should push True to the stack" ] if! println!
|
||||||
|
F [ "fail - F should push False to the stack" ] [ "OK" ] if! println!
|
||||||
@@ -23,15 +23,9 @@ impl MachineBuilder {
|
|||||||
panic!();
|
panic!();
|
||||||
});
|
});
|
||||||
|
|
||||||
self.register_builtin_fun("T", |machine, _| {
|
// True and false values
|
||||||
machine.stack_push(BoolObj::new(true))?;
|
self.register_global("T", BoolObj::new(true));
|
||||||
Ok(BuiltinExit::Return)
|
self.register_global("F", BoolObj::new(false));
|
||||||
});
|
|
||||||
|
|
||||||
self.register_builtin_fun("F", |machine, _| {
|
|
||||||
machine.stack_push(BoolObj::new(false))?;
|
|
||||||
Ok(BuiltinExit::Return)
|
|
||||||
});
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// if
|
// if
|
||||||
|
|||||||
Reference in New Issue
Block a user