Closed Bug 933966 Opened 11 years ago Closed 11 years ago

Excessive indentation of !InternJSString in InitIds

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla28

People

(Reporter: mccr8, Assigned: mccr8)

References

(Blocks 1 open bug)

Details

(Whiteboard: [qa-])

Attachments

(1 file)

I'm not sure what this is, but the bindings generator is producing this:

  if (!InternJSString(cx, atomsCache->type_id, "type") ||
                                                                                                       !InternJSString(cx, atomsCache->streetAddress_id, "streetAddress") ||

waaaaay to much indentation on the second and subsequent lines.  This is true in ContactProperties::InitIds and ContactAddressInit::InitIds.
It didn't paste very well, but that was overly indented by about 100 characters.
The issue is that CGWrapper with reindent=True indents the second and later lines by len(self.declarePre).  But In this caller, we have:

        idinit = CGWrapper(idinit, pre="""
// Initialize these in reverse order so that any failure leaves the first one
// uninitialized.
if (""",

etc.  So declarePre is actually a multiline string, ever since that comment got added.  We should probably fix CGWrapper to only use the length of the last line of self.declarePre for the indent.
Ah, sounds easy to fix, thanks for the analysis.
Assignee: nobody → continuation
This fixes the InitIds indentation.
Attachment #826182 - Flags: review?(bzbarsky)
Comment on attachment 826182 [details] [diff] [review]
reindent by the amount in the last line

r=me.  Thank you!
Attachment #826182 - Flags: review?(bzbarsky) → review+
https://hg.mozilla.org/mozilla-central/rev/f747e2b7a784
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
Whiteboard: [qa-]
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: