Updated to add semicolon in front of the newly added function expressions so they aren't interpreted as function calls if placed directly after a function declaration/expression. For example as in:
LzSprite.prototype.foo = function () {
  [...]
}
(function () {
  [...]
})()
which is now:
LzSprite.prototype.foo = function () {
  [...]
}
;(function () {
  [...]
})()

Change bargull-20110108-bAx by barg...@bargull02 on 2011-01-08 19:19:17
in /home/anba/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: restrict top-level if-directives to be resolvable at compile-time

Bugs Fixed: LPP-9538 (Compiler should not allow class definition inside conditional that is not resolvable at compile time)

Technical Reviewer: ptw
QA Reviewer: (pending)

Details:
Added the same restriction as in CodeGenerator for JavascriptGenerator, that means top-level if-directives need to be resolvable at compile-time. This new restriction forced me to add a couple of function expressions for dhtml to avoid compiler errors when compiling the lfc.


Tests:
test case from bug report no longer compiles

Files:
M WEB-INF/lps/lfc/kernel/dhtml/LzTimeKernel.js
M WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
M WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
M WEB-INF/lps/lfc/kernel/dhtml/LzXMLParser.js
M WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
M WEB-INF/lps/lfc/debugger/platform/dhtml/LzDebug.js
M WEB-INF/lps/lfc/compiler/Class.lzs
M WEB-INF/lps/server/src/org/openlaszlo/sc/JavascriptGenerator.java
M lps/includes/source/lzhistory.js
M lps/includes/source/excanvas.js
M lps/includes/source/embednew.js
M lps/includes/source/json2.js

Changeset: http://svn.openlaszlo.org/openlaszlo/patches/bargull-20110108-bAx.tar

Reply via email to