NOTE: The current preferred location for bug reports is the GitHub issue tracker.
Bug 660 - Add support for static inner classes to the Java-to-C++ translator
Add support for static inner classes to the Java-to-C++ translator
Status: ASSIGNED
Product: Validator.nu
Classification: Unclassified
Component: HTML parser
HEAD
All All
: P2 enhancement
Assigned To: Ben Newman
Depends on: 662
Blocks:
  Show dependency treegraph
 
Reported: 2009-10-02 03:14 CEST by Ben Newman
Modified: 2009-10-03 12:04 CEST (History)
1 user (show)

See Also:


Attachments
Patch to support translating static inner classes. (5.51 KB, patch)
2009-10-02 03:14 CEST, Ben Newman
Details
WIP-2 (8.28 KB, patch)
2009-10-03 12:04 CEST, Ben Newman
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Newman 2009-10-02 03:14:21 CEST
Created attachment 116 [details]
Patch to support translating static inner classes.

I decided to try my hand at this mostly to gain some experience with the translator, but I also believe it will prove useful for encapsulation, especially in the Tokenizer.

The trickiest part was handling HVisitor.previousVisibility correctly, so that the visibility modifiers within the inner class declaration don't affect those following the declaration.
Comment 1 Ben Newman 2009-10-03 02:18:51 CEST
Comment on attachment 116 [details]
Patch to support translating static inner classes.

This patch isn't quite right.  The method definitions in the .cpp file need the enclosing::type:: qualifiers.
Comment 2 Ben Newman 2009-10-03 12:04:16 CEST
Created attachment 118 [details]
WIP-2

Now handling inner(-inner)* classes properly, and using appropriate scope::qualifiers:: wherever these classes (or their members) are referred to.  For example, static methods calls such as Tokenizer.SomeInnerClass.create() can be translated into appropriate C++ (nsHtml5Tokenizer::nsHtml5SomeInnerClass::create()).

I feel a lot better about this patch but I'm still going to call it a work in progress because it's 2am and I've only done ad-hoc testing.