about summary refs log tree commit diff stats
path: root/cpp/025name
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/025name')
-rw-r--r--cpp/025name21
1 files changed, 18 insertions, 3 deletions
diff --git a/cpp/025name b/cpp/025name
index f226d8e6..e3d290c3 100644
--- a/cpp/025name
+++ b/cpp/025name
@@ -42,8 +42,9 @@ void transform_names(const recipe_number r) {
       inst.ingredients[1].initialized = true;
       trace("name") << "field " << inst.ingredients[1].name << " of type " << Type[record].name << " is at offset " << inst.ingredients[1].value;
     }
-    // 2: map names to addresses
+    // 2: map names to addresses if necessary
     for (size_t in = 0; in < inst.ingredients.size(); ++in) {
+      if (is_raw(inst.ingredients[in])) continue;
 //?       cout << "ingredient " << inst.ingredients[in].name << '\n'; //? 1
       if (inst.ingredients[in].name != "default_space"
           && inst.ingredients[in].types[0]
@@ -56,8 +57,8 @@ void transform_names(const recipe_number r) {
         inst.ingredients[in].initialized = true;
       }
     }
-    // 3: replace names with addresses
     for (size_t out = 0; out < inst.products.size(); ++out) {
+      if (is_raw(inst.products[out])) continue;
 //?       cout << "product " << out << '/' << inst.products.size() << " " << inst.products[out].name << '\n'; //? 3
 //?       cout << inst.products[out].types[0] << '\n'; //? 1
       if (inst.products[out].name != "_"
@@ -94,6 +95,13 @@ int find_element_name(const type_number t, const string& name) {
   return -1;
 }
 
+bool is_raw(const reagent& r) {
+  for (size_t i = /*skip value+type*/1; i < r.properties.size(); ++i) {
+    if (r.properties[i].first == "raw") return true;
+  }
+  return false;
+}
+
 :(scenario "convert_names_passes_dummy")
 # _ is just a dummy result that never gets consumed
 recipe main [
@@ -102,7 +110,7 @@ recipe main [
 +name: assign x 1
 -name: assign _ 1
 
-//: One reserved word that we'll need later.
+//: one reserved word that we'll need later
 :(scenario "convert_names_passes_default_space")
 recipe main [
   default_space:integer, x:integer <- copy 0:literal
@@ -110,6 +118,13 @@ recipe main [
 +name: assign x 1
 -name: assign default_space 1
 
+//: an escape hatch to suppress name conversion that we'll use later
+:(scenario "convert_names_passes_raw")
+recipe main [
+  x:integer/raw <- copy 0:literal
+]
+-name: assign x 1
+
 //: update our running example record for the next test
 :(before "End Mu Types Initialization")
 Type[point].element_names.push_back("x");
;id=dc5a0acf3feea227d03a98cedf427d2aef462320'>^
f6fd7e1b ^
78357b88 ^
52e3ea8a ^
372367f5 ^
f6fd7e1b ^


52e3ea8a ^
f6fd7e1b ^




























3350c34a ^
f6fd7e1b ^
4254408a ^




f6fd7e1b ^

4254408a ^
372367f5 ^
f6fd7e1b ^


4254408a ^
3350c34a ^
f6fd7e1b ^



4254408a ^
372367f5 ^
f6fd7e1b ^


4254408a ^
3350c34a ^
f6fd7e1b ^






1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88