[qfcc] Emit only one instance per protocol per module

This is actually a double issue: when a class implementing a protocol
used the protocol in @protocol(), not only would the protocol get
emitted as part of the class data specifying that the class conforms to
the protocol, a second instance would be emitted again when @protocol()
was used. On top of that, only the instance referenced by @protocol()
would be initialized. Now, both class emission and @protocol() get their
protocol def from the same place and thus only one, properly
initialized, protocol instance is emitted.
This commit is contained in:
Bill Currie 2020-03-02 10:55:46 +09:00
parent 8021613b79
commit 9ccff74fcf

View file

@ -1667,7 +1667,7 @@ emit_protocol_list_item (def_t *def, void *data, int index)
internal_error (0, "%s: out of bounds index: %d %d",
__FUNCTION__, index, protocols->count);
}
EMIT_DEF (def->space, D_INT(def), emit_protocol (protocol));
EMIT_DEF (def->space, D_INT(def), protocol_def (protocol));
}
def_t *