fix other mandelbrot variants
[mu.git] / archive / 1.vm / 018constant.cc
blobbbf3a4121a0162ace67786fb40018f5ddd01a8c5
1 //: A few literal constants.
3 :(before "End Mu Types Initialization")
4 put(Type_ordinal, "literal-boolean", 0);
6 //: 'true'
8 :(code)
9 void test_true() {
10 load(
11 "def main [\n"
12 " 1:boolean <- copy true\n"
13 "]\n"
15 CHECK_TRACE_CONTENTS(
16 "parse: ingredient: {true: \"literal-boolean\"}\n"
20 :(before "End Parsing reagent")
21 if (name == "true") {
22 if (type != NULL) {
23 raise << "'true' is a literal and can't take a type\n" << end();
24 return;
26 type = new type_tree("literal-boolean");
27 set_value(1);
30 //: 'false'
32 :(code)
33 void test_false() {
34 load(
35 "def main [\n"
36 " 1:boolean <- copy false\n"
37 "]\n"
39 CHECK_TRACE_CONTENTS(
40 "parse: ingredient: {false: \"literal-boolean\"}\n"
44 :(before "End Parsing reagent")
45 if (name == "false") {
46 if (type != NULL) {
47 raise << "'false' is a literal and can't take a type\n" << end();
48 return;
50 type = new type_tree("literal-boolean");
51 set_value(0);
54 //: 'null'
56 :(before "End Mu Types Initialization")
57 put(Type_ordinal, "literal-address", 0);
59 :(code)
60 void test_null() {
61 load(
62 "def main [\n"
63 " 1:address:number <- copy null\n"
64 "]\n"
66 CHECK_TRACE_CONTENTS(
67 "parse: ingredient: {null: \"literal-address\"}\n"
71 :(before "End Parsing reagent")
72 if (name == "null") {
73 if (type != NULL) {
74 raise << "'null' is a literal and can't take a type\n" << end();
75 return;
77 type = new type_tree("literal-address");
78 set_value(0);