Browse Source

Fixed toggle:, self used in trapShow:default:

Herbert Vojčík 12 years ago
parent
commit
218e84ef57
3 changed files with 25 additions and 39 deletions
  1. 8 15
      js/Trapped-Frontend.deploy.js
  2. 14 21
      js/Trapped-Frontend.js
  3. 3 3
      st/Trapped-Frontend.st

+ 8 - 15
js/Trapped-Frontend.deploy.js

@@ -393,12 +393,8 @@ smalltalk.method({
 selector: "trap:toggle:",
 fn: function (path,aBlock){
 var self=this;
-var $1,$2;
 smalltalk.send(self,"_trap_toggle_ifNotPresent_",[path,aBlock,(function(){
-$1=smalltalk.send(self,"_asJQuery",[]);
-smalltalk.send($1,"_empty",[]);
-$2=smalltalk.send($1,"_hide",[]);
-return $2;
+return smalltalk.send(smalltalk.send(self,"_asJQuery",[]),"_hide",[]);
 })]);
 return self}
 }),
@@ -418,12 +414,10 @@ $1=smalltalk.send(shown,"__eq",[smalltalk.send(data,"_notNil",[])]);
 if(! smalltalk.assert($1)){
 shown=smalltalk.send(data,"_notNil",[]);
 shown;
-if(smalltalk.assert(shown)){
 $2=smalltalk.send(self,"_asJQuery",[]);
 smalltalk.send($2,"_empty",[]);
 $3=smalltalk.send($2,"_show",[]);
 $3;
-};
 if(smalltalk.assert(shown)){
 $4=aBlock;
 } else {
@@ -454,17 +448,16 @@ smalltalk.method({
 selector: "trapShow:default:",
 fn: function (path,anObject){
 var self=this;
-var $1,$3,$2;
-smalltalk.send(self,"_trap_read_",[path,(function(model,html){
-$1=smalltalk.send(html,"_root",[]);
-smalltalk.send($1,"_empty",[]);
+var $2,$1;
+smalltalk.send(self,"_trap_read_",[path,(function(model){
+smalltalk.send(self,"_empty",[]);
 if(($receiver = model) == nil || $receiver == undefined){
-$3=anObject;
+$2=anObject;
 } else {
-$3=model;
+$2=model;
 };
-$2=smalltalk.send($1,"_with_",[$3]);
-return $2;
+$1=smalltalk.send(self,"_with_",[$2]);
+return $1;
 })]);
 return self}
 }),

+ 14 - 21
js/Trapped-Frontend.js

@@ -521,17 +521,13 @@ selector: "trap:toggle:",
 category: '*Trapped-Frontend',
 fn: function (path,aBlock){
 var self=this;
-var $1,$2;
 smalltalk.send(self,"_trap_toggle_ifNotPresent_",[path,aBlock,(function(){
-$1=smalltalk.send(self,"_asJQuery",[]);
-smalltalk.send($1,"_empty",[]);
-$2=smalltalk.send($1,"_hide",[]);
-return $2;
+return smalltalk.send(smalltalk.send(self,"_asJQuery",[]),"_hide",[]);
 })]);
 return self},
 args: ["path", "aBlock"],
-source: "trap: path toggle: aBlock\x0a    self trap: path toggle: aBlock ifNotPresent: [ self asJQuery empty; hide ]",
-messageSends: ["trap:toggle:ifNotPresent:", "empty", "asJQuery", "hide"],
+source: "trap: path toggle: aBlock\x0a    self trap: path toggle: aBlock ifNotPresent: [ self asJQuery hide ]",
+messageSends: ["trap:toggle:ifNotPresent:", "hide", "asJQuery"],
 referencedClasses: []
 }),
 smalltalk.TagBrush);
@@ -551,12 +547,10 @@ $1=smalltalk.send(shown,"__eq",[smalltalk.send(data,"_notNil",[])]);
 if(! smalltalk.assert($1)){
 shown=smalltalk.send(data,"_notNil",[]);
 shown;
-if(smalltalk.assert(shown)){
 $2=smalltalk.send(self,"_asJQuery",[]);
 smalltalk.send($2,"_empty",[]);
 $3=smalltalk.send($2,"_show",[]);
 $3;
-};
 if(smalltalk.assert(shown)){
 $4=aBlock;
 } else {
@@ -567,8 +561,8 @@ return smalltalk.send($4,"_value_value_",[data,html]);
 })]);
 return self},
 args: ["path", "aBlock", "anotherBlock"],
-source: "trap: path toggle: aBlock ifNotPresent: anotherBlock\x0a    | shown |\x0a    shown := nil.\x0a    self trap: path read: [ :data : html |\x0a        shown = data notNil ifFalse: [\x0a            shown := data notNil.\x0a            shown ifTrue: [ self asJQuery empty; show ].\x0a            (shown ifTrue: [aBlock] ifFalse: [anotherBlock]) value: data value: html.\x0a        ]\x0a    ]",
-messageSends: ["trap:read:", "ifFalse:", "notNil", "ifTrue:", "empty", "asJQuery", "show", "value:value:", "ifTrue:ifFalse:", "="],
+source: "trap: path toggle: aBlock ifNotPresent: anotherBlock\x0a    | shown |\x0a    shown := nil.\x0a    self trap: path read: [ :data : html |\x0a        shown = data notNil ifFalse: [\x0a            shown := data notNil.\x0a            self asJQuery empty; show.\x0a            (shown ifTrue: [aBlock] ifFalse: [anotherBlock]) value: data value: html.\x0a        ]\x0a    ]",
+messageSends: ["trap:read:", "ifFalse:", "notNil", "empty", "asJQuery", "show", "value:value:", "ifTrue:ifFalse:", "="],
 referencedClasses: []
 }),
 smalltalk.TagBrush);
@@ -597,22 +591,21 @@ selector: "trapShow:default:",
 category: '*Trapped-Frontend',
 fn: function (path,anObject){
 var self=this;
-var $1,$3,$2;
-smalltalk.send(self,"_trap_read_",[path,(function(model,html){
-$1=smalltalk.send(html,"_root",[]);
-smalltalk.send($1,"_empty",[]);
+var $2,$1;
+smalltalk.send(self,"_trap_read_",[path,(function(model){
+smalltalk.send(self,"_empty",[]);
 if(($receiver = model) == nil || $receiver == undefined){
-$3=anObject;
+$2=anObject;
 } else {
-$3=model;
+$2=model;
 };
-$2=smalltalk.send($1,"_with_",[$3]);
-return $2;
+$1=smalltalk.send(self,"_with_",[$2]);
+return $1;
 })]);
 return self},
 args: ["path", "anObject"],
-source: "trapShow: path default: anObject\x0a\x09self trap: path read: [ :model :html | html root empty; with: (model ifNil: [anObject]) ]",
-messageSends: ["trap:read:", "empty", "root", "with:", "ifNil:"],
+source: "trapShow: path default: anObject\x0a\x09self trap: path read: [ :model | self empty; with: (model ifNil: [anObject]) ]",
+messageSends: ["trap:read:", "empty", "with:", "ifNil:"],
 referencedClasses: []
 }),
 smalltalk.TagBrush);

+ 3 - 3
st/Trapped-Frontend.st

@@ -198,7 +198,7 @@ trap: path read: aBlock
 !
 
 trap: path toggle: aBlock
-    self trap: path toggle: aBlock ifNotPresent: [ self asJQuery empty; hide ]
+    self trap: path toggle: aBlock ifNotPresent: [ self asJQuery hide ]
 !
 
 trap: path toggle: aBlock ifNotPresent: anotherBlock
@@ -207,7 +207,7 @@ trap: path toggle: aBlock ifNotPresent: anotherBlock
     self trap: path read: [ :data : html |
         shown = data notNil ifFalse: [
             shown := data notNil.
-            shown ifTrue: [ self asJQuery empty; show ].
+            self asJQuery empty; show.
             (shown ifTrue: [aBlock] ifFalse: [anotherBlock]) value: data value: html.
         ]
     ]
@@ -218,6 +218,6 @@ trapShow: path
 !
 
 trapShow: path default: anObject
-	self trap: path read: [ :model :html | html root empty; with: (model ifNil: [anObject]) ]
+	self trap: path read: [ :model | self empty; with: (model ifNil: [anObject]) ]
 ! !