Jelajahi Sumber

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 tahun lalu
induk
melakukan
aed2936bad
4 mengubah file dengan 190 tambahan dan 190 penghapusan
  1. 10 10
      src/Benchfib.js
  2. 18 18
      src/Examples.js
  3. 156 156
      src/IDE.js
  4. 6 6
      src/IDE.st

+ 10 - 10
src/Benchfib.js

@@ -13,7 +13,7 @@ $core.method({
 selector: "main",
 protocol: "not yet classified",
 fn: function (){
-var self=this;
+var self=this,$self=this;
 var result;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
@@ -39,16 +39,16 @@ $core.method({
 selector: "benchFib",
 protocol: "*Benchfib",
 fn: function (){
-var self=this;
+var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
 var $1,$4,$3,$2;
-$1=self.__lt((2));
+$1=$self.__lt((2));
 if($core.assert($1)){
 return (1);
 } else {
-$4=self.__minus((1));
+$4=$self.__minus((1));
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.sendIdx["-"]=1;
 //>>excludeEnd("ctx");
@@ -56,7 +56,7 @@ $3=$recv($4)._benchFib();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.sendIdx["benchFib"]=1;
 //>>excludeEnd("ctx");
-$2=$recv($3).__plus($recv(self.__minus((2)))._benchFib());
+$2=$recv($3).__plus($recv($self.__minus((2)))._benchFib());
 return $recv($2).__plus((1));
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.sendIdx["+"]=1;
@@ -80,7 +80,7 @@ $core.method({
 selector: "benchmark",
 protocol: "*Benchfib",
 fn: function (){
-var self=this;
+var self=this,$self=this;
 var size,flags,prime,k,count;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
@@ -175,7 +175,7 @@ $core.method({
 selector: "jsbenchFib",
 protocol: "*Benchfib",
 fn: function (){
-var self=this;
+var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
@@ -202,7 +202,7 @@ $core.method({
 selector: "jsbenchmark",
 protocol: "*Benchfib",
 fn: function (){
-var self=this;
+var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
@@ -247,7 +247,7 @@ $core.method({
 selector: "jstinyBenchmarks",
 protocol: "*Benchfib",
 fn: function (){
-var self=this;
+var self=this,$self=this;
 var t1,t2,r,n1,n2;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
@@ -368,7 +368,7 @@ $core.method({
 selector: "tinyBenchmarks",
 protocol: "*Benchfib",
 fn: function (){
-var self=this;
+var self=this,$self=this;
 var t1,t2,r,n1,n2;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {

+ 18 - 18
src/Examples.js

@@ -15,16 +15,16 @@ $core.method({
 selector: "decrease",
 protocol: "actions",
 fn: function (){
-var self=this;
+var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-self["@count"]=$recv(self["@count"]).__minus((1));
-$recv(self["@header"])._contents_((function(html){
+$self["@count"]=$recv($self["@count"]).__minus((1));
+$recv($self["@header"])._contents_((function(html){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
-return $recv(html)._with_($recv(self["@count"])._asString());
+return $recv(html)._with_($recv($self["@count"])._asString());
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)});
 //>>excludeEnd("ctx");
@@ -48,16 +48,16 @@ $core.method({
 selector: "increase",
 protocol: "actions",
 fn: function (){
-var self=this;
+var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-self["@count"]=$recv(self["@count"]).__plus((1));
-$recv(self["@header"])._contents_((function(html){
+$self["@count"]=$recv($self["@count"]).__plus((1));
+$recv($self["@header"])._contents_((function(html){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
-return $recv(html)._with_($recv(self["@count"])._asString());
+return $recv(html)._with_($recv($self["@count"])._asString());
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)});
 //>>excludeEnd("ctx");
@@ -81,7 +81,7 @@ $core.method({
 selector: "initialize",
 protocol: "initialization",
 fn: function (){
-var self=this;
+var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
@@ -89,11 +89,11 @@ return $core.withContext(function($ctx1) {
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.supercall = true,
 //>>excludeEnd("ctx");
-($globals.Counter.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
+($globals.Counter.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.supercall = false;
 //>>excludeEnd("ctx");;
-self["@count"]=(0);
+$self["@count"]=(0);
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Counter)});
@@ -113,17 +113,17 @@ $core.method({
 selector: "renderOn:",
 protocol: "rendering",
 fn: function (html){
-var self=this;
+var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
 var $1,$2,$3,$4;
 $1=$recv(html)._h1();
-$recv($1)._with_($recv(self["@count"])._asString());
+$recv($1)._with_($recv($self["@count"])._asString());
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.sendIdx["with:"]=1;
 //>>excludeEnd("ctx");
-self["@header"]=$recv($1)._yourself();
+$self["@header"]=$recv($1)._yourself();
 $2=$recv(html)._button();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.sendIdx["button"]=1;
@@ -136,7 +136,7 @@ $3=$recv($2)._onClick_((function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
-return self._increase();
+return $self._increase();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
 //>>excludeEnd("ctx");
@@ -150,7 +150,7 @@ $recv($4)._onClick_((function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
-return self._decrease();
+return $self._decrease();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
 //>>excludeEnd("ctx");
@@ -175,11 +175,11 @@ $core.method({
 selector: "tryExample",
 protocol: "example",
 fn: function (){
-var self=this;
+var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-$recv(self._new())._appendToJQuery_("body"._asJQuery());
+$recv($self._new())._appendToJQuery_("body"._asJQuery());
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"tryExample",{},$globals.Counter.a$cls)});

File diff ditekan karena terlalu besar
+ 156 - 156
src/IDE.js


+ 6 - 6
src/IDE.st

@@ -210,7 +210,7 @@ selection
 !
 
 setEditorOn: aTextarea
-	<inlineJS: 'self["@editor"] = self._class()._codeMirror().fromTextArea(aTextarea, {
+	<inlineJS: '$self["@editor"] = $self._class()._codeMirror().fromTextArea(aTextarea, {
 		theme: "ide.codeMirrorTheme"._settingValueIfAbsent_("default"),
 		mode: "text/x-stsrc",
 		lineNumbers: true,
@@ -262,17 +262,17 @@ focus
 handleKeyDown: anEvent
 	<inlineJS: 'if(anEvent.ctrlKey) {
 		if(anEvent.keyCode === 80) { //ctrl+p
-			self._printIt();
+			$self._printIt();
 			anEvent.preventDefault();
 			return false;
 		}
 		if(anEvent.keyCode === 68) { //ctrl+d
-			self._doIt();
+			$self._doIt();
 			anEvent.preventDefault();
 			return false;
 		}
 		if(anEvent.keyCode === 73) { //ctrl+i
-			self._inspectIt();
+			$self._inspectIt();
 			anEvent.preventDefault();
 			return false;
 		}
@@ -342,7 +342,7 @@ initialize
 !
 
 setupCodeMirror
-	<inlineJS: 'self._codeMirror().keyMap["default"].fallthrough = ["basic"]'>
+	<inlineJS: '$self._codeMirror().keyMap["default"].fallthrough = ["basic"]'>
 ! !
 
 Widget subclass: #TabManager
@@ -864,7 +864,7 @@ disableSaveButton
 handleSourceAreaKeyDown: anEvent
 	<inlineJS: 'if(anEvent.ctrlKey) {
 		if(anEvent.keyCode === 83) { //ctrl+s
-			self._compile();
+			$self._compile();
 			anEvent.preventDefault();
 			return false;
 		}

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini