Re: [Laszlo-reviews] For Review: Change 20100501-bargull-k2W Summary: fix for flex array literal vs. meta data bug
André Bargull <andre.bargull <at> udo.edu>
2010-05-03 16:35:50 GMT
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 <at> 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 <andre.bargull <at> udo.edu
> <mailto:andre.bargull <at> udo.edu>> wrote:
>
> Change 20100501-bargull-k2W by bargull <at> 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
> hminsky <at> laszlosystems.com <mailto:hminsky <at> laszlosystems.com>
>
>