Charles SALMON schrieb:
> Hello,
>
> I am trying to compile my application to do a build version (make build).
> The following code:
> var v = [];
> for(attr in o) {
> if(o[attr] == null) v.push("\"" + attr + "\": null");
> else if(typeof o[attr] == "function"); /* skip */
> else v.push(escapeJSONString(attr) + ": " + toJSON(o[attr]));
> }
>
> is transformed as:
>
> var v=[];
> for(attr in o){if(o[attr]==null)v.push("\""+attr+"\": null");
> else if(typeof o[attr]=="function")else
> v.push(escapeJSONString(attr)+": "+toJSON(o[attr]));
> }return "{"+v.join(", ")+"}";
> }};
>
> The ';' of the 'else if(typeof o[attr] == "function"); /* skip */' is
> removed, which make the following error in firefox:
>
> Error: syntax error
> Source File:
> file:///home/charless/workspace/HighLightEclipse/HighLightWeb/frontend/application/srfgui/build/script/srfgui.js
> Line: 23334, Column: 35
> Source Code:
> else if(typeof o[attr]=="function")else
> v.push(escapeJSONString(attr)+": "+toJSON(o[attr]));
>
> Is it a bug ?
Hi Charles,
yes you have found a bug in the compiler. We have fixed it in svn.
Meanwhile you can rewrite your code like this:
var v = [];
for(attr in o) {
if(o[attr] == null) v.push("\"" + attr + "\": null") {}
else if(typeof o[attr] == "function") {} /* skip */
else v.push(escapeJSONString(attr) + ": " + toJSON(o[attr]));
}
This should be more readable for others as well.
Best Fabian
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel