[Laszlo-dev] For Review: Change 20071221-dda-4 Summary: Added support for initializers in SWF9
Donald Anderson
dda at ddanderson.com
Fri Dec 21 19:25:42 PST 2007
I don't know why yet, but if you leave 'public' off, it gets through
the parser, at least for me.
- Don
On Dec 21, 2007, at 5:32 PM, Henry Minsky wrote:
> I'm getting this error when I try to define a constructor for LzNode
> with optional args
>
> public function LzNode ( parent:* , attrs:* , children:* = null,
> instcall:* = null){
>
> lzl:
> [echo] Compiling C:\users\hqm\openlaszlo\devildog/lps/includes/
> lfc/LFC9.lzl
> [java] while compiling
> C:\users\hqm\openlaszlo\devildog\WEB-INF\lps\lfc\core\LzNode.js
> [java] while compiling
> C:\users\hqm\openlaszlo\devildog\WEB-INF\lps\lfc\core\Library.lzs
> [java] Exception compiling scriptfile: Syntax error: the token
> "public function LzNode ( parent : * , attrs : * , children : * =" was
> not expected at this position at line 72, column 5.
> [java] org.openlaszlo.sc.parser.ParseException: Syntax error: the
> token "public function LzNode ( parent : * , attrs : * , children : *
> =" was not expected at this position at line 72, column 5.
> [java] at
> org.openlaszlo.sc.parser.Parser.generateParseException(Parser.java:
> 9248)
> [java] at
> org.openlaszlo.sc.parser.Parser.jj_consume_token(Parser.java:9123)
> [java] at
> org.openlaszlo.sc.parser.Parser.ClassDirective(Parser.java:5217)
> [java] at
> org.openlaszlo.sc.parser.Parser.ClassDefinition(Parser.java:5548)
> [java] at
> org.openlaszlo.sc.parser.Parser.ModifiedDefinition(Parser.java:4461)
> [java] at org.openlaszlo.sc.parser.Parser.Directive(Parser.java:
> 4492)
> [java] at org.openlaszlo.sc.parser.Parser.Program(Parser.java:
> 4416)
>
>
>
>
> On Dec 21, 2007 8:21 AM, Donald Anderson <dda at ddanderson.com> wrote:
>> Good point. Probably is allowed, I'll look at it today,
>> time permitting.
>>
>> - Don
>>
>>
>> On Dec 21, 2007, at 7:58 AM, P T Withington wrote:
>>
>>> Approved.
>>>
>>> I wonder if this is allowed:
>>>
>>> function foo (a:t = x, b:u = (a = y, z))
>>>
>>> i.e., I wonder what level of complexity is allowed in the
>>> initializer expression, and if you potentially have to parenthesize
>>> the expression when you output it?
>>>
>>> On 2007-12-21, at 02:28 EST, Donald Anderson wrote:
>>>
>>>> Change 20071221-dda-4 by dda at Lester.local on 2007-12-21 02:15:48
>>>> EST
>>>> in /Users/dda/laszlo/src/svn/openlaszlo/branches/devildog
>>>> for http://svn.openlaszlo.org/openlaszlo/branches/devildog
>>>>
>>>> Summary: Added support for initializers in SWF9
>>>>
>>>> New Features:
>>>>
>>>> Bugs Fixed: LPP-5308
>>>>
>>>> Technical Reviewer: ptw (pending)
>>>> QA Reviewer: hminsky (pending)
>>>> Doc Reviewer: (pending)
>>>>
>>>> Documentation:
>>>>
>>>> Release Notes:
>>>>
>>>> Details:
>>>> - Added grammar to recognize formal parameter initializers,
>>>> param = expression.
>>>>
>>>> - initializers are checked to see that they are null (a current
>>>> restriction) if not, a warning is issued.
>>>>
>>>> - For all runtimes but SWF9, the initializers are removed.
>>>> Eventually that behavior could change for all runtimes
>>>> (no removal of initializers) and with more work, we could
>>>> fully support them.
>>>>
>>>> - changed the unparser to support printing the initializers
>>>> (not as pretty as it should be).
>>>>
>>>> - removed some unused code in CodeGenerator, JavascriptGenerator.
>>>>
>>>> Tests:
>>>> - smokecheck SWF8/DHMTL
>>>> - added test/optargs.lzx to test all cases, this is
>>>> now accepted by SWF8/DHTML. Gives reasonable results
>>>> in DHTML. I believe more work may be needed in SWF8
>>>> to support this.
>>>> - temporarily copied the functions from optargs.lzx to
>>>> LzNode to demonstrate it working for SWF9.
>>>>
>>>>
>>>> Files:
>>>> A test/optargs.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/SWF9Generator.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/src/org/openlaszlo/sc/
>>>> ParseTreePrinter.java
>>>> M WEB-INF/lps/server/sc/src/org/openlaszlo/sc/Parser.jjt
>>>>
>>>> Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20071221-dda-4.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
>>
>>
>>
>>
>>
>
>
>
> --
> Henry Minsky
> Software Architect
> hminsky at laszlosystems.com
--
Don Anderson
Java/C/C++, Berkeley DB, systems consultant
voice: 617-547-7881
email: dda at ddanderson.com
www: http://www.ddanderson.com
More information about the Laszlo-dev
mailing list