amber/js/Kernel-Methods.js in resin-0.0.1 vs amber/js/Kernel-Methods.js in resin-0.0.2

- old
+ new

@@ -1,213 +1,247 @@ smalltalk.addPackage('Kernel-Methods', {}); -smalltalk.addClass('CompiledMethod', smalltalk.Object, [], 'Kernel-Methods'); -smalltalk.CompiledMethod.comment=unescape('CompiledMethod%20hold%20the%20source%20and%20compiled%20code%20of%20a%20class%20method.%0A%0AYou%20can%20get%20a%20CompiledMethod%20using%20%60Behavior%3E%3EmethodAt%3A%60%0A%0A%09String%20methodAt%3A%20%27lines%27%0A%0Aand%20read%20the%20source%20code%0A%0A%09%28String%20methodAt%3A%20%27lines%27%29%20source%0A%0ASee%20referenced%20classes%3A%0A%0A%09%28String%20methodAt%3A%20%27lines%27%29%20referencedClasses%0A%0Aor%20messages%20sent%20from%20this%20method%3A%0A%09%0A%09%28String%20methodAt%3A%20%27lines%27%29%20%20messageSends') +smalltalk.addClass('Message', smalltalk.Object, ['selector', 'arguments'], 'Kernel-Methods'); +smalltalk.Message.comment=unescape('Generally%2C%20the%20system%20does%20not%20use%20instances%20of%20Message%20for%20efficiency%20reasons.%0AHowever%2C%20when%20a%20message%20is%20not%20understood%20by%20its%20receiver%2C%20the%20interpreter%20will%20make%20up%20an%20instance%20of%20it%20in%20order%20to%20capture%20the%20information%20involved%20in%20an%20actual%20message%20transmission.%20%0AThis%20instance%20is%20sent%20it%20as%20an%20argument%20with%20the%20message%20%60doesNotUnderstand%3A%60%20to%20the%20receiver.%0A%0ASee%20boot.js%2C%20%60messageNotUnderstood%60%20%20and%20its%20counterpart%20%60Object%3E%3EdoesNotUnderstand%3A%60') smalltalk.addMethod( -unescape('_source'), +unescape('_selector'), smalltalk.method({ -selector: unescape('source'), +selector: unescape('selector'), category: 'accessing', -fn: function (){ -var self=this; -return (($receiver = smalltalk.send(self, "_basicAt_", ["source"])) == nil || $receiver == undefined) ? (function(){return "";})() : $receiver; -return self;}, +fn: function () { + var self = this; + return self['@selector']; + return self; +}, args: [], -source: unescape('source%0A%09%5E%28self%20basicAt%3A%20%27source%27%29%20ifNil%3A%20%5B%27%27%5D'), -messageSends: ["ifNil:", "basicAt:"], +source: unescape('selector%0A%09%5Eselector'), +messageSends: [], referencedClasses: [] }), -smalltalk.CompiledMethod); +smalltalk.Message); smalltalk.addMethod( -unescape('_source_'), +unescape('_selector_'), smalltalk.method({ -selector: unescape('source%3A'), +selector: unescape('selector%3A'), category: 'accessing', -fn: function (aString){ -var self=this; -smalltalk.send(self, "_basicAt_put_", ["source", aString]); -return self;}, +fn: function (aString) { + var self = this; + self['@selector'] = aString; + return self; +}, args: ["aString"], -source: unescape('source%3A%20aString%0A%09self%20basicAt%3A%20%27source%27%20put%3A%20aString'), -messageSends: ["basicAt:put:"], +source: unescape('selector%3A%20aString%0A%09selector%20%3A%3D%20aString'), +messageSends: [], referencedClasses: [] }), -smalltalk.CompiledMethod); +smalltalk.Message); smalltalk.addMethod( -unescape('_category'), +unescape('_arguments_'), smalltalk.method({ -selector: unescape('category'), +selector: unescape('arguments%3A'), category: 'accessing', -fn: function (){ -var self=this; -return (($receiver = smalltalk.send(self, "_basicAt_", ["category"])) == nil || $receiver == undefined) ? (function(){return "";})() : $receiver; -return self;}, -args: [], -source: unescape('category%0A%09%5E%28self%20basicAt%3A%20%27category%27%29%20ifNil%3A%20%5B%27%27%5D'), -messageSends: ["ifNil:", "basicAt:"], +fn: function (anArray) { + var self = this; + self['@arguments'] = anArray; + return self; +}, +args: ["anArray"], +source: unescape('arguments%3A%20anArray%0A%09arguments%20%3A%3D%20anArray'), +messageSends: [], referencedClasses: [] }), -smalltalk.CompiledMethod); +smalltalk.Message); smalltalk.addMethod( -unescape('_category_'), +unescape('_arguments'), smalltalk.method({ -selector: unescape('category%3A'), +selector: unescape('arguments'), category: 'accessing', -fn: function (aString){ -var self=this; -smalltalk.send(self, "_basicAt_put_", ["category", aString]); -return self;}, -args: ["aString"], -source: unescape('category%3A%20aString%0A%09self%20basicAt%3A%20%27category%27%20put%3A%20aString'), -messageSends: ["basicAt:put:"], +fn: function () { + var self = this; + return self['@arguments']; + return self; +}, +args: [], +source: unescape('arguments%0A%09%5Earguments'), +messageSends: [], referencedClasses: [] }), -smalltalk.CompiledMethod); +smalltalk.Message); smalltalk.addMethod( -unescape('_selector'), +unescape('_printString'), smalltalk.method({ -selector: unescape('selector'), -category: 'accessing', -fn: function (){ -var self=this; -return smalltalk.send(self, "_basicAt_", ["selector"]); -return self;}, +selector: unescape('printString'), +category: 'printing', +fn: function () { + var self = this; + return smalltalk.send(smalltalk.String || String, "_streamContents_", [function (aStream) {return function ($rec) {smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(self, "_printString", [], smalltalk.Object)]);smalltalk.send($rec, "_nextPutAll_", [unescape("%28")]);smalltalk.send($rec, "_nextPutAll_", [self['@selector']]);return smalltalk.send($rec, "_nextPutAll_", [unescape("%29")]);}(aStream);}]); + return self; +}, args: [], -source: unescape('selector%0A%09%5Eself%20basicAt%3A%20%27selector%27'), -messageSends: ["basicAt:"], -referencedClasses: [] +source: unescape('printString%0A%09%5E%20String%20streamContents%3A%20%5B%3AaStream%7C%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09%09%09%09aStream%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09%09%09%09%09nextPutAll%3A%20super%20printString%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09%09%09%09%09nextPutAll%3A%20%27%28%27%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09%09%09%09%09nextPutAll%3A%20selector%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09%09%09%09%09nextPutAll%3A%20%27%29%27%20%09%09%09%09%5D'), +messageSends: ["streamContents:", "nextPutAll:", "printString"], +referencedClasses: ["String"] }), -smalltalk.CompiledMethod); +smalltalk.Message); smalltalk.addMethod( -unescape('_selector_'), +unescape('_sendTo_'), smalltalk.method({ -selector: unescape('selector%3A'), -category: 'accessing', -fn: function (aString){ -var self=this; -smalltalk.send(self, "_basicAt_put_", ["selector", aString]); -return self;}, -args: ["aString"], -source: unescape('selector%3A%20aString%0A%09self%20basicAt%3A%20%27selector%27%20put%3A%20aString'), -messageSends: ["basicAt:put:"], +selector: unescape('sendTo%3A'), +category: 'printing', +fn: function (anObject) { + var self = this; + smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_send_to_arguments_", [smalltalk.send(self, "_selector", []), anObject, smalltalk.send(self, "_arguments", [])]); + return self; +}, +args: ["anObject"], +source: unescape('sendTo%3A%20anObject%0A%09Smalltalk%20current%20send%3A%20self%20selector%20to%3A%20anObject%20arguments%3A%20self%20arguments'), +messageSends: ["send:to:arguments:", "current", "selector", "arguments"], +referencedClasses: ["Smalltalk"] +}), +smalltalk.Message); + + +smalltalk.addMethod( +unescape('_selector_arguments_'), +smalltalk.method({ +selector: unescape('selector%3Aarguments%3A'), +category: 'instance creation', +fn: function (aString, anArray) { + var self = this; + return function ($rec) {smalltalk.send($rec, "_selector_", [aString]);smalltalk.send($rec, "_arguments_", [anArray]);return smalltalk.send($rec, "_yourself", []);}(smalltalk.send(self, "_new", [])); + return self; +}, +args: ["aString", "anArray"], +source: unescape('selector%3A%20aString%20arguments%3A%20anArray%0A%09%5Eself%20new%0A%09%09selector%3A%20aString%3B%0A%09%09arguments%3A%20anArray%3B%0A%09%09yourself'), +messageSends: ["selector:", "arguments:", "yourself", "new"], referencedClasses: [] }), -smalltalk.CompiledMethod); +smalltalk.Message.klass); + +smalltalk.addClass('MethodContext', smalltalk.Object, [], 'Kernel-Methods'); +smalltalk.MethodContext.comment=unescape('MethodContext%20holds%20all%20the%20dynamic%20state%20associated%20with%20the%20execution%20of%20either%20a%20method%20activation%20resulting%20from%20a%20message%20send.%20That%20is%20used%20to%20build%20the%20call%20stack%20while%20debugging.%0A%20%20%0AMethodContext%20instances%20are%20JavaScript%20%60SmalltalkMethodContext%60%20objects%20defined%20in%20boot.js%20%0A%0ACurrent%20limitation%3A%20MethodContext%20instances%20are%20not%20created%20on%20Block%20evaluation.%20That%20means%20it%27s%20actually%20impossible%20to%20debug%20inside%20a%20Block.') smalltalk.addMethod( -unescape('_fn'), +unescape('_receiver'), smalltalk.method({ -selector: unescape('fn'), +selector: unescape('receiver'), category: 'accessing', -fn: function (){ -var self=this; -return smalltalk.send(self, "_basicAt_", ["fn"]); -return self;}, +fn: function () { + var self = this; + return self.receiver; + return self; +}, args: [], -source: unescape('fn%0A%09%5Eself%20basicAt%3A%20%27fn%27'), -messageSends: ["basicAt:"], +source: unescape('receiver%0A%09%3Creturn%20self.receiver%3E'), +messageSends: [], referencedClasses: [] }), -smalltalk.CompiledMethod); +smalltalk.MethodContext); smalltalk.addMethod( -unescape('_fn_'), +unescape('_selector'), smalltalk.method({ -selector: unescape('fn%3A'), +selector: unescape('selector'), category: 'accessing', -fn: function (aBlock){ -var self=this; -smalltalk.send(self, "_basicAt_put_", ["fn", aBlock]); -return self;}, -args: ["aBlock"], -source: unescape('fn%3A%20aBlock%0A%09self%20basicAt%3A%20%27fn%27%20put%3A%20aBlock'), -messageSends: ["basicAt:put:"], +fn: function () { + var self = this; + return smalltalk.convertSelector(self.selector); + return self; +}, +args: [], +source: unescape('selector%0A%09%3Creturn%20smalltalk.convertSelector%28self.selector%29%3E'), +messageSends: [], referencedClasses: [] }), -smalltalk.CompiledMethod); +smalltalk.MethodContext); smalltalk.addMethod( -unescape('_messageSends'), +unescape('_home'), smalltalk.method({ -selector: unescape('messageSends'), +selector: unescape('home'), category: 'accessing', -fn: function (){ -var self=this; -return smalltalk.send(self, "_basicAt_", ["messageSends"]); -return self;}, +fn: function () { + var self = this; + return self.homeContext; + return self; +}, args: [], -source: unescape('messageSends%0A%09%5Eself%20basicAt%3A%20%27messageSends%27'), -messageSends: ["basicAt:"], +source: unescape('home%0A%09%3Creturn%20self.homeContext%3E'), +messageSends: [], referencedClasses: [] }), -smalltalk.CompiledMethod); +smalltalk.MethodContext); smalltalk.addMethod( -unescape('_methodClass'), +unescape('_temps'), smalltalk.method({ -selector: unescape('methodClass'), +selector: unescape('temps'), category: 'accessing', -fn: function (){ -var self=this; -return smalltalk.send(self, "_basicAt_", ["methodClass"]); -return self;}, +fn: function () { + var self = this; + return self.temps; + return self; +}, args: [], -source: unescape('methodClass%0A%09%5Eself%20basicAt%3A%20%27methodClass%27'), -messageSends: ["basicAt:"], +source: unescape('temps%0A%09%3Creturn%20self.temps%3E'), +messageSends: [], referencedClasses: [] }), -smalltalk.CompiledMethod); +smalltalk.MethodContext); smalltalk.addMethod( -unescape('_referencedClasses'), +unescape('_printString'), smalltalk.method({ -selector: unescape('referencedClasses'), +selector: unescape('printString'), category: 'accessing', -fn: function (){ -var self=this; -return smalltalk.send(self, "_basicAt_", ["referencedClasses"]); -return self;}, +fn: function () { + var self = this; + return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_printString", [], smalltalk.Object), "__comma", [unescape("%28")]), "__comma", [smalltalk.send(self, "_asString", [])]), "__comma", [unescape("%29")]); + return self; +}, args: [], -source: unescape('referencedClasses%0A%09%5Eself%20basicAt%3A%20%27referencedClasses%27'), -messageSends: ["basicAt:"], +source: unescape('printString%0A%09%5Esuper%20printString%2C%20%27%28%27%2C%20self%20asString%2C%20%27%29%27'), +messageSends: [unescape("%2C"), "printString", "asString"], referencedClasses: [] }), -smalltalk.CompiledMethod); +smalltalk.MethodContext); smalltalk.addMethod( -unescape('_arguments'), +unescape('_asString'), smalltalk.method({ -selector: unescape('arguments'), +selector: unescape('asString'), category: 'accessing', -fn: function (){ -var self=this; -return self.args || []; -return self;}, +fn: function () { + var self = this; + return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_receiver", []), "_class", []), "_printString", []), "__comma", [unescape("%20%3E%3E%20")]), "__comma", [smalltalk.send(self, "_selector", [])]); + return self; +}, args: [], -source: unescape('arguments%0A%09%3Creturn%20self.args%20%7C%7C%20%5B%5D%3E'), -messageSends: [], +source: unescape('asString%0A%09%5Eself%20receiver%20class%20printString%2C%20%27%20%3E%3E%20%27%2C%20self%20selector'), +messageSends: [unescape("%2C"), "printString", "class", "receiver", "selector"], referencedClasses: [] }), -smalltalk.CompiledMethod); +smalltalk.MethodContext); smalltalk.addClass('BlockClosure', smalltalk.Object, [], 'Kernel-Methods'); smalltalk.BlockClosure.comment=unescape('A%20BlockClosure%20is%20a%20lexical%20closure.%0AThe%20JavaScript%20representation%20is%20a%20function.%0A%0AA%20BlockClosure%20is%20evaluated%20with%20the%20%60%23value*%60%20methods%20in%20the%20%27evaluating%27%20protocol.') smalltalk.addMethod( unescape('_compiledSource'), smalltalk.method({ selector: unescape('compiledSource'), category: 'accessing', -fn: function (){ -var self=this; -return self.toString(); -return self;}, +fn: function () { + var self = this; + return self.toString(); + return self; +}, args: [], source: unescape('compiledSource%0A%09%3Creturn%20self.toString%28%29%3E'), messageSends: [], referencedClasses: [] }), @@ -216,14 +250,17 @@ smalltalk.addMethod( unescape('_whileTrue_'), smalltalk.method({ selector: unescape('whileTrue%3A'), category: 'controlling', -fn: function (aBlock){ -var self=this; -while(self()) {aBlock()}; -return self;}, +fn: function (aBlock) { + var self = this; + while (self()) { + aBlock(); + } + return self; +}, args: ["aBlock"], source: unescape('whileTrue%3A%20aBlock%0A%09%22inlined%20in%20the%20Compiler%22%0A%09%3Cwhile%28self%28%29%29%20%7BaBlock%28%29%7D%3E'), messageSends: [], referencedClasses: [] }), @@ -232,14 +269,17 @@ smalltalk.addMethod( unescape('_whileFalse_'), smalltalk.method({ selector: unescape('whileFalse%3A'), category: 'controlling', -fn: function (aBlock){ -var self=this; -while(!self()) {aBlock()}; -return self;}, +fn: function (aBlock) { + var self = this; + while (!self()) { + aBlock(); + } + return self; +}, args: ["aBlock"], source: unescape('whileFalse%3A%20aBlock%0A%09%22inlined%20in%20the%20Compiler%22%0A%09%3Cwhile%28%21self%28%29%29%20%7BaBlock%28%29%7D%3E'), messageSends: [], referencedClasses: [] }), @@ -248,14 +288,15 @@ smalltalk.addMethod( unescape('_value'), smalltalk.method({ selector: unescape('value'), category: 'evaluating', -fn: function (){ -var self=this; -return self();; -return self;}, +fn: function () { + var self = this; + return self(); + return self; +}, args: [], source: unescape('value%0A%09%22inlined%20in%20the%20Compiler%22%0A%09%3Creturn%20self%28%29%3B%3E'), messageSends: [], referencedClasses: [] }), @@ -264,14 +305,15 @@ smalltalk.addMethod( unescape('_value_'), smalltalk.method({ selector: unescape('value%3A'), category: 'evaluating', -fn: function (anArg){ -var self=this; -return self(anArg);; -return self;}, +fn: function (anArg) { + var self = this; + return self(anArg); + return self; +}, args: ["anArg"], source: unescape('value%3A%20anArg%0A%09%22inlined%20in%20the%20Compiler%22%0A%09%3Creturn%20self%28anArg%29%3B%3E'), messageSends: [], referencedClasses: [] }), @@ -280,14 +322,15 @@ smalltalk.addMethod( unescape('_value_value_'), smalltalk.method({ selector: unescape('value%3Avalue%3A'), category: 'evaluating', -fn: function (firstArg, secondArg){ -var self=this; -return self(firstArg, secondArg);; -return self;}, +fn: function (firstArg, secondArg) { + var self = this; + return self(firstArg, secondArg); + return self; +}, args: ["firstArg", "secondArg"], source: unescape('value%3A%20firstArg%20value%3A%20secondArg%0A%09%22inlined%20in%20the%20Compiler%22%0A%09%3Creturn%20self%28firstArg%2C%20secondArg%29%3B%3E'), messageSends: [], referencedClasses: [] }), @@ -296,14 +339,15 @@ smalltalk.addMethod( unescape('_value_value_value_'), smalltalk.method({ selector: unescape('value%3Avalue%3Avalue%3A'), category: 'evaluating', -fn: function (firstArg, secondArg, thirdArg){ -var self=this; -return self(firstArg, secondArg, thirdArg);; -return self;}, +fn: function (firstArg, secondArg, thirdArg) { + var self = this; + return self(firstArg, secondArg, thirdArg); + return self; +}, args: ["firstArg", "secondArg", "thirdArg"], source: unescape('value%3A%20firstArg%20value%3A%20secondArg%20value%3A%20thirdArg%0A%09%22inlined%20in%20the%20Compiler%22%0A%09%3Creturn%20self%28firstArg%2C%20secondArg%2C%20thirdArg%29%3B%3E'), messageSends: [], referencedClasses: [] }), @@ -312,14 +356,15 @@ smalltalk.addMethod( unescape('_valueWithPossibleArguments_'), smalltalk.method({ selector: unescape('valueWithPossibleArguments%3A'), category: 'evaluating', -fn: function (aCollection){ -var self=this; -return self.apply(null, aCollection);; -return self;}, +fn: function (aCollection) { + var self = this; + return self.apply(null, aCollection); + return self; +}, args: ["aCollection"], source: unescape('valueWithPossibleArguments%3A%20aCollection%0A%09%3Creturn%20self.apply%28null%2C%20aCollection%29%3B%3E'), messageSends: [], referencedClasses: [] }), @@ -328,14 +373,15 @@ smalltalk.addMethod( unescape('_on_do_'), smalltalk.method({ selector: unescape('on%3Ado%3A'), category: 'error handling', -fn: function (anErrorClass, aBlock){ -var self=this; -return smalltalk.send(self, "_try_catch_", [self, (function(error){return ((($receiver = smalltalk.send(error, "_isKindOf_", [anErrorClass])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(aBlock, "_value_", [error]);})() : (function(){return smalltalk.send(error, "_signal", []);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(aBlock, "_value_", [error]);}), (function(){return smalltalk.send(error, "_signal", []);})]));})]); -return self;}, +fn: function (anErrorClass, aBlock) { + var self = this; + return smalltalk.send(self, "_try_catch_", [self, function (error) {return ($receiver = smalltalk.send(error, "_isKindOf_", [anErrorClass])).klass === smalltalk.Boolean ? $receiver ? function () {return smalltalk.send(aBlock, "_value_", [error]);}() : function () {return smalltalk.send(error, "_signal", []);}() : smalltalk.send($receiver, "_ifTrue_ifFalse_", [function () {return smalltalk.send(aBlock, "_value_", [error]);}, function () {return smalltalk.send(error, "_signal", []);}]);}]); + return self; +}, args: ["anErrorClass", "aBlock"], source: unescape('on%3A%20anErrorClass%20do%3A%20aBlock%0A%09%5Eself%20try%3A%20self%20catch%3A%20%5B%3Aerror%20%7C%0A%09%20%20%20%20%28error%20isKindOf%3A%20anErrorClass%29%20%0A%09%20%20%20%20%20ifTrue%3A%20%5BaBlock%20value%3A%20error%5D%0A%09%20%20%20%20%20ifFalse%3A%20%5Berror%20signal%5D%5D'), messageSends: ["try:catch:", "ifTrue:ifFalse:", "isKindOf:", "value:", "signal"], referencedClasses: [] }), @@ -344,14 +390,15 @@ smalltalk.addMethod( unescape('_valueWithTimeout_'), smalltalk.method({ selector: unescape('valueWithTimeout%3A'), category: 'timeout/interval', -fn: function (aNumber){ -var self=this; -return setTimeout(self, aNumber); -return self;}, +fn: function (aNumber) { + var self = this; + return setTimeout(self, aNumber); + return self; +}, args: ["aNumber"], source: unescape('valueWithTimeout%3A%20aNumber%0A%09%3Creturn%20setTimeout%28self%2C%20aNumber%29%3E'), messageSends: [], referencedClasses: [] }), @@ -360,14 +407,15 @@ smalltalk.addMethod( unescape('_valueWithInterval_'), smalltalk.method({ selector: unescape('valueWithInterval%3A'), category: 'timeout/interval', -fn: function (aNumber){ -var self=this; -return setInterval(self, aNumber); -return self;}, +fn: function (aNumber) { + var self = this; + return setInterval(self, aNumber); + return self; +}, args: ["aNumber"], source: unescape('valueWithInterval%3A%20aNumber%0A%09%3Creturn%20setInterval%28self%2C%20aNumber%29%3E'), messageSends: [], referencedClasses: [] }), @@ -376,14 +424,15 @@ smalltalk.addMethod( unescape('_whileFalse'), smalltalk.method({ selector: unescape('whileFalse'), category: 'controlling', -fn: function (){ -var self=this; -smalltalk.send(self, "_whileFalse_", [(function(){return nil;})]); -return self;}, +fn: function () { + var self = this; + smalltalk.send(self, "_whileFalse_", [function () {return nil;}]); + return self; +}, args: [], source: unescape('whileFalse%0A%09%22inlined%20in%20the%20Compiler%22%0A%09self%20whileFalse%3A%20%5B%5D'), messageSends: ["whileFalse:"], referencedClasses: [] }), @@ -392,14 +441,15 @@ smalltalk.addMethod( unescape('_whileTrue'), smalltalk.method({ selector: unescape('whileTrue'), category: 'controlling', -fn: function (){ -var self=this; -smalltalk.send(self, "_whileTrue_", [(function(){return nil;})]); -return self;}, +fn: function () { + var self = this; + smalltalk.send(self, "_whileTrue_", [function () {return nil;}]); + return self; +}, args: [], source: unescape('whileTrue%0A%09%22inlined%20in%20the%20Compiler%22%0A%09self%20whileTrue%3A%20%5B%5D'), messageSends: ["whileTrue:"], referencedClasses: [] }), @@ -408,14 +458,15 @@ smalltalk.addMethod( unescape('_new'), smalltalk.method({ selector: unescape('new'), category: 'evaluating', -fn: function (){ -var self=this; -return new self(); -return self;}, +fn: function () { + var self = this; + return new self; + return self; +}, args: [], source: unescape('new%0A%09%22Use%20the%20receiver%20as%20a%20JS%20constructor.%20%0A%09*Do%20not*%20use%20this%20method%20to%20instanciate%20Smalltalk%20objects%21%22%0A%09%3Creturn%20new%20self%28%29%3E'), messageSends: [], referencedClasses: [] }), @@ -424,14 +475,15 @@ smalltalk.addMethod( unescape('_applyTo_arguments_'), smalltalk.method({ selector: unescape('applyTo%3Aarguments%3A'), category: 'evaluating', -fn: function (anObject, aCollection){ -var self=this; -return self.apply(anObject, aCollection); -return self;}, +fn: function (anObject, aCollection) { + var self = this; + return self.apply(anObject, aCollection); + return self; +}, args: ["anObject", "aCollection"], source: unescape('applyTo%3A%20anObject%20arguments%3A%20aCollection%0A%09%3Creturn%20self.apply%28anObject%2C%20aCollection%29%3E'), messageSends: [], referencedClasses: [] }), @@ -440,14 +492,15 @@ smalltalk.addMethod( unescape('_timeToRun'), smalltalk.method({ selector: unescape('timeToRun'), category: 'evaluating', -fn: function (){ -var self=this; -return smalltalk.send((smalltalk.Date || Date), "_millisecondsToRun_", [self]); -return self;}, +fn: function () { + var self = this; + return smalltalk.send(smalltalk.Date || Date, "_millisecondsToRun_", [self]); + return self; +}, args: [], source: unescape('timeToRun%0A%09%22Answer%20the%20number%20of%20milliseconds%20taken%20to%20execute%20this%20block.%22%0A%0A%09%5E%20Date%20millisecondsToRun%3A%20self'), messageSends: ["millisecondsToRun:"], referencedClasses: ["Date"] }), @@ -456,14 +509,15 @@ smalltalk.addMethod( unescape('_numArgs'), smalltalk.method({ selector: unescape('numArgs'), category: 'accessing', -fn: function (){ -var self=this; -return self.length; -return self;}, +fn: function () { + var self = this; + return self.length; + return self; +}, args: [], source: unescape('numArgs%0A%09%3Creturn%20self.length%3E'), messageSends: [], referencedClasses: [] }), @@ -472,16 +526,17 @@ smalltalk.addMethod( unescape('_ensure_'), smalltalk.method({ selector: unescape('ensure%3A'), category: 'evaluating', -fn: function (aBlock){ -var self=this; -var success=nil; -(success=false); -return smalltalk.send((function(){smalltalk.send(self, "_value", []);(success=true);return smalltalk.send(aBlock, "_value", []);}), "_on_do_", [(smalltalk.Error || Error), (function(ex){((($receiver = success).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(aBlock, "_value", []);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(aBlock, "_value", []);})]));return smalltalk.send(ex, "_signal", []);})]); -return self;}, +fn: function (aBlock) { + var self = this; + var success = nil; + success = false; + return smalltalk.send(function () {smalltalk.send(self, "_value", []);success = true;return smalltalk.send(aBlock, "_value", []);}, "_on_do_", [smalltalk.Error || Error, function (ex) {($receiver = success).klass === smalltalk.Boolean ? !$receiver ? function () {return smalltalk.send(aBlock, "_value", []);}() : nil : smalltalk.send($receiver, "_ifFalse_", [function () {return smalltalk.send(aBlock, "_value", []);}]);return smalltalk.send(ex, "_signal", []);}]); + return self; +}, args: ["aBlock"], source: unescape('ensure%3A%20aBlock%0A%09%7C%20success%20%7C%0A%09success%20%3A%3D%20false.%0A%09%5E%5Bself%20value.%20success%20%3A%3D%20true.%20aBlock%20value%5D%0A%09%09on%3A%20Error%0A%09%09do%3A%20%5B%3Aex%20%7C%0A%09%09%09success%20ifFalse%3A%20%5BaBlock%20value%5D.%0A%09%09%09ex%20signal%5D'), messageSends: ["on:do:", "value", "ifFalse:", "signal"], referencedClasses: ["Error"] }), @@ -490,14 +545,15 @@ smalltalk.addMethod( unescape('_newValue_'), smalltalk.method({ selector: unescape('newValue%3A'), category: 'evaluating', -fn: function (anObject){ -var self=this; -return new self(anObject); -return self;}, +fn: function (anObject) { + var self = this; + return new self(anObject); + return self; +}, args: ["anObject"], source: unescape('newValue%3A%20anObject%0A%09%22Use%20the%20receiver%20as%20a%20JS%20constructor.%20%0A%09*Do%20not*%20use%20this%20method%20to%20instanciate%20Smalltalk%20objects%21%22%0A%09%3Creturn%20new%20self%28anObject%29%3E'), messageSends: [], referencedClasses: [] }), @@ -506,14 +562,15 @@ smalltalk.addMethod( unescape('_newValue_value_'), smalltalk.method({ selector: unescape('newValue%3Avalue%3A'), category: 'evaluating', -fn: function (anObject, anObject2){ -var self=this; -return new self(anObject, anObject2); -return self;}, +fn: function (anObject, anObject2) { + var self = this; + return new self(anObject, anObject2); + return self; +}, args: ["anObject", "anObject2"], source: unescape('newValue%3A%20%20anObject%20value%3A%20anObject2%0A%09%22Use%20the%20receiver%20as%20a%20JS%20constructor.%20%0A%09*Do%20not*%20use%20this%20method%20to%20instanciate%20Smalltalk%20objects%21%22%0A%09%3Creturn%20new%20self%28anObject%2C%20anObject2%29%3E'), messageSends: [], referencedClasses: [] }), @@ -522,218 +579,229 @@ smalltalk.addMethod( unescape('_newValue_value_value_'), smalltalk.method({ selector: unescape('newValue%3Avalue%3Avalue%3A'), category: 'evaluating', -fn: function (anObject, anObject2, anObject3){ -var self=this; -return new self(anObject, anObject2); -return self;}, +fn: function (anObject, anObject2, anObject3) { + var self = this; + return new self(anObject, anObject2); + return self; +}, args: ["anObject", "anObject2", "anObject3"], source: unescape('newValue%3A%20%20anObject%20value%3A%20anObject2%20value%3A%20anObject3%0A%09%22Use%20the%20receiver%20as%20a%20JS%20constructor.%20%0A%09*Do%20not*%20use%20this%20method%20to%20instanciate%20Smalltalk%20objects%21%22%0A%09%3Creturn%20new%20self%28anObject%2C%20anObject2%29%3E'), messageSends: [], referencedClasses: [] }), smalltalk.BlockClosure); -smalltalk.addClass('MethodContext', smalltalk.Object, [], 'Kernel-Methods'); -smalltalk.MethodContext.comment=unescape('MethodContext%20holds%20all%20the%20dynamic%20state%20associated%20with%20the%20execution%20of%20either%20a%20method%20activation%20resulting%20from%20a%20message%20send.%20That%20is%20used%20to%20build%20the%20call%20stack%20while%20debugging.%0A%20%20%0AMethodContext%20instances%20are%20JavaScript%20%60SmalltalkMethodContext%60%20objects%20defined%20in%20boot.js%20%0A%0ACurrent%20limitation%3A%20MethodContext%20instances%20are%20not%20created%20on%20Block%20evaluation.%20That%20means%20it%27s%20actually%20impossible%20to%20debug%20inside%20a%20Block.') +smalltalk.addClass('CompiledMethod', smalltalk.Object, [], 'Kernel-Methods'); +smalltalk.CompiledMethod.comment=unescape('CompiledMethod%20hold%20the%20source%20and%20compiled%20code%20of%20a%20class%20method.%0A%0AYou%20can%20get%20a%20CompiledMethod%20using%20%60Behavior%3E%3EmethodAt%3A%60%0A%0A%09String%20methodAt%3A%20%27lines%27%0A%0Aand%20read%20the%20source%20code%0A%0A%09%28String%20methodAt%3A%20%27lines%27%29%20source%0A%0ASee%20referenced%20classes%3A%0A%0A%09%28String%20methodAt%3A%20%27lines%27%29%20referencedClasses%0A%0Aor%20messages%20sent%20from%20this%20method%3A%0A%09%0A%09%28String%20methodAt%3A%20%27lines%27%29%20%20messageSends') smalltalk.addMethod( -unescape('_receiver'), +unescape('_source'), smalltalk.method({ -selector: unescape('receiver'), +selector: unescape('source'), category: 'accessing', -fn: function (){ -var self=this; -return self.receiver; -return self;}, +fn: function () { + var self = this; + return ($receiver = smalltalk.send(self, "_basicAt_", ["source"])) == nil || + $receiver == undefined ? function () {return "";}() : $receiver; + return self; +}, args: [], -source: unescape('receiver%0A%09%3Creturn%20self.receiver%3E'), -messageSends: [], +source: unescape('source%0A%09%5E%28self%20basicAt%3A%20%27source%27%29%20ifNil%3A%20%5B%27%27%5D'), +messageSends: ["ifNil:", "basicAt:"], referencedClasses: [] }), -smalltalk.MethodContext); +smalltalk.CompiledMethod); smalltalk.addMethod( -unescape('_selector'), +unescape('_source_'), smalltalk.method({ -selector: unescape('selector'), +selector: unescape('source%3A'), category: 'accessing', -fn: function (){ -var self=this; -return smalltalk.convertSelector(self.selector); -return self;}, -args: [], -source: unescape('selector%0A%09%3Creturn%20smalltalk.convertSelector%28self.selector%29%3E'), -messageSends: [], +fn: function (aString) { + var self = this; + smalltalk.send(self, "_basicAt_put_", ["source", aString]); + return self; +}, +args: ["aString"], +source: unescape('source%3A%20aString%0A%09self%20basicAt%3A%20%27source%27%20put%3A%20aString'), +messageSends: ["basicAt:put:"], referencedClasses: [] }), -smalltalk.MethodContext); +smalltalk.CompiledMethod); smalltalk.addMethod( -unescape('_home'), +unescape('_category'), smalltalk.method({ -selector: unescape('home'), +selector: unescape('category'), category: 'accessing', -fn: function (){ -var self=this; -return self.homeContext; -return self;}, +fn: function () { + var self = this; + return ($receiver = smalltalk.send(self, "_basicAt_", ["category"])) == nil || + $receiver == undefined ? function () {return "";}() : $receiver; + return self; +}, args: [], -source: unescape('home%0A%09%3Creturn%20self.homeContext%3E'), -messageSends: [], +source: unescape('category%0A%09%5E%28self%20basicAt%3A%20%27category%27%29%20ifNil%3A%20%5B%27%27%5D'), +messageSends: ["ifNil:", "basicAt:"], referencedClasses: [] }), -smalltalk.MethodContext); +smalltalk.CompiledMethod); smalltalk.addMethod( -unescape('_temps'), +unescape('_category_'), smalltalk.method({ -selector: unescape('temps'), +selector: unescape('category%3A'), category: 'accessing', -fn: function (){ -var self=this; -return self.temps; -return self;}, -args: [], -source: unescape('temps%0A%09%3Creturn%20self.temps%3E'), -messageSends: [], +fn: function (aString) { + var self = this; + smalltalk.send(self, "_basicAt_put_", ["category", aString]); + return self; +}, +args: ["aString"], +source: unescape('category%3A%20aString%0A%09self%20basicAt%3A%20%27category%27%20put%3A%20aString'), +messageSends: ["basicAt:put:"], referencedClasses: [] }), -smalltalk.MethodContext); +smalltalk.CompiledMethod); smalltalk.addMethod( -unescape('_printString'), +unescape('_selector'), smalltalk.method({ -selector: unescape('printString'), +selector: unescape('selector'), category: 'accessing', -fn: function (){ -var self=this; -return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_printString", [], smalltalk.Object), "__comma", [unescape("%28")]), "__comma", [smalltalk.send(self, "_asString", [])]), "__comma", [unescape("%29")]); -return self;}, +fn: function () { + var self = this; + return smalltalk.send(self, "_basicAt_", ["selector"]); + return self; +}, args: [], -source: unescape('printString%0A%09%5Esuper%20printString%2C%20%27%28%27%2C%20self%20asString%2C%20%27%29%27'), -messageSends: [unescape("%2C"), "printString", "asString"], +source: unescape('selector%0A%09%5Eself%20basicAt%3A%20%27selector%27'), +messageSends: ["basicAt:"], referencedClasses: [] }), -smalltalk.MethodContext); +smalltalk.CompiledMethod); smalltalk.addMethod( -unescape('_asString'), +unescape('_selector_'), smalltalk.method({ -selector: unescape('asString'), +selector: unescape('selector%3A'), category: 'accessing', -fn: function (){ -var self=this; -return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_receiver", []), "_class", []), "_printString", []), "__comma", [unescape("%20%3E%3E%20")]), "__comma", [smalltalk.send(self, "_selector", [])]); -return self;}, -args: [], -source: unescape('asString%0A%09%5Eself%20receiver%20class%20printString%2C%20%27%20%3E%3E%20%27%2C%20self%20selector'), -messageSends: [unescape("%2C"), "printString", "class", "receiver", "selector"], +fn: function (aString) { + var self = this; + smalltalk.send(self, "_basicAt_put_", ["selector", aString]); + return self; +}, +args: ["aString"], +source: unescape('selector%3A%20aString%0A%09self%20basicAt%3A%20%27selector%27%20put%3A%20aString'), +messageSends: ["basicAt:put:"], referencedClasses: [] }), -smalltalk.MethodContext); +smalltalk.CompiledMethod); - - -smalltalk.addClass('Message', smalltalk.Object, ['selector', 'arguments'], 'Kernel-Methods'); -smalltalk.Message.comment=unescape('Generally%2C%20the%20system%20does%20not%20use%20instances%20of%20Message%20for%20efficiency%20reasons.%0AHowever%2C%20when%20a%20message%20is%20not%20understood%20by%20its%20receiver%2C%20the%20interpreter%20will%20make%20up%20an%20instance%20of%20it%20in%20order%20to%20capture%20the%20information%20involved%20in%20an%20actual%20message%20transmission.%20%0AThis%20instance%20is%20sent%20it%20as%20an%20argument%20with%20the%20message%20%60doesNotUnderstand%3A%60%20to%20the%20receiver.%0A%0ASee%20boot.js%2C%20%60messageNotUnderstood%60%20%20and%20its%20counterpart%20%60Object%3E%3EdoesNotUnderstand%3A%60') smalltalk.addMethod( -unescape('_selector'), +unescape('_fn'), smalltalk.method({ -selector: unescape('selector'), +selector: unescape('fn'), category: 'accessing', -fn: function (){ -var self=this; -return self['@selector']; -return self;}, +fn: function () { + var self = this; + return smalltalk.send(self, "_basicAt_", ["fn"]); + return self; +}, args: [], -source: unescape('selector%0A%09%5Eselector'), -messageSends: [], +source: unescape('fn%0A%09%5Eself%20basicAt%3A%20%27fn%27'), +messageSends: ["basicAt:"], referencedClasses: [] }), -smalltalk.Message); +smalltalk.CompiledMethod); smalltalk.addMethod( -unescape('_selector_'), +unescape('_fn_'), smalltalk.method({ -selector: unescape('selector%3A'), +selector: unescape('fn%3A'), category: 'accessing', -fn: function (aString){ -var self=this; -(self['@selector']=aString); -return self;}, -args: ["aString"], -source: unescape('selector%3A%20aString%0A%09selector%20%3A%3D%20aString'), -messageSends: [], +fn: function (aBlock) { + var self = this; + smalltalk.send(self, "_basicAt_put_", ["fn", aBlock]); + return self; +}, +args: ["aBlock"], +source: unescape('fn%3A%20aBlock%0A%09self%20basicAt%3A%20%27fn%27%20put%3A%20aBlock'), +messageSends: ["basicAt:put:"], referencedClasses: [] }), -smalltalk.Message); +smalltalk.CompiledMethod); smalltalk.addMethod( -unescape('_arguments_'), +unescape('_messageSends'), smalltalk.method({ -selector: unescape('arguments%3A'), +selector: unescape('messageSends'), category: 'accessing', -fn: function (anArray){ -var self=this; -(self['@arguments']=anArray); -return self;}, -args: ["anArray"], -source: unescape('arguments%3A%20anArray%0A%09arguments%20%3A%3D%20anArray'), -messageSends: [], +fn: function () { + var self = this; + return smalltalk.send(self, "_basicAt_", ["messageSends"]); + return self; +}, +args: [], +source: unescape('messageSends%0A%09%5Eself%20basicAt%3A%20%27messageSends%27'), +messageSends: ["basicAt:"], referencedClasses: [] }), -smalltalk.Message); +smalltalk.CompiledMethod); smalltalk.addMethod( -unescape('_arguments'), +unescape('_methodClass'), smalltalk.method({ -selector: unescape('arguments'), +selector: unescape('methodClass'), category: 'accessing', -fn: function (){ -var self=this; -return self['@arguments']; -return self;}, +fn: function () { + var self = this; + return smalltalk.send(self, "_basicAt_", ["methodClass"]); + return self; +}, args: [], -source: unescape('arguments%0A%09%5Earguments'), -messageSends: [], +source: unescape('methodClass%0A%09%5Eself%20basicAt%3A%20%27methodClass%27'), +messageSends: ["basicAt:"], referencedClasses: [] }), -smalltalk.Message); +smalltalk.CompiledMethod); smalltalk.addMethod( -unescape('_printString'), +unescape('_referencedClasses'), smalltalk.method({ -selector: unescape('printString'), -category: 'printing', -fn: function (){ -var self=this; -return smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(aStream){return (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(self, "_printString", [], smalltalk.Object)]);smalltalk.send($rec, "_nextPutAll_", [unescape("%28")]);smalltalk.send($rec, "_nextPutAll_", [self['@selector']]);return smalltalk.send($rec, "_nextPutAll_", [unescape("%29")]);})(aStream);})]); -return self;}, +selector: unescape('referencedClasses'), +category: 'accessing', +fn: function () { + var self = this; + return smalltalk.send(self, "_basicAt_", ["referencedClasses"]); + return self; +}, args: [], -source: unescape('printString%0A%09%5E%20String%20streamContents%3A%20%5B%3AaStream%7C%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09%09%09%09aStream%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09%09%09%09%09nextPutAll%3A%20super%20printString%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09%09%09%09%09nextPutAll%3A%20%27%28%27%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09%09%09%09%09nextPutAll%3A%20selector%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09%09%09%09%09nextPutAll%3A%20%27%29%27%20%09%09%09%09%5D'), -messageSends: ["streamContents:", "nextPutAll:", "printString"], -referencedClasses: ["String"] +source: unescape('referencedClasses%0A%09%5Eself%20basicAt%3A%20%27referencedClasses%27'), +messageSends: ["basicAt:"], +referencedClasses: [] }), -smalltalk.Message); +smalltalk.CompiledMethod); - smalltalk.addMethod( -unescape('_selector_arguments_'), +unescape('_arguments'), smalltalk.method({ -selector: unescape('selector%3Aarguments%3A'), -category: 'instance creation', -fn: function (aString, anArray){ -var self=this; -return (function($rec){smalltalk.send($rec, "_selector_", [aString]);smalltalk.send($rec, "_arguments_", [anArray]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", [])); -return self;}, -args: ["aString", "anArray"], -source: unescape('selector%3A%20aString%20arguments%3A%20anArray%0A%09%5Eself%20new%0A%09%09selector%3A%20aString%3B%0A%09%09arguments%3A%20anArray%3B%0A%09%09yourself'), -messageSends: ["selector:", "arguments:", "yourself", "new"], +selector: unescape('arguments'), +category: 'accessing', +fn: function () { + var self = this; + return self.args || []; + return self; +}, +args: [], +source: unescape('arguments%0A%09%3Creturn%20self.args%20%7C%7C%20%5B%5D%3E'), +messageSends: [], referencedClasses: [] }), -smalltalk.Message.klass); +smalltalk.CompiledMethod); +