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.cc11
1 files changed, 5 insertions, 6 deletions
diff --git a/021check_instruction.cc b/021check_instruction.cc
index fc1f0a1f..15d14afc 100644
--- a/021check_instruction.cc
+++ b/021check_instruction.cc
@@ -79,17 +79,16 @@ bool types_match(reagent lhs, reagent rhs) {
   // to sidestep type-checking, use /raw in the source.
   // this is unsafe, and will be highlighted in red inside vim. just for some tests.
   if (is_raw(rhs)) return true;
-  // allow writing 0 to any address
-  if (rhs.name == "0" && is_mu_address(lhs)) return true;
-  if (is_literal(rhs)) return valid_type_for_literal(lhs) && size_of(rhs) == size_of(lhs);
+  if (is_literal(rhs)) return valid_type_for_literal(lhs, rhs) && size_of(rhs) == size_of(lhs);
   if (!lhs.type) return !rhs.type;
   return types_match(lhs.type, rhs.type);
 }
 
-bool valid_type_for_literal(const reagent& r) {
-  if (is_mu_array(r)) return false;
-  if (is_mu_address(r)) return false;
+bool valid_type_for_literal(const reagent& lhs, const reagent& literal_rhs) {
+  if (is_mu_array(lhs)) return false;
   // End valid_type_for_literal Special-cases
+  // allow writing 0 to any address
+  if (is_mu_address(lhs)) return literal_rhs.name == "0";
   return true;
 }
 
re>4c4d325c ^
a654e4ec ^
9e751bb8 ^

e5c11a51 ^
dbe12410 ^
4a39d12d ^
a654e4ec ^
e5c11a51 ^
dbe12410 ^

a654e4ec ^



e5c11a51 ^






















a654e4ec ^

dbe12410 ^
e5c11a51 ^
a654e4ec ^
204dae92 ^





9e751bb8 ^
204dae92 ^

9e751bb8 ^



204dae92 ^

9e751bb8 ^







204dae92 ^

dbe12410 ^


a654e4ec ^
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