Commit a67e8bcc authored by Boris Zbarsky's avatar Boris Zbarsky
Browse files

Bug 1531623. Fix webidl identifier conflicts involving typedefs to produce...

Bug 1531623.  Fix webidl identifier conflicts involving typedefs to produce saner exceptions.  r=qdot

Differential Revision: https://phabricator.services.mozilla.com/D21647

--HG--
extra : moz-landing-system : lando
parent eedd09df
......@@ -2789,9 +2789,11 @@ class IDLTypedefType(IDLType):
class IDLTypedef(IDLObjectWithIdentifier):
def __init__(self, location, parentScope, innerType, name):
# Set self.innerType first, because IDLObjectWithIdentifier.__init__
# will call our __str__, which wants to use it.
self.innerType = innerType
identifier = IDLUnresolvedIdentifier(location, name)
IDLObjectWithIdentifier.__init__(self, location, parentScope, identifier)
self.innerType = innerType
def __str__(self):
return "Typedef %s %s" % (self.identifier.name, self.innerType)
......
def WebIDLTest(parser, harness):
exception = None
try:
parser.parse(
"""
typedef long foo;
typedef long foo;
""")
results = parser.finish()
except Exception as e:
exception = e
harness.ok(exception, "Should have thrown.")
harness.ok("Multiple unresolvable definitions of identifier 'foo'" in str(exception),
"Should have a sane exception message")
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment