On 2010-03-14, at 11:25, André Bargull wrote:

> 
> On 3/14/2010 3:05 PM, P T Withington wrote:
>> On 2010-03-13, at 20:47, André Bargull wrote:
>> 
>> 
[...]
>>> 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.
> 
> 
> I still think it's a bug, global function declarations must not have one of 
> these modifiers: static/final/override or a namespace.
> Here's a simple test-case which works in swf8 and dhtml because all modifiers 
> are removed, but fails to compile for swf10.
> 
> ---
> <canvas debug="true">
>    <script when="immediate"><![CDATA[
>        // illegal namespace and override modifier
>        public override function bla () {
>            Debug.write("called bla");
>        }
>        // invalid namespace modifier
>        public function blubb () {
>            Debug.write("called blubb");
>        }
>        // ok, this fails to compile with
>        // > Syntax error: the token "var" was not expected at this position.
>        // public var foo = 0;
>    ]]></script>
> </canvas>
> ---

I see your point.  Do you want to file a bug?  Maybe you want to try playing 
with the parser?

I think the bug is that FunctionDeclaration should not be in 
ModifiedDefinition, but instead should appear as an alternative to 
ModifiedDefinition in Directive and StatementList.  ModifiedDefinition at the 
top level should only allow ClassDefinition.  There is already a separate 
ClassProperty syntax that handles class methods and properties.


Reply via email to