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)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla32

People

(Reporter: jorendorff, Assigned: jorendorff)

Details

Attachments

(3 files)

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.
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().
> 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.
Oh, I guess I was thinking of switch statements. This is trivial then.
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
Attachment #8418408 - Flags: review?(peterv)
Attachment #8418409 - Flags: review?(peterv)
Attachment #8418408 - Flags: review?(peterv) → review+
Attachment #8418409 - Flags: review?(peterv) → review+
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+
Oh, good point. I'll qfold them to land.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: