Browse Source

Move TrappedPosition into Trapped-Frontend.

Herbert Vojčík 6 years ago
parent
commit
f76ef11509

+ 4 - 7
example-todo/src/Trapped-Todo.js

@@ -88,11 +88,8 @@ $ctx1.supercall = true,
 $ctx1.supercall = false;
 //>>excludeEnd("ctx");;
 axon=$recv($globals.SimpleAxon)._new();
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx1.sendIdx["new"]=1;
-//>>excludeEnd("ctx");
 $recv(axon)._registerIn_(self);
-$recv(axon)._addInterest_($recv($recv($globals.InterestedInTrapPathSubtree)._new())._aspect_block_([["todos"]],(function(){
+$recv(axon)._addInterest_($recv($globals.TrappedPosition)._interestOn_block_([["todos"], nil],(function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
@@ -123,10 +120,10 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: [],
-source: "initialize\x0a\x09| axon |\x0a\x09super initialize.\x0a\x0a    axon := SimpleAxon new.\x0a\x09axon registerIn: self.\x0a\x09\x0a\x09axon addInterest: (\x0a\x09\x09InterestedInTrapPathSubtree new\x0a\x09\x09\x09aspect: #((todos))\x0a\x09\x09\x09block: [ axon changed: #((remaining)) ]).\x0a\x0a    [ self axes: #((todos)) transform: [{\x0a        #{'text'->'learn trapped'. 'done'->true}.\x0a        #{'text'->'build a trapped app'. 'done'->false}\x0a    }]] valueWithTimeout: 2000.\x0a\x0a\x09title := 'Todo'.\x0a\x09todoText := nil.\x0a\x09todos := nil",
-referencedClasses: ["SimpleAxon", "InterestedInTrapPathSubtree"],
+source: "initialize\x0a\x09| axon |\x0a\x09super initialize.\x0a\x0a    axon := SimpleAxon new.\x0a\x09axon registerIn: self.\x0a\x09\x0a\x09axon addInterest: (TrappedPosition\x0a\x09\x09interestOn: #((todos) nil)\x0a\x09\x09block: [ axon changed: #((remaining)) ]).\x0a\x0a    [ self axes: #((todos)) transform: [{\x0a        #{'text'->'learn trapped'. 'done'->true}.\x0a        #{'text'->'build a trapped app'. 'done'->false}\x0a    }]] valueWithTimeout: 2000.\x0a\x0a\x09title := 'Todo'.\x0a\x09todoText := nil.\x0a\x09todos := nil",
+referencedClasses: ["SimpleAxon", "TrappedPosition"],
 //>>excludeEnd("ide");
-messageSends: ["initialize", "new", "registerIn:", "addInterest:", "aspect:block:", "changed:", "valueWithTimeout:", "axes:transform:"]
+messageSends: ["initialize", "new", "registerIn:", "addInterest:", "interestOn:block:", "changed:", "valueWithTimeout:", "axes:transform:"]
 }),
 $globals.TrappedTodo);
 

+ 3 - 4
example-todo/src/Trapped-Todo.st

@@ -86,10 +86,9 @@ initialize
     axon := SimpleAxon new.
 	axon registerIn: self.
 	
-	axon addInterest: (
-		InterestedInTrapPathSubtree new
-			aspect: #((todos))
-			block: [ axon changed: #((remaining)) ]).
+	axon addInterest: (TrappedPosition
+		interestOn: #((todos) nil)
+		block: [ axon changed: #((remaining)) ]).
 
     [ self axes: #((todos)) transform: [{
         #{'text'->'learn trapped'. 'done'->true}.

+ 0 - 185
src/Trapped-Backend.js

@@ -128,189 +128,4 @@ messageSends: ["root:", "new"]
 }),
 $globals.Isolator.a$cls);
 
-
-$core.addClass("TrappedPosition", $globals.Object, ["path", "model"], "Trapped-Backend");
-$core.addMethod(
-$core.method({
-selector: "interestOn:block:",
-protocol: "private",
-fn: function (anAspect,aBlock){
-var self=this,$self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $1,$3,$2;
-$1=$recv($recv(anAspect)._notEmpty())._and_((function(){
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx2) {
-//>>excludeEnd("ctx");
-return $recv($recv(anAspect)._last())._isNil();
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
-//>>excludeEnd("ctx");
-}));
-if($core.assert($1)){
-$3=$recv($globals.InterestedThruAxes)._new();
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx1.sendIdx["new"]=1;
-//>>excludeEnd("ctx");
-$2=$recv($3)._aspect_block_($recv(anAspect)._allButLast(),aBlock);
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx1.sendIdx["aspect:block:"]=1;
-//>>excludeEnd("ctx");
-return $2;
-} else {
-return $recv($recv($globals.InterestedUpToAxes)._new())._aspect_block_(anAspect,aBlock);
-}
-return self;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"interestOn:block:",{anAspect:anAspect,aBlock:aBlock},$globals.TrappedPosition)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["anAspect", "aBlock"],
-source: "interestOn: anAspect block: aBlock\x0a\x09(anAspect notEmpty and: [ anAspect last isNil ])\x0a\x09\x09ifTrue: [ ^ InterestedThruAxes new aspect: anAspect allButLast block: aBlock ]\x0a\x09\x09ifFalse: [ ^ InterestedUpToAxes new aspect: anAspect block: aBlock ]",
-referencedClasses: ["InterestedThruAxes", "InterestedUpToAxes"],
-//>>excludeEnd("ide");
-messageSends: ["ifTrue:ifFalse:", "and:", "notEmpty", "isNil", "last", "aspect:block:", "new", "allButLast"]
-}),
-$globals.TrappedPosition);
-
-$core.addMethod(
-$core.method({
-selector: "model",
-protocol: "accessing",
-fn: function (){
-var self=this,$self=this;
-return $self["@model"];
-
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: [],
-source: "model\x0a\x09^model",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: []
-}),
-$globals.TrappedPosition);
-
-$core.addMethod(
-$core.method({
-selector: "modify:",
-protocol: "action",
-fn: function (aBlock){
-var self=this,$self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-$recv($self._model())._axes_transform_($self._path(),aBlock);
-return self;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"modify:",{aBlock:aBlock},$globals.TrappedPosition)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aBlock"],
-source: "modify: aBlock\x0a\x09self model axes: self path transform: aBlock",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["axes:transform:", "model", "path"]
-}),
-$globals.TrappedPosition);
-
-$core.addMethod(
-$core.method({
-selector: "path",
-protocol: "accessing",
-fn: function (){
-var self=this,$self=this;
-return $self["@path"];
-
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: [],
-source: "path\x0a\x09^path",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: []
-}),
-$globals.TrappedPosition);
-
-$core.addMethod(
-$core.method({
-selector: "path:model:",
-protocol: "accessing",
-fn: function (anArray,aTrappedMW){
-var self=this,$self=this;
-$self["@path"]=anArray;
-$self["@model"]=aTrappedMW;
-return self;
-
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["anArray", "aTrappedMW"],
-source: "path: anArray model: aTrappedMW\x0a\x09path := anArray.\x0a    model := aTrappedMW",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: []
-}),
-$globals.TrappedPosition);
-
-$core.addMethod(
-$core.method({
-selector: "read:",
-protocol: "action",
-fn: function (aBlock){
-var self=this,$self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-$recv($self._model())._axes_consume_($self._path(),aBlock);
-return self;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"read:",{aBlock:aBlock},$globals.TrappedPosition)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aBlock"],
-source: "read: aBlock\x0a\x09self model axes: self path consume: aBlock",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["axes:consume:", "model", "path"]
-}),
-$globals.TrappedPosition);
-
-$core.addMethod(
-$core.method({
-selector: "watch:",
-protocol: "action",
-fn: function (aBlock){
-var self=this,$self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-$recv($recv($self._model())._registeredAxon())._addInterest_($self._interestOn_block_($self._path(),(function(){
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx2) {
-//>>excludeEnd("ctx");
-return $self._read_(aBlock);
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
-//>>excludeEnd("ctx");
-})));
-return self;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"watch:",{aBlock:aBlock},$globals.TrappedPosition)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aBlock"],
-source: "watch: aBlock\x0a\x09self model registeredAxon addInterest: (self\x0a\x09\x09interestOn: self path\x0a\x09\x09block: [ self read: aBlock ])",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["addInterest:", "registeredAxon", "model", "interestOn:block:", "path", "read:"]
-}),
-$globals.TrappedPosition);
-
-
 });

+ 0 - 43
src/Trapped-Backend.st

@@ -36,46 +36,3 @@ on: anObject
 ^self new root: anObject
 ! !
 
-Object subclass: #TrappedPosition
-	instanceVariableNames: 'path model'
-	package: 'Trapped-Backend'!
-
-!TrappedPosition methodsFor: 'accessing'!
-
-model
-	^model
-!
-
-path
-	^path
-!
-
-path: anArray model: aTrappedMW
-	path := anArray.
-    model := aTrappedMW
-! !
-
-!TrappedPosition methodsFor: 'action'!
-
-modify: aBlock
-	self model axes: self path transform: aBlock
-!
-
-read: aBlock
-	self model axes: self path consume: aBlock
-!
-
-watch: aBlock
-	self model registeredAxon addInterest: (self
-		interestOn: self path
-		block: [ self read: aBlock ])
-! !
-
-!TrappedPosition methodsFor: 'private'!
-
-interestOn: anAspect block: aBlock
-	(anAspect notEmpty and: [ anAspect last isNil ])
-		ifTrue: [ ^ InterestedThruAxes new aspect: anAspect allButLast block: aBlock ]
-		ifFalse: [ ^ InterestedUpToAxes new aspect: anAspect block: aBlock ]
-! !
-

+ 259 - 74
src/Trapped-Frontend.js

@@ -1,8 +1,8 @@
 define(["amber/boot"
 //>>excludeStart("imports", pragmas.excludeImports);
-, "axxord/Axxord", "amber/web/Web"
+, "amber/web/Web", "axxord/Axxord"
 //>>excludeEnd("imports");
-, "amber/web/Web", "amber_core/Kernel-Collections", "amber_core/Kernel-Objects", "trapped/Trapped-Backend"], function($boot
+, "amber/web/Web", "amber_core/Kernel-Collections", "amber_core/Kernel-Objects"], function($boot
 //>>excludeStart("imports", pragmas.excludeImports);
 
 //>>excludeEnd("imports");
@@ -299,6 +299,263 @@ $globals.TrappedDataCarrierToView);
 
 
 
+$core.addClass("TrappedPosition", $globals.Object, ["path", "model"], "Trapped-Frontend");
+$core.addMethod(
+$core.method({
+selector: "model",
+protocol: "accessing",
+fn: function (){
+var self=this,$self=this;
+return $self["@model"];
+
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "model\x0a\x09^model",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: []
+}),
+$globals.TrappedPosition);
+
+$core.addMethod(
+$core.method({
+selector: "modify:",
+protocol: "action",
+fn: function (aBlock){
+var self=this,$self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+$recv($self._model())._axes_transform_($self._path(),aBlock);
+return self;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"modify:",{aBlock:aBlock},$globals.TrappedPosition)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aBlock"],
+source: "modify: aBlock\x0a\x09self model axes: self path transform: aBlock",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["axes:transform:", "model", "path"]
+}),
+$globals.TrappedPosition);
+
+$core.addMethod(
+$core.method({
+selector: "path",
+protocol: "accessing",
+fn: function (){
+var self=this,$self=this;
+return $self["@path"];
+
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "path\x0a\x09^path",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: []
+}),
+$globals.TrappedPosition);
+
+$core.addMethod(
+$core.method({
+selector: "path:model:",
+protocol: "accessing",
+fn: function (anArray,aTrappedMW){
+var self=this,$self=this;
+$self["@path"]=anArray;
+$self["@model"]=aTrappedMW;
+return self;
+
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["anArray", "aTrappedMW"],
+source: "path: anArray model: aTrappedMW\x0a\x09path := anArray.\x0a    model := aTrappedMW",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: []
+}),
+$globals.TrappedPosition);
+
+$core.addMethod(
+$core.method({
+selector: "read:",
+protocol: "action",
+fn: function (aBlock){
+var self=this,$self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+$recv($self._model())._axes_consume_($self._path(),aBlock);
+return self;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"read:",{aBlock:aBlock},$globals.TrappedPosition)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aBlock"],
+source: "read: aBlock\x0a\x09self model axes: self path consume: aBlock",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["axes:consume:", "model", "path"]
+}),
+$globals.TrappedPosition);
+
+$core.addMethod(
+$core.method({
+selector: "watch:",
+protocol: "action",
+fn: function (aBlock){
+var self=this,$self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+$recv($recv($self._model())._registeredAxon())._addInterest_($recv($self._class())._interestOn_block_($self._path(),(function(){
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx2) {
+//>>excludeEnd("ctx");
+return $self._read_(aBlock);
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
+//>>excludeEnd("ctx");
+})));
+return self;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"watch:",{aBlock:aBlock},$globals.TrappedPosition)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aBlock"],
+source: "watch: aBlock\x0a\x09self model registeredAxon addInterest: (self class\x0a\x09\x09interestOn: self path\x0a\x09\x09block: [ self read: aBlock ])",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["addInterest:", "registeredAxon", "model", "interestOn:block:", "class", "path", "read:"]
+}),
+$globals.TrappedPosition);
+
+
+$core.addMethod(
+$core.method({
+selector: "interestOn:block:",
+protocol: "factory",
+fn: function (anAspect,aBlock){
+var self=this,$self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1,$3,$2;
+$1=$recv($recv(anAspect)._notEmpty())._and_((function(){
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx2) {
+//>>excludeEnd("ctx");
+return $recv($recv(anAspect)._last())._isNil();
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
+//>>excludeEnd("ctx");
+}));
+if($core.assert($1)){
+$3=$recv($globals.InterestedThruAxes)._new();
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx1.sendIdx["new"]=1;
+//>>excludeEnd("ctx");
+$2=$recv($3)._aspect_block_($recv(anAspect)._allButLast(),aBlock);
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx1.sendIdx["aspect:block:"]=1;
+//>>excludeEnd("ctx");
+return $2;
+} else {
+return $recv($recv($globals.InterestedUpToAxes)._new())._aspect_block_(anAspect,aBlock);
+}
+return self;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"interestOn:block:",{anAspect:anAspect,aBlock:aBlock},$globals.TrappedPosition.a$cls)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["anAspect", "aBlock"],
+source: "interestOn: anAspect block: aBlock\x0a\x09(anAspect notEmpty and: [ anAspect last isNil ])\x0a\x09\x09ifTrue: [ ^ InterestedThruAxes new aspect: anAspect allButLast block: aBlock ]\x0a\x09\x09ifFalse: [ ^ InterestedUpToAxes new aspect: anAspect block: aBlock ]",
+referencedClasses: ["InterestedThruAxes", "InterestedUpToAxes"],
+//>>excludeEnd("ide");
+messageSends: ["ifTrue:ifFalse:", "and:", "notEmpty", "isNil", "last", "aspect:block:", "new", "allButLast"]
+}),
+$globals.TrappedPosition.a$cls);
+
+
+$core.addClass("TrappedSnapshot", $globals.TrappedPosition, ["prefix"], "Trapped-Frontend");
+$core.addMethod(
+$core.method({
+selector: "do:",
+protocol: "action",
+fn: function (aBlock){
+var self=this,$self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+$recv($recv($globals.TrappedPathStack)._current())._with_do_($recv([$self["@prefix"]]).__comma($self["@path"]),(function(){
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx2) {
+//>>excludeEnd("ctx");
+return $recv(aBlock)._value_($self["@model"]);
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
+//>>excludeEnd("ctx");
+}));
+return self;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.TrappedSnapshot)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aBlock"],
+source: "do: aBlock\x0a\x09TrappedPathStack current with: {prefix}, path do: [ aBlock value: model ]",
+referencedClasses: ["TrappedPathStack"],
+//>>excludeEnd("ide");
+messageSends: ["with:do:", "current", ",", "value:"]
+}),
+$globals.TrappedSnapshot);
+
+$core.addMethod(
+$core.method({
+selector: "prefix",
+protocol: "accessing",
+fn: function (){
+var self=this,$self=this;
+return $self["@prefix"];
+
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "prefix\x0a\x09^ prefix",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: []
+}),
+$globals.TrappedSnapshot);
+
+$core.addMethod(
+$core.method({
+selector: "prefix:",
+protocol: "accessing",
+fn: function (anObject){
+var self=this,$self=this;
+$self["@prefix"]=anObject;
+return self;
+
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["anObject"],
+source: "prefix: anObject\x0a\x09prefix := anObject",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: []
+}),
+$globals.TrappedSnapshot);
+
+
+
 $core.addClass("TrappedProcessingChain", $globals.Object, ["processors"], "Trapped-Frontend");
 $core.addMethod(
 $core.method({
@@ -1500,78 +1757,6 @@ messageSends: ["ensure:", "value"]
 $globals.TrappedPathStack);
 
 
-
-$core.addClass("TrappedSnapshot", $globals.TrappedPosition, ["prefix"], "Trapped-Frontend");
-$core.addMethod(
-$core.method({
-selector: "do:",
-protocol: "action",
-fn: function (aBlock){
-var self=this,$self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-$recv($recv($globals.TrappedPathStack)._current())._with_do_($recv([$self["@prefix"]]).__comma($self["@path"]),(function(){
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx2) {
-//>>excludeEnd("ctx");
-return $recv(aBlock)._value_($self["@model"]);
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
-//>>excludeEnd("ctx");
-}));
-return self;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.TrappedSnapshot)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aBlock"],
-source: "do: aBlock\x0a\x09TrappedPathStack current with: {prefix}, path do: [ aBlock value: model ]",
-referencedClasses: ["TrappedPathStack"],
-//>>excludeEnd("ide");
-messageSends: ["with:do:", "current", ",", "value:"]
-}),
-$globals.TrappedSnapshot);
-
-$core.addMethod(
-$core.method({
-selector: "prefix",
-protocol: "accessing",
-fn: function (){
-var self=this,$self=this;
-return $self["@prefix"];
-
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: [],
-source: "prefix\x0a\x09^ prefix",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: []
-}),
-$globals.TrappedSnapshot);
-
-$core.addMethod(
-$core.method({
-selector: "prefix:",
-protocol: "accessing",
-fn: function (anObject){
-var self=this,$self=this;
-$self["@prefix"]=anObject;
-return self;
-
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["anObject"],
-source: "prefix: anObject\x0a\x09prefix := anObject",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: []
-}),
-$globals.TrappedSnapshot);
-
-
 $core.addMethod(
 $core.method({
 selector: "asTrapProcSendTo:",

+ 63 - 20
src/Trapped-Frontend.st

@@ -76,6 +76,69 @@ proceed
 	(chain processorNo: index) toView: self
 ! !
 
+Object subclass: #TrappedPosition
+	instanceVariableNames: 'path model'
+	package: 'Trapped-Frontend'!
+
+!TrappedPosition methodsFor: 'accessing'!
+
+model
+	^model
+!
+
+path
+	^path
+!
+
+path: anArray model: aTrappedMW
+	path := anArray.
+    model := aTrappedMW
+! !
+
+!TrappedPosition methodsFor: 'action'!
+
+modify: aBlock
+	self model axes: self path transform: aBlock
+!
+
+read: aBlock
+	self model axes: self path consume: aBlock
+!
+
+watch: aBlock
+	self model registeredAxon addInterest: (self class
+		interestOn: self path
+		block: [ self read: aBlock ])
+! !
+
+!TrappedPosition class methodsFor: 'factory'!
+
+interestOn: anAspect block: aBlock
+	(anAspect notEmpty and: [ anAspect last isNil ])
+		ifTrue: [ ^ InterestedThruAxes new aspect: anAspect allButLast block: aBlock ]
+		ifFalse: [ ^ InterestedUpToAxes new aspect: anAspect block: aBlock ]
+! !
+
+TrappedPosition subclass: #TrappedSnapshot
+	instanceVariableNames: 'prefix'
+	package: 'Trapped-Frontend'!
+
+!TrappedSnapshot methodsFor: 'accessing'!
+
+prefix
+	^ prefix
+!
+
+prefix: anObject
+	prefix := anObject
+! !
+
+!TrappedSnapshot methodsFor: 'action'!
+
+do: aBlock
+	TrappedPathStack current with: {prefix}, path do: [ aBlock value: model ]
+! !
+
 Object subclass: #TrappedProcessingChain
 	instanceVariableNames: 'processors'
 	package: 'Trapped-Frontend'!
@@ -413,26 +476,6 @@ initialize
 	elements := #().
 ! !
 
-TrappedPosition subclass: #TrappedSnapshot
-	instanceVariableNames: 'prefix'
-	package: 'Trapped-Frontend'!
-
-!TrappedSnapshot methodsFor: 'accessing'!
-
-prefix
-	^ prefix
-!
-
-prefix: anObject
-	prefix := anObject
-! !
-
-!TrappedSnapshot methodsFor: 'action'!
-
-do: aBlock
-	TrappedPathStack current with: {prefix}, path do: [ aBlock value: model ]
-! !
-
 !Array methodsFor: '*Trapped-Frontend'!
 
 asTrapProcSendTo: anObject