Yes, the comment is fine.
I think the _real_ bug is that Javascript treats an empty var decl as
a syntax error. To me, you should always be able to have an empty
expression any where you can have an expression. I guess a var decl
is technically not an expression. <sigh />
On 2009-02-20, at 08:49EST, Donald Anderson wrote:
Tucker,
It turns out this replacement happens in the JavascriptGenerator
(line 420). Running the same testcase with dhtml
gives the spinning laszlo logo. I know SWF9Generator does the same
trick for a different case to handle globals, but replacing
a node with ASTEmptyExpression seems to be a common technique.
Probably because it's somewhat awkward to elide a
node as it affects the next higher level node. I'm inclined to add
a stronger comment in ParseTreeGenerator. Okay?
- Don
On Feb 16, 2009, at 2:12 PM, P T Withington wrote:
I'm not real happy with this solution. It seems that the swf9 back-
end is creating an illegal parse tree (replacing a variable
declaration with an empty expression) and that you are then
papering over that in the parse tree printer. I would rather see
you fix the swf9 back-end to remove the variable declaration
altogether from the parse tree.
If that is not possible, can we at least have a comment in the code
saying _why_ the parse tree printer has to deal with empty
declarations?
On 2009-02-16, at 13:17EST, Donald Anderson wrote:
Change 20090216-dda-V by [email protected] on 2009-02-16 12:11:27
EST
in /Users/dda/laszlo/src/svn/openlaszlo/trunk-b
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: SWF9: Fix comma separated global declaration
New Features:
Bugs Fixed: [LPP-7746] SWF9: comma separated global var
declarations don't compile
Technical Reviewer: ptw (pending)
QA Reviewer: (pending)
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
In SWF9, a variable statement that appears outside a method (that
is, a global var declaration),
is dismantled as the variable declaration appears in a separate
file named for the global variable,
e.g. var foo, bar ==> foo.as, bar.as
The original variable expressions are left behind as empty
expressions.
This changeset fixes the unparser so it knows to drop empty
expressions in a variable declaration list.
This was not noticed testing with single variables 'var foo', as
the unparser generated a comma separated
list of expressions - one blank expression, comma separated,
still yielded a blank result.
Tests:
The test case from the JIRA now compiles. Same test case with
mix of initialized and uninitialized vars compiles.
The usual regression tests: smokecheck, lzpix, weather on
swf9,swf8,dhtml
Files:
M WEB-INF/lps/server/src/org/openlaszlo/sc/
ParseTreePrinter.java
Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20090216-dda-V.tar
--
Don Anderson
Java/C/C++, Berkeley DB, systems consultant
voice: 617-306-2057
email: [email protected]
www: http://www.ddanderson.com
--
Don Anderson
Java/C/C++, Berkeley DB, systems consultant
voice: 617-306-2057
email: [email protected]
www: http://www.ddanderson.com