4271 - bugfix unrelated to alloc-ids

This commit is contained in:
Kartik Agaram 2018-06-25 10:59:20 -07:00
parent 129a9f71ce
commit b0631dec20
2 changed files with 18 additions and 2 deletions

View File

@ -40,9 +40,12 @@ void transform_names(const recipe_ordinal r) {
bool names_used = false;
bool numeric_locations_used = false;
map<string, int>& names = Name[r];
// store the indices 'used' so far in the map
// record the indices 'used' so far in the map
int& curr_idx = names[""];
curr_idx = 2; // reserve indices 0 and 1 for the chaining slot in a later layer
// reserve indices 0 and 1 for the chaining slot in a later layer.
// transform_names may get called multiple times in later layers, so
// curr_idx may already be set.
if (curr_idx < 2) curr_idx = 2;
for (int i = 0; i < SIZE(caller.steps); ++i) {
instruction& inst = caller.steps.at(i);
// End transform_names(inst) Special-cases

View File

@ -168,3 +168,16 @@ def main [
3:num/raw <- use-scope 1:space/raw
]
+mem: storing 34 in location 3
:(scenario recursive_transform_names)
def foo [
local-scope
x:num <- copy 0
return default-space/names:foo
]
def main [
local-scope
0:space/names:foo <- foo
x:num/space:1 <- copy 34
]
$error: 0