Author: ptw
Date: 2007-09-25 12:53:25 -0700 (Tue, 25 Sep 2007)
New Revision: 6589
Modified:
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java
Log:
Change 20070925-ptw-2 by [EMAIL PROTECTED] on 2007-09-25 11:56:09 EDT
in /Users/ptw/OpenLaszlo/ringding-clean
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Fix SWF constraint lossage in r6548
Bugs Fixed:
LPP-4786 'Script compiler needs refactoring before SWF9 work can begin'
Technical Reviewer: [EMAIL PROTECTED] (Message-Id: <[EMAIL PROTECTED]>)
QA Reviewer: hminsky (pending)
Doc Reviewer: (pending)
Details:
The remodularization tripped up the SWF Generator because it was
analyzing the constraint body _after_ it had been optimized to
inline the setAttribute call. Move the dependency analyzer to the
top of translateFunctionInternal, as is done in Javascript
Generator.
Tests:
Enabling ReferenceGenerator.debugConstraints shows that
constraints are actually being processed. smokecheck.lzx passes
in SWF now, and the SWF debugger window shows up again.
Modified:
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java
===================================================================
---
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java
2007-09-25 18:08:05 UTC (rev 6588)
+++
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java
2007-09-25 19:53:25 UTC (rev 6589)
@@ -1614,6 +1614,7 @@
String functionName = null;
SimpleNode params;
SimpleNode stmts;
+ SimpleNode depExpr = null;
if (children.length == 3) {
ASTIdentifier functionNameIdentifier = (ASTIdentifier)children[0];
params = children[1];
@@ -1667,6 +1668,34 @@
break;
}
}
+ if (options.getBoolean(Compiler.CONSTRAINT_FUNCTION)) {
+// assert (functionName != null);
+ if (ReferenceCollector.DebugConstraints) {
+ System.err.println("stmts: " + stmts);
+ }
+ // Find dependencies.
+ //
+ // Compute this before any transformations on the function body.
+ //
+ // The job of a constraint function is to compute a value.
+ // The current implementation inlines the call to set the
+ // attribute that the constraint is attached to, within the
+ // constraint function it Walking the statements of
+ // the function will process the expression that computes
+ // the value; it will also process the call to
+ // setAttribute, but ReferenceCollector knows to ignore
+ //
+ ReferenceCollector dependencies = new
ReferenceCollector(options.getBoolean(Compiler.COMPUTE_METAREFERENCES));
+ // Only visit original body
+ for (Iterator i = stmtList.iterator(); i.hasNext(); ) {
+ SimpleNode stmt = (SimpleNode)i.next();
+ dependencies.visit(stmt);
+ }
+ depExpr = dependencies.computeReferences(userFunctionName);
+ if (options.getBoolean(Compiler.PRINT_CONSTRAINTS)) {
+ (new Compiler.ParseTreePrinter()).print(depExpr);
+ }
+ }
List prefix = new ArrayList();
List postfix = new ArrayList();
if (options.getBoolean(Compiler.DEBUG_BACKTRACE)) {
@@ -2059,30 +2088,7 @@
}
}
if (options.getBoolean(Compiler.CONSTRAINT_FUNCTION)) {
-// assert (functionName != null);
- if (ReferenceCollector.DebugConstraints) {
- System.err.println("stmts: " + stmts);
- }
- // Find dependencies.
- //
- // The job of a constraint function is to compute a value.
- // The current implementation inlines the call to set the
- // attribute that the constraint is attached to, within the
- // constraint function it Walking the statements of
- // the function will process the expression that computes
- // the value; it will also process the call to
- // setAttribute, but ReferenceCollector knows to ignore
- //
- ReferenceCollector dependencies = new
ReferenceCollector(options.getBoolean(Compiler.COMPUTE_METAREFERENCES));
- for (Iterator i = stmtList.iterator(); i.hasNext(); ) {
- SimpleNode stmt = (SimpleNode)i.next();
- dependencies.visit(stmt);
- }
- SimpleNode expr = dependencies.computeReferences(userFunctionName);
- if (options.getBoolean(Compiler.PRINT_CONSTRAINTS)) {
- (new Compiler.ParseTreePrinter()).print(expr);
- }
- return expr;
+ return depExpr;
}
return null;
}
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins