scan.cc: add_type: extract out add_field_types