"Adam D. Ruppe" <[email protected]> wrote in message
news:[email protected]...
>
> If I add a way to instead put those var declarations in
> function scope, it is cleaner - no globals - and the same
> thing Javascript itself would do anyway!
>
>
> I'll have to redo the string buffering to make that though,
> so it will take some code to do it. Dumping it in the global
> was simple to implement with what was already there.
>
Btw, in VarDeclaration::toMicroD you're using microd_decl23 as the sink,
which results in all var declarations getting doubled. The problem with
globals not getting default initialized is here too, it's only using
explicit initializers. Something like this should work:
// set sink to be one of the normal buffers, not a tee
sink(" = ");
if (init)
init->toMicroD(sink);
else
type->defaultInit(0)->toMicroD(sink);
sink(";\n");