Change 20091110-ptw-R by [email protected] on 2009-11-10 17:24:06 EST
in /Users/ptw/OpenLaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Ensure closed-over parameters will not be shadowed by
instance members in swf8 and DHTML
Bugs Fixed: LPP-8593 Regression in swf8 compiler
Technical Reviewer: hminsky (pending)
QA Reviewer: max (pending)
Overview:
When I moved the "withThis" analysis from the tag compiler to the
script compiler (supporting LPP-7184), I missed the obscure case
of a parameter that is closed over by an inner function but might
be shadowed by an instance member. For this case, we have to copy
the parameter into a context inside the `with (this)` block. In
swf8, we have to actually build a context
Details:
JavascriptGenerator, CodeGenerator: Turn off withThis if it does
not apply (in a script block or no possible instance references).
Don't rename closed-over variables, but _do_ rename closed-over
parameters if you withThis (you will be inserting the instance
into the scope chain where it might shadow the parameters).
Re-create the closed over parameters inside the with context.
(For swf8, we have to build a new context, for Javascript the
runtime does the right thing with a var declaration inside a
`with`).
Compiler, CodeGenerator: Remove the (obsolete) ACTIVATION_OBJECT
support, which is no longer needed to support closures, and
repurpose it to ensure closed-over parameters are not shadowed by
`with (this)`.
ViewSchema: Remove unused SETTER_TYPE, noticed in passing.
Tests:
The following test will now display "name: 'correct'" in all 3
runtimes:
<canvas>
<class name="test" extends="view">
<method name="testMethod" args="name">
Debug.info("%w name: %w", arguments.callee, name);
return function inner () {
Debug.info("%w name: %w", arguments.callee, name);
}
</method>
</class>
<test name='WRONG' oninit="testMethod('correct')()" />
</canvas>
Files:
M WEB-INF/lps/server/src/org/openlaszlo/sc/JavascriptGenerator.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/compiler/ViewSchema.java
Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20091110-ptw-R.tar
_______________________________________________
Laszlo-reviews mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-reviews