about summary refs log tree commit diff stats
path: root/021check_instruction.cc
diff options
context:
space:
mode:
Diffstat (limited to '021check_instruction.cc')
-rw-r--r--021check_instruction.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/021check_instruction.cc b/021check_instruction.cc
index 2fdaad60..f3dd89d8 100644
--- a/021check_instruction.cc
+++ b/021check_instruction.cc
@@ -88,10 +88,27 @@ bool types_match(reagent lhs, reagent rhs) {
 // (trees perform the same check recursively on each subtree)
 bool types_match(type_tree* lhs, type_tree* rhs) {
   if (!lhs) return true;
+  if (!rhs || rhs->value == 0) {
+    if (lhs->value == Type_ordinal["array"]) return false;
+    if (lhs->value == Type_ordinal["address"]) return false;
+    return size_of(rhs) == size_of(lhs);
+  }
   if (lhs->value != rhs->value) return false;
   return types_match(lhs->left, rhs->left) && types_match(lhs->right, rhs->right);
 }
 
+// hacky version that allows 0 addresses
+bool types_match(const reagent lhs, const type_tree* rhs, const vector<double>& data) {
+  if (is_dummy(lhs)) return true;
+  if (!rhs || rhs->value == 0) {
+    if (lhs.type->value == Type_ordinal["array"]) return false;
+    if (lhs.type->value == Type_ordinal["address"]) return scalar(data) && data.at(0) == 0;
+    return size_of(rhs) == size_of(lhs);
+  }
+  if (lhs.type->value != rhs->value) return false;
+  return types_match(lhs.type->left, rhs->left) && types_match(lhs.type->right, rhs->right);
+}
+
 bool is_raw(const reagent& r) {
   return has_property(r, "raw");
 }
4eab6c90e5e6b5129e7f4a3949b86'>6fe535c ^
12fdf36 ^


60684e8 ^



77025ae ^
60684e8 ^
de8bd68 ^
12fdf36 ^
de8bd68 ^
12fdf36 ^




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