Browse Source

Stop using fn.

Herby Vojčík 5 years ago
parent
commit
e3973b288b
4 changed files with 14 additions and 66 deletions
  1. 13 39
      lang/src/Compiler-Core.js
  2. 1 4
      lang/src/Compiler-Core.st
  3. 0 19
      lang/src/Kernel-Methods.js
  4. 0 4
      lang/src/Kernel-Methods.st

+ 13 - 39
lang/src/Compiler-Core.js

@@ -559,69 +559,43 @@ selector: "compile:forClass:protocol:",
 protocol: "compiling",
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["aString", "aClass", "anotherString"],
-source: "compile: aString forClass: aClass protocol: anotherString\x0a\x09| compilationResult result pragmas closure closureFactory |\x0a\x09compilationResult :=\x0a\x09\x09self compileSource: aString forClass: aClass protocol: anotherString.\x0a\x09pragmas := compilationResult removeKey: #pragmas.\x0a\x09closure := (compilationResult removeKey: #fn ifAbsent: [])\x0a\x09\x09ifNotNil: [ :js | self eval: js forPackage: self currentPackage ].\x0a\x09closureFactory := (compilationResult removeKey: #instantiateFn ifAbsent: [])\x0a\x09\x09ifNotNil: [ :js | self eval: js forPackage: self currentPackage ].\x0a\x09result := Smalltalk core method: compilationResult.\x0a\x09result protocol: anotherString; pragmas: pragmas.\x0a\x09closure ifNotNil: [ result fn: closure ].\x0a\x09closureFactory ifNotNil: [ result instantiateFn: closureFactory ].\x0a\x09^ result",
+source: "compile: aString forClass: aClass protocol: anotherString\x0a\x09| compilationResult result pragmas closureFactory |\x0a\x09compilationResult :=\x0a\x09\x09self compileSource: aString forClass: aClass protocol: anotherString.\x0a\x09pragmas := compilationResult removeKey: #pragmas.\x0a\x09closureFactory := (compilationResult removeKey: #instantiateFn ifAbsent: [])\x0a\x09\x09ifNotNil: [ :js | self eval: js forPackage: self currentPackage ].\x0a\x09result := Smalltalk core method: compilationResult.\x0a\x09result protocol: anotherString; pragmas: pragmas.\x0a\x09closureFactory ifNotNil: [ result instantiateFn: closureFactory ].\x0a\x09^ result",
 referencedClasses: ["Smalltalk"],
 //>>excludeEnd("ide");
 pragmas: [],
-messageSends: ["compileSource:forClass:protocol:", "removeKey:", "ifNotNil:", "removeKey:ifAbsent:", "eval:forPackage:", "currentPackage", "method:", "core", "protocol:", "pragmas:", "fn:", "instantiateFn:"]
+messageSends: ["compileSource:forClass:protocol:", "removeKey:", "ifNotNil:", "removeKey:ifAbsent:", "eval:forPackage:", "currentPackage", "method:", "core", "protocol:", "pragmas:", "instantiateFn:"]
 }, function ($methodClass){ return function (aString,aClass,anotherString){
 var self=this,$self=this;
-var compilationResult,result,pragmas,closure,closureFactory;
+var compilationResult,result,pragmas,closureFactory;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-var $1,$2,$3,$4,$5,$6,$receiver;
+var $1,$2,$3,$receiver;
 compilationResult=$self._compileSource_forClass_protocol_(aString,aClass,anotherString);
 pragmas=$recv(compilationResult)._removeKey_("pragmas");
-$1=$recv(compilationResult)._removeKey_ifAbsent_("fn",(function(){
+$1=$recv(compilationResult)._removeKey_ifAbsent_("instantiateFn",(function(){
 
 }));
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx1.sendIdx["removeKey:ifAbsent:"]=1;
-//>>excludeEnd("ctx");
 if(($receiver = $1) == null || $receiver.a$nil){
-closure=$1;
-} else {
-var js;
-js=$receiver;
-$2=$self._currentPackage();
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx1.sendIdx["currentPackage"]=1;
-//>>excludeEnd("ctx");
-closure=$self._eval_forPackage_(js,$2);
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx1.sendIdx["eval:forPackage:"]=1;
-//>>excludeEnd("ctx");
-}
-$3=$recv(compilationResult)._removeKey_ifAbsent_("instantiateFn",(function(){
-
-}));
-if(($receiver = $3) == null || $receiver.a$nil){
-closureFactory=$3;
+closureFactory=$1;
 } else {
 var js;
 js=$receiver;
 closureFactory=$self._eval_forPackage_(js,$self._currentPackage());
 }
 result=$recv($recv($globals.Smalltalk)._core())._method_(compilationResult);
-$4=result;
-$recv($4)._protocol_(anotherString);
-$recv($4)._pragmas_(pragmas);
-$5=closure;
-if(($receiver = $5) == null || $receiver.a$nil){
-$5;
-} else {
-$recv(result)._fn_(closure);
-}
-$6=closureFactory;
-if(($receiver = $6) == null || $receiver.a$nil){
-$6;
+$2=result;
+$recv($2)._protocol_(anotherString);
+$recv($2)._pragmas_(pragmas);
+$3=closureFactory;
+if(($receiver = $3) == null || $receiver.a$nil){
+$3;
 } else {
 $recv(result)._instantiateFn_(closureFactory);
 }
 return result;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString,compilationResult:compilationResult,result:result,pragmas:pragmas,closure:closure,closureFactory:closureFactory})});
+}, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString,compilationResult:compilationResult,result:result,pragmas:pragmas,closureFactory:closureFactory})});
 //>>excludeEnd("ctx");
 }; }),
 $globals.Compiler);

+ 1 - 4
lang/src/Compiler-Core.st

@@ -168,17 +168,14 @@ ast: aString forClass: aClass protocol: anotherString
 !
 
 compile: aString forClass: aClass protocol: anotherString
-	| compilationResult result pragmas closure closureFactory |
+	| compilationResult result pragmas closureFactory |
 	compilationResult :=
 		self compileSource: aString forClass: aClass protocol: anotherString.
 	pragmas := compilationResult removeKey: #pragmas.
-	closure := (compilationResult removeKey: #fn ifAbsent: [])
-		ifNotNil: [ :js | self eval: js forPackage: self currentPackage ].
 	closureFactory := (compilationResult removeKey: #instantiateFn ifAbsent: [])
 		ifNotNil: [ :js | self eval: js forPackage: self currentPackage ].
 	result := Smalltalk core method: compilationResult.
 	result protocol: anotherString; pragmas: pragmas.
-	closure ifNotNil: [ result fn: closure ].
 	closureFactory ifNotNil: [ result instantiateFn: closureFactory ].
 	^ result
 !

+ 0 - 19
lang/src/Kernel-Methods.js

@@ -1004,25 +1004,6 @@ return $self.fn;
 }; }),
 $globals.CompiledMethod);
 
-$core.addMethod(
-$core.method({
-selector: "fn:",
-protocol: "accessing",
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aBlock"],
-source: "fn: aBlock\x0a\x09fn := aBlock",
-referencedClasses: [],
-//>>excludeEnd("ide");
-pragmas: [],
-messageSends: []
-}, function ($methodClass){ return function (aBlock){
-var self=this,$self=this;
-$self.fn=aBlock;
-return self;
-
-}; }),
-$globals.CompiledMethod);
-
 $core.addMethod(
 $core.method({
 selector: "instantiateFn",

+ 0 - 4
lang/src/Kernel-Methods.st

@@ -241,10 +241,6 @@ fn
 	^ fn
 !
 
-fn: aBlock
-	fn := aBlock
-!
-
 instantiateFn
 	^ instantiateFn
 !