Simon!
Thank you for your report. However I could not reproduce it with the
code you sent.
This is the code I've tested:
-- snip --
function test1(clone)
{
var foo="hello";
obj.clone();
obj.foo();
}
qx.Proto.clone = function()
{
var cloneArgs = {};
cloneArgs.viewCategories = [];
var vcs = this.getViewCategories();
for (var i = 0; i < vcs.length; i++)
{
var vc = vcs[i];
if (vc != null)
{
var cloneViewCategory = vc.clone();
cloneArgs.viewCategories[cloneArgs.viewCategories.length] =
cloneViewCategory;
}
}
var clone = new ext.data.viewstate.ViewState(cloneArgs);
return clone;
}
function test2() {
var clone = new ext.data.viewstate.ViewState(cloneArgs);
var cloneViewCategory = vc.clone();
}
-- snap --
and this is the result when using:
framework/tool/modules/compiler.py --optimize-variables file.js
-- snip --
function test1($0){var
$1="hello";obj.clone();obj.foo();}qx.Proto.clone=function(){var
$0={};$0.viewCategories=[];var $1=this.getViewCategories();for(var
$2=0;$2<$1.length;$2++){var $3=$1[$2];if($3!=null){var
$4=$3.clone();$0.viewCategories[$0.viewCategories.length]=$4;}}var
$5=new ext.data.viewstate.ViewState($0);return $5;};function test2(){var
$0=new ext.data.viewstate.ViewState(cloneArgs);var $1=vc.clone();}
-- snap --
As you can see all calls to clone() are kept. Are you really sure all
your tools are up-to-date. Maybe you can spend some more time for
further investigations. Please try to reproduce your problem by the
module/compiler.py script as this should be faster for you and us to
find and verify bugs.
Thank you.
Sebastian
Simon Bull schrieb:
> Hi All,
>
> I am using Qx 0.6.5.
>
> I have a custom js class called ViewState that is composed of ViewCategories,
> which are composed of OptionGroups, which are composed of Options. Each of
> these classes implements a clone method that looks something like this (this
> one is from the top level Object, ViewState):
>
> qx.Proto.clone = function()
> {
> var cloneArgs = {};
> cloneArgs.viewCategories = [];
> var vcs = this.getViewCategories();
> for (var i = 0; i < vcs.length; i++)
> {
> var vc = vcs[i];
> if (vc != null)
> {
> var cloneViewCategory = vc.clone();
> cloneArgs.viewCategories[cloneArgs.viewCategories.length] =
> cloneViewCategory;
> }
> }
> var clone = new ext.data.viewstate.ViewState(cloneArgs);
> return clone;
> }
>
>
> My code runs fine after a make source, but fails after a make build. Looking
> into the custom.js file I see that lines of code like:
>
> var clone = new ext.data.viewstate.ViewState(cloneArgs);
>
> are compressed to:
>
> var $b = new ext.data.viewstate.ViewState($a);
>
> which is all good.
>
>
> However, some (not all) of the lines of code that look like:
>
> var cloneViewCategory = vc.clone();
>
> are compressed to:
>
> var $c = $d.$b();
>
>
> which is wrong, it should something like:
>
> var $c = $d.clone();
>
>
> If I change the source code from
> "var clone = new ext.data.viewstate.ViewState(cloneArgs);"
>
> to
>
> "var foobar = new ext.data.viewstate.ViewState(cloneArgs);"
>
> then both the make source and make build versions work fine.
>
> It appears that the make script is confusing the local var name "clone" with
> the method name "clone". Perhaps this is related to the recursive nature of
> my clone() method?
>
>
> Has anyone else seen this problem?
>
>
> Simon
>
>
>
>
>
>
>
>
>
>
>
>
> Send instant messages to your online friends http://au.messenger.yahoo.com
>
> -------------------------------------------------------------------------
> 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
-------------------------------------------------------------------------
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