|
@@ -462,7 +462,7 @@ smalltalk.method({
|
|
|
selector: 'basicDelete:',
|
|
|
fn: function (aString){
|
|
|
var self=this;
|
|
|
-delete self[aString];
|
|
|
+delete self[aString]; return aString;
|
|
|
return self;}
|
|
|
}),
|
|
|
smalltalk.Object);
|
|
@@ -484,21 +484,7 @@ smalltalk.method({
|
|
|
selector: 'asJSON',
|
|
|
fn: function (){
|
|
|
var self=this;
|
|
|
-return JSON.stringify(self._asJSONObject());
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Object);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'_asJSONObject',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'asJSONObject',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-var object=nil;
|
|
|
-object=smalltalk.send((smalltalk.Object || Object), "_new", []);
|
|
|
-smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "_instanceVariableNames", []), "_do_", [(function(each){return smalltalk.send(object, "_basicAt_put_", [each, smalltalk.send(smalltalk.send(self, "_instVarAt_", [each]), "_asJSONObject", [])]);})]);
|
|
|
-return object;
|
|
|
+return smalltalk.send((smalltalk.JSON || JSON), "_parse_", [smalltalk.send(self, "_asJSONString", [])]);
|
|
|
return self;}
|
|
|
}),
|
|
|
smalltalk.Object);
|
|
@@ -555,7 +541,7 @@ smalltalk.method({
|
|
|
selector: 'deprecatedAPI',
|
|
|
fn: function (){
|
|
|
var self=this;
|
|
|
-smalltalk.send((typeof console == 'undefined' ? nil : console), "_warn_", [smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.getThisContext()), "_home", []), "_asString", []), "__comma", [unescape("%20is%20deprecated%21")])]);
|
|
|
+smalltalk.send((typeof console == 'undefined' ? nil : console), "_warn_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.getThisContext()), "_home", []), "_asString", []), "__comma", [unescape("%20is%20deprecated%21%20%28in%20")]), "__comma", [smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.getThisContext()), "_home", []), "_home", []), "_asString", [])]), "__comma", [unescape("%29")])]);
|
|
|
return self;}
|
|
|
}),
|
|
|
smalltalk.Object);
|
|
@@ -582,6 +568,17 @@ return self;}
|
|
|
}),
|
|
|
smalltalk.Object);
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
+'_asJSONString',
|
|
|
+smalltalk.method({
|
|
|
+selector: 'asJSONString',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+return smalltalk.send((smalltalk.JSON || JSON), "_stringify_", [self]);
|
|
|
+return self;}
|
|
|
+}),
|
|
|
+smalltalk.Object);
|
|
|
+
|
|
|
|
|
|
smalltalk.addMethod(
|
|
|
'_initialize',
|
|
@@ -1430,6 +1427,7 @@ smalltalk.method({
|
|
|
selector: 'subclass:instanceVariableNames:category:',
|
|
|
fn: function (aString, aString2, aString3){
|
|
|
var self=this;
|
|
|
+smalltalk.send(self, "_deprecatedAPI", []);
|
|
|
return smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, aString2, aString3]);
|
|
|
return self;}
|
|
|
}),
|
|
@@ -1984,17 +1982,6 @@ return self;}
|
|
|
}),
|
|
|
smalltalk.Number);
|
|
|
|
|
|
-smalltalk.addMethod(
|
|
|
-'_asJSONObject',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'asJSONObject',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-return self;
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Number);
|
|
|
-
|
|
|
smalltalk.addMethod(
|
|
|
'_clearTimeout',
|
|
|
smalltalk.method({
|
|
@@ -2508,17 +2495,6 @@ return self;}
|
|
|
}),
|
|
|
smalltalk.Boolean);
|
|
|
|
|
|
-smalltalk.addMethod(
|
|
|
-'_asJSONObject',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'asJSONObject',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-return self;
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Boolean);
|
|
|
-
|
|
|
smalltalk.addMethod(
|
|
|
'_&',
|
|
|
smalltalk.method({
|
|
@@ -2932,17 +2908,6 @@ return self;}
|
|
|
}),
|
|
|
smalltalk.Date);
|
|
|
|
|
|
-smalltalk.addMethod(
|
|
|
-'_asJSONObject',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'asJSONObject',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-return self;
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Date);
|
|
|
-
|
|
|
|
|
|
smalltalk.addMethod(
|
|
|
'_new_',
|
|
@@ -3043,6 +3008,7 @@ smalltalk.method({
|
|
|
selector: 'subclass:instanceVariableNames:category:',
|
|
|
fn: function (aString, aString2, aString3){
|
|
|
var self=this;
|
|
|
+smalltalk.send(self, "_deprecatedAPI", []);
|
|
|
return smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, aString2, aString3]);
|
|
|
return self;}
|
|
|
}),
|
|
@@ -3459,7 +3425,7 @@ smalltalk.method({
|
|
|
selector: 'remove:',
|
|
|
fn: function (anObject){
|
|
|
var self=this;
|
|
|
-smalltalk.send(self, "_subclassResponsibility", []);
|
|
|
+return smalltalk.send(self, "_remove_ifAbsent_", [anObject, (function(){return smalltalk.send(self, "_errorNotFound", []);})]);
|
|
|
return self;}
|
|
|
}),
|
|
|
smalltalk.Collection);
|
|
@@ -3508,6 +3474,17 @@ return self;}
|
|
|
}),
|
|
|
smalltalk.Collection);
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
+'_remove_ifAbsent_',
|
|
|
+smalltalk.method({
|
|
|
+selector: 'remove:ifAbsent:',
|
|
|
+fn: function (anObject, aBlock){
|
|
|
+var self=this;
|
|
|
+smalltalk.send(self, "_subclassResponsibility", []);
|
|
|
+return self;}
|
|
|
+}),
|
|
|
+smalltalk.Collection);
|
|
|
+
|
|
|
|
|
|
smalltalk.addMethod(
|
|
|
'_streamClass',
|
|
@@ -4137,17 +4114,6 @@ return self;}
|
|
|
}),
|
|
|
smalltalk.String);
|
|
|
|
|
|
-smalltalk.addMethod(
|
|
|
-'_asJSONObject',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'asJSONObject',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-return self;
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.String);
|
|
|
-
|
|
|
smalltalk.addMethod(
|
|
|
'_trimLeft_',
|
|
|
smalltalk.method({
|
|
@@ -4654,17 +4620,6 @@ return self;}
|
|
|
}),
|
|
|
smalltalk.Array);
|
|
|
|
|
|
-smalltalk.addMethod(
|
|
|
-'_asJSONObject',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'asJSONObject',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-return smalltalk.send(self, "_collect_", [(function(each){return smalltalk.send(each, "_asJSONObject", []);})]);
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Array);
|
|
|
-
|
|
|
smalltalk.addMethod(
|
|
|
'_removeFrom_to_',
|
|
|
smalltalk.method({
|
|
@@ -5008,7 +4963,7 @@ return self;}
|
|
|
smalltalk.Association.klass);
|
|
|
|
|
|
|
|
|
-smalltalk.addClass('Dictionary', smalltalk.Collection, ['keys'], 'Kernel');
|
|
|
+smalltalk.addClass('Dictionary', smalltalk.Collection, [], 'Kernel');
|
|
|
smalltalk.addMethod(
|
|
|
'__eq',
|
|
|
smalltalk.method({
|
|
@@ -5037,25 +4992,13 @@ return self;}
|
|
|
}),
|
|
|
smalltalk.Dictionary);
|
|
|
|
|
|
-smalltalk.addMethod(
|
|
|
-'_initialize',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'initialize',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-smalltalk.send(self, "_initialize", [], smalltalk.Collection);
|
|
|
-self['@keys']=[];
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary);
|
|
|
-
|
|
|
smalltalk.addMethod(
|
|
|
'_size',
|
|
|
smalltalk.method({
|
|
|
selector: 'size',
|
|
|
fn: function (){
|
|
|
var self=this;
|
|
|
-return smalltalk.send(self['@keys'], "_size", []);
|
|
|
+return smalltalk.send(smalltalk.send(self, "_keys", []), "_size", []);
|
|
|
return self;}
|
|
|
}),
|
|
|
smalltalk.Dictionary);
|
|
@@ -5068,7 +5011,7 @@ fn: function (){
|
|
|
var self=this;
|
|
|
var associations=nil;
|
|
|
associations=[];
|
|
|
-smalltalk.send(self['@keys'], "_do_", [(function(each){return smalltalk.send(associations, "_add_", [smalltalk.send((smalltalk.Association || Association), "_key_value_", [each, smalltalk.send(self, "_at_", [each])])]);})]);
|
|
|
+smalltalk.send(smalltalk.send(self, "_keys", []), "_do_", [(function(each){return smalltalk.send(associations, "_add_", [smalltalk.send((smalltalk.Association || Association), "_key_value_", [each, smalltalk.send(self, "_at_", [each])])]);})]);
|
|
|
return associations;
|
|
|
return self;}
|
|
|
}),
|
|
@@ -5080,7 +5023,15 @@ smalltalk.method({
|
|
|
selector: 'keys',
|
|
|
fn: function (){
|
|
|
var self=this;
|
|
|
-return smalltalk.send(self['@keys'], "_copy", []);
|
|
|
+
|
|
|
+ var keys = [];
|
|
|
+ for(var i in self) {
|
|
|
+ if(self.hasOwnProperty(i)) {
|
|
|
+ keys.push(i);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ return keys;
|
|
|
+ ;
|
|
|
return self;}
|
|
|
}),
|
|
|
smalltalk.Dictionary);
|
|
@@ -5091,7 +5042,7 @@ smalltalk.method({
|
|
|
selector: 'values',
|
|
|
fn: function (){
|
|
|
var self=this;
|
|
|
-return smalltalk.send(self['@keys'], "_collect_", [(function(each){return smalltalk.send(self, "_at_", [each]);})]);
|
|
|
+return smalltalk.send(smalltalk.send(self, "_keys", []), "_collect_", [(function(each){return smalltalk.send(self, "_at_", [each]);})]);
|
|
|
return self;}
|
|
|
}),
|
|
|
smalltalk.Dictionary);
|
|
@@ -5102,7 +5053,6 @@ smalltalk.method({
|
|
|
selector: 'at:put:',
|
|
|
fn: function (aKey, aValue){
|
|
|
var self=this;
|
|
|
-((($receiver = smalltalk.send(self['@keys'], "_includes_", [aKey])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(self['@keys'], "_add_", [aKey]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(self['@keys'], "_add_", [aKey]);})]));
|
|
|
return smalltalk.send(self, "_basicAt_put_", [aKey, aValue]);
|
|
|
return self;}
|
|
|
}),
|
|
@@ -5114,7 +5064,7 @@ smalltalk.method({
|
|
|
selector: 'at:ifAbsent:',
|
|
|
fn: function (aKey, aBlock){
|
|
|
var self=this;
|
|
|
-return smalltalk.send(smalltalk.send(smalltalk.send(self, "_keys", []), "_includes_", [aKey]), "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self, "_basicAt_", [aKey]);}), aBlock]);
|
|
|
+return smalltalk.send(smalltalk.send(self, "_includesKey_", [aKey]), "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self, "_basicAt_", [aKey]);}), aBlock]);
|
|
|
return self;}
|
|
|
}),
|
|
|
smalltalk.Dictionary);
|
|
@@ -5280,24 +5230,13 @@ return self;}
|
|
|
}),
|
|
|
smalltalk.Dictionary);
|
|
|
|
|
|
-smalltalk.addMethod(
|
|
|
-'_remove_',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'remove:',
|
|
|
-fn: function (aKey){
|
|
|
-var self=this;
|
|
|
-smalltalk.send(self, "_removeKey_", [aKey]);
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary);
|
|
|
-
|
|
|
smalltalk.addMethod(
|
|
|
'_removeKey_',
|
|
|
smalltalk.method({
|
|
|
selector: 'removeKey:',
|
|
|
fn: function (aKey){
|
|
|
var self=this;
|
|
|
-smalltalk.send(self['@keys'], "_remove_", [aKey]);
|
|
|
+smalltalk.send(self, "_remove_", [aKey]);
|
|
|
return self;}
|
|
|
}),
|
|
|
smalltalk.Dictionary);
|
|
@@ -5313,20 +5252,6 @@ return self;}
|
|
|
}),
|
|
|
smalltalk.Dictionary);
|
|
|
|
|
|
-smalltalk.addMethod(
|
|
|
-'_asJSONObject',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'asJSONObject',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-var object=nil;
|
|
|
-object=smalltalk.send((smalltalk.Object || Object), "_new", []);
|
|
|
-smalltalk.send(self, "_keysAndValuesDo_", [(function(key, value){return smalltalk.send(object, "_basicAt_put_", [key, smalltalk.send(value, "_asJSONObject", [])]);})]);
|
|
|
-return object;
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary);
|
|
|
-
|
|
|
smalltalk.addMethod(
|
|
|
'_printString',
|
|
|
smalltalk.method({
|
|
@@ -5351,6 +5276,53 @@ return self;}
|
|
|
}),
|
|
|
smalltalk.Dictionary);
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
+'_includesKey_',
|
|
|
+smalltalk.method({
|
|
|
+selector: 'includesKey:',
|
|
|
+fn: function (aKey){
|
|
|
+var self=this;
|
|
|
+return self.hasOwnProperty(aKey);
|
|
|
+return self;}
|
|
|
+}),
|
|
|
+smalltalk.Dictionary);
|
|
|
+
|
|
|
+smalltalk.addMethod(
|
|
|
+'_remove_ifAbsent_',
|
|
|
+smalltalk.method({
|
|
|
+selector: 'remove:ifAbsent:',
|
|
|
+fn: function (aKey, aBlock){
|
|
|
+var self=this;
|
|
|
+return smalltalk.send(self, "_removeKey_ifAbsent_", [aKey, aBlock]);
|
|
|
+return self;}
|
|
|
+}),
|
|
|
+smalltalk.Dictionary);
|
|
|
+
|
|
|
+smalltalk.addMethod(
|
|
|
+'_removeKey_ifAbsent_',
|
|
|
+smalltalk.method({
|
|
|
+selector: 'removeKey:ifAbsent:',
|
|
|
+fn: function (aKey, aBlock){
|
|
|
+var self=this;
|
|
|
+return ((($receiver = smalltalk.send(self, "_includesKey_", [aKey])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(aBlock, "_value", []);})() : (function(){return smalltalk.send(self, "_basicDelete_", [aKey]);})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){return smalltalk.send(aBlock, "_value", []);}), (function(){return smalltalk.send(self, "_basicDelete_", [aKey]);})]));
|
|
|
+return self;}
|
|
|
+}),
|
|
|
+smalltalk.Dictionary);
|
|
|
+
|
|
|
+smalltalk.addMethod(
|
|
|
+'_deepCopy',
|
|
|
+smalltalk.method({
|
|
|
+selector: 'deepCopy',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+var copy=nil;
|
|
|
+copy=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []);
|
|
|
+smalltalk.send(self, "_associationsDo_", [(function(each){return smalltalk.send(copy, "_at_put_", [smalltalk.send(each, "_key", []), smalltalk.send(smalltalk.send(each, "_value", []), "_deepCopy", [])]);})]);
|
|
|
+return copy;
|
|
|
+return self;}
|
|
|
+}),
|
|
|
+smalltalk.Dictionary);
|
|
|
+
|
|
|
|
|
|
smalltalk.addMethod(
|
|
|
'_fromPairs_',
|
|
@@ -6674,348 +6646,3 @@ return self;}
|
|
|
smalltalk.ConsoleTranscript.klass);
|
|
|
|
|
|
|
|
|
-smalltalk.addClass('Dictionary2', smalltalk.Dictionary, ['keys'], 'Kernel');
|
|
|
-smalltalk.addMethod(
|
|
|
-'__eq',
|
|
|
-smalltalk.method({
|
|
|
-selector: '=',
|
|
|
-fn: function (aDictionary){
|
|
|
-var self=this;
|
|
|
-try{((($receiver = smalltalk.send(smalltalk.send(self, "_class", []), "__eq", [smalltalk.send(aDictionary, "_class", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return (function(){throw({name: 'stReturn', selector: '__eq', fn: function(){return false}})})();})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (function(){throw({name: 'stReturn', selector: '__eq', fn: function(){return false}})})();})]));
|
|
|
-((($receiver = smalltalk.send(smalltalk.send(self, "_size", []), "__eq", [smalltalk.send(aDictionary, "_size", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return (function(){throw({name: 'stReturn', selector: '__eq', fn: function(){return false}})})();})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (function(){throw({name: 'stReturn', selector: '__eq', fn: function(){return false}})})();})]));
|
|
|
-(function(){throw({name: 'stReturn', selector: '__eq', fn: function(){return smalltalk.send(smalltalk.send(self, "_associations", []), "__eq", [smalltalk.send(aDictionary, "_associations", [])])}})})();
|
|
|
-return self;
|
|
|
-} catch(e) {if(e.name === 'stReturn' && e.selector === '__eq'){return e.fn()} throw(e)}}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'_shallowCopy',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'shallowCopy',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-var copy=nil;
|
|
|
-copy=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []);
|
|
|
-smalltalk.send(self, "_associationsDo_", [(function(each){return smalltalk.send(copy, "_at_put_", [smalltalk.send(each, "_key", []), smalltalk.send(each, "_value", [])]);})]);
|
|
|
-return copy;
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'_initialize',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'initialize',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-smalltalk.send(self, "_initialize", [], smalltalk.Dictionary);
|
|
|
-self['@keys']=[];
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'_size',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'size',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-return smalltalk.send(self['@keys'], "_size", []);
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'_associations',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'associations',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-var associations=nil;
|
|
|
-associations=[];
|
|
|
-smalltalk.send(self['@keys'], "_do_", [(function(each){return smalltalk.send(associations, "_add_", [smalltalk.send((smalltalk.Association || Association), "_key_value_", [each, smalltalk.send(self, "_at_", [each])])]);})]);
|
|
|
-return associations;
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'_keys',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'keys',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-return smalltalk.send(self['@keys'], "_copy", []);
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'_values',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'values',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-return smalltalk.send(self['@keys'], "_collect_", [(function(each){return smalltalk.send(self, "_at_", [each]);})]);
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'_at_put_',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'at:put:',
|
|
|
-fn: function (aKey, aValue){
|
|
|
-var self=this;
|
|
|
-((($receiver = smalltalk.send(self['@keys'], "_includes_", [aKey])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(self['@keys'], "_add_", [aKey]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(self['@keys'], "_add_", [aKey]);})]));
|
|
|
-return smalltalk.send(self, "_basicAt_put_", [aKey, aValue]);
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'_at_ifAbsent_',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'at:ifAbsent:',
|
|
|
-fn: function (aKey, aBlock){
|
|
|
-var self=this;
|
|
|
-return smalltalk.send(smalltalk.send(smalltalk.send(self, "_keys", []), "_includes_", [aKey]), "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self, "_basicAt_", [aKey]);}), aBlock]);
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'_at_ifAbsentPut_',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'at:ifAbsentPut:',
|
|
|
-fn: function (aKey, aBlock){
|
|
|
-var self=this;
|
|
|
-return smalltalk.send(self, "_at_ifAbsent_", [aKey, (function(){return smalltalk.send(self, "_at_put_", [aKey, smalltalk.send(aBlock, "_value", [])]);})]);
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'_at_ifPresent_',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'at:ifPresent:',
|
|
|
-fn: function (aKey, aBlock){
|
|
|
-var self=this;
|
|
|
-return (($receiver = smalltalk.send(self, "_basicAt_", [aKey])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(aBlock, "_value_", [smalltalk.send(self, "_at_", [aKey])]);})() : nil;
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'_at_ifPresent_ifAbsent_',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'at:ifPresent:ifAbsent:',
|
|
|
-fn: function (aKey, aBlock, anotherBlock){
|
|
|
-var self=this;
|
|
|
-return smalltalk.send(smalltalk.send(self, "_basicAt_", [aKey]), "_ifNil_ifNotNil_", [anotherBlock, (function(){return smalltalk.send(aBlock, "_value_", [smalltalk.send(self, "_at_", [aKey])]);})]);
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'_add_',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'add:',
|
|
|
-fn: function (anAssociation){
|
|
|
-var self=this;
|
|
|
-smalltalk.send(self, "_at_put_", [smalltalk.send(anAssociation, "_key", []), smalltalk.send(anAssociation, "_value", [])]);
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'_addAll_',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'addAll:',
|
|
|
-fn: function (aDictionary){
|
|
|
-var self=this;
|
|
|
-smalltalk.send(self, "_addAll_", [smalltalk.send(aDictionary, "_associations", [])], smalltalk.Dictionary);
|
|
|
-return aDictionary;
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'__comma',
|
|
|
-smalltalk.method({
|
|
|
-selector: ',',
|
|
|
-fn: function (aCollection){
|
|
|
-var self=this;
|
|
|
-smalltalk.send(self, "_shouldNotImplement", []);
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'_copyFrom_to_',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'copyFrom:to:',
|
|
|
-fn: function (anIndex, anotherIndex){
|
|
|
-var self=this;
|
|
|
-smalltalk.send(self, "_shouldNotImplement", []);
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'_associationsDo_',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'associationsDo:',
|
|
|
-fn: function (aBlock){
|
|
|
-var self=this;
|
|
|
-smalltalk.send(smalltalk.send(self, "_associations", []), "_do_", [aBlock]);
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'_keysAndValuesDo_',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'keysAndValuesDo:',
|
|
|
-fn: function (aBlock){
|
|
|
-var self=this;
|
|
|
-smalltalk.send(self, "_associationsDo_", [(function(each){return smalltalk.send(aBlock, "_value_value_", [smalltalk.send(each, "_key", []), smalltalk.send(each, "_value", [])]);})]);
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'_do_',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'do:',
|
|
|
-fn: function (aBlock){
|
|
|
-var self=this;
|
|
|
-smalltalk.send(smalltalk.send(self, "_values", []), "_do_", [aBlock]);
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'_select_',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'select:',
|
|
|
-fn: function (aBlock){
|
|
|
-var self=this;
|
|
|
-var newDict=nil;
|
|
|
-newDict=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []);
|
|
|
-smalltalk.send(self, "_keysAndValuesDo_", [(function(key, value){return ((($receiver = smalltalk.send(aBlock, "_value_", [value])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(newDict, "_at_put_", [key, value]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(newDict, "_at_put_", [key, value]);})]));})]);
|
|
|
-return newDict;
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'_collect_',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'collect:',
|
|
|
-fn: function (aBlock){
|
|
|
-var self=this;
|
|
|
-var newDict=nil;
|
|
|
-newDict=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []);
|
|
|
-smalltalk.send(self, "_keysAndValuesDo_", [(function(key, value){return smalltalk.send(newDict, "_at_put_", [key, smalltalk.send(aBlock, "_value_", [value])]);})]);
|
|
|
-return newDict;
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'_detect_ifNone_',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'detect:ifNone:',
|
|
|
-fn: function (aBlock, anotherBlock){
|
|
|
-var self=this;
|
|
|
-return smalltalk.send(smalltalk.send(self, "_values", []), "_detect_ifNone_", [aBlock, anotherBlock]);
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'_includes_',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'includes:',
|
|
|
-fn: function (anObject){
|
|
|
-var self=this;
|
|
|
-return smalltalk.send(smalltalk.send(self, "_values", []), "_includes_", [anObject]);
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'_remove_',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'remove:',
|
|
|
-fn: function (aKey){
|
|
|
-var self=this;
|
|
|
-smalltalk.send(self, "_removeKey_", [aKey]);
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'_removeKey_',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'removeKey:',
|
|
|
-fn: function (aKey){
|
|
|
-var self=this;
|
|
|
-smalltalk.send(self['@keys'], "_remove_", [aKey]);
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'_at_',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'at:',
|
|
|
-fn: function (aKey){
|
|
|
-var self=this;
|
|
|
-return smalltalk.send(self, "_at_ifAbsent_", [aKey, (function(){return smalltalk.send(self, "_errorNotFound", []);})]);
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'_asJSONObject',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'asJSONObject',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-var object=nil;
|
|
|
-object=smalltalk.send((smalltalk.Object || Object), "_new", []);
|
|
|
-smalltalk.send(self, "_keysAndValuesDo_", [(function(key, value){return smalltalk.send(object, "_basicAt_put_", [key, smalltalk.send(value, "_asJSONObject", [])]);})]);
|
|
|
-return object;
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'_printString',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'printString',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-return smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(aStream){(function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(self, "_printString", [], smalltalk.Dictionary)]);return smalltalk.send($rec, "_nextPutAll_", [unescape("%28")]);})(aStream);smalltalk.send(smalltalk.send(self, "_associations", []), "_do_separatedBy_", [(function(anAssociation){return (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(anAssociation, "_key", []), "_printString", [])]);smalltalk.send($rec, "_nextPutAll_", [unescape("%20-%3E%20")]);return smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(anAssociation, "_value", []), "_printString", [])]);})(aStream);}), (function(){return smalltalk.send(aStream, "_nextPutAll_", [unescape("%20%2C%20")]);})]);return smalltalk.send(aStream, "_nextPutAll_", [unescape("%29")]);})]);
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-'_storeOn_',
|
|
|
-smalltalk.method({
|
|
|
-selector: 'storeOn:',
|
|
|
-fn: function (aStream){
|
|
|
-var self=this;
|
|
|
-smalltalk.send(aStream, "_nextPutAll_", [unescape("%23%7B")]);
|
|
|
-smalltalk.send(smalltalk.send(self, "_associations", []), "_do_separatedBy_", [(function(each){return smalltalk.send(each, "_storeOn_", [aStream]);}), (function(){return smalltalk.send(aStream, "_nextPutAll_", [". "]);})]);
|
|
|
-smalltalk.send(aStream, "_nextPutAll_", [unescape("%7D")]);
|
|
|
-return self;}
|
|
|
-}),
|
|
|
-smalltalk.Dictionary2);
|
|
|
-
|
|
|
-
|
|
|
-
|