void block_set_evaluation_empty(Block* block, bool empty) { if (empty) set_bool(block_insert_property(block, s_EvaluationEmpty), true); else block_remove_property(block, s_EvaluationEmpty); }
void block_set_has_effects(Block* block, bool hasEffects) { if (hasEffects) set_bool(block_insert_property(block, s_HasEffects), true); else block_remove_property(block, s_HasEffects); }
void block_update_state_type(Block* block) { if (!block_state_type_is_out_of_date(block)) return; // Recreate the state type Type* type = create_compound_type(); // TODO: give this new type a nice name for (int i=0; i < block->length(); i++) { Term* term = block->get(i); if (term == NULL) continue; if (term->function != FUNCS.unpack_state || FUNCS.unpack_state == NULL) continue; Term* identifyingTerm = term->input(1); caValue* fieldName = get_unique_name(identifyingTerm); ca_assert(is_string(fieldName)); ca_assert(!string_eq(fieldName, "")); compound_type_append_field(type, declared_type(term), as_cstring(fieldName)); } block->stateType = type; block_remove_property(block, sym_DirtyStateType); // Might need to update any existing pack_state calls. block_update_pack_state_calls(block); }