12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109 |
- smalltalk.addPackage('Kernel-Methods', {});
- smalltalk.addClass('BlockClosure', smalltalk.Object, [], 'Kernel-Methods');
- smalltalk.BlockClosure.comment="A BlockClosure is a lexical closure.\x0aThe JavaScript representation is a function.\x0a\x0aA BlockClosure is evaluated with the `#value*` methods in the 'evaluating' protocol."
- smalltalk.addMethod(
- "_applyTo_arguments_",
- smalltalk.method({
- selector: "applyTo:arguments:",
- category: 'evaluating',
- fn: function (anObject, aCollection) {
- var self = this;
- return self.apply(anObject, aCollection);
- return self;
- },
- args: ["anObject", "aCollection"],
- source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- "_compiledSource",
- smalltalk.method({
- selector: "compiledSource",
- category: 'accessing',
- fn: function () {
- var self = this;
- return self.toString();
- return self;
- },
- args: [],
- source: "compiledSource\x0a\x09<return self.toString()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- "_ensure_",
- smalltalk.method({
- selector: "ensure:",
- category: 'evaluating',
- fn: function (aBlock){
- var self=this;
- try{return self()}finally{aBlock._value()};
- ;
- return self},
- args: ["aBlock"],
- source: "ensure: aBlock\x0a\x09<try{return self()}finally{aBlock._value()}>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- "_fork",
- smalltalk.method({
- selector: "fork",
- category: 'timeout/interval',
- fn: function (){
- var self=this;
- smalltalk.send(smalltalk.send((smalltalk.ForkPool || ForkPool),"_default",[]),"_fork_",[self]);
- return self},
- args: [],
- source: "fork\x0a\x09ForkPool default fork: self",
- messageSends: ["fork:", "default"],
- referencedClasses: ["ForkPool"]
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- "_new",
- smalltalk.method({
- selector: "new",
- category: 'evaluating',
- fn: function () {
- var self = this;
- return new self;
- return self;
- },
- args: [],
- source: "new\x0a\x09\x22Use the receiver as a JS constructor. \x0a\x09*Do not* use this method to instanciate Smalltalk objects!\x22\x0a\x09<return new self()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- "_newValue_",
- smalltalk.method({
- selector: "newValue:",
- category: 'evaluating',
- fn: function (anObject) {
- var self = this;
- return new self(anObject);
- return self;
- },
- args: ["anObject"],
- source: "newValue: anObject\x0a\x09\x22Use the receiver as a JS constructor. \x0a\x09*Do not* use this method to instanciate Smalltalk objects!\x22\x0a\x09<return new self(anObject)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- "_newValue_value_",
- smalltalk.method({
- selector: "newValue:value:",
- category: 'evaluating',
- fn: function (anObject, anObject2) {
- var self = this;
- return new self(anObject, anObject2);
- return self;
- },
- args: ["anObject", "anObject2"],
- source: "newValue: anObject value: anObject2\x0a\x09\x22Use the receiver as a JS constructor. \x0a\x09*Do not* use this method to instanciate Smalltalk objects!\x22\x0a\x09<return new self(anObject, anObject2)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- "_newValue_value_value_",
- smalltalk.method({
- selector: "newValue:value:value:",
- category: 'evaluating',
- fn: function (anObject, anObject2, anObject3) {
- var self = this;
- return new self(anObject, anObject2);
- return self;
- },
- args: ["anObject", "anObject2", "anObject3"],
- source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09\x22Use the receiver as a JS constructor. \x0a\x09*Do not* use this method to instanciate Smalltalk objects!\x22\x0a\x09<return new self(anObject, anObject2)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- "_numArgs",
- smalltalk.method({
- selector: "numArgs",
- category: 'accessing',
- fn: function () {
- var self = this;
- return self.length;
- return self;
- },
- args: [],
- source: "numArgs\x0a\x09<return self.length>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- "_on_do_",
- smalltalk.method({
- selector: "on:do:",
- category: 'error handling',
- fn: function (anErrorClass, aBlock) {
- var self = this;
- var $2, $1;
- $1 = smalltalk.send(self, "_try_catch_", [self, function (error) {$2 = smalltalk.send(error, "_isKindOf_", [anErrorClass]);if (smalltalk.assert($2)) {return smalltalk.send(aBlock, "_value_", [error]);} else {return smalltalk.send(error, "_signal", []);}}]);
- return $1;
- },
- args: ["anErrorClass", "aBlock"],
- source: "on: anErrorClass do: aBlock\x0a\x09^self try: self catch: [:error |\x0a\x09 (error isKindOf: anErrorClass) \x0a\x09 ifTrue: [aBlock value: error]\x0a\x09 ifFalse: [error signal]]",
- messageSends: ["try:catch:", "ifTrue:ifFalse:", "value:", "signal", "isKindOf:"],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- "_timeToRun",
- smalltalk.method({
- selector: "timeToRun",
- category: 'evaluating',
- fn: function () {
- var self = this;
- var $1;
- $1 = smalltalk.send(smalltalk.Date || Date, "_millisecondsToRun_", [self]);
- return $1;
- },
- args: [],
- source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
- messageSends: ["millisecondsToRun:"],
- referencedClasses: ["Date"]
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- "_value",
- smalltalk.method({
- selector: "value",
- category: 'evaluating',
- fn: function () {
- var self = this;
- return self();
- return self;
- },
- args: [],
- source: "value\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self();>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- "_value_",
- smalltalk.method({
- selector: "value:",
- category: 'evaluating',
- fn: function (anArg) {
- var self = this;
- return self(anArg);
- return self;
- },
- args: ["anArg"],
- source: "value: anArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(anArg);>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- "_value_value_",
- smalltalk.method({
- selector: "value:value:",
- category: 'evaluating',
- fn: function (firstArg, secondArg) {
- var self = this;
- return self(firstArg, secondArg);
- return self;
- },
- args: ["firstArg", "secondArg"],
- source: "value: firstArg value: secondArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg);>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- "_value_value_value_",
- smalltalk.method({
- selector: "value:value:value:",
- category: 'evaluating',
- fn: function (firstArg, secondArg, thirdArg) {
- var self = this;
- return self(firstArg, secondArg, thirdArg);
- return self;
- },
- args: ["firstArg", "secondArg", "thirdArg"],
- source: "value: firstArg value: secondArg value: thirdArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- "_valueWithInterval_",
- smalltalk.method({
- selector: "valueWithInterval:",
- category: 'timeout/interval',
- fn: function (aNumber){
- var self=this;
- var interval = setInterval(self, aNumber);
- return smalltalk.Timeout._on_(interval);
- ;
- ;
- return self},
- args: ["aNumber"],
- source: "valueWithInterval: aNumber\x0a\x09<\x0a \x09var interval = setInterval(self, aNumber);\x0a \x09return smalltalk.Timeout._on_(interval);\x0a >",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- "_valueWithPossibleArguments_",
- smalltalk.method({
- selector: "valueWithPossibleArguments:",
- category: 'evaluating',
- fn: function (aCollection) {
- var self = this;
- return self.apply(null, aCollection);
- return self;
- },
- args: ["aCollection"],
- source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- "_valueWithTimeout_",
- smalltalk.method({
- selector: "valueWithTimeout:",
- category: 'timeout/interval',
- fn: function (aNumber){
- var self=this;
- var timeout = setTimeout(self, aNumber);
- return smalltalk.Timeout._on_(timeout);
- ;
- ;
- return self},
- args: ["aNumber"],
- source: "valueWithTimeout: aNumber\x0a\x09<\x0a \x09var timeout = setTimeout(self, aNumber);\x0a \x09return smalltalk.Timeout._on_(timeout);\x0a >",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- "_whileFalse",
- smalltalk.method({
- selector: "whileFalse",
- category: 'controlling',
- fn: function () {
- var self = this;
- smalltalk.send(self, "_whileFalse_", [function () {}]);
- return self;
- },
- args: [],
- source: "whileFalse\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileFalse: []",
- messageSends: ["whileFalse:"],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- "_whileFalse_",
- smalltalk.method({
- selector: "whileFalse:",
- category: 'controlling',
- fn: function (aBlock) {
- var self = this;
- while (!self()) {
- aBlock();
- }
- return self;
- },
- args: ["aBlock"],
- source: "whileFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(!self()) {aBlock()}>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- "_whileTrue",
- smalltalk.method({
- selector: "whileTrue",
- category: 'controlling',
- fn: function () {
- var self = this;
- smalltalk.send(self, "_whileTrue_", [function () {}]);
- return self;
- },
- args: [],
- source: "whileTrue\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileTrue: []",
- messageSends: ["whileTrue:"],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- "_whileTrue_",
- smalltalk.method({
- selector: "whileTrue:",
- category: 'controlling',
- fn: function (aBlock) {
- var self = this;
- while (self()) {
- aBlock();
- }
- return self;
- },
- args: ["aBlock"],
- source: "whileTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(self()) {aBlock()}>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addClass('CompiledMethod', smalltalk.Object, [], 'Kernel-Methods');
- smalltalk.CompiledMethod.comment="CompiledMethod hold the source and compiled code of a class method.\x0a\x0aYou can get a CompiledMethod using `Behavior>>methodAt:`\x0a\x0a\x09String methodAt: 'lines'\x0a\x0aand read the source code\x0a\x0a\x09(String methodAt: 'lines') source\x0a\x0aSee referenced classes:\x0a\x0a\x09(String methodAt: 'lines') referencedClasses\x0a\x0aor messages sent from this method:\x0a\x09\x0a\x09(String methodAt: 'lines') messageSends"
- smalltalk.addMethod(
- "_arguments",
- smalltalk.method({
- selector: "arguments",
- category: 'accessing',
- fn: function () {
- var self = this;
- return self.args || [];
- return self;
- },
- args: [],
- source: "arguments\x0a\x09<return self.args || []>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- "_category",
- smalltalk.method({
- selector: "category",
- category: 'accessing',
- fn: function () {
- var self = this;
- var $2, $1;
- $2 = smalltalk.send(self, "_basicAt_", ["category"]);
- if (($receiver = $2) == nil || $receiver == undefined) {
- $1 = "";
- } else {
- $1 = $2;
- }
- return $1;
- },
- args: [],
- source: "category\x0a\x09^(self basicAt: 'category') ifNil: ['']",
- messageSends: ["ifNil:", "basicAt:"],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- "_category_",
- smalltalk.method({
- selector: "category:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- var $1;
- var oldCategory;
- oldCategory=smalltalk.send(self,"_category",[]);
- smalltalk.send(self,"_basicAt_put_",["category",aString]);
- $1=smalltalk.send(self,"_methodClass",[]);
- if(($receiver = $1) == nil || $receiver == undefined){
- $1;
- } else {
- smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_organization",[]),"_addElement_",[aString]);
- smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_methods",[]),"_select_",[(function(each){
- return smalltalk.send(smalltalk.send(each,"_category",[]),"__eq",[oldCategory]);
- })]),"_ifEmpty_",[(function(){
- return smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_organization",[]),"_removeElement_",[oldCategory]);
- })]);
- };
- return self},
- args: ["aString"],
- source: "category: aString\x0a\x09| oldCategory |\x0a oldCategory := self category.\x0a\x09self basicAt: 'category' put: aString.\x0a \x0a self methodClass ifNotNil: [\x0a \x09self methodClass organization addElement: aString.\x0a \x0a\x09\x09(self methodClass methods \x0a \x09\x09select: [ :each | each category = oldCategory ])\x0a \x09ifEmpty: [ self methodClass organization removeElement: oldCategory ] ]",
- messageSends: ["category", "basicAt:put:", "ifNotNil:", "addElement:", "organization", "methodClass", "ifEmpty:", "removeElement:", "select:", "=", "methods"],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- "_fn",
- smalltalk.method({
- selector: "fn",
- category: 'accessing',
- fn: function () {
- var self = this;
- var $1;
- $1 = smalltalk.send(self, "_basicAt_", ["fn"]);
- return $1;
- },
- args: [],
- source: "fn\x0a\x09^self basicAt: 'fn'",
- messageSends: ["basicAt:"],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- "_fn_",
- smalltalk.method({
- selector: "fn:",
- category: 'accessing',
- fn: function (aBlock) {
- var self = this;
- smalltalk.send(self, "_basicAt_put_", ["fn", aBlock]);
- return self;
- },
- args: ["aBlock"],
- source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
- messageSends: ["basicAt:put:"],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- "_messageSends",
- smalltalk.method({
- selector: "messageSends",
- category: 'accessing',
- fn: function () {
- var self = this;
- var $1;
- $1 = smalltalk.send(self, "_basicAt_", ["messageSends"]);
- return $1;
- },
- args: [],
- source: "messageSends\x0a\x09^self basicAt: 'messageSends'",
- messageSends: ["basicAt:"],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- "_methodClass",
- smalltalk.method({
- selector: "methodClass",
- category: 'accessing',
- fn: function () {
- var self = this;
- var $1;
- $1 = smalltalk.send(self, "_basicAt_", ["methodClass"]);
- return $1;
- },
- args: [],
- source: "methodClass\x0a\x09^self basicAt: 'methodClass'",
- messageSends: ["basicAt:"],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- "_protocol",
- smalltalk.method({
- selector: "protocol",
- category: 'accessing',
- fn: function () {
- var self = this;
- var $1;
- $1 = smalltalk.send(self, "_category", []);
- return $1;
- },
- args: [],
- source: "protocol\x0a\x09^ self category",
- messageSends: ["category"],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- "_referencedClasses",
- smalltalk.method({
- selector: "referencedClasses",
- category: 'accessing',
- fn: function () {
- var self = this;
- var $1;
- $1 = smalltalk.send(self, "_basicAt_", ["referencedClasses"]);
- return $1;
- },
- args: [],
- source: "referencedClasses\x0a\x09^self basicAt: 'referencedClasses'",
- messageSends: ["basicAt:"],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- "_selector",
- smalltalk.method({
- selector: "selector",
- category: 'accessing',
- fn: function () {
- var self = this;
- var $1;
- $1 = smalltalk.send(self, "_basicAt_", ["selector"]);
- return $1;
- },
- args: [],
- source: "selector\x0a\x09^self basicAt: 'selector'",
- messageSends: ["basicAt:"],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- "_selector_",
- smalltalk.method({
- selector: "selector:",
- category: 'accessing',
- fn: function (aString) {
- var self = this;
- smalltalk.send(self, "_basicAt_put_", ["selector", aString]);
- return self;
- },
- args: ["aString"],
- source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
- messageSends: ["basicAt:put:"],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- "_source",
- smalltalk.method({
- selector: "source",
- category: 'accessing',
- fn: function () {
- var self = this;
- var $2, $1;
- $2 = smalltalk.send(self, "_basicAt_", ["source"]);
- if (($receiver = $2) == nil || $receiver == undefined) {
- $1 = "";
- } else {
- $1 = $2;
- }
- return $1;
- },
- args: [],
- source: "source\x0a\x09^(self basicAt: 'source') ifNil: ['']",
- messageSends: ["ifNil:", "basicAt:"],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- "_source_",
- smalltalk.method({
- selector: "source:",
- category: 'accessing',
- fn: function (aString) {
- var self = this;
- smalltalk.send(self, "_basicAt_put_", ["source", aString]);
- return self;
- },
- args: ["aString"],
- source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
- messageSends: ["basicAt:put:"],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addClass('ForkPool', smalltalk.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
- smalltalk.ForkPool.comment="A ForkPool is responsible for handling forked blocks.\x0aThe pool size sets the maximum concurrent forked blocks.\x0a\x0aThe default instance is accessed with `ForkPool default`"
- smalltalk.addMethod(
- "_addWorker",
- smalltalk.method({
- selector: "addWorker",
- category: 'action',
- fn: function (){
- var self=this;
- smalltalk.send(self["@worker"],"_valueWithTimeout_",[(0)]);
- self["@poolSize"]=smalltalk.send(self["@poolSize"],"__plus",[(1)]);
- return self},
- args: [],
- source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a poolSize := poolSize + 1",
- messageSends: ["valueWithTimeout:", "+"],
- referencedClasses: []
- }),
- smalltalk.ForkPool);
- smalltalk.addMethod(
- "_defaultMaxPoolSize",
- smalltalk.method({
- selector: "defaultMaxPoolSize",
- category: 'defaults',
- fn: function (){
- var self=this;
- var $1;
- $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_defaultMaxPoolSize",[]);
- return $1;
- },
- args: [],
- source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
- messageSends: ["defaultMaxPoolSize", "class"],
- referencedClasses: []
- }),
- smalltalk.ForkPool);
- smalltalk.addMethod(
- "_fork_",
- smalltalk.method({
- selector: "fork:",
- category: 'action',
- fn: function (aBlock){
- var self=this;
- var $1;
- $1=smalltalk.send(self["@poolSize"],"__lt",[smalltalk.send(self,"_maxPoolSize",[])]);
- if(smalltalk.assert($1)){
- smalltalk.send(self,"_addWorker",[]);
- };
- smalltalk.send(self["@queue"],"_back_",[aBlock]);
- return self},
- args: ["aBlock"],
- source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue back: aBlock",
- messageSends: ["ifTrue:", "addWorker", "<", "maxPoolSize", "back:"],
- referencedClasses: []
- }),
- smalltalk.ForkPool);
- smalltalk.addMethod(
- "_initialize",
- smalltalk.method({
- selector: "initialize",
- category: 'initialization',
- fn: function (){
- var self=this;
- smalltalk.send(self,"_initialize",[],smalltalk.Object);
- self["@poolSize"]=(0);
- self["@queue"]=smalltalk.send((smalltalk.Queue || Queue),"_new",[]);
- self["@worker"]=smalltalk.send(self,"_makeWorker",[]);
- return self},
- args: [],
- source: "initialize\x0a super initialize.\x0a \x0a\x09poolSize := 0.\x0a queue := Queue new.\x0a worker := self makeWorker",
- messageSends: ["initialize", "new", "makeWorker"],
- referencedClasses: ["Queue"]
- }),
- smalltalk.ForkPool);
- smalltalk.addMethod(
- "_makeWorker",
- smalltalk.method({
- selector: "makeWorker",
- category: 'initialization',
- fn: function (){
- var self=this;
- var $2,$1;
- var sentinel;
- sentinel=smalltalk.send((smalltalk.Object || Object),"_new",[]);
- $1=(function(){
- var block;
- self["@poolSize"]=smalltalk.send(self["@poolSize"],"__minus",[(1)]);
- self["@poolSize"];
- block=smalltalk.send(self["@queue"],"_frontIfAbsent_",[(function(){
- return sentinel;
- })]);
- block;
- $2=smalltalk.send(block,"__eq_eq",[sentinel]);
- if(! smalltalk.assert($2)){
- return smalltalk.send((function(){
- return smalltalk.send(block,"_value",[]);
- }),"_ensure_",[(function(){
- return smalltalk.send(self,"_addWorker",[]);
- })]);
- };
- });
- return $1;
- },
- args: [],
- source: "makeWorker\x0a\x09| sentinel |\x0a sentinel := Object new.\x0a ^[ | block |\x0a poolSize := poolSize - 1.\x0a\x09\x09block := queue frontIfAbsent: [ sentinel ].\x0a block == sentinel ifFalse: [\x0a \x09[ block value ] ensure: [ self addWorker ]]]",
- messageSends: ["new", "-", "frontIfAbsent:", "ifFalse:", "ensure:", "addWorker", "value", "=="],
- referencedClasses: ["Object"]
- }),
- smalltalk.ForkPool);
- smalltalk.addMethod(
- "_maxPoolSize",
- smalltalk.method({
- selector: "maxPoolSize",
- category: 'accessing',
- fn: function (){
- var self=this;
- var $2,$1;
- $2=self["@maxPoolSize"];
- if(($receiver = $2) == nil || $receiver == undefined){
- $1=smalltalk.send(self,"_defaultMaxPoolSize",[]);
- } else {
- $1=$2;
- };
- return $1;
- },
- args: [],
- source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
- messageSends: ["ifNil:", "defaultMaxPoolSize"],
- referencedClasses: []
- }),
- smalltalk.ForkPool);
- smalltalk.addMethod(
- "_maxPoolSize_",
- smalltalk.method({
- selector: "maxPoolSize:",
- category: 'accessing',
- fn: function (anInteger){
- var self=this;
- self["@maxPoolSize"]=anInteger;
- return self},
- args: ["anInteger"],
- source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ForkPool);
- smalltalk.ForkPool.klass.iVarNames = ['default'];
- smalltalk.addMethod(
- "_default",
- smalltalk.method({
- selector: "default",
- category: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- if(($receiver = self["@default"]) == nil || $receiver == undefined){
- self["@default"]=smalltalk.send(self,"_new",[]);
- $1=self["@default"];
- } else {
- $1=self["@default"];
- };
- return $1;
- },
- args: [],
- source: "default\x0a\x09^default ifNil: [ default := self new ]",
- messageSends: ["ifNil:", "new"],
- referencedClasses: []
- }),
- smalltalk.ForkPool.klass);
- smalltalk.addMethod(
- "_defaultMaxPoolSize",
- smalltalk.method({
- selector: "defaultMaxPoolSize",
- category: 'accessing',
- fn: function (){
- var self=this;
- return (100);
- },
- args: [],
- source: "defaultMaxPoolSize\x0a\x09^100",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ForkPool.klass);
- smalltalk.addMethod(
- "_resetDefault",
- smalltalk.method({
- selector: "resetDefault",
- category: 'accessing',
- fn: function (){
- var self=this;
- self["@default"]=nil;
- return self},
- args: [],
- source: "resetDefault\x0a\x09default := nil",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ForkPool.klass);
- smalltalk.addClass('Message', smalltalk.Object, ['selector', 'arguments'], 'Kernel-Methods');
- smalltalk.Message.comment="Generally, the system does not use instances of Message for efficiency reasons.\x0aHowever, when a message is not understood by its receiver, the interpreter will make up an instance of it in order to capture the information involved in an actual message transmission. \x0aThis instance is sent it as an argument with the message `doesNotUnderstand:` to the receiver.\x0a\x0aSee boot.js, `messageNotUnderstood` and its counterpart `Object>>doesNotUnderstand:`"
- smalltalk.addMethod(
- "_arguments",
- smalltalk.method({
- selector: "arguments",
- category: 'accessing',
- fn: function () {
- var self = this;
- return self['@arguments'];
- },
- args: [],
- source: "arguments\x0a\x09^arguments",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Message);
- smalltalk.addMethod(
- "_arguments_",
- smalltalk.method({
- selector: "arguments:",
- category: 'accessing',
- fn: function (anArray) {
- var self = this;
- self['@arguments'] = anArray;
- return self;
- },
- args: ["anArray"],
- source: "arguments: anArray\x0a\x09arguments := anArray",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Message);
- smalltalk.addMethod(
- "_printString",
- smalltalk.method({
- selector: "printString",
- category: 'printing',
- fn: function () {
- var self = this;
- var $2, $1;
- $1 = smalltalk.send(smalltalk.String || String, "_streamContents_", [function (aStream) {smalltalk.send(aStream, "_nextPutAll_", [smalltalk.send(self, "_printString", [], smalltalk.Object)]);smalltalk.send(aStream, "_nextPutAll_", ["("]);smalltalk.send(aStream, "_nextPutAll_", [self['@selector']]);$2 = smalltalk.send(aStream, "_nextPutAll_", [")"]);return $2;}]);
- return $1;
- },
- args: [],
- source: "printString\x0a\x09^ String streamContents: [:aStream| \x0a \x09\x09\x09\x09aStream \x0a \x09\x09\x09\x09\x09nextPutAll: super printString;\x0a \x09\x09\x09\x09\x09nextPutAll: '(';\x0a \x09\x09\x09\x09\x09nextPutAll: selector;\x0a \x09\x09\x09\x09\x09nextPutAll: ')' \x09\x09\x09\x09]",
- messageSends: ["streamContents:", "nextPutAll:", "printString"],
- referencedClasses: ["String"]
- }),
- smalltalk.Message);
- smalltalk.addMethod(
- "_selector",
- smalltalk.method({
- selector: "selector",
- category: 'accessing',
- fn: function () {
- var self = this;
- return self['@selector'];
- },
- args: [],
- source: "selector\x0a\x09^selector",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Message);
- smalltalk.addMethod(
- "_selector_",
- smalltalk.method({
- selector: "selector:",
- category: 'accessing',
- fn: function (aString) {
- var self = this;
- self['@selector'] = aString;
- return self;
- },
- args: ["aString"],
- source: "selector: aString\x0a\x09selector := aString",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Message);
- smalltalk.addMethod(
- "_sendTo_",
- smalltalk.method({
- selector: "sendTo:",
- category: 'printing',
- fn: function (anObject) {
- var self = this;
- var $1;
- $1 = smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_send_to_arguments_", [smalltalk.send(self, "_selector", []), anObject, smalltalk.send(self, "_arguments", [])]);
- return $1;
- },
- args: ["anObject"],
- source: "sendTo: anObject\x0a\x09^ Smalltalk current send: self selector to: anObject arguments: self arguments",
- messageSends: ["send:to:arguments:", "selector", "arguments", "current"],
- referencedClasses: ["Smalltalk"]
- }),
- smalltalk.Message);
- smalltalk.addMethod(
- "_selector_arguments_",
- smalltalk.method({
- selector: "selector:arguments:",
- category: 'instance creation',
- fn: function (aString, anArray) {
- var self = this;
- var $2, $3, $1;
- $2 = smalltalk.send(self, "_new", []);
- smalltalk.send($2, "_selector_", [aString]);
- smalltalk.send($2, "_arguments_", [anArray]);
- $3 = smalltalk.send($2, "_yourself", []);
- $1 = $3;
- return $1;
- },
- args: ["aString", "anArray"],
- source: "selector: aString arguments: anArray\x0a\x09^self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
- messageSends: ["selector:", "new", "arguments:", "yourself"],
- referencedClasses: []
- }),
- smalltalk.Message.klass);
- smalltalk.addClass('MethodContext', smalltalk.Object, [], 'Kernel-Methods');
- smalltalk.MethodContext.comment="MethodContext holds all the dynamic state associated with the execution of either a method activation resulting from a message send. That is used to build the call stack while debugging.\x0a \x0aMethodContext instances are JavaScript `SmalltalkMethodContext` objects defined in boot.js \x0a\x0aCurrent limitation: MethodContext instances are not created on Block evaluation. That means it's actually impossible to debug inside a Block."
- smalltalk.addMethod(
- "_asString",
- smalltalk.method({
- selector: "asString",
- category: 'accessing',
- fn: function () {
- var self = this;
- var $1;
- $1 = smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_receiver", []), "_class", []), "_printString", []), "__comma", [" >> "]), "__comma", [smalltalk.send(self, "_selector", [])]);
- return $1;
- },
- args: [],
- source: "asString\x0a\x09^self receiver class printString, ' >> ', self selector",
- messageSends: [",", "selector", "printString", "class", "receiver"],
- referencedClasses: []
- }),
- smalltalk.MethodContext);
- smalltalk.addMethod(
- "_home",
- smalltalk.method({
- selector: "home",
- category: 'accessing',
- fn: function () {
- var self = this;
- return self.homeContext;
- return self;
- },
- args: [],
- source: "home\x0a\x09<return self.homeContext>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MethodContext);
- smalltalk.addMethod(
- "_pc",
- smalltalk.method({
- selector: "pc",
- category: 'accessing',
- fn: function () {
- var self = this;
- return self.pc;
- return self;
- },
- args: [],
- source: "pc\x0a\x09<return self.pc>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MethodContext);
- smalltalk.addMethod(
- "_printString",
- smalltalk.method({
- selector: "printString",
- category: 'accessing',
- fn: function () {
- var self = this;
- var $1;
- $1 = smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_printString", [], smalltalk.Object), "__comma", ["("]), "__comma", [smalltalk.send(self, "_asString", [])]), "__comma", [")"]);
- return $1;
- },
- args: [],
- source: "printString\x0a\x09^super printString, '(', self asString, ')'",
- messageSends: [",", "asString", "printString"],
- referencedClasses: []
- }),
- smalltalk.MethodContext);
- smalltalk.addMethod(
- "_receiver",
- smalltalk.method({
- selector: "receiver",
- category: 'accessing',
- fn: function () {
- var self = this;
- return self.receiver;
- return self;
- },
- args: [],
- source: "receiver\x0a\x09<return self.receiver>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MethodContext);
- smalltalk.addMethod(
- "_selector",
- smalltalk.method({
- selector: "selector",
- category: 'accessing',
- fn: function () {
- var self = this;
- return smalltalk.convertSelector(self.selector);
- return self;
- },
- args: [],
- source: "selector\x0a\x09<return smalltalk.convertSelector(self.selector)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MethodContext);
- smalltalk.addMethod(
- "_temps",
- smalltalk.method({
- selector: "temps",
- category: 'accessing',
- fn: function () {
- var self = this;
- return self.temps;
- return self;
- },
- args: [],
- source: "temps\x0a\x09<return self.temps>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MethodContext);
|