Browse Source

Amber refactor.

Herby Vojčík 5 years ago
parent
commit
6158f12ebb
2 changed files with 12 additions and 10 deletions
  1. 9 5
      src/Web-Snippets.js
  2. 3 5
      src/Web-Snippets.st

+ 9 - 5
src/Web-Snippets.js

@@ -113,7 +113,8 @@ var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-$recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_($recv($recv((function(htmlReceiver){
+var $2,$1;
+$2=$recv($recv((function(htmlReceiver){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
@@ -121,7 +122,10 @@ return $recv(htmlReceiver)._snippet_(anElement);
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({htmlReceiver:htmlReceiver},$ctx1,1)});
 //>>excludeEnd("ctx");
-}))._currySelf())._asCompiledMethod_(aString),$globals.HTMLCanvas,"**snippets");
+}))._currySelf())._asCompiledMethod_(aString);
+$recv($2)._protocol_("**snippets");
+$1=$recv($2)._yourself();
+$recv($globals.HTMLCanvas)._addCompiledMethod_($1);
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"snippetAt:compile:",{aString:aString,anElement:anElement},$globals.HTMLSnippet)});
@@ -129,10 +133,10 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["aString", "anElement"],
-source: "snippetAt: aString compile: anElement\x0a\x09\x22Method generation for the snippet.\x0a\x09The selector is aString, the method block uses anElement\x22\x0a\x09\x0a\x09ClassBuilder new\x0a\x09\x09installMethod: ([ :htmlReceiver | htmlReceiver snippet: anElement ]\x0a\x09\x09\x09currySelf asCompiledMethod: aString)\x0a\x09\x09forClass: HTMLCanvas\x0a\x09\x09protocol: '**snippets'",
-referencedClasses: ["ClassBuilder", "HTMLCanvas"],
+source: "snippetAt: aString compile: anElement\x0a\x09\x22Method generation for the snippet.\x0a\x09The selector is aString, the method block uses anElement\x22\x0a\x09\x0a\x09HTMLCanvas addCompiledMethod:\x0a\x09\x09(([ :htmlReceiver | htmlReceiver snippet: anElement ]\x0a\x09\x09\x09currySelf asCompiledMethod: aString) protocol: '**snippets'; yourself)",
+referencedClasses: ["HTMLCanvas"],
 //>>excludeEnd("ide");
-messageSends: ["installMethod:forClass:protocol:", "new", "asCompiledMethod:", "currySelf", "snippet:"]
+messageSends: ["addCompiledMethod:", "protocol:", "asCompiledMethod:", "currySelf", "snippet:", "yourself"]
 }),
 $globals.HTMLSnippet);
 

+ 3 - 5
src/Web-Snippets.st

@@ -67,11 +67,9 @@ snippetAt: aString compile: anElement
 	"Method generation for the snippet.
 	The selector is aString, the method block uses anElement"
 	
-	ClassBuilder new
-		installMethod: ([ :htmlReceiver | htmlReceiver snippet: anElement ]
-			currySelf asCompiledMethod: aString)
-		forClass: HTMLCanvas
-		protocol: '**snippets'
+	HTMLCanvas addCompiledMethod:
+		(([ :htmlReceiver | htmlReceiver snippet: anElement ]
+			currySelf asCompiledMethod: aString) protocol: '**snippets'; yourself)
 ! !
 
 !HTMLSnippet methodsFor: 'private'!