Skip to content

Commit

Permalink
Attempt to fix bumptech#24
Browse files Browse the repository at this point in the history
Messages were named using their stack *depth* so 2 messages of the same
depth collided. This attempt names messages by their full scope -
avoiding collisions while hopefully not breaking other stuffs.
  • Loading branch information
schmichael committed Mar 14, 2013
1 parent 869cfd4 commit 82367aa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion palm/palmc/codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def out(s):
o.append(s)

def clean(name):
return name.split('-', 1)[1]
return name.rsplit('-', 1)[1]

def write_enum(name, spec):
out(
Expand Down
5 changes: 4 additions & 1 deletion palm/palmc/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,11 @@ def message(self, (tag, start, stop, subtags), buffer):

return cm, self.messages[cm]

def _get_message_namespace(self):
return '-'.join(m[0] for m in self.message_stack)

def message_label(self, (tag, start, stop, subtags), buffer):
self.current_message = str(len(self.message_stack)) + '-' + buffer[start:stop]
self.current_message = self._get_message_namespace() + '-' + buffer[start:stop]
if self.current_message in self.messages:
raise ProtoParseError(start, stop, buffer, "message %s already defined" % self.current_message)
self.messages[self.current_message] = {}, [] # fields, submessages
Expand Down

0 comments on commit 82367aa

Please sign in to comment.