diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/025name | 9 | ||||
-rw-r--r-- | cpp/026new | 2 |
2 files changed, 5 insertions, 6 deletions
diff --git a/cpp/025name b/cpp/025name index 46e559a5..81ab0cc9 100644 --- a/cpp/025name +++ b/cpp/025name @@ -44,8 +44,8 @@ void transform_names(const recipe_number r) { //? cout << "ingredient " << inst.ingredients[in].name << '\n'; //? 1 if (inst.ingredients[in].name == "default-space") inst.ingredients[in].initialized = true; - if (inst.ingredients[in].name != "default-space" - && inst.ingredients[in].types[0] + if (inst.ingredients[in].types[0] // not a literal + && !inst.ingredients[in].initialized && inst.ingredients[in].name.find_first_not_of("0123456789-.") != string::npos) { if (names.find(inst.ingredients[in].name) == names.end()) { raise << "use before set: " << inst.ingredients[in].name << " in " << Recipe[r].name << '\n'; @@ -59,9 +59,8 @@ void transform_names(const recipe_number r) { //? cout << inst.products[out].types[0] << '\n'; //? 1 if (inst.products[out].name == "default-space") inst.products[out].initialized = true; - if (inst.products[out].name != "_" - && inst.products[out].name != "default-space" - && inst.products[out].types[0] + if (inst.products[out].types[0] // not a literal + && !inst.products[out].initialized && inst.products[out].name.find_first_not_of("0123456789-.") != string::npos) { if (names.find(inst.products[out].name) == names.end()) { trace("name") << "assign " << inst.products[out].name << " " << curr_idx; diff --git a/cpp/026new b/cpp/026new index 2bef48e7..9c9bbc04 100644 --- a/cpp/026new +++ b/cpp/026new @@ -30,7 +30,7 @@ if (inst.operation == Recipe_number["new"]) { //? cout << inst.ingredients[0].to_string() << '\n'; //? 1 assert(isa_literal(inst.ingredients[0])); if (inst.ingredients[0].properties[0].second[0] == "type") { - inst.ingredients[0].value = Type_number[inst.ingredients[0].name]; + inst.ingredients[0].set_value(Type_number[inst.ingredients[0].name]); } trace("new") << inst.ingredients[0].name << " -> " << inst.ingredients[0].value; } |