Browse Source

Compile both self and $self into method.

'self' meant to be used for the value.
'$self' meant to be used as a receiver.
ATM, both are defined as 'this'.
Herbert Vojčík 7 years ago
parent
commit
a09e93d607
2 changed files with 46 additions and 46 deletions
  1. 24 24
      src/Silk-Tests.js
  2. 22 22
      src/Silk.js

+ 24 - 24
src/Silk-Tests.js

@@ -21,7 +21,7 @@ $core.method({
 selector: "testedClass",
 protocol: "fixture",
 fn: function (){
-var self=this;
+var self=this,$self=this;
 return $globals.Silk;
 
 },
@@ -42,7 +42,7 @@ $core.method({
 selector: "assertBodyEndsWith:",
 protocol: "fixture",
 fn: function (aString){
-var self=this;
+var self=this,$self=this;
 var sanitizedBody,sanitizedAssertion;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
@@ -62,8 +62,8 @@ $3=$recv(sanitizedAssertion)._size();
 $ctx1.sendIdx["size"]=2;
 //>>excludeEnd("ctx");
 $1=$recv($2).__gt_eq($3);
-self._assert_($1);
-self._assert_equals_($recv(sanitizedBody)._last_($recv(sanitizedAssertion)._size()),sanitizedAssertion);
+$self._assert_($1);
+$self._assert_equals_($recv(sanitizedBody)._last_($recv(sanitizedAssertion)._size()),sanitizedAssertion);
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"assertBodyEndsWith:",{aString:aString,sanitizedBody:sanitizedBody,sanitizedAssertion:sanitizedAssertion},$globals.SilkTest)});
@@ -83,7 +83,7 @@ $core.method({
 selector: "assertBodyEndsWithOneOf:",
 protocol: "fixture",
 fn: function (aStringArray){
-var self=this;
+var self=this,$self=this;
 var sanitizedBody,err;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
@@ -115,8 +115,8 @@ $3=$recv(sanitizedAssertion)._size();
 $ctx3.sendIdx["size"]=2;
 //>>excludeEnd("ctx");
 $1=$recv($2).__gt_eq($3);
-self._assert_($1);
-self._assert_equals_($recv(sanitizedBody)._last_($recv(sanitizedAssertion)._size()),sanitizedAssertion);
+$self._assert_($1);
+$self._assert_equals_($recv(sanitizedBody)._last_($recv(sanitizedAssertion)._size()),sanitizedAssertion);
 throw $early=[self];
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
@@ -157,14 +157,14 @@ $core.method({
 selector: "setUp",
 protocol: "fixture",
 fn: function (){
-var self=this;
+var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-self["@fixtureDiv"]=$recv(document)._createElement_("div");
-$recv($recv(document)._body())._appendChild_(self["@fixtureDiv"]);
-$recv(self["@fixtureDiv"])._setAttribute_to_("id","fixture");
-$recv(self["@fixtureDiv"])._innerHTML_("sentinel");
+$self["@fixtureDiv"]=$recv(document)._createElement_("div");
+$recv($recv(document)._body())._appendChild_($self["@fixtureDiv"]);
+$recv($self["@fixtureDiv"])._setAttribute_to_("id","fixture");
+$recv($self["@fixtureDiv"])._innerHTML_("sentinel");
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SilkTest)});
@@ -184,7 +184,7 @@ $core.method({
 selector: "tearDown",
 protocol: "fixture",
 fn: function (){
-var self=this;
+var self=this,$self=this;
 var lastChild;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
@@ -195,7 +195,7 @@ $1=$recv(document)._body();
 $ctx1.sendIdx["body"]=1;
 //>>excludeEnd("ctx");
 lastChild=$recv($1)._lastChild();
-self._assert_equals_(lastChild,self["@fixtureDiv"]);
+$self._assert_equals_(lastChild,$self["@fixtureDiv"]);
 $recv($recv(document)._body())._removeChild_(lastChild);
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
@@ -216,7 +216,7 @@ $core.method({
 selector: "testInsertTable",
 protocol: "testing",
 fn: function (){
-var self=this;
+var self=this,$self=this;
 var d,tbl;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
@@ -250,7 +250,7 @@ $recv($3)._TD_("E");
 $ctx1.sendIdx["TD:"]=5;
 //>>excludeEnd("ctx");
 $recv($3)._TD_("F");
-self._assertBodyEndsWith_(">sentinel<table><tr><td>A</td><td>B</td><td>C</td></tr><tr><td>D</td><td>E</td><td>F</td></tr></table></div>");
+$self._assertBodyEndsWith_(">sentinel<table><tr><td>A</td><td>B</td><td>C</td></tr><tr><td>D</td><td>E</td><td>F</td></tr></table></div>");
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"testInsertTable",{d:d,tbl:tbl},$globals.SilkTest)});
@@ -270,7 +270,7 @@ $core.method({
 selector: "testInsertTable2",
 protocol: "testing",
 fn: function (){
-var self=this;
+var self=this,$self=this;
 var d,tbl;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
@@ -306,7 +306,7 @@ $ctx1.sendIdx["TD:"]=5;
 //>>excludeEnd("ctx");
 $6=[$7,$8,$recv($globals.Silk)._TD_("F")];
 $recv($1)._TR_($6);
-self._assertBodyEndsWith_(">sentinel<table><tr><td>A</td><td>B</td><td>C</td></tr><tr><td>D</td><td>E</td><td>F</td></tr></table></div>");
+$self._assertBodyEndsWith_(">sentinel<table><tr><td>A</td><td>B</td><td>C</td></tr><tr><td>D</td><td>E</td><td>F</td></tr></table></div>");
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"testInsertTable2",{d:d,tbl:tbl},$globals.SilkTest)});
@@ -326,7 +326,7 @@ $core.method({
 selector: "testNestedDIVsWithAttributes",
 protocol: "testing",
 fn: function (){
-var self=this;
+var self=this,$self=this;
 var s;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
@@ -388,7 +388,7 @@ return $recv($globals.Transcript)._show_("button pressed");
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
 //>>excludeEnd("ctx");
 }));
-self._assertBodyEndsWithOneOf_([">sentinel<div class=\x22mySilkContainerClass\x22 id=\x22container\x22><div id=\x22contentarea\x22>here comes the content</div><div class=\x22myToolbarClass\x22 id=\x22toolbar\x22><button>do something</button></div></div></div>", ">sentinel<div id=\x22container\x22 class=\x22mySilkContainerClass\x22><div id=\x22contentarea\x22>here comes the content</div><div id=\x22toolbar\x22 class=\x22myToolbarClass\x22><button>do something</button></div></div></div>"]);
+$self._assertBodyEndsWithOneOf_([">sentinel<div class=\x22mySilkContainerClass\x22 id=\x22container\x22><div id=\x22contentarea\x22>here comes the content</div><div class=\x22myToolbarClass\x22 id=\x22toolbar\x22><button>do something</button></div></div></div>", ">sentinel<div id=\x22container\x22 class=\x22mySilkContainerClass\x22><div id=\x22contentarea\x22>here comes the content</div><div id=\x22toolbar\x22 class=\x22myToolbarClass\x22><button>do something</button></div></div></div>"]);
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"testNestedDIVsWithAttributes",{s:s},$globals.SilkTest)});
@@ -408,15 +408,15 @@ $core.method({
 selector: "testOnClickEvent",
 protocol: "testing",
 fn: function (){
-var self=this;
+var self=this,$self=this;
 var s,para;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
 s="#fixture"._asSilk();
 para=$recv(s)._P_("DOM");
-self._timeout_((100));
-$recv(self._async_((function(){
+$self._timeout_((100));
+$recv($self._async_((function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
@@ -424,7 +424,7 @@ $recv(para)._on_bind_("click",(function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx3) {
 //>>excludeEnd("ctx");
-return self._finished();
+return $self._finished();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
 //>>excludeEnd("ctx");

+ 22 - 22
src/Silk.js

@@ -15,18 +15,18 @@ $core.method({
 selector: "doesNotUnderstand:",
 protocol: "writing",
 fn: function (aMessage){
-var self=this;
+var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
 var $1,$2,$receiver;
-$1=$recv(self._class())._tryMakeDnuElement_(aMessage);
+$1=$recv($self._class())._tryMakeDnuElement_(aMessage);
 if(($receiver = $1) == null || $receiver.a$nil){
 $2=(
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.supercall = true,
 //>>excludeEnd("ctx");
-($globals.Silk.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($recv(self), [aMessage]));
+($globals.Silk.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($self, [aMessage]));
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.supercall = false;
 //>>excludeEnd("ctx");;
@@ -34,7 +34,7 @@ return $2;
 } else {
 var newElement;
 newElement=$receiver;
-self.__lt_lt(newElement);
+$self.__lt_lt(newElement);
 return newElement;
 }
 return self;
@@ -56,7 +56,7 @@ $core.method({
 selector: "nextPut:",
 protocol: "writing",
 fn: function (anObject){
-var self=this;
+var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
@@ -67,7 +67,7 @@ if(($receiver = $1) == null || $receiver.a$nil){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.supercall = true,
 //>>excludeEnd("ctx");
-($globals.Silk.superclass||$boot.nilAsClass).fn.prototype._nextPut_.apply($recv(self), [anObject]));
+($globals.Silk.superclass||$boot.nilAsClass).fn.prototype._nextPut_.apply($self, [anObject]));
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.supercall = false;
 //>>excludeEnd("ctx");;
@@ -94,18 +94,18 @@ $core.method({
 selector: "doesNotUnderstand:",
 protocol: "message handling",
 fn: function (aMessage){
-var self=this;
+var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
 var $1,$receiver;
-$1=self._tryMakeDnuElement_(aMessage);
+$1=$self._tryMakeDnuElement_(aMessage);
 if(($receiver = $1) == null || $receiver.a$nil){
 return (
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.supercall = true,
 //>>excludeEnd("ctx");
-($globals.Silk.a$cls.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($recv(self), [aMessage]));
+($globals.Silk.a$cls.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($self, [aMessage]));
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.supercall = false;
 //>>excludeEnd("ctx");;
@@ -130,7 +130,7 @@ $core.method({
 selector: "tryMakeDnuElement:",
 protocol: "instance creation",
 fn: function (aMessage){
-var self=this;
+var self=this,$self=this;
 var selector,newElement,useArg;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
@@ -158,7 +158,7 @@ $3=$recv(selector)._includes_(":");
 if($core.assert($3)){
 return nil;
 }
-newElement=self._newElement_($recv(selector)._asLowercase());
+newElement=$self._newElement_($recv(selector)._asLowercase());
 $4=useArg;
 if($core.assert($4)){
 $recv(newElement).__lt_lt($recv($recv(aMessage)._arguments())._first());
@@ -182,11 +182,11 @@ $core.method({
 selector: "renderOnSilk:",
 protocol: "*Silk",
 fn: function (aSilk){
-var self=this;
+var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-$recv(self["@key"])._attrPut_on_(self["@value"],aSilk);
+$recv($self["@key"])._attrPut_on_($self["@value"],aSilk);
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"renderOnSilk:",{aSilk:aSilk},$globals.Association)});
@@ -206,11 +206,11 @@ $core.method({
 selector: "renderOnSilk:",
 protocol: "*Silk",
 fn: function (aSilk){
-var self=this;
+var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-self._value_(aSilk);
+$self._value_(aSilk);
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"renderOnSilk:",{aSilk:aSilk},$globals.BlockClosure)});
@@ -230,11 +230,11 @@ $core.method({
 selector: "asSilk",
 protocol: "*Silk",
 fn: function (){
-var self=this;
+var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-return $recv($globals.Silk)._at_(self._asString());
+return $recv($globals.Silk)._at_($self._asString());
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"asSilk",{},$globals.CharacterArray)});
 //>>excludeEnd("ctx");
@@ -253,7 +253,7 @@ $core.method({
 selector: "inSilk",
 protocol: "*Silk",
 fn: function (){
-var self=this;
+var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
@@ -279,7 +279,7 @@ $core.method({
 selector: "renderOnSilk:",
 protocol: "*Silk",
 fn: function (aSilk){
-var self=this;
+var self=this,$self=this;
 return nil;
 
 },
@@ -297,7 +297,7 @@ $core.method({
 selector: "inSilk",
 protocol: "*Silk",
 fn: function (){
-var self=this;
+var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
@@ -323,7 +323,7 @@ $core.method({
 selector: "renderOnSilk:",
 protocol: "*Silk",
 fn: function (aSilk){
-var self=this;
+var self=this,$self=this;
 return nil;
 
 },
@@ -341,7 +341,7 @@ $core.method({
 selector: "attrPut:on:",
 protocol: "*Silk",
 fn: function (anObject,aSilk){
-var self=this;
+var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");