Closed
Bug 763724
Opened 12 years ago
Closed 12 years ago
The WebIDL parser should detect interfaces that inherit from or implement themselves
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla16
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
8.79 KB,
patch
|
justin.lebar+bug
:
review+
|
Details | Diff | Splinter Review |
Right now I think we go into an infinite loop or something. We should throw. "implements" makes this a bit of a pain, possibly.
Assignee | ||
Comment 1•12 years ago
|
||
Attachment #632893 -
Flags: review?(khuey)
Assignee | ||
Updated•12 years ago
|
Assignee: nobody → bzbarsky
Whiteboard: [need review]
Assignee | ||
Comment 2•12 years ago
|
||
Comment on attachment 632893 [details] [diff] [review] Detect cycles in the interface inheritance and implementation graph. It looks like my distinguishability-checking move depends on this. :(
Attachment #632893 -
Flags: review?(khuey) → review?(justin.lebar+bug)
Comment 3•12 years ago
|
||
>+ cycleInGraph = self.inheritsFromOrImplements(self) >+ if cycleInGraph: >+ raise WebIDLError("Interface %s has itself as ancestor or " >+ "implemented interface" % self.identifier.name, >+ self.location, >+ extraLocation=cycleInGraph.location) I'd prefer |if self.inheritsFromOrImplements(self)|, but either way is fine. >@@ -603,16 +610,31 @@ class IDLInterface(IDLObjectWithScope): > > # And now collect up the consequential interfaces of all of those > temp = set() > for iface in consequentialInterfaces: > temp |= iface.getConsequentialInterfaces() > > return consequentialInterfaces | temp > >+ def inheritsFromOrImplements(self, otherInterface): Based on its name, it seems to me that this should return a bool. Perhaps we should rename this method, or at least document the behavior. >+ if self.parent: >+ if self.parent is otherInterface: >+ return self Why |is| and not |==|?
Updated•12 years ago
|
Attachment #632893 -
Flags: review?(justin.lebar+bug) → review+
Assignee | ||
Comment 4•12 years ago
|
||
> I'd prefer |if self.inheritsFromOrImplements(self)| I can do that. > Perhaps we should rename this method, or at least document the behavior. Will try to find a better name, for sure. > Why |is| and not |==|? No reason. Can do ==.
Assignee | ||
Comment 5•12 years ago
|
||
> I can do that.
Actually, no, since I use cycleInGraph.location in the error message.
I renamed to findInterfaceLoopPoint and added some docs.
Comment 6•12 years ago
|
||
> Actually, no, since I use cycleInGraph.location in the error message.
Ah, right! Sounds like a plan.
Assignee | ||
Comment 7•12 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/5de10f87c56e
Flags: in-testsuite+
Whiteboard: [need review]
Target Milestone: --- → mozilla16
Comment 8•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/5de10f87c56e
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•