+static void write_compound_type(const compound_type_t *type)
+{
+ /* first: search for a matching typedef in the global type... */
+ declaration_t *declaration = global_context->declarations;
+ while(declaration != NULL) {
+ if(! (declaration->storage_class & STORAGE_CLASS_TYPEDEF)) {
+ declaration = declaration->next;
+ continue;
+ }
+ if(declaration->type == (type_t*) type)
+ break;
+ declaration = declaration->next;
+ }
+
+ if(declaration != NULL) {
+ fprintf(out, "%s", declaration->symbol->string);
+ return;
+ }
+
+ /* does the struct have a name? */
+ if(type->symbol != NULL) {
+ /* TODO: make sure we create a struct for it... */
+ fprintf(out, "%s", type->symbol->string);
+ return;
+ }
+ /* TODO: create a struct and use its name here... */
+ fprintf(out, "/* TODO anonymous struct */byte");
+}
+
+static void write_method_type(const method_type_t *type)
+{
+ fprintf(out, "(func(");
+
+ method_parameter_type_t *parameter_type = type->parameter_types;
+ int first = 1;
+ while(parameter_type != NULL) {
+ if(!first) {
+ fprintf(out, ", ");
+ } else {
+ first = 0;
+ }
+
+ if(parameter_type->symbol != NULL) {
+ fprintf(out, "%s : ", parameter_type->symbol->string);
+ } else {
+ /* TODO make up some unused names (or allow _ in fluffy?) */
+ fprintf(out, "_ : ");
+ }
+ write_type(parameter_type->type);
+
+ parameter_type = parameter_type->next;
+ }
+
+ fprintf(out, ") : ");
+ write_type(type->result_type);
+ fprintf(out, ")");
+}
+