Kaynağa Gözat

Double-dispatch attr putting through key class.

Herbert Vojčík 9 yıl önce
ebeveyn
işleme
705e312785
2 değiştirilmiş dosya ile 34 ekleme ve 4 silme
  1. 27 3
      src/Silk.js
  2. 7 1
      src/Silk.st

+ 27 - 3
src/Silk.js

@@ -185,7 +185,7 @@ var self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-$recv(aSilk)._attrAt_put_(self["@key"],self["@value"]);
+$recv(self["@key"])._attrPut_on_(self["@value"],aSilk);
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"renderOnSilk:",{aSilk:aSilk},$globals.Association)});
@@ -193,10 +193,10 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["aSilk"],
-source: "renderOnSilk: aSilk\x0a\x09aSilk attrAt: key put: value",
+source: "renderOnSilk: aSilk\x0a\x09key attrPut: value on: aSilk",
 referencedClasses: [],
 //>>excludeEnd("ide");
-messageSends: ["attrAt:put:"]
+messageSends: ["attrPut:on:"]
 }),
 $globals.Association);
 
@@ -326,4 +326,28 @@ messageSends: []
 }),
 $globals.Object);
 
+$core.addMethod(
+$core.method({
+selector: "attrPut:on:",
+protocol: '*Silk',
+fn: function (anObject,aSilk){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+$recv(aSilk)._attrAt_put_(self,anObject);
+return self;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"attrPut:on:",{anObject:anObject,aSilk:aSilk},$globals.String)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["anObject", "aSilk"],
+source: "attrPut: anObject on: aSilk\x0a\x09aSilk attrAt: self put: anObject",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["attrAt:put:"]
+}),
+$globals.String);
+
 });

+ 7 - 1
src/Silk.st

@@ -87,7 +87,7 @@ doesNotUnderstand: aMessage
 !Association methodsFor: '*Silk'!
 
 renderOnSilk: aSilk
-	aSilk attrAt: key put: value
+	key attrPut: value on: aSilk
 ! !
 
 !BlockClosure methodsFor: '*Silk'!
@@ -118,3 +118,9 @@ renderOnSilk: aSilk
 	^ nil
 ! !
 
+!String methodsFor: '*Silk'!
+
+attrPut: anObject on: aSilk
+	aSilk attrAt: self put: anObject
+! !
+