Amazing how easy that was.
This commit is contained in:
Kartik K. Agaram 2015-03-20 21:33:32 -07:00
parent 198ad74126
commit 72cc3ae158
2 changed files with 22 additions and 1 deletions

View File

@ -0,0 +1,11 @@
parse/0: instruction: 1
parse/0: ingredient: {name: "0", value: 0, type: 0, properties: [0: literal]}
parse/0: product: {name: "a", value: 0, type: 4, properties: [a: point]}
parse/0: instruction: 1
parse/0: ingredient: {name: "0", value: 0, type: 0, properties: [0: literal]}
parse/0: product: {name: "b", value: 0, type: 1, properties: [b: integer]}
name/0: assign a 1
name/0: assign b 3
after-brace/0: recipe main
after-brace/0: copy ...
after-brace/0: copy ...

View File

@ -68,7 +68,7 @@ void transform_names(const recipe_number r) {
if (names.find(inst.products[out].name) == names.end()) {
trace("name") << "assign " << inst.products[out].name << " " << curr_idx;
names[inst.products[out].name] = curr_idx;
++curr_idx;
curr_idx += size_of(inst.products[out]);
}
inst.products[out].value = names[inst.products[out].name];
inst.products[out].initialized = true;
@ -136,3 +136,13 @@ recipe main [
]
+name: field y of type point is at offset 1
+name: field x of type point is at offset 0
//: this test is actually illegal so can't call run
:(scenarios transform_test)
:(scenario "convert_names_handles_records")
recipe main [
a:point <- copy 0:literal
b:integer <- copy 0:literal
]
+name: assign a 1
+name: assign b 3