On 18/06/2015 12:15, ISHIKAWA,chiaki wrote: > Unfortunately, it does not handle the particular coding style of > #if,#else,#endif in JavaScript source files since > use of C-style macro preprocessor is not quite standard. > > Nobody seems to have written a emacs mode for this C-style macro use in > JavaScript code. Correct me if I am wrong on this point. > (When I tried to indent some broken JavaScript source files > it could not handle #if,#else,#endif, etc. very well.) > > I wonder if there is an automatic formatter for JavaScript > that handles this particular issue of non-standard C-preprocessor usage. > > If not, we may be forced to rewrite such macro usage into > > BEFORE: > #if defined(WIN32) > blabla > #else > gazonk-foobar > #endif > > AFTER > if(C.system_win32) { > blabla > } else { > gazonk-foobar > } > > or something like that (modulo the correct positioning of "{", "}", > "else") by introducing system-wide constant that defines > system types. Run-time overhead should be minimal given the modern JS > interpreter and optimizing JIT compiler. > > Just a thought.
You can convert pre-processor directives to normal JavaScript using AppConstants.jsm Phil -- Philip Chee <phi...@aleytys.pc.my>, <philip.c...@gmail.com> http://flashblock.mozdev.org/ http://xsidebar.mozdev.org Guard us from the she-wolf and the wolf, and guard us from the thief, oh Night, and so be good for us to pass. _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform