123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316 |
- define(["amber/boot"
- //>>excludeStart("imports", pragmas.excludeImports);
- , "axxord/Axxord"
- //>>excludeEnd("imports");
- , "amber_core/Kernel-Objects"], function($boot
- //>>excludeStart("imports", pragmas.excludeImports);
- //>>excludeEnd("imports");
- ){"use strict";
- if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
- if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
- var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
- if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
- $core.addPackage("Trapped-Backend");
- $core.packages["Trapped-Backend"].innerEval = function (expr) { return eval(expr); };
- $core.packages["Trapped-Backend"].imports = ["axxord/Axxord"];
- $core.packages["Trapped-Backend"].transport = {"type":"amd","amdNamespace":"trapped"};
- $core.addClass("Isolator", $globals.Object, ["root"], "Trapped-Backend");
- $core.addMethod(
- $core.method({
- selector: "model:modify:",
- protocol: "action",
- fn: function (anEavModel,aBlock){
- var self=this,$self=this;
- var newValue;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- newValue=$recv(aBlock)._value_($recv(anEavModel)._on_(self));
- $recv(anEavModel)._on_put_(self,$recv(newValue)._deepCopy());
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"model:modify:",{anEavModel:anEavModel,aBlock:aBlock,newValue:newValue},$globals.Isolator)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anEavModel", "aBlock"],
- source: "model: anEavModel modify: aBlock\x0a\x0a| newValue |\x0anewValue := aBlock value: (anEavModel on: self).\x0aanEavModel on: self put: newValue deepCopy",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["value:", "on:", "on:put:", "deepCopy"]
- }),
- $globals.Isolator);
- $core.addMethod(
- $core.method({
- selector: "model:read:",
- protocol: "action",
- fn: function (anEavModel,aBlock){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $recv(aBlock)._value_($recv($recv(anEavModel)._on_(self))._deepCopy());
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"model:read:",{anEavModel:anEavModel,aBlock:aBlock},$globals.Isolator)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anEavModel", "aBlock"],
- source: "model: anEavModel read: aBlock\x0a\x0aaBlock value: (anEavModel on: self) deepCopy",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["value:", "deepCopy", "on:"]
- }),
- $globals.Isolator);
- $core.addMethod(
- $core.method({
- selector: "root",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- return $self["@root"];
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "root\x0a\x0a^root",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.Isolator);
- $core.addMethod(
- $core.method({
- selector: "root:",
- protocol: "accessing",
- fn: function (anObject){
- var self=this,$self=this;
- $self["@root"]=anObject;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anObject"],
- source: "root: anObject\x0a\x0aroot := anObject",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.Isolator);
- $core.addMethod(
- $core.method({
- selector: "on:",
- protocol: "instance creation",
- fn: function (anObject){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($self._new())._root_(anObject);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Isolator.a$cls)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anObject"],
- source: "on: anObject\x0a^self new root: anObject",
- referencedClasses: [],
- //>>excludeEnd("ide");
- 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);
- });
|