Prechádzať zdrojové kódy

TrappedDataCarrier>>{source,source:} and setting it

Herbert Vojčík 10 rokov pred
rodič
commit
b6f40aa4dd
2 zmenil súbory, kde vykonal 51 pridanie a 4 odobranie
  1. 40 3
      js/Trapped-Frontend.js
  2. 11 1
      st/Trapped-Frontend.st

+ 40 - 3
js/Trapped-Frontend.js

@@ -2,7 +2,7 @@ define("gh_herby_trapped/Trapped-Frontend", ["amber_vm/smalltalk", "amber_vm/nil
 smalltalk.addPackage('Trapped-Frontend');
 smalltalk.packages["Trapped-Frontend"].transport = {"type":"amd","amdNamespace":"gh_herby_trapped"};
 
-smalltalk.addClass('TrappedDataCarrier', smalltalk.Object, ['target', 'model', 'chain'], 'Trapped-Frontend');
+smalltalk.addClass('TrappedDataCarrier', smalltalk.Object, ['target', 'model', 'chain', 'source'], 'Trapped-Frontend');
 smalltalk.addMethod(
 smalltalk.method({
 selector: "chain:",
@@ -36,6 +36,40 @@ referencedClasses: []
 }),
 smalltalk.TrappedDataCarrier);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "source",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self["@source"];
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.TrappedDataCarrier)})},
+args: [],
+source: "source\x0a\x09^source",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.TrappedDataCarrier);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "source:",
+category: 'accessing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@source"]=anObject;
+return self}, function($ctx1) {$ctx1.fill(self,"source:",{anObject:anObject},smalltalk.TrappedDataCarrier)})},
+args: ["anObject"],
+source: "source: anObject\x0a\x09source := anObject",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.TrappedDataCarrier);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "target",
@@ -215,14 +249,17 @@ _st(self["@processors"])._do_((function(each){
 return smalltalk.withContext(function($ctx2) {
 return _st(each)._installToView_toModel_(toViewCarrier,toModelCarrier);
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+_st(toViewCarrier)._source_(aSnapshot);
+$ctx1.sendIdx["source:"]=1;
+_st(toModelCarrier)._source_(aTagBrush);
 $1=_st(_st(toViewCarrier)._value()).__eq(true);
 if(smalltalk.assert($1)){
 _st(_st(toViewCarrier)._copy())._proceed();
 };
 return self}, function($ctx1) {$ctx1.fill(self,"forSnapshot:andBrush:",{aSnapshot:aSnapshot,aTagBrush:aTagBrush,toViewCarrier:toViewCarrier,toModelCarrier:toModelCarrier},smalltalk.TrappedProcessingChain)})},
 args: ["aSnapshot", "aTagBrush"],
-source: "forSnapshot: aSnapshot andBrush: aTagBrush\x0a\x09| toViewCarrier toModelCarrier |\x0a\x09toViewCarrier := TrappedDataCarrierToView on: self target: aTagBrush.\x0a\x09toModelCarrier := TrappedDataCarrierToModel on: self target: aSnapshot.\x0a\x09processors do: [ :each | each installToView: toViewCarrier toModel: toModelCarrier ].\x0a\x09toViewCarrier value = true ifTrue: [ toViewCarrier copy proceed ]",
-messageSends: ["on:target:", "do:", "installToView:toModel:", "ifTrue:", "=", "value", "proceed", "copy"],
+source: "forSnapshot: aSnapshot andBrush: aTagBrush\x0a\x09| toViewCarrier toModelCarrier |\x0a\x09toViewCarrier := TrappedDataCarrierToView on: self target: aTagBrush.\x0a\x09toModelCarrier := TrappedDataCarrierToModel on: self target: aSnapshot.\x0a\x09processors do: [ :each | each installToView: toViewCarrier toModel: toModelCarrier ].\x0a\x09toViewCarrier source: aSnapshot.\x0a\x09toModelCarrier source: aTagBrush.\x0a\x09toViewCarrier value = true ifTrue: [ toViewCarrier copy proceed ]",
+messageSends: ["on:target:", "do:", "installToView:toModel:", "source:", "ifTrue:", "=", "value", "proceed", "copy"],
 referencedClasses: ["TrappedDataCarrierToView", "TrappedDataCarrierToModel"]
 }),
 smalltalk.TrappedProcessingChain);

+ 11 - 1
st/Trapped-Frontend.st

@@ -1,6 +1,6 @@
 Smalltalk current createPackage: 'Trapped-Frontend'!
 Object subclass: #TrappedDataCarrier
-	instanceVariableNames: 'target model chain'
+	instanceVariableNames: 'target model chain source'
 	package: 'Trapped-Frontend'!
 
 !TrappedDataCarrier methodsFor: 'accessing'!
@@ -9,6 +9,14 @@ chain: aProcessingChain
 	chain := aProcessingChain
 !
 
+source
+	^source
+!
+
+source: anObject
+	source := anObject
+!
+
 target
 	^target
 !
@@ -92,6 +100,8 @@ forSnapshot: aSnapshot andBrush: aTagBrush
 	toViewCarrier := TrappedDataCarrierToView on: self target: aTagBrush.
 	toModelCarrier := TrappedDataCarrierToModel on: self target: aSnapshot.
 	processors do: [ :each | each installToView: toViewCarrier toModel: toModelCarrier ].
+	toViewCarrier source: aSnapshot.
+	toModelCarrier source: aTagBrush.
 	toViewCarrier value = true ifTrue: [ toViewCarrier copy proceed ]
 ! !