Closed
Bug 998080
Opened 11 years ago
Closed 11 years ago
Codegen.py: don't require every definition_body() to return indented code
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla32
People
(Reporter: jorendorff, Assigned: jorendorff)
Details
Attachments
(3 files)
5.87 KB,
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
20.76 KB,
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
40.31 KB,
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
In bug 986492 comment 20, peterv wrote:
> > def _define(self, fromDeclare=False):
> > + return self.definition_prologue(fromDeclare) + self.definition_body() + self.definition_epilogue()
>
> I wonder if it wouldn't make more sense to just indent
> self.definition_body() here, instead of in all the implementations.
Yes, I think so. It was a pain indenting it everywhere.
Caveat: There are few function bodies that contain goto labels, which shouldn't be indented. I think the solution for those is a heuristic hack. But that is a matter of taste.
Assignee | ||
Comment 1•11 years ago
|
||
Along the same lines: CGEventClass's three methods impl{Traverse,Unlink,Trace} all contain manual indentation, but it would be prettier for the caller to do it using fill().
![]() |
||
Comment 2•11 years ago
|
||
> There are few function bodies that contain goto labels
Code using goto in codegen will get an automatic r-. We have no such code and shouldn't be adding any.
Assignee | ||
Comment 3•11 years ago
|
||
Oh, I guess I was thinking of switch statements. This is trivial then.
Assignee | ||
Comment 4•11 years ago
|
||
In three parts. Each part focuses on a single method name, changes all implementations of that method to produce non-indented output, and changes its callers to indent instead.
Assignee: nobody → jorendorff
Assignee | ||
Comment 5•11 years ago
|
||
Assignee | ||
Comment 6•11 years ago
|
||
Attachment #8418410 -
Flags: review?(peterv)
Assignee | ||
Updated•11 years ago
|
Attachment #8418408 -
Flags: review?(peterv)
Assignee | ||
Updated•11 years ago
|
Attachment #8418409 -
Flags: review?(peterv)
Updated•11 years ago
|
Attachment #8418408 -
Flags: review?(peterv) → review+
Updated•11 years ago
|
Attachment #8418409 -
Flags: review?(peterv) → review+
Comment 7•11 years ago
|
||
Comment on attachment 8418410 [details] [diff] [review]
Part 3 - Make definition_body not indent
Review of attachment 8418410 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks for doing this! I wonder if collapsing some of these patches would allow us to preserve blame (where you're adding things and then removing them in subsequent patches).
Attachment #8418410 -
Flags: review?(peterv) → review+
Assignee | ||
Comment 8•11 years ago
|
||
Oh, good point. I'll qfold them to land.
Assignee | ||
Comment 9•11 years ago
|
||
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•