[View] [Edit] [Lock] [References] [Attachments] [History] [Home] [Changes] [Search] [Help]
[E8] E8Blob.st.js
Javascript code to generate Blob classes
smalltalk.addClass("E8Blob",smalltalk.Object, [], 'E8');
smalltalk.bind(smalltalk.E8Blob.$klass,"clone:",0 ,function (tag){var $s8Ret$={name:"stReturn"};try{var self=this;var cls=nil;var samples=nil;var js=nil;var src=nil;((tag.isNumber()).mustBeBoolean()==true ? (function(){return (function(){$s8Ret$.result=(function(){return tag.timesRepeat_((function(i){return self.clone_(i.toString());}));})();throw($s8Ret$)})();})() : nil); cls=unescape("smalltalk.addClass%28%22E8Blob")._comma(tag)._comma(unescape("%22%2Csmalltalk.E8Blob%2C%20%5B%5D%2C%20%22E8%22%29%3B%0A")); samples=smalltalk.Object.selectors().sorted().collect_((function(each){return smalltalk.Object._gt_gt(each);}))._comma(smalltalk.Object.$klass.selectors().sorted().collect_((function(each){return smalltalk.Object.$klass._gt_gt(each);}))); js=smalltalk.Exporter.exportAll_(samples); src=cls._comma(js.replace_with_("smalltalk.Object", "smalltalk.E8Blob"._comma(tag))); smalltalk.Compiler.$$new().eval_(src);return self;} catch($$ex) {if($$ex === $s8Ret$){return $$ex.result;} throw($$ex);}} ,"clone",unescape("clone%3A%20tag%0A%09%22%20Create%20a%20clone%20subclass%20of%20the%20receiver.%0A%09Note%20the%20clone%20subclass%20will%20have%20all%20methods%20obtained%20modifying%20Object%20method%20export.%0A%09%22%0A%0A%09%7C%20cls%20samples%20js%20src%20%7C%0A%09tag%20isNumber%20ifTrue%3A%20%5B%0A%09%09%5Etag%20timesRepeat%3A%20%5B%3Ai%7C%20self%20clone%3A%20i%20toString%20%5D%0A%09%5D.%0A%09cls%20%3A%3D%20%27smalltalk.addClass%28%22E8Blob%27%20%2Ctag%20%2C%27%22%2Csmalltalk.E8Blob%2C%20%5B%5D%2C%20%22E8%22%29%3B%0A%27.%09samples%20%3A%3D%0A%09%09%20%28Object%20selectors%20sorted%20collect%3A%20%5B%3Aeach%7C%20Object%20%3E%3E%20each%20%5D%29%0A%09%09%2C%28Object%20class%20selectors%20sorted%20collect%3A%20%5B%3Aeach%7C%20Object%20class%20%3E%3E%20each%20%5D%29.%0A%09js%20%3A%3D%20Exporter%20exportAll%3A%20samples.%0A%09src%20%3A%3D%20cls%20%2C%28js%20replace%3A%20%27smalltalk.Object%27%20with%3A%20%27smalltalk.E8Blob%27%2Ctag%29.%0A%09Compiler%20new%20eval%3A%20src"));
smalltalk.bind(smalltalk.E8Blob.$klass,"pollute:",0 ,function (tag){var $s8Ret$={name:"stReturn"};try{var self=this;var random=nil;var garbage=nil;((tag.isNumber()).mustBeBoolean()==true ? (function(){return (function(){$s8Ret$.result=(function(){return tag.timesRepeat_((function(i){return self.pollute_(i.toString());}));})();throw($s8Ret$)})();})() : nil); random=smalltalk.Random.$$new(); (((nil.isNil_(smalltalk.PollutionPool))).mustBeBoolean()==true ? (function(){return smalltalk.PollutionPool=smalltalk.PoolDictionary.$$new();})() : nil); garbage=smalltalk.Array.with_with_((1).to_((1000)).collect_((function(i){return random.next();})), smalltalk.Object.selectors().sorted().collect_((function(each){return smalltalk.Array.with_with_(each, smalltalk.Object._gt_gt(each).source().reversed());}))); smalltalk.PollutionPool.at_put_(tag, garbage);return self;} catch($$ex) {if($$ex === $s8Ret$){return $$ex.result;} throw($$ex);}} ,"polution",unescape("pollute%3A%20tag%0A%09%22%20Pollute%20global%20pool%20with%20object%20samples.%20%22%0A%0A%09%7C%20random%20garbage%20%7C%0A%09tag%20isNumber%20ifTrue%3A%20%5B%0A%09%09%5Etag%20timesRepeat%3A%20%5B%3Ai%7C%0A%09%09%09self%20pollute%3A%20i%20toString%0A%09%09%5D%0A%09%5D.%0A%09random%20%3A%3D%20Random%20new.%0A%09PollutionPool%20isNil%20ifTrue%3A%20%5B%0A%09%09PollutionPool%20%3A%3D%20PoolDictionary%20new%0A%09%5D.%0A%09garbage%20%3A%3D%20Array%0A%09%09with%3A%20%28%281%20to%3A%201000%29%20collect%3A%20%5B%3Ai%7C%20random%20next%20%5D%29%20%0A%09%09with%3A%20%28Object%20selectors%20sorted%20collect%3A%20%5B%3Aeach%7C%0A%09%09%09Array%20with%3A%20each%20with%3A%20%28Object%20%3E%3E%20each%29%20source%20reversed%0A%09%09%09%5D%29.%0A%09PollutionPool%20at%3A%20tag%20put%3A%20garbage"));