On 5/3/2010 4:57 PM, Henry Minsky wrote:
approved

note: this code runs properly

       [1,2].forEach(function(a:*) {Debug.write(a)});

But if I add a 'void' return type declaration for the anon function, it
gets an error
at runtime

       [1,2].forEach(function(a:*) : void {Debug.write(a)});


ERROR @hello.lzx≈4: ArgumentError: Error #1063: Argument count mismatch
on <anonymous>(). Expected 1, got 3.

Yeah, I've also hit this issue from time to time. Somehow adding the return-type changes Flex to be more strict, that means you need to define all parameters:

[1,2].forEach(function(item:*, index:int, array:Array) :void {Debug.write(item)});





On Fri, Apr 30, 2010 at 7:24 PM, André Bargull <[email protected]
<mailto:[email protected]>> wrote:

    Change 20100501-bargull-k2W by barg...@bargull02 on 2010-05-01 00:42:11
    in /home/anba/src/svn/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

    Summary: fix for flex array literal vs. meta data bug

    New Features:

    Bugs Fixed: LPP-8891 (SWF9: don't remove parenthesis around brackets
    or add them automatically)

    Technical Reviewer: ptw
    QA Reviewer: henry
    Doc Reviewer: (pending)

    Documentation:

    Release Notes:

    Overview:


    Details:
    The ActionScript3 grammar does not follow the ECMAScript grammar for
    MemberExpressions, namely the MemberExpression for property access
    must not be an ArrayLiteral, cf. section 11.2 "Left-Hand-Side
    Expressions" ECMAScript 3rd/5th edition. This restriction was added
    to ActionScript3 due to their MetaData support, e.g.
    [Embed(source="...")].
    This change adds the required parenthesis around array literals for
    property access.


    Tests:
    [].forEach(function(...rest){}) works in swf9+

    Files:
    M WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9ParseTreePrinter.java

    Changeset:
    http://svn.openlaszlo.org/openlaszlo/patches/20100501-bargull-k2W.tar




--
Henry Minsky
Software Architect
[email protected] <mailto:[email protected]>


Reply via email to