On 2010-03-13, at 20:47, André Bargull wrote:
> It seems the JS2Doc_Test test-case is broken. I've changed the following
> things to make it almost working again:
> - updated the expected output to the newer "except $runtime" syntax in
> JS2Doc_Test
> - added if-case for ASTVariableDeclarationList in
> "JS2Doc#collectVariableDeclarations(..)"
> - replaced loop over falseDirective children with visit call for
> falseDirective in "JS2Doc#visitIfDirective(..)"
>
> Now there's only one remaining issue for function declarations, here's an
> example:
>> identical: false
>> input: function foo () { }
>> output: <?xml version="1.0" encoding="UTF-8"?><js2doc buildoptions="debug
>> profile" runtimeoptions="dhtml swf8 swf9"><property id="prototype"
>> name="prototype"><object><property id="prototype.foo"
>> name="foo"><function/></property></object></property></js2doc>
>> expect: <?xml version="1.0" encoding="UTF-8"?><js2doc buildoptions="debug
>> profile" runtimeoptions="dhtml swf8 swf9"><property id="foo"
>> name="foo"><function/></property></js2doc>
>
> Somehow the function declaration is wrapped in a ASTModifiedDefinition, this
> causes a call to "JS2Doc#ensurePrototypeNode(..)" in
> "JS2Doc#visitMethodDeclaration(..)". The stacktrace is like:
> visitToplevelStatement(..) -> visitModifiedDefinition(..) ->
> visitMethodDeclaration(..) -> ensurePrototypeNode(..)
>
> I wonder why the compiler wraps a simple function declaration outside of a
> class in a ASTModifiedDefinition at all. It's possible to work around this
> issue in JS2Doc, but I think this could be a bug in the compiler. Any
> thoughts?
That's just the way Don wrote the parser. All function and class declarations
are always going to be wrapped in a modified definition. I don't think there's
necessarily a right or wrong way to do this. The parser definition is in
WEB-INF/lps/server/sc/src/org/openlaszlo.