Closed Bug 742170 Opened 9 years ago Closed 9 years ago

CGCreateInterfaceObjectsMethod should probably use CGThings for the CreateInterfaceObjects calls.

Categories

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

x86
macOS
defect

Tracking

()

RESOLVED FIXED
mozilla15

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

Instead of manually munging whitespace.
Attached patch Like so (obsolete) — Splinter Review
Assignee: nobody → bzbarsky
Attachment #613362 - Flags: review?(peterv)
Whiteboard: [need review]
Priority: -- → P2
Comment on attachment 613362 [details] [diff] [review]
Like so

Review of attachment 613362 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/bindings/Codegen.py
@@ +824,2 @@
>              if len(idsToInit) > 1:
> +                initIds = CGWrapper(initIds, pre="(", post=")", reindent=True)

I wonder if it'd make sense to add support for this to CGList (pre and post for len > 1).

@@ +863,5 @@
> +        ourList = CGList([CGGeneric(getParentProto)], "\n\n")
> +        if initIds is not None:
> +            ourList.prepend(initIds)
> +        if chrome is not None:
> +            ourList.append(chrome)

Would it make sense to make CGList skip None values?
Attachment #613362 - Flags: review?(peterv) → review+
> I wonder if it'd make sense to add support for this to CGList (pre and post for len > 1).

We'd need to add the reindent thing there too...  We could do that, I guess.  Want me to?

> Would it make sense to make CGList skip None values?

Yes, absolutely.  I'll do that instead.
Attached patch With that changeSplinter Review
Attachment #613362 - Attachment is obsolete: true
Attachment #613644 - Flags: review?(peterv)
Blocks: 742217
Comment on attachment 613644 [details] [diff] [review]
With that change

Review of attachment 613644 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/bindings/Codegen.py
@@ +251,4 @@
>      def declare(self):
> +        decl = self.child.declare()
> +        if self.reindent:
> +            decl = decl.replace("\n", "\n" + (" " * len(self.declarePre)))

Should these .rstrip(" ") to avoid trailing whitespace?
Attachment #613644 - Flags: review?(peterv) → review+
Hmm.  Long-term, we should never have trailing whitespace in cgitems, imo.

But you raise another interesting question.  We don't really want to add whitespace to blank lines.  So perhaps this should do something more like what CGIndenter does, in terms of the regexp?
> Long-term, we should never have trailing whitespace in cgitems, imo.

That includes trailing newlines, which are the case rstrip() would help with.
Per discussion with peter, I'll just smack this with stripTrailingWhitespace().
https://hg.mozilla.org/projects/birch/rev/5ccd428446a9
Flags: in-testsuite-
Whiteboard: [need review] → [need birch merge]
Target Milestone: --- → mozilla15
https://hg.mozilla.org/mozilla-central/rev/5ccd428446a9
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Whiteboard: [need birch merge]
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.