(self)
| 101 | """Maps from messages to ids, used for de-duplication.""" |
| 102 | |
| 103 | def __init__(self): |
| 104 | # We maintain separate message ids for each type name, e.g. for AttrList, |
| 105 | # TagSpec, AttrSpec, etc., there are ids 0 - # unique message instances. |
| 106 | self.next_message_id_by_type_name_ = {} |
| 107 | # The key for this map is an instance of MessageKey. |
| 108 | self.message_id_by_message_key_ = {} |
| 109 | |
| 110 | # A bit that keeps track whether a message has been emitted or |
| 111 | # not. Strictly speaking, this bit gets flipped when the message |
| 112 | # is about to be printed - it being true will prevent that |
| 113 | # something gets printed twice. |
| 114 | self.is_printed_by_message_key_ = {} |
| 115 | |
| 116 | # References between tag specs in the .protoascii are expressed as |
| 117 | # tag spec names (see also TagSpecName), so we maintain this special |
| 118 | # case mapping to resolve them to message ids. |
| 119 | self.message_id_by_tag_spec_name_ = {} |
| 120 | |
| 121 | # References from tag specs to attr specs in the .protoascii are expressed |
| 122 | # as attr list names, so we maintain this mapping to resolve them to |
| 123 | # message ids for the generated Javascript. |
| 124 | self.message_id_by_attr_list_name_ = {} |
| 125 | |
| 126 | # Interned strings have negative IDs, starting from -1. This makes it |
| 127 | # easy to distinguish them from other message ids. In the interned_strings_ |
| 128 | # array, they can be found by calculating their index -1 - <string_id>. |
| 129 | self.interned_strings_ = [] |
| 130 | self.string_id_by_interned_string_ = {} |
| 131 | |
| 132 | def InternString(self, a_string): |
| 133 | """Interns strings to eliminate duplicates and to refer to them as numbers. |
nothing calls this directly
no outgoing calls
no test coverage detected