Browse Source

use Object >> atLyst:ifAbsent:put:

Herbert Vojčík 8 years ago
parent
commit
bc44d2a3b7
3 changed files with 8 additions and 18 deletions
  1. 2 2
      bower.json
  2. 5 13
      src/Trapped-Backend.js
  3. 1 3
      src/Trapped-Backend.st

+ 2 - 2
bower.json

@@ -25,8 +25,8 @@
   ],
   "dependencies": {
     "amber": ">=0.14.15",
-    "xontent": "^0.1.0",
-    "lyst": "^0.1.0"
+    "lyst": "^0.1.2",
+    "xontent": "^0.1.0"
   },
   "devDependencies": {
     "amber-ide-starter-dialog": "^0.1.0",

+ 5 - 13
src/Trapped-Backend.js

@@ -1,4 +1,4 @@
-define("trapped/Trapped-Backend", ["amber/boot", "amber_core/Kernel-Objects", "axon/Axon", "amber_core/Kernel-Collections"], function($boot){
+define("trapped/Trapped-Backend", ["amber/boot", "amber_core/Kernel-Objects", "axon/Axon", "amber_core/Kernel-Collections"], function($boot){"use strict";
 var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
 $core.addPackage('Trapped-Backend');
 $core.packages["Trapped-Backend"].innerEval = function (expr) { return eval(expr); };
@@ -727,29 +727,21 @@ return nil;
 
 }));
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx2.sendIdx["atLyst:ifAbsent:"]=1;
-//>>excludeEnd("ctx");
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({anObject:anObject},$ctx1,1)});
 //>>excludeEnd("ctx");
 }));
 $1=self._isEmpty();
 if(!$core.assert($1)){
 $recv(model)._putBlock_((function(anObject,value){
-var penultimate;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
-penultimate=$recv(anObject)._atLyst_ifAbsent_(self._allButLast(),(function(){
+return $recv(anObject)._atLyst_ifAbsent_put_(self,(function(){
 return nil;
 
-}));
-penultimate;
-return $recv(self._last())._atYndexIn_ifAbsent_put_(penultimate,(function(){
-
 }),value);
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx2) {$ctx2.fillBlock({anObject:anObject,value:value,penultimate:penultimate},$ctx1,4)});
+}, function($ctx2) {$ctx2.fillBlock({anObject:anObject,value:value},$ctx1,4)});
 //>>excludeEnd("ctx");
 }));
 };
@@ -761,10 +753,10 @@ return $2;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: [],
-source: "asEavModel\x0a    | model |\x0a    model := EavModel new.\x0a    model getBlock: [ :anObject | anObject atLyst: self ifAbsent: [ nil ] ].\x0a    self isEmpty ifFalse: [\x0a        model putBlock: [ :anObject :value | | penultimate |\x0a            penultimate := anObject atLyst: self allButLast ifAbsent: [ nil ].\x0a            self last atYndexIn: penultimate ifAbsent: [] put: value ]].\x0a    ^model",
+source: "asEavModel\x0a    | model |\x0a    model := EavModel new.\x0a    model getBlock: [ :anObject | anObject atLyst: self ifAbsent: [ nil ] ].\x0a    self isEmpty ifFalse: [\x0a        model putBlock: [ :anObject :value | anObject atLyst: self ifAbsent: [ nil ] put: value ]].\x0a    ^model",
 referencedClasses: ["EavModel"],
 //>>excludeEnd("ide");
-messageSends: ["new", "getBlock:", "atLyst:ifAbsent:", "ifFalse:", "isEmpty", "putBlock:", "allButLast", "atYndexIn:ifAbsent:put:", "last"]
+messageSends: ["new", "getBlock:", "atLyst:ifAbsent:", "ifFalse:", "isEmpty", "putBlock:", "atLyst:ifAbsent:put:"]
 }),
 $globals.SequenceableCollection);
 

+ 1 - 3
src/Trapped-Backend.st

@@ -213,9 +213,7 @@ asEavModel
     model := EavModel new.
     model getBlock: [ :anObject | anObject atLyst: self ifAbsent: [ nil ] ].
     self isEmpty ifFalse: [
-        model putBlock: [ :anObject :value | | penultimate |
-            penultimate := anObject atLyst: self allButLast ifAbsent: [ nil ].
-            self last atYndexIn: penultimate ifAbsent: [] put: value ]].
+        model putBlock: [ :anObject :value | anObject atLyst: self ifAbsent: [ nil ] put: value ]].
     ^model
 ! !