[Laszlo-dev] For Review: Change 20080226-dda-5 Summary: Support optional and variable arg syntax for SWF8, DHTML
P T Withington
ptwithy at gmail.com
Sun Mar 2 04:23:31 PST 2008
The 'enforce null' idea was half a loaf. This is great to have. People
should try to clean up any manual defaults to use the built in
mechanism when they can now, as it will be much more efficient in JS2
runtimes.
On Feb 29, 2008, at 13:28, Donald Anderson <dda at ddanderson.com> wrote:
> Ah, yes. Thanks, I'll add that.
> I think there was some thinking that the optional args would
> be restricted to null, but I don't know if there's any strong reason
> to do that.
>
> I'm going to commit this to trunk, and Tucker can do the technical
> review when he has the time for it.
>
>
> On Feb 28, 2008, at 8:30 AM, Philip Romanik wrote:
>
>> Approved!
>>
>> I added a few tests to my copy of optarg.lzx to prove to myself
>> that non-null default arguments work properly. You might want to
>> add a similar test:
>>
>> function f6(x=1,y=2) {
>> return x+y;
>> }
>>
>> ...
>>
>> check(f6(), 3)
>> check(f6(2), 4)
>> check(f6(2,3), 5)
>> check(f6(2,3,4), 5)
>>
>>
>>> [Sorry if this is a repeat - it doesn't look like it was sent the
>>> first time]
>>>
>>> Change 20080226-dda-5 by dda at lester.local on 2008-02-26 09:02:58 EST
>>> in /Users/dda/laszlo/src/svn/openlaszlo/trunk
>>> for http://svn.openlaszlo.org/openlaszlo/trunk
>>>
>>> Summary: Support optional and variable arg syntax for SWF8, DHTML
>>>
>>> New Features: JS2 syntax for optional arguments and ...rest syntax
>>> for variable arguments now supported
>>>
>>> Bugs Fixed: LPP-5273
>>>
>>> Technical Reviewer: ptw (pending)
>>> QA Reviewer: promanik (pending)
>>> Doc Reviewer: (pending)
>>>
>>> Documentation: The syntax allowed is according to the Ecmascript 4
>>> draft standard,
>>> which is implemented in ActionScript 3.
>>>
>>> Release Notes:
>>>
>>> Details:
>>> The grammar aspect of this change is backported from the
>>> devildog branch.
>>> To help future merges, it seemed best to take all grammar
>>> changes except for
>>> the SWF9 'passthrough' work. Which means we get:
>>> - varargs and optional args, with corresponding changes to
>>> ASTIdentifier
>>> - recognition 'const' keyword (treating the same as 'var')
>>> - 'catch' allows a type declaration for argument.
>>> - turn on 'visitor' support in parser, could help with
>>> future work.
>>>
>>> The changes to the formal arguments are made just before a
>>> function is translated,
>>> and are designed as a single method. This will allow SWF9 to
>>> provide a
>>> no-op for the method and keep its behavior to pass through
>>> the syntax
>>> to the third party compiler.
>>>
>>> The new function is formalArgumentsTransformations and is
>>> expected to be self documenting.
>>>
>>> A small fix to 'setRuntime' in JavascriptGenerator spotted
>>> and changed.
>>>
>>> Some unneeded code removed from CodeGenerator (this change
>>> already in devildog).
>>>
>>> A new file test/optarg.lzx is added. This will supercede
>>> test/ optargs.lzx already
>>> in the devildog branch.
>>>
>>> Tests:
>>> (smokecheck,weather,lzpix) x (swf8,dhtml)
>>> new test/optarg.lzx (swf8,dhtml)
>>> one-off test: locally, incorporated parts of test/optarg.lzx
>>> into LFC to make
>>> sure syntaxes work within 'class { function foo(args...) }'
>>> syntax.
>>>
>>> Files:
>>> A test/optarg.lzx
>>> M WEB-INF/lps/server/src/org/openlaszlo/sc/
>>> JavascriptGenerator.java
>>> M WEB-INF/lps/server/src/org/openlaszlo/sc/
>>> VariableAnalyzer.java
>>> M WEB-INF/lps/server/src/org/openlaszlo/sc/CommonGenerator.java
>>> M WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java
>>> M WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java
>>> M WEB-INF/lps/server/sc/src/org/openlaszlo/sc/Parser.jjt
>>> M WEB-INF/lps/server/sc/src/org/openlaszlo/sc/parser/
>>> SimpleNode.java
>>> M WEB-INF/lps/server/sc/src/org/openlaszlo/sc/parser/
>>> ASTModifiedDefinition.java
>>> M WEB-INF/lps/server/sc/src/org/openlaszlo/sc/parser/
>>> ASTOperator.java
>>> M WEB-INF/lps/server/sc/src/org/openlaszlo/sc/parser/
>>> ASTLiteral.java
>>> M WEB-INF/lps/server/sc/src/org/openlaszlo/sc/parser/
>>> ASTIdentifier.java
>>>
>>> Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20080226-dda-5.tar
>>>
>>>
>>>
>>> --
>>>
>>> Don Anderson
>>> Java/C/C++, Berkeley DB, systems consultant
>>>
>>> voice: 617-547-7881
>>> email: dda at ddanderson.com
>>> www: http://www.ddanderson.com
>>>
>>>
>>>
>>>
>>
>
>
> --
>
> Don Anderson
> Java/C/C++, Berkeley DB, systems consultant
>
> voice: 617-547-7881
> email: dda at ddanderson.com
> www: http://www.ddanderson.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20080303/0c80746f/attachment.html
More information about the Laszlo-dev
mailing list