/* ==================================================================== | | Amber Smalltalk | http://amber-lang.net | ====================================================================== ====================================================================== | | Copyright (c) 2010-2011 | Nicolas Petton | | Amber is released under the MIT license | | Permission is hereby granted, free of charge, to any person obtaining | a copy of this software and associated documentation files (the | 'Software'), to deal in the Software without restriction, including | without limitation the rights to use, copy, modify, merge, publish, | distribute, sublicense, and/or sell copies of the Software, and to | permit persons to whom the Software is furnished to do so, subject to | the following conditions: | | The above copyright notice and this permission notice shall be | included in all copies or substantial portions of the Software. | | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ==================================================================== */ /* Make sure that console is defined */ if(typeof console === "undefined") { this.console = { log: function() {}, warn: function() {}, info: function() {}, debug: function() {}, error: function() {} }; } /* Array extensions */ Array.prototype.addElement = function(el) { if(typeof el === 'undefined') { return; } if(this.indexOf(el) == -1) { this.push(el); } }; Array.prototype.removeElement = function(el) { var i = this.indexOf(el); if (i !== -1) { this.splice(i, 1); } }; /* Smalltalk constructors definition */ function SmalltalkObject() {} function SmalltalkBehavior() {} function SmalltalkClass() {} function SmalltalkMetaclass() { this.meta = true; } function SmalltalkPackage() {} function SmalltalkMethod() {} function SmalltalkNil() {} function SmalltalkOrganizer() { } function SmalltalkPackageOrganizer() { this.elements = []; } function SmalltalkClassOrganizer() { this.elements = []; } function inherits(child, parent) { child.prototype = Object.create(parent.prototype, { constructor: { value: child, enumerable: false, configurable: true, writable: true } }); } inherits(SmalltalkBehavior, SmalltalkObject); inherits(SmalltalkClass, SmalltalkBehavior); inherits(SmalltalkMetaclass, SmalltalkBehavior); inherits(SmalltalkNil, SmalltalkObject); inherits(SmalltalkMethod, SmalltalkObject); inherits(SmalltalkPackage, SmalltalkObject); inherits(SmalltalkOrganizer, SmalltalkObject); inherits(SmalltalkPackageOrganizer, SmalltalkOrganizer); inherits(SmalltalkClassOrganizer, SmalltalkOrganizer); function Smalltalk() { var st = this; /* This is the current call context object. While it is publicly available, Use smalltalk.getThisContext() instead which will answer a safe copy of the current context */ st.thisContext = undefined; /* List of all reserved words in JavaScript. They may not be used as variables in Smalltalk. */ // list of reserved JavaScript keywords as of // http://es5.github.com/#x7.6.1.1 // and // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.6.1 st.reservedWords = ['break', 'case', 'catch', 'continue', 'debugger', 'default', 'delete', 'do', 'else', 'finally', 'for', 'function', 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw', 'try', 'typeof', 'var', 'void', 'while', 'with', // ES5: future use: http://es5.github.com/#x7.6.1.2 'class', 'const', 'enum', 'export', 'extends', 'import', 'super', // ES5: future use in strict mode 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', 'yield']; var initialized = false; /* Smalltalk classes */ var classes = []; var wrappedClasses = []; /* Method not implemented handlers */ var dnu = { methods: [], selectors: [], get: function (string) { var index = this.selectors.indexOf(string); if(index !== -1) { return this.methods[index]; } this.selectors.push(string); var selector = st.selector(string); var method = {jsSelector: selector, fn: this.createHandler(selector)}; this.methods.push(method); return method; }, /* Dnu handler method */ createHandler: function (selector) { return function () { var args = Array.prototype.slice.call(arguments); return messageNotUnderstood(this, selector, args); }; } }; /* Answer all method selectors based on dnu handlers */ st.allSelectors = function() { return dnu.selectors; }; /* Unique ID number generator */ var oid = 0; st.nextId = function() { oid += 1; return oid; }; /* We hold all Packages in a separate Object */ st.packages = {}; /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */ function pkg(spec) { var that = new SmalltalkPackage(); that.pkgName = spec.pkgName; that.organization = new SmalltalkPackageOrganizer(); that.properties = spec.properties || {}; return that; } /* Smalltalk class creation. A class is an instance of an automatically created metaclass object. Newly created classes (not their metaclass) should be added to the smalltalk object, see smalltalk.addClass(). Superclass linking is *not* handled here, see smalltalk.init() */ function klass(spec) { spec = spec || {}; var meta = metaclass(spec); var that = meta.instanceClass; that.fn = spec.fn || function() {}; setupClass(that, spec); that.className = spec.className; that.wrapped = spec.wrapped || false; meta.className = spec.className + ' class'; if(spec.superclass) { that.superclass = spec.superclass; meta.superclass = spec.superclass.klass; } return that; } function metaclass(spec) { spec = spec || {}; var that = new SmalltalkMetaclass(); inherits( that.fn = function() {}, spec.superclass ? spec.superclass.klass.fn : SmalltalkClass ); that.instanceClass = new that.fn(); setupClass(that); return that; } function setupClass(klass, spec) { spec = spec || {}; klass.iVarNames = spec.iVarNames || []; klass.pkg = spec.pkg; Object.defineProperty(klass, "toString", { value: function() { return 'Smalltalk ' + this.className; }, enumerable:false, configurable: true, writable: false }); klass.organization = new SmalltalkClassOrganizer(); klass.organization.theClass = klass; Object.defineProperty(klass, "methods", { value: {}, enumerable: false, configurable: true, writable: true }); wireKlass(klass); } /* Smalltalk method object. To add a method to a class, use smalltalk.addMethod() */ st.method = function(spec) { var that = new SmalltalkMethod(); that.selector = spec.selector; that.jsSelector = spec.jsSelector; that.args = spec.args || {}; that.category = spec.category; that.source = spec.source; that.messageSends = spec.messageSends || []; that.referencedClasses = spec.referencedClasses || []; that.fn = spec.fn; return that; }; /* Initialize a class in its class hierarchy. Handle both classes and metaclasses. */ st.init = function(klass) { st.initClass(klass); if(klass.klass && !klass.meta) { st.initClass(klass.klass); } }; st.initClass = function(klass) { if(klass.wrapped) { copySuperclass(klass); } else { installSuperclass(klass); } if(klass === st.Object || klass.wrapped) { installDnuHandlers(klass); } }; function wireKlass(klass) { Object.defineProperty(klass.fn.prototype, "klass", { value: klass, enumerable: false, configurable: true, writable: true }); } function installSuperclass(klass) { // only if the klass has not been initialized yet. if(klass.fn.prototype._yourself) { return; } if(klass.superclass && klass.superclass !== nil) { inherits(klass.fn, klass.superclass.fn); wireKlass(klass); reinstallMethods(klass); } } function copySuperclass(klass, superclass) { for (superclass = superclass || klass.superclass; superclass && superclass !== nil; superclass = superclass.superclass) { for (var keys = Object.keys(superclass.methods), i = 0; i < keys.length; i++) { installMethodIfAbsent(superclass.methods[keys[i]], klass); } } } function installMethod(method, klass) { Object.defineProperty(klass.fn.prototype, method.jsSelector, { value: method.fn, enumerable: false, configurable: true, writable: true }); } function installMethodIfAbsent(method, klass) { if(!klass.fn.prototype[method.jsSelector]) { installMethod(method, klass); } } function reinstallMethods(klass) { for(var keys = Object.keys(klass.methods), i=0; i>doesNotUnderstand: */ return receiver._doesNotUnderstand_( st.Message._new() ._selector_(st.convertSelector(selector)) ._arguments_(args) ); } /* Call a method of a JS object, or answer a property if it exists. Else try wrapping a JSObjectProxy around the receiver. If the object property is a function, then call it, except if it starts with an uppercase character (we probably want to answer the function itself in this case and send it #new from Amber). Converts keyword-based selectors by using the first keyword only, but keeping all message arguments. Example: "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)" */ function callJavaScriptMethod(receiver, selector, args) { var jsSelector = selector._asJavaScriptSelector(); var jsProperty = receiver[jsSelector]; if(typeof jsProperty === "function" && !/^[A-Z]/.test(jsSelector)) { return jsProperty.apply(receiver, args); } else if(jsProperty !== undefined) { if(args[0]) { receiver[jsSelector] = args[0]; return nil; } else { return jsProperty; } } return st.send(st.JSObjectProxy._on_(receiver), selector, args); } /* Handle thisContext pseudo variable */ st.getThisContext = function() { if(st.thisContext) { st.thisContext.init(); return st.thisContext; } else { return nil; } }; function pushContext(setup) { return st.thisContext = new SmalltalkMethodContext(smalltalk.thisContext, setup); } function popContext(context) { st.thisContext = context.homeContext; } /* Convert a Smalltalk selector into a JS selector */ st.selector = function(string) { var selector = '_' + string; selector = selector.replace(/:/g, '_'); selector = selector.replace(/[\&]/g, '_and'); selector = selector.replace(/[\|]/g, '_or'); selector = selector.replace(/[+]/g, '_plus'); selector = selector.replace(/-/g, '_minus'); selector = selector.replace(/[*]/g ,'_star'); selector = selector.replace(/[\/]/g ,'_slash'); selector = selector.replace(/[\\]/g ,'_backslash'); selector = selector.replace(/[\~]/g ,'_tild'); selector = selector.replace(/>/g ,'_gt'); selector = selector.replace(/>asSelector accordingly */ st.convertSelector = function(selector) { if(selector.match(/__/)) { return convertBinarySelector(selector); } else { return convertKeywordSelector(selector); } }; function convertKeywordSelector(selector) { return selector.replace(/^_/, '').replace(/_/g, ':'); } function convertBinarySelector(selector) { return selector .replace(/^_/, '') .replace(/_and/g, '&') .replace(/_or/g, '|') .replace(/_plus/g, '+') .replace(/_minus/g, '-') .replace(/_star/g, '*') .replace(/_slash/g, '/') .replace(/_backslash/g, '\\') .replace(/_tild/g, '~') .replace(/_gt/g, '>') .replace(/_lt/g, '<') .replace(/_eq/g, '=') .replace(/_comma/g, ',') .replace(/_at/g, '@') } /* Converts a JavaScript object to valid Smalltalk Object */ st.readJSObject = function(js) { var object = js; var readObject = (js.constructor === Object); var readArray = (js.constructor === Array); if(readObject) { object = st.Dictionary._new(); } for(var i in js) { if(readObject) { object._at_put_(i, st.readJSObject(js[i])); } if(readArray) { object[i] = st.readJSObject(js[i]); } } return object; }; /* Boolean assertion */ st.assert = function(shouldBeBoolean) { if ((undefined !== shouldBeBoolean) && (shouldBeBoolean.klass === smalltalk.Boolean)) { return shouldBeBoolean == true; } else { smalltalk.NonBooleanReceiver._new()._object_(shouldBeBoolean)._signal(); } }; /* Backward compatibility with Amber 0.9.1 */ st.symbolFor = function(aString) { return aString; } /* Smalltalk initialization. Called on page load */ st.initialize = function() { if(initialized) { return; } classes.forEach(function(klass) { st.init(klass); }); classes.forEach(function(klass) { klass._initialize(); }); initialized = true; }; } inherits(Smalltalk, SmalltalkObject); function SmalltalkMethodContext(home, setup) { this.homeContext = home; this.setup = setup || function() {}; this.pc = 0; } // Fallbacks SmalltalkMethodContext.prototype.locals = {}; SmalltalkMethodContext.prototype.receiver = null; SmalltalkMethodContext.prototype.selector = null; SmalltalkMethodContext.prototype.lookupClass = null; inherits(SmalltalkMethodContext, SmalltalkObject); SmalltalkMethodContext.prototype.fill = function(receiver, selector, locals, lookupClass) { this.receiver = receiver; this.selector = selector; this.locals = locals || {}; this.lookupClass = lookupClass; }; SmalltalkMethodContext.prototype.fillBlock = function(locals, ctx) { this.locals = locals || {}; this.methodContext = ctx; }; SmalltalkMethodContext.prototype.init = function() { var home = this.homeContext; if(home) {home = home.init()} this.setup(this); }; SmalltalkMethodContext.prototype.method = function() { var method; var lookup = this.lookupClass || this.receiver.klass; while(!method && lookup) { method = lookup.methods[smalltalk.convertSelector(this.selector)]; lookup = lookup.superclass } return method; }; // TODO: this is just wrong :) SmalltalkMethodContext.prototype.resume = function() { //Brutally set the receiver as thisContext, then re-enter the function smalltalk.thisContext = this; return this.method.apply(receiver, temps); }; /* Global Smalltalk objects. */ var nil = new SmalltalkNil(); var smalltalk = new Smalltalk(); if(this.jQuery) { this.jQuery.allowJavaScriptCalls = true; } /* * Answer the smalltalk representation of o. * Used in message sends */ var _st = function(o) { if(o == null) {return nil} if(o.klass) {return o} return smalltalk.JSObjectProxy._on_(o); }; /***************************************** BOOTSTRAP ******************************************/ smalltalk.wrapClassName("Object", "Kernel-Objects", SmalltalkObject, undefined, false); smalltalk.wrapClassName("Behavior", "Kernel-Classes", SmalltalkBehavior, smalltalk.Object, false); smalltalk.wrapClassName("Metaclass", "Kernel-Classes", SmalltalkMetaclass, smalltalk.Behavior, false); smalltalk.wrapClassName("Class", "Kernel-Classes", SmalltalkClass, smalltalk.Behavior, false); smalltalk.Object.klass.superclass = smalltalk.Class; smalltalk.wrapClassName("Smalltalk", "Kernel-Objects", Smalltalk, smalltalk.Object, false); smalltalk.wrapClassName("Package", "Kernel-Objects", SmalltalkPackage, smalltalk.Object, false); smalltalk.wrapClassName("CompiledMethod", "Kernel-Methods", SmalltalkMethod, smalltalk.Object, false); smalltalk.wrapClassName("Organizer", "Kernel-Objects", SmalltalkOrganizer, smalltalk.Object, false); smalltalk.wrapClassName("PackageOrganizer", "Kernel-Objects", SmalltalkPackageOrganizer, smalltalk.Organizer, false); smalltalk.wrapClassName("ClassOrganizer", "Kernel-Objects", SmalltalkClassOrganizer, smalltalk.Organizer, false); smalltalk.wrapClassName("Number", "Kernel-Objects", Number, smalltalk.Object); smalltalk.wrapClassName("BlockClosure", "Kernel-Methods", Function, smalltalk.Object); smalltalk.wrapClassName("Boolean", "Kernel-Objects", Boolean, smalltalk.Object); smalltalk.wrapClassName("Date", "Kernel-Objects", Date, smalltalk.Object); smalltalk.wrapClassName("UndefinedObject", "Kernel-Objects", SmalltalkNil, smalltalk.Object, false); smalltalk.addClass("Collection", smalltalk.Object, null, "Kernel-Collections"); smalltalk.addClass("IndexableCollection", smalltalk.Collection, null, "Kernel-Collections"); smalltalk.addClass("SequenceableCollection", smalltalk.IndexableCollection, null, "Kernel-Collections"); smalltalk.addClass("CharacterArray", smalltalk.SequenceableCollection, null, "Kernel-Collections"); smalltalk.wrapClassName("String", "Kernel-Collections", String, smalltalk.CharacterArray); smalltalk.wrapClassName("Array", "Kernel-Collections", Array, smalltalk.SequenceableCollection); smalltalk.wrapClassName("RegularExpression", "Kernel-Collections", RegExp, smalltalk.Object); smalltalk.wrapClassName("Error", "Kernel-Exceptions", Error, smalltalk.Object); smalltalk.wrapClassName("MethodContext", "Kernel-Methods", SmalltalkMethodContext, smalltalk.Object, false); /* Alias definitions */ smalltalk.alias(smalltalk.Array, "OrderedCollection"); smalltalk.alias(smalltalk.Date, "Time"); smalltalk.addPackage('Kernel-Objects'); smalltalk.addClass('Object', smalltalk.nil, [], 'Kernel-Objects'); smalltalk.Object.comment="*Object is the root of the Smalltalk class system*. All classes in the system are subclasses of Object.\x0a\x0aObject provides default behavior common to all normal objects, such as:\x0a\x0a- access\x0a- copying\x0a- comparison\x0a- error handling\x0a- message sending\x0a- reflection\x0a\x0aAlso utility messages that all objects should respond to are defined here.\x0a\x0aObject has no instance variable.\x0a\x0a##Access\x0a\x0aInstance variables can be accessed with `#instVarAt:` and `#instVarAt:put:`. `Object >> instanceVariableNames` answers a collection of all instance variable names.\x0aAccessing JavaScript properties of an object is done through `#basicAt:`, `#basicAt:put:` and `basicDelete:`.\x0a\x0a##Copying\x0a\x0aCopying an object is handled by `#copy` and `#deepCopy`. The first one performs a shallow copy of the receiver, while the second one performs a deep copy.\x0aThe hook method `#postCopy` can be overriden in subclasses to copy fields as necessary to complete the full copy. It will be sent by the copy of the receiver.\x0a\x0a##Comparison\x0a\x0aObjects understand equality `#=` and identity `#==` comparison.\x0a\x0a##Error handling\x0a\x0a- `#halt` is the typical message to use for inserting breakpoints during debugging.\x0a- `#error:` throws a generic error exception\x0a- `#doesNotUnderstand:` handles the fact that there was an attempt to send the given message to the receiver but the receiver does not understand this message.\x0a\x09Overriding this message can be useful to implement proxies for example." smalltalk.addMethod( smalltalk.method({ selector: "->", category: 'converting', fn: function (anObject){ var self=this; function $Association(){return smalltalk.Association||(typeof Association=="undefined"?nil:Association)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st($Association())._key_value_(self,anObject); return $1; }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},smalltalk.Object)})}, args: ["anObject"], source: "-> anObject\x0a\x09^Association key: self value: anObject", messageSends: ["key:value:"], referencedClasses: ["Association"] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "=", category: 'comparing', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self).__eq_eq(anObject); return $1; }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},smalltalk.Object)})}, args: ["anObject"], source: "= anObject\x0a\x09^self == anObject", messageSends: ["=="], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "==", category: 'comparing', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._identityHash()).__eq(_st(anObject)._identityHash()); return $1; }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},smalltalk.Object)})}, args: ["anObject"], source: "== anObject\x0a\x09^self identityHash = anObject identityHash", messageSends: ["=", "identityHash"], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "asJSON", category: 'converting', fn: function (){ var self=this; var variables; function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)} return smalltalk.withContext(function($ctx1) { var $1; variables=_st($HashedCollection())._new(); _st(_st(_st(self)._class())._allInstanceVariableNames())._do_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(variables)._at_put_(each,_st(_st(self)._instVarAt_(each))._asJSON()); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); $1=variables; return $1; }, function($ctx1) {$ctx1.fill(self,"asJSON",{variables:variables},smalltalk.Object)})}, args: [], source: "asJSON\x0a\x09| variables |\x0a\x09variables := HashedCollection new.\x0a\x09self class allInstanceVariableNames do: [:each |\x0a\x09\x09variables at: each put: (self instVarAt: each) asJSON].\x0a\x09^variables", messageSends: ["new", "do:", "at:put:", "asJSON", "instVarAt:", "allInstanceVariableNames", "class"], referencedClasses: ["HashedCollection"] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "asJSONString", category: 'converting', fn: function (){ var self=this; function $JSON(){return smalltalk.JSON||(typeof JSON=="undefined"?nil:JSON)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st($JSON())._stringify_(_st(self)._asJSON()); return $1; }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},smalltalk.Object)})}, args: [], source: "asJSONString\x0a\x09^JSON stringify: self asJSON", messageSends: ["stringify:", "asJSON"], referencedClasses: ["JSON"] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "asJavascript", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._asString(); return $1; }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Object)})}, args: [], source: "asJavascript\x0a\x09^self asString", messageSends: ["asString"], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "asString", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._printString(); return $1; }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Object)})}, args: [], source: "asString\x0a\x09^self printString", messageSends: ["printString"], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "basicAt:", category: 'accessing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { return self[aString]; return self}, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},smalltalk.Object)})}, args: ["aString"], source: "basicAt: aString\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "basicAt:put:", category: 'accessing', fn: function (aString,anObject){ var self=this; return smalltalk.withContext(function($ctx1) { return self[aString] = anObject; return self}, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},smalltalk.Object)})}, args: ["aString", "anObject"], source: "basicAt: aString put: anObject\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "basicDelete:", category: 'accessing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { delete self[aString]; return aString; return self}, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},smalltalk.Object)})}, args: ["aString"], source: "basicDelete: aString\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "basicPerform:", category: 'message handling', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._basicPerform_withArguments_(aString,[]); return $1; }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},smalltalk.Object)})}, args: ["aString"], source: "basicPerform: aString\x0a\x09^self basicPerform: aString withArguments: #()", messageSends: ["basicPerform:withArguments:"], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "basicPerform:withArguments:", category: 'message handling', fn: function (aString,aCollection){ var self=this; return smalltalk.withContext(function($ctx1) { return self[aString].apply(self, aCollection);; return self}, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},smalltalk.Object)})}, args: ["aString", "aCollection"], source: "basicPerform: aString withArguments: aCollection\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "class", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.klass; return self}, function($ctx1) {$ctx1.fill(self,"class",{},smalltalk.Object)})}, args: [], source: "class\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "copy", category: 'copying', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._shallowCopy())._postCopy(); return $1; }, function($ctx1) {$ctx1.fill(self,"copy",{},smalltalk.Object)})}, args: [], source: "copy\x0a\x09^self shallowCopy postCopy", messageSends: ["postCopy", "shallowCopy"], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "deepCopy", category: 'copying', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var copy = self.klass._new(); for(var i in self) { if(/^@.+/.test(i)) { copy[i] = self[i]._deepCopy(); } } return copy; ; return self}, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.Object)})}, args: [], source: "deepCopy\x0a\x09<\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09for(var i in self) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i]._deepCopy();\x0a\x09\x09}\x0a\x09\x09}\x0a\x09\x09return copy;\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "deprecatedAPI", category: 'error handling', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { _st(console)._warn_(_st(_st(_st(_st(_st(smalltalk.getThisContext())._home())._asString()).__comma(" is deprecated! (in ")).__comma(_st(_st(_st(smalltalk.getThisContext())._home())._home())._asString())).__comma(")")); return self}, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},smalltalk.Object)})}, args: [], source: "deprecatedAPI\x0a\x09\x22Just a simple way to deprecate methods.\x0a\x09#deprecatedAPI is in the 'error handling' protocol even if it doesn't throw an error,\x0a\x09but it could in the future.\x22\x0a\x09console warn: thisContext home asString, ' is deprecated! (in ', thisContext home home asString, ')'", messageSends: ["warn:", ",", "asString", "home"], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "doesNotUnderstand:", category: 'error handling', fn: function (aMessage){ var self=this; function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)} return smalltalk.withContext(function($ctx1) { var $1,$2; $1=_st($MessageNotUnderstood())._new(); _st($1)._receiver_(self); _st($1)._message_(aMessage); $2=_st($1)._signal(); return self}, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},smalltalk.Object)})}, args: ["aMessage"], source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal", messageSends: ["receiver:", "new", "message:", "signal"], referencedClasses: ["MessageNotUnderstood"] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "error:", category: 'error handling', fn: function (aString){ var self=this; function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)} return smalltalk.withContext(function($ctx1) { _st($Error())._signal_(aString); return self}, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},smalltalk.Object)})}, args: ["aString"], source: "error: aString\x0a\x09Error signal: aString", messageSends: ["signal:"], referencedClasses: ["Error"] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "halt", category: 'error handling', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._error_("Halt encountered"); return self}, function($ctx1) {$ctx1.fill(self,"halt",{},smalltalk.Object)})}, args: [], source: "halt\x0a\x09self error: 'Halt encountered'", messageSends: ["error:"], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "identityHash", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var hash=self.identityHash; if (hash) return hash; hash=smalltalk.nextId(); Object.defineProperty(self, 'identityHash', {value:hash}); return hash; ; return self}, function($ctx1) {$ctx1.fill(self,"identityHash",{},smalltalk.Object)})}, args: [], source: "identityHash\x0a\x09<\x0a\x09var hash=self.identityHash;\x0a\x09if (hash) return hash;\x0a\x09hash=smalltalk.nextId();\x0a\x09Object.defineProperty(self, 'identityHash', {value:hash});\x0a\x09return hash;\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "ifNil:", category: 'testing', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self; return $1; }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},smalltalk.Object)})}, args: ["aBlock"], source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "ifNil:ifNotNil:", category: 'testing', fn: function (aBlock,anotherBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(anotherBlock)._value_(self); return $1; }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Object)})}, args: ["aBlock", "anotherBlock"], source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^anotherBlock value: self", messageSends: ["value:"], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "ifNotNil:", category: 'testing', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(aBlock)._value_(self); return $1; }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},smalltalk.Object)})}, args: ["aBlock"], source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value: self", messageSends: ["value:"], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "ifNotNil:ifNil:", category: 'testing', fn: function (aBlock,anotherBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(aBlock)._value_(self); return $1; }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Object)})}, args: ["aBlock", "anotherBlock"], source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value: self", messageSends: ["value:"], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "initialize", category: 'initialization', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Object)})}, args: [], source: "initialize", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "instVarAt:", category: 'accessing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { return self['@'+aString] ; return self}, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},smalltalk.Object)})}, args: ["aString"], source: "instVarAt: aString\x0a\x09< return self['@'+aString] >", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "instVarAt:put:", category: 'accessing', fn: function (aString,anObject){ var self=this; return smalltalk.withContext(function($ctx1) { self['@' + aString] = anObject ; return self}, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},smalltalk.Object)})}, args: ["aString", "anObject"], source: "instVarAt: aString put: anObject\x0a\x09< self['@' + aString] = anObject >", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "isBehavior", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return false; }, function($ctx1) {$ctx1.fill(self,"isBehavior",{},smalltalk.Object)})}, args: [], source: "isBehavior\x0a\x09^ false", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "isBoolean", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return false; }, function($ctx1) {$ctx1.fill(self,"isBoolean",{},smalltalk.Object)})}, args: [], source: "isBoolean\x0a\x09^ false", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "isClass", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return false; }, function($ctx1) {$ctx1.fill(self,"isClass",{},smalltalk.Object)})}, args: [], source: "isClass\x0a\x09^false", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "isCompiledMethod", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return false; }, function($ctx1) {$ctx1.fill(self,"isCompiledMethod",{},smalltalk.Object)})}, args: [], source: "isCompiledMethod\x0a\x09^ false", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "isImmutable", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return false; }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.Object)})}, args: [], source: "isImmutable\x0a\x09^ false", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "isKindOf:", category: 'testing', fn: function (aClass){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=_st(self)._isMemberOf_(aClass); if(smalltalk.assert($2)){ $1=true; } else { $1=_st(_st(self)._class())._inheritsFrom_(aClass); }; return $1; }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},smalltalk.Object)})}, args: ["aClass"], source: "isKindOf: aClass\x0a\x09^(self isMemberOf: aClass)\x0a\x09\x09ifTrue: [true]\x0a\x09\x09ifFalse: [self class inheritsFrom: aClass]", messageSends: ["ifTrue:ifFalse:", "inheritsFrom:", "class", "isMemberOf:"], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "isMemberOf:", category: 'testing', fn: function (aClass){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._class()).__eq(aClass); return $1; }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},smalltalk.Object)})}, args: ["aClass"], source: "isMemberOf: aClass\x0a\x09^self class = aClass", messageSends: ["=", "class"], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "isMetaclass", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return false; }, function($ctx1) {$ctx1.fill(self,"isMetaclass",{},smalltalk.Object)})}, args: [], source: "isMetaclass\x0a\x09^false", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "isNil", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return false; }, function($ctx1) {$ctx1.fill(self,"isNil",{},smalltalk.Object)})}, args: [], source: "isNil\x0a\x09^false", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "isNumber", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return false; }, function($ctx1) {$ctx1.fill(self,"isNumber",{},smalltalk.Object)})}, args: [], source: "isNumber\x0a\x09^false", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "isPackage", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return false; }, function($ctx1) {$ctx1.fill(self,"isPackage",{},smalltalk.Object)})}, args: [], source: "isPackage\x0a\x09^ false", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "isParseFailure", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return false; }, function($ctx1) {$ctx1.fill(self,"isParseFailure",{},smalltalk.Object)})}, args: [], source: "isParseFailure\x0a\x09^false", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "isString", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return false; }, function($ctx1) {$ctx1.fill(self,"isString",{},smalltalk.Object)})}, args: [], source: "isString\x0a\x09^false", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "isSymbol", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return false; }, function($ctx1) {$ctx1.fill(self,"isSymbol",{},smalltalk.Object)})}, args: [], source: "isSymbol\x0a\x09^false", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "notNil", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._isNil())._not(); return $1; }, function($ctx1) {$ctx1.fill(self,"notNil",{},smalltalk.Object)})}, args: [], source: "notNil\x0a\x09^self isNil not", messageSends: ["not", "isNil"], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "perform:", category: 'message handling', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._perform_withArguments_(aString,[]); return $1; }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},smalltalk.Object)})}, args: ["aString"], source: "perform: aString\x0a\x09^self perform: aString withArguments: #()", messageSends: ["perform:withArguments:"], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "perform:withArguments:", category: 'message handling', fn: function (aString,aCollection){ var self=this; return smalltalk.withContext(function($ctx1) { return smalltalk.send(self, aString._asSelector(), aCollection); return self}, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},smalltalk.Object)})}, args: ["aString", "aCollection"], source: "perform: aString withArguments: aCollection\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "postCopy", category: 'copying', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"postCopy",{},smalltalk.Object)})}, args: [], source: "postCopy", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "printOn:", category: 'printing', fn: function (aStream){ var self=this; return smalltalk.withContext(function($ctx1) { var $1,$3,$2; $1=aStream; $3=_st(_st(_st(_st(self)._class())._name())._first())._isVowel(); if(smalltalk.assert($3)){ $2="an "; } else { $2="a "; }; _st($1)._nextPutAll_($2); _st(aStream)._nextPutAll_(_st(_st(self)._class())._name()); return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Object)})}, args: ["aStream"], source: "printOn: aStream\x0a\x09\x22Append to the aStream, a string representing the receiver.\x22\x0a\x09\x0a\x09aStream nextPutAll: (self class name first isVowel\x0a\x09\x09ifTrue: [ 'an ' ]\x0a\x09\x09ifFalse: [ 'a ' ]).\x0a\x09aStream nextPutAll: self class name", messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "printString", category: 'printing', fn: function (){ var self=this; function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st($String())._streamContents_((function(stream){ return smalltalk.withContext(function($ctx2) { return _st(self)._printOn_(stream); }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"printString",{},smalltalk.Object)})}, args: [], source: "printString\x0a\x09\x22Answer a String representation of the receiver.\x22\x0a\x0a\x09^ String streamContents: [ :stream | self printOn: stream ]", messageSends: ["streamContents:", "printOn:"], referencedClasses: ["String"] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "putOn:", category: 'streaming', fn: function (aStream){ var self=this; return smalltalk.withContext(function($ctx1) { _st(aStream)._nextPut_(self); return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},smalltalk.Object)})}, args: ["aStream"], source: "putOn: aStream\x0a\x09aStream nextPut: self", messageSends: ["nextPut:"], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "respondsTo:", category: 'testing', fn: function (aSelector){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._class())._canUnderstand_(aSelector); return $1; }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},smalltalk.Object)})}, args: ["aSelector"], source: "respondsTo: aSelector\x0a\x09^self class canUnderstand: aSelector", messageSends: ["canUnderstand:", "class"], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "shallowCopy", category: 'copying', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var copy = self.klass._new(); for(var i in self) { if(/^@.+/.test(i)) { copy[i] = self[i]; } } return copy; ; return self}, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.Object)})}, args: [], source: "shallowCopy\x0a\x09<\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09for(var i in self) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i];\x0a\x09\x09}\x0a\x09\x09}\x0a\x09\x09return copy;\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "shouldNotImplement", category: 'error handling', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._error_(_st("This method should not be implemented in ").__comma(_st(_st(self)._class())._name())); return self}, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},smalltalk.Object)})}, args: [], source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name", messageSends: ["error:", ",", "name", "class"], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "size", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._error_("Object not indexable"); return self}, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Object)})}, args: [], source: "size\x0a\x09self error: 'Object not indexable'", messageSends: ["error:"], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "subclassResponsibility", category: 'error handling', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._error_("This method is a responsibility of a subclass"); return self}, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},smalltalk.Object)})}, args: [], source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'", messageSends: ["error:"], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "test", category: 'converting', fn: function (){ var self=this; var a; return smalltalk.withContext(function($ctx1) { a=(1); _st(self)._halt(); return self}, function($ctx1) {$ctx1.fill(self,"test",{a:a},smalltalk.Object)})}, args: [], source: "test\x0a\x09| a |\x0a\x09a := 1.\x0a\x09self halt", messageSends: ["halt"], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "throw:", category: 'error handling', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { throw anObject ; return self}, function($ctx1) {$ctx1.fill(self,"throw:",{anObject:anObject},smalltalk.Object)})}, args: ["anObject"], source: "throw: anObject\x0a\x09< throw anObject >", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "try:catch:", category: 'error handling', fn: function (aBlock,anotherBlock){ var self=this; return smalltalk.withContext(function($ctx1) { try{return aBlock()} catch(e) {return anotherBlock(e)}; return self}, function($ctx1) {$ctx1.fill(self,"try:catch:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Object)})}, args: ["aBlock", "anotherBlock"], source: "try: aBlock catch: anotherBlock\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "value", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.valueOf(); return self}, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.Object)})}, args: [], source: "value\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "yourself", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self; return $1; }, function($ctx1) {$ctx1.fill(self,"yourself",{},smalltalk.Object)})}, args: [], source: "yourself\x0a\x09^self", messageSends: [], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "~=", category: 'comparing', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self).__eq(anObject)).__eq(false); return $1; }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},smalltalk.Object)})}, args: ["anObject"], source: "~= anObject\x0a\x09^(self = anObject) = false", messageSends: ["="], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "~~", category: 'comparing', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self).__eq_eq(anObject)).__eq(false); return $1; }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},smalltalk.Object)})}, args: ["anObject"], source: "~~ anObject\x0a\x09^(self == anObject) = false", messageSends: ["=", "=="], referencedClasses: [] }), smalltalk.Object); smalltalk.addMethod( smalltalk.method({ selector: "initialize", category: 'initialization', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Object.klass)})}, args: [], source: "initialize\x0a\x09\x22no op\x22", messageSends: [], referencedClasses: [] }), smalltalk.Object.klass); smalltalk.addClass('Boolean', smalltalk.Object, [], 'Kernel-Objects'); smalltalk.Boolean.comment="Boolean wraps the JavaScript `Boolean()` constructor. The `true` and `false` objects are the JavaScript boolean objects.\x0a\x0aBoolean defines the protocol for logic testing operations and conditional control structures for the logical values.\x0aBoolean instances are weither `true` or `false`." smalltalk.addMethod( smalltalk.method({ selector: "&", category: 'controlling', fn: function (aBoolean){ var self=this; return smalltalk.withContext(function($ctx1) { if(self == true) { return aBoolean; } else { return false; } ; return self}, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},smalltalk.Boolean)})}, args: ["aBoolean"], source: "& aBoolean\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBoolean;\x0a\x09\x09} else {\x0a\x09\x09return false;\x0a\x09\x09}\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.Boolean); smalltalk.addMethod( smalltalk.method({ selector: "=", category: 'comparing', fn: function (aBoolean){ var self=this; return smalltalk.withContext(function($ctx1) { if(! aBoolean._isBoolean || ! aBoolean._isBoolean()) { return false; } return Boolean(self == true) == aBoolean ; return self}, function($ctx1) {$ctx1.fill(self,"=",{aBoolean:aBoolean},smalltalk.Boolean)})}, args: ["aBoolean"], source: "= aBoolean\x0a\x09<\x0a\x09\x09if(! aBoolean._isBoolean || ! aBoolean._isBoolean()) {\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09\x09return Boolean(self == true) == aBoolean\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.Boolean); smalltalk.addMethod( smalltalk.method({ selector: "==", category: 'comparing', fn: function (aBoolean){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self).__eq(aBoolean); return $1; }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},smalltalk.Boolean)})}, args: ["aBoolean"], source: "== aBoolean\x0a\x09^self = aBoolean", messageSends: ["="], referencedClasses: [] }), smalltalk.Boolean); smalltalk.addMethod( smalltalk.method({ selector: "and:", category: 'controlling', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=_st(self).__eq(true); $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){ return smalltalk.withContext(function($ctx2) { return false; }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},smalltalk.Boolean)})}, args: ["aBlock"], source: "and: aBlock\x0a\x09^self = true\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [false]", messageSends: ["ifTrue:ifFalse:", "="], referencedClasses: [] }), smalltalk.Boolean); smalltalk.addMethod( smalltalk.method({ selector: "asJSON", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self; return $1; }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.Boolean)})}, args: [], source: "asJSON\x0a\x09^self", messageSends: [], referencedClasses: [] }), smalltalk.Boolean); smalltalk.addMethod( smalltalk.method({ selector: "asString", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.toString() ; return self}, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Boolean)})}, args: [], source: "asString\x0a\x09< return self.toString() >", messageSends: [], referencedClasses: [] }), smalltalk.Boolean); smalltalk.addMethod( smalltalk.method({ selector: "deepCopy", category: 'copying', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self; return $1; }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.Boolean)})}, args: [], source: "deepCopy\x0a\x09^self", messageSends: [], referencedClasses: [] }), smalltalk.Boolean); smalltalk.addMethod( smalltalk.method({ selector: "ifFalse:", category: 'controlling', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=self; $1=_st($2)._ifTrue_ifFalse_((function(){ return smalltalk.withContext(function($ctx2) { }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),aBlock); return $1; }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},smalltalk.Boolean)})}, args: ["aBlock"], source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: [] ifFalse: aBlock", messageSends: ["ifTrue:ifFalse:"], referencedClasses: [] }), smalltalk.Boolean); smalltalk.addMethod( smalltalk.method({ selector: "ifFalse:ifTrue:", category: 'controlling', fn: function (aBlock,anotherBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=self; $1=_st($2)._ifTrue_ifFalse_(anotherBlock,aBlock); return $1; }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Boolean)})}, args: ["aBlock", "anotherBlock"], source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: anotherBlock ifFalse: aBlock", messageSends: ["ifTrue:ifFalse:"], referencedClasses: [] }), smalltalk.Boolean); smalltalk.addMethod( smalltalk.method({ selector: "ifTrue:", category: 'controlling', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=self; $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){ return smalltalk.withContext(function($ctx2) { }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},smalltalk.Boolean)})}, args: ["aBlock"], source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: aBlock ifFalse: []", messageSends: ["ifTrue:ifFalse:"], referencedClasses: [] }), smalltalk.Boolean); smalltalk.addMethod( smalltalk.method({ selector: "ifTrue:ifFalse:", category: 'controlling', fn: function (aBlock,anotherBlock){ var self=this; return smalltalk.withContext(function($ctx1) { if(self == true) { return aBlock(); } else { return anotherBlock(); } ; return self}, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Boolean)})}, args: ["aBlock", "anotherBlock"], source: "ifTrue: aBlock ifFalse: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBlock();\x0a\x09\x09} else {\x0a\x09\x09return anotherBlock();\x0a\x09\x09}\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.Boolean); smalltalk.addMethod( smalltalk.method({ selector: "isBoolean", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return true; }, function($ctx1) {$ctx1.fill(self,"isBoolean",{},smalltalk.Boolean)})}, args: [], source: "isBoolean\x0a\x09^ true", messageSends: [], referencedClasses: [] }), smalltalk.Boolean); smalltalk.addMethod( smalltalk.method({ selector: "isImmutable", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return true; }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.Boolean)})}, args: [], source: "isImmutable\x0a\x09^ true", messageSends: [], referencedClasses: [] }), smalltalk.Boolean); smalltalk.addMethod( smalltalk.method({ selector: "not", category: 'controlling', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self).__eq(false); return $1; }, function($ctx1) {$ctx1.fill(self,"not",{},smalltalk.Boolean)})}, args: [], source: "not\x0a\x09^self = false", messageSends: ["="], referencedClasses: [] }), smalltalk.Boolean); smalltalk.addMethod( smalltalk.method({ selector: "or:", category: 'controlling', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=_st(self).__eq(true); $1=_st($2)._ifTrue_ifFalse_((function(){ return smalltalk.withContext(function($ctx2) { return true; }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),aBlock); return $1; }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},smalltalk.Boolean)})}, args: ["aBlock"], source: "or: aBlock\x0a\x09^self = true\x0a\x09\x09ifTrue: [true]\x0a\x09\x09ifFalse: aBlock", messageSends: ["ifTrue:ifFalse:", "="], referencedClasses: [] }), smalltalk.Boolean); smalltalk.addMethod( smalltalk.method({ selector: "printOn:", category: 'printing', fn: function (aStream){ var self=this; return smalltalk.withContext(function($ctx1) { _st(aStream)._nextPutAll_(_st(self)._asString()); return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Boolean)})}, args: ["aStream"], source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString", messageSends: ["nextPutAll:", "asString"], referencedClasses: [] }), smalltalk.Boolean); smalltalk.addMethod( smalltalk.method({ selector: "shallowCopy", category: 'copying', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self; return $1; }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.Boolean)})}, args: [], source: "shallowCopy\x0a\x09^self", messageSends: [], referencedClasses: [] }), smalltalk.Boolean); smalltalk.addMethod( smalltalk.method({ selector: "|", category: 'controlling', fn: function (aBoolean){ var self=this; return smalltalk.withContext(function($ctx1) { if(self == true) { return true; } else { return aBoolean; } ; return self}, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},smalltalk.Boolean)})}, args: ["aBoolean"], source: "| aBoolean\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return true;\x0a\x09\x09} else {\x0a\x09\x09return aBoolean;\x0a\x09\x09}\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.Boolean); smalltalk.addClass('Date', smalltalk.Object, [], 'Kernel-Objects'); smalltalk.Date.comment="The Date class is used to work with dates and times. Therefore `Date today` and `Date now` are both valid in\x0aAmber and answer the same date object.\x0a\x0aDate wraps the `Date()` JavaScript constructor, and Smalltalk date objects are JavaScript date objects." smalltalk.addMethod( smalltalk.method({ selector: "+", category: 'arithmetic', fn: function (aDate){ var self=this; return smalltalk.withContext(function($ctx1) { return self + aDate; return self}, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},smalltalk.Date)})}, args: ["aDate"], source: "+ aDate\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "-", category: 'arithmetic', fn: function (aDate){ var self=this; return smalltalk.withContext(function($ctx1) { return self - aDate; return self}, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},smalltalk.Date)})}, args: ["aDate"], source: "- aDate\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "<", category: 'comparing', fn: function (aDate){ var self=this; return smalltalk.withContext(function($ctx1) { return self < aDate; return self}, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},smalltalk.Date)})}, args: ["aDate"], source: "< aDate\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "<=", category: 'comparing', fn: function (aDate){ var self=this; return smalltalk.withContext(function($ctx1) { return self <= aDate; return self}, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},smalltalk.Date)})}, args: ["aDate"], source: "<= aDate\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: ">", category: 'comparing', fn: function (aDate){ var self=this; return smalltalk.withContext(function($ctx1) { return self > aDate; return self}, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},smalltalk.Date)})}, args: ["aDate"], source: "> aDate\x0a\x09> aDate>", messageSends: [], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: ">=", category: 'comparing', fn: function (aDate){ var self=this; return smalltalk.withContext(function($ctx1) { return self >= aDate; return self}, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},smalltalk.Date)})}, args: ["aDate"], source: ">= aDate\x0a\x09>= aDate>", messageSends: [], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "asDateString", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.toDateString(); return self}, function($ctx1) {$ctx1.fill(self,"asDateString",{},smalltalk.Date)})}, args: [], source: "asDateString\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "asLocaleString", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.toLocaleString(); return self}, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},smalltalk.Date)})}, args: [], source: "asLocaleString\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "asMilliseconds", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._time(); return $1; }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},smalltalk.Date)})}, args: [], source: "asMilliseconds\x0a\x09^self time", messageSends: ["time"], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "asNumber", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._asMilliseconds(); return $1; }, function($ctx1) {$ctx1.fill(self,"asNumber",{},smalltalk.Date)})}, args: [], source: "asNumber\x0a\x09^self asMilliseconds", messageSends: ["asMilliseconds"], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "asString", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.toString(); return self}, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Date)})}, args: [], source: "asString\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "asTimeString", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.toTimeString(); return self}, function($ctx1) {$ctx1.fill(self,"asTimeString",{},smalltalk.Date)})}, args: [], source: "asTimeString\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "day", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._dayOfWeek(); return $1; }, function($ctx1) {$ctx1.fill(self,"day",{},smalltalk.Date)})}, args: [], source: "day\x0a\x09^self dayOfWeek", messageSends: ["dayOfWeek"], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "day:", category: 'accessing', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._dayOfWeek_(aNumber); return self}, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},smalltalk.Date)})}, args: ["aNumber"], source: "day: aNumber\x0a\x09self dayOfWeek: aNumber", messageSends: ["dayOfWeek:"], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "dayOfMonth", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.getDate(); return self}, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},smalltalk.Date)})}, args: [], source: "dayOfMonth\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "dayOfMonth:", category: 'accessing', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { self.setDate(aNumber); return self}, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},smalltalk.Date)})}, args: ["aNumber"], source: "dayOfMonth: aNumber\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "dayOfWeek", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.getDay() + 1; return self}, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},smalltalk.Date)})}, args: [], source: "dayOfWeek\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "dayOfWeek:", category: 'accessing', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { return self.setDay(aNumber - 1); return self}, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},smalltalk.Date)})}, args: ["aNumber"], source: "dayOfWeek: aNumber\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "hours", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.getHours(); return self}, function($ctx1) {$ctx1.fill(self,"hours",{},smalltalk.Date)})}, args: [], source: "hours\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "hours:", category: 'accessing', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { self.setHours(aNumber); return self}, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},smalltalk.Date)})}, args: ["aNumber"], source: "hours: aNumber\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "milliseconds", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.getMilliseconds(); return self}, function($ctx1) {$ctx1.fill(self,"milliseconds",{},smalltalk.Date)})}, args: [], source: "milliseconds\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "milliseconds:", category: 'accessing', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { self.setMilliseconds(aNumber); return self}, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},smalltalk.Date)})}, args: ["aNumber"], source: "milliseconds: aNumber\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "minutes", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.getMinutes(); return self}, function($ctx1) {$ctx1.fill(self,"minutes",{},smalltalk.Date)})}, args: [], source: "minutes\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "minutes:", category: 'accessing', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { self.setMinutes(aNumber); return self}, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},smalltalk.Date)})}, args: ["aNumber"], source: "minutes: aNumber\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "month", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.getMonth() + 1; return self}, function($ctx1) {$ctx1.fill(self,"month",{},smalltalk.Date)})}, args: [], source: "month\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "month:", category: 'accessing', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { self.setMonth(aNumber - 1); return self}, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},smalltalk.Date)})}, args: ["aNumber"], source: "month: aNumber\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "printOn:", category: 'printing', fn: function (aStream){ var self=this; return smalltalk.withContext(function($ctx1) { _st(aStream)._nextPutAll_(_st(self)._asString()); return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Date)})}, args: ["aStream"], source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString", messageSends: ["nextPutAll:", "asString"], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "seconds", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.getSeconds(); return self}, function($ctx1) {$ctx1.fill(self,"seconds",{},smalltalk.Date)})}, args: [], source: "seconds\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "seconds:", category: 'accessing', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { self.setSeconds(aNumber); return self}, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},smalltalk.Date)})}, args: ["aNumber"], source: "seconds: aNumber\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "time", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.getTime(); return self}, function($ctx1) {$ctx1.fill(self,"time",{},smalltalk.Date)})}, args: [], source: "time\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "time:", category: 'accessing', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { self.setTime(aNumber); return self}, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},smalltalk.Date)})}, args: ["aNumber"], source: "time: aNumber\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "year", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.getFullYear(); return self}, function($ctx1) {$ctx1.fill(self,"year",{},smalltalk.Date)})}, args: [], source: "year\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "year:", category: 'accessing', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { self.setFullYear(aNumber); return self}, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},smalltalk.Date)})}, args: ["aNumber"], source: "year: aNumber\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Date); smalltalk.addMethod( smalltalk.method({ selector: "fromMilliseconds:", category: 'instance creation', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._new_(aNumber); return $1; }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},smalltalk.Date.klass)})}, args: ["aNumber"], source: "fromMilliseconds: aNumber\x0a\x09^self new: aNumber", messageSends: ["new:"], referencedClasses: [] }), smalltalk.Date.klass); smalltalk.addMethod( smalltalk.method({ selector: "fromSeconds:", category: 'instance creation', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._fromMilliseconds_(_st(aNumber).__star((1000))); return $1; }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},smalltalk.Date.klass)})}, args: ["aNumber"], source: "fromSeconds: aNumber\x0a\x09^self fromMilliseconds: aNumber * 1000", messageSends: ["fromMilliseconds:", "*"], referencedClasses: [] }), smalltalk.Date.klass); smalltalk.addMethod( smalltalk.method({ selector: "fromString:", category: 'instance creation', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._new_(aString); return $1; }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},smalltalk.Date.klass)})}, args: ["aString"], source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^self new: aString", messageSends: ["new:"], referencedClasses: [] }), smalltalk.Date.klass); smalltalk.addMethod( smalltalk.method({ selector: "millisecondsToRun:", category: 'instance creation', fn: function (aBlock){ var self=this; var t; function $Date(){return smalltalk.Date||(typeof Date=="undefined"?nil:Date)} return smalltalk.withContext(function($ctx1) { var $1; t=_st($Date())._now(); _st(aBlock)._value(); $1=_st(_st($Date())._now()).__minus(t); return $1; }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},smalltalk.Date.klass)})}, args: ["aBlock"], source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^Date now - t", messageSends: ["now", "value", "-"], referencedClasses: ["Date"] }), smalltalk.Date.klass); smalltalk.addMethod( smalltalk.method({ selector: "new:", category: 'instance creation', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { return new Date(anObject); return self}, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},smalltalk.Date.klass)})}, args: ["anObject"], source: "new: anObject\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Date.klass); smalltalk.addMethod( smalltalk.method({ selector: "now", category: 'instance creation', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._today(); return $1; }, function($ctx1) {$ctx1.fill(self,"now",{},smalltalk.Date.klass)})}, args: [], source: "now\x0a\x09^self today", messageSends: ["today"], referencedClasses: [] }), smalltalk.Date.klass); smalltalk.addMethod( smalltalk.method({ selector: "today", category: 'instance creation', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._new(); return $1; }, function($ctx1) {$ctx1.fill(self,"today",{},smalltalk.Date.klass)})}, args: [], source: "today\x0a\x09^self new", messageSends: ["new"], referencedClasses: [] }), smalltalk.Date.klass); smalltalk.addClass('Environment', smalltalk.Object, [], 'Kernel-Objects'); smalltalk.Environment.comment="Abstract class defining common behavior for local and remote environments" smalltalk.addMethod( smalltalk.method({ selector: "addInstVarNamed:to:", category: 'compiling', fn: function (aString,aClass){ var self=this; return smalltalk.withContext(function($ctx1) { var $1,$2; $1=_st(_st(aClass)._instanceVariableNames())._copy(); _st($1)._add_(aString); $2=_st($1)._yourself(); _st(_st(self)._classBuilder())._addSubclassOf_named_instanceVariableNames_package_(_st(aClass)._superclass(),_st(aClass)._name(),$2,_st(_st(aClass)._package())._name()); return self}, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},smalltalk.HLEnvironment)})}, args: ["aString", "aClass"], source: "addInstVarNamed: aString to: aClass\x0a\x09self classBuilder\x0a\x09\x09addSubclassOf: aClass superclass \x0a\x09\x09named: aClass name \x0a\x09\x09instanceVariableNames: (aClass instanceVariableNames copy add: aString; yourself)\x0a\x09\x09package: aClass package name", messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package", "classBuilder"], referencedClasses: [] }), smalltalk.Environment); smalltalk.addMethod( smalltalk.method({ selector: "allSelectors", category: 'accessing', fn: function (){ var self=this; function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(_st($Smalltalk())._current())._at_("allSelectors"))._value(); return $1; }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},smalltalk.Environment)})}, args: [], source: "allSelectors\x0a\x09^ (Smalltalk current at: 'allSelectors') value", messageSends: ["value", "at:", "current"], referencedClasses: ["Smalltalk"] }), smalltalk.Environment); smalltalk.addMethod( smalltalk.method({ selector: "availableClassNames", category: 'accessing', fn: function (){ var self=this; function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(_st($Smalltalk())._current())._classes())._collect_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(each)._name(); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},smalltalk.HLEnvironment)})}, args: [], source: "availableClassNames\x0a\x09^ Smalltalk current classes \x0a\x09\x09collect: [ :each | each name ]", messageSends: ["collect:", "name", "classes", "current"], referencedClasses: ["Smalltalk"] }), smalltalk.Environment); smalltalk.addMethod( smalltalk.method({ selector: "availablePackageNames", category: 'accessing', fn: function (){ var self=this; function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(_st($Smalltalk())._current())._packages())._collect_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(each)._name(); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},smalltalk.HLEnvironment)})}, args: [], source: "availablePackageNames\x0a\x09^ Smalltalk current packages \x0a\x09\x09collect: [ :each | each name ]", messageSends: ["collect:", "name", "packages", "current"], referencedClasses: ["Smalltalk"] }), smalltalk.Environment); smalltalk.addMethod( smalltalk.method({ selector: "availableProtocolsFor:", category: 'accessing', fn: function (aClass){ var self=this; var protocols; return smalltalk.withContext(function($ctx1) { var $1,$2; protocols=_st(aClass)._protocols(); $1=_st(aClass)._superclass(); if(($receiver = $1) == nil || $receiver == undefined){ $1; } else { _st(protocols)._addAll_(_st(self)._availableProtocolsFor_(_st(aClass)._superclass())); }; $2=_st(_st(protocols)._asSet())._asArray(); return $2; }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},smalltalk.HLEnvironment)})}, args: ["aClass"], source: "availableProtocolsFor: aClass\x0a\x09| protocols |\x0a\x09\x0a\x09protocols := aClass protocols.\x0a\x09aClass superclass ifNotNil: [ protocols addAll: (self availableProtocolsFor: aClass superclass) ].\x0a\x09^ protocols asSet asArray", messageSends: ["protocols", "ifNotNil:", "addAll:", "availableProtocolsFor:", "superclass", "asArray", "asSet"], referencedClasses: [] }), smalltalk.Environment); smalltalk.addMethod( smalltalk.method({ selector: "classBuilder", category: 'accessing', fn: function (){ var self=this; function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st($ClassBuilder())._new(); return $1; }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},smalltalk.HLEnvironment)})}, args: [], source: "classBuilder\x0a\x09^ ClassBuilder new", messageSends: ["new"], referencedClasses: ["ClassBuilder"] }), smalltalk.Environment); smalltalk.addMethod( smalltalk.method({ selector: "classNamed:", category: 'accessing', fn: function (aString){ var self=this; function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return smalltalk.withContext(function($ctx1) { var $2,$1; $2=_st(_st($Smalltalk())._current())._at_(_st(aString)._asSymbol()); if(($receiver = $2) == nil || $receiver == undefined){ $1=_st(self)._error_("Invalid class name"); } else { $1=$2; }; return $1; }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},smalltalk.HLEnvironment)})}, args: ["aString"], source: "classNamed: aString\x0a\x09^ (Smalltalk current at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]", messageSends: ["ifNil:", "error:", "at:", "asSymbol", "current"], referencedClasses: ["Smalltalk"] }), smalltalk.Environment); smalltalk.addMethod( smalltalk.method({ selector: "classes", category: 'accessing', fn: function (){ var self=this; function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st($Smalltalk())._current())._classes(); return $1; }, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Environment)})}, args: [], source: "classes\x0a\x09^ Smalltalk current classes", messageSends: ["classes", "current"], referencedClasses: ["Smalltalk"] }), smalltalk.Environment); smalltalk.addMethod( smalltalk.method({ selector: "commitPackage:", category: 'actions', fn: function (aPackage){ var self=this; return smalltalk.withContext(function($ctx1) { _st(aPackage)._commit(); return self}, function($ctx1) {$ctx1.fill(self,"commitPackage:",{aPackage:aPackage},smalltalk.HLEnvironment)})}, args: ["aPackage"], source: "commitPackage: aPackage\x0a\x09aPackage commit", messageSends: ["commit"], referencedClasses: [] }), smalltalk.Environment); smalltalk.addMethod( smalltalk.method({ selector: "compileClassComment:for:", category: 'compiling', fn: function (aString,aClass){ var self=this; return smalltalk.withContext(function($ctx1) { _st(aClass)._comment_(aString); return self}, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},smalltalk.HLEnvironment)})}, args: ["aString", "aClass"], source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString", messageSends: ["comment:"], referencedClasses: [] }), smalltalk.Environment); smalltalk.addMethod( smalltalk.method({ selector: "compileClassDefinition:", category: 'compiling', fn: function (aString){ var self=this; function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)} return smalltalk.withContext(function($ctx1) { _st(self)._eval_on_(aString,_st($DoIt())._new()); return self}, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},smalltalk.HLEnvironment)})}, args: ["aString"], source: "compileClassDefinition: aString\x0a\x09self eval: aString on: DoIt new", messageSends: ["eval:on:", "new"], referencedClasses: ["DoIt"] }), smalltalk.Environment); smalltalk.addMethod( smalltalk.method({ selector: "compileMethod:for:protocol:", category: 'compiling', fn: function (sourceCode,class_,protocol){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(class_)._compile_category_(sourceCode,protocol); return $1; }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},smalltalk.HLEnvironment)})}, args: ["sourceCode", "class", "protocol"], source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09category: protocol", messageSends: ["compile:category:"], referencedClasses: [] }), smalltalk.Environment); smalltalk.addMethod( smalltalk.method({ selector: "copyClass:to:", category: 'actions', fn: function (aClass,aClassName){ var self=this; function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st($Smalltalk())._current())._at_(aClassName); if(($receiver = $1) == nil || $receiver == undefined){ $1; } else { _st(self)._error_(_st(_st("A class named ").__comma(aClassName)).__comma(" already exists")); }; _st(_st($ClassBuilder())._new())._copyClass_named_(aClass,aClassName); return self}, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},smalltalk.HLEnvironment)})}, args: ["aClass", "aClassName"], source: "copyClass: aClass to: aClassName\x0a\x09(Smalltalk current at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new copyClass: aClass named: aClassName\x0a\x09\x09\x0a\x09", messageSends: ["ifNotNil:", "error:", ",", "at:", "current", "copyClass:named:", "new"], referencedClasses: ["Smalltalk", "ClassBuilder"] }), smalltalk.Environment); smalltalk.addMethod( smalltalk.method({ selector: "eval:on:", category: 'actions', fn: function (aString,aReceiver){ var self=this; var compiler; function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)} function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)} return smalltalk.withContext(function($ctx1) { var $1,$2; var $early={}; try { compiler=_st($Compiler())._new(); _st((function(){ return smalltalk.withContext(function($ctx2) { return _st(compiler)._parseExpression_(aString); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(ex){ return smalltalk.withContext(function($ctx2) { $1=_st(window)._alert_(_st(ex)._messageText()); throw $early=[$1]; }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})})); $2=_st(compiler)._evaluateExpression_on_(aString,aReceiver); return $2; } catch(e) {if(e===$early)return e[0]; throw e} }, function($ctx1) {$ctx1.fill(self,"eval:on:",{aString:aString,aReceiver:aReceiver,compiler:compiler},smalltalk.HLEnvironment)})}, args: ["aString", "aReceiver"], source: "eval: aString on: aReceiver\x0a\x09| compiler |\x0a\x09compiler := Compiler new.\x0a\x09[ compiler parseExpression: aString ] on: Error do: [ :ex |\x0a\x09\x09^ window alert: ex messageText ].\x0a\x09^ compiler evaluateExpression: aString on: aReceiver", messageSends: ["new", "on:do:", "alert:", "messageText", "parseExpression:", "evaluateExpression:on:"], referencedClasses: ["Compiler", "Error"] }), smalltalk.Environment); smalltalk.addMethod( smalltalk.method({ selector: "moveClass:toPackage:", category: 'actions', fn: function (aClass,aPackageName){ var self=this; var package_; function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)} return smalltalk.withContext(function($ctx1) { var $1,$2,$3; package_=_st($Package())._named_(aPackageName); $1=package_; if(($receiver = $1) == nil || $receiver == undefined){ _st(self)._error_("Invalid package name"); } else { $1; }; $2=_st(package_).__eq_eq(_st(aClass)._package()); if(smalltalk.assert($2)){ $3=self; return $3; }; _st(aClass)._package_(package_); return self}, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},smalltalk.HLEnvironment)})}, args: ["aClass", "aPackageName"], source: "moveClass: aClass toPackage: aPackageName\x0a\x09| package |\x0a\x09\x0a\x09package := Package named: aPackageName.\x0a\x09package ifNil: [ self error: 'Invalid package name' ].\x0a\x09package == aClass package ifTrue: [ ^ self ].\x0a\x09\x0a\x09aClass package: package", messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"], referencedClasses: ["Package"] }), smalltalk.Environment); smalltalk.addMethod( smalltalk.method({ selector: "moveMethod:toClass:", category: 'actions', fn: function (aMethod,aClassName){ var self=this; var destinationClass; function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return smalltalk.withContext(function($ctx1) { var $1,$2,$3; destinationClass=_st(_st($Smalltalk())._current())._at_(_st(aClassName)._asSymbol()); $1=destinationClass; if(($receiver = $1) == nil || $receiver == undefined){ _st(self)._error_("Invalid class name"); } else { $1; }; $2=_st(destinationClass).__eq_eq(_st(aMethod)._methodClass()); if(smalltalk.assert($2)){ $3=self; return $3; }; _st(destinationClass)._compile_category_(_st(aMethod)._source(),_st(aMethod)._protocol()); _st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod); return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},smalltalk.Environment)})}, args: ["aMethod", "aClassName"], source: "moveMethod: aMethod toClass: aClassName\x0a\x09| destinationClass |\x0a\x09\x0a\x09destinationClass := Smalltalk current at: aClassName asSymbol.\x0a\x09destinationClass ifNil: [ self error: 'Invalid class name' ].\x0a\x09destinationClass == aMethod methodClass ifTrue: [ ^ self ].\x0a\x09\x0a\x09destinationClass \x0a\x09\x09compile: aMethod source\x0a\x09\x09category: aMethod protocol.\x0a\x09aMethod methodClass \x0a\x09\x09removeCompiledMethod: aMethod\x0a\x09", messageSends: ["at:", "asSymbol", "current", "ifNil:", "error:", "ifTrue:", "==", "methodClass", "compile:category:", "source", "protocol", "removeCompiledMethod:"], referencedClasses: ["Smalltalk"] }), smalltalk.Environment); smalltalk.addMethod( smalltalk.method({ selector: "moveMethod:toProtocol:", category: 'actions', fn: function (aMethod,aProtocol){ var self=this; return smalltalk.withContext(function($ctx1) { _st(aMethod)._category_(aProtocol); return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},smalltalk.HLEnvironment)})}, args: ["aMethod", "aProtocol"], source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod category: aProtocol", messageSends: ["category:"], referencedClasses: [] }), smalltalk.Environment); smalltalk.addMethod( smalltalk.method({ selector: "packages", category: 'accessing', fn: function (){ var self=this; function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st($Smalltalk())._current())._packages(); return $1; }, function($ctx1) {$ctx1.fill(self,"packages",{},smalltalk.HLEnvironment)})}, args: [], source: "packages\x0a\x09^ Smalltalk current packages", messageSends: ["packages", "current"], referencedClasses: ["Smalltalk"] }), smalltalk.Environment); smalltalk.addMethod( smalltalk.method({ selector: "removeClass:", category: 'actions', fn: function (aClass){ var self=this; function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return smalltalk.withContext(function($ctx1) { _st(_st($Smalltalk())._current())._removeClass_(aClass); return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},smalltalk.HLEnvironment)})}, args: ["aClass"], source: "removeClass: aClass\x0a\x09Smalltalk current removeClass: aClass", messageSends: ["removeClass:", "current"], referencedClasses: ["Smalltalk"] }), smalltalk.Environment); smalltalk.addMethod( smalltalk.method({ selector: "removeMethod:", category: 'actions', fn: function (aMethod){ var self=this; return smalltalk.withContext(function($ctx1) { _st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod); return self}, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},smalltalk.Environment)})}, args: ["aMethod"], source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod", messageSends: ["removeCompiledMethod:", "methodClass"], referencedClasses: [] }), smalltalk.Environment); smalltalk.addMethod( smalltalk.method({ selector: "removeProtocol:from:", category: 'actions', fn: function (aString,aClass){ var self=this; return smalltalk.withContext(function($ctx1) { _st(_st(_st(aClass)._methods())._select_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(_st(each)._protocol()).__eq(aString); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._do_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(aClass)._removeCompiledMethod_(each); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},smalltalk.Environment)})}, args: ["aString", "aClass"], source: "removeProtocol: aString from: aClass\x0a\x09(aClass methods\x0a\x09\x09select: [ :each | each protocol = aString ])\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]", messageSends: ["do:", "removeCompiledMethod:", "select:", "=", "protocol", "methods"], referencedClasses: [] }), smalltalk.Environment); smalltalk.addMethod( smalltalk.method({ selector: "renameClass:to:", category: 'actions', fn: function (aClass,aClassName){ var self=this; function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st($Smalltalk())._current())._at_(aClassName); if(($receiver = $1) == nil || $receiver == undefined){ $1; } else { _st(self)._error_(_st(_st("A class named ").__comma(aClassName)).__comma(" already exists")); }; _st(_st($ClassBuilder())._new())._renameClass_to_(aClass,aClassName); return self}, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},smalltalk.HLEnvironment)})}, args: ["aClass", "aClassName"], source: "renameClass: aClass to: aClassName\x0a\x09(Smalltalk current at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new renameClass: aClass to: aClassName\x09\x0a\x09", messageSends: ["ifNotNil:", "error:", ",", "at:", "current", "renameClass:to:", "new"], referencedClasses: ["Smalltalk", "ClassBuilder"] }), smalltalk.Environment); smalltalk.addMethod( smalltalk.method({ selector: "renameProtocol:to:in:", category: 'actions', fn: function (aString,anotherString,aClass){ var self=this; return smalltalk.withContext(function($ctx1) { _st(_st(_st(aClass)._methods())._select_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(_st(each)._protocol()).__eq(aString); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._do_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(each)._protocol_(anotherString); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},smalltalk.Environment)})}, args: ["aString", "anotherString", "aClass"], source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methods\x0a\x09\x09select: [ :each | each protocol = aString ])\x0a\x09\x09do: [ :each | each protocol: anotherString ]", messageSends: ["do:", "protocol:", "select:", "=", "protocol", "methods"], referencedClasses: [] }), smalltalk.Environment); smalltalk.addMethod( smalltalk.method({ selector: "systemAnnouncer", category: 'accessing', fn: function (){ var self=this; function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(_st($Smalltalk())._current())._at_("SystemAnnouncer"))._current(); return $1; }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},smalltalk.Environment)})}, args: [], source: "systemAnnouncer\x0a\x09^ (Smalltalk current at: #SystemAnnouncer) current", messageSends: ["current", "at:"], referencedClasses: ["Smalltalk"] }), smalltalk.Environment); smalltalk.addClass('JSObjectProxy', smalltalk.Object, ['jsObject'], 'Kernel-Objects'); smalltalk.JSObjectProxy.comment="JSObjectProxy handles sending messages to JavaScript object, therefore accessing JavaScript objects from Amber is transparent.\x0aJSOjbectProxy makes intensive use of `#doesNotUnderstand:`.\x0a\x0a## Examples\x0a\x0aJSObjectProxy objects are instanciated by Amber when a Smalltalk message is sent to a JavaScript object.\x0a\x0a\x09window alert: 'hello world'.\x0a\x09window inspect.\x0a\x09(window jQuery: 'body') append: 'hello world'\x0a\x0aSmalltalk messages sends are converted to JavaScript function calls or object property access _(in this order)_. If n one of them match, a `MessageNotUnderstood` error will be thrown.\x0a\x0a## Message conversion rules\x0a\x0a- `someUser name` becomes `someUser.name`\x0a- `someUser name: 'John'` becomes `someUser name = \x22John\x22`\x0a- `console log: 'hello world'` becomes `console.log('hello world')`\x0a- `(window jQuery: 'foo') css: 'background' color: 'red'` becomes `window.jQuery('foo').css('background', 'red')`\x0a\x0a__Note:__ For keyword-based messages, only the first keyword is kept: `window foo: 1 bar: 2` is equivalent to `window foo: 1 baz: 2`." smalltalk.addMethod( smalltalk.method({ selector: "addObjectVariablesTo:", category: 'proxy', fn: function (aDictionary){ var self=this; return smalltalk.withContext(function($ctx1) { for(var i in self['@jsObject']) { aDictionary._at_put_(i, self['@jsObject'][i]); } ; return self}, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:",{aDictionary:aDictionary},smalltalk.JSObjectProxy)})}, args: ["aDictionary"], source: "addObjectVariablesTo: aDictionary\x0a\x09<\x0a\x09\x09for(var i in self['@jsObject']) {\x0a\x09\x09\x09aDictionary._at_put_(i, self['@jsObject'][i]);\x0a\x09\x09}\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.JSObjectProxy); smalltalk.addMethod( smalltalk.method({ selector: "at:", category: 'accessing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { return self['@jsObject'][aString]; return self}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.JSObjectProxy)})}, args: ["aString"], source: "at: aString\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.JSObjectProxy); smalltalk.addMethod( smalltalk.method({ selector: "at:ifAbsent:", category: 'accessing', fn: function (aString,aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var obj = self['@jsObject']; return aString in obj ? obj[aString] : aBlock(); ; return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},smalltalk.JSObjectProxy)})}, args: ["aString", "aBlock"], source: "at: aString ifAbsent: aBlock\x0a\x09\x22return the aString property or evaluate aBlock if the property is not defined on the object\x22\x0a\x09<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? obj[aString] : aBlock();\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.JSObjectProxy); smalltalk.addMethod( smalltalk.method({ selector: "at:ifPresent:", category: 'accessing', fn: function (aString,aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var obj = self['@jsObject']; return aString in obj ? aBlock(obj[aString]) : nil; ; return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},smalltalk.JSObjectProxy)})}, args: ["aString", "aBlock"], source: "at: aString ifPresent: aBlock\x0a\x09\x22return the evaluation of aBlock with the value if the property is defined or return nil\x22\x0a\x09<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? aBlock(obj[aString]) : nil;\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.JSObjectProxy); smalltalk.addMethod( smalltalk.method({ selector: "at:ifPresent:ifAbsent:", category: 'accessing', fn: function (aString,aBlock,anotherBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var obj = self['@jsObject']; return aString in obj ? aBlock(obj[aString]) : anotherBlock(); ; return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.JSObjectProxy)})}, args: ["aString", "aBlock", "anotherBlock"], source: "at: aString ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22return the evaluation of aBlock with the value if the property is defined\x0a\x09or return value of anotherBlock\x22\x0a\x09<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? aBlock(obj[aString]) : anotherBlock();\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.JSObjectProxy); smalltalk.addMethod( smalltalk.method({ selector: "at:put:", category: 'accessing', fn: function (aString,anObject){ var self=this; return smalltalk.withContext(function($ctx1) { self['@jsObject'][aString] = anObject; return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},smalltalk.JSObjectProxy)})}, args: ["aString", "anObject"], source: "at: aString put: anObject\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.JSObjectProxy); smalltalk.addMethod( smalltalk.method({ selector: "doesNotUnderstand:", category: 'proxy', fn: function (aMessage){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=_st(self)._lookupProperty_(_st(_st(aMessage)._selector())._asJavaScriptSelector()); if(($receiver = $2) == nil || $receiver == undefined){ $1=smalltalk.Object.fn.prototype._doesNotUnderstand_.apply(_st(self), [aMessage]); } else { var jsSelector; jsSelector=$receiver; $1=_st(self)._forwardMessage_withArguments_(jsSelector,_st(aMessage)._arguments()); }; return $1; }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},smalltalk.JSObjectProxy)})}, args: ["aMessage"], source: "doesNotUnderstand: aMessage\x0a\x09^ (self lookupProperty: aMessage selector asJavaScriptSelector)\x0a\x09\x09ifNil: [ super doesNotUnderstand: aMessage ]\x0a\x09\x09ifNotNil: [ :jsSelector | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09forwardMessage: jsSelector \x0a\x09\x09\x09\x09withArguments: aMessage arguments ]", messageSends: ["ifNil:ifNotNil:", "doesNotUnderstand:", "forwardMessage:withArguments:", "arguments", "lookupProperty:", "asJavaScriptSelector", "selector"], referencedClasses: [] }), smalltalk.JSObjectProxy); smalltalk.addMethod( smalltalk.method({ selector: "forwardMessage:withArguments:", category: 'proxy', fn: function (aString,anArray){ var self=this; return smalltalk.withContext(function($ctx1) { return smalltalk.send(self._jsObject(), aString, anArray); ; return self}, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:",{aString:aString,anArray:anArray},smalltalk.JSObjectProxy)})}, args: ["aString", "anArray"], source: "forwardMessage: aString withArguments: anArray\x0a\x09<\x0a\x09\x09return smalltalk.send(self._jsObject(), aString, anArray);\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.JSObjectProxy); smalltalk.addMethod( smalltalk.method({ selector: "inspectOn:", category: 'proxy', fn: function (anInspector){ var self=this; var variables; function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} return smalltalk.withContext(function($ctx1) { variables=_st($Dictionary())._new(); _st(variables)._at_put_("#self",_st(self)._jsObject()); _st(anInspector)._setLabel_(_st(self)._printString()); _st(self)._addObjectVariablesTo_(variables); _st(anInspector)._setVariables_(variables); return self}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},smalltalk.JSObjectProxy)})}, args: ["anInspector"], source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self jsObject.\x0a\x09anInspector setLabel: self printString.\x0a\x09self addObjectVariablesTo: variables.\x0a\x09anInspector setVariables: variables", messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:", "setVariables:"], referencedClasses: ["Dictionary"] }), smalltalk.JSObjectProxy); smalltalk.addMethod( smalltalk.method({ selector: "jsObject", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@jsObject"]; return $1; }, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxy)})}, args: [], source: "jsObject\x0a\x09^jsObject", messageSends: [], referencedClasses: [] }), smalltalk.JSObjectProxy); smalltalk.addMethod( smalltalk.method({ selector: "jsObject:", category: 'accessing', fn: function (aJSObject){ var self=this; return smalltalk.withContext(function($ctx1) { self["@jsObject"]=aJSObject; return self}, function($ctx1) {$ctx1.fill(self,"jsObject:",{aJSObject:aJSObject},smalltalk.JSObjectProxy)})}, args: ["aJSObject"], source: "jsObject: aJSObject\x0a\x09jsObject := aJSObject", messageSends: [], referencedClasses: [] }), smalltalk.JSObjectProxy); smalltalk.addMethod( smalltalk.method({ selector: "keysAndValuesDo:", category: 'enumerating', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var o = self['@jsObject']; for(var i in o) { aBlock(i, o[i]); } ; return self}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},smalltalk.JSObjectProxy)})}, args: ["aBlock"], source: "keysAndValuesDo: aBlock\x0a\x09<\x0a\x09\x09var o = self['@jsObject'];\x0a\x09\x09for(var i in o) {\x0a\x09\x09\x09aBlock(i, o[i]);\x0a\x09\x09}\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.JSObjectProxy); smalltalk.addMethod( smalltalk.method({ selector: "lookupProperty:", category: 'accessing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { return aString in self._jsObject() ? aString : nil; return self}, function($ctx1) {$ctx1.fill(self,"lookupProperty:",{aString:aString},smalltalk.JSObjectProxy)})}, args: ["aString"], source: "lookupProperty: aString\x0a\x09\x22Looks up a property in JS object.\x0a\x09Answer the property if it is present, or nil if it is not present.\x22\x0a\x09\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.JSObjectProxy); smalltalk.addMethod( smalltalk.method({ selector: "printOn:", category: 'printing', fn: function (aStream){ var self=this; return smalltalk.withContext(function($ctx1) { _st(aStream)._nextPutAll_(_st(_st(self)._jsObject())._toString()); return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.JSObjectProxy)})}, args: ["aStream"], source: "printOn: aStream\x0a\x09aStream nextPutAll: self jsObject toString", messageSends: ["nextPutAll:", "toString", "jsObject"], referencedClasses: [] }), smalltalk.JSObjectProxy); smalltalk.addMethod( smalltalk.method({ selector: "value", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._at_ifAbsent_("value",(function(){ return smalltalk.withContext(function($ctx2) { return smalltalk.Object.fn.prototype._value.apply(_st(self), []); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.JSObjectProxy)})}, args: [], source: "value\x0a\x09\x22if attribute 'value' exists on the JS object return it,\x0a\x09otherwise return the result of Object>>value.\x22\x0a\x09\x0a\x09^ self \x0a\x09\x09at: 'value' \x0a\x09\x09ifAbsent: [ super value ]", messageSends: ["at:ifAbsent:", "value"], referencedClasses: [] }), smalltalk.JSObjectProxy); smalltalk.addMethod( smalltalk.method({ selector: "on:", category: 'instance creation', fn: function (aJSObject){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$3,$1; $2=_st(self)._new(); _st($2)._jsObject_(aJSObject); $3=_st($2)._yourself(); $1=$3; return $1; }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject},smalltalk.JSObjectProxy.klass)})}, args: ["aJSObject"], source: "on: aJSObject\x0a\x09^self new\x0a\x09\x09jsObject: aJSObject;\x0a\x09\x09yourself", messageSends: ["jsObject:", "new", "yourself"], referencedClasses: [] }), smalltalk.JSObjectProxy.klass); smalltalk.addClass('Number', smalltalk.Object, [], 'Kernel-Objects'); smalltalk.Number.comment="Number holds the most general methods for dealing with numbers.\x0aNumber is directly mapped to JavaScript Number.\x0a\x0aMost arithmetic methods like `#+` `#/` `#-` `#max:` are directly inlined into javascript.\x0a\x0a##Enumerating\x0aA Number can be used to evaluate a Block a fixed number of times:\x0a\x0a\x095 timesRepeat: [Transcript show: 'This will be printed 5 times'; cr].\x0a\x09\x0a\x091 to: 5 do: [:aNumber| Transcript show: aNumber asString; cr].\x0a\x09\x0a\x091 to: 10 by: 2 do: [:aNumber| Transcript show: aNumber asString; cr]." smalltalk.addMethod( smalltalk.method({ selector: "&", category: 'converting', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { return self & aNumber; return self}, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},smalltalk.Number)})}, args: ["aNumber"], source: "& aNumber\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "*", category: 'arithmetic', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { return self * aNumber; return self}, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},smalltalk.Number)})}, args: ["aNumber"], source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "+", category: 'arithmetic', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { return self + aNumber; return self}, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},smalltalk.Number)})}, args: ["aNumber"], source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "-", category: 'arithmetic', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { return self - aNumber; return self}, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},smalltalk.Number)})}, args: ["aNumber"], source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "/", category: 'arithmetic', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { return self / aNumber; return self}, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},smalltalk.Number)})}, args: ["aNumber"], source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "<", category: 'comparing', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { return self < aNumber; return self}, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},smalltalk.Number)})}, args: ["aNumber"], source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "<=", category: 'comparing', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { return self <= aNumber; return self}, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},smalltalk.Number)})}, args: ["aNumber"], source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "=", category: 'comparing', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { if(! aNumber._isNumber || ! aNumber._isNumber()) { return false; } return Number(self) == aNumber ; return self}, function($ctx1) {$ctx1.fill(self,"=",{aNumber:aNumber},smalltalk.Number)})}, args: ["aNumber"], source: "= aNumber\x0a\x09<\x0a\x09\x09if(! aNumber._isNumber || ! aNumber._isNumber()) {\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09\x09return Number(self) == aNumber\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: ">", category: 'comparing', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { return self > aNumber; return self}, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},smalltalk.Number)})}, args: ["aNumber"], source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09> aNumber>", messageSends: [], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: ">=", category: 'comparing', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { return self >= aNumber; return self}, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},smalltalk.Number)})}, args: ["aNumber"], source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09>= aNumber>", messageSends: [], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "@", category: 'converting', fn: function (aNumber){ var self=this; function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st($Point())._x_y_(self,aNumber); return $1; }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},smalltalk.Number)})}, args: ["aNumber"], source: "@ aNumber\x0a\x09^Point x: self y: aNumber", messageSends: ["x:y:"], referencedClasses: ["Point"] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "IsImmutable", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return true; }, function($ctx1) {$ctx1.fill(self,"IsImmutable",{},smalltalk.Number)})}, args: [], source: "IsImmutable\x0a\x09^ true", messageSends: [], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "\x5c\x5c", category: 'arithmetic', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { return self % aNumber; return self}, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},smalltalk.Number)})}, args: ["aNumber"], source: "\x5c\x5c aNumber\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "abs", category: 'arithmetic', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return Math.abs(self);; return self}, function($ctx1) {$ctx1.fill(self,"abs",{},smalltalk.Number)})}, args: [], source: "abs\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "asJSON", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self; return $1; }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.Number)})}, args: [], source: "asJSON\x0a\x09^self", messageSends: [], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "asJavascript", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st("(").__comma(_st(self)._printString())).__comma(")"); return $1; }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Number)})}, args: [], source: "asJavascript\x0a\x09^'(', self printString, ')'", messageSends: [",", "printString"], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "asPoint", category: 'converting', fn: function (){ var self=this; function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st($Point())._x_y_(self,self); return $1; }, function($ctx1) {$ctx1.fill(self,"asPoint",{},smalltalk.Number)})}, args: [], source: "asPoint\x0a\x09^Point x: self y: self", messageSends: ["x:y:"], referencedClasses: ["Point"] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "asString", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return String(self) ; return self}, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Number)})}, args: [], source: "asString\x0a\x09< return String(self) >", messageSends: [], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "atRandom", category: 'converting', fn: function (){ var self=this; function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(_st(_st(_st($Random())._new())._next()).__star(self))._truncated()).__plus((1)); return $1; }, function($ctx1) {$ctx1.fill(self,"atRandom",{},smalltalk.Number)})}, args: [], source: "atRandom\x0a\x09^(Random new next * self) truncated + 1", messageSends: ["+", "truncated", "*", "next", "new"], referencedClasses: ["Random"] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "copy", category: 'copying', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self; return $1; }, function($ctx1) {$ctx1.fill(self,"copy",{},smalltalk.Number)})}, args: [], source: "copy\x0a\x09^self", messageSends: [], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "deepCopy", category: 'copying', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._copy(); return $1; }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.Number)})}, args: [], source: "deepCopy\x0a\x09^self copy", messageSends: ["copy"], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "even", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st((0)).__eq(_st(self).__backslash_backslash((2))); return $1; }, function($ctx1) {$ctx1.fill(self,"even",{},smalltalk.Number)})}, args: [], source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)", messageSends: ["=", "\x5c\x5c"], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "identityHash", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._asString()).__comma("n"); return $1; }, function($ctx1) {$ctx1.fill(self,"identityHash",{},smalltalk.Number)})}, args: [], source: "identityHash\x0a\x09^self asString, 'n'", messageSends: [",", "asString"], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "isNumber", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return true; }, function($ctx1) {$ctx1.fill(self,"isNumber",{},smalltalk.Number)})}, args: [], source: "isNumber\x0a\x09^true", messageSends: [], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "isZero", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self).__eq((0)); return $1; }, function($ctx1) {$ctx1.fill(self,"isZero",{},smalltalk.Number)})}, args: [], source: "isZero\x0a\x09^self = 0", messageSends: ["="], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "max:", category: 'arithmetic', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { return Math.max(self, aNumber);; return self}, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},smalltalk.Number)})}, args: ["aNumber"], source: "max: aNumber\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "min:", category: 'arithmetic', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { return Math.min(self, aNumber);; return self}, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},smalltalk.Number)})}, args: ["aNumber"], source: "min: aNumber\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "negated", category: 'arithmetic', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st((0)).__minus(self); return $1; }, function($ctx1) {$ctx1.fill(self,"negated",{},smalltalk.Number)})}, args: [], source: "negated\x0a\x09^0 - self", messageSends: ["-"], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "negative", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self).__lt((0)); return $1; }, function($ctx1) {$ctx1.fill(self,"negative",{},smalltalk.Number)})}, args: [], source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0", messageSends: ["<"], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "odd", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._even())._not(); return $1; }, function($ctx1) {$ctx1.fill(self,"odd",{},smalltalk.Number)})}, args: [], source: "odd\x0a\x09^ self even not", messageSends: ["not", "even"], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "positive", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self).__gt_eq((0)); return $1; }, function($ctx1) {$ctx1.fill(self,"positive",{},smalltalk.Number)})}, args: [], source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0", messageSends: [">="], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "printOn:", category: 'printing', fn: function (aStream){ var self=this; return smalltalk.withContext(function($ctx1) { _st(aStream)._nextPutAll_(_st(self)._asString()); return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Number)})}, args: ["aStream"], source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString", messageSends: ["nextPutAll:", "asString"], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "printShowingDecimalPlaces:", category: 'printing', fn: function (placesDesired){ var self=this; return smalltalk.withContext(function($ctx1) { return self.toFixed(placesDesired); return self}, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},smalltalk.Number)})}, args: ["placesDesired"], source: "printShowingDecimalPlaces: placesDesired\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "rounded", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return Math.round(self);; return self}, function($ctx1) {$ctx1.fill(self,"rounded",{},smalltalk.Number)})}, args: [], source: "rounded\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "sqrt", category: 'arithmetic', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return Math.sqrt(self); return self}, function($ctx1) {$ctx1.fill(self,"sqrt",{},smalltalk.Number)})}, args: [], source: "sqrt\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "squared", category: 'arithmetic', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self).__star(self); return $1; }, function($ctx1) {$ctx1.fill(self,"squared",{},smalltalk.Number)})}, args: [], source: "squared\x0a\x09^self * self", messageSends: ["*"], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "timesRepeat:", category: 'enumerating', fn: function (aBlock){ var self=this; var count; return smalltalk.withContext(function($ctx1) { count=(1); _st((function(){ return smalltalk.withContext(function($ctx2) { return _st(count).__gt(self); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){ return smalltalk.withContext(function($ctx2) { _st(aBlock)._value(); count=_st(count).__plus((1)); return count; }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},smalltalk.Number)})}, args: ["aBlock"], source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[count > self] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1]", messageSends: ["whileFalse:", "value", "+", ">"], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "to:", category: 'converting', fn: function (aNumber){ var self=this; var array,first,last,count; function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)} return smalltalk.withContext(function($ctx1) { var $1; first=_st(self)._truncated(); last=_st(_st(aNumber)._truncated()).__plus((1)); count=(1); array=_st($Array())._new(); _st(_st(last).__minus(first))._timesRepeat_((function(){ return smalltalk.withContext(function($ctx2) { _st(array)._at_put_(count,first); count=_st(count).__plus((1)); count; first=_st(first).__plus((1)); return first; }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); $1=array; return $1; }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},smalltalk.Number)})}, args: ["aNumber"], source: "to: aNumber\x0a\x09| array first last count |\x0a\x09first := self truncated.\x0a\x09last := aNumber truncated + 1.\x0a\x09count := 1.\x0a\x09array := Array new.\x0a\x09(last - first) timesRepeat: [\x0a\x09\x09array at: count put: first.\x0a\x09\x09count := count + 1.\x0a\x09\x09first := first + 1].\x0a\x09^array", messageSends: ["truncated", "+", "new", "timesRepeat:", "at:put:", "-"], referencedClasses: ["Array"] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "to:by:", category: 'converting', fn: function (stop,step){ var self=this; var array,value,pos; function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)} return smalltalk.withContext(function($ctx1) { var $1,$2,$3; value=self; array=_st($Array())._new(); pos=(1); $1=_st(step).__eq((0)); if(smalltalk.assert($1)){ _st(self)._error_("step must be non-zero"); }; $2=_st(step).__lt((0)); if(smalltalk.assert($2)){ _st((function(){ return smalltalk.withContext(function($ctx2) { return _st(value).__gt_eq(stop); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){ return smalltalk.withContext(function($ctx2) { _st(array)._at_put_(pos,value); pos=_st(pos).__plus((1)); pos; value=_st(value).__plus(step); return value; }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); } else { _st((function(){ return smalltalk.withContext(function($ctx2) { return _st(value).__lt_eq(stop); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){ return smalltalk.withContext(function($ctx2) { _st(array)._at_put_(pos,value); pos=_st(pos).__plus((1)); pos; value=_st(value).__plus(step); return value; }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); }; $3=array; return $3; }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},smalltalk.Number)})}, args: ["stop", "step"], source: "to: stop by: step\x0a\x09| array value pos |\x0a\x09value := self.\x0a\x09array := Array new.\x0a\x09pos := 1.\x0a\x09step = 0 ifTrue: [self error: 'step must be non-zero'].\x0a\x09step < 0\x0a\x09\x09ifTrue: [[ value >= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09array at: pos put: value.\x0a\x09\x09\x09\x09\x09pos := pos + 1.\x0a\x09\x09\x09\x09\x09value := value + step]]\x0a\x09\x09ifFalse: [[ value <= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09array at: pos put: value.\x0a\x09\x09\x09\x09pos := pos + 1.\x0a\x09\x09\x09\x09\x09value := value + step]].\x0a\x09^array", messageSends: ["new", "ifTrue:", "error:", "=", "ifTrue:ifFalse:", "whileTrue:", "at:put:", "+", ">=", "<=", "<"], referencedClasses: ["Array"] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "to:by:do:", category: 'enumerating', fn: function (stop,step,aBlock){ var self=this; var value; return smalltalk.withContext(function($ctx1) { var $1,$2; value=self; $1=_st(step).__eq((0)); if(smalltalk.assert($1)){ _st(self)._error_("step must be non-zero"); }; $2=_st(step).__lt((0)); if(smalltalk.assert($2)){ _st((function(){ return smalltalk.withContext(function($ctx2) { return _st(value).__gt_eq(stop); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){ return smalltalk.withContext(function($ctx2) { _st(aBlock)._value_(value); value=_st(value).__plus(step); return value; }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); } else { _st((function(){ return smalltalk.withContext(function($ctx2) { return _st(value).__lt_eq(stop); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){ return smalltalk.withContext(function($ctx2) { _st(aBlock)._value_(value); value=_st(value).__plus(step); return value; }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); }; return self}, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},smalltalk.Number)})}, args: ["stop", "step", "aBlock"], source: "to: stop by: step do: aBlock\x0a\x09| value |\x0a\x09value := self.\x0a\x09step = 0 ifTrue: [self error: 'step must be non-zero'].\x0a\x09step < 0\x0a\x09\x09ifTrue: [[ value >= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09aBlock value: value.\x0a\x09\x09\x09\x09\x09value := value + step]]\x0a\x09\x09ifFalse: [[ value <= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09aBlock value: value.\x0a\x09\x09\x09\x09\x09value := value + step]]", messageSends: ["ifTrue:", "error:", "=", "ifTrue:ifFalse:", "whileTrue:", "value:", "+", ">=", "<=", "<"], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "to:do:", category: 'enumerating', fn: function (stop,aBlock){ var self=this; var nextValue; return smalltalk.withContext(function($ctx1) { nextValue=self; _st((function(){ return smalltalk.withContext(function($ctx2) { return _st(nextValue).__lt_eq(stop); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){ return smalltalk.withContext(function($ctx2) { _st(aBlock)._value_(nextValue); nextValue=_st(nextValue).__plus((1)); return nextValue; }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},smalltalk.Number)})}, args: ["stop", "aBlock"], source: "to: stop do: aBlock\x0a\x09\x22Evaluate aBlock for each number from self to aNumber.\x22\x0a\x09| nextValue |\x0a\x09nextValue := self.\x0a\x09[nextValue <= stop]\x0a\x09\x09whileTrue:\x0a\x09\x09\x09[aBlock value: nextValue.\x0a\x09\x09\x09nextValue := nextValue + 1]", messageSends: ["whileTrue:", "value:", "+", "<="], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "truncated", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { if(self >= 0) { return Math.floor(self); } else { return Math.floor(self * (-1)) * (-1); }; ; return self}, function($ctx1) {$ctx1.fill(self,"truncated",{},smalltalk.Number)})}, args: [], source: "truncated\x0a\x09<\x0a\x09\x09if(self >>= 0) {\x0a\x09\x09\x09return Math.floor(self);\x0a\x09\x09} else {\x0a\x09\x09\x09return Math.floor(self * (-1)) * (-1);\x0a\x09\x09};\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "|", category: 'converting', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { return self | aNumber; return self}, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},smalltalk.Number)})}, args: ["aNumber"], source: "| aNumber\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Number); smalltalk.addMethod( smalltalk.method({ selector: "pi", category: 'instance creation', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return Math.PI; return self}, function($ctx1) {$ctx1.fill(self,"pi",{},smalltalk.Number.klass)})}, args: [], source: "pi\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Number.klass); smalltalk.addClass('Organizer', smalltalk.Object, [], 'Kernel-Objects'); smalltalk.addMethod( smalltalk.method({ selector: "addElement:", category: 'accessing', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { self.elements.addElement(anObject); return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},smalltalk.Organizer)})}, args: ["anObject"], source: "addElement: anObject\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Organizer); smalltalk.addMethod( smalltalk.method({ selector: "elements", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._basicAt_("elements"))._copy(); return $1; }, function($ctx1) {$ctx1.fill(self,"elements",{},smalltalk.Organizer)})}, args: [], source: "elements\x0a\x09^ (self basicAt: 'elements') copy", messageSends: ["copy", "basicAt:"], referencedClasses: [] }), smalltalk.Organizer); smalltalk.addMethod( smalltalk.method({ selector: "removeElement:", category: 'accessing', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { self.elements.removeElement(anObject); return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},smalltalk.Organizer)})}, args: ["anObject"], source: "removeElement: anObject\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Organizer); smalltalk.addClass('ClassOrganizer', smalltalk.Organizer, [], 'Kernel-Objects'); smalltalk.addMethod( smalltalk.method({ selector: "addElement:", category: 'accessing', fn: function (aString){ var self=this; function $ProtocolAdded(){return smalltalk.ProtocolAdded||(typeof ProtocolAdded=="undefined"?nil:ProtocolAdded)} function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} return smalltalk.withContext(function($ctx1) { var $1,$2; smalltalk.Organizer.fn.prototype._addElement_.apply(_st(self), [aString]); $1=_st($ProtocolAdded())._new(); _st($1)._protocol_(aString); _st($1)._theClass_(_st(self)._theClass()); $2=_st($1)._yourself(); _st(_st($SystemAnnouncer())._current())._announce_($2); return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},smalltalk.ClassOrganizer)})}, args: ["aString"], source: "addElement: aString\x0a\x09super addElement: aString.\x0a\x0a\x09SystemAnnouncer current announce: (ProtocolAdded new\x0a\x09\x09protocol: aString;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09yourself)", messageSends: ["addElement:", "announce:", "protocol:", "new", "theClass:", "theClass", "yourself", "current"], referencedClasses: ["ProtocolAdded", "SystemAnnouncer"] }), smalltalk.ClassOrganizer); smalltalk.addMethod( smalltalk.method({ selector: "removeElement:", category: 'accessing', fn: function (aString){ var self=this; function $ProtocolRemoved(){return smalltalk.ProtocolRemoved||(typeof ProtocolRemoved=="undefined"?nil:ProtocolRemoved)} function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} return smalltalk.withContext(function($ctx1) { var $1,$2; smalltalk.Organizer.fn.prototype._removeElement_.apply(_st(self), [aString]); $1=_st($ProtocolRemoved())._new(); _st($1)._protocol_(aString); _st($1)._theClass_(_st(self)._theClass()); $2=_st($1)._yourself(); _st(_st($SystemAnnouncer())._current())._announce_($2); return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},smalltalk.ClassOrganizer)})}, args: ["aString"], source: "removeElement: aString\x0a\x09super removeElement: aString.\x0a\x0a\x09SystemAnnouncer current announce: (ProtocolRemoved new\x0a\x09\x09protocol: aString;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09yourself)", messageSends: ["removeElement:", "announce:", "protocol:", "new", "theClass:", "theClass", "yourself", "current"], referencedClasses: ["ProtocolRemoved", "SystemAnnouncer"] }), smalltalk.ClassOrganizer); smalltalk.addMethod( smalltalk.method({ selector: "theClass", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.theClass ; return self}, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ClassOrganizer)})}, args: [], source: "theClass\x0a\x09< return self.theClass >", messageSends: [], referencedClasses: [] }), smalltalk.ClassOrganizer); smalltalk.addClass('PackageOrganizer', smalltalk.Organizer, [], 'Kernel-Objects'); smalltalk.addClass('Package', smalltalk.Object, ['commitPathJs', 'commitPathSt'], 'Kernel-Objects'); smalltalk.Package.comment="A Package is similar to a \x22class category\x22 typically found in other Smalltalks like Pharo or Squeak. Amber does not have class categories anymore, it had in the beginning but now each class in the system knows which package it belongs to.\x0a\x0aA Package has a name, an Array of \x22requires\x22, a comment and a Dictionary with other optional key value attributes. A Package can also be queried for its classes, but it will then resort to a reverse scan of all classes to find them.\x0aPackages are manipulated through \x22Smalltalk current\x22, like for example finding one based on a name:\x0a\x0a\x09Smalltalk current packageAt: 'Kernel'\x0a\x0a...but you can also use:\x0a\x0a\x09Package named: 'Kernel'\x0a\x0aA Package differs slightly from a Monticello package which can span multiple class categories using a naming convention based on hyphenation. But just as in Monticello a Package supports \x22class extensions\x22 so a Package\x0acan define behaviors in foreign classes using a naming convention for method categories where the category starts with an asterisk and then the name of the owning package follows. This can easily be seen in for example class\x0aString where the method category \x22*IDE\x22 defines #inspectOn: which thus is a method belonging to the IDE package.\x0a\x0aYou can fetch a package from the server:\x0a\x0a\x09Package fetch: 'Additional-Examples'" smalltalk.addMethod( smalltalk.method({ selector: "classes", category: 'classes', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._organization())._elements(); return $1; }, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Package)})}, args: [], source: "classes\x0a\x09^ self organization elements", messageSends: ["elements", "organization"], referencedClasses: [] }), smalltalk.Package); smalltalk.addMethod( smalltalk.method({ selector: "commitPathJs", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=self["@commitPathJs"]; if(($receiver = $2) == nil || $receiver == undefined){ $1=_st(_st(self)._class())._defaultCommitPathJs(); } else { $1=$2; }; return $1; }, function($ctx1) {$ctx1.fill(self,"commitPathJs",{},smalltalk.Package)})}, args: [], source: "commitPathJs\x0a\x09^ commitPathJs ifNil: [self class defaultCommitPathJs]", messageSends: ["ifNil:", "defaultCommitPathJs", "class"], referencedClasses: [] }), smalltalk.Package); smalltalk.addMethod( smalltalk.method({ selector: "commitPathJs:", category: 'accessing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { self["@commitPathJs"]=aString; return self}, function($ctx1) {$ctx1.fill(self,"commitPathJs:",{aString:aString},smalltalk.Package)})}, args: ["aString"], source: "commitPathJs: aString\x0a\x09commitPathJs := aString", messageSends: [], referencedClasses: [] }), smalltalk.Package); smalltalk.addMethod( smalltalk.method({ selector: "commitPathSt", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=self["@commitPathSt"]; if(($receiver = $2) == nil || $receiver == undefined){ $1=_st(_st(self)._class())._defaultCommitPathSt(); } else { $1=$2; }; return $1; }, function($ctx1) {$ctx1.fill(self,"commitPathSt",{},smalltalk.Package)})}, args: [], source: "commitPathSt\x0a\x09^ commitPathSt ifNil: [self class defaultCommitPathSt]", messageSends: ["ifNil:", "defaultCommitPathSt", "class"], referencedClasses: [] }), smalltalk.Package); smalltalk.addMethod( smalltalk.method({ selector: "commitPathSt:", category: 'accessing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { self["@commitPathSt"]=aString; return self}, function($ctx1) {$ctx1.fill(self,"commitPathSt:",{aString:aString},smalltalk.Package)})}, args: ["aString"], source: "commitPathSt: aString\x0a\x09commitPathSt := aString", messageSends: [], referencedClasses: [] }), smalltalk.Package); smalltalk.addMethod( smalltalk.method({ selector: "isPackage", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return true; }, function($ctx1) {$ctx1.fill(self,"isPackage",{},smalltalk.Package)})}, args: [], source: "isPackage\x0a\x09^ true", messageSends: [], referencedClasses: [] }), smalltalk.Package); smalltalk.addMethod( smalltalk.method({ selector: "name", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.pkgName; return self}, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.Package)})}, args: [], source: "name\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Package); smalltalk.addMethod( smalltalk.method({ selector: "name:", category: 'accessing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { self.pkgName = aString; return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},smalltalk.Package)})}, args: ["aString"], source: "name: aString\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Package); smalltalk.addMethod( smalltalk.method({ selector: "organization", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._basicAt_("organization"); return $1; }, function($ctx1) {$ctx1.fill(self,"organization",{},smalltalk.Package)})}, args: [], source: "organization\x0a\x09^ self basicAt: 'organization'", messageSends: ["basicAt:"], referencedClasses: [] }), smalltalk.Package); smalltalk.addMethod( smalltalk.method({ selector: "printOn:", category: 'printing', fn: function (aStream){ var self=this; return smalltalk.withContext(function($ctx1) { var $1,$2; smalltalk.Object.fn.prototype._printOn_.apply(_st(self), [aStream]); $1=aStream; _st($1)._nextPutAll_(" ("); _st($1)._nextPutAll_(_st(self)._name()); $2=_st($1)._nextPutAll_(")"); return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Package)})}, args: ["aStream"], source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'", messageSends: ["printOn:", "nextPutAll:", "name"], referencedClasses: [] }), smalltalk.Package); smalltalk.addMethod( smalltalk.method({ selector: "setupClasses", category: 'classes', fn: function (){ var self=this; function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)} return smalltalk.withContext(function($ctx1) { var $1,$2; $1=_st(self)._classes(); _st($1)._do_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(_st($ClassBuilder())._new())._setupClass_(each); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); $2=_st($1)._do_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(each)._initialize(); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"setupClasses",{},smalltalk.Package)})}, args: [], source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]", messageSends: ["do:", "setupClass:", "new", "classes", "initialize"], referencedClasses: ["ClassBuilder"] }), smalltalk.Package); smalltalk.addMethod( smalltalk.method({ selector: "sortedClasses", category: 'classes', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._class())._sortedClasses_(_st(self)._classes()); return $1; }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},smalltalk.Package)})}, args: [], source: "sortedClasses\x0a\x09\x22Answer all classes in the receiver, sorted by superclass/subclasses and by class name for common subclasses (Issue #143).\x22\x0a\x0a\x09^self class sortedClasses: self classes", messageSends: ["sortedClasses:", "classes", "class"], referencedClasses: [] }), smalltalk.Package); smalltalk.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt']; smalltalk.addMethod( smalltalk.method({ selector: "commitPathsFromLoader", category: 'commit paths', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var commitPath = typeof amber !== 'undefined' && amber.commitPath; if (!commitPath) return; if (commitPath.js) self._defaultCommitPathJs_(commitPath.js); if (commitPath.st) self._defaultCommitPathSt_(commitPath.st); ; return self}, function($ctx1) {$ctx1.fill(self,"commitPathsFromLoader",{},smalltalk.Package.klass)})}, args: [], source: "commitPathsFromLoader\x0a\x09<\x0a\x09\x09var commitPath = typeof amber !== 'undefined' && amber.commitPath;\x0a\x09\x09if (!commitPath) return;\x0a\x09\x09if (commitPath.js) self._defaultCommitPathJs_(commitPath.js);\x0a\x09\x09if (commitPath.st) self._defaultCommitPathSt_(commitPath.st);\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.Package.klass); smalltalk.addMethod( smalltalk.method({ selector: "defaultCommitPathJs", category: 'commit paths', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=self["@defaultCommitPathJs"]; if(($receiver = $2) == nil || $receiver == undefined){ self["@defaultCommitPathJs"]="js"; $1=self["@defaultCommitPathJs"]; } else { $1=$2; }; return $1; }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs",{},smalltalk.Package.klass)})}, args: [], source: "defaultCommitPathJs\x0a\x09^ defaultCommitPathJs ifNil: [ defaultCommitPathJs := 'js']", messageSends: ["ifNil:"], referencedClasses: [] }), smalltalk.Package.klass); smalltalk.addMethod( smalltalk.method({ selector: "defaultCommitPathJs:", category: 'commit paths', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { self["@defaultCommitPathJs"]=aString; return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs:",{aString:aString},smalltalk.Package.klass)})}, args: ["aString"], source: "defaultCommitPathJs: aString\x0a\x09defaultCommitPathJs := aString", messageSends: [], referencedClasses: [] }), smalltalk.Package.klass); smalltalk.addMethod( smalltalk.method({ selector: "defaultCommitPathSt", category: 'commit paths', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=self["@defaultCommitPathSt"]; if(($receiver = $2) == nil || $receiver == undefined){ self["@defaultCommitPathSt"]="st"; $1=self["@defaultCommitPathSt"]; } else { $1=$2; }; return $1; }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt",{},smalltalk.Package.klass)})}, args: [], source: "defaultCommitPathSt\x0a\x09^ defaultCommitPathSt ifNil: [ defaultCommitPathSt := 'st']", messageSends: ["ifNil:"], referencedClasses: [] }), smalltalk.Package.klass); smalltalk.addMethod( smalltalk.method({ selector: "defaultCommitPathSt:", category: 'commit paths', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { self["@defaultCommitPathSt"]=aString; return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt:",{aString:aString},smalltalk.Package.klass)})}, args: ["aString"], source: "defaultCommitPathSt: aString\x0a\x09defaultCommitPathSt := aString", messageSends: [], referencedClasses: [] }), smalltalk.Package.klass); smalltalk.addMethod( smalltalk.method({ selector: "initialize", category: 'initialization', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { smalltalk.Object.klass.fn.prototype._initialize.apply(_st(self), []); _st(self)._commitPathsFromLoader(); return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Package.klass)})}, args: [], source: "initialize\x0a\x09super initialize.\x0a\x09self commitPathsFromLoader", messageSends: ["initialize", "commitPathsFromLoader"], referencedClasses: [] }), smalltalk.Package.klass); smalltalk.addMethod( smalltalk.method({ selector: "load:", category: 'loading-storing', fn: function (aPackageName){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._load_prefix_(aPackageName,_st(_st(self)._defaultCommitPathJs()).__comma("/")); return self}, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},smalltalk.Package.klass)})}, args: ["aPackageName"], source: "load: aPackageName\x0a\x09self load: aPackageName prefix: self defaultCommitPathJs, '/'", messageSends: ["load:prefix:", ",", "defaultCommitPathJs"], referencedClasses: [] }), smalltalk.Package.klass); smalltalk.addMethod( smalltalk.method({ selector: "load:prefix:", category: 'loading-storing', fn: function (aPackageName,aPrefix){ var self=this; function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)} return smalltalk.withContext(function($ctx1) { _st(jQuery)._getScript_onSuccess_(_st(_st(aPrefix).__comma(aPackageName)).__comma(".js"),(function(){ return smalltalk.withContext(function($ctx2) { return _st(_st($Package())._named_(aPackageName))._setupClasses(); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"load:prefix:",{aPackageName:aPackageName,aPrefix:aPrefix},smalltalk.Package.klass)})}, args: ["aPackageName", "aPrefix"], source: "load: aPackageName prefix: aPrefix\x0a\x09jQuery\x0a\x09\x09getScript: (aPrefix , aPackageName , '.js')\x0a\x09\x09onSuccess: [\x0a\x09\x09\x09(Package named: aPackageName) setupClasses ]", messageSends: ["getScript:onSuccess:", ",", "setupClasses", "named:"], referencedClasses: ["Package"] }), smalltalk.Package.klass); smalltalk.addMethod( smalltalk.method({ selector: "named:", category: 'accessing', fn: function (aPackageName){ var self=this; function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st($Smalltalk())._current())._packageAt_(aPackageName); return $1; }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},smalltalk.Package.klass)})}, args: ["aPackageName"], source: "named: aPackageName\x0a\x0a\x09^Smalltalk current packageAt: aPackageName", messageSends: ["packageAt:", "current"], referencedClasses: ["Smalltalk"] }), smalltalk.Package.klass); smalltalk.addMethod( smalltalk.method({ selector: "named:ifAbsent:", category: 'accessing', fn: function (aPackageName,aBlock){ var self=this; function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st($Smalltalk())._current())._packageAt_ifAbsent_(aPackageName,aBlock); return $1; }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},smalltalk.Package.klass)})}, args: ["aPackageName", "aBlock"], source: "named: aPackageName ifAbsent: aBlock\x0a\x0a\x09^Smalltalk current packageAt: aPackageName ifAbsent: aBlock", messageSends: ["packageAt:ifAbsent:", "current"], referencedClasses: ["Smalltalk"] }), smalltalk.Package.klass); smalltalk.addMethod( smalltalk.method({ selector: "resetCommitPaths", category: 'commit paths', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { self["@defaultCommitPathJs"]=nil; self["@defaultCommitPathSt"]=nil; return self}, function($ctx1) {$ctx1.fill(self,"resetCommitPaths",{},smalltalk.Package.klass)})}, args: [], source: "resetCommitPaths\x0a\x09\x09defaultCommitPathJs := nil.\x0a\x09\x09defaultCommitPathSt := nil.", messageSends: [], referencedClasses: [] }), smalltalk.Package.klass); smalltalk.addMethod( smalltalk.method({ selector: "sortedClasses:", category: 'sorting', fn: function (classes){ var self=this; var children,others,nodes,expandedClasses; function $ClassSorterNode(){return smalltalk.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)} function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)} return smalltalk.withContext(function($ctx1) { var $1,$2; children=[]; others=[]; _st(classes)._do_((function(each){ return smalltalk.withContext(function($ctx2) { $1=_st(classes)._includes_(_st(each)._superclass()); if(smalltalk.assert($1)){ return _st(others)._add_(each); } else { return _st(children)._add_(each); }; }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); nodes=_st(children)._collect_((function(each){ return smalltalk.withContext(function($ctx2) { return _st($ClassSorterNode())._on_classes_level_(each,others,(0)); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); nodes=_st(nodes)._sorted_((function(a,b){ return smalltalk.withContext(function($ctx2) { return _st(_st(_st(a)._theClass())._name()).__lt_eq(_st(_st(b)._theClass())._name()); }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})); expandedClasses=_st($Array())._new(); _st(nodes)._do_((function(aNode){ return smalltalk.withContext(function($ctx2) { return _st(aNode)._traverseClassesWith_(expandedClasses); }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1)})})); $2=expandedClasses; return $2; }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},smalltalk.Package.klass)})}, args: ["classes"], source: "sortedClasses: classes\x0a\x09\x22Answer classes, sorted by superclass/subclasses and by class name for common subclasses (Issue #143)\x22\x0a\x0a\x09| children others nodes expandedClasses |\x0a\x09children := #().\x0a\x09others := #().\x0a\x09classes do: [:each |\x0a\x09\x09(classes includes: each superclass)\x0a\x09\x09\x09ifFalse: [children add: each]\x0a\x09\x09\x09ifTrue: [others add: each]].\x0a\x09nodes := children collect: [:each |\x0a\x09\x09ClassSorterNode on: each classes: others level: 0].\x0a\x09nodes := nodes sorted: [:a :b | a theClass name <= b theClass name ].\x0a\x09expandedClasses := Array new.\x0a\x09nodes do: [:aNode |\x0a\x09\x09aNode traverseClassesWith: expandedClasses].\x0a\x09^expandedClasses", messageSends: ["do:", "ifFalse:ifTrue:", "add:", "includes:", "superclass", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"], referencedClasses: ["ClassSorterNode", "Array"] }), smalltalk.Package.klass); smalltalk.addClass('Point', smalltalk.Object, ['x', 'y'], 'Kernel-Objects'); smalltalk.Point.comment="A `Point` represents an x-y pair of numbers usually designating a geometric coordinate.\x0aPoints are traditionally created using the binary `#@` message to a number:\x0a\x0a\x09100@120\x0a\x0aPoints can then be arithmetically manipulated:\x0a\x0a\x09100@100 + (10@10)\x0a\x0a...or for example:\x0a\x0a\x09(100@100) * 2\x0a\x0a**NOTE:** Creating a Point with a negative y-value will need a space after `@` in order to avoid a parsing error:\x0a\x0a\x09100@ -100 \x22but 100@-100 would not parse\x22\x0a\x0aAmber does not have much behavior in this class out-of-the-box." smalltalk.addMethod( smalltalk.method({ selector: "*", category: 'arithmetic', fn: function (aPoint){ var self=this; function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st($Point())._x_y_(_st(_st(self)._x()).__star(_st(_st(aPoint)._asPoint())._x()),_st(_st(self)._y()).__star(_st(_st(aPoint)._asPoint())._y())); return $1; }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},smalltalk.Point)})}, args: ["aPoint"], source: "* aPoint\x0a\x09^Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y", messageSends: ["x:y:", "*", "x", "asPoint", "y"], referencedClasses: ["Point"] }), smalltalk.Point); smalltalk.addMethod( smalltalk.method({ selector: "+", category: 'arithmetic', fn: function (aPoint){ var self=this; function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st($Point())._x_y_(_st(_st(self)._x()).__plus(_st(_st(aPoint)._asPoint())._x()),_st(_st(self)._y()).__plus(_st(_st(aPoint)._asPoint())._y())); return $1; }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},smalltalk.Point)})}, args: ["aPoint"], source: "+ aPoint\x0a\x09^Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y", messageSends: ["x:y:", "+", "x", "asPoint", "y"], referencedClasses: ["Point"] }), smalltalk.Point); smalltalk.addMethod( smalltalk.method({ selector: "-", category: 'arithmetic', fn: function (aPoint){ var self=this; function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st($Point())._x_y_(_st(_st(self)._x()).__minus(_st(_st(aPoint)._asPoint())._x()),_st(_st(self)._y()).__minus(_st(_st(aPoint)._asPoint())._y())); return $1; }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},smalltalk.Point)})}, args: ["aPoint"], source: "- aPoint\x0a\x09^Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y", messageSends: ["x:y:", "-", "x", "asPoint", "y"], referencedClasses: ["Point"] }), smalltalk.Point); smalltalk.addMethod( smalltalk.method({ selector: "/", category: 'arithmetic', fn: function (aPoint){ var self=this; function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st($Point())._x_y_(_st(_st(self)._x()).__slash(_st(_st(aPoint)._asPoint())._x()),_st(_st(self)._y()).__slash(_st(_st(aPoint)._asPoint())._y())); return $1; }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},smalltalk.Point)})}, args: ["aPoint"], source: "/ aPoint\x0a\x09^Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y", messageSends: ["x:y:", "/", "x", "asPoint", "y"], referencedClasses: ["Point"] }), smalltalk.Point); smalltalk.addMethod( smalltalk.method({ selector: "=", category: 'arithmetic', fn: function (aPoint){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(_st(aPoint)._class()).__eq(_st(self)._class()))._and_((function(){ return smalltalk.withContext(function($ctx2) { return _st(_st(_st(aPoint)._x()).__eq(_st(self)._x())).__and(_st(_st(aPoint)._y()).__eq(_st(self)._y())); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},smalltalk.Point)})}, args: ["aPoint"], source: "= aPoint\x0a\x09^aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y)]", messageSends: ["and:", "&", "=", "y", "x", "class"], referencedClasses: [] }), smalltalk.Point); smalltalk.addMethod( smalltalk.method({ selector: "asPoint", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self; return $1; }, function($ctx1) {$ctx1.fill(self,"asPoint",{},smalltalk.Point)})}, args: [], source: "asPoint\x0a\x09^self", messageSends: [], referencedClasses: [] }), smalltalk.Point); smalltalk.addMethod( smalltalk.method({ selector: "printOn:", category: 'printing', fn: function (aStream){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; _st(self["@x"])._printOn_(aStream); _st(aStream)._nextPutAll_("@"); $1=_st(_st(self["@y"])._notNil())._and_((function(){ return smalltalk.withContext(function($ctx2) { return _st(self["@y"])._negative(); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); if(smalltalk.assert($1)){ _st(aStream)._space(); }; _st(self["@y"])._printOn_(aStream); return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Point)})}, args: ["aStream"], source: "printOn: aStream\x0a\x09\x22Print receiver in classic x@y notation.\x22\x0a\x0a\x09x printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: '@'.\x0a\x09(y notNil and: [y negative]) ifTrue: [\x0a\x09\x09\x09\x22Avoid ambiguous @- construct\x22\x0a\x09\x09\x09aStream space ].\x0a\x09\x0a\x09y printOn: aStream", messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "space", "and:", "negative", "notNil"], referencedClasses: [] }), smalltalk.Point); smalltalk.addMethod( smalltalk.method({ selector: "translateBy:", category: 'transforming', fn: function (delta){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(_st(delta)._x()).__plus(self["@x"])).__at(_st(_st(delta)._y()).__plus(self["@y"])); return $1; }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},smalltalk.Point)})}, args: ["delta"], source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^(delta x + x) @ (delta y + y)", messageSends: ["@", "+", "y", "x"], referencedClasses: [] }), smalltalk.Point); smalltalk.addMethod( smalltalk.method({ selector: "x", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@x"]; return $1; }, function($ctx1) {$ctx1.fill(self,"x",{},smalltalk.Point)})}, args: [], source: "x\x0a\x09^x", messageSends: [], referencedClasses: [] }), smalltalk.Point); smalltalk.addMethod( smalltalk.method({ selector: "x:", category: 'accessing', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { self["@x"]=aNumber; return self}, function($ctx1) {$ctx1.fill(self,"x:",{aNumber:aNumber},smalltalk.Point)})}, args: ["aNumber"], source: "x: aNumber\x0a\x09x := aNumber", messageSends: [], referencedClasses: [] }), smalltalk.Point); smalltalk.addMethod( smalltalk.method({ selector: "y", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@y"]; return $1; }, function($ctx1) {$ctx1.fill(self,"y",{},smalltalk.Point)})}, args: [], source: "y\x0a\x09^y", messageSends: [], referencedClasses: [] }), smalltalk.Point); smalltalk.addMethod( smalltalk.method({ selector: "y:", category: 'accessing', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { self["@y"]=aNumber; return self}, function($ctx1) {$ctx1.fill(self,"y:",{aNumber:aNumber},smalltalk.Point)})}, args: ["aNumber"], source: "y: aNumber\x0a\x09y := aNumber", messageSends: [], referencedClasses: [] }), smalltalk.Point); smalltalk.addMethod( smalltalk.method({ selector: "x:y:", category: 'instance creation', fn: function (aNumber,anotherNumber){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$3,$1; $2=_st(self)._new(); _st($2)._x_(aNumber); _st($2)._y_(anotherNumber); $3=_st($2)._yourself(); $1=$3; return $1; }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},smalltalk.Point.klass)})}, args: ["aNumber", "anotherNumber"], source: "x: aNumber y: anotherNumber\x0a\x09^self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself", messageSends: ["x:", "new", "y:", "yourself"], referencedClasses: [] }), smalltalk.Point.klass); smalltalk.addClass('Random', smalltalk.Object, [], 'Kernel-Objects'); smalltalk.Random.comment="`Random` is a random number generator and is implemented as a trivial wrapper around javascript `Math.random()` and is used like this:\x0a\x0a\x09Random new next\x0a\x0aThis will return a float x where x < 1 and x > 0. If you want a random integer from 1 to 10 you can use `#atRandom`\x0a\x0a\x0910 atRandom\x0a\x0a...and if you want a random number in a specific interval this also works:\x0a\x0a\x09(3 to: 7) atRandom\x0a\x0a...but be aware that `#to:` does not create an Interval as in other Smalltalk implementations but in fact an `Array` of numbers, so it's better to use:\x0a\x0a\x095 atRandom + 2\x0a\x0aSince `#atRandom` is implemented in `SequencableCollection` you can easy pick an element at random:\x0a\x0a\x09#('a' 'b' 'c') atRandom\x0a\x0a...or perhaps a letter from a `String`:\x0a\x0a\x09'abc' atRandom\x0a\x0aSince Amber does not have Characters this will return a `String` of length 1 like for example `'b'`." smalltalk.addMethod( smalltalk.method({ selector: "next", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return Math.random(); return self}, function($ctx1) {$ctx1.fill(self,"next",{},smalltalk.Random)})}, args: [], source: "next\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Random); smalltalk.addMethod( smalltalk.method({ selector: "next:", category: 'accessing', fn: function (anInteger){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st((1))._to_(anInteger))._collect_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(self)._next(); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},smalltalk.Random)})}, args: ["anInteger"], source: "next: anInteger\x0a\x09^(1 to: anInteger) collect: [:each | self next]", messageSends: ["collect:", "next", "to:"], referencedClasses: [] }), smalltalk.Random); smalltalk.addClass('Smalltalk', smalltalk.Object, [], 'Kernel-Objects'); smalltalk.Smalltalk.comment="Smalltalk has only one instance, accessed with `Smalltalk current`.\x0aIt represents the global JavaScript variable `smalltalk` declared in `js/boot.js`.\x0a\x0aThe `smalltalk` object holds all class and packages defined in the system.\x0a\x0a## Classes\x0a\x0aClasses can be accessed using the following methods:\x0a\x0a- `#classes` answers the full list of Smalltalk classes in the system\x0a- `#at:` answers a specific class of `nil`\x0a\x0a## Packages\x0a\x0aPackages can be accessed using the following methods:\x0a\x0a- `#packages` answers the full list of packages\x0a- `#packageAt:` answers a specific class of `nil`\x0a\x0a__note:__ classes and packages are accessed using strings, not symbols\x0a\x0a## Parsing\x0a\x0aThe `#parse:` method is used to parse Smalltalk source code.\x0aIt requires the `Compiler` package and the `js/parser.js` parser file in order to work" smalltalk.addMethod( smalltalk.method({ selector: "asSmalltalkException:", category: 'error handling', fn: function (anObject){ var self=this; function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)} function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)} return smalltalk.withContext(function($ctx1) { var $2,$1; $2=_st(_st(self)._isSmalltalkObject_(anObject))._and_((function(){ return smalltalk.withContext(function($ctx2) { return _st(anObject)._isKindOf_($Error()); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); if(smalltalk.assert($2)){ $1=anObject; } else { $1=_st($JavaScriptException())._on_(anObject); }; return $1; }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},smalltalk.Smalltalk)})}, args: ["anObject"], source: "asSmalltalkException: anObject\x0a\x09\x22A JavaScript exception may be thrown.\x0a\x09We then need to convert it back to a Smalltalk object\x22\x0a\x09\x0a\x09^ ((self isSmalltalkObject: anObject) and: [ anObject isKindOf: Error ])\x0a\x09\x09ifTrue: [ anObject ]\x0a\x09\x09ifFalse: [ JavaScriptException on: anObject ]", messageSends: ["ifTrue:ifFalse:", "on:", "and:", "isKindOf:", "isSmalltalkObject:"], referencedClasses: ["JavaScriptException", "Error"] }), smalltalk.Smalltalk); smalltalk.addMethod( smalltalk.method({ selector: "at:", category: 'accessing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { return self[aString]; return self}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.Smalltalk)})}, args: ["aString"], source: "at: aString\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Smalltalk); smalltalk.addMethod( smalltalk.method({ selector: "basicParse:", category: 'private', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { return smalltalk.parser.parse(aString); return self}, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},smalltalk.Smalltalk)})}, args: ["aString"], source: "basicParse: aString\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Smalltalk); smalltalk.addMethod( smalltalk.method({ selector: "classes", category: 'classes', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.classes(); return self}, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Smalltalk)})}, args: [], source: "classes\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Smalltalk); smalltalk.addMethod( smalltalk.method({ selector: "createPackage:", category: 'packages', fn: function (packageName){ var self=this; return smalltalk.withContext(function($ctx1) { return smalltalk.addPackage(packageName); return self}, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName},smalltalk.Smalltalk)})}, args: ["packageName"], source: "createPackage: packageName\x0a\x09\x22Create and bind a new package with given name and return it.\x22\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Smalltalk); smalltalk.addMethod( smalltalk.method({ selector: "createPackage:properties:", category: 'private', fn: function (packageName,aDict){ var self=this; return smalltalk.withContext(function($ctx1) { var $1,$2; _st(self)._deprecatedAPI(); $1=_st(aDict)._isEmpty(); if(! smalltalk.assert($1)){ _st(self)._error_("createPackage:properties: called with nonempty properties"); }; $2=_st(self)._createPackage_(packageName); return $2; }, function($ctx1) {$ctx1.fill(self,"createPackage:properties:",{packageName:packageName,aDict:aDict},smalltalk.Smalltalk)})}, args: ["packageName", "aDict"], source: "createPackage: packageName properties: aDict\x0a\x09\x22Needed to import .st files: they begin with this call.\x22\x0a\x09self deprecatedAPI.\x0a\x09\x0a\x09aDict isEmpty ifFalse: [ self error: 'createPackage:properties: called with nonempty properties' ].\x0a\x09^ self createPackage: packageName", messageSends: ["deprecatedAPI", "ifFalse:", "error:", "isEmpty", "createPackage:"], referencedClasses: [] }), smalltalk.Smalltalk); smalltalk.addMethod( smalltalk.method({ selector: "deleteClass:", category: 'classes', fn: function (aClass){ var self=this; return smalltalk.withContext(function($ctx1) { self.removeClass(aClass); return self}, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},smalltalk.Smalltalk)})}, args: ["aClass"], source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Smalltalk); smalltalk.addMethod( smalltalk.method({ selector: "deletePackage:", category: 'packages', fn: function (packageName){ var self=this; return smalltalk.withContext(function($ctx1) { delete smalltalk.packages[packageName]; return self}, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},smalltalk.Smalltalk)})}, args: ["packageName"], source: "deletePackage: packageName\x0a\x09\x22Deletes a package by deleting its binding, but does not check if it contains classes etc.\x0a\x09To remove a package, use #removePackage instead.\x22\x0a\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Smalltalk); smalltalk.addMethod( smalltalk.method({ selector: "isSmalltalkObject:", category: 'testing', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { return typeof anObject.klass !== 'undefined'; return self}, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},smalltalk.Smalltalk)})}, args: ["anObject"], source: "isSmalltalkObject: anObject\x0a\x09\x22Consider anObject a Smalltalk object if it has a 'klass' property.\x0a\x09Note that this may be unaccurate\x22\x0a\x09\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Smalltalk); smalltalk.addMethod( smalltalk.method({ selector: "packageAt:", category: 'packages', fn: function (packageName){ var self=this; return smalltalk.withContext(function($ctx1) { return self.packages[packageName]; return self}, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},smalltalk.Smalltalk)})}, args: ["packageName"], source: "packageAt: packageName\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Smalltalk); smalltalk.addMethod( smalltalk.method({ selector: "packageAt:ifAbsent:", category: 'packages', fn: function (packageName,aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=_st(self)._packageAt_(packageName); $1=_st($2)._ifNil_(aBlock); return $1; }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},smalltalk.Smalltalk)})}, args: ["packageName", "aBlock"], source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^(self packageAt: packageName) ifNil: aBlock", messageSends: ["ifNil:", "packageAt:"], referencedClasses: [] }), smalltalk.Smalltalk); smalltalk.addMethod( smalltalk.method({ selector: "packages", category: 'packages', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.packages.all(); return self}, function($ctx1) {$ctx1.fill(self,"packages",{},smalltalk.Smalltalk)})}, args: [], source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Smalltalk); smalltalk.addMethod( smalltalk.method({ selector: "parse:", category: 'accessing', fn: function (aString){ var self=this; var result; return smalltalk.withContext(function($ctx1) { var $1; _st(self)._try_catch_((function(){ return smalltalk.withContext(function($ctx2) { result=_st(self)._basicParse_(aString); return result; }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(ex){ return smalltalk.withContext(function($ctx2) { return _st(_st(self)._parseError_parsing_(ex,aString))._signal(); }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})})); $1=result; return $1; }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},smalltalk.Smalltalk)})}, args: ["aString"], source: "parse: aString\x0a\x09| result |\x0a\x09self try: [result := self basicParse: aString] catch: [:ex | (self parseError: ex parsing: aString) signal].\x0a\x09^result", messageSends: ["try:catch:", "basicParse:", "signal", "parseError:parsing:"], referencedClasses: [] }), smalltalk.Smalltalk); smalltalk.addMethod( smalltalk.method({ selector: "parseError:parsing:", category: 'error handling', fn: function (anException,aString){ var self=this; function $ParseError(){return smalltalk.ParseError||(typeof ParseError=="undefined"?nil:ParseError)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st($ParseError())._new())._messageText_(_st(_st(_st(_st(_st("Parse error on line ").__comma(_st(anException)._basicAt_("line"))).__comma(" column ")).__comma(_st(anException)._basicAt_("column"))).__comma(" : Unexpected character ")).__comma(_st(anException)._basicAt_("found"))); return $1; }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},smalltalk.Smalltalk)})}, args: ["anException", "aString"], source: "parseError: anException parsing: aString\x0a\x09^ ParseError new messageText: 'Parse error on line ', (anException basicAt: 'line') ,' column ' , (anException basicAt: 'column') ,' : Unexpected character ', (anException basicAt: 'found')", messageSends: ["messageText:", ",", "basicAt:", "new"], referencedClasses: ["ParseError"] }), smalltalk.Smalltalk); smalltalk.addMethod( smalltalk.method({ selector: "pseudoVariableNames", category: 'packages', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=["self", "super", "nil", "true", "false", "thisContext"]; return $1; }, function($ctx1) {$ctx1.fill(self,"pseudoVariableNames",{},smalltalk.Smalltalk)})}, args: [], source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')", messageSends: [], referencedClasses: [] }), smalltalk.Smalltalk); smalltalk.addMethod( smalltalk.method({ selector: "readJSObject:", category: 'accessing', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { return self.readJSObject(anObject); return self}, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},smalltalk.Smalltalk)})}, args: ["anObject"], source: "readJSObject: anObject\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Smalltalk); smalltalk.addMethod( smalltalk.method({ selector: "removeClass:", category: 'classes', fn: function (aClass){ var self=this; function $ClassRemoved(){return smalltalk.ClassRemoved||(typeof ClassRemoved=="undefined"?nil:ClassRemoved)} function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} return smalltalk.withContext(function($ctx1) { var $1,$2,$3; $1=_st(aClass)._isMetaclass(); if(smalltalk.assert($1)){ _st(self)._error_(_st(_st(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!")); }; _st(self)._deleteClass_(aClass); $2=_st($ClassRemoved())._new(); _st($2)._theClass_(aClass); $3=_st($2)._yourself(); _st(_st($SystemAnnouncer())._current())._announce_($3); return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},smalltalk.Smalltalk)})}, args: ["aClass"], source: "removeClass: aClass\x0a\x09aClass isMetaclass ifTrue: [self error: aClass asString, ' is a Metaclass and cannot be removed!'].\x0a\x09\x0a\x09self deleteClass: aClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRemoved new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)", messageSends: ["ifTrue:", "error:", ",", "asString", "isMetaclass", "deleteClass:", "announce:", "theClass:", "new", "yourself", "current"], referencedClasses: ["ClassRemoved", "SystemAnnouncer"] }), smalltalk.Smalltalk); smalltalk.addMethod( smalltalk.method({ selector: "removePackage:", category: 'packages', fn: function (packageName){ var self=this; var pkg; return smalltalk.withContext(function($ctx1) { pkg=_st(self)._packageAt_ifAbsent_(packageName,(function(){ return smalltalk.withContext(function($ctx2) { return _st(self)._error_(_st("Missing package: ").__comma(packageName)); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); _st(_st(pkg)._classes())._do_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(self)._removeClass_(each); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); _st(self)._deletePackage_(packageName); return self}, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},smalltalk.Smalltalk)})}, args: ["packageName"], source: "removePackage: packageName\x0a\x09\x22Removes a package and all its classes.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [self error: 'Missing package: ', packageName].\x0a\x09pkg classes do: [:each |\x0a\x09\x09\x09self removeClass: each].\x0a\x09self deletePackage: packageName", messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "removeClass:", "classes", "deletePackage:"], referencedClasses: [] }), smalltalk.Smalltalk); smalltalk.addMethod( smalltalk.method({ selector: "renamePackage:to:", category: 'packages', fn: function (packageName,newName){ var self=this; var pkg; return smalltalk.withContext(function($ctx1) { var $1; pkg=_st(self)._packageAt_ifAbsent_(packageName,(function(){ return smalltalk.withContext(function($ctx2) { return _st(self)._error_(_st("Missing package: ").__comma(packageName)); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); $1=_st(self)._packageAt_(newName); if(($receiver = $1) == nil || $receiver == undefined){ $1; } else { _st(self)._error_(_st("Already exists a package called: ").__comma(newName)); }; _st(_st(self)._basicAt_("packages"))._at_put_(newName,pkg); _st(pkg)._name_(newName); _st(self)._deletePackage_(packageName); return self}, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},smalltalk.Smalltalk)})}, args: ["packageName", "newName"], source: "renamePackage: packageName to: newName\x0a\x09\x22Rename a package.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [self error: 'Missing package: ', packageName].\x0a\x09(self packageAt: newName) ifNotNil: [self error: 'Already exists a package called: ', newName].\x0a\x09(self basicAt: 'packages') at: newName put: pkg.\x0a\x09pkg name: newName.\x0a\x09self deletePackage: packageName.", messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "at:put:", "basicAt:", "name:", "deletePackage:"], referencedClasses: [] }), smalltalk.Smalltalk); smalltalk.addMethod( smalltalk.method({ selector: "reservedWords", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.reservedWords; return self}, function($ctx1) {$ctx1.fill(self,"reservedWords",{},smalltalk.Smalltalk)})}, args: [], source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Smalltalk); smalltalk.addMethod( smalltalk.method({ selector: "version", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return "0.10"; }, function($ctx1) {$ctx1.fill(self,"version",{},smalltalk.Smalltalk)})}, args: [], source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.10'", messageSends: [], referencedClasses: [] }), smalltalk.Smalltalk); smalltalk.Smalltalk.klass.iVarNames = ['current']; smalltalk.addMethod( smalltalk.method({ selector: "current", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return smalltalk; return self}, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.Smalltalk.klass)})}, args: [], source: "current\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Smalltalk.klass); smalltalk.addClass('Timeout', smalltalk.Object, ['rawTimeout'], 'Kernel-Objects'); smalltalk.Timeout.comment="I am wrapping the returns from set{Timeout,Interval}.\x0a\x0aNumber suffices in browsers, but node.js returns an object." smalltalk.addMethod( smalltalk.method({ selector: "clearInterval", category: 'timeout/interval', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var interval = self["@rawTimeout"]; clearInterval(interval); ; return self}, function($ctx1) {$ctx1.fill(self,"clearInterval",{},smalltalk.Timeout)})}, args: [], source: "clearInterval\x0a\x09<\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.Timeout); smalltalk.addMethod( smalltalk.method({ selector: "clearTimeout", category: 'timeout/interval', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var timeout = self["@rawTimeout"]; clearTimeout(timeout); ; return self}, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},smalltalk.Timeout)})}, args: [], source: "clearTimeout\x0a\x09<\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.Timeout); smalltalk.addMethod( smalltalk.method({ selector: "rawTimeout:", category: 'accessing', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { self["@rawTimeout"]=anObject; return self}, function($ctx1) {$ctx1.fill(self,"rawTimeout:",{anObject:anObject},smalltalk.Timeout)})}, args: ["anObject"], source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject", messageSends: [], referencedClasses: [] }), smalltalk.Timeout); smalltalk.addMethod( smalltalk.method({ selector: "on:", category: 'instance creation', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$3,$1; $2=_st(self)._new(); _st($2)._rawTimeout_(anObject); $3=_st($2)._yourself(); $1=$3; return $1; }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},smalltalk.Timeout.klass)})}, args: ["anObject"], source: "on: anObject\x0a\x09^self new rawTimeout: anObject; yourself", messageSends: ["rawTimeout:", "new", "yourself"], referencedClasses: [] }), smalltalk.Timeout.klass); smalltalk.addClass('UndefinedObject', smalltalk.Object, [], 'Kernel-Objects'); smalltalk.UndefinedObject.comment="UndefinedObject describes the behavior of its sole instance, `nil`. `nil` represents a prior value for variables that have not been initialized, or for results which are meaningless.\x0a\x0a`nil` is the Smalltalk representation of the `undefined` JavaScript object." smalltalk.addMethod( smalltalk.method({ selector: "asJSON", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=null; return $1; }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.UndefinedObject)})}, args: [], source: "asJSON\x0a\x09^null", messageSends: [], referencedClasses: [] }), smalltalk.UndefinedObject); smalltalk.addMethod( smalltalk.method({ selector: "deepCopy", category: 'copying', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self; return $1; }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.UndefinedObject)})}, args: [], source: "deepCopy\x0a\x09^self", messageSends: [], referencedClasses: [] }), smalltalk.UndefinedObject); smalltalk.addMethod( smalltalk.method({ selector: "ifNil:", category: 'testing', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=self; $1=_st($2)._ifNil_ifNotNil_(aBlock,(function(){ return smalltalk.withContext(function($ctx2) { }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},smalltalk.UndefinedObject)})}, args: ["aBlock"], source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifNil: aBlock ifNotNil: []", messageSends: ["ifNil:ifNotNil:"], referencedClasses: [] }), smalltalk.UndefinedObject); smalltalk.addMethod( smalltalk.method({ selector: "ifNil:ifNotNil:", category: 'testing', fn: function (aBlock,anotherBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(aBlock)._value(); return $1; }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.UndefinedObject)})}, args: ["aBlock", "anotherBlock"], source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value", messageSends: ["value"], referencedClasses: [] }), smalltalk.UndefinedObject); smalltalk.addMethod( smalltalk.method({ selector: "ifNotNil:", category: 'testing', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self; return $1; }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},smalltalk.UndefinedObject)})}, args: ["aBlock"], source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self", messageSends: [], referencedClasses: [] }), smalltalk.UndefinedObject); smalltalk.addMethod( smalltalk.method({ selector: "ifNotNil:ifNil:", category: 'testing', fn: function (aBlock,anotherBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(anotherBlock)._value(); return $1; }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.UndefinedObject)})}, args: ["aBlock", "anotherBlock"], source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^anotherBlock value", messageSends: ["value"], referencedClasses: [] }), smalltalk.UndefinedObject); smalltalk.addMethod( smalltalk.method({ selector: "isImmutable", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return true; }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.UndefinedObject)})}, args: [], source: "isImmutable\x0a\x09^ true", messageSends: [], referencedClasses: [] }), smalltalk.UndefinedObject); smalltalk.addMethod( smalltalk.method({ selector: "isNil", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return true; }, function($ctx1) {$ctx1.fill(self,"isNil",{},smalltalk.UndefinedObject)})}, args: [], source: "isNil\x0a\x09^true", messageSends: [], referencedClasses: [] }), smalltalk.UndefinedObject); smalltalk.addMethod( smalltalk.method({ selector: "notNil", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return false; }, function($ctx1) {$ctx1.fill(self,"notNil",{},smalltalk.UndefinedObject)})}, args: [], source: "notNil\x0a\x09^false", messageSends: [], referencedClasses: [] }), smalltalk.UndefinedObject); smalltalk.addMethod( smalltalk.method({ selector: "printOn:", category: 'printing', fn: function (aStream){ var self=this; return smalltalk.withContext(function($ctx1) { _st(aStream)._nextPutAll_("nil"); return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.UndefinedObject)})}, args: ["aStream"], source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'", messageSends: ["nextPutAll:"], referencedClasses: [] }), smalltalk.UndefinedObject); smalltalk.addMethod( smalltalk.method({ selector: "shallowCopy", category: 'copying', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self; return $1; }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.UndefinedObject)})}, args: [], source: "shallowCopy\x0a\x09^self", messageSends: [], referencedClasses: [] }), smalltalk.UndefinedObject); smalltalk.addMethod( smalltalk.method({ selector: "subclass:instanceVariableNames:", category: 'class creation', fn: function (aString,anotherString){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._subclass_instanceVariableNames_package_(aString,anotherString,nil); return $1; }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},smalltalk.UndefinedObject)})}, args: ["aString", "anotherString"], source: "subclass: aString instanceVariableNames: anotherString\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil", messageSends: ["subclass:instanceVariableNames:package:"], referencedClasses: [] }), smalltalk.UndefinedObject); smalltalk.addMethod( smalltalk.method({ selector: "subclass:instanceVariableNames:category:", category: 'class creation', fn: function (aString,aString2,aString3){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; _st(self)._deprecatedAPI(); $1=_st(self)._subclass_instanceVariableNames_package_(aString,aString2,aString3); return $1; }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.UndefinedObject)})}, args: ["aString", "aString2", "aString3"], source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for compatibility.\x22\x0a\x09self deprecatedAPI.\x0a\x09^self subclass: aString instanceVariableNames: aString2 package: aString3", messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"], referencedClasses: [] }), smalltalk.UndefinedObject); smalltalk.addMethod( smalltalk.method({ selector: "subclass:instanceVariableNames:package:", category: 'class creation', fn: function (aString,aString2,aString3){ var self=this; function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,_st(aString)._asString(),aString2,aString3); return $1; }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.UndefinedObject)})}, args: ["aString", "aString2", "aString3"], source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3", messageSends: ["superclass:subclass:instanceVariableNames:package:", "asString", "new"], referencedClasses: ["ClassBuilder"] }), smalltalk.UndefinedObject); smalltalk.addMethod( smalltalk.method({ selector: "new", category: 'instance creation', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._error_("You cannot create new instances of UndefinedObject. Use nil"); return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.UndefinedObject.klass)})}, args: [], source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'", messageSends: ["error:"], referencedClasses: [] }), smalltalk.UndefinedObject.klass); smalltalk.addMethod( smalltalk.method({ selector: "asJavaScriptSelector", category: '*Kernel-Objects', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._replace_with_("^([a-zA-Z0-9]*).*$","$1"); return $1; }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSelector",{},smalltalk.String)})}, args: [], source: "asJavaScriptSelector\x0a\x09\x22Return first keyword of the selector, without trailing colon.\x22\x0a\x09^self replace: '^([a-zA-Z0-9]*).*$' with: '$1'", messageSends: ["replace:with:"], referencedClasses: [] }), smalltalk.String); smalltalk.addPackage('Kernel-Classes'); smalltalk.addClass('Behavior', smalltalk.Object, [], 'Kernel-Classes'); smalltalk.Behavior.comment="Behavior is the superclass of all class objects.\x0a\x0aIt defines the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).\x0aInstances know about the subclass/superclass relationships between classes, contain the description that instances are created from,\x0aand hold the method dictionary that's associated with each class.\x0a\x0aBehavior also provides methods for compiling methods, examining the method dictionary, and iterating over the class hierarchy." smalltalk.addMethod( smalltalk.method({ selector: "addCompiledMethod:", category: 'compiling', fn: function (aMethod){ var self=this; var oldMethod,announcement; function $MethodAdded(){return smalltalk.MethodAdded||(typeof MethodAdded=="undefined"?nil:MethodAdded)} function $MethodModified(){return smalltalk.MethodModified||(typeof MethodModified=="undefined"?nil:MethodModified)} function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4,$5,$6; oldMethod=_st(_st(self)._methodDictionary())._at_ifAbsent_(_st(aMethod)._selector(),(function(){ return smalltalk.withContext(function($ctx2) { return nil; }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); $1=_st(_st(self)._protocols())._includes_(_st(aMethod)._protocol()); if(! smalltalk.assert($1)){ _st(_st(self)._organization())._addElement_(_st(aMethod)._protocol()); }; _st(self)._basicAddCompiledMethod_(aMethod); $2=oldMethod; if(($receiver = $2) == nil || $receiver == undefined){ $3=_st($MethodAdded())._new(); _st($3)._method_(aMethod); $4=_st($3)._yourself(); announcement=$4; } else { $5=_st($MethodModified())._new(); _st($5)._oldMethod_(oldMethod); _st($5)._method_(aMethod); $6=_st($5)._yourself(); announcement=$6; }; _st(_st($SystemAnnouncer())._current())._announce_(announcement); return self}, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},smalltalk.Behavior)})}, args: ["aMethod"], source: "addCompiledMethod: aMethod\x0a\x09| oldMethod announcement |\x0a\x09\x0a\x09oldMethod := self methodDictionary\x0a\x09\x09at: aMethod selector\x0a\x09\x09ifAbsent: [ nil ].\x0a\x09\x0a\x09(self protocols includes: aMethod protocol)\x0a\x09\x09ifFalse: [ self organization addElement: aMethod protocol ].\x0a\x0a\x09self basicAddCompiledMethod: aMethod.\x0a\x09\x0a\x09announcement := oldMethod\x0a\x09\x09ifNil: [\x0a\x09\x09\x09MethodAdded new\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ]\x0a\x09\x09ifNotNil: [\x0a\x09\x09\x09MethodModified new\x0a\x09\x09\x09\x09\x09oldMethod: oldMethod;\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ].\x0a\x09\x09\x09\x09\x09\x0a\x09\x09\x09\x09\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09\x09\x09announce: announcement", messageSends: ["at:ifAbsent:", "selector", "methodDictionary", "ifFalse:", "addElement:", "protocol", "organization", "includes:", "protocols", "basicAddCompiledMethod:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"], referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "allInstanceVariableNames", category: 'accessing', fn: function (){ var self=this; var result; return smalltalk.withContext(function($ctx1) { var $1,$2; result=_st(_st(self)._instanceVariableNames())._copy(); $1=_st(self)._superclass(); if(($receiver = $1) == nil || $receiver == undefined){ $1; } else { _st(result)._addAll_(_st(_st(self)._superclass())._allInstanceVariableNames()); }; $2=result; return $2; }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},smalltalk.Behavior)})}, args: [], source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames].\x0a\x09^result", messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "addAll:", "allInstanceVariableNames", "superclass"], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "allSelectors", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$3,$1; $1=_st(_st(self)._allSuperclasses())._inject_into_(_st(self)._selectors(),(function(soFar,aBehavior){ return smalltalk.withContext(function($ctx2) { $2=soFar; _st($2)._addAll_(_st(aBehavior)._selectors()); $3=_st($2)._yourself(); return $3; }, function($ctx2) {$ctx2.fillBlock({soFar:soFar,aBehavior:aBehavior},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},smalltalk.Behavior)})}, args: [], source: "allSelectors\x0a\x09^self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :soFar :aBehavior | soFar addAll: aBehavior selectors; yourself ]", messageSends: ["inject:into:", "selectors", "addAll:", "yourself", "allSuperclasses"], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "allSubclasses", category: 'accessing', fn: function (){ var self=this; var result; return smalltalk.withContext(function($ctx1) { var $1; result=_st(self)._subclasses(); _st(_st(self)._subclasses())._do_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(result)._addAll_(_st(each)._allSubclasses()); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); $1=result; return $1; }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{result:result},smalltalk.Behavior)})}, args: [], source: "allSubclasses\x0a\x09| result |\x0a\x09result := self subclasses.\x0a\x09self subclasses do: [:each |\x0a\x09\x09result addAll: each allSubclasses].\x0a\x09^result", messageSends: ["subclasses", "do:", "addAll:", "allSubclasses"], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "allSubclassesDo:", category: 'enumerating', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { _st(_st(self)._subclasses())._do_((function(each){ return smalltalk.withContext(function($ctx2) { _st(aBlock)._value_(each); return _st(each)._allSubclassesDo_(aBlock); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},smalltalk.Behavior)})}, args: ["aBlock"], source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a\x09self subclasses do: [ :each |\x0a \x09aBlock value: each.\x0a each allSubclassesDo: aBlock ].", messageSends: ["do:", "value:", "allSubclassesDo:", "subclasses"], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "allSuperclasses", category: 'accessing', fn: function (){ var self=this; function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} return smalltalk.withContext(function($ctx1) { var $1,$2,$4,$5,$3; $1=_st(self)._superclass(); if(($receiver = $1) == nil || $receiver == undefined){ $2=[]; return $2; } else { $1; }; $4=_st($OrderedCollection())._with_(_st(self)._superclass()); _st($4)._addAll_(_st(_st(self)._superclass())._allSuperclasses()); $5=_st($4)._yourself(); $3=$5; return $3; }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},smalltalk.Behavior)})}, args: [], source: "allSuperclasses\x0a\x09\x0a\x09self superclass ifNil: [ ^ #() ].\x0a\x09\x0a\x09^ (OrderedCollection with: self superclass)\x0a\x09\x09addAll: self superclass allSuperclasses;\x0a\x09\x09yourself", messageSends: ["ifNil:", "superclass", "addAll:", "allSuperclasses", "with:", "yourself"], referencedClasses: ["OrderedCollection"] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "basicAddCompiledMethod:", category: 'private', fn: function (aMethod){ var self=this; return smalltalk.withContext(function($ctx1) { smalltalk.addMethod(aMethod, self); return self}, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},smalltalk.Behavior)})}, args: ["aMethod"], source: "basicAddCompiledMethod: aMethod\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "basicNew", category: 'instance creation', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return new self.fn(); return self}, function($ctx1) {$ctx1.fill(self,"basicNew",{},smalltalk.Behavior)})}, args: [], source: "basicNew\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "basicRemoveCompiledMethod:", category: 'private', fn: function (aMethod){ var self=this; return smalltalk.withContext(function($ctx1) { smalltalk.removeMethod(aMethod) smalltalk.init(self); ; return self}, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},smalltalk.Behavior)})}, args: ["aMethod"], source: "basicRemoveCompiledMethod: aMethod\x0a\x09<\x0a\x09\x09smalltalk.removeMethod(aMethod)\x0a\x09\x09smalltalk.init(self);\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "canUnderstand:", category: 'testing', fn: function (aSelector){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(_st(_st(self)._methodDictionary())._keys())._includes_(_st(aSelector)._asString()))._or_((function(){ return smalltalk.withContext(function($ctx2) { return _st(_st(_st(self)._superclass())._notNil())._and_((function(){ return smalltalk.withContext(function($ctx3) { return _st(_st(self)._superclass())._canUnderstand_(aSelector); }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})})); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},smalltalk.Behavior)})}, args: ["aSelector"], source: "canUnderstand: aSelector\x0a\x09^(self methodDictionary keys includes: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [self superclass canUnderstand: aSelector]]", messageSends: ["or:", "and:", "canUnderstand:", "superclass", "notNil", "includes:", "asString", "keys", "methodDictionary"], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "comment", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=_st(self)._basicAt_("comment"); if(($receiver = $2) == nil || $receiver == undefined){ $1=""; } else { $1=$2; }; return $1; }, function($ctx1) {$ctx1.fill(self,"comment",{},smalltalk.Behavior)})}, args: [], source: "comment\x0a\x09^(self basicAt: 'comment') ifNil: ['']", messageSends: ["ifNil:", "basicAt:"], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "comment:", category: 'accessing', fn: function (aString){ var self=this; function $ClassCommentChanged(){return smalltalk.ClassCommentChanged||(typeof ClassCommentChanged=="undefined"?nil:ClassCommentChanged)} function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} return smalltalk.withContext(function($ctx1) { var $1,$2; _st(self)._basicAt_put_("comment",aString); $1=_st($ClassCommentChanged())._new(); _st($1)._theClass_(self); $2=_st($1)._yourself(); _st(_st($SystemAnnouncer())._current())._announce_($2); return self}, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},smalltalk.Behavior)})}, args: ["aString"], source: "comment: aString\x0a\x09self basicAt: 'comment' put: aString.\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassCommentChanged new\x0a\x09\x09\x09theClass: self;\x0a\x09\x09\x09yourself)", messageSends: ["basicAt:put:", "announce:", "theClass:", "new", "yourself", "current"], referencedClasses: ["ClassCommentChanged", "SystemAnnouncer"] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "commentStamp", category: 'accessing', fn: function (){ var self=this; function $ClassCommentReader(){return smalltalk.ClassCommentReader||(typeof ClassCommentReader=="undefined"?nil:ClassCommentReader)} return smalltalk.withContext(function($ctx1) { var $2,$3,$1; $2=_st($ClassCommentReader())._new(); _st($2)._class_(self); $3=_st($2)._yourself(); $1=$3; return $1; }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},smalltalk.Behavior)})}, args: [], source: "commentStamp\x0a\x09^ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself", messageSends: ["class:", "new", "yourself"], referencedClasses: ["ClassCommentReader"] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "commentStamp:prior:", category: 'accessing', fn: function (aStamp,prior){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._commentStamp(); return $1; }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},smalltalk.Behavior)})}, args: ["aStamp", "prior"], source: "commentStamp: aStamp prior: prior\x0a\x09\x09^self commentStamp", messageSends: ["commentStamp"], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "compile:", category: 'compiling', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._compile_category_(aString,""); return $1; }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},smalltalk.Behavior)})}, args: ["aString"], source: "compile: aString\x0a\x09^ self compile: aString category: ''", messageSends: ["compile:category:"], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "compile:category:", category: 'compiling', fn: function (aString,anotherString){ var self=this; function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st($Compiler())._new())._install_forClass_category_(aString,self,anotherString); return $1; }, function($ctx1) {$ctx1.fill(self,"compile:category:",{aString:aString,anotherString:anotherString},smalltalk.Behavior)})}, args: ["aString", "anotherString"], source: "compile: aString category: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09category: anotherString", messageSends: ["install:forClass:category:", "new"], referencedClasses: ["Compiler"] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "definition", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return ""; }, function($ctx1) {$ctx1.fill(self,"definition",{},smalltalk.Behavior)})}, args: [], source: "definition\x0a\x09^ ''", messageSends: [], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "includesBehavior:", category: 'testing', fn: function (aClass){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self).__eq_eq(aClass))._or_((function(){ return smalltalk.withContext(function($ctx2) { return _st(self)._inheritsFrom_(aClass); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},smalltalk.Behavior)})}, args: ["aClass"], source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]", messageSends: ["or:", "inheritsFrom:", "=="], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "includesSelector:", category: 'testing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._methodDictionary())._includesKey_(aString); return $1; }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},smalltalk.Behavior)})}, args: ["aString"], source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString", messageSends: ["includesKey:", "methodDictionary"], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "inheritsFrom:", category: 'testing', fn: function (aClass){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(aClass)._allSubclasses())._includes_(self); return $1; }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},smalltalk.Behavior)})}, args: ["aClass"], source: "inheritsFrom: aClass\x0a\x09^aClass allSubclasses includes: self", messageSends: ["includes:", "allSubclasses"], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "instanceVariableNames", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.iVarNames; return self}, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},smalltalk.Behavior)})}, args: [], source: "instanceVariableNames\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "isBehavior", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return true; }, function($ctx1) {$ctx1.fill(self,"isBehavior",{},smalltalk.Behavior)})}, args: [], source: "isBehavior\x0a\x09^ true", messageSends: [], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "lookupSelector:", category: 'accessing', fn: function (selector){ var self=this; var lookupClass; return smalltalk.withContext(function($ctx1) { var $1,$2; var $early={}; try { lookupClass=self; _st((function(){ return smalltalk.withContext(function($ctx2) { return _st(lookupClass).__eq(nil); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){ return smalltalk.withContext(function($ctx2) { $1=_st(lookupClass)._includesSelector_(selector); if(smalltalk.assert($1)){ $2=_st(lookupClass)._methodAt_(selector); throw $early=[$2]; }; lookupClass=_st(lookupClass)._superclass(); return lookupClass; }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); return nil; } catch(e) {if(e===$early)return e[0]; throw e} }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},smalltalk.Behavior)})}, args: ["selector"], source: "lookupSelector: selector\x0a\x09\x22Look up the given selector in my methodDictionary.\x0a\x09Return the corresponding method if found.\x0a\x09Otherwise chase the superclass chain and try again.\x0a\x09Return nil if no method is found.\x22\x0a\x09\x0a\x09| lookupClass |\x0a\x09\x0a\x09lookupClass := self.\x0a\x09[ lookupClass = nil ] whileFalse: [\x0a\x09\x09(lookupClass includesSelector: selector)\x0a\x09\x09\x09\x09ifTrue: [ ^ lookupClass methodAt: selector ].\x0a\x09\x09\x09lookupClass := lookupClass superclass ].\x0a\x09^ nil", messageSends: ["whileFalse:", "ifTrue:", "methodAt:", "includesSelector:", "superclass", "="], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "methodAt:", category: 'accessing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._methodDictionary())._at_(aString); return $1; }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},smalltalk.Behavior)})}, args: ["aString"], source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString", messageSends: ["at:", "methodDictionary"], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "methodDictionary", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var dict = smalltalk.HashedCollection._new(); var methods = self.methods; for(var i in methods) { if(methods[i].selector) { dict._at_put_(methods[i].selector, methods[i]); } }; return dict; return self}, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},smalltalk.Behavior)})}, args: [], source: "methodDictionary\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "methods", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._methodDictionary())._values(); return $1; }, function($ctx1) {$ctx1.fill(self,"methods",{},smalltalk.Behavior)})}, args: [], source: "methods\x0a\x09^ self methodDictionary values", messageSends: ["values", "methodDictionary"], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "methodsFor:", category: 'accessing', fn: function (aString){ var self=this; function $ClassCategoryReader(){return smalltalk.ClassCategoryReader||(typeof ClassCategoryReader=="undefined"?nil:ClassCategoryReader)} return smalltalk.withContext(function($ctx1) { var $2,$3,$1; $2=_st($ClassCategoryReader())._new(); _st($2)._class_category_(self,aString); $3=_st($2)._yourself(); $1=$3; return $1; }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},smalltalk.Behavior)})}, args: ["aString"], source: "methodsFor: aString\x0a\x09^ClassCategoryReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself", messageSends: ["class:category:", "new", "yourself"], referencedClasses: ["ClassCategoryReader"] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "methodsFor:stamp:", category: 'accessing', fn: function (aString,aStamp){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._methodsFor_(aString); return $1; }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},smalltalk.Behavior)})}, args: ["aString", "aStamp"], source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for compatibility, right now ignores stamp.\x22\x0a\x09^self methodsFor: aString", messageSends: ["methodsFor:"], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "methodsInProtocol:", category: 'accessing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(_st(self)._methodDictionary())._values())._select_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(_st(each)._protocol()).__eq(aString); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},smalltalk.Behavior)})}, args: ["aString"], source: "methodsInProtocol: aString\x0a\x09^ self methodDictionary values select: [ :each | each protocol = aString ]", messageSends: ["select:", "=", "protocol", "values", "methodDictionary"], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "name", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.className || nil; return self}, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.Behavior)})}, args: [], source: "name\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "new", category: 'instance creation', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._basicNew())._initialize(); return $1; }, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.Behavior)})}, args: [], source: "new\x0a\x09^self basicNew initialize", messageSends: ["initialize", "basicNew"], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "organization", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._basicAt_("organization"); return $1; }, function($ctx1) {$ctx1.fill(self,"organization",{},smalltalk.Behavior)})}, args: [], source: "organization\x0a\x09^ self basicAt: 'organization'", messageSends: ["basicAt:"], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "protocols", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(_st(self)._organization())._elements())._sorted(); return $1; }, function($ctx1) {$ctx1.fill(self,"protocols",{},smalltalk.Behavior)})}, args: [], source: "protocols\x0a\x09^ self organization elements sorted", messageSends: ["sorted", "elements", "organization"], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "protocolsDo:", category: 'enumerating', fn: function (aBlock){ var self=this; var methodsByCategory; function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)} function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)} return smalltalk.withContext(function($ctx1) { methodsByCategory=_st($HashedCollection())._new(); _st(_st(_st(self)._methodDictionary())._values())._do_((function(m){ return smalltalk.withContext(function($ctx2) { return _st(_st(methodsByCategory)._at_ifAbsentPut_(_st(m)._category(),(function(){ return smalltalk.withContext(function($ctx3) { return _st($Array())._new(); }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})})))._add_(m); }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1)})})); _st(_st(self)._protocols())._do_((function(category){ return smalltalk.withContext(function($ctx2) { return _st(aBlock)._value_value_(category,_st(methodsByCategory)._at_(category)); }, function($ctx2) {$ctx2.fillBlock({category:category},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByCategory:methodsByCategory},smalltalk.Behavior)})}, args: ["aBlock"], source: "protocolsDo: aBlock\x0a\x09\x22Execute aBlock for each method category with\x0a\x09its collection of methods in the sort order of category name.\x22\x0a\x0a\x09| methodsByCategory |\x0a\x09methodsByCategory := HashedCollection new.\x0a\x09self methodDictionary values do: [:m |\x0a\x09\x09(methodsByCategory at: m category ifAbsentPut: [Array new])\x0a\x09\x09\x09add: m].\x0a\x09self protocols do: [:category |\x0a\x09\x09aBlock value: category value: (methodsByCategory at: category)]", messageSends: ["new", "do:", "add:", "at:ifAbsentPut:", "category", "values", "methodDictionary", "value:value:", "at:", "protocols"], referencedClasses: ["HashedCollection", "Array"] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "prototype", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.fn.prototype; return self}, function($ctx1) {$ctx1.fill(self,"prototype",{},smalltalk.Behavior)})}, args: [], source: "prototype\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "removeCompiledMethod:", category: 'compiling', fn: function (aMethod){ var self=this; function $MethodRemoved(){return smalltalk.MethodRemoved||(typeof MethodRemoved=="undefined"?nil:MethodRemoved)} function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} return smalltalk.withContext(function($ctx1) { var $1,$2; _st(self)._basicRemoveCompiledMethod_(aMethod); _st(_st(self)._methods())._detect_ifNone_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(_st(each)._protocol()).__eq(_st(aMethod)._protocol()); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){ return smalltalk.withContext(function($ctx2) { return _st(_st(self)._organization())._removeElement_(_st(aMethod)._protocol()); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); $1=_st($MethodRemoved())._new(); _st($1)._method_(aMethod); $2=_st($1)._yourself(); _st(_st($SystemAnnouncer())._current())._announce_($2); return self}, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},smalltalk.Behavior)})}, args: ["aMethod"], source: "removeCompiledMethod: aMethod\x0a\x09self basicRemoveCompiledMethod: aMethod.\x0a\x09\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aMethod protocol ]\x0a\x09\x09ifNone: [ self organization removeElement: aMethod protocol ].\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (MethodRemoved new\x0a\x09\x09\x09method: aMethod;\x0a\x09\x09\x09yourself)", messageSends: ["basicRemoveCompiledMethod:", "detect:ifNone:", "=", "protocol", "removeElement:", "organization", "methods", "announce:", "method:", "new", "yourself", "current"], referencedClasses: ["MethodRemoved", "SystemAnnouncer"] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "selectors", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._methodDictionary())._keys(); return $1; }, function($ctx1) {$ctx1.fill(self,"selectors",{},smalltalk.Behavior)})}, args: [], source: "selectors\x0a\x09^ self methodDictionary keys", messageSends: ["keys", "methodDictionary"], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "subclasses", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return smalltalk.subclasses(self); return self}, function($ctx1) {$ctx1.fill(self,"subclasses",{},smalltalk.Behavior)})}, args: [], source: "subclasses\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "superclass", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.superclass || nil; return self}, function($ctx1) {$ctx1.fill(self,"superclass",{},smalltalk.Behavior)})}, args: [], source: "superclass\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "theMetaClass", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._class(); return $1; }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},smalltalk.Behavior)})}, args: [], source: "theMetaClass\x0a\x09^ self class", messageSends: ["class"], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "theNonMetaClass", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self; return $1; }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},smalltalk.Behavior)})}, args: [], source: "theNonMetaClass\x0a\x09^ self", messageSends: [], referencedClasses: [] }), smalltalk.Behavior); smalltalk.addMethod( smalltalk.method({ selector: "withAllSubclasses", category: 'accessing', fn: function (){ var self=this; function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)} return smalltalk.withContext(function($ctx1) { var $2,$3,$1; $2=_st($Array())._with_(self); _st($2)._addAll_(_st(self)._allSubclasses()); $3=_st($2)._yourself(); $1=$3; return $1; }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},smalltalk.Behavior)})}, args: [], source: "withAllSubclasses\x0a\x09^(Array with: self) addAll: self allSubclasses; yourself", messageSends: ["addAll:", "allSubclasses", "with:", "yourself"], referencedClasses: ["Array"] }), smalltalk.Behavior); smalltalk.addClass('Class', smalltalk.Behavior, [], 'Kernel-Classes'); smalltalk.Class.comment="Class is __the__ class object.\x0a\x0aInstances are the classes of the system.\x0aClass creation is done throught a `ClassBuilder`" smalltalk.addMethod( smalltalk.method({ selector: "asJavascript", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st("smalltalk.").__comma(_st(self)._name()); return $1; }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Class)})}, args: [], source: "asJavascript\x0a\x09^ 'smalltalk.', self name", messageSends: [",", "name"], referencedClasses: [] }), smalltalk.Class); smalltalk.addMethod( smalltalk.method({ selector: "category", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=_st(self)._package(); if(($receiver = $2) == nil || $receiver == undefined){ $1="Unclassified"; } else { $1=_st(_st(self)._package())._name(); }; return $1; }, function($ctx1) {$ctx1.fill(self,"category",{},smalltalk.Class)})}, args: [], source: "category\x0a\x09^self package ifNil: ['Unclassified'] ifNotNil: [self package name]", messageSends: ["ifNil:ifNotNil:", "name", "package"], referencedClasses: [] }), smalltalk.Class); smalltalk.addMethod( smalltalk.method({ selector: "definition", category: 'accessing', fn: function (){ var self=this; function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)} return smalltalk.withContext(function($ctx1) { var $2,$3,$4,$5,$1; $1=_st($String())._streamContents_((function(stream){ return smalltalk.withContext(function($ctx2) { $2=stream; _st($2)._nextPutAll_(_st(_st(self)._superclass())._asString()); _st($2)._nextPutAll_(" subclass: #"); _st($2)._nextPutAll_(_st(self)._name()); _st($2)._nextPutAll_(_st(_st($String())._lf()).__comma(_st($String())._tab())); $3=_st($2)._nextPutAll_("instanceVariableNames: '"); $3; _st(_st(self)._instanceVariableNames())._do_separatedBy_((function(each){ return smalltalk.withContext(function($ctx3) { return _st(stream)._nextPutAll_(each); }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){ return smalltalk.withContext(function($ctx3) { return _st(stream)._nextPutAll_(" "); }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})})); $4=stream; _st($4)._nextPutAll_(_st(_st("'").__comma(_st($String())._lf())).__comma(_st($String())._tab())); _st($4)._nextPutAll_("package: '"); _st($4)._nextPutAll_(_st(self)._category()); $5=_st($4)._nextPutAll_("'"); return $5; }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"definition",{},smalltalk.Class)})}, args: [], source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: self superclass asString;\x0a\x09\x09\x09nextPutAll: ' subclass: #';\x0a\x09\x09\x09nextPutAll: self name;\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: '''', String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'package: ''';\x0a\x09\x09\x09nextPutAll: self category;\x0a\x09\x09\x09nextPutAll: '''' ]", messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "tab", "lf", "do:separatedBy:", "instanceVariableNames", "category"], referencedClasses: ["String"] }), smalltalk.Class); smalltalk.addMethod( smalltalk.method({ selector: "isClass", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return true; }, function($ctx1) {$ctx1.fill(self,"isClass",{},smalltalk.Class)})}, args: [], source: "isClass\x0a\x09^true", messageSends: [], referencedClasses: [] }), smalltalk.Class); smalltalk.addMethod( smalltalk.method({ selector: "package", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._basicAt_("pkg"); return $1; }, function($ctx1) {$ctx1.fill(self,"package",{},smalltalk.Class)})}, args: [], source: "package\x0a\x09^ self basicAt: 'pkg'", messageSends: ["basicAt:"], referencedClasses: [] }), smalltalk.Class); smalltalk.addMethod( smalltalk.method({ selector: "package:", category: 'accessing', fn: function (aPackage){ var self=this; var oldPackage; function $ClassMoved(){return smalltalk.ClassMoved||(typeof ClassMoved=="undefined"?nil:ClassMoved)} function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} return smalltalk.withContext(function($ctx1) { var $1,$2; oldPackage=_st(self)._package(); _st(self)._basicAt_put_("pkg",aPackage); _st(_st(oldPackage)._organization())._removeElement_(self); _st(_st(aPackage)._organization())._addElement_(self); $1=_st($ClassMoved())._new(); _st($1)._theClass_(self); _st($1)._oldPackage_(oldPackage); $2=_st($1)._yourself(); _st(_st($SystemAnnouncer())._current())._announce_($2); return self}, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},smalltalk.Class)})}, args: ["aPackage"], source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09oldPackage := self package.\x0a\x09\x0a\x09self basicAt: 'pkg' put: aPackage.\x0a\x09oldPackage organization removeElement: self.\x0a\x09aPackage organization addElement: self.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)", messageSends: ["package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "theClass:", "new", "oldPackage:", "yourself", "current"], referencedClasses: ["ClassMoved", "SystemAnnouncer"] }), smalltalk.Class); smalltalk.addMethod( smalltalk.method({ selector: "printOn:", category: 'printing', fn: function (aStream){ var self=this; return smalltalk.withContext(function($ctx1) { _st(aStream)._nextPutAll_(_st(self)._name()); return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Class)})}, args: ["aStream"], source: "printOn: aStream\x0a\x09aStream nextPutAll: self name", messageSends: ["nextPutAll:", "name"], referencedClasses: [] }), smalltalk.Class); smalltalk.addMethod( smalltalk.method({ selector: "rename:", category: 'accessing', fn: function (aString){ var self=this; function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)} return smalltalk.withContext(function($ctx1) { _st(_st($ClassBuilder())._new())._renameClass_to_(self,aString); return self}, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},smalltalk.Class)})}, args: ["aString"], source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString", messageSends: ["renameClass:to:", "new"], referencedClasses: ["ClassBuilder"] }), smalltalk.Class); smalltalk.addMethod( smalltalk.method({ selector: "subclass:instanceVariableNames:", category: 'class creation', fn: function (aString,anotherString){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._subclass_instanceVariableNames_package_(aString,anotherString,nil); return $1; }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},smalltalk.Class)})}, args: ["aString", "anotherString"], source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for compatibility.\x22\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil", messageSends: ["subclass:instanceVariableNames:package:"], referencedClasses: [] }), smalltalk.Class); smalltalk.addMethod( smalltalk.method({ selector: "subclass:instanceVariableNames:category:", category: 'class creation', fn: function (aString,aString2,aString3){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; _st(self)._deprecatedAPI(); $1=_st(self)._subclass_instanceVariableNames_package_(aString,aString2,aString3); return $1; }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.Class)})}, args: ["aString", "aString2", "aString3"], source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for compatibility.\x22\x0a\x09self deprecatedAPI.\x0a\x09^self subclass: aString instanceVariableNames: aString2 package: aString3", messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"], referencedClasses: [] }), smalltalk.Class); smalltalk.addMethod( smalltalk.method({ selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:", category: 'class creation', fn: function (aString,aString2,classVars,pools,aString3){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._subclass_instanceVariableNames_package_(aString,aString2,aString3); return $1; }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},smalltalk.Class)})}, args: ["aString", "aString2", "classVars", "pools", "aString3"], source: "subclass: aString instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3\x0a\x09\x22Just ignore class variables and pools. Added for compatibility.\x22\x0a\x09^self subclass: aString instanceVariableNames: aString2 package: aString3", messageSends: ["subclass:instanceVariableNames:package:"], referencedClasses: [] }), smalltalk.Class); smalltalk.addMethod( smalltalk.method({ selector: "subclass:instanceVariableNames:package:", category: 'class creation', fn: function (aString,aString2,aString3){ var self=this; function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,_st(aString)._asString(),aString2,aString3); return $1; }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.Class)})}, args: ["aString", "aString2", "aString3"], source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3", messageSends: ["superclass:subclass:instanceVariableNames:package:", "asString", "new"], referencedClasses: ["ClassBuilder"] }), smalltalk.Class); smalltalk.addClass('Metaclass', smalltalk.Behavior, [], 'Kernel-Classes'); smalltalk.Metaclass.comment="Metaclass is the root of the class hierarchy.\x0a\x0aMetaclass instances are metaclasses, one for each real class.\x0aMetaclass instances have a single instance, which they hold onto, which is the class that they are the metaclass of." smalltalk.addMethod( smalltalk.method({ selector: "asJavascript", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st("smalltalk.").__comma(_st(_st(self)._instanceClass())._name())).__comma(".klass"); return $1; }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Metaclass)})}, args: [], source: "asJavascript\x0a\x09^ 'smalltalk.', self instanceClass name, '.klass'", messageSends: [",", "name", "instanceClass"], referencedClasses: [] }), smalltalk.Metaclass); smalltalk.addMethod( smalltalk.method({ selector: "definition", category: 'accessing', fn: function (){ var self=this; function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)} return smalltalk.withContext(function($ctx1) { var $2,$3,$1; $1=_st($String())._streamContents_((function(stream){ return smalltalk.withContext(function($ctx2) { $2=stream; _st($2)._nextPutAll_(_st(self)._asString()); $3=_st($2)._nextPutAll_(" instanceVariableNames: '"); $3; _st(_st(self)._instanceVariableNames())._do_separatedBy_((function(each){ return smalltalk.withContext(function($ctx3) { return _st(stream)._nextPutAll_(each); }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){ return smalltalk.withContext(function($ctx3) { return _st(stream)._nextPutAll_(" "); }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})})); return _st(stream)._nextPutAll_("'"); }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"definition",{},smalltalk.Metaclass)})}, args: [], source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: self asString;\x0a\x09\x09\x09nextPutAll: ' instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream nextPutAll: '''' ]", messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"], referencedClasses: ["String"] }), smalltalk.Metaclass); smalltalk.addMethod( smalltalk.method({ selector: "instanceClass", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.instanceClass; return self}, function($ctx1) {$ctx1.fill(self,"instanceClass",{},smalltalk.Metaclass)})}, args: [], source: "instanceClass\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Metaclass); smalltalk.addMethod( smalltalk.method({ selector: "instanceVariableNames:", category: 'accessing', fn: function (aCollection){ var self=this; function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)} return smalltalk.withContext(function($ctx1) { _st(_st($ClassBuilder())._new())._class_instanceVariableNames_(self,aCollection); return self}, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},smalltalk.Metaclass)})}, args: ["aCollection"], source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection", messageSends: ["class:instanceVariableNames:", "new"], referencedClasses: ["ClassBuilder"] }), smalltalk.Metaclass); smalltalk.addMethod( smalltalk.method({ selector: "isMetaclass", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return true; }, function($ctx1) {$ctx1.fill(self,"isMetaclass",{},smalltalk.Metaclass)})}, args: [], source: "isMetaclass\x0a\x09^true", messageSends: [], referencedClasses: [] }), smalltalk.Metaclass); smalltalk.addMethod( smalltalk.method({ selector: "printOn:", category: 'printing', fn: function (aStream){ var self=this; return smalltalk.withContext(function($ctx1) { var $1,$2; $1=aStream; _st($1)._nextPutAll_(_st(_st(self)._instanceClass())._name()); $2=_st($1)._nextPutAll_(" class"); return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Metaclass)})}, args: ["aStream"], source: "printOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: self instanceClass name;\x0a\x09\x09nextPutAll: ' class'", messageSends: ["nextPutAll:", "name", "instanceClass"], referencedClasses: [] }), smalltalk.Metaclass); smalltalk.addMethod( smalltalk.method({ selector: "theMetaClass", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self; return $1; }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},smalltalk.Metaclass)})}, args: [], source: "theMetaClass\x0a\x09^ self", messageSends: [], referencedClasses: [] }), smalltalk.Metaclass); smalltalk.addMethod( smalltalk.method({ selector: "theNonMetaClass", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._instanceClass(); return $1; }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},smalltalk.Metaclass)})}, args: [], source: "theNonMetaClass\x0a\x09^ self instanceClass", messageSends: ["instanceClass"], referencedClasses: [] }), smalltalk.Metaclass); smalltalk.addClass('ClassBuilder', smalltalk.Object, [], 'Kernel-Classes'); smalltalk.ClassBuilder.comment="ClassBuilder is responsible for compiling new classes or modifying existing classes in the system.\x0a\x0aRather than using ClassBuilder directly to compile a class, use `Class >> subclass:instanceVariableNames:package:`." smalltalk.addMethod( smalltalk.method({ selector: "addSubclassOf:named:instanceVariableNames:package:", category: 'class definition', fn: function (aClass,aString,aCollection,packageName){ var self=this; var theClass; function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4; theClass=_st(_st($Smalltalk())._current())._at_(aString); $1=theClass; if(($receiver = $1) == nil || $receiver == undefined){ $1; } else { $2=_st(_st(theClass)._superclass()).__eq_eq(aClass); if(! smalltalk.assert($2)){ $3=_st(self)._migrateClassNamed_superclass_instanceVariableNames_package_(aString,aClass,aCollection,packageName); return $3; }; }; $4=_st(self)._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,aString,aCollection,packageName); return $4; }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName,theClass:theClass},smalltalk.ClassBuilder)})}, args: ["aClass", "aString", "aCollection", "packageName"], source: "addSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09| theClass |\x0a\x09\x0a\x09theClass := Smalltalk current at: aString.\x0a\x09\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass superclass == aClass ifFalse: [\x0a\x09\x09\x09^ self\x0a\x09\x09\x09\x09migrateClassNamed: aString\x0a\x09\x09\x09\x09superclass: aClass\x0a\x09\x09\x09\x09instanceVariableNames: aCollection\x0a\x09\x09\x09\x09package: packageName ] ].\x0a\x0a\x09^ self\x0a\x09\x09basicAddSubclassOf: aClass\x0a\x09\x09named: aString\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName", messageSends: ["at:", "current", "ifNotNil:", "ifFalse:", "migrateClassNamed:superclass:instanceVariableNames:package:", "==", "superclass", "basicAddSubclassOf:named:instanceVariableNames:package:"], referencedClasses: ["Smalltalk"] }), smalltalk.ClassBuilder); smalltalk.addMethod( smalltalk.method({ selector: "basicAddSubclassOf:named:instanceVariableNames:package:", category: 'private', fn: function (aClass,aString,aCollection,packageName){ var self=this; return smalltalk.withContext(function($ctx1) { smalltalk.addClass(aString, aClass, aCollection, packageName); return smalltalk[aString] ; return self}, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},smalltalk.ClassBuilder)})}, args: ["aClass", "aString", "aCollection", "packageName"], source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<\x0a\x09\x09smalltalk.addClass(aString, aClass, aCollection, packageName);\x0a\x09\x09return smalltalk[aString]\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.ClassBuilder); smalltalk.addMethod( smalltalk.method({ selector: "basicClass:instanceVariableNames:", category: 'private', fn: function (aClass,aString){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._basicClass_instanceVariables_(aClass,_st(self)._instanceVariableNamesFor_(aString)); return self}, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})}, args: ["aClass", "aString"], source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)", messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"], referencedClasses: [] }), smalltalk.ClassBuilder); smalltalk.addMethod( smalltalk.method({ selector: "basicClass:instanceVariables:", category: 'private', fn: function (aClass,aCollection){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(aClass)._isMetaclass(); if(! smalltalk.assert($1)){ _st(self)._error_(_st(_st(aClass)._name()).__comma(" is not a metaclass")); }; _st(aClass)._basicAt_put_("iVarNames",aCollection); return self}, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},smalltalk.ClassBuilder)})}, args: ["aClass", "aCollection"], source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [self error: aClass name, ' is not a metaclass'].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection", messageSends: ["ifFalse:", "error:", ",", "name", "isMetaclass", "basicAt:put:"], referencedClasses: [] }), smalltalk.ClassBuilder); smalltalk.addMethod( smalltalk.method({ selector: "basicRemoveClass:", category: 'private', fn: function (aClass){ var self=this; return smalltalk.withContext(function($ctx1) { smalltalk.removeClass(aClass); return self}, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},smalltalk.ClassBuilder)})}, args: ["aClass"], source: "basicRemoveClass: aClass\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.ClassBuilder); smalltalk.addMethod( smalltalk.method({ selector: "basicRenameClass:to:", category: 'private', fn: function (aClass,aString){ var self=this; return smalltalk.withContext(function($ctx1) { smalltalk[aString] = aClass; delete smalltalk[aClass.className]; aClass.className = aString; ; return self}, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})}, args: ["aClass", "aString"], source: "basicRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09smalltalk[aString] = aClass;\x0a\x09\x09delete smalltalk[aClass.className];\x0a\x09\x09aClass.className = aString;\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.ClassBuilder); smalltalk.addMethod( smalltalk.method({ selector: "basicSwapClassNames:with:", category: 'private', fn: function (aClass,anotherClass){ var self=this; return smalltalk.withContext(function($ctx1) { var tmp = aClass.className; aClass.className = anotherClass.className; anotherClass.className = tmp; ; return self}, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},smalltalk.ClassBuilder)})}, args: ["aClass", "anotherClass"], source: "basicSwapClassNames: aClass with: anotherClass\x0a\x09<\x0a\x09\x09var tmp = aClass.className;\x0a\x09\x09aClass.className = anotherClass.className;\x0a\x09\x09anotherClass.className = tmp;\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.ClassBuilder); smalltalk.addMethod( smalltalk.method({ selector: "class:instanceVariableNames:", category: 'class definition', fn: function (aClass,aString){ var self=this; function $ClassDefinitionChanged(){return smalltalk.ClassDefinitionChanged||(typeof ClassDefinitionChanged=="undefined"?nil:ClassDefinitionChanged)} function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} return smalltalk.withContext(function($ctx1) { var $1,$2; _st(self)._basicClass_instanceVariableNames_(aClass,aString); _st(self)._setupClass_(aClass); $1=_st($ClassDefinitionChanged())._new(); _st($1)._theClass_(aClass); $2=_st($1)._yourself(); _st(_st($SystemAnnouncer())._current())._announce_($2); return self}, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})}, args: ["aClass", "aString"], source: "class: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariableNames: aString.\x0a\x09self setupClass: aClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)", messageSends: ["basicClass:instanceVariableNames:", "setupClass:", "announce:", "theClass:", "new", "yourself", "current"], referencedClasses: ["ClassDefinitionChanged", "SystemAnnouncer"] }), smalltalk.ClassBuilder); smalltalk.addMethod( smalltalk.method({ selector: "copyClass:named:", category: 'copying', fn: function (aClass,aString){ var self=this; var newClass; function $ClassAdded(){return smalltalk.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)} function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} return smalltalk.withContext(function($ctx1) { var $1,$2,$3; newClass=_st(self)._addSubclassOf_named_instanceVariableNames_package_(_st(aClass)._superclass(),aString,_st(aClass)._instanceVariableNames(),_st(_st(aClass)._package())._name()); _st(self)._copyClass_to_(aClass,newClass); $1=_st($ClassAdded())._new(); _st($1)._theClass_(newClass); $2=_st($1)._yourself(); _st(_st($SystemAnnouncer())._current())._announce_($2); $3=newClass; return $3; }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,aString:aString,newClass:newClass},smalltalk.ClassBuilder)})}, args: ["aClass", "aString"], source: "copyClass: aClass named: aString\x0a\x09| newClass |\x0a\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass superclass\x0a\x09\x09named: aString\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name.\x0a\x0a\x09self copyClass: aClass to: newClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^newClass", messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "theClass:", "new", "yourself", "current"], referencedClasses: ["ClassAdded", "SystemAnnouncer"] }), smalltalk.ClassBuilder); smalltalk.addMethod( smalltalk.method({ selector: "copyClass:to:", category: 'copying', fn: function (aClass,anotherClass){ var self=this; function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)} return smalltalk.withContext(function($ctx1) { _st(anotherClass)._comment_(_st(aClass)._comment()); _st(_st(_st(aClass)._methodDictionary())._values())._do_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(_st($Compiler())._new())._install_forClass_category_(_st(each)._source(),anotherClass,_st(each)._category()); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); _st(self)._basicClass_instanceVariables_(_st(anotherClass)._class(),_st(_st(aClass)._class())._instanceVariableNames()); _st(_st(_st(_st(aClass)._class())._methodDictionary())._values())._do_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(_st($Compiler())._new())._install_forClass_category_(_st(each)._source(),_st(anotherClass)._class(),_st(each)._category()); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); _st(self)._setupClass_(anotherClass); return self}, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},smalltalk.ClassBuilder)})}, args: ["aClass", "anotherClass"], source: "copyClass: aClass to: anotherClass\x0a\x0a\x09anotherClass comment: aClass comment.\x0a\x0a\x09aClass methodDictionary values do: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass category: each category ].\x0a\x0a\x09self basicClass: anotherClass class instanceVariables: aClass class instanceVariableNames.\x0a\x0a\x09aClass class methodDictionary values do: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass class category: each category ].\x0a\x0a\x09self setupClass: anotherClass", messageSends: ["comment:", "comment", "do:", "install:forClass:category:", "source", "category", "new", "values", "methodDictionary", "basicClass:instanceVariables:", "class", "instanceVariableNames", "setupClass:"], referencedClasses: ["Compiler"] }), smalltalk.ClassBuilder); smalltalk.addMethod( smalltalk.method({ selector: "installMethod:forClass:category:", category: 'method definition', fn: function (aCompiledMethod,aBehavior,aString){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; _st(aCompiledMethod)._category_(aString); _st(aBehavior)._addCompiledMethod_(aCompiledMethod); _st(self)._setupClass_(aBehavior); $1=aCompiledMethod; return $1; }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:category:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},smalltalk.ClassBuilder)})}, args: ["aCompiledMethod", "aBehavior", "aString"], source: "installMethod: aCompiledMethod forClass: aBehavior category: aString\x0a\x09aCompiledMethod category: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09self setupClass: aBehavior.\x0a\x09^aCompiledMethod", messageSends: ["category:", "addCompiledMethod:", "setupClass:"], referencedClasses: [] }), smalltalk.ClassBuilder); smalltalk.addMethod( smalltalk.method({ selector: "instanceVariableNamesFor:", category: 'accessing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(aString)._tokenize_(" "))._reject_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(each)._isEmpty(); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},smalltalk.ClassBuilder)})}, args: ["aString"], source: "instanceVariableNamesFor: aString\x0a\x09^(aString tokenize: ' ') reject: [ :each | each isEmpty ]", messageSends: ["reject:", "isEmpty", "tokenize:"], referencedClasses: [] }), smalltalk.ClassBuilder); smalltalk.addMethod( smalltalk.method({ selector: "migrateClass:superclass:", category: 'class migration', fn: function (aClass,anotherClass){ var self=this; return smalltalk.withContext(function($ctx1) { _st(console)._log_(_st(aClass)._name()); _st(self)._migrateClassNamed_superclass_instanceVariableNames_package_(_st(aClass)._name(),anotherClass,_st(aClass)._instanceVariableNames(),_st(_st(aClass)._package())._name()); return self}, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},smalltalk.ClassBuilder)})}, args: ["aClass", "anotherClass"], source: "migrateClass: aClass superclass: anotherClass\x0a\x09console log: aClass name.\x0a\x09self\x0a\x09\x09migrateClassNamed: aClass name\x0a\x09\x09superclass: anotherClass\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name", messageSends: ["log:", "name", "migrateClassNamed:superclass:instanceVariableNames:package:", "instanceVariableNames", "package"], referencedClasses: [] }), smalltalk.ClassBuilder); smalltalk.addMethod( smalltalk.method({ selector: "migrateClassNamed:superclass:instanceVariableNames:package:", category: 'class migration', fn: function (aString,aClass,aCollection,packageName){ var self=this; var oldClass,newClass,tmp; function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)} return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4,$5; tmp=_st("new*").__comma(aString); oldClass=_st(_st($Smalltalk())._current())._at_(aString); newClass=_st(self)._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName); _st(self)._basicSwapClassNames_with_(oldClass,newClass); _st((function(){ return smalltalk.withContext(function($ctx2) { return _st(self)._copyClass_to_(oldClass,newClass); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(exception){ return smalltalk.withContext(function($ctx2) { $1=self; _st($1)._basicSwapClassNames_with_(oldClass,newClass); $2=_st($1)._basicRemoveClass_(newClass); $2; return _st(exception)._signal(); }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1)})})); $3=self; _st($3)._rawRenameClass_to_(oldClass,tmp); $4=_st($3)._rawRenameClass_to_(newClass,aString); _st(_st(oldClass)._subclasses())._do_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(self)._migrateClass_superclass_(each,newClass); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); _st(self)._basicRemoveClass_(oldClass); $5=newClass; return $5; }, function($ctx1) {$ctx1.fill(self,"migrateClassNamed:superclass:instanceVariableNames:package:",{aString:aString,aClass:aClass,aCollection:aCollection,packageName:packageName,oldClass:oldClass,newClass:newClass,tmp:tmp},smalltalk.ClassBuilder)})}, args: ["aString", "aClass", "aCollection", "packageName"], source: "migrateClassNamed: aString superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', aString.\x0a\x09oldClass := Smalltalk current at: aString.\x0a\x09\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: tmp\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName.\x0a\x0a\x09self basicSwapClassNames: oldClass with: newClass.\x0a\x0a\x09[ self copyClass: oldClass to: newClass ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :exception |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09basicSwapClassNames: oldClass with: newClass;\x0a\x09\x09\x09\x09basicRemoveClass: newClass.\x0a\x09\x09\x09exception signal ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: aString.\x0a\x0a\x09oldClass subclasses do: [ :each |\x0a\x09\x09self migrateClass: each superclass: newClass ].\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09^newClass", messageSends: [",", "at:", "current", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "basicRemoveClass:", "signal", "copyClass:to:", "rawRenameClass:to:", "do:", "migrateClass:superclass:", "subclasses"], referencedClasses: ["Smalltalk", "Error"] }), smalltalk.ClassBuilder); smalltalk.addMethod( smalltalk.method({ selector: "rawRenameClass:to:", category: 'private', fn: function (aClass,aString){ var self=this; return smalltalk.withContext(function($ctx1) { smalltalk[aString] = aClass; ; return self}, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})}, args: ["aClass", "aString"], source: "rawRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09smalltalk[aString] = aClass;\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.ClassBuilder); smalltalk.addMethod( smalltalk.method({ selector: "renameClass:to:", category: 'class migration', fn: function (aClass,aString){ var self=this; function $ClassRenamed(){return smalltalk.ClassRenamed||(typeof ClassRenamed=="undefined"?nil:ClassRenamed)} function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} return smalltalk.withContext(function($ctx1) { var $1,$2; _st(self)._basicRenameClass_to_(aClass,aString); $1=_st($ClassRenamed())._new(); _st($1)._theClass_(aClass); $2=_st($1)._yourself(); _st(_st($SystemAnnouncer())._current())._announce_($2); return self}, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})}, args: ["aClass", "aString"], source: "renameClass: aClass to: aString\x0a\x09self basicRenameClass: aClass to: aString.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRenamed new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)", messageSends: ["basicRenameClass:to:", "announce:", "theClass:", "new", "yourself", "current"], referencedClasses: ["ClassRenamed", "SystemAnnouncer"] }), smalltalk.ClassBuilder); smalltalk.addMethod( smalltalk.method({ selector: "setupClass:", category: 'public', fn: function (aClass){ var self=this; return smalltalk.withContext(function($ctx1) { smalltalk.init(aClass);; return self}, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},smalltalk.ClassBuilder)})}, args: ["aClass"], source: "setupClass: aClass\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.ClassBuilder); smalltalk.addMethod( smalltalk.method({ selector: "superclass:subclass:", category: 'class definition', fn: function (aClass,aString){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._superclass_subclass_instanceVariableNames_package_(aClass,aString,"",nil); return $1; }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})}, args: ["aClass", "aString"], source: "superclass: aClass subclass: aString\x0a\x09^self superclass: aClass subclass: aString instanceVariableNames: '' package: nil", messageSends: ["superclass:subclass:instanceVariableNames:package:"], referencedClasses: [] }), smalltalk.ClassBuilder); smalltalk.addMethod( smalltalk.method({ selector: "superclass:subclass:instanceVariableNames:package:", category: 'class definition', fn: function (aClass,aString,aString2,aString3){ var self=this; var newClass; function $ClassAdded(){return smalltalk.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)} function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4,$6,$5,$7,$8,$9; $1=self; $2=aClass; $3=aString; $4=_st(self)._instanceVariableNamesFor_(aString2); $6=aString3; if(($receiver = $6) == nil || $receiver == undefined){ $5="unclassified"; } else { $5=$6; }; newClass=_st($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$4,$5); _st(self)._setupClass_(newClass); $7=_st($ClassAdded())._new(); _st($7)._theClass_(newClass); $8=_st($7)._yourself(); _st(_st($SystemAnnouncer())._current())._announce_($8); $9=newClass; return $9; }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,aString:aString,aString2:aString2,aString3:aString3,newClass:newClass},smalltalk.ClassBuilder)})}, args: ["aClass", "aString", "aString2", "aString3"], source: "superclass: aClass subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09| newClass |\x0a\x09\x0a\x09newClass := self addSubclassOf: aClass\x0a\x09\x09named: aString instanceVariableNames: (self instanceVariableNamesFor: aString2)\x0a\x09\x09package: (aString3 ifNil: ['unclassified']).\x0a\x09self setupClass: newClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^newClass", messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:", "announce:", "theClass:", "new", "yourself", "current"], referencedClasses: ["ClassAdded", "SystemAnnouncer"] }), smalltalk.ClassBuilder); smalltalk.addClass('ClassCategoryReader', smalltalk.Object, ['class', 'category'], 'Kernel-Classes'); smalltalk.ClassCategoryReader.comment="ClassCategoryReader represents a mechanism for retrieving class descriptions stored on a file." smalltalk.addMethod( smalltalk.method({ selector: "class:category:", category: 'accessing', fn: function (aClass,aString){ var self=this; return smalltalk.withContext(function($ctx1) { self["@class"]=aClass; self["@category"]=aString; return self}, function($ctx1) {$ctx1.fill(self,"class:category:",{aClass:aClass,aString:aString},smalltalk.ClassCategoryReader)})}, args: ["aClass", "aString"], source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString", messageSends: [], referencedClasses: [] }), smalltalk.ClassCategoryReader); smalltalk.addMethod( smalltalk.method({ selector: "compileMethod:", category: 'private', fn: function (aString){ var self=this; function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)} return smalltalk.withContext(function($ctx1) { _st(_st($Compiler())._new())._install_forClass_category_(aString,self["@class"],self["@category"]); return self}, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},smalltalk.ClassCategoryReader)})}, args: ["aString"], source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class category: category", messageSends: ["install:forClass:category:", "new"], referencedClasses: ["Compiler"] }), smalltalk.ClassCategoryReader); smalltalk.addMethod( smalltalk.method({ selector: "initialize", category: 'initialization', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []); return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ClassCategoryReader)})}, args: [], source: "initialize\x0a\x09super initialize.", messageSends: ["initialize"], referencedClasses: [] }), smalltalk.ClassCategoryReader); smalltalk.addMethod( smalltalk.method({ selector: "scanFrom:", category: 'fileIn', fn: function (aChunkParser){ var self=this; var chunk; function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)} return smalltalk.withContext(function($ctx1) { _st((function(){ return smalltalk.withContext(function($ctx2) { chunk=_st(aChunkParser)._nextChunk(); chunk; return _st(chunk)._isEmpty(); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){ return smalltalk.withContext(function($ctx2) { return _st(self)._compileMethod_(chunk); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); _st(_st($ClassBuilder())._new())._setupClass_(self["@class"]); return self}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},smalltalk.ClassCategoryReader)})}, args: ["aChunkParser"], source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty] whileFalse: [\x0a\x09\x09self compileMethod: chunk].\x0a\x09ClassBuilder new setupClass: class", messageSends: ["whileFalse:", "compileMethod:", "nextChunk", "isEmpty", "setupClass:", "new"], referencedClasses: ["ClassBuilder"] }), smalltalk.ClassCategoryReader); smalltalk.addClass('ClassCommentReader', smalltalk.Object, ['class'], 'Kernel-Classes'); smalltalk.ClassCommentReader.comment="ClassCommentReader represents a mechanism for retrieving class comments stored on a file.\x0aSee `ClassCategoryReader` too." smalltalk.addMethod( smalltalk.method({ selector: "class:", category: 'accessing', fn: function (aClass){ var self=this; return smalltalk.withContext(function($ctx1) { self["@class"]=aClass; return self}, function($ctx1) {$ctx1.fill(self,"class:",{aClass:aClass},smalltalk.ClassCommentReader)})}, args: ["aClass"], source: "class: aClass\x0a\x09class := aClass", messageSends: [], referencedClasses: [] }), smalltalk.ClassCommentReader); smalltalk.addMethod( smalltalk.method({ selector: "initialize", category: 'initialization', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []); return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ClassCommentReader)})}, args: [], source: "initialize\x0a\x09super initialize.", messageSends: ["initialize"], referencedClasses: [] }), smalltalk.ClassCommentReader); smalltalk.addMethod( smalltalk.method({ selector: "scanFrom:", category: 'fileIn', fn: function (aChunkParser){ var self=this; var chunk; return smalltalk.withContext(function($ctx1) { var $1; chunk=_st(aChunkParser)._nextChunk(); $1=_st(chunk)._isEmpty(); if(! smalltalk.assert($1)){ _st(self)._setComment_(chunk); }; return self}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},smalltalk.ClassCommentReader)})}, args: ["aChunkParser"], source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09\x09self setComment: chunk].", messageSends: ["nextChunk", "ifFalse:", "setComment:", "isEmpty"], referencedClasses: [] }), smalltalk.ClassCommentReader); smalltalk.addMethod( smalltalk.method({ selector: "setComment:", category: 'private', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self["@class"])._comment_(aString); return self}, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},smalltalk.ClassCommentReader)})}, args: ["aString"], source: "setComment: aString\x0a\x09class comment: aString", messageSends: ["comment:"], referencedClasses: [] }), smalltalk.ClassCommentReader); smalltalk.addClass('ClassSorterNode', smalltalk.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes'); smalltalk.addMethod( smalltalk.method({ selector: "getNodesFrom:", category: 'accessing', fn: function (aCollection){ var self=this; var children,others; function $ClassSorterNode(){return smalltalk.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)} return smalltalk.withContext(function($ctx1) { var $1; children=[]; others=[]; _st(aCollection)._do_((function(each){ return smalltalk.withContext(function($ctx2) { $1=_st(_st(each)._superclass()).__eq(_st(self)._theClass()); if(smalltalk.assert($1)){ return _st(children)._add_(each); } else { return _st(others)._add_(each); }; }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); self["@nodes"]=_st(children)._collect_((function(each){ return smalltalk.withContext(function($ctx2) { return _st($ClassSorterNode())._on_classes_level_(each,others,_st(_st(self)._level()).__plus((1))); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},smalltalk.ClassSorterNode)})}, args: ["aCollection"], source: "getNodesFrom: aCollection\x0a\x09| children others |\x0a\x09children := #().\x0a\x09others := #().\x0a\x09aCollection do: [:each |\x0a\x09\x09(each superclass = self theClass)\x0a\x09\x09\x09ifTrue: [children add: each]\x0a\x09\x09\x09ifFalse: [others add: each]].\x0a\x09nodes:= children collect: [:each |\x0a\x09\x09ClassSorterNode on: each classes: others level: self level + 1]", messageSends: ["do:", "ifTrue:ifFalse:", "add:", "=", "theClass", "superclass", "collect:", "on:classes:level:", "+", "level"], referencedClasses: ["ClassSorterNode"] }), smalltalk.ClassSorterNode); smalltalk.addMethod( smalltalk.method({ selector: "level", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@level"]; return $1; }, function($ctx1) {$ctx1.fill(self,"level",{},smalltalk.ClassSorterNode)})}, args: [], source: "level\x0a\x09^level", messageSends: [], referencedClasses: [] }), smalltalk.ClassSorterNode); smalltalk.addMethod( smalltalk.method({ selector: "level:", category: 'accessing', fn: function (anInteger){ var self=this; return smalltalk.withContext(function($ctx1) { self["@level"]=anInteger; return self}, function($ctx1) {$ctx1.fill(self,"level:",{anInteger:anInteger},smalltalk.ClassSorterNode)})}, args: ["anInteger"], source: "level: anInteger\x0a\x09level := anInteger", messageSends: [], referencedClasses: [] }), smalltalk.ClassSorterNode); smalltalk.addMethod( smalltalk.method({ selector: "nodes", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@nodes"]; return $1; }, function($ctx1) {$ctx1.fill(self,"nodes",{},smalltalk.ClassSorterNode)})}, args: [], source: "nodes\x0a\x09^nodes", messageSends: [], referencedClasses: [] }), smalltalk.ClassSorterNode); smalltalk.addMethod( smalltalk.method({ selector: "theClass", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@theClass"]; return $1; }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ClassSorterNode)})}, args: [], source: "theClass\x0a\x09^theClass", messageSends: [], referencedClasses: [] }), smalltalk.ClassSorterNode); smalltalk.addMethod( smalltalk.method({ selector: "theClass:", category: 'accessing', fn: function (aClass){ var self=this; return smalltalk.withContext(function($ctx1) { self["@theClass"]=aClass; return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.ClassSorterNode)})}, args: ["aClass"], source: "theClass: aClass\x0a\x09theClass := aClass", messageSends: [], referencedClasses: [] }), smalltalk.ClassSorterNode); smalltalk.addMethod( smalltalk.method({ selector: "traverseClassesWith:", category: 'visiting', fn: function (aCollection){ var self=this; return smalltalk.withContext(function($ctx1) { _st(aCollection)._add_(_st(self)._theClass()); _st(_st(_st(self)._nodes())._sorted_((function(a,b){ return smalltalk.withContext(function($ctx2) { return _st(_st(_st(a)._theClass())._name()).__lt_eq(_st(_st(b)._theClass())._name()); }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._do_((function(aNode){ return smalltalk.withContext(function($ctx2) { return _st(aNode)._traverseClassesWith_(aCollection); }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},smalltalk.ClassSorterNode)})}, args: ["aCollection"], source: "traverseClassesWith: aCollection\x0a\x09\x22sort classes alphabetically Issue #143\x22\x0a\x0a\x09aCollection add: self theClass.\x0a\x09(self nodes sorted: [:a :b | a theClass name <= b theClass name ]) do: [:aNode |\x0a\x09\x09aNode traverseClassesWith: aCollection ].", messageSends: ["add:", "theClass", "do:", "traverseClassesWith:", "sorted:", "<=", "name", "nodes"], referencedClasses: [] }), smalltalk.ClassSorterNode); smalltalk.addMethod( smalltalk.method({ selector: "on:classes:level:", category: 'instance creation', fn: function (aClass,aCollection,anInteger){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$3,$1; $2=_st(self)._new(); _st($2)._theClass_(aClass); _st($2)._level_(anInteger); _st($2)._getNodesFrom_(aCollection); $3=_st($2)._yourself(); $1=$3; return $1; }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},smalltalk.ClassSorterNode.klass)})}, args: ["aClass", "aCollection", "anInteger"], source: "on: aClass classes: aCollection level: anInteger\x0a\x09^self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09level: anInteger;\x0a\x09\x09getNodesFrom: aCollection;\x0a\x09\x09yourself", messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"], referencedClasses: [] }), smalltalk.ClassSorterNode.klass); 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( smalltalk.method({ selector: "applyTo:arguments:", category: 'evaluating', fn: function (anObject,aCollection){ var self=this; return smalltalk.withContext(function($ctx1) { return self.apply(anObject, aCollection); return self}, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},smalltalk.BlockClosure)})}, args: ["anObject", "aCollection"], source: "applyTo: anObject arguments: aCollection\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.BlockClosure); smalltalk.addMethod( smalltalk.method({ selector: "asCompiledMethod:", category: 'converting', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { return smalltalk.method({selector:aString, fn:self});; return self}, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},smalltalk.BlockClosure)})}, args: ["aString"], source: "asCompiledMethod: aString\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.BlockClosure); smalltalk.addMethod( smalltalk.method({ selector: "compiledSource", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.toString(); return self}, function($ctx1) {$ctx1.fill(self,"compiledSource",{},smalltalk.BlockClosure)})}, args: [], source: "compiledSource\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.BlockClosure); smalltalk.addMethod( smalltalk.method({ selector: "currySelf", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return function () { var args = [ this ]; args.push.apply(args, arguments); return self.apply(null, args); } ; return self}, function($ctx1) {$ctx1.fill(self,"currySelf",{},smalltalk.BlockClosure)})}, args: [], source: "currySelf\x0a\x09\x22Transforms [ :selfarg :x :y | stcode ] block\x0a\x09which represents JS function (selfarg, x, y, ...) {jscode}\x0a\x09into function (x, y, ...) {jscode} that takes selfarg from 'this'.\x0a\x09IOW, it is usable as JS method and first arg takes the receiver.\x22\x0a\x09\x0a\x09<\x0a\x09\x09return function () {\x0a\x09\x09\x09var args = [ this ];\x0a\x09\x09\x09args.push.apply(args, arguments);\x0a\x09\x09\x09return self.apply(null, args);\x0a\x09\x09}\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.BlockClosure); smalltalk.addMethod( smalltalk.method({ selector: "ensure:", category: 'evaluating', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { try{return self()}finally{aBlock._value()}; return self}, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},smalltalk.BlockClosure)})}, args: ["aBlock"], source: "ensure: aBlock\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.BlockClosure); smalltalk.addMethod( smalltalk.method({ selector: "fork", category: 'timeout/interval', fn: function (){ var self=this; function $ForkPool(){return smalltalk.ForkPool||(typeof ForkPool=="undefined"?nil:ForkPool)} return smalltalk.withContext(function($ctx1) { _st(_st($ForkPool())._default())._fork_(self); return self}, function($ctx1) {$ctx1.fill(self,"fork",{},smalltalk.BlockClosure)})}, args: [], source: "fork\x0a\x09ForkPool default fork: self", messageSends: ["fork:", "default"], referencedClasses: ["ForkPool"] }), smalltalk.BlockClosure); smalltalk.addMethod( smalltalk.method({ selector: "new", category: 'evaluating', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return new self(); return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.BlockClosure)})}, 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", messageSends: [], referencedClasses: [] }), smalltalk.BlockClosure); smalltalk.addMethod( smalltalk.method({ selector: "newValue:", category: 'evaluating', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { return new self(anObject); return self}, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},smalltalk.BlockClosure)})}, 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", messageSends: [], referencedClasses: [] }), smalltalk.BlockClosure); smalltalk.addMethod( smalltalk.method({ selector: "newValue:value:", category: 'evaluating', fn: function (anObject,anObject2){ var self=this; return smalltalk.withContext(function($ctx1) { return new self(anObject, anObject2); return self}, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},smalltalk.BlockClosure)})}, 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", messageSends: [], referencedClasses: [] }), smalltalk.BlockClosure); smalltalk.addMethod( smalltalk.method({ selector: "newValue:value:value:", category: 'evaluating', fn: function (anObject,anObject2,anObject3){ var self=this; return smalltalk.withContext(function($ctx1) { return new self(anObject, anObject2,anObject3); return self}, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},smalltalk.BlockClosure)})}, 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", messageSends: [], referencedClasses: [] }), smalltalk.BlockClosure); smalltalk.addMethod( smalltalk.method({ selector: "numArgs", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.length; return self}, function($ctx1) {$ctx1.fill(self,"numArgs",{},smalltalk.BlockClosure)})}, args: [], source: "numArgs\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.BlockClosure); smalltalk.addMethod( smalltalk.method({ selector: "on:do:", category: 'error handling', fn: function (anErrorClass,aBlock){ var self=this; function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return smalltalk.withContext(function($ctx1) { var $2,$1; $1=_st(self)._try_catch_(self,(function(error){ var smalltalkError; return smalltalk.withContext(function($ctx2) { smalltalkError=_st(_st($Smalltalk())._current())._asSmalltalkException_(error); smalltalkError; $2=_st(smalltalkError)._isKindOf_(anErrorClass); if(smalltalk.assert($2)){ return _st(aBlock)._value_(smalltalkError); } else { return _st(smalltalkError)._signal(); }; }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},smalltalk.BlockClosure)})}, args: ["anErrorClass", "aBlock"], source: "on: anErrorClass do: aBlock\x0a\x09\x22All exceptions thrown in the Smalltalk stack are cought.\x0a\x09Convert all JS exceptions to JavaScriptException instances.\x22\x0a\x09\x0a\x09^self try: self catch: [ :error | | smalltalkError |\x0a\x09\x09smalltalkError := Smalltalk current asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError signal ] ]", messageSends: ["try:catch:", "asSmalltalkException:", "current", "ifTrue:ifFalse:", "value:", "signal", "isKindOf:"], referencedClasses: ["Smalltalk"] }), smalltalk.BlockClosure); smalltalk.addMethod( smalltalk.method({ selector: "timeToRun", category: 'evaluating', fn: function (){ var self=this; function $Date(){return smalltalk.Date||(typeof Date=="undefined"?nil:Date)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st($Date())._millisecondsToRun_(self); return $1; }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},smalltalk.BlockClosure)})}, 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( smalltalk.method({ selector: "value", category: 'evaluating', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self();; return self}, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.BlockClosure)})}, args: [], source: "value\x0a\x09\x22inlined in the Compiler\x22\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.BlockClosure); smalltalk.addMethod( smalltalk.method({ selector: "value:", category: 'evaluating', fn: function (anArg){ var self=this; return smalltalk.withContext(function($ctx1) { return self(anArg);; return self}, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},smalltalk.BlockClosure)})}, args: ["anArg"], source: "value: anArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.BlockClosure); smalltalk.addMethod( smalltalk.method({ selector: "value:value:", category: 'evaluating', fn: function (firstArg,secondArg){ var self=this; return smalltalk.withContext(function($ctx1) { return self(firstArg, secondArg);; return self}, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},smalltalk.BlockClosure)})}, args: ["firstArg", "secondArg"], source: "value: firstArg value: secondArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.BlockClosure); smalltalk.addMethod( smalltalk.method({ selector: "value:value:value:", category: 'evaluating', fn: function (firstArg,secondArg,thirdArg){ var self=this; return smalltalk.withContext(function($ctx1) { return self(firstArg, secondArg, thirdArg);; return self}, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},smalltalk.BlockClosure)})}, args: ["firstArg", "secondArg", "thirdArg"], source: "value: firstArg value: secondArg value: thirdArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.BlockClosure); smalltalk.addMethod( smalltalk.method({ selector: "valueWithInterval:", category: 'timeout/interval', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { var interval = setInterval(self, aNumber); return smalltalk.Timeout._on_(interval); ; return self}, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},smalltalk.BlockClosure)})}, args: ["aNumber"], source: "valueWithInterval: aNumber\x0a\x09<\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return smalltalk.Timeout._on_(interval);\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.BlockClosure); smalltalk.addMethod( smalltalk.method({ selector: "valueWithPossibleArguments:", category: 'evaluating', fn: function (aCollection){ var self=this; return smalltalk.withContext(function($ctx1) { return self.apply(null, aCollection);; return self}, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},smalltalk.BlockClosure)})}, args: ["aCollection"], source: "valueWithPossibleArguments: aCollection\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.BlockClosure); smalltalk.addMethod( smalltalk.method({ selector: "valueWithTimeout:", category: 'timeout/interval', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { var timeout = setTimeout(self, aNumber); return smalltalk.Timeout._on_(timeout); ; return self}, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},smalltalk.BlockClosure)})}, args: ["aNumber"], source: "valueWithTimeout: aNumber\x0a\x09<\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return smalltalk.Timeout._on_(timeout);\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.BlockClosure); smalltalk.addMethod( smalltalk.method({ selector: "whileFalse", category: 'controlling', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._whileFalse_((function(){ return smalltalk.withContext(function($ctx2) { }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"whileFalse",{},smalltalk.BlockClosure)})}, args: [], source: "whileFalse\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileFalse: []", messageSends: ["whileFalse:"], referencedClasses: [] }), smalltalk.BlockClosure); smalltalk.addMethod( smalltalk.method({ selector: "whileFalse:", category: 'controlling', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { while(!self()) {aBlock()}; return self}, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},smalltalk.BlockClosure)})}, args: ["aBlock"], source: "whileFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.BlockClosure); smalltalk.addMethod( smalltalk.method({ selector: "whileTrue", category: 'controlling', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._whileTrue_((function(){ return smalltalk.withContext(function($ctx2) { }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"whileTrue",{},smalltalk.BlockClosure)})}, args: [], source: "whileTrue\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileTrue: []", messageSends: ["whileTrue:"], referencedClasses: [] }), smalltalk.BlockClosure); smalltalk.addMethod( smalltalk.method({ selector: "whileTrue:", category: 'controlling', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { while(self()) {aBlock()}; return self}, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},smalltalk.BlockClosure)})}, args: ["aBlock"], source: "whileTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09", 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( smalltalk.method({ selector: "arguments", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.args || []; return self}, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.CompiledMethod)})}, args: [], source: "arguments\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.CompiledMethod); smalltalk.addMethod( smalltalk.method({ selector: "category", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=_st(self)._basicAt_("category"); if(($receiver = $2) == nil || $receiver == undefined){ $1=_st(self)._defaultCategory(); } else { $1=$2; }; return $1; }, function($ctx1) {$ctx1.fill(self,"category",{},smalltalk.CompiledMethod)})}, args: [], source: "category\x0a\x09^(self basicAt: 'category') ifNil: [ self defaultCategory ]", messageSends: ["ifNil:", "defaultCategory", "basicAt:"], referencedClasses: [] }), smalltalk.CompiledMethod); smalltalk.addMethod( smalltalk.method({ selector: "category:", category: 'accessing', fn: function (aString){ var self=this; var oldProtocol; function $MethodMoved(){return smalltalk.MethodMoved||(typeof MethodMoved=="undefined"?nil:MethodMoved)} function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)} return smalltalk.withContext(function($ctx1) { var $1,$2,$3; oldProtocol=_st(self)._protocol(); _st(self)._basicAt_put_("category",aString); $1=_st($MethodMoved())._new(); _st($1)._method_(self); _st($1)._oldProtocol_(oldProtocol); $2=_st($1)._yourself(); _st(_st($SystemAnnouncer())._current())._announce_($2); $3=_st(self)._methodClass(); if(($receiver = $3) == nil || $receiver == undefined){ $3; } else { _st(_st(_st(self)._methodClass())._organization())._addElement_(aString); _st(_st(_st(_st(self)._methodClass())._methods())._select_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(_st(each)._protocol()).__eq(oldProtocol); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._ifEmpty_((function(){ return smalltalk.withContext(function($ctx2) { return _st(_st(_st(self)._methodClass())._organization())._removeElement_(oldProtocol); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); }; return self}, function($ctx1) {$ctx1.fill(self,"category:",{aString:aString,oldProtocol:oldProtocol},smalltalk.CompiledMethod)})}, args: ["aString"], source: "category: aString\x0a\x09| oldProtocol |\x0a\x09oldProtocol := self protocol.\x0a\x09self basicAt: 'category' put: aString.\x0a\x0a\x09SystemAnnouncer current announce: (MethodMoved new\x0a\x09\x09method: self;\x0a\x09\x09oldProtocol: oldProtocol;\x0a\x09\x09yourself).\x0a\x0a\x09self methodClass ifNotNil: [\x0a\x09\x09self methodClass organization addElement: aString.\x0a\x09\x0a\x09\x09(self methodClass methods\x0a\x09\x09\x09select: [ :each | each protocol = oldProtocol ])\x0a\x09\x09\x09ifEmpty: [ self methodClass organization removeElement: oldProtocol ] ]", messageSends: ["protocol", "basicAt:put:", "announce:", "method:", "new", "oldProtocol:", "yourself", "current", "ifNotNil:", "addElement:", "organization", "methodClass", "ifEmpty:", "removeElement:", "select:", "=", "methods"], referencedClasses: ["MethodMoved", "SystemAnnouncer"] }), smalltalk.CompiledMethod); smalltalk.addMethod( smalltalk.method({ selector: "defaultCategory", category: 'defaults', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return "as yet unclassified"; }, function($ctx1) {$ctx1.fill(self,"defaultCategory",{},smalltalk.CompiledMethod)})}, args: [], source: "defaultCategory\x0a\x09^ 'as yet unclassified'", messageSends: [], referencedClasses: [] }), smalltalk.CompiledMethod); smalltalk.addMethod( smalltalk.method({ selector: "fn", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._basicAt_("fn"); return $1; }, function($ctx1) {$ctx1.fill(self,"fn",{},smalltalk.CompiledMethod)})}, args: [], source: "fn\x0a\x09^self basicAt: 'fn'", messageSends: ["basicAt:"], referencedClasses: [] }), smalltalk.CompiledMethod); smalltalk.addMethod( smalltalk.method({ selector: "fn:", category: 'accessing', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._basicAt_put_("fn",aBlock); return self}, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},smalltalk.CompiledMethod)})}, args: ["aBlock"], source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock", messageSends: ["basicAt:put:"], referencedClasses: [] }), smalltalk.CompiledMethod); smalltalk.addMethod( smalltalk.method({ selector: "isCompiledMethod", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return true; }, function($ctx1) {$ctx1.fill(self,"isCompiledMethod",{},smalltalk.CompiledMethod)})}, args: [], source: "isCompiledMethod\x0a\x09^ true", messageSends: [], referencedClasses: [] }), smalltalk.CompiledMethod); smalltalk.addMethod( smalltalk.method({ selector: "isOverridden", category: 'testing', fn: function (){ var self=this; var selector; return smalltalk.withContext(function($ctx1) { var $1; var $early={}; try { selector=_st(self)._selector(); _st(_st(self)._methodClass())._allSubclassesDo_((function(each){ return smalltalk.withContext(function($ctx2) { $1=_st(each)._includesSelector_(selector); if(smalltalk.assert($1)){ throw $early=[true]; }; }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); return false; } catch(e) {if(e===$early)return e[0]; throw e} }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},smalltalk.CompiledMethod)})}, args: [], source: "isOverridden\x0a\x09| selector |\x0a \x0a selector := self selector.\x0a self methodClass allSubclassesDo: [ :each |\x0a\x09 (each includesSelector: selector)\x0a \x09ifTrue: [ ^ true ] ].\x0a\x09^ false", messageSends: ["selector", "allSubclassesDo:", "ifTrue:", "includesSelector:", "methodClass"], referencedClasses: [] }), smalltalk.CompiledMethod); smalltalk.addMethod( smalltalk.method({ selector: "isOverride", category: 'testing', fn: function (){ var self=this; var superclass; return smalltalk.withContext(function($ctx1) { var $1,$2; superclass=_st(_st(self)._methodClass())._superclass(); $1=superclass; if(($receiver = $1) == nil || $receiver == undefined){ return false; } else { $1; }; $2=_st(_st(_st(_st(self)._methodClass())._superclass())._lookupSelector_(_st(self)._selector()))._notNil(); return $2; }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},smalltalk.CompiledMethod)})}, args: [], source: "isOverride\x0a\x09| superclass |\x0a \x0a superclass := self methodClass superclass.\x0a\x09superclass ifNil: [ ^ false ].\x0a\x09\x0a ^ (self methodClass superclass lookupSelector: self selector) notNil", messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"], referencedClasses: [] }), smalltalk.CompiledMethod); smalltalk.addMethod( smalltalk.method({ selector: "messageSends", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._basicAt_("messageSends"); return $1; }, function($ctx1) {$ctx1.fill(self,"messageSends",{},smalltalk.CompiledMethod)})}, args: [], source: "messageSends\x0a\x09^self basicAt: 'messageSends'", messageSends: ["basicAt:"], referencedClasses: [] }), smalltalk.CompiledMethod); smalltalk.addMethod( smalltalk.method({ selector: "methodClass", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._basicAt_("methodClass"); return $1; }, function($ctx1) {$ctx1.fill(self,"methodClass",{},smalltalk.CompiledMethod)})}, args: [], source: "methodClass\x0a\x09^self basicAt: 'methodClass'", messageSends: ["basicAt:"], referencedClasses: [] }), smalltalk.CompiledMethod); smalltalk.addMethod( smalltalk.method({ selector: "protocol", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._category(); return $1; }, function($ctx1) {$ctx1.fill(self,"protocol",{},smalltalk.CompiledMethod)})}, args: [], source: "protocol\x0a\x09^ self category", messageSends: ["category"], referencedClasses: [] }), smalltalk.CompiledMethod); smalltalk.addMethod( smalltalk.method({ selector: "protocol:", category: 'accessing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._category_(aString); return self}, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString},smalltalk.CompiledMethod)})}, args: ["aString"], source: "protocol: aString\x0a\x09self category: aString", messageSends: ["category:"], referencedClasses: [] }), smalltalk.CompiledMethod); smalltalk.addMethod( smalltalk.method({ selector: "referencedClasses", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._basicAt_("referencedClasses"); return $1; }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},smalltalk.CompiledMethod)})}, args: [], source: "referencedClasses\x0a\x09^self basicAt: 'referencedClasses'", messageSends: ["basicAt:"], referencedClasses: [] }), smalltalk.CompiledMethod); smalltalk.addMethod( smalltalk.method({ selector: "selector", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._basicAt_("selector"); return $1; }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.CompiledMethod)})}, args: [], source: "selector\x0a\x09^self basicAt: 'selector'", messageSends: ["basicAt:"], referencedClasses: [] }), smalltalk.CompiledMethod); smalltalk.addMethod( smalltalk.method({ selector: "selector:", category: 'accessing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._basicAt_put_("selector",aString); return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.CompiledMethod)})}, args: ["aString"], source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString", messageSends: ["basicAt:put:"], referencedClasses: [] }), smalltalk.CompiledMethod); smalltalk.addMethod( smalltalk.method({ selector: "source", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=_st(self)._basicAt_("source"); if(($receiver = $2) == nil || $receiver == undefined){ $1=""; } else { $1=$2; }; return $1; }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.CompiledMethod)})}, args: [], source: "source\x0a\x09^(self basicAt: 'source') ifNil: ['']", messageSends: ["ifNil:", "basicAt:"], referencedClasses: [] }), smalltalk.CompiledMethod); smalltalk.addMethod( smalltalk.method({ selector: "source:", category: 'accessing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._basicAt_put_("source",aString); return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.CompiledMethod)})}, 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( smalltalk.method({ selector: "addWorker", category: 'private', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self["@worker"])._valueWithTimeout_((0)); self["@poolSize"]=_st(self["@poolSize"]).__plus((1)); return self}, function($ctx1) {$ctx1.fill(self,"addWorker",{},smalltalk.ForkPool)})}, args: [], source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1", messageSends: ["valueWithTimeout:", "+"], referencedClasses: [] }), smalltalk.ForkPool); smalltalk.addMethod( smalltalk.method({ selector: "defaultMaxPoolSize", category: 'defaults', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._class())._defaultMaxPoolSize(); return $1; }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},smalltalk.ForkPool)})}, args: [], source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize", messageSends: ["defaultMaxPoolSize", "class"], referencedClasses: [] }), smalltalk.ForkPool); smalltalk.addMethod( smalltalk.method({ selector: "fork:", category: 'actions', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self["@poolSize"]).__lt(_st(self)._maxPoolSize()); if(smalltalk.assert($1)){ _st(self)._addWorker(); }; _st(self["@queue"])._nextPut_(aBlock); return self}, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},smalltalk.ForkPool)})}, args: ["aBlock"], source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock", messageSends: ["ifTrue:", "addWorker", "<", "maxPoolSize", "nextPut:"], referencedClasses: [] }), smalltalk.ForkPool); smalltalk.addMethod( smalltalk.method({ selector: "initialize", category: 'initialization', fn: function (){ var self=this; function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)} return smalltalk.withContext(function($ctx1) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []); self["@poolSize"]=(0); self["@queue"]=_st($Queue())._new(); self["@worker"]=_st(self)._makeWorker(); return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ForkPool)})}, args: [], source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker", messageSends: ["initialize", "new", "makeWorker"], referencedClasses: ["Queue"] }), smalltalk.ForkPool); smalltalk.addMethod( smalltalk.method({ selector: "makeWorker", category: 'initialization', fn: function (){ var self=this; var sentinel; function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)} return smalltalk.withContext(function($ctx1) { var $2,$1; sentinel=_st($Object())._new(); $1=(function(){ var block; return smalltalk.withContext(function($ctx2) { self["@poolSize"]=_st(self["@poolSize"]).__minus((1)); self["@poolSize"]; block=_st(self["@queue"])._nextIfAbsent_((function(){ return smalltalk.withContext(function($ctx3) { return sentinel; }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})})); block; $2=_st(block).__eq_eq(sentinel); if(! smalltalk.assert($2)){ return _st((function(){ return smalltalk.withContext(function($ctx3) { return _st(block)._value(); }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._ensure_((function(){ return smalltalk.withContext(function($ctx3) { return _st(self)._addWorker(); }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})})); }; }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1)})}); return $1; }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},smalltalk.ForkPool)})}, args: [], source: "makeWorker\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09^[ | block |\x0a\x09\x09poolSize := poolSize - 1.\x0a\x09\x09block := queue nextIfAbsent: [ sentinel ].\x0a\x09\x09block == sentinel ifFalse: [\x0a\x09\x09\x09[ block value ] ensure: [ self addWorker ]]]", messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "ensure:", "addWorker", "value", "=="], referencedClasses: ["Object"] }), smalltalk.ForkPool); smalltalk.addMethod( smalltalk.method({ selector: "maxPoolSize", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=self["@maxPoolSize"]; if(($receiver = $2) == nil || $receiver == undefined){ $1=_st(self)._defaultMaxPoolSize(); } else { $1=$2; }; return $1; }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},smalltalk.ForkPool)})}, args: [], source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]", messageSends: ["ifNil:", "defaultMaxPoolSize"], referencedClasses: [] }), smalltalk.ForkPool); smalltalk.addMethod( smalltalk.method({ selector: "maxPoolSize:", category: 'accessing', fn: function (anInteger){ var self=this; return smalltalk.withContext(function($ctx1) { self["@maxPoolSize"]=anInteger; return self}, function($ctx1) {$ctx1.fill(self,"maxPoolSize:",{anInteger:anInteger},smalltalk.ForkPool)})}, args: ["anInteger"], source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger", messageSends: [], referencedClasses: [] }), smalltalk.ForkPool); smalltalk.ForkPool.klass.iVarNames = ['default']; smalltalk.addMethod( smalltalk.method({ selector: "default", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=self["@default"]; if(($receiver = $2) == nil || $receiver == undefined){ self["@default"]=_st(self)._new(); $1=self["@default"]; } else { $1=$2; }; return $1; }, function($ctx1) {$ctx1.fill(self,"default",{},smalltalk.ForkPool.klass)})}, args: [], source: "default\x0a\x09^default ifNil: [ default := self new ]", messageSends: ["ifNil:", "new"], referencedClasses: [] }), smalltalk.ForkPool.klass); smalltalk.addMethod( smalltalk.method({ selector: "defaultMaxPoolSize", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=(100); return $1; }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},smalltalk.ForkPool.klass)})}, args: [], source: "defaultMaxPoolSize\x0a\x09^100", messageSends: [], referencedClasses: [] }), smalltalk.ForkPool.klass); smalltalk.addMethod( smalltalk.method({ selector: "resetDefault", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { self["@default"]=nil; return self}, function($ctx1) {$ctx1.fill(self,"resetDefault",{},smalltalk.ForkPool.klass)})}, 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( smalltalk.method({ selector: "arguments", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@arguments"]; return $1; }, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.Message)})}, args: [], source: "arguments\x0a\x09^arguments", messageSends: [], referencedClasses: [] }), smalltalk.Message); smalltalk.addMethod( smalltalk.method({ selector: "arguments:", category: 'accessing', fn: function (anArray){ var self=this; return smalltalk.withContext(function($ctx1) { self["@arguments"]=anArray; return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{anArray:anArray},smalltalk.Message)})}, args: ["anArray"], source: "arguments: anArray\x0a\x09arguments := anArray", messageSends: [], referencedClasses: [] }), smalltalk.Message); smalltalk.addMethod( smalltalk.method({ selector: "printOn:", category: 'printing', fn: function (aStream){ var self=this; return smalltalk.withContext(function($ctx1) { var $1,$2; smalltalk.Object.fn.prototype._printOn_.apply(_st(self), [aStream]); $1=aStream; _st($1)._nextPutAll_("("); _st($1)._nextPutAll_(_st(self)._selector()); $2=_st($1)._nextPutAll_(")"); return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Message)})}, args: ["aStream"], source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'", messageSends: ["printOn:", "nextPutAll:", "selector"], referencedClasses: [] }), smalltalk.Message); smalltalk.addMethod( smalltalk.method({ selector: "selector", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@selector"]; return $1; }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.Message)})}, args: [], source: "selector\x0a\x09^selector", messageSends: [], referencedClasses: [] }), smalltalk.Message); smalltalk.addMethod( smalltalk.method({ selector: "selector:", category: 'accessing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { self["@selector"]=aString; return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.Message)})}, args: ["aString"], source: "selector: aString\x0a\x09selector := aString", messageSends: [], referencedClasses: [] }), smalltalk.Message); smalltalk.addMethod( smalltalk.method({ selector: "sendTo:", category: 'actions', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(anObject)._perform_withArguments_(_st(self)._selector(),_st(self)._arguments()); return $1; }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},smalltalk.Message)})}, args: ["anObject"], source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments", messageSends: ["perform:withArguments:", "selector", "arguments"], referencedClasses: [] }), smalltalk.Message); smalltalk.addMethod( smalltalk.method({ selector: "selector:arguments:", category: 'instance creation', fn: function (aString,anArray){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$3,$1; $2=_st(self)._new(); _st($2)._selector_(aString); _st($2)._arguments_(anArray); $3=_st($2)._yourself(); $1=$3; return $1; }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},smalltalk.Message.klass)})}, 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" smalltalk.addMethod( smalltalk.method({ selector: "asString", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=_st(self)._isBlockContext(); if(smalltalk.assert($2)){ $1=_st(_st("a block (in ").__comma(_st(_st(_st(_st(self)._methodContext())._receiver())._class())._printString())).__comma(")"); } else { $1=_st(_st(_st(_st(_st(self)._receiver())._class())._printString()).__comma(" >> ")).__comma(_st(self)._selector()); }; return $1; }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.MethodContext)})}, args: [], source: "asString\x0a\x09^self isBlockContext\x0a\x09\x09ifTrue: [ 'a block (in ', self methodContext receiver class printString, ')' ]\x0a\x09\x09ifFalse: [ self receiver class printString, ' >> ', self selector ]", messageSends: ["ifTrue:ifFalse:", ",", "printString", "class", "receiver", "methodContext", "selector", "isBlockContext"], referencedClasses: [] }), smalltalk.MethodContext); smalltalk.addMethod( smalltalk.method({ selector: "home", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.methodContext || self.homeContext; return self}, function($ctx1) {$ctx1.fill(self,"home",{},smalltalk.MethodContext)})}, args: [], source: "home\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.MethodContext); smalltalk.addMethod( smalltalk.method({ selector: "isBlockContext", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._selector())._isNil(); return $1; }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},smalltalk.MethodContext)})}, args: [], source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil", messageSends: ["isNil", "selector"], referencedClasses: [] }), smalltalk.MethodContext); smalltalk.addMethod( smalltalk.method({ selector: "locals", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.locals; return self}, function($ctx1) {$ctx1.fill(self,"locals",{},smalltalk.MethodContext)})}, args: [], source: "locals\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.MethodContext); smalltalk.addMethod( smalltalk.method({ selector: "method", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(_st(_st(self)._methodContext())._receiver())._class())._lookupSelector_(_st(_st(self)._methodContext())._selector()); return $1; }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.MethodContext)})}, args: [], source: "method\x0a\x09^self methodContext receiver class lookupSelector: self methodContext selector", messageSends: ["lookupSelector:", "selector", "methodContext", "class", "receiver"], referencedClasses: [] }), smalltalk.MethodContext); smalltalk.addMethod( smalltalk.method({ selector: "methodContext", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1,$2,$3; $1=_st(self)._isBlockContext(); if(! smalltalk.assert($1)){ $2=self; return $2; }; $3=_st(self)._home(); return $3; }, function($ctx1) {$ctx1.fill(self,"methodContext",{},smalltalk.MethodContext)})}, args: [], source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self home", messageSends: ["ifFalse:", "isBlockContext", "home"], referencedClasses: [] }), smalltalk.MethodContext); smalltalk.addMethod( smalltalk.method({ selector: "outerContext", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.homeContext; return self}, function($ctx1) {$ctx1.fill(self,"outerContext",{},smalltalk.MethodContext)})}, args: [], source: "outerContext\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.MethodContext); smalltalk.addMethod( smalltalk.method({ selector: "pc", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.pc; return self}, function($ctx1) {$ctx1.fill(self,"pc",{},smalltalk.MethodContext)})}, args: [], source: "pc\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.MethodContext); smalltalk.addMethod( smalltalk.method({ selector: "printOn:", category: 'printing', fn: function (aStream){ var self=this; return smalltalk.withContext(function($ctx1) { var $1,$2; smalltalk.Object.fn.prototype._printOn_.apply(_st(self), [aStream]); $1=aStream; _st($1)._nextPutAll_("("); _st($1)._nextPutAll_(_st(self)._asString()); $2=_st($1)._nextPutAll_(")"); return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.MethodContext)})}, args: ["aStream"], source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'", messageSends: ["printOn:", "nextPutAll:", "asString"], referencedClasses: [] }), smalltalk.MethodContext); smalltalk.addMethod( smalltalk.method({ selector: "receiver", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.receiver; return self}, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.MethodContext)})}, args: [], source: "receiver\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.MethodContext); smalltalk.addMethod( smalltalk.method({ selector: "selector", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { if(self.selector) { return smalltalk.convertSelector(self.selector); } else { return nil; } ; return self}, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.MethodContext)})}, args: [], source: "selector\x0a\x09<\x0a\x09\x09if(self.selector) {\x0a\x09\x09\x09return smalltalk.convertSelector(self.selector);\x0a\x09\x09} else {\x0a\x09\x09\x09return nil;\x0a\x09\x09}\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.MethodContext); smalltalk.addMethod( smalltalk.method({ selector: "temps", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; _st(self)._deprecatedAPI(); $1=_st(self)._locals(); return $1; }, function($ctx1) {$ctx1.fill(self,"temps",{},smalltalk.MethodContext)})}, args: [], source: "temps\x0a\x09self deprecatedAPI.\x0a\x09\x0a\x09^ self locals", messageSends: ["deprecatedAPI", "locals"], referencedClasses: [] }), smalltalk.MethodContext); smalltalk.addClass('NativeFunction', smalltalk.Object, [], 'Kernel-Methods'); smalltalk.NativeFunction.comment="NativeFunction is a wrapper around native functions, such as `WebSocket`.\x0aFor 'normal' functions (whose constructor is the JavaScript `Function` object), use `BlockClosure`.\x0a\x0aSee the class-side `instance creation` methods.\x0a\x0aCreated instances will most probably be instance of `JSObjectProxy`.\x0a\x0aUsage example:\x0a\x0a\x09| ws |\x0a\x09ws := NativeFunction constructor: 'WebSocket' value: 'ws://localhost'.\x0a\x09ws at: 'onopen' put: [ ws send: 'hey there from Amber' ]" smalltalk.addMethod( smalltalk.method({ selector: "constructor:", category: 'instance creation', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { var native=eval(aString); return new native(); ; return self}, function($ctx1) {$ctx1.fill(self,"constructor:",{aString:aString},smalltalk.NativeFunction.klass)})}, args: ["aString"], source: "constructor: aString\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native();\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.NativeFunction.klass); smalltalk.addMethod( smalltalk.method({ selector: "constructor:value:", category: 'instance creation', fn: function (aString,anObject){ var self=this; return smalltalk.withContext(function($ctx1) { var native=eval(aString); return new native(anObject); ; return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:",{aString:aString,anObject:anObject},smalltalk.NativeFunction.klass)})}, args: ["aString", "anObject"], source: "constructor: aString value:anObject\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native(anObject);\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.NativeFunction.klass); smalltalk.addMethod( smalltalk.method({ selector: "constructor:value:value:", category: 'instance creation', fn: function (aString,anObject,anObject2){ var self=this; return smalltalk.withContext(function($ctx1) { var native=eval(aString); return new native(anObject,anObject2); ; return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},smalltalk.NativeFunction.klass)})}, args: ["aString", "anObject", "anObject2"], source: "constructor: aString value:anObject value: anObject2\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native(anObject,anObject2);\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.NativeFunction.klass); smalltalk.addMethod( smalltalk.method({ selector: "constructor:value:value:value:", category: 'instance creation', fn: function (aString,anObject,anObject2,anObject3){ var self=this; return smalltalk.withContext(function($ctx1) { var native=eval(aString); return new native(anObject,anObject2, anObject3); ; return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},smalltalk.NativeFunction.klass)})}, args: ["aString", "anObject", "anObject2", "anObject3"], source: "constructor: aString value:anObject value: anObject2 value:anObject3\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native(anObject,anObject2, anObject3);\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.NativeFunction.klass); smalltalk.addMethod( smalltalk.method({ selector: "exists:", category: 'testing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { if(aString in window) { return true } else { return false } ; return self}, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},smalltalk.NativeFunction.klass)})}, args: ["aString"], source: "exists: aString\x0a\x09<\x0a\x09\x09if(aString in window) {\x0a\x09\x09\x09return true\x0a\x09\x09} else {\x0a\x09\x09\x09return false\x0a\x09\x09}\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.NativeFunction.klass); smalltalk.addPackage('Kernel-Collections'); smalltalk.addClass('Association', smalltalk.Object, ['key', 'value'], 'Kernel-Collections'); smalltalk.Association.comment="I represent a pair of associated objects, a key and a value. My instances can serve as entries in a dictionary.\x0a\x0aInstances can be created with the class-side method `#key:value:`" smalltalk.addMethod( smalltalk.method({ selector: "=", category: 'comparing', fn: function (anAssociation){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(_st(self)._class()).__eq(_st(anAssociation)._class()))._and_((function(){ return smalltalk.withContext(function($ctx2) { return _st(_st(_st(self)._key()).__eq(_st(anAssociation)._key()))._and_((function(){ return smalltalk.withContext(function($ctx3) { return _st(_st(self)._value()).__eq(_st(anAssociation)._value()); }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})})); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},smalltalk.Association)})}, args: ["anAssociation"], source: "= anAssociation\x0a\x09^self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value]]", messageSends: ["and:", "=", "value", "key", "class"], referencedClasses: [] }), smalltalk.Association); smalltalk.addMethod( smalltalk.method({ selector: "key", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@key"]; return $1; }, function($ctx1) {$ctx1.fill(self,"key",{},smalltalk.Association)})}, args: [], source: "key\x0a\x09^key", messageSends: [], referencedClasses: [] }), smalltalk.Association); smalltalk.addMethod( smalltalk.method({ selector: "key:", category: 'accessing', fn: function (aKey){ var self=this; return smalltalk.withContext(function($ctx1) { self["@key"]=aKey; return self}, function($ctx1) {$ctx1.fill(self,"key:",{aKey:aKey},smalltalk.Association)})}, args: ["aKey"], source: "key: aKey\x0a\x09key := aKey", messageSends: [], referencedClasses: [] }), smalltalk.Association); smalltalk.addMethod( smalltalk.method({ selector: "printOn:", category: 'printing', fn: function (aStream){ var self=this; return smalltalk.withContext(function($ctx1) { _st(_st(self)._key())._printOn_(aStream); _st(aStream)._nextPutAll_(" -> "); _st(_st(self)._value())._printOn_(aStream); return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Association)})}, args: ["aStream"], source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream", messageSends: ["printOn:", "key", "nextPutAll:", "value"], referencedClasses: [] }), smalltalk.Association); smalltalk.addMethod( smalltalk.method({ selector: "value", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@value"]; return $1; }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.Association)})}, args: [], source: "value\x0a\x09^value", messageSends: [], referencedClasses: [] }), smalltalk.Association); smalltalk.addMethod( smalltalk.method({ selector: "value:", category: 'accessing', fn: function (aValue){ var self=this; return smalltalk.withContext(function($ctx1) { self["@value"]=aValue; return self}, function($ctx1) {$ctx1.fill(self,"value:",{aValue:aValue},smalltalk.Association)})}, args: ["aValue"], source: "value: aValue\x0a\x09value := aValue", messageSends: [], referencedClasses: [] }), smalltalk.Association); smalltalk.addMethod( smalltalk.method({ selector: "key:value:", category: 'instance creation', fn: function (aKey,aValue){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$3,$1; $2=_st(self)._new(); _st($2)._key_(aKey); _st($2)._value_(aValue); $3=_st($2)._yourself(); $1=$3; return $1; }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},smalltalk.Association.klass)})}, args: ["aKey", "aValue"], source: "key: aKey value: aValue\x0a\x09\x09^self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself", messageSends: ["key:", "new", "value:", "yourself"], referencedClasses: [] }), smalltalk.Association.klass); smalltalk.addClass('Collection', smalltalk.Object, [], 'Kernel-Collections'); smalltalk.Collection.comment="I am the abstract superclass of all classes that represent a group of elements.\x0a\x0aI provide a set of useful methods to the Collectiohn hierarchy such as enumerating and converting methods." smalltalk.addMethod( smalltalk.method({ selector: ",", category: 'copying', fn: function (aCollection){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$3,$1; $2=_st(self)._copy(); _st($2)._addAll_(aCollection); $3=_st($2)._yourself(); $1=$3; return $1; }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},smalltalk.Collection)})}, args: ["aCollection"], source: ", aCollection\x0a\x09^self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself", messageSends: ["addAll:", "copy", "yourself"], referencedClasses: [] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "add:", category: 'adding/removing', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility(); return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},smalltalk.Collection)})}, args: ["anObject"], source: "add: anObject\x0a\x09self subclassResponsibility", messageSends: ["subclassResponsibility"], referencedClasses: [] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "addAll:", category: 'adding/removing', fn: function (aCollection){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; _st(aCollection)._do_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(self)._add_(each); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); $1=aCollection; return $1; }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},smalltalk.Collection)})}, args: ["aCollection"], source: "addAll: aCollection\x0a\x09aCollection do: [:each |\x0a\x09\x09self add: each].\x0a\x09^aCollection", messageSends: ["do:", "add:"], referencedClasses: [] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "asArray", category: 'converting', fn: function (){ var self=this; function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st($Array())._withAll_(self); return $1; }, function($ctx1) {$ctx1.fill(self,"asArray",{},smalltalk.Collection)})}, args: [], source: "asArray\x0a\x09^Array withAll: self", messageSends: ["withAll:"], referencedClasses: ["Array"] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "asJSON", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._asArray())._collect_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(each)._asJSON(); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.Collection)})}, args: [], source: "asJSON\x0a\x09^self asArray collect: [:each | each asJSON]", messageSends: ["collect:", "asJSON", "asArray"], referencedClasses: [] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "asOrderedCollection", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._asArray(); return $1; }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},smalltalk.Collection)})}, args: [], source: "asOrderedCollection\x0a\x09^self asArray", messageSends: ["asArray"], referencedClasses: [] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "asSet", category: 'converting', fn: function (){ var self=this; function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st($Set())._withAll_(self); return $1; }, function($ctx1) {$ctx1.fill(self,"asSet",{},smalltalk.Collection)})}, args: [], source: "asSet\x0a\x09^Set withAll: self", messageSends: ["withAll:"], referencedClasses: ["Set"] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "collect:", category: 'enumerating', fn: function (aBlock){ var self=this; var stream; return smalltalk.withContext(function($ctx1) { var $1; stream=_st(_st(_st(self)._class())._new())._writeStream(); _st(self)._do_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(stream)._nextPut_(_st(aBlock)._value_(each)); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); $1=_st(stream)._contents(); return $1; }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},smalltalk.Collection)})}, args: ["aBlock"], source: "collect: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09stream nextPut: (aBlock value: each) ].\x0a\x09^stream contents", messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"], referencedClasses: [] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "copyWith:", category: 'copying', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$3,$1; $2=_st(self)._copy(); _st($2)._add_(anObject); $3=_st($2)._yourself(); $1=$3; return $1; }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},smalltalk.Collection)})}, args: ["anObject"], source: "copyWith: anObject\x0a\x09^self copy add: anObject; yourself", messageSends: ["add:", "copy", "yourself"], referencedClasses: [] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "copyWithAll:", category: 'copying', fn: function (aCollection){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$3,$1; $2=_st(self)._copy(); _st($2)._addAll_(aCollection); $3=_st($2)._yourself(); $1=$3; return $1; }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},smalltalk.Collection)})}, args: ["aCollection"], source: "copyWithAll: aCollection\x0a\x09^self copy addAll: aCollection; yourself", messageSends: ["addAll:", "copy", "yourself"], referencedClasses: [] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "copyWithoutAll:", category: 'copying', fn: function (aCollection){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._reject_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(aCollection)._includes_(each); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},smalltalk.Collection)})}, args: ["aCollection"], source: "copyWithoutAll: aCollection\x0a\x09\x22Answer a copy of the receiver that does not contain any elements\x0a\x09equal to those in aCollection.\x22\x0a\x0a\x09^ self reject: [:each | aCollection includes: each]", messageSends: ["reject:", "includes:"], referencedClasses: [] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "detect:", category: 'enumerating', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._detect_ifNone_(aBlock,(function(){ return smalltalk.withContext(function($ctx2) { return _st(self)._errorNotFound(); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},smalltalk.Collection)})}, args: ["aBlock"], source: "detect: aBlock\x0a\x09^self detect: aBlock ifNone: [self errorNotFound]", messageSends: ["detect:ifNone:", "errorNotFound"], referencedClasses: [] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "detect:ifNone:", category: 'enumerating', fn: function (aBlock,anotherBlock){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility(); return self}, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Collection)})}, args: ["aBlock", "anotherBlock"], source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility", messageSends: ["subclassResponsibility"], referencedClasses: [] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "do:", category: 'enumerating', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility(); return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.Collection)})}, args: ["aBlock"], source: "do: aBlock\x0a\x09self subclassResponsibility", messageSends: ["subclassResponsibility"], referencedClasses: [] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "do:separatedBy:", category: 'enumerating', fn: function (aBlock,anotherBlock){ var self=this; var actionBeforeElement; return smalltalk.withContext(function($ctx1) { actionBeforeElement=(function(){ return smalltalk.withContext(function($ctx2) { actionBeforeElement=anotherBlock; return actionBeforeElement; }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}); _st(self)._do_((function(each){ return smalltalk.withContext(function($ctx2) { _st(actionBeforeElement)._value(); return _st(aBlock)._value_(each); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},smalltalk.Collection)})}, args: ["aBlock", "anotherBlock"], source: "do: aBlock separatedBy: anotherBlock\x0a\x09| actionBeforeElement |\x0a\x09actionBeforeElement := [actionBeforeElement := anotherBlock].\x0a\x09self do: [:each |\x0a\x09\x09actionBeforeElement value.\x0a\x09\x09aBlock value: each]", messageSends: ["do:", "value", "value:"], referencedClasses: [] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "errorNotFound", category: 'error handling', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._error_("Object is not in the collection"); return self}, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},smalltalk.Collection)})}, args: [], source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'", messageSends: ["error:"], referencedClasses: [] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "ifEmpty:", category: 'testing', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=_st(self)._isEmpty(); if(smalltalk.assert($2)){ $1=_st(aBlock)._value(); } else { $1=self; }; return $1; }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},smalltalk.Collection)})}, args: ["aBlock"], source: "ifEmpty: aBlock\x0a\x09\x22Evaluate the given block with the receiver as argument, answering its value if the receiver is empty, otherwise answer the receiver. Note that the fact that this method returns its argument in case the receiver is not empty allows one to write expressions like the following ones: self classifyMethodAs:\x0a\x09\x09(myProtocol ifEmpty: ['As yet unclassified'])\x22\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: [ aBlock value ]\x0a\x09\x09ifFalse: [ self ]", messageSends: ["ifTrue:ifFalse:", "value", "isEmpty"], referencedClasses: [] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "ifNotEmpty:", category: 'testing', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._notEmpty(); _st($1)._ifTrue_(aBlock); return self}, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},smalltalk.Collection)})}, args: ["aBlock"], source: "ifNotEmpty: aBlock\x0a\x09self notEmpty ifTrue: aBlock.", messageSends: ["ifTrue:", "notEmpty"], referencedClasses: [] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "includes:", category: 'testing', fn: function (anObject){ var self=this; var sentinel; function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)} return smalltalk.withContext(function($ctx1) { var $1; sentinel=_st($Object())._new(); $1=_st(_st(self)._detect_ifNone_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(each).__eq(anObject); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){ return smalltalk.withContext(function($ctx2) { return sentinel; }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__tild_eq(sentinel); return $1; }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,sentinel:sentinel},smalltalk.Collection)})}, args: ["anObject"], source: "includes: anObject\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09^(self detect: [ :each | each = anObject] ifNone: [ sentinel ]) ~= sentinel", messageSends: ["new", "~=", "detect:ifNone:", "="], referencedClasses: ["Object"] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "inject:into:", category: 'enumerating', fn: function (anObject,aBlock){ var self=this; var result; return smalltalk.withContext(function($ctx1) { var $1; result=anObject; _st(self)._do_((function(each){ return smalltalk.withContext(function($ctx2) { result=_st(aBlock)._value_value_(result,each); return result; }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); $1=result; return $1; }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},smalltalk.Collection)})}, args: ["anObject", "aBlock"], source: "inject: anObject into: aBlock\x0a\x09| result |\x0a\x09result := anObject.\x0a\x09self do: [:each |\x0a\x09\x09result := aBlock value: result value: each].\x0a\x09^result", messageSends: ["do:", "value:value:"], referencedClasses: [] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "intersection:", category: 'enumerating', fn: function (aCollection){ var self=this; var set,outputSet; function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)} return smalltalk.withContext(function($ctx1) { var $1,$2; set=_st(self)._asSet(); outputSet=_st($Set())._new(); _st(aCollection)._do_((function(each){ return smalltalk.withContext(function($ctx2) { $1=_st(_st(set)._includes_(each))._and_((function(){ return smalltalk.withContext(function($ctx3) { return _st(_st(outputSet)._includes_(each))._not(); }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})})); if(smalltalk.assert($1)){ return _st(outputSet)._add_(each); }; }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); $2=_st(_st(self)._class())._withAll_(_st(outputSet)._asArray()); return $2; }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},smalltalk.Collection)})}, args: ["aCollection"], source: "intersection: aCollection\x0a\x09\x22Answer the set theoretic intersection of two collections.\x22\x0a\x0a\x09| set outputSet |\x0a\x09\x0a\x09set := self asSet.\x0a\x09outputSet := Set new.\x0a\x09\x0a\x09aCollection do: [ :each |\x0a\x09\x09((set includes: each) and: [(outputSet includes: each) not])\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09outputSet add: each]].\x0a\x09\x09\x0a\x09^ self class withAll: outputSet asArray", messageSends: ["asSet", "new", "do:", "ifTrue:", "add:", "and:", "not", "includes:", "withAll:", "asArray", "class"], referencedClasses: ["Set"] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "isEmpty", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._size()).__eq((0)); return $1; }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},smalltalk.Collection)})}, args: [], source: "isEmpty\x0a\x09^self size = 0", messageSends: ["=", "size"], referencedClasses: [] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "notEmpty", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._isEmpty())._not(); return $1; }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},smalltalk.Collection)})}, args: [], source: "notEmpty\x0a\x09^self isEmpty not", messageSends: ["not", "isEmpty"], referencedClasses: [] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "occurrencesOf:", category: 'accessing', fn: function (anObject){ var self=this; var tally; return smalltalk.withContext(function($ctx1) { var $1,$2; tally=(0); _st(self)._do_((function(each){ return smalltalk.withContext(function($ctx2) { $1=_st(anObject).__eq(each); if(smalltalk.assert($1)){ tally=_st(tally).__plus((1)); return tally; }; }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); $2=tally; return $2; }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},smalltalk.Collection)})}, args: ["anObject"], source: "occurrencesOf: anObject\x0a\x09\x22Answer how many of the receiver's elements are equal to anObject.\x22\x0a\x0a\x09| tally |\x0a\x09tally := 0.\x0a\x09self do: [:each | anObject = each ifTrue: [tally := tally + 1]].\x0a\x09^tally", messageSends: ["do:", "ifTrue:", "+", "="], referencedClasses: [] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "putOn:", category: 'streaming', fn: function (aStream){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._do_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(each)._putOn_(aStream); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},smalltalk.Collection)})}, args: ["aStream"], source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]", messageSends: ["do:", "putOn:"], referencedClasses: [] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "reject:", category: 'enumerating', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._select_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(_st(aBlock)._value_(each)).__eq(false); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},smalltalk.Collection)})}, args: ["aBlock"], source: "reject: aBlock\x0a\x09^self select: [:each | (aBlock value: each) = false]", messageSends: ["select:", "=", "value:"], referencedClasses: [] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "remove:", category: 'adding/removing', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._remove_ifAbsent_(anObject,(function(){ return smalltalk.withContext(function($ctx2) { return _st(self)._errorNotFound(); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},smalltalk.Collection)})}, args: ["anObject"], source: "remove: anObject\x0a\x09^self remove: anObject ifAbsent: [self errorNotFound]", messageSends: ["remove:ifAbsent:", "errorNotFound"], referencedClasses: [] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "remove:ifAbsent:", category: 'adding/removing', fn: function (anObject,aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility(); return self}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.Collection)})}, args: ["anObject", "aBlock"], source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility", messageSends: ["subclassResponsibility"], referencedClasses: [] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "select:", category: 'enumerating', fn: function (aBlock){ var self=this; var stream; return smalltalk.withContext(function($ctx1) { var $1,$2; stream=_st(_st(_st(self)._class())._new())._writeStream(); _st(self)._do_((function(each){ return smalltalk.withContext(function($ctx2) { $1=_st(aBlock)._value_(each); if(smalltalk.assert($1)){ return _st(stream)._nextPut_(each); }; }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); $2=_st(stream)._contents(); return $2; }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},smalltalk.Collection)})}, args: ["aBlock"], source: "select: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [:each |\x0a\x09\x09(aBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: each]].\x0a\x09^stream contents", messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "nextPut:", "value:", "contents"], referencedClasses: [] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "size", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility(); return self}, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Collection)})}, args: [], source: "size\x0a\x09self subclassResponsibility", messageSends: ["subclassResponsibility"], referencedClasses: [] }), smalltalk.Collection); smalltalk.addMethod( smalltalk.method({ selector: "new:", category: 'instance creation', fn: function (anInteger){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._new(); return $1; }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},smalltalk.Collection.klass)})}, args: ["anInteger"], source: "new: anInteger\x0a\x09^self new", messageSends: ["new"], referencedClasses: [] }), smalltalk.Collection.klass); smalltalk.addMethod( smalltalk.method({ selector: "with:", category: 'instance creation', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$3,$1; $2=_st(self)._new(); _st($2)._add_(anObject); $3=_st($2)._yourself(); $1=$3; return $1; }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},smalltalk.Collection.klass)})}, args: ["anObject"], source: "with: anObject\x0a\x09\x09^self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself", messageSends: ["add:", "new", "yourself"], referencedClasses: [] }), smalltalk.Collection.klass); smalltalk.addMethod( smalltalk.method({ selector: "with:with:", category: 'instance creation', fn: function (anObject,anotherObject){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$3,$1; $2=_st(self)._new(); _st($2)._add_(anObject); _st($2)._add_(anotherObject); $3=_st($2)._yourself(); $1=$3; return $1; }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},smalltalk.Collection.klass)})}, args: ["anObject", "anotherObject"], source: "with: anObject with: anotherObject\x0a\x09\x09^self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself", messageSends: ["add:", "new", "yourself"], referencedClasses: [] }), smalltalk.Collection.klass); smalltalk.addMethod( smalltalk.method({ selector: "with:with:with:", category: 'instance creation', fn: function (firstObject,secondObject,thirdObject){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$3,$1; $2=_st(self)._new(); _st($2)._add_(firstObject); _st($2)._add_(secondObject); _st($2)._add_(thirdObject); $3=_st($2)._yourself(); $1=$3; return $1; }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},smalltalk.Collection.klass)})}, args: ["firstObject", "secondObject", "thirdObject"], source: "with: firstObject with: secondObject with: thirdObject\x0a\x09\x09^self new\x0a\x09\x09add: firstObject;\x0a\x09\x09add: secondObject;\x0a\x09\x09add: thirdObject;\x0a\x09\x09yourself", messageSends: ["add:", "new", "yourself"], referencedClasses: [] }), smalltalk.Collection.klass); smalltalk.addMethod( smalltalk.method({ selector: "withAll:", category: 'instance creation', fn: function (aCollection){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$3,$1; $2=_st(self)._new(); _st($2)._addAll_(aCollection); $3=_st($2)._yourself(); $1=$3; return $1; }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},smalltalk.Collection.klass)})}, args: ["aCollection"], source: "withAll: aCollection\x0a\x09\x09^self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself", messageSends: ["addAll:", "new", "yourself"], referencedClasses: [] }), smalltalk.Collection.klass); smalltalk.addClass('IndexableCollection', smalltalk.Collection, [], 'Kernel-Collections'); smalltalk.IndexableCollection.comment="I am a key-value store, that is,\x0ait stores values under indexes.\x0a\x0aAs a rule of thumb, if a collection has at: and at:put:,\x0ait is an IndexableCollection." smalltalk.addMethod( smalltalk.method({ selector: "at:", category: 'accessing', fn: function (anIndex){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._at_ifAbsent_(anIndex,(function(){ return smalltalk.withContext(function($ctx2) { return _st(self)._errorNotFound(); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},smalltalk.IndexableCollection)})}, args: ["anIndex"], source: "at: anIndex\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, raise an error.\x22\x0a\x0a\x09^self at: anIndex ifAbsent: [ self errorNotFound ]", messageSends: ["at:ifAbsent:", "errorNotFound"], referencedClasses: [] }), smalltalk.IndexableCollection); smalltalk.addMethod( smalltalk.method({ selector: "at:ifAbsent:", category: 'accessing', fn: function (anIndex,aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._subclassReponsibility(); return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},smalltalk.IndexableCollection)})}, args: ["anIndex", "aBlock"], source: "at: anIndex ifAbsent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, answer the value of aBlock.\x22\x0a\x0a\x09self subclassReponsibility", messageSends: ["subclassReponsibility"], referencedClasses: [] }), smalltalk.IndexableCollection); smalltalk.addMethod( smalltalk.method({ selector: "at:ifPresent:", category: 'accessing', fn: function (anIndex,aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){ return smalltalk.withContext(function($ctx2) { return nil; }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},smalltalk.IndexableCollection)})}, args: ["anIndex", "aBlock"], source: "at: anIndex ifPresent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value of evaluating aBlock with the value stored at anIndex.\x0a\x09Otherwise, answer nil.\x22\x0a\x0a\x09^self at: anIndex ifPresent: aBlock ifAbsent: [ nil ]", messageSends: ["at:ifPresent:ifAbsent:"], referencedClasses: [] }), smalltalk.IndexableCollection); smalltalk.addMethod( smalltalk.method({ selector: "at:ifPresent:ifAbsent:", category: 'accessing', fn: function (anIndex,aBlock,anotherBlock){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._subclassReponsibility(); return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.IndexableCollection)})}, args: ["anIndex", "aBlock", "anotherBlock"], source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value of evaluating aBlock with the value stored at anIndex.\x0a\x09Otherwise, answer the value of anotherBlock.\x22\x0a\x0a\x09self subclassReponsibility", messageSends: ["subclassReponsibility"], referencedClasses: [] }), smalltalk.IndexableCollection); smalltalk.addMethod( smalltalk.method({ selector: "at:put:", category: 'accessing', fn: function (anIndex,anObject){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._subclassReponsibility(); return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},smalltalk.IndexableCollection)})}, args: ["anIndex", "anObject"], source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassReponsibility", messageSends: ["subclassReponsibility"], referencedClasses: [] }), smalltalk.IndexableCollection); smalltalk.addMethod( smalltalk.method({ selector: "indexOf:", category: 'accessing', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._indexOf_ifAbsent_(anObject,(function(){ return smalltalk.withContext(function($ctx2) { return _st(self)._errorNotFound(); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},smalltalk.IndexableCollection)})}, args: ["anObject"], source: "indexOf: anObject\x0a\x09\x22Lookup index at which anObject is stored in the receiver.\x0a\x09If not present, raise an error.\x22\x0a\x0a\x09^self indexOf: anObject ifAbsent: [ self errorNotFound ]", messageSends: ["indexOf:ifAbsent:", "errorNotFound"], referencedClasses: [] }), smalltalk.IndexableCollection); smalltalk.addMethod( smalltalk.method({ selector: "indexOf:ifAbsent:", category: 'accessing', fn: function (anObject,aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility(); return self}, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.IndexableCollection)})}, args: ["anObject", "aBlock"], source: "indexOf: anObject ifAbsent: aBlock\x0a\x09\x22Lookup index at which anObject is stored in the receiver.\x0a\x09If not present, return value of executing aBlock.\x22\x0a\x0a\x09self subclassResponsibility", messageSends: ["subclassResponsibility"], referencedClasses: [] }), smalltalk.IndexableCollection); smalltalk.addMethod( smalltalk.method({ selector: "with:do:", category: 'enumarating', fn: function (anotherCollection,aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._withIndexDo_((function(each,index){ return smalltalk.withContext(function($ctx2) { return _st(aBlock)._value_value_(each,_st(anotherCollection)._at_(index)); }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},smalltalk.IndexableCollection)})}, args: ["anotherCollection", "aBlock"], source: "with: anotherCollection do: aBlock\x0a\x09\x22Calls aBlock with every value from self\x0a\x09and with indetically-indexed value from anotherCollection\x22\x0a\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09aBlock value: each value: (anotherCollection at: index) ]", messageSends: ["withIndexDo:", "value:value:", "at:"], referencedClasses: [] }), smalltalk.IndexableCollection); smalltalk.addMethod( smalltalk.method({ selector: "withIndexDo:", category: 'enumarating', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._subclassReponsibility(); return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},smalltalk.IndexableCollection)})}, args: ["aBlock"], source: "withIndexDo: aBlock\x0a\x09\x22Calls aBlock with every value from self\x0a\x09and with its index as the second argument\x22\x0a\x0a\x09self subclassReponsibility", messageSends: ["subclassReponsibility"], referencedClasses: [] }), smalltalk.IndexableCollection); smalltalk.addClass('HashedCollection', smalltalk.IndexableCollection, [], 'Kernel-Collections'); smalltalk.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, it can only have strings as keys." smalltalk.addMethod( smalltalk.method({ selector: ",", category: 'copying', fn: function (aCollection){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._shouldNotImplement(); return self}, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},smalltalk.HashedCollection)})}, args: ["aCollection"], source: ", aCollection\x0a\x09self shouldNotImplement", messageSends: ["shouldNotImplement"], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "=", category: 'comparing', fn: function (aHashedCollection){ var self=this; return smalltalk.withContext(function($ctx1) { var $1,$2,$3; $1=_st(_st(self)._class()).__eq(_st(aHashedCollection)._class()); if(! smalltalk.assert($1)){ return false; }; $2=_st(_st(self)._size()).__eq(_st(aHashedCollection)._size()); if(! smalltalk.assert($2)){ return false; }; $3=_st(_st(self)._associations()).__eq(_st(aHashedCollection)._associations()); return $3; }, function($ctx1) {$ctx1.fill(self,"=",{aHashedCollection:aHashedCollection},smalltalk.HashedCollection)})}, args: ["aHashedCollection"], source: "= aHashedCollection\x0a\x09self class = aHashedCollection class ifFalse: [^false].\x0a\x09self size = aHashedCollection size ifFalse: [^false].\x0a\x09^self associations = aHashedCollection associations", messageSends: ["ifFalse:", "=", "class", "size", "associations"], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "add:", category: 'adding/removing', fn: function (anAssociation){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._at_put_(_st(anAssociation)._key(),_st(anAssociation)._value()); return self}, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},smalltalk.HashedCollection)})}, args: ["anAssociation"], source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value", messageSends: ["at:put:", "key", "value"], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "addAll:", category: 'adding/removing', fn: function (aHashedCollection){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; smalltalk.IndexableCollection.fn.prototype._addAll_.apply(_st(self), [_st(aHashedCollection)._associations()]); $1=aHashedCollection; return $1; }, function($ctx1) {$ctx1.fill(self,"addAll:",{aHashedCollection:aHashedCollection},smalltalk.HashedCollection)})}, args: ["aHashedCollection"], source: "addAll: aHashedCollection\x0a\x09super addAll: aHashedCollection associations.\x0a\x09^aHashedCollection", messageSends: ["addAll:", "associations"], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "asDictionary", category: 'converting', fn: function (){ var self=this; function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st($Dictionary())._fromPairs_(_st(self)._associations()); return $1; }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},smalltalk.HashedCollection)})}, args: [], source: "asDictionary\x0a\x09^Dictionary fromPairs: self associations", messageSends: ["fromPairs:", "associations"], referencedClasses: ["Dictionary"] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "asJSON", category: 'converting', fn: function (){ var self=this; var c; return smalltalk.withContext(function($ctx1) { var $1; c=_st(_st(self)._class())._new(); _st(self)._keysAndValuesDo_((function(key,value){ return smalltalk.withContext(function($ctx2) { return _st(c)._at_put_(key,_st(value)._asJSON()); }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})})); $1=c; return $1; }, function($ctx1) {$ctx1.fill(self,"asJSON",{c:c},smalltalk.HashedCollection)})}, args: [], source: "asJSON\x0a\x09| c |\x0a\x09c := self class new.\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09\x09c at: key put: value asJSON].\x0a\x09^c", messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "asJSON"], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "associations", category: 'accessing', fn: function (){ var self=this; var associations; return smalltalk.withContext(function($ctx1) { var $1; associations=[]; _st(self)._associationsDo_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(associations)._add_(each); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); $1=associations; return $1; }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},smalltalk.HashedCollection)})}, args: [], source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [:each | associations add: each].\x0a\x09^associations", messageSends: ["associationsDo:", "add:"], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "associationsDo:", category: 'enumerating', fn: function (aBlock){ var self=this; function $Association(){return smalltalk.Association||(typeof Association=="undefined"?nil:Association)} return smalltalk.withContext(function($ctx1) { _st(self)._keysAndValuesDo_((function(key,value){ return smalltalk.withContext(function($ctx2) { return _st(aBlock)._value_(_st($Association())._key_value_(key,value)); }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},smalltalk.HashedCollection)})}, args: ["aBlock"], source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09\x09aBlock value: (Association key: key value: value)]", messageSends: ["keysAndValuesDo:", "value:", "key:value:"], referencedClasses: ["Association"] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "at:ifAbsent:", category: 'accessing', fn: function (aKey,aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=_st(self)._includesKey_(aKey); $1=_st($2)._ifTrue_ifFalse_((function(){ return smalltalk.withContext(function($ctx2) { return _st(self)._basicAt_(aKey); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),aBlock); return $1; }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.HashedCollection)})}, args: ["aKey", "aBlock"], source: "at: aKey ifAbsent: aBlock\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifTrue: [self basicAt: aKey]\x0a\x09\x09ifFalse: aBlock", messageSends: ["ifTrue:ifFalse:", "basicAt:", "includesKey:"], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "at:ifAbsentPut:", category: 'accessing', fn: function (aKey,aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._at_ifAbsent_(aKey,(function(){ return smalltalk.withContext(function($ctx2) { return _st(self)._at_put_(aKey,_st(aBlock)._value()); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},smalltalk.HashedCollection)})}, args: ["aKey", "aBlock"], source: "at: aKey ifAbsentPut: aBlock\x0a\x09^self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value]", messageSends: ["at:ifAbsent:", "at:put:", "value"], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "at:ifPresent:ifAbsent:", category: 'accessing', fn: function (aKey,aBlock,anotherBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=_st(self)._includesKey_(aKey); $1=_st($2)._ifTrue_ifFalse_((function(){ return smalltalk.withContext(function($ctx2) { return _st(aBlock)._value_(_st(self)._at_(aKey)); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),anotherBlock); return $1; }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.HashedCollection)})}, args: ["aKey", "aBlock", "anotherBlock"], source: "at: aKey ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22Lookup the given key in the receiver.\x0a\x09If it is present, answer the value of evaluating the oneArgBlock with the value associated with the key,\x0a\x09otherwise answer the value of absentBlock.\x22\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifTrue: [ aBlock value: (self at: aKey) ]\x0a\x09\x09ifFalse: anotherBlock", messageSends: ["ifTrue:ifFalse:", "value:", "at:", "includesKey:"], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "at:put:", category: 'accessing', fn: function (aKey,aValue){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._basicAt_put_(aKey,aValue); return $1; }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},smalltalk.HashedCollection)})}, args: ["aKey", "aValue"], source: "at: aKey put: aValue\x0a\x09^self basicAt: aKey put: aValue", messageSends: ["basicAt:put:"], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "collect:", category: 'enumerating', fn: function (aBlock){ var self=this; var newDict; return smalltalk.withContext(function($ctx1) { var $1; newDict=_st(_st(self)._class())._new(); _st(self)._keysAndValuesDo_((function(key,value){ return smalltalk.withContext(function($ctx2) { return _st(newDict)._at_put_(key,_st(aBlock)._value_(value)); }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})})); $1=newDict; return $1; }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},smalltalk.HashedCollection)})}, args: ["aBlock"], source: "collect: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09\x09newDict at: key put: (aBlock value: value)].\x0a\x09^newDict", messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "deepCopy", category: 'copying', fn: function (){ var self=this; var copy; return smalltalk.withContext(function($ctx1) { var $1; copy=_st(_st(self)._class())._new(); _st(self)._keysAndValuesDo_((function(key,value){ return smalltalk.withContext(function($ctx2) { return _st(copy)._at_put_(key,_st(value)._deepCopy()); }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})})); $1=copy; return $1; }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},smalltalk.HashedCollection)})}, args: [], source: "deepCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09\x09copy at: key put: value deepCopy].\x0a\x09^copy", messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "detect:ifNone:", category: 'enumerating', fn: function (aBlock,anotherBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._values())._detect_ifNone_(aBlock,anotherBlock); return $1; }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.HashedCollection)})}, args: ["aBlock", "anotherBlock"], source: "detect: aBlock ifNone: anotherBlock\x0a\x09^self values detect: aBlock ifNone: anotherBlock", messageSends: ["detect:ifNone:", "values"], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "do:", category: 'enumerating', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._valuesDo_(aBlock); return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.HashedCollection)})}, args: ["aBlock"], source: "do: aBlock\x0a\x09self valuesDo: aBlock", messageSends: ["valuesDo:"], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "includes:", category: 'enumerating', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._values())._includes_(anObject); return $1; }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},smalltalk.HashedCollection)})}, args: ["anObject"], source: "includes: anObject\x0a\x09^self values includes: anObject", messageSends: ["includes:", "values"], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "includesKey:", category: 'testing', fn: function (aKey){ var self=this; return smalltalk.withContext(function($ctx1) { return self.hasOwnProperty(aKey); return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},smalltalk.HashedCollection)})}, args: ["aKey"], source: "includesKey: aKey\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "indexOf:ifAbsent:", category: 'accessing', fn: function (anObject,aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._keys())._detect_ifNone_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(_st(self)._at_(each)).__eq(anObject); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),aBlock); return $1; }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.HashedCollection)})}, args: ["anObject", "aBlock"], source: "indexOf: anObject ifAbsent: aBlock\x0a\x0a\x09^ self keys detect: [ :each | (self at: each) = anObject ] ifNone: aBlock", messageSends: ["detect:ifNone:", "=", "at:", "keys"], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "keys", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { if ('function'===typeof Object.keys) return Object.keys(self); var keys = []; for(var i in self) { if(self.hasOwnProperty(i)) { keys.push(i); } }; return keys; ; return self}, function($ctx1) {$ctx1.fill(self,"keys",{},smalltalk.HashedCollection)})}, args: [], source: "keys\x0a\x09<\x0a\x09\x09if ('function'===typeof Object.keys) return Object.keys(self);\x0a\x09\x09var keys = [];\x0a\x09\x09for(var i in self) {\x0a\x09\x09\x09if(self.hasOwnProperty(i)) {\x0a\x09\x09\x09\x09keys.push(i);\x0a\x09\x09\x09}\x0a\x09\x09};\x0a\x09\x09return keys;\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "keysAndValuesDo:", category: 'enumerating', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._keysDo_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(aBlock)._value_value_(each,_st(self)._at_(each)); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},smalltalk.HashedCollection)})}, args: ["aBlock"], source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [:each |\x0a\x09\x09aBlock value: each value: (self at: each)]", messageSends: ["keysDo:", "value:value:", "at:"], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "keysDo:", category: 'enumerating', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { _st(_st(self)._keys())._do_(aBlock); return self}, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},smalltalk.HashedCollection)})}, args: ["aBlock"], source: "keysDo: aBlock\x0a\x09self keys do: aBlock", messageSends: ["do:", "keys"], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "printOn:", category: 'printing', fn: function (aStream){ var self=this; return smalltalk.withContext(function($ctx1) { smalltalk.IndexableCollection.fn.prototype._printOn_.apply(_st(self), [aStream]); _st(aStream)._nextPutAll_(" ("); _st(_st(self)._associations())._do_separatedBy_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(each)._printOn_(aStream); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){ return smalltalk.withContext(function($ctx2) { return _st(aStream)._nextPutAll_(" , "); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); _st(aStream)._nextPutAll_(")"); return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.HashedCollection)})}, args: ["aStream"], source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self associations\x0a\x09\x09do: [:each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' , ' ].\x0a\x09aStream nextPutAll: ')'", messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "remove:ifAbsent:", category: 'adding/removing', fn: function (aKey,aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._removeKey_ifAbsent_(aKey,aBlock); return $1; }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.HashedCollection)})}, args: ["aKey", "aBlock"], source: "remove: aKey ifAbsent: aBlock\x0a\x09^self removeKey: aKey ifAbsent: aBlock", messageSends: ["removeKey:ifAbsent:"], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "removeKey:", category: 'adding/removing', fn: function (aKey){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._remove_(aKey); return $1; }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},smalltalk.HashedCollection)})}, args: ["aKey"], source: "removeKey: aKey\x0a\x09^self remove: aKey", messageSends: ["remove:"], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "removeKey:ifAbsent:", category: 'adding/removing', fn: function (aKey,aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=_st(self)._includesKey_(aKey); if(smalltalk.assert($2)){ $1=_st(self)._basicDelete_(aKey); } else { $1=_st(aBlock)._value(); }; return $1; }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.HashedCollection)})}, args: ["aKey", "aBlock"], source: "removeKey: aKey ifAbsent: aBlock\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifFalse: [aBlock value]\x0a\x09\x09ifTrue: [self basicDelete: aKey]", messageSends: ["ifFalse:ifTrue:", "value", "basicDelete:", "includesKey:"], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "select:", category: 'enumerating', fn: function (aBlock){ var self=this; var newDict; return smalltalk.withContext(function($ctx1) { var $1,$2; newDict=_st(_st(self)._class())._new(); _st(self)._keysAndValuesDo_((function(key,value){ return smalltalk.withContext(function($ctx2) { $1=_st(aBlock)._value_(value); if(smalltalk.assert($1)){ return _st(newDict)._at_put_(key,value); }; }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})})); $2=newDict; return $2; }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},smalltalk.HashedCollection)})}, args: ["aBlock"], source: "select: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09\x09(aBlock value: value) ifTrue: [newDict at: key put: value]].\x0a\x09^newDict", messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "at:put:", "value:"], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "shallowCopy", category: 'copying', fn: function (){ var self=this; var copy; return smalltalk.withContext(function($ctx1) { var $1; copy=_st(_st(self)._class())._new(); _st(self)._keysAndValuesDo_((function(key,value){ return smalltalk.withContext(function($ctx2) { return _st(copy)._at_put_(key,value); }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})})); $1=copy; return $1; }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},smalltalk.HashedCollection)})}, args: [], source: "shallowCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09\x09copy at: key put: value].\x0a\x09^copy", messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "size", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._keys())._size(); return $1; }, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.HashedCollection)})}, args: [], source: "size\x0a\x09^self keys size", messageSends: ["size", "keys"], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "values", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._keys())._collect_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(self)._at_(each); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"values",{},smalltalk.HashedCollection)})}, args: [], source: "values\x0a\x09^self keys collect: [:each | self at: each]", messageSends: ["collect:", "at:", "keys"], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "valuesDo:", category: 'enumerating', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._keysAndValuesDo_((function(key,value){ return smalltalk.withContext(function($ctx2) { return _st(aBlock)._value_(value); }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},smalltalk.HashedCollection)})}, args: ["aBlock"], source: "valuesDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value ]", messageSends: ["keysAndValuesDo:", "value:"], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "withIndexDo:", category: 'enumerating', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._keysAndValuesDo_((function(key,value){ return smalltalk.withContext(function($ctx2) { return _st(aBlock)._value_value_(value,key); }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},smalltalk.HashedCollection)})}, args: ["aBlock"], source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]", messageSends: ["keysAndValuesDo:", "value:value:"], referencedClasses: [] }), smalltalk.HashedCollection); smalltalk.addMethod( smalltalk.method({ selector: "fromPairs:", category: 'instance creation', fn: function (aCollection){ var self=this; var dict; return smalltalk.withContext(function($ctx1) { var $1; dict=_st(self)._new(); _st(aCollection)._do_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(dict)._add_(each); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); $1=dict; return $1; }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection,dict:dict},smalltalk.HashedCollection.klass)})}, args: ["aCollection"], source: "fromPairs: aCollection\x0a\x09| dict |\x0a\x09dict := self new.\x0a\x09aCollection do: [:each | dict add: each].\x0a\x09^dict", messageSends: ["new", "do:", "add:"], referencedClasses: [] }), smalltalk.HashedCollection.klass); smalltalk.addClass('Dictionary', smalltalk.HashedCollection, ['keys', 'values'], 'Kernel-Collections'); smalltalk.Dictionary.comment="I represent a set of elements that can be viewed from one of two perspectives: a set of associations,\x0aor a container of values that are externally named where the name can be any object that responds to `=`.\x0a\x0aThe external name is referred to as the key." smalltalk.addMethod( smalltalk.method({ selector: "asHashedCollection", category: 'converting', fn: function (){ var self=this; function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st($HashedCollection())._fromPairs_(_st(self)._associations()); return $1; }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},smalltalk.Dictionary)})}, args: [], source: "asHashedCollection\x0a\x09^HashedCollection fromPairs: self associations", messageSends: ["fromPairs:", "associations"], referencedClasses: ["HashedCollection"] }), smalltalk.Dictionary); smalltalk.addMethod( smalltalk.method({ selector: "asJSON", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._asHashedCollection())._asJSON(); return $1; }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.Dictionary)})}, args: [], source: "asJSON\x0a\x09^self asHashedCollection asJSON", messageSends: ["asJSON", "asHashedCollection"], referencedClasses: [] }), smalltalk.Dictionary); smalltalk.addMethod( smalltalk.method({ selector: "at:ifAbsent:", category: 'accessing', fn: function (aKey,aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var index = self._positionOfKey_(aKey); return index >=0 ? self['@values'][index] : aBlock(); ; return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.Dictionary)})}, args: ["aKey", "aBlock"], source: "at: aKey ifAbsent: aBlock\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09return index >>=0 ? self['@values'][index] : aBlock();\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.Dictionary); smalltalk.addMethod( smalltalk.method({ selector: "at:put:", category: 'accessing', fn: function (aKey,aValue){ var self=this; return smalltalk.withContext(function($ctx1) { var index = self._positionOfKey_(aKey); if(index === -1) { var keys = self['@keys']; index = keys.length; keys.push(aKey); } return self['@values'][index] = aValue; ; return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},smalltalk.Dictionary)})}, args: ["aKey", "aValue"], source: "at: aKey put: aValue\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09var keys = self['@keys'];\x0a\x09\x09\x09index = keys.length;\x0a\x09\x09\x09keys.push(aKey);\x0a\x09\x09}\x0a\x0a\x09\x09return self['@values'][index] = aValue;\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.Dictionary); smalltalk.addMethod( smalltalk.method({ selector: "includesKey:", category: 'testing', fn: function (aKey){ var self=this; return smalltalk.withContext(function($ctx1) { return self._positionOfKey_(aKey) >= 0; ; return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},smalltalk.Dictionary)})}, args: ["aKey"], source: "includesKey: aKey\x0a\x09< return self._positionOfKey_(aKey) >>= 0; >", messageSends: [], referencedClasses: [] }), smalltalk.Dictionary); smalltalk.addMethod( smalltalk.method({ selector: "indexOf:ifAbsent:", category: 'accessing', fn: function (anObject,aBlock){ var self=this; var index; return smalltalk.withContext(function($ctx1) { var $2,$1; index=_st(self["@values"])._indexOf_ifAbsent_(anObject,(function(){ return smalltalk.withContext(function($ctx2) { return (0); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); $2=_st(index).__eq((0)); if(smalltalk.assert($2)){ $1=_st(aBlock)._value(); } else { $1=_st(self["@keys"])._at_(index); }; return $1; }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},smalltalk.Dictionary)})}, args: ["anObject", "aBlock"], source: "indexOf: anObject ifAbsent: aBlock\x0a\x0a\x09| index |\x0a\x09index := values indexOf: anObject ifAbsent: [0].\x0a\x09^ index = 0 ifTrue: [ aBlock value ] ifFalse: [ keys at: index ]", messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "value", "at:", "="], referencedClasses: [] }), smalltalk.Dictionary); smalltalk.addMethod( smalltalk.method({ selector: "initialize", category: 'initialization', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { smalltalk.HashedCollection.fn.prototype._initialize.apply(_st(self), []); self["@keys"]=[]; self["@values"]=[]; return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Dictionary)})}, args: [], source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()", messageSends: ["initialize"], referencedClasses: [] }), smalltalk.Dictionary); smalltalk.addMethod( smalltalk.method({ selector: "keys", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self["@keys"])._copy(); return $1; }, function($ctx1) {$ctx1.fill(self,"keys",{},smalltalk.Dictionary)})}, args: [], source: "keys\x0a\x09^keys copy", messageSends: ["copy"], referencedClasses: [] }), smalltalk.Dictionary); smalltalk.addMethod( smalltalk.method({ selector: "keysAndValuesDo:", category: 'enumerating', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self["@keys"])._with_do_(self["@values"],aBlock); return $1; }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},smalltalk.Dictionary)})}, args: ["aBlock"], source: "keysAndValuesDo: aBlock\x0a\x09^keys with: values do: aBlock", messageSends: ["with:do:"], referencedClasses: [] }), smalltalk.Dictionary); smalltalk.addMethod( smalltalk.method({ selector: "keysDo:", category: 'enumerating', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self["@keys"])._do_(aBlock); return $1; }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},smalltalk.Dictionary)})}, args: ["aBlock"], source: "keysDo: aBlock\x0a\x09^keys do: aBlock", messageSends: ["do:"], referencedClasses: [] }), smalltalk.Dictionary); smalltalk.addMethod( smalltalk.method({ selector: "positionOfKey:", category: 'private', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { var keys = self['@keys']; for(var i=0;i", messageSends: [], referencedClasses: [] }), smalltalk.Dictionary); smalltalk.addMethod( smalltalk.method({ selector: "removeKey:ifAbsent:", category: 'adding/removing', fn: function (aKey,aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var index = self._positionOfKey_(aKey); if(index === -1) { return aBlock() } else { var keys = self['@keys'], values = self['@values']; var value = values[index], l = keys.length; keys[index] = keys[l-1]; keys.pop(); values[index] = values[l-1]; values.pop(); return value; } ; return self}, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.Dictionary)})}, args: ["aKey", "aBlock"], source: "removeKey: aKey ifAbsent: aBlock\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09return aBlock()\x0a\x09\x09} else {\x0a\x09\x09\x09var keys = self['@keys'], values = self['@values'];\x0a\x09\x09\x09var value = values[index], l = keys.length;\x0a\x09\x09\x09keys[index] = keys[l-1];\x0a\x09\x09\x09keys.pop();\x0a\x09\x09\x09values[index] = values[l-1];\x0a\x09\x09\x09values.pop();\x0a\x09\x09\x09return value;\x0a\x09\x09}\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.Dictionary); smalltalk.addMethod( smalltalk.method({ selector: "values", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self["@values"])._copy(); return $1; }, function($ctx1) {$ctx1.fill(self,"values",{},smalltalk.Dictionary)})}, args: [], source: "values\x0a\x09^values copy", messageSends: ["copy"], referencedClasses: [] }), smalltalk.Dictionary); smalltalk.addMethod( smalltalk.method({ selector: "valuesDo:", category: 'enumerating', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self["@values"])._do_(aBlock); return $1; }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},smalltalk.Dictionary)})}, args: ["aBlock"], source: "valuesDo: aBlock\x0a\x09^values do: aBlock", messageSends: ["do:"], referencedClasses: [] }), smalltalk.Dictionary); smalltalk.addClass('SequenceableCollection', smalltalk.IndexableCollection, [], 'Kernel-Collections'); smalltalk.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1." smalltalk.addMethod( smalltalk.method({ selector: "=", category: 'comparing', fn: function (aCollection){ var self=this; return smalltalk.withContext(function($ctx1) { var $1,$2; var $early={}; try { $1=_st(_st(_st(self)._class()).__eq(_st(aCollection)._class()))._and_((function(){ return smalltalk.withContext(function($ctx2) { return _st(_st(self)._size()).__eq(_st(aCollection)._size()); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); if(! smalltalk.assert($1)){ return false; }; _st(self)._withIndexDo_((function(each,i){ return smalltalk.withContext(function($ctx2) { $2=_st(_st(aCollection)._at_(i)).__eq(each); if(! smalltalk.assert($2)){ throw $early=[false]; }; }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1)})})); return true; } catch(e) {if(e===$early)return e[0]; throw e} }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},smalltalk.SequenceableCollection)})}, args: ["aCollection"], source: "= aCollection\x0a\x09(self class = aCollection class and: [\x0a\x09\x09self size = aCollection size]) ifFalse: [^false].\x0a\x09self withIndexDo: [:each :i |\x0a\x09\x09\x09\x09(aCollection at: i) = each ifFalse: [^false]].\x0a\x09^true", messageSends: ["ifFalse:", "and:", "=", "size", "class", "withIndexDo:", "at:"], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "addLast:", category: 'adding', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._add_(anObject); return self}, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},smalltalk.SequenceableCollection)})}, args: ["anObject"], source: "addLast: anObject\x0a\x09self add: anObject", messageSends: ["add:"], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "allButFirst", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._copyFrom_to_((2),_st(self)._size()); return $1; }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},smalltalk.SequenceableCollection)})}, args: [], source: "allButFirst\x0a\x09^self copyFrom: 2 to: self size", messageSends: ["copyFrom:to:", "size"], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "allButLast", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._copyFrom_to_((1),_st(_st(self)._size()).__minus((1))); return $1; }, function($ctx1) {$ctx1.fill(self,"allButLast",{},smalltalk.SequenceableCollection)})}, args: [], source: "allButLast\x0a\x09^self copyFrom: 1 to: self size - 1", messageSends: ["copyFrom:to:", "-", "size"], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "atRandom", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._at_(_st(_st(self)._size())._atRandom()); return $1; }, function($ctx1) {$ctx1.fill(self,"atRandom",{},smalltalk.SequenceableCollection)})}, args: [], source: "atRandom\x0a\x09^ self at: self size atRandom", messageSends: ["at:", "atRandom", "size"], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "copyFrom:to:", category: 'copying', fn: function (anIndex,anotherIndex){ var self=this; var range,newCollection; return smalltalk.withContext(function($ctx1) { var $1; range=_st(anIndex)._to_(anotherIndex); newCollection=_st(_st(self)._class())._new_(_st(range)._size()); _st(range)._withIndexDo_((function(each,i){ return smalltalk.withContext(function($ctx2) { return _st(newCollection)._at_put_(i,_st(self)._at_(each)); }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1)})})); $1=newCollection; return $1; }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex,range:range,newCollection:newCollection},smalltalk.SequenceableCollection)})}, args: ["anIndex", "anotherIndex"], source: "copyFrom: anIndex to: anotherIndex\x0a\x09| range newCollection |\x0a\x09range := anIndex to: anotherIndex.\x0a\x09newCollection := self class new: range size.\x0a\x09range withIndexDo: [:each :i |\x0a\x09\x09newCollection at: i put: (self at: each)].\x0a\x09^newCollection", messageSends: ["to:", "new:", "size", "class", "withIndexDo:", "at:put:", "at:"], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "deepCopy", category: 'copying', fn: function (){ var self=this; var newCollection; return smalltalk.withContext(function($ctx1) { var $1; newCollection=_st(_st(self)._class())._new_(_st(self)._size()); _st(self)._withIndexDo_((function(each,index){ return smalltalk.withContext(function($ctx2) { return _st(newCollection)._at_put_(index,_st(each)._deepCopy()); }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1)})})); $1=newCollection; return $1; }, function($ctx1) {$ctx1.fill(self,"deepCopy",{newCollection:newCollection},smalltalk.SequenceableCollection)})}, args: [], source: "deepCopy\x0a\x09| newCollection |\x0a\x09newCollection := self class new: self size.\x0a\x09self withIndexDo: [:each :index |\x0a\x09\x09newCollection at: index put: each deepCopy].\x0a\x09^newCollection", messageSends: ["new:", "size", "class", "withIndexDo:", "at:put:", "deepCopy"], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "detect:ifNone:", category: 'enumerating', fn: function (aBlock,anotherBlock){ var self=this; return smalltalk.withContext(function($ctx1) { for(var i = 0; i < self.length; i++) if(aBlock(self[i])) return self[i]; return anotherBlock(); ; return self}, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.SequenceableCollection)})}, args: ["aBlock", "anotherBlock"], source: "detect: aBlock ifNone: anotherBlock\x0a\x09<\x0a\x09\x09for(var i = 0; i < self.length; i++)\x0a\x09\x09\x09if(aBlock(self[i]))\x0a\x09\x09\x09\x09return self[i];\x0a\x09\x09return anotherBlock();\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "do:", category: 'enumerating', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { for(var i=0;i", messageSends: [], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "first", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._at_((1)); return $1; }, function($ctx1) {$ctx1.fill(self,"first",{},smalltalk.SequenceableCollection)})}, args: [], source: "first\x0a\x09^self at: 1", messageSends: ["at:"], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "first:", category: 'accessing', fn: function (n){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._copyFrom_to_((1),n); return $1; }, function($ctx1) {$ctx1.fill(self,"first:",{n:n},smalltalk.SequenceableCollection)})}, args: ["n"], source: "first: n\x0a\x09\x22Answer the first n elements of the receiver.\x0a\x09Raise an error if there are not enough elements.\x22\x0a\x0a\x09^ self copyFrom: 1 to: n", messageSends: ["copyFrom:to:"], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "fourth", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._at_((4)); return $1; }, function($ctx1) {$ctx1.fill(self,"fourth",{},smalltalk.SequenceableCollection)})}, args: [], source: "fourth\x0a\x09^self at: 4", messageSends: ["at:"], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "includes:", category: 'testing', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._indexOf_ifAbsent_(anObject,(function(){ return smalltalk.withContext(function($ctx2) { return nil; }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._notNil(); return $1; }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},smalltalk.SequenceableCollection)})}, args: ["anObject"], source: "includes: anObject\x0a\x09^(self indexOf: anObject ifAbsent: [nil]) notNil", messageSends: ["notNil", "indexOf:ifAbsent:"], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "indexOf:ifAbsent:", category: 'accessing', fn: function (anObject,aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { for(var i=0;i", messageSends: [], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "indexOf:startingAt:", category: 'accessing', fn: function (anObject,start){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._indexOf_startingAt_ifAbsent_(anObject,start,(function(){ return smalltalk.withContext(function($ctx2) { return (0); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},smalltalk.SequenceableCollection)})}, args: ["anObject", "start"], source: "indexOf: anObject startingAt: start\x0a\x09\x22Answer the index of the first occurence of anElement after start\x0a\x09within the receiver. If the receiver does not contain anElement,\x0a\x09answer 0.\x22\x0a\x09^self indexOf: anObject startingAt: start ifAbsent: [0]", messageSends: ["indexOf:startingAt:ifAbsent:"], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "indexOf:startingAt:ifAbsent:", category: 'accessing', fn: function (anObject,start,aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { for(var i=start-1;i", messageSends: [], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "last", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._at_(_st(self)._size()); return $1; }, function($ctx1) {$ctx1.fill(self,"last",{},smalltalk.SequenceableCollection)})}, args: [], source: "last\x0a\x09^self at: self size", messageSends: ["at:", "size"], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "newStream", category: 'streaming', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._streamClass())._on_(self); return $1; }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.SequenceableCollection)})}, args: [], source: "newStream\x0a\x09^self streamClass on: self", messageSends: ["on:", "streamClass"], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "readStream", category: 'streaming', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._stream(); return $1; }, function($ctx1) {$ctx1.fill(self,"readStream",{},smalltalk.SequenceableCollection)})}, args: [], source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^self stream", messageSends: ["stream"], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "removeLast", category: 'adding', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._remove_(_st(self)._last()); return self}, function($ctx1) {$ctx1.fill(self,"removeLast",{},smalltalk.SequenceableCollection)})}, args: [], source: "removeLast\x0a\x09self remove: self last", messageSends: ["remove:", "last"], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "reversed", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility(); return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},smalltalk.SequenceableCollection)})}, args: [], source: "reversed\x0a\x09self subclassResponsibility", messageSends: ["subclassResponsibility"], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "second", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._at_((2)); return $1; }, function($ctx1) {$ctx1.fill(self,"second",{},smalltalk.SequenceableCollection)})}, args: [], source: "second\x0a\x09^self at: 2", messageSends: ["at:"], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "shallowCopy", category: 'copying', fn: function (){ var self=this; var newCollection; return smalltalk.withContext(function($ctx1) { var $1; newCollection=_st(_st(self)._class())._new_(_st(self)._size()); _st(self)._withIndexDo_((function(each,index){ return smalltalk.withContext(function($ctx2) { return _st(newCollection)._at_put_(index,each); }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1)})})); $1=newCollection; return $1; }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{newCollection:newCollection},smalltalk.SequenceableCollection)})}, args: [], source: "shallowCopy\x0a\x09| newCollection |\x0a\x09newCollection := self class new: self size.\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09newCollection at: index put: each].\x0a\x09^newCollection", messageSends: ["new:", "size", "class", "withIndexDo:", "at:put:"], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "stream", category: 'streaming', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._newStream(); return $1; }, function($ctx1) {$ctx1.fill(self,"stream",{},smalltalk.SequenceableCollection)})}, args: [], source: "stream\x0a\x09^self newStream", messageSends: ["newStream"], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "streamClass", category: 'streaming', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._class())._streamClass(); return $1; }, function($ctx1) {$ctx1.fill(self,"streamClass",{},smalltalk.SequenceableCollection)})}, args: [], source: "streamClass\x0a\x09^self class streamClass", messageSends: ["streamClass", "class"], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "third", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._at_((3)); return $1; }, function($ctx1) {$ctx1.fill(self,"third",{},smalltalk.SequenceableCollection)})}, args: [], source: "third\x0a\x09^self at: 3", messageSends: ["at:"], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "with:do:", category: 'enumerating', fn: function (anotherCollection,aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { for(var i=0;i", messageSends: [], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "withIndexDo:", category: 'enumerating', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { for(var i=0;i", messageSends: [], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "writeStream", category: 'streaming', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._stream(); return $1; }, function($ctx1) {$ctx1.fill(self,"writeStream",{},smalltalk.SequenceableCollection)})}, args: [], source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^self stream", messageSends: ["stream"], referencedClasses: [] }), smalltalk.SequenceableCollection); smalltalk.addMethod( smalltalk.method({ selector: "streamClass", category: 'accessing', fn: function (){ var self=this; function $Stream(){return smalltalk.Stream||(typeof Stream=="undefined"?nil:Stream)} return smalltalk.withContext(function($ctx1) { var $1; $1=$Stream(); return $1; }, function($ctx1) {$ctx1.fill(self,"streamClass",{},smalltalk.SequenceableCollection.klass)})}, args: [], source: "streamClass\x0a\x09\x09^Stream", messageSends: [], referencedClasses: ["Stream"] }), smalltalk.SequenceableCollection.klass); smalltalk.addMethod( smalltalk.method({ selector: "streamContents:", category: 'streaming', fn: function (aBlock){ var self=this; var stream; return smalltalk.withContext(function($ctx1) { var $1; stream=_st(_st(self)._streamClass())._on_(_st(self)._new()); _st(aBlock)._value_(stream); $1=_st(stream)._contents(); return $1; }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},smalltalk.SequenceableCollection.klass)})}, args: ["aBlock"], source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents", messageSends: ["on:", "new", "streamClass", "value:", "contents"], referencedClasses: [] }), smalltalk.SequenceableCollection.klass); smalltalk.addClass('Array', smalltalk.SequenceableCollection, [], 'Kernel-Collections'); smalltalk.Array.comment="I represent a collection of objects ordered by the collector. The size of arrays is dynamic.\x0aIn Amber, OrderedCollection is an alias for Array." smalltalk.addMethod( smalltalk.method({ selector: "add:", category: 'adding/removing', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { self.push(anObject); return anObject;; return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},smalltalk.Array)})}, args: ["anObject"], source: "add: anObject\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Array); smalltalk.addMethod( smalltalk.method({ selector: "asJavascript", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st("[").__comma(_st(_st(self)._collect_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(each)._asJavascript(); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._join_(", "))).__comma("]"); return $1; }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Array)})}, args: [], source: "asJavascript\x0a\x09^'[', ((self collect: [:each | each asJavascript]) join: ', '), ']'", messageSends: [",", "join:", "collect:", "asJavascript"], referencedClasses: [] }), smalltalk.Array); smalltalk.addMethod( smalltalk.method({ selector: "at:ifAbsent:", category: 'accessing', fn: function (anIndex,aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { if((anIndex < 1) || (self.length < anIndex)) {return aBlock()}; return self[anIndex - 1]; ; return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},smalltalk.Array)})}, args: ["anIndex", "aBlock"], source: "at: anIndex ifAbsent: aBlock\x0a\x09<\x0a\x09\x09if((anIndex < 1) || (self.length < anIndex)) {return aBlock()};\x0a\x09\x09return self[anIndex - 1];\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.Array); smalltalk.addMethod( smalltalk.method({ selector: "at:put:", category: 'accessing', fn: function (anIndex,anObject){ var self=this; return smalltalk.withContext(function($ctx1) { return self[anIndex - 1] = anObject; return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},smalltalk.Array)})}, args: ["anIndex", "anObject"], source: "at: anIndex put: anObject\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Array); smalltalk.addMethod( smalltalk.method({ selector: "join:", category: 'enumerating', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { return self.join(aString); return self}, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},smalltalk.Array)})}, args: ["aString"], source: "join: aString\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Array); smalltalk.addMethod( smalltalk.method({ selector: "printOn:", category: 'printing', fn: function (aStream){ var self=this; return smalltalk.withContext(function($ctx1) { smalltalk.SequenceableCollection.fn.prototype._printOn_.apply(_st(self), [aStream]); _st(aStream)._nextPutAll_(" ("); _st(self)._do_separatedBy_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(each)._printOn_(aStream); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){ return smalltalk.withContext(function($ctx2) { return _st(aStream)._nextPutAll_(" "); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); _st(aStream)._nextPutAll_(")"); return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Array)})}, args: ["aStream"], source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self \x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream nextPutAll: ')'", messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"], referencedClasses: [] }), smalltalk.Array); smalltalk.addMethod( smalltalk.method({ selector: "remove:ifAbsent:", category: 'adding/removing', fn: function (anObject,aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { for(var i=0;i", messageSends: [], referencedClasses: [] }), smalltalk.Array); smalltalk.addMethod( smalltalk.method({ selector: "removeFrom:to:", category: 'adding/removing', fn: function (aNumber,anotherNumber){ var self=this; return smalltalk.withContext(function($ctx1) { self.splice(aNumber - 1,anotherNumber - 1); return self}, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},smalltalk.Array)})}, args: ["aNumber", "anotherNumber"], source: "removeFrom: aNumber to: anotherNumber\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Array); smalltalk.addMethod( smalltalk.method({ selector: "reversed", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self._copy().reverse(); return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},smalltalk.Array)})}, args: [], source: "reversed\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Array); smalltalk.addMethod( smalltalk.method({ selector: "size", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.length; return self}, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Array)})}, args: [], source: "size\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Array); smalltalk.addMethod( smalltalk.method({ selector: "sort", category: 'enumerating', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._basicPerform_("sort"); return $1; }, function($ctx1) {$ctx1.fill(self,"sort",{},smalltalk.Array)})}, args: [], source: "sort\x0a\x09^self basicPerform: 'sort'", messageSends: ["basicPerform:"], referencedClasses: [] }), smalltalk.Array); smalltalk.addMethod( smalltalk.method({ selector: "sort:", category: 'enumerating', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { return self.sort(function(a, b) { if(aBlock(a,b)) {return -1} else {return 1} }) ; return self}, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},smalltalk.Array)})}, args: ["aBlock"], source: "sort: aBlock\x0a\x09<\x0a\x09\x09return self.sort(function(a, b) {\x0a\x09\x09\x09if(aBlock(a,b)) {return -1} else {return 1}\x0a\x09\x09})\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.Array); smalltalk.addMethod( smalltalk.method({ selector: "sorted", category: 'enumerating', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._copy())._sort(); return $1; }, function($ctx1) {$ctx1.fill(self,"sorted",{},smalltalk.Array)})}, args: [], source: "sorted\x0a\x09^self copy sort", messageSends: ["sort", "copy"], referencedClasses: [] }), smalltalk.Array); smalltalk.addMethod( smalltalk.method({ selector: "sorted:", category: 'enumerating', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._copy())._sort_(aBlock); return $1; }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},smalltalk.Array)})}, args: ["aBlock"], source: "sorted: aBlock\x0a\x09^self copy sort: aBlock", messageSends: ["sort:", "copy"], referencedClasses: [] }), smalltalk.Array); smalltalk.addMethod( smalltalk.method({ selector: "new:", category: 'instance creation', fn: function (anInteger){ var self=this; return smalltalk.withContext(function($ctx1) { return new Array(anInteger); return self}, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},smalltalk.Array.klass)})}, args: ["anInteger"], source: "new: anInteger\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Array.klass); smalltalk.addMethod( smalltalk.method({ selector: "with:", category: 'instance creation', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$3,$1; $2=_st(self)._new_((1)); _st($2)._at_put_((1),anObject); $3=_st($2)._yourself(); $1=$3; return $1; }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},smalltalk.Array.klass)})}, args: ["anObject"], source: "with: anObject\x0a\x09\x09^(self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself", messageSends: ["at:put:", "new:", "yourself"], referencedClasses: [] }), smalltalk.Array.klass); smalltalk.addMethod( smalltalk.method({ selector: "with:with:", category: 'instance creation', fn: function (anObject,anObject2){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$3,$1; $2=_st(self)._new_((2)); _st($2)._at_put_((1),anObject); _st($2)._at_put_((2),anObject2); $3=_st($2)._yourself(); $1=$3; return $1; }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},smalltalk.Array.klass)})}, args: ["anObject", "anObject2"], source: "with: anObject with: anObject2\x0a\x09\x09^(self new: 2)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09yourself", messageSends: ["at:put:", "new:", "yourself"], referencedClasses: [] }), smalltalk.Array.klass); smalltalk.addMethod( smalltalk.method({ selector: "with:with:with:", category: 'instance creation', fn: function (anObject,anObject2,anObject3){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$3,$1; $2=_st(self)._new_((3)); _st($2)._at_put_((1),anObject); _st($2)._at_put_((2),anObject2); _st($2)._at_put_((3),anObject3); $3=_st($2)._yourself(); $1=$3; return $1; }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},smalltalk.Array.klass)})}, args: ["anObject", "anObject2", "anObject3"], source: "with: anObject with: anObject2 with: anObject3\x0a\x09\x09^(self new: 3)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09at: 3 put: anObject3;\x0a\x09\x09yourself", messageSends: ["at:put:", "new:", "yourself"], referencedClasses: [] }), smalltalk.Array.klass); smalltalk.addMethod( smalltalk.method({ selector: "withAll:", category: 'instance creation', fn: function (aCollection){ var self=this; var instance,index; return smalltalk.withContext(function($ctx1) { var $1; index=(1); instance=_st(self)._new_(_st(aCollection)._size()); _st(aCollection)._do_((function(each){ return smalltalk.withContext(function($ctx2) { _st(instance)._at_put_(index,each); index=_st(index).__plus((1)); return index; }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); $1=instance; return $1; }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},smalltalk.Array.klass)})}, args: ["aCollection"], source: "withAll: aCollection\x0a\x09| instance index |\x0a\x09index := 1.\x0a\x09instance := self new: aCollection size.\x0a\x09aCollection do: [:each |\x0a\x09\x09instance at: index put: each.\x0a\x09\x09index := index + 1].\x0a\x09^instance", messageSends: ["new:", "size", "do:", "at:put:", "+"], referencedClasses: [] }), smalltalk.Array.klass); smalltalk.addClass('CharacterArray', smalltalk.SequenceableCollection, [], 'Kernel-Collections'); smalltalk.CharacterArray.comment="I am the abstract superclass of string-like collections." smalltalk.addMethod( smalltalk.method({ selector: ",", category: 'copying', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._asString()).__comma(_st(aString)._asString()); return $1; }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},smalltalk.CharacterArray)})}, args: ["aString"], source: ", aString\x0a\x09^self asString, aString asString", messageSends: [",", "asString"], referencedClasses: [] }), smalltalk.CharacterArray); smalltalk.addMethod( smalltalk.method({ selector: "add:", category: 'adding', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._errorReadOnly(); return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},smalltalk.CharacterArray)})}, args: ["anObject"], source: "add: anObject\x0a\x09self errorReadOnly", messageSends: ["errorReadOnly"], referencedClasses: [] }), smalltalk.CharacterArray); smalltalk.addMethod( smalltalk.method({ selector: "asLowercase", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._class())._fromString_(_st(_st(self)._asString())._asLowercase()); return $1; }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},smalltalk.CharacterArray)})}, args: [], source: "asLowercase\x0a\x09^self class fromString: self asString asLowercase", messageSends: ["fromString:", "asLowercase", "asString", "class"], referencedClasses: [] }), smalltalk.CharacterArray); smalltalk.addMethod( smalltalk.method({ selector: "asNumber", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._asString())._asNumber(); return $1; }, function($ctx1) {$ctx1.fill(self,"asNumber",{},smalltalk.CharacterArray)})}, args: [], source: "asNumber\x0a\x09^self asString asNumber", messageSends: ["asNumber", "asString"], referencedClasses: [] }), smalltalk.CharacterArray); smalltalk.addMethod( smalltalk.method({ selector: "asString", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._subclassResponsibility(); return $1; }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.CharacterArray)})}, args: [], source: "asString\x0a\x09^self subclassResponsibility", messageSends: ["subclassResponsibility"], referencedClasses: [] }), smalltalk.CharacterArray); smalltalk.addMethod( smalltalk.method({ selector: "asSymbol", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._asString(); return $1; }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},smalltalk.CharacterArray)})}, args: [], source: "asSymbol\x0a\x09^self asString", messageSends: ["asString"], referencedClasses: [] }), smalltalk.CharacterArray); smalltalk.addMethod( smalltalk.method({ selector: "asUppercase", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._class())._fromString_(_st(_st(self)._asString())._asUppercase()); return $1; }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},smalltalk.CharacterArray)})}, args: [], source: "asUppercase\x0a\x09^self class fromString: self asString asUppercase", messageSends: ["fromString:", "asUppercase", "asString", "class"], referencedClasses: [] }), smalltalk.CharacterArray); smalltalk.addMethod( smalltalk.method({ selector: "at:put:", category: 'accessing', fn: function (anIndex,anObject){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._errorReadOnly(); return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},smalltalk.CharacterArray)})}, args: ["anIndex", "anObject"], source: "at: anIndex put: anObject\x0a\x09self errorReadOnly", messageSends: ["errorReadOnly"], referencedClasses: [] }), smalltalk.CharacterArray); smalltalk.addMethod( smalltalk.method({ selector: "errorReadOnly", category: 'error handling', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._error_("Object is read-only"); return self}, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},smalltalk.CharacterArray)})}, args: [], source: "errorReadOnly\x0a\x09self error: 'Object is read-only'", messageSends: ["error:"], referencedClasses: [] }), smalltalk.CharacterArray); smalltalk.addMethod( smalltalk.method({ selector: "printOn:", category: 'printing', fn: function (aStream){ var self=this; return smalltalk.withContext(function($ctx1) { _st(_st(self)._asString())._printOn_(aStream); return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.CharacterArray)})}, args: ["aStream"], source: "printOn: aStream\x0a\x09self asString printOn: aStream", messageSends: ["printOn:", "asString"], referencedClasses: [] }), smalltalk.CharacterArray); smalltalk.addMethod( smalltalk.method({ selector: "putOn:", category: 'streaming', fn: function (aStream){ var self=this; return smalltalk.withContext(function($ctx1) { _st(aStream)._nextPutString_(self); return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},smalltalk.CharacterArray)})}, args: ["aStream"], source: "putOn: aStream\x0a\x09aStream nextPutString: self", messageSends: ["nextPutString:"], referencedClasses: [] }), smalltalk.CharacterArray); smalltalk.addMethod( smalltalk.method({ selector: "remove:", category: 'adding', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._errorReadOnly(); return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},smalltalk.CharacterArray)})}, args: ["anObject"], source: "remove: anObject\x0a\x09self errorReadOnly", messageSends: ["errorReadOnly"], referencedClasses: [] }), smalltalk.CharacterArray); smalltalk.addMethod( smalltalk.method({ selector: "fromString:", category: 'instance creation', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility(); return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},smalltalk.CharacterArray.klass)})}, args: ["aString"], source: "fromString: aString\x0a\x09self subclassResponsibility", messageSends: ["subclassResponsibility"], referencedClasses: [] }), smalltalk.CharacterArray.klass); smalltalk.addClass('String', smalltalk.CharacterArray, [], 'Kernel-Collections'); smalltalk.String.comment="I am an indexed collection of Characters. Unlike most Smalltalk dialects, Amber doesn't provide the Character class. Instead, elements of a String are single character strings.\x0a\x0aString inherits many useful methods from its hierarchy, such as\x0a\x09`Collection >> #,`" smalltalk.addMethod( smalltalk.method({ selector: ",", category: 'copying', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { return self + aString; return self}, function($ctx1) {$ctx1.fill(self,",",{aString:aString},smalltalk.String)})}, args: ["aString"], source: ", aString\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "<", category: 'comparing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { return String(self) < aString._asString(); return self}, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},smalltalk.String)})}, args: ["aString"], source: "< aString\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "<=", category: 'comparing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { return String(self) <= aString._asString(); return self}, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},smalltalk.String)})}, args: ["aString"], source: "<= aString\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "=", category: 'comparing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { if(typeof aString === 'undefined') { return false } if(!aString._isString || ! aString._isString()) { return false; } return String(self) === String(aString) ; return self}, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},smalltalk.String)})}, args: ["aString"], source: "= aString\x0a\x09<\x0a\x09\x09if(typeof aString === 'undefined') { return false }\x0a\x09\x09if(!aString._isString || ! aString._isString()) {\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09\x09return String(self) === String(aString)\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "==", category: 'comparing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self).__eq(aString); return $1; }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},smalltalk.String)})}, args: ["aString"], source: "== aString\x0a\x09^self = aString", messageSends: ["="], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: ">", category: 'comparing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { return String(self) > aString._asString(); return self}, function($ctx1) {$ctx1.fill(self,">",{aString:aString},smalltalk.String)})}, args: ["aString"], source: "> aString\x0a\x09> aString._asString()>", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: ">=", category: 'comparing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { return String(self) >= aString._asString(); return self}, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},smalltalk.String)})}, args: ["aString"], source: ">= aString\x0a\x09>= aString._asString()>", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "asJSON", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self; return $1; }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.String)})}, args: [], source: "asJSON\x0a\x09^self", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "asJavascript", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1) return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\""; else return "\"" + self + "\""; ; return self}, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.String)})}, args: [], source: "asJavascript\x0a\x09<\x0a\x09\x09if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self.replace(/[\x5cx00-\x5cx1f\x22\x5c\x5c\x5cx7f-\x5cx9f]/g, function(ch){var c=ch.charCodeAt(0);return \x22\x5c\x5cx\x22+(\x220\x22+c.toString(16)).slice(-2)}) + \x22\x5c\x22\x22;\x0a\x09\x09else\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self + \x22\x5c\x22\x22;\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "asLowercase", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.toLowerCase(); return self}, function($ctx1) {$ctx1.fill(self,"asLowercase",{},smalltalk.String)})}, args: [], source: "asLowercase\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "asNumber", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return Number(self); return self}, function($ctx1) {$ctx1.fill(self,"asNumber",{},smalltalk.String)})}, args: [], source: "asNumber\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "asRegexp", category: 'converting', fn: function (){ var self=this; function $RegularExpression(){return smalltalk.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st($RegularExpression())._fromString_(self); return $1; }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},smalltalk.String)})}, args: [], source: "asRegexp\x0a\x09^ RegularExpression fromString: self", messageSends: ["fromString:"], referencedClasses: ["RegularExpression"] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "asSelector", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return smalltalk.selector(self); return self}, function($ctx1) {$ctx1.fill(self,"asSelector",{},smalltalk.String)})}, args: [], source: "asSelector\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "asString", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self; return $1; }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.String)})}, args: [], source: "asString\x0a\x09^self", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "asSymbol", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self; return $1; }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},smalltalk.String)})}, args: [], source: "asSymbol\x0a\x09^ self", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "asUppercase", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.toUpperCase(); return self}, function($ctx1) {$ctx1.fill(self,"asUppercase",{},smalltalk.String)})}, args: [], source: "asUppercase\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "asciiValue", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.charCodeAt(0);; return self}, function($ctx1) {$ctx1.fill(self,"asciiValue",{},smalltalk.String)})}, args: [], source: "asciiValue\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "at:ifAbsent:", category: 'accessing', fn: function (anIndex,aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { return String(self).charAt(anIndex - 1) || aBlock(); return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},smalltalk.String)})}, args: ["anIndex", "aBlock"], source: "at: anIndex ifAbsent: aBlock\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "charCodeAt:", category: 'accessing', fn: function (anInteger){ var self=this; return smalltalk.withContext(function($ctx1) { return self.charCodeAt(anInteger - 1) ; return self}, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},smalltalk.String)})}, args: ["anInteger"], source: "charCodeAt: anInteger\x0a\x09< return self.charCodeAt(anInteger - 1) >", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "copyFrom:to:", category: 'copying', fn: function (anIndex,anotherIndex){ var self=this; return smalltalk.withContext(function($ctx1) { return self.substring(anIndex - 1, anotherIndex); return self}, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},smalltalk.String)})}, args: ["anIndex", "anotherIndex"], source: "copyFrom: anIndex to: anotherIndex\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "crlfSanitized", category: 'converting', fn: function (){ var self=this; function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._lines())._join_(_st($String())._lf()); return $1; }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},smalltalk.String)})}, args: [], source: "crlfSanitized\x0a\x09^self lines join: String lf", messageSends: ["join:", "lf", "lines"], referencedClasses: ["String"] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "deepCopy", category: 'copying', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._shallowCopy(); return $1; }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.String)})}, args: [], source: "deepCopy\x0a\x09^self shallowCopy", messageSends: ["shallowCopy"], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "do:", category: 'enumerating', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { for(var i=0;i", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "escaped", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return escape(self); return self}, function($ctx1) {$ctx1.fill(self,"escaped",{},smalltalk.String)})}, args: [], source: "escaped\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "includesSubString:", category: 'testing', fn: function (subString){ var self=this; return smalltalk.withContext(function($ctx1) { return self.indexOf(subString) != -1 ; return self}, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},smalltalk.String)})}, args: ["subString"], source: "includesSubString: subString\x0a\x09< return self.indexOf(subString) != -1 >", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "isImmutable", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return true; }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.String)})}, args: [], source: "isImmutable\x0a\x09^ true", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "isString", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return true; }, function($ctx1) {$ctx1.fill(self,"isString",{},smalltalk.String)})}, args: [], source: "isString\x0a\x09^true", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "isVowel", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(_st(self)._size()).__eq((1)))._and_((function(){ return smalltalk.withContext(function($ctx2) { return _st("aeiou")._includes_(_st(self)._asLowercase()); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"isVowel",{},smalltalk.String)})}, args: [], source: "isVowel\x0a\x09\x22Answer true if the receiver is a one character string containing a voyel\x22\x0a\x09\x0a\x09^ self size = 1 and: [ 'aeiou' includes: self asLowercase ]", messageSends: ["and:", "includes:", "asLowercase", "=", "size"], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "join:", category: 'split join', fn: function (aCollection){ var self=this; function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st($String())._streamContents_((function(stream){ return smalltalk.withContext(function($ctx2) { return _st(aCollection)._do_separatedBy_((function(each){ return smalltalk.withContext(function($ctx3) { return _st(stream)._nextPutAll_(_st(each)._asString()); }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){ return smalltalk.withContext(function($ctx3) { return _st(stream)._nextPutAll_(self); }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})})); }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},smalltalk.String)})}, args: ["aCollection"], source: "join: aCollection\x0a\x09^ String\x0a\x09\x09streamContents: [:stream | aCollection\x0a\x09\x09\x09\x09do: [:each | stream nextPutAll: each asString]\x0a\x09\x09\x09\x09separatedBy: [stream nextPutAll: self]]", messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"], referencedClasses: ["String"] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "lineIndicesDo:", category: 'split join', fn: function (aBlock){ var self=this; var cr,lf,start,sz,nextLF,nextCR; function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)} return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4; var $early={}; try { start=(1); sz=_st(self)._size(); cr=_st($String())._cr(); nextCR=_st(self)._indexOf_startingAt_(cr,(1)); lf=_st($String())._lf(); nextLF=_st(self)._indexOf_startingAt_(lf,(1)); _st((function(){ return smalltalk.withContext(function($ctx2) { return _st(start).__lt_eq(sz); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){ return smalltalk.withContext(function($ctx2) { $1=_st(_st(nextLF).__eq((0)))._and_((function(){ return smalltalk.withContext(function($ctx3) { return _st(nextCR).__eq((0)); }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})})); if(smalltalk.assert($1)){ _st(aBlock)._value_value_value_(start,sz,sz); $2=self; throw $early=[$2]; }; $3=_st(_st(nextCR).__eq((0)))._or_((function(){ return smalltalk.withContext(function($ctx3) { return _st(_st((0)).__lt(nextLF))._and_((function(){ return smalltalk.withContext(function($ctx4) { return _st(nextLF).__lt(nextCR); }, function($ctx4) {$ctx4.fillBlock({},$ctx1)})})); }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})})); if(smalltalk.assert($3)){ _st(aBlock)._value_value_value_(start,_st(nextLF).__minus((1)),nextLF); start=_st((1)).__plus(nextLF); start; nextLF=_st(self)._indexOf_startingAt_(lf,start); return nextLF; } else { $4=_st(_st((1)).__plus(nextCR)).__eq(nextLF); if(smalltalk.assert($4)){ _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextLF); start=_st((1)).__plus(nextLF); start; nextCR=_st(self)._indexOf_startingAt_(cr,start); nextCR; nextLF=_st(self)._indexOf_startingAt_(lf,start); return nextLF; } else { _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextCR); start=_st((1)).__plus(nextCR); start; nextCR=_st(self)._indexOf_startingAt_(cr,start); return nextCR; }; }; }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); return self} catch(e) {if(e===$early)return e[0]; throw e} }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},smalltalk.String)})}, args: ["aBlock"], source: "lineIndicesDo: aBlock\x0a\x09\x22execute aBlock with 3 arguments for each line:\x0a\x09- start index of line\x0a\x09- end index of line without line delimiter\x0a\x09- end index of line including line delimiter(s) CR, LF or CRLF\x22\x0a\x09\x0a\x09| cr lf start sz nextLF nextCR |\x0a\x09start := 1.\x0a\x09sz := self size.\x0a\x09cr := String cr.\x0a\x09nextCR := self indexOf: cr startingAt: 1.\x0a\x09lf := String lf.\x0a\x09nextLF := self indexOf: lf startingAt: 1.\x0a\x09[ start <= sz ] whileTrue: [\x0a\x09\x09(nextLF = 0 and: [ nextCR = 0 ])\x0a\x09\x09\x09ifTrue: [ \x22No more CR, nor LF, the string is over\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: sz value: sz.\x0a\x09\x09\x09\x09\x09^self ].\x0a\x09\x09(nextCR = 0 or: [ 0 < nextLF and: [ nextLF < nextCR ] ])\x0a\x09\x09\x09ifTrue: [ \x22Found a LF\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextLF - 1 value: nextLF.\x0a\x09\x09\x09\x09\x09start := 1 + nextLF.\x0a\x09\x09\x09\x09\x09nextLF := self indexOf: lf startingAt: start ]\x0a\x09\x09\x09ifFalse: [ 1 + nextCR = nextLF\x0a\x09\x09\x09\x09ifTrue: [ \x22Found a CR-LF pair\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextCR - 1 value: nextLF.\x0a\x09\x09\x09\x09\x09start := 1 + nextLF.\x0a\x09\x09\x09\x09\x09nextCR := self indexOf: cr startingAt: start.\x0a\x09\x09\x09\x09\x09nextLF := self indexOf: lf startingAt: start ]\x0a\x09\x09\x09\x09ifFalse: [ \x22Found a CR\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextCR - 1 value: nextCR.\x0a\x09\x09\x09\x09\x09start := 1 + nextCR.\x0a\x09\x09\x09\x09\x09nextCR := self indexOf: cr startingAt: start ]]]", messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "ifTrue:", "value:value:value:", "and:", "=", "ifTrue:ifFalse:", "-", "+", "or:", "<", "<="], referencedClasses: ["String"] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "lineNumber:", category: 'split join', fn: function (anIndex){ var self=this; var lineCount; return smalltalk.withContext(function($ctx1) { var $1,$2; var $early={}; try { lineCount=(0); _st(self)._lineIndicesDo_((function(start,endWithoutDelimiters,end){ return smalltalk.withContext(function($ctx2) { lineCount=_st(lineCount).__plus((1)); $1=_st(lineCount).__eq(anIndex); if(smalltalk.assert($1)){ $2=_st(self)._copyFrom_to_(start,endWithoutDelimiters); throw $early=[$2]; }; }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1)})})); return nil; } catch(e) {if(e===$early)return e[0]; throw e} }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},smalltalk.String)})}, args: ["anIndex"], source: "lineNumber: anIndex\x0a\x09\x22Answer a string containing the characters in the given line number.\x22\x0a\x0a\x09| lineCount |\x0a\x09lineCount := 0.\x0a\x09self lineIndicesDo: [:start :endWithoutDelimiters :end |\x0a\x09\x09(lineCount := lineCount + 1) = anIndex ifTrue: [^self copyFrom: start to: endWithoutDelimiters]].\x0a\x09^nil", messageSends: ["lineIndicesDo:", "ifTrue:", "copyFrom:to:", "=", "+"], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "lines", category: 'split join', fn: function (){ var self=this; var lines; function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)} return smalltalk.withContext(function($ctx1) { var $1; lines=_st($Array())._new(); _st(self)._linesDo_((function(aLine){ return smalltalk.withContext(function($ctx2) { return _st(lines)._add_(aLine); }, function($ctx2) {$ctx2.fillBlock({aLine:aLine},$ctx1)})})); $1=lines; return $1; }, function($ctx1) {$ctx1.fill(self,"lines",{lines:lines},smalltalk.String)})}, args: [], source: "lines\x0a\x09\x22Answer an array of lines composing this receiver without the line ending delimiters.\x22\x0a\x0a\x09| lines |\x0a\x09lines := Array new.\x0a\x09self linesDo: [:aLine | lines add: aLine].\x0a\x09^lines", messageSends: ["new", "linesDo:", "add:"], referencedClasses: ["Array"] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "linesDo:", category: 'split join', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._lineIndicesDo_((function(start,endWithoutDelimiters,end){ return smalltalk.withContext(function($ctx2) { return _st(aBlock)._value_(_st(self)._copyFrom_to_(start,endWithoutDelimiters)); }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},smalltalk.String)})}, args: ["aBlock"], source: "linesDo: aBlock\x0a\x09\x22Execute aBlock with each line in this string. The terminating line\x0a\x09delimiters CR, LF or CRLF pairs are not included in what is passed to aBlock\x22\x0a\x0a\x09self lineIndicesDo: [:start :endWithoutDelimiters :end |\x0a\x09\x09aBlock value: (self copyFrom: start to: endWithoutDelimiters)]", messageSends: ["lineIndicesDo:", "value:", "copyFrom:to:"], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "match:", category: 'regular expressions', fn: function (aRegexp){ var self=this; return smalltalk.withContext(function($ctx1) { return self.search(aRegexp) != -1; return self}, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},smalltalk.String)})}, args: ["aRegexp"], source: "match: aRegexp\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "matchesOf:", category: 'regular expressions', fn: function (aRegularExpression){ var self=this; return smalltalk.withContext(function($ctx1) { return self.match(aRegularExpression); return self}, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},smalltalk.String)})}, args: ["aRegularExpression"], source: "matchesOf: aRegularExpression\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "printNl", category: 'printing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { console.log(self); return self}, function($ctx1) {$ctx1.fill(self,"printNl",{},smalltalk.String)})}, args: [], source: "printNl\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "printOn:", category: 'printing', fn: function (aStream){ var self=this; return smalltalk.withContext(function($ctx1) { var $1,$2; $1=aStream; _st($1)._nextPutAll_("'"); _st($1)._nextPutAll_(self); $2=_st($1)._nextPutAll_("'"); return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.String)})}, args: ["aStream"], source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''", messageSends: ["nextPutAll:"], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "replace:with:", category: 'regular expressions', fn: function (aString,anotherString){ var self=this; function $RegularExpression(){return smalltalk.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._replaceRegexp_with_(_st($RegularExpression())._fromString_flag_(aString,"g"),anotherString); return $1; }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},smalltalk.String)})}, args: ["aString", "anotherString"], source: "replace: aString with: anotherString\x0a\x09^self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString", messageSends: ["replaceRegexp:with:", "fromString:flag:"], referencedClasses: ["RegularExpression"] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "replaceRegexp:with:", category: 'regular expressions', fn: function (aRegexp,aString){ var self=this; return smalltalk.withContext(function($ctx1) { return self.replace(aRegexp, aString); return self}, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},smalltalk.String)})}, args: ["aRegexp", "aString"], source: "replaceRegexp: aRegexp with: aString\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "reversed", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.split("").reverse().join(""); return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},smalltalk.String)})}, args: [], source: "reversed\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "shallowCopy", category: 'copying', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._class())._fromString_(self); return $1; }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.String)})}, args: [], source: "shallowCopy\x0a\x09^self class fromString: self", messageSends: ["fromString:", "class"], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "size", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.length; return self}, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.String)})}, args: [], source: "size\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "subStrings:", category: 'split join', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._tokenize_(aString); return $1; }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},smalltalk.String)})}, args: ["aString"], source: "subStrings: aString\x0a\x09^ self tokenize: aString", messageSends: ["tokenize:"], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "tokenize:", category: 'split join', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { return self.split(aString); return self}, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},smalltalk.String)})}, args: ["aString"], source: "tokenize: aString\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "trimBoth", category: 'regular expressions', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._trimBoth_("\x5cs"); return $1; }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},smalltalk.String)})}, args: [], source: "trimBoth\x0a\x09^self trimBoth: '\x5cs'", messageSends: ["trimBoth:"], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "trimBoth:", category: 'regular expressions', fn: function (separators){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._trimLeft_(separators))._trimRight_(separators); return $1; }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},smalltalk.String)})}, args: ["separators"], source: "trimBoth: separators\x0a\x0a\x09^(self trimLeft: separators) trimRight: separators", messageSends: ["trimRight:", "trimLeft:"], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "trimLeft", category: 'regular expressions', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._trimLeft_("\x5cs"); return $1; }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},smalltalk.String)})}, args: [], source: "trimLeft\x0a\x09^self trimLeft: '\x5cs'", messageSends: ["trimLeft:"], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "trimLeft:", category: 'regular expressions', fn: function (separators){ var self=this; function $RegularExpression(){return smalltalk.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._replaceRegexp_with_(_st($RegularExpression())._fromString_flag_(_st(_st("^[").__comma(separators)).__comma("]+"),"g"),""); return $1; }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},smalltalk.String)})}, args: ["separators"], source: "trimLeft: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''", messageSends: ["replaceRegexp:with:", "fromString:flag:", ","], referencedClasses: ["RegularExpression"] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "trimRight", category: 'regular expressions', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._trimRight_("\x5cs"); return $1; }, function($ctx1) {$ctx1.fill(self,"trimRight",{},smalltalk.String)})}, args: [], source: "trimRight\x0a\x09^self trimRight: '\x5cs'", messageSends: ["trimRight:"], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "trimRight:", category: 'regular expressions', fn: function (separators){ var self=this; function $RegularExpression(){return smalltalk.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._replaceRegexp_with_(_st($RegularExpression())._fromString_flag_(_st(_st("[").__comma(separators)).__comma("]+$"),"g"),""); return $1; }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},smalltalk.String)})}, args: ["separators"], source: "trimRight: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''", messageSends: ["replaceRegexp:with:", "fromString:flag:", ","], referencedClasses: ["RegularExpression"] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "unescaped", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return unescape(self); return self}, function($ctx1) {$ctx1.fill(self,"unescaped",{},smalltalk.String)})}, args: [], source: "unescaped\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "withIndexDo:", category: 'enumerating', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { for(var i=0;i", messageSends: [], referencedClasses: [] }), smalltalk.String); smalltalk.addMethod( smalltalk.method({ selector: "cr", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return '\r'; return self}, function($ctx1) {$ctx1.fill(self,"cr",{},smalltalk.String.klass)})}, args: [], source: "cr\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.String.klass); smalltalk.addMethod( smalltalk.method({ selector: "crlf", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return '\r\n'; return self}, function($ctx1) {$ctx1.fill(self,"crlf",{},smalltalk.String.klass)})}, args: [], source: "crlf\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.String.klass); smalltalk.addMethod( smalltalk.method({ selector: "fromCharCode:", category: 'instance creation', fn: function (anInteger){ var self=this; return smalltalk.withContext(function($ctx1) { return String.fromCharCode(anInteger); return self}, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},smalltalk.String.klass)})}, args: ["anInteger"], source: "fromCharCode: anInteger\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.String.klass); smalltalk.addMethod( smalltalk.method({ selector: "fromString:", category: 'instance creation', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { return String(aString); return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},smalltalk.String.klass)})}, args: ["aString"], source: "fromString: aString\x0a\x09\x09", messageSends: [], referencedClasses: [] }), smalltalk.String.klass); smalltalk.addMethod( smalltalk.method({ selector: "lf", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return '\n'; return self}, function($ctx1) {$ctx1.fill(self,"lf",{},smalltalk.String.klass)})}, args: [], source: "lf\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.String.klass); smalltalk.addMethod( smalltalk.method({ selector: "random", category: 'random', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);; return self}, function($ctx1) {$ctx1.fill(self,"random",{},smalltalk.String.klass)})}, args: [], source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.String.klass); smalltalk.addMethod( smalltalk.method({ selector: "randomNotIn:", category: 'random', fn: function (aString){ var self=this; var result; return smalltalk.withContext(function($ctx1) { var $1; _st((function(){ return smalltalk.withContext(function($ctx2) { result=_st(self)._random(); result; return _st(aString)._includesSubString_(result); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue(); $1=result; return $1; }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},smalltalk.String.klass)})}, args: ["aString"], source: "randomNotIn: aString\x0a\x09| result |\x0a [ result := self random. aString includesSubString: result ] whileTrue.\x0a ^result", messageSends: ["whileTrue", "random", "includesSubString:"], referencedClasses: [] }), smalltalk.String.klass); smalltalk.addMethod( smalltalk.method({ selector: "space", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return ' '; return self}, function($ctx1) {$ctx1.fill(self,"space",{},smalltalk.String.klass)})}, args: [], source: "space\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.String.klass); smalltalk.addMethod( smalltalk.method({ selector: "streamClass", category: 'accessing', fn: function (){ var self=this; function $StringStream(){return smalltalk.StringStream||(typeof StringStream=="undefined"?nil:StringStream)} return smalltalk.withContext(function($ctx1) { var $1; $1=$StringStream(); return $1; }, function($ctx1) {$ctx1.fill(self,"streamClass",{},smalltalk.String.klass)})}, args: [], source: "streamClass\x0a\x09\x09^StringStream", messageSends: [], referencedClasses: ["StringStream"] }), smalltalk.String.klass); smalltalk.addMethod( smalltalk.method({ selector: "tab", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return '\t'; return self}, function($ctx1) {$ctx1.fill(self,"tab",{},smalltalk.String.klass)})}, args: [], source: "tab\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.String.klass); smalltalk.addMethod( smalltalk.method({ selector: "value:", category: 'instance creation', fn: function (aUTFCharCode){ var self=this; return smalltalk.withContext(function($ctx1) { return String.fromCharCode(aUTFCharCode);; return self}, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},smalltalk.String.klass)})}, args: ["aUTFCharCode"], source: "value: aUTFCharCode\x0a\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.String.klass); smalltalk.addClass('Set', smalltalk.Collection, ['elements'], 'Kernel-Collections'); smalltalk.Set.comment="I represent an unordered set of objects without duplicates." smalltalk.addMethod( smalltalk.method({ selector: "=", category: 'comparing', fn: function (aCollection){ var self=this; return smalltalk.withContext(function($ctx1) { var $1,$2,$3; var $early={}; try { $1=_st(_st(self)._class()).__eq(_st(aCollection)._class()); if(! smalltalk.assert($1)){ return false; }; $2=_st(_st(self)._size()).__eq(_st(aCollection)._size()); if(! smalltalk.assert($2)){ return false; }; _st(self)._do_((function(each){ return smalltalk.withContext(function($ctx2) { $3=_st(aCollection)._includes_(each); if(! smalltalk.assert($3)){ throw $early=[false]; }; }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); return true; } catch(e) {if(e===$early)return e[0]; throw e} }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},smalltalk.Set)})}, args: ["aCollection"], source: "= aCollection\x0a\x09self class = aCollection class ifFalse: [ ^ false ].\x0a\x09self size = aCollection size ifFalse: [ ^ false ].\x0a\x09self do: [:each | (aCollection includes: each) ifFalse: [ ^ false ] ].\x0a\x09^ true", messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"], referencedClasses: [] }), smalltalk.Set); smalltalk.addMethod( smalltalk.method({ selector: "add:", category: 'adding/removing', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { var found; for(var i=0; i < self['@elements'].length; i++) { if(anObject == self['@elements'][i]) { found = true; break; } } if(!found) {self['@elements'].push(anObject)} ; return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},smalltalk.Set)})}, args: ["anObject"], source: "add: anObject\x0a\x09<\x0a\x09\x09var found;\x0a\x09\x09for(var i=0; i < self['@elements'].length; i++) {\x0a\x09\x09\x09if(anObject == self['@elements'][i]) {\x0a\x09\x09\x09\x09found = true;\x0a\x09\x09\x09\x09break;\x0a\x09\x09\x09}\x0a\x09\x09}\x0a\x09\x09if(!found) {self['@elements'].push(anObject)}\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.Set); smalltalk.addMethod( smalltalk.method({ selector: "asArray", category: 'converting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self["@elements"])._copy(); return $1; }, function($ctx1) {$ctx1.fill(self,"asArray",{},smalltalk.Set)})}, args: [], source: "asArray\x0a\x09^elements copy", messageSends: ["copy"], referencedClasses: [] }), smalltalk.Set); smalltalk.addMethod( smalltalk.method({ selector: "collect:", category: 'enumerating', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._class())._withAll_(_st(self["@elements"])._collect_(aBlock)); return $1; }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},smalltalk.Set)})}, args: ["aBlock"], source: "collect: aBlock\x0a\x09^self class withAll: (elements collect: aBlock)", messageSends: ["withAll:", "collect:", "class"], referencedClasses: [] }), smalltalk.Set); smalltalk.addMethod( smalltalk.method({ selector: "detect:ifNone:", category: 'enumerating', fn: function (aBlock,anotherBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self["@elements"])._detect_ifNone_(aBlock,anotherBlock); return $1; }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Set)})}, args: ["aBlock", "anotherBlock"], source: "detect: aBlock ifNone: anotherBlock\x0a\x09^elements detect: aBlock ifNone: anotherBlock", messageSends: ["detect:ifNone:"], referencedClasses: [] }), smalltalk.Set); smalltalk.addMethod( smalltalk.method({ selector: "do:", category: 'enumerating', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self["@elements"])._do_(aBlock); return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.Set)})}, args: ["aBlock"], source: "do: aBlock\x0a\x09elements do: aBlock", messageSends: ["do:"], referencedClasses: [] }), smalltalk.Set); smalltalk.addMethod( smalltalk.method({ selector: "includes:", category: 'testing', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self["@elements"])._includes_(anObject); return $1; }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},smalltalk.Set)})}, args: ["anObject"], source: "includes: anObject\x0a\x09^elements includes: anObject", messageSends: ["includes:"], referencedClasses: [] }), smalltalk.Set); smalltalk.addMethod( smalltalk.method({ selector: "initialize", category: 'initialization', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { smalltalk.Collection.fn.prototype._initialize.apply(_st(self), []); self["@elements"]=[]; return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Set)})}, args: [], source: "initialize\x0a\x09super initialize.\x0a\x09elements := #()", messageSends: ["initialize"], referencedClasses: [] }), smalltalk.Set); smalltalk.addMethod( smalltalk.method({ selector: "printOn:", category: 'printing', fn: function (aStream){ var self=this; return smalltalk.withContext(function($ctx1) { smalltalk.Collection.fn.prototype._printOn_.apply(_st(self), [aStream]); _st(aStream)._nextPutAll_(" ("); _st(self)._do_separatedBy_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(each)._printOn_(aStream); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){ return smalltalk.withContext(function($ctx2) { return _st(aStream)._nextPutAll_(" "); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); _st(aStream)._nextPutAll_(")"); return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Set)})}, args: ["aStream"], source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self \x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream nextPutAll: ')'", messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"], referencedClasses: [] }), smalltalk.Set); smalltalk.addMethod( smalltalk.method({ selector: "remove:", category: 'adding/removing', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self["@elements"])._remove_(anObject); return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},smalltalk.Set)})}, args: ["anObject"], source: "remove: anObject\x0a\x09elements remove: anObject", messageSends: ["remove:"], referencedClasses: [] }), smalltalk.Set); smalltalk.addMethod( smalltalk.method({ selector: "select:", category: 'enumerating', fn: function (aBlock){ var self=this; var collection; return smalltalk.withContext(function($ctx1) { var $1,$2; collection=_st(_st(self)._class())._new(); _st(self)._do_((function(each){ return smalltalk.withContext(function($ctx2) { $1=_st(aBlock)._value_(each); if(smalltalk.assert($1)){ return _st(collection)._add_(each); }; }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); $2=collection; return $2; }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},smalltalk.Set)})}, args: ["aBlock"], source: "select: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [:each |\x0a\x09\x09(aBlock value: each) ifTrue: [\x0a\x09\x09\x09collection add: each]].\x0a\x09^collection", messageSends: ["new", "class", "do:", "ifTrue:", "add:", "value:"], referencedClasses: [] }), smalltalk.Set); smalltalk.addMethod( smalltalk.method({ selector: "size", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self["@elements"])._size(); return $1; }, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Set)})}, args: [], source: "size\x0a\x09^elements size", messageSends: ["size"], referencedClasses: [] }), smalltalk.Set); smalltalk.addClass('Queue', smalltalk.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections'); smalltalk.Queue.comment="I am a one-sided queue.\x0a\x0a## Usage\x0a\x0aUse `#nextPut:` to add items to the queue.\x0aUse `#next` or `#nextIfAbsent:` to get (and remove) the next item in the queue.\x0a\x0a## Implementation notes\x0a\x0aA Queue uses two OrderedCollections inside,\x0a`read` is at the front, is not modified and only read using `readIndex`.\x0a`write` is at the back and is appended new items.\x0aWhen `read` is exhausted, `write` is promoted to `read` and new `write` is created.\x0a\x0aAs a consequence, no data moving is done by me, write appending may do data moving\x0awhen growing `write`, but this is left to engine to implement as good as it chooses to." smalltalk.addMethod( smalltalk.method({ selector: "initialize", category: 'initialization', fn: function (){ var self=this; function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} return smalltalk.withContext(function($ctx1) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []); self["@read"]=_st($OrderedCollection())._new(); self["@write"]=_st($OrderedCollection())._new(); self["@readIndex"]=(1); return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Queue)})}, args: [], source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1", messageSends: ["initialize", "new"], referencedClasses: ["OrderedCollection"] }), smalltalk.Queue); smalltalk.addMethod( smalltalk.method({ selector: "next", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._nextIfAbsent_((function(){ return smalltalk.withContext(function($ctx2) { return _st(self)._error_("Cannot read from empty Queue."); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"next",{},smalltalk.Queue)})}, args: [], source: "next\x0a\x09^self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]", messageSends: ["nextIfAbsent:", "error:"], referencedClasses: [] }), smalltalk.Queue); smalltalk.addMethod( smalltalk.method({ selector: "nextIfAbsent:", category: 'accessing', fn: function (aBlock){ var self=this; var result; function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)} return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4; var $early={}; try { result=_st(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){ return smalltalk.withContext(function($ctx2) { $1=_st(self["@write"])._isEmpty(); if(smalltalk.assert($1)){ $2=_st(self["@readIndex"]).__gt((1)); if(smalltalk.assert($2)){ self["@read"]=[]; self["@read"]; self["@readIndex"]=(1); self["@readIndex"]; }; $3=_st(aBlock)._value(); throw $early=[$3]; }; self["@read"]=self["@write"]; self["@read"]; self["@readIndex"]=(1); self["@readIndex"]; self["@write"]=_st($OrderedCollection())._new(); self["@write"]; return _st(self["@read"])._first(); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); _st(self["@read"])._at_put_(self["@readIndex"],nil); self["@readIndex"]=_st(self["@readIndex"]).__plus((1)); $4=result; return $4; } catch(e) {if(e===$early)return e[0]; throw e} }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},smalltalk.Queue)})}, args: ["aBlock"], source: "nextIfAbsent: aBlock\x0a\x09| result |\x0a\x09result := read at: readIndex ifAbsent: [\x0a\x09\x09write isEmpty ifTrue: [\x0a\x09\x09\x09readIndex > 1 ifTrue: [ read := #(). readIndex := 1 ].\x0a\x09\x09\x09^aBlock value ].\x0a\x09\x09read := write.\x0a\x09\x09readIndex := 1.\x0a\x09\x09write := OrderedCollection new.\x0a\x09\x09read first ].\x0a\x09read at: readIndex put: nil.\x0a\x09readIndex := readIndex + 1.\x0a\x09^result", messageSends: ["at:ifAbsent:", "ifTrue:", ">", "value", "isEmpty", "new", "first", "at:put:", "+"], referencedClasses: ["OrderedCollection"] }), smalltalk.Queue); smalltalk.addMethod( smalltalk.method({ selector: "nextPut:", category: 'accessing', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self["@write"])._add_(anObject); return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},smalltalk.Queue)})}, args: ["anObject"], source: "nextPut: anObject\x0a\x09write add: anObject", messageSends: ["add:"], referencedClasses: [] }), smalltalk.Queue); smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel-Collections'); smalltalk.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object." smalltalk.addMethod( smalltalk.method({ selector: "compile:", category: 'evaluating', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { return self.compile(aString); return self}, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},smalltalk.RegularExpression)})}, args: ["aString"], source: "compile: aString\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.RegularExpression); smalltalk.addMethod( smalltalk.method({ selector: "exec:", category: 'evaluating', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { return self.exec(aString) || nil; return self}, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},smalltalk.RegularExpression)})}, args: ["aString"], source: "exec: aString\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.RegularExpression); smalltalk.addMethod( smalltalk.method({ selector: "test:", category: 'evaluating', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { return self.test(aString); return self}, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},smalltalk.RegularExpression)})}, args: ["aString"], source: "test: aString\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.RegularExpression); smalltalk.addMethod( smalltalk.method({ selector: "fromString:", category: 'instance creation', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._fromString_flag_(aString,""); return $1; }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},smalltalk.RegularExpression.klass)})}, args: ["aString"], source: "fromString: aString\x0a\x09\x09^self fromString: aString flag: ''", messageSends: ["fromString:flag:"], referencedClasses: [] }), smalltalk.RegularExpression.klass); smalltalk.addMethod( smalltalk.method({ selector: "fromString:flag:", category: 'instance creation', fn: function (aString,anotherString){ var self=this; return smalltalk.withContext(function($ctx1) { return new RegExp(aString, anotherString); return self}, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},smalltalk.RegularExpression.klass)})}, args: ["aString", "anotherString"], source: "fromString: aString flag: anotherString\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.RegularExpression.klass); smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections'); smalltalk.Stream.comment="I represent an accessor for a sequence of objects. This sequence is referred to as my \x22contents\x22.\x0aMy instances are read/write streams to the contents sequence collection." smalltalk.addMethod( smalltalk.method({ selector: "<<", category: 'writing', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._write_(anObject); return self}, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},smalltalk.Stream)})}, args: ["anObject"], source: "<< anObject\x0a\x09self write: anObject", messageSends: ["write:"], referencedClasses: [] }), smalltalk.Stream); smalltalk.addMethod( smalltalk.method({ selector: "atEnd", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._position()).__eq(_st(self)._size()); return $1; }, function($ctx1) {$ctx1.fill(self,"atEnd",{},smalltalk.Stream)})}, args: [], source: "atEnd\x0a\x09^self position = self size", messageSends: ["=", "size", "position"], referencedClasses: [] }), smalltalk.Stream); smalltalk.addMethod( smalltalk.method({ selector: "atStart", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._position()).__eq((0)); return $1; }, function($ctx1) {$ctx1.fill(self,"atStart",{},smalltalk.Stream)})}, args: [], source: "atStart\x0a\x09^self position = 0", messageSends: ["=", "position"], referencedClasses: [] }), smalltalk.Stream); smalltalk.addMethod( smalltalk.method({ selector: "close", category: 'actions', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"close",{},smalltalk.Stream)})}, args: [], source: "close", messageSends: [], referencedClasses: [] }), smalltalk.Stream); smalltalk.addMethod( smalltalk.method({ selector: "collection", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@collection"]; return $1; }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.Stream)})}, args: [], source: "collection\x0a\x09^collection", messageSends: [], referencedClasses: [] }), smalltalk.Stream); smalltalk.addMethod( smalltalk.method({ selector: "contents", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._collection())._copyFrom_to_((1),_st(self)._streamSize()); return $1; }, function($ctx1) {$ctx1.fill(self,"contents",{},smalltalk.Stream)})}, args: [], source: "contents\x0a\x09^self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize", messageSends: ["copyFrom:to:", "streamSize", "collection"], referencedClasses: [] }), smalltalk.Stream); smalltalk.addMethod( smalltalk.method({ selector: "do:", category: 'enumerating', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { _st((function(){ return smalltalk.withContext(function($ctx2) { return _st(self)._atEnd(); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){ return smalltalk.withContext(function($ctx2) { return _st(aBlock)._value_(_st(self)._next()); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.Stream)})}, args: ["aBlock"], source: "do: aBlock\x0a\x09[self atEnd] whileFalse: [aBlock value: self next]", messageSends: ["whileFalse:", "value:", "next", "atEnd"], referencedClasses: [] }), smalltalk.Stream); smalltalk.addMethod( smalltalk.method({ selector: "flush", category: 'actions', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"flush",{},smalltalk.Stream)})}, args: [], source: "flush", messageSends: [], referencedClasses: [] }), smalltalk.Stream); smalltalk.addMethod( smalltalk.method({ selector: "isEmpty", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._size()).__eq((0)); return $1; }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},smalltalk.Stream)})}, args: [], source: "isEmpty\x0a\x09^self size = 0", messageSends: ["=", "size"], referencedClasses: [] }), smalltalk.Stream); smalltalk.addMethod( smalltalk.method({ selector: "next", category: 'reading', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=_st(self)._atEnd(); if(smalltalk.assert($2)){ $1=nil; } else { _st(self)._position_(_st(_st(self)._position()).__plus((1))); $1=_st(self["@collection"])._at_(_st(self)._position()); }; return $1; }, function($ctx1) {$ctx1.fill(self,"next",{},smalltalk.Stream)})}, args: [], source: "next\x0a\x09^self atEnd\x0a\x09\x09ifTrue: [nil]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09self position: self position + 1.\x0a\x09\x09\x09collection at: self position]", messageSends: ["ifTrue:ifFalse:", "position:", "+", "position", "at:", "atEnd"], referencedClasses: [] }), smalltalk.Stream); smalltalk.addMethod( smalltalk.method({ selector: "next:", category: 'reading', fn: function (anInteger){ var self=this; var tempCollection; return smalltalk.withContext(function($ctx1) { var $1,$2; tempCollection=_st(_st(_st(self)._collection())._class())._new(); _st(anInteger)._timesRepeat_((function(){ return smalltalk.withContext(function($ctx2) { $1=_st(self)._atEnd(); if(! smalltalk.assert($1)){ return _st(tempCollection)._add_(_st(self)._next()); }; }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); $2=tempCollection; return $2; }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},smalltalk.Stream)})}, args: ["anInteger"], source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09\x09self atEnd ifFalse: [\x0a\x09\x09tempCollection add: self next]].\x0a\x09^tempCollection", messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "add:", "next", "atEnd"], referencedClasses: [] }), smalltalk.Stream); smalltalk.addMethod( smalltalk.method({ selector: "nextPut:", category: 'writing', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._position_(_st(_st(self)._position()).__plus((1))); _st(_st(self)._collection())._at_put_(_st(self)._position(),anObject); _st(self)._setStreamSize_(_st(_st(self)._streamSize())._max_(_st(self)._position())); return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},smalltalk.Stream)})}, args: ["anObject"], source: "nextPut: anObject\x0a\x09self position: self position + 1.\x0a\x09self collection at: self position put: anObject.\x0a\x09self setStreamSize: (self streamSize max: self position)", messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"], referencedClasses: [] }), smalltalk.Stream); smalltalk.addMethod( smalltalk.method({ selector: "nextPutAll:", category: 'writing', fn: function (aCollection){ var self=this; return smalltalk.withContext(function($ctx1) { _st(aCollection)._do_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(self)._nextPut_(each); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},smalltalk.Stream)})}, args: ["aCollection"], source: "nextPutAll: aCollection\x0a\x09aCollection do: [:each |\x0a\x09\x09self nextPut: each]", messageSends: ["do:", "nextPut:"], referencedClasses: [] }), smalltalk.Stream); smalltalk.addMethod( smalltalk.method({ selector: "nextPutString:", category: 'writing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._nextPut_(aString); return self}, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},smalltalk.Stream)})}, args: ["aString"], source: "nextPutString: aString\x0a\x09self nextPut: aString", messageSends: ["nextPut:"], referencedClasses: [] }), smalltalk.Stream); smalltalk.addMethod( smalltalk.method({ selector: "peek", category: 'reading', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=_st(self)._atEnd(); if(! smalltalk.assert($2)){ $1=_st(_st(self)._collection())._at_(_st(_st(self)._position()).__plus((1))); }; return $1; }, function($ctx1) {$ctx1.fill(self,"peek",{},smalltalk.Stream)})}, args: [], source: "peek\x0a\x09^self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1]", messageSends: ["ifFalse:", "at:", "+", "position", "collection", "atEnd"], referencedClasses: [] }), smalltalk.Stream); smalltalk.addMethod( smalltalk.method({ selector: "position", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=self["@position"]; if(($receiver = $2) == nil || $receiver == undefined){ self["@position"]=(0); $1=self["@position"]; } else { $1=$2; }; return $1; }, function($ctx1) {$ctx1.fill(self,"position",{},smalltalk.Stream)})}, args: [], source: "position\x0a\x09^position ifNil: [position := 0]", messageSends: ["ifNil:"], referencedClasses: [] }), smalltalk.Stream); smalltalk.addMethod( smalltalk.method({ selector: "position:", category: 'accessing', fn: function (anInteger){ var self=this; return smalltalk.withContext(function($ctx1) { self["@position"]=anInteger; return self}, function($ctx1) {$ctx1.fill(self,"position:",{anInteger:anInteger},smalltalk.Stream)})}, args: ["anInteger"], source: "position: anInteger\x0a\x09position := anInteger", messageSends: [], referencedClasses: [] }), smalltalk.Stream); smalltalk.addMethod( smalltalk.method({ selector: "reset", category: 'actions', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._position_((0)); return self}, function($ctx1) {$ctx1.fill(self,"reset",{},smalltalk.Stream)})}, args: [], source: "reset\x0a\x09self position: 0", messageSends: ["position:"], referencedClasses: [] }), smalltalk.Stream); smalltalk.addMethod( smalltalk.method({ selector: "resetContents", category: 'actions', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._reset(); _st(self)._setStreamSize_((0)); return self}, function($ctx1) {$ctx1.fill(self,"resetContents",{},smalltalk.Stream)})}, args: [], source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0", messageSends: ["reset", "setStreamSize:"], referencedClasses: [] }), smalltalk.Stream); smalltalk.addMethod( smalltalk.method({ selector: "setCollection:", category: 'accessing', fn: function (aCollection){ var self=this; return smalltalk.withContext(function($ctx1) { self["@collection"]=aCollection; return self}, function($ctx1) {$ctx1.fill(self,"setCollection:",{aCollection:aCollection},smalltalk.Stream)})}, args: ["aCollection"], source: "setCollection: aCollection\x0a\x09collection := aCollection", messageSends: [], referencedClasses: [] }), smalltalk.Stream); smalltalk.addMethod( smalltalk.method({ selector: "setStreamSize:", category: 'accessing', fn: function (anInteger){ var self=this; return smalltalk.withContext(function($ctx1) { self["@streamSize"]=anInteger; return self}, function($ctx1) {$ctx1.fill(self,"setStreamSize:",{anInteger:anInteger},smalltalk.Stream)})}, args: ["anInteger"], source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger", messageSends: [], referencedClasses: [] }), smalltalk.Stream); smalltalk.addMethod( smalltalk.method({ selector: "setToEnd", category: 'positioning', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._position_(_st(self)._size()); return self}, function($ctx1) {$ctx1.fill(self,"setToEnd",{},smalltalk.Stream)})}, args: [], source: "setToEnd\x0a\x09self position: self size", messageSends: ["position:", "size"], referencedClasses: [] }), smalltalk.Stream); smalltalk.addMethod( smalltalk.method({ selector: "size", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._streamSize(); return $1; }, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Stream)})}, args: [], source: "size\x0a\x09^self streamSize", messageSends: ["streamSize"], referencedClasses: [] }), smalltalk.Stream); smalltalk.addMethod( smalltalk.method({ selector: "skip:", category: 'positioning', fn: function (anInteger){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._position_(_st(_st(_st(self)._position()).__plus(anInteger))._min_max_(_st(self)._size(),(0))); return self}, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},smalltalk.Stream)})}, args: ["anInteger"], source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)", messageSends: ["position:", "min:max:", "size", "+", "position"], referencedClasses: [] }), smalltalk.Stream); smalltalk.addMethod( smalltalk.method({ selector: "streamSize", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@streamSize"]; return $1; }, function($ctx1) {$ctx1.fill(self,"streamSize",{},smalltalk.Stream)})}, args: [], source: "streamSize\x0a\x09^streamSize", messageSends: [], referencedClasses: [] }), smalltalk.Stream); smalltalk.addMethod( smalltalk.method({ selector: "write:", category: 'writing', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { _st(anObject)._putOn_(self); return self}, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},smalltalk.Stream)})}, args: ["anObject"], source: "write: anObject\x0a\x09anObject putOn: self", messageSends: ["putOn:"], referencedClasses: [] }), smalltalk.Stream); smalltalk.addMethod( smalltalk.method({ selector: "on:", category: 'instance creation', fn: function (aCollection){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$3,$1; $2=_st(self)._new(); _st($2)._setCollection_(aCollection); _st($2)._setStreamSize_(_st(aCollection)._size()); $3=_st($2)._yourself(); $1=$3; return $1; }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},smalltalk.Stream.klass)})}, args: ["aCollection"], source: "on: aCollection\x0a\x09\x09^self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself", messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"], referencedClasses: [] }), smalltalk.Stream.klass); smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel-Collections'); smalltalk.StringStream.comment="I am a Stream specific to `String` objects." smalltalk.addMethod( smalltalk.method({ selector: "cr", category: 'writing', fn: function (){ var self=this; function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._nextPutAll_(_st($String())._cr()); return $1; }, function($ctx1) {$ctx1.fill(self,"cr",{},smalltalk.StringStream)})}, args: [], source: "cr\x0a\x09^self nextPutAll: String cr", messageSends: ["nextPutAll:", "cr"], referencedClasses: ["String"] }), smalltalk.StringStream); smalltalk.addMethod( smalltalk.method({ selector: "crlf", category: 'writing', fn: function (){ var self=this; function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._nextPutAll_(_st($String())._crlf()); return $1; }, function($ctx1) {$ctx1.fill(self,"crlf",{},smalltalk.StringStream)})}, args: [], source: "crlf\x0a\x09^self nextPutAll: String crlf", messageSends: ["nextPutAll:", "crlf"], referencedClasses: ["String"] }), smalltalk.StringStream); smalltalk.addMethod( smalltalk.method({ selector: "lf", category: 'writing', fn: function (){ var self=this; function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._nextPutAll_(_st($String())._lf()); return $1; }, function($ctx1) {$ctx1.fill(self,"lf",{},smalltalk.StringStream)})}, args: [], source: "lf\x0a\x09^self nextPutAll: String lf", messageSends: ["nextPutAll:", "lf"], referencedClasses: ["String"] }), smalltalk.StringStream); smalltalk.addMethod( smalltalk.method({ selector: "next:", category: 'reading', fn: function (anInteger){ var self=this; var tempCollection; return smalltalk.withContext(function($ctx1) { var $1,$2; tempCollection=_st(_st(_st(self)._collection())._class())._new(); _st(anInteger)._timesRepeat_((function(){ return smalltalk.withContext(function($ctx2) { $1=_st(self)._atEnd(); if(! smalltalk.assert($1)){ tempCollection=_st(tempCollection).__comma(_st(self)._next()); return tempCollection; }; }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); $2=tempCollection; return $2; }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},smalltalk.StringStream)})}, args: ["anInteger"], source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09\x09self atEnd ifFalse: [\x0a\x09\x09tempCollection := tempCollection, self next]].\x0a\x09^tempCollection", messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", ",", "next", "atEnd"], referencedClasses: [] }), smalltalk.StringStream); smalltalk.addMethod( smalltalk.method({ selector: "nextPut:", category: 'writing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._nextPutAll_(aString); return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},smalltalk.StringStream)})}, args: ["aString"], source: "nextPut: aString\x0a\x09self nextPutAll: aString", messageSends: ["nextPutAll:"], referencedClasses: [] }), smalltalk.StringStream); smalltalk.addMethod( smalltalk.method({ selector: "nextPutAll:", category: 'writing', fn: function (aString){ var self=this; var pre,post; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._atEnd(); if(smalltalk.assert($1)){ _st(self)._setCollection_(_st(_st(self)._collection()).__comma(aString)); } else { pre=_st(_st(self)._collection())._copyFrom_to_((1),_st(self)._position()); pre; post=_st(_st(self)._collection())._copyFrom_to_(_st(_st(_st(self)._position()).__plus((1))).__plus(_st(aString)._size()),_st(_st(self)._collection())._size()); post; _st(self)._setCollection_(_st(_st(pre).__comma(aString)).__comma(post)); }; _st(self)._position_(_st(_st(self)._position()).__plus(_st(aString)._size())); _st(self)._setStreamSize_(_st(_st(self)._streamSize())._max_(_st(self)._position())); return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},smalltalk.StringStream)})}, args: ["aString"], source: "nextPutAll: aString\x0a\x09| pre post |\x0a\x09self atEnd ifTrue: [ self setCollection: self collection, aString ] ifFalse: [\x0a\x09\x09pre := self collection copyFrom: 1 to: self position.\x0a\x09\x09post := self collection copyFrom: (self position + 1 + aString size) to: self collection size.\x0a\x09\x09self setCollection: pre, aString, post\x0a\x09].\x0a\x09self position: self position + aString size.\x0a\x09self setStreamSize: (self streamSize max: self position)", messageSends: ["ifTrue:ifFalse:", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "atEnd", "position:", "setStreamSize:", "max:", "streamSize"], referencedClasses: [] }), smalltalk.StringStream); smalltalk.addMethod( smalltalk.method({ selector: "nextPutString:", category: 'writing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._nextPutAll_(aString); return self}, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},smalltalk.StringStream)})}, args: ["aString"], source: "nextPutString: aString\x0a\x09self nextPutAll: aString", messageSends: ["nextPutAll:"], referencedClasses: [] }), smalltalk.StringStream); smalltalk.addMethod( smalltalk.method({ selector: "space", category: 'writing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._nextPut_(" "); return self}, function($ctx1) {$ctx1.fill(self,"space",{},smalltalk.StringStream)})}, args: [], source: "space\x0a\x09self nextPut: ' '", messageSends: ["nextPut:"], referencedClasses: [] }), smalltalk.StringStream); smalltalk.addMethod( smalltalk.method({ selector: "tab", category: 'writing', fn: function (){ var self=this; function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._nextPutAll_(_st($String())._tab()); return $1; }, function($ctx1) {$ctx1.fill(self,"tab",{},smalltalk.StringStream)})}, args: [], source: "tab\x0a\x09^self nextPutAll: String tab", messageSends: ["nextPutAll:", "tab"], referencedClasses: ["String"] }), smalltalk.StringStream); smalltalk.addPackage('Kernel-Exceptions'); smalltalk.addClass('Error', smalltalk.Object, ['messageText'], 'Kernel-Exceptions'); smalltalk.Error.comment="From the ANSI standard:\x0a\x0aThis protocol describes the behavior of instances of class `Error`.\x0aThese are used to represent error conditions that prevent the normal continuation of processing.\x0aActual error exceptions used by an application may be subclasses of this class.\x0aAs `Error` is explicitly specified to be subclassable, conforming implementations must implement its behavior in a non-fragile manner." smalltalk.addMethod( smalltalk.method({ selector: "context", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.context; return self}, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.Error)})}, args: [], source: "context\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Error); smalltalk.addMethod( smalltalk.method({ selector: "initialize", category: 'initialization', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._messageText_(_st("Errorclass: ").__comma(_st(_st(self)._class())._name())); return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Error)})}, args: [], source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).", messageSends: ["messageText:", ",", "name", "class"], referencedClasses: [] }), smalltalk.Error); smalltalk.addMethod( smalltalk.method({ selector: "isSmalltalkError", category: 'testing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.smalltalkError === true; return self}, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},smalltalk.Error)})}, args: [], source: "isSmalltalkError\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Error); smalltalk.addMethod( smalltalk.method({ selector: "jsStack", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self.stack; return self}, function($ctx1) {$ctx1.fill(self,"jsStack",{},smalltalk.Error)})}, args: [], source: "jsStack\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Error); smalltalk.addMethod( smalltalk.method({ selector: "messageText", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@messageText"]; return $1; }, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.Error)})}, args: [], source: "messageText\x0a\x09^messageText", messageSends: [], referencedClasses: [] }), smalltalk.Error); smalltalk.addMethod( smalltalk.method({ selector: "messageText:", category: 'accessing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { self["@messageText"]=aString; return self}, function($ctx1) {$ctx1.fill(self,"messageText:",{aString:aString},smalltalk.Error)})}, args: ["aString"], source: "messageText: aString\x0a\x09messageText := aString", messageSends: [], referencedClasses: [] }), smalltalk.Error); smalltalk.addMethod( smalltalk.method({ selector: "signal", category: 'signaling', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self); return self}, function($ctx1) {$ctx1.fill(self,"signal",{},smalltalk.Error)})}, args: [], source: "signal\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Error); smalltalk.addMethod( smalltalk.method({ selector: "signal:", category: 'signaling', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._messageText_(aString); _st(self)._signal(); return self}, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},smalltalk.Error)})}, args: ["aString"], source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal", messageSends: ["messageText:", "signal"], referencedClasses: [] }), smalltalk.Error); smalltalk.addMethod( smalltalk.method({ selector: "signal", category: 'instance creation', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._new())._signal(); return $1; }, function($ctx1) {$ctx1.fill(self,"signal",{},smalltalk.Error.klass)})}, args: [], source: "signal\x0a\x09^self new signal", messageSends: ["signal", "new"], referencedClasses: [] }), smalltalk.Error.klass); smalltalk.addMethod( smalltalk.method({ selector: "signal:", category: 'instance creation', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._new())._signal_(aString); return $1; }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},smalltalk.Error.klass)})}, args: ["aString"], source: "signal: aString\x0a\x09\x09^self new\x0a\x09\x09signal: aString", messageSends: ["signal:", "new"], referencedClasses: [] }), smalltalk.Error.klass); smalltalk.addClass('JavaScriptException', smalltalk.Error, ['exception'], 'Kernel-Exceptions'); smalltalk.JavaScriptException.comment="A JavaScriptException is thrown when a non-Smalltalk exception occurs while in the Smalltalk stack.\x0aSee `boot.js` `inContext()` and `BlockClosure >> on:do:`" smalltalk.addMethod( smalltalk.method({ selector: "context:", category: 'accessing', fn: function (aMethodContext){ var self=this; return smalltalk.withContext(function($ctx1) { self.context = aMethodContext; return self}, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},smalltalk.JavaScriptException)})}, args: ["aMethodContext"], source: "context: aMethodContext\x0a\x09\x22Set the context from the outside.\x0a\x09See boot.js `inContext()` exception handling\x22\x0a\x09\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.JavaScriptException); smalltalk.addMethod( smalltalk.method({ selector: "exception", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@exception"]; return $1; }, function($ctx1) {$ctx1.fill(self,"exception",{},smalltalk.JavaScriptException)})}, args: [], source: "exception\x0a\x09^ exception", messageSends: [], referencedClasses: [] }), smalltalk.JavaScriptException); smalltalk.addMethod( smalltalk.method({ selector: "exception:", category: 'accessing', fn: function (anException){ var self=this; return smalltalk.withContext(function($ctx1) { self["@exception"]=anException; return self}, function($ctx1) {$ctx1.fill(self,"exception:",{anException:anException},smalltalk.JavaScriptException)})}, args: ["anException"], source: "exception: anException\x0a\x09exception := anException", messageSends: [], referencedClasses: [] }), smalltalk.JavaScriptException); smalltalk.addMethod( smalltalk.method({ selector: "messageText", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return 'JavaScript exception: ' + self["@exception"].toString(); return self}, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.JavaScriptException)})}, args: [], source: "messageText\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.JavaScriptException); smalltalk.addMethod( smalltalk.method({ selector: "on:", category: 'instance creation', fn: function (anException){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$3,$1; $2=_st(self)._new(); _st($2)._exception_(anException); $3=_st($2)._yourself(); $1=$3; return $1; }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},smalltalk.JavaScriptException.klass)})}, args: ["anException"], source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself", messageSends: ["exception:", "new", "yourself"], referencedClasses: [] }), smalltalk.JavaScriptException.klass); smalltalk.addMethod( smalltalk.method({ selector: "on:context:", category: 'instance creation', fn: function (anException,aMethodContext){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$3,$1; $2=_st(self)._new(); _st($2)._exception_(anException); _st($2)._context_(aMethodContext); $3=_st($2)._yourself(); $1=$3; return $1; }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},smalltalk.JavaScriptException.klass)})}, args: ["anException", "aMethodContext"], source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself", messageSends: ["exception:", "new", "context:", "yourself"], referencedClasses: [] }), smalltalk.JavaScriptException.klass); smalltalk.addClass('MessageNotUnderstood', smalltalk.Error, ['message', 'receiver'], 'Kernel-Exceptions'); smalltalk.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`." smalltalk.addMethod( smalltalk.method({ selector: "message", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@message"]; return $1; }, function($ctx1) {$ctx1.fill(self,"message",{},smalltalk.MessageNotUnderstood)})}, args: [], source: "message\x0a\x09^message", messageSends: [], referencedClasses: [] }), smalltalk.MessageNotUnderstood); smalltalk.addMethod( smalltalk.method({ selector: "message:", category: 'accessing', fn: function (aMessage){ var self=this; return smalltalk.withContext(function($ctx1) { self["@message"]=aMessage; return self}, function($ctx1) {$ctx1.fill(self,"message:",{aMessage:aMessage},smalltalk.MessageNotUnderstood)})}, args: ["aMessage"], source: "message: aMessage\x0a\x09message := aMessage", messageSends: [], referencedClasses: [] }), smalltalk.MessageNotUnderstood); smalltalk.addMethod( smalltalk.method({ selector: "messageText", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(_st(_st(self)._receiver())._asString()).__comma(" does not understand #")).__comma(_st(_st(self)._message())._selector()); return $1; }, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.MessageNotUnderstood)})}, args: [], source: "messageText\x0a\x09^self receiver asString, ' does not understand #', self message selector", messageSends: [",", "selector", "message", "asString", "receiver"], referencedClasses: [] }), smalltalk.MessageNotUnderstood); smalltalk.addMethod( smalltalk.method({ selector: "receiver", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@receiver"]; return $1; }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.MessageNotUnderstood)})}, args: [], source: "receiver\x0a\x09^receiver", messageSends: [], referencedClasses: [] }), smalltalk.MessageNotUnderstood); smalltalk.addMethod( smalltalk.method({ selector: "receiver:", category: 'accessing', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { self["@receiver"]=anObject; return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},smalltalk.MessageNotUnderstood)})}, args: ["anObject"], source: "receiver: anObject\x0a\x09receiver := anObject", messageSends: [], referencedClasses: [] }), smalltalk.MessageNotUnderstood); smalltalk.addClass('NonBooleanReceiver', smalltalk.Error, ['object'], 'Kernel-Exceptions'); smalltalk.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver." smalltalk.addMethod( smalltalk.method({ selector: "object", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@object"]; return $1; }, function($ctx1) {$ctx1.fill(self,"object",{},smalltalk.NonBooleanReceiver)})}, args: [], source: "object\x0a\x09^ object", messageSends: [], referencedClasses: [] }), smalltalk.NonBooleanReceiver); smalltalk.addMethod( smalltalk.method({ selector: "object:", category: 'accessing', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { self["@object"]=anObject; return self}, function($ctx1) {$ctx1.fill(self,"object:",{anObject:anObject},smalltalk.NonBooleanReceiver)})}, args: ["anObject"], source: "object: anObject\x0a\x09object := anObject", messageSends: [], referencedClasses: [] }), smalltalk.NonBooleanReceiver); smalltalk.addClass('ErrorHandler', smalltalk.Object, [], 'Kernel-Exceptions'); smalltalk.ErrorHandler.comment="ErrorHandler is used to manage Smalltalk errors.\x0aSee `boot.js` `handleError()` function.\x0a\x0aSubclasses of `ErrorHandler` can register themselves as the current handler with\x0a`ErrorHandler class >> register`.\x0a\x0aSubclasses may override `#handleError:` to perform an action on the thrown exception.\x0aThe default behavior is to log the error and the context stack to the JavaScript console." smalltalk.addMethod( smalltalk.method({ selector: "handleError:", category: 'error handling', fn: function (anError){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(anError)._context(); if(($receiver = $1) == nil || $receiver == undefined){ $1; } else { _st(self)._logErrorContext_(_st(anError)._context()); }; _st(self)._logError_(anError); return self}, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},smalltalk.ErrorHandler)})}, args: ["anError"], source: "handleError: anError\x0a\x09anError context ifNotNil: [self logErrorContext: anError context].\x0a\x09self logError: anError", messageSends: ["ifNotNil:", "logErrorContext:", "context", "logError:"], referencedClasses: [] }), smalltalk.ErrorHandler); smalltalk.addMethod( smalltalk.method({ selector: "log:", category: 'private', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { _st(console)._log_(aString); return self}, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},smalltalk.ErrorHandler)})}, args: ["aString"], source: "log: aString\x0a\x09console log: aString", messageSends: ["log:"], referencedClasses: [] }), smalltalk.ErrorHandler); smalltalk.addMethod( smalltalk.method({ selector: "logContext:", category: 'private', fn: function (aContext){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(aContext)._home(); if(($receiver = $1) == nil || $receiver == undefined){ $1; } else { _st(self)._logContext_(_st(aContext)._home()); }; _st(self)._log_(_st(_st(_st(_st(aContext)._receiver())._asString()).__comma(">>")).__comma(_st(_st(aContext)._selector())._asString())); return self}, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},smalltalk.ErrorHandler)})}, args: ["aContext"], source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home].\x0a\x09self log: aContext receiver asString, '>>', aContext selector asString", messageSends: ["ifNotNil:", "logContext:", "home", "log:", ",", "asString", "selector", "receiver"], referencedClasses: [] }), smalltalk.ErrorHandler); smalltalk.addMethod( smalltalk.method({ selector: "logError:", category: 'private', fn: function (anError){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._log_(_st(anError)._messageText()); return self}, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},smalltalk.ErrorHandler)})}, args: ["anError"], source: "logError: anError\x0a\x09self log: anError messageText", messageSends: ["log:", "messageText"], referencedClasses: [] }), smalltalk.ErrorHandler); smalltalk.addMethod( smalltalk.method({ selector: "logErrorContext:", category: 'private', fn: function (aContext){ var self=this; return smalltalk.withContext(function($ctx1) { var $1,$2; $1=aContext; if(($receiver = $1) == nil || $receiver == undefined){ $1; } else { $2=_st(aContext)._home(); if(($receiver = $2) == nil || $receiver == undefined){ $2; } else { _st(self)._logContext_(_st(aContext)._home()); }; }; return self}, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},smalltalk.ErrorHandler)})}, args: ["aContext"], source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home]]", messageSends: ["ifNotNil:", "logContext:", "home"], referencedClasses: [] }), smalltalk.ErrorHandler); smalltalk.ErrorHandler.klass.iVarNames = ['current']; smalltalk.addMethod( smalltalk.method({ selector: "current", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=self["@current"]; if(($receiver = $2) == nil || $receiver == undefined){ self["@current"]=_st(self)._new(); $1=self["@current"]; } else { $1=$2; }; return $1; }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.ErrorHandler.klass)})}, args: [], source: "current\x0a\x09^current ifNil: [current := self new]", messageSends: ["ifNil:", "new"], referencedClasses: [] }), smalltalk.ErrorHandler.klass); smalltalk.addMethod( smalltalk.method({ selector: "initialize", category: 'initialization', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._register(); return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ErrorHandler.klass)})}, args: [], source: "initialize\x0a\x09self register", messageSends: ["register"], referencedClasses: [] }), smalltalk.ErrorHandler.klass); smalltalk.addMethod( smalltalk.method({ selector: "register", category: 'initialization', fn: function (){ var self=this; function $ErrorHandler(){return smalltalk.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)} return smalltalk.withContext(function($ctx1) { _st($ErrorHandler())._setCurrent_(_st(self)._new()); return self}, function($ctx1) {$ctx1.fill(self,"register",{},smalltalk.ErrorHandler.klass)})}, args: [], source: "register\x0a\x09ErrorHandler setCurrent: self new", messageSends: ["setCurrent:", "new"], referencedClasses: ["ErrorHandler"] }), smalltalk.ErrorHandler.klass); smalltalk.addMethod( smalltalk.method({ selector: "setCurrent:", category: 'accessing', fn: function (anHandler){ var self=this; return smalltalk.withContext(function($ctx1) { self["@current"]=anHandler; return self}, function($ctx1) {$ctx1.fill(self,"setCurrent:",{anHandler:anHandler},smalltalk.ErrorHandler.klass)})}, args: ["anHandler"], source: "setCurrent: anHandler\x0a\x09current := anHandler", messageSends: [], referencedClasses: [] }), smalltalk.ErrorHandler.klass); smalltalk.addPackage('Kernel-Transcript'); smalltalk.addClass('ConsoleTranscript', smalltalk.Object, ['textarea'], 'Kernel-Transcript'); smalltalk.addMethod( smalltalk.method({ selector: "clear", category: 'printing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"clear",{},smalltalk.ConsoleTranscript)})}, args: [], source: "clear\x0a\x09\x22no op\x22", messageSends: [], referencedClasses: [] }), smalltalk.ConsoleTranscript); smalltalk.addMethod( smalltalk.method({ selector: "cr", category: 'printing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"cr",{},smalltalk.ConsoleTranscript)})}, args: [], source: "cr\x0a\x09\x22no op\x22", messageSends: [], referencedClasses: [] }), smalltalk.ConsoleTranscript); smalltalk.addMethod( smalltalk.method({ selector: "open", category: 'actions', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"open",{},smalltalk.ConsoleTranscript)})}, args: [], source: "open", messageSends: [], referencedClasses: [] }), smalltalk.ConsoleTranscript); smalltalk.addMethod( smalltalk.method({ selector: "show:", category: 'printing', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { console.log(String(string._asString())); return self}, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},smalltalk.ConsoleTranscript)})}, args: ["anObject"], source: "show: anObject\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.ConsoleTranscript); smalltalk.addMethod( smalltalk.method({ selector: "initialize", category: 'initialization', fn: function (){ var self=this; function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)} return smalltalk.withContext(function($ctx1) { _st($Transcript())._register_(_st(self)._new()); return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ConsoleTranscript.klass)})}, args: [], source: "initialize\x0a\x09Transcript register: self new", messageSends: ["register:", "new"], referencedClasses: ["Transcript"] }), smalltalk.ConsoleTranscript.klass); smalltalk.addClass('Transcript', smalltalk.Object, ['textarea'], 'Kernel-Transcript'); smalltalk.Transcript.klass.iVarNames = ['current']; smalltalk.addMethod( smalltalk.method({ selector: "clear", category: 'printing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { _st(_st(self)._current())._clear(); return self}, function($ctx1) {$ctx1.fill(self,"clear",{},smalltalk.Transcript.klass)})}, args: [], source: "clear\x0a\x09self current clear", messageSends: ["clear", "current"], referencedClasses: [] }), smalltalk.Transcript.klass); smalltalk.addMethod( smalltalk.method({ selector: "cr", category: 'printing', fn: function (){ var self=this; function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)} return smalltalk.withContext(function($ctx1) { _st(_st(self)._current())._show_(_st($String())._cr()); return self}, function($ctx1) {$ctx1.fill(self,"cr",{},smalltalk.Transcript.klass)})}, args: [], source: "cr\x0a\x09self current show: String cr", messageSends: ["show:", "cr", "current"], referencedClasses: ["String"] }), smalltalk.Transcript.klass); smalltalk.addMethod( smalltalk.method({ selector: "current", category: 'instance creation', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@current"]; return $1; }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.Transcript.klass)})}, args: [], source: "current\x0a\x09^current", messageSends: [], referencedClasses: [] }), smalltalk.Transcript.klass); smalltalk.addMethod( smalltalk.method({ selector: "new", category: 'instance creation', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._shouldNotImplement(); return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.Transcript.klass)})}, args: [], source: "new\x0a\x09self shouldNotImplement", messageSends: ["shouldNotImplement"], referencedClasses: [] }), smalltalk.Transcript.klass); smalltalk.addMethod( smalltalk.method({ selector: "open", category: 'instance creation', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { _st(_st(self)._current())._open(); return self}, function($ctx1) {$ctx1.fill(self,"open",{},smalltalk.Transcript.klass)})}, args: [], source: "open\x0a\x09self current open", messageSends: ["open", "current"], referencedClasses: [] }), smalltalk.Transcript.klass); smalltalk.addMethod( smalltalk.method({ selector: "register:", category: 'instance creation', fn: function (aTranscript){ var self=this; return smalltalk.withContext(function($ctx1) { self["@current"]=aTranscript; return self}, function($ctx1) {$ctx1.fill(self,"register:",{aTranscript:aTranscript},smalltalk.Transcript.klass)})}, args: ["aTranscript"], source: "register: aTranscript\x0a\x09current := aTranscript", messageSends: [], referencedClasses: [] }), smalltalk.Transcript.klass); smalltalk.addMethod( smalltalk.method({ selector: "show:", category: 'printing', fn: function (anObject){ var self=this; return smalltalk.withContext(function($ctx1) { _st(_st(self)._current())._show_(anObject); return self}, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},smalltalk.Transcript.klass)})}, args: ["anObject"], source: "show: anObject\x0a\x09self current show: anObject", messageSends: ["show:", "current"], referencedClasses: [] }), smalltalk.Transcript.klass); smalltalk.addPackage('Kernel-Announcements'); smalltalk.addClass('AnnouncementSubscription', smalltalk.Object, ['block', 'announcementClass'], 'Kernel-Announcements'); smalltalk.AnnouncementSubscription.comment="The subscription is a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible." smalltalk.addMethod( smalltalk.method({ selector: "announcementClass", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@announcementClass"]; return $1; }, function($ctx1) {$ctx1.fill(self,"announcementClass",{},smalltalk.AnnouncementSubscription)})}, args: [], source: "announcementClass\x0a\x09^ announcementClass", messageSends: [], referencedClasses: [] }), smalltalk.AnnouncementSubscription); smalltalk.addMethod( smalltalk.method({ selector: "announcementClass:", category: 'accessing', fn: function (aClass){ var self=this; return smalltalk.withContext(function($ctx1) { self["@announcementClass"]=aClass; return self}, function($ctx1) {$ctx1.fill(self,"announcementClass:",{aClass:aClass},smalltalk.AnnouncementSubscription)})}, args: ["aClass"], source: "announcementClass: aClass\x0a\x09announcementClass := aClass", messageSends: [], referencedClasses: [] }), smalltalk.AnnouncementSubscription); smalltalk.addMethod( smalltalk.method({ selector: "block", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@block"]; return $1; }, function($ctx1) {$ctx1.fill(self,"block",{},smalltalk.AnnouncementSubscription)})}, args: [], source: "block\x0a\x09^block", messageSends: [], referencedClasses: [] }), smalltalk.AnnouncementSubscription); smalltalk.addMethod( smalltalk.method({ selector: "block:", category: 'accessing', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { self["@block"]=aBlock; return self}, function($ctx1) {$ctx1.fill(self,"block:",{aBlock:aBlock},smalltalk.AnnouncementSubscription)})}, args: ["aBlock"], source: "block: aBlock\x0a\x09block := aBlock", messageSends: [], referencedClasses: [] }), smalltalk.AnnouncementSubscription); smalltalk.addMethod( smalltalk.method({ selector: "deliver:", category: 'announcing', fn: function (anAnnouncement){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(self)._handlesAnnouncement_(anAnnouncement); if(smalltalk.assert($1)){ _st(_st(self)._block())._value_(anAnnouncement); }; return self}, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},smalltalk.AnnouncementSubscription)})}, args: ["anAnnouncement"], source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [self block value: anAnnouncement]", messageSends: ["ifTrue:", "value:", "block", "handlesAnnouncement:"], referencedClasses: [] }), smalltalk.AnnouncementSubscription); smalltalk.addMethod( smalltalk.method({ selector: "handlesAnnouncement:", category: 'announcing', fn: function (anAnnouncement){ var self=this; function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)} return smalltalk.withContext(function($ctx1) { var $2,$1; $2=_st(_st($Smalltalk())._current())._at_(_st(_st(self)._announcementClass())._name()); if(($receiver = $2) == nil || $receiver == undefined){ return false; } else { var class_; class_=$receiver; $1=_st(class_)._includesBehavior_(_st(_st($Smalltalk())._current())._at_(_st(_st(_st(anAnnouncement)._class())._theNonMetaClass())._name())); }; return $1; }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},smalltalk.AnnouncementSubscription)})}, args: ["anAnnouncement"], source: "handlesAnnouncement: anAnnouncement\x0a\x09\x22anAnnouncement might be announced from within another Amber environment\x22\x0a\x09\x0a\x09^ (Smalltalk current at: self announcementClass name)\x0a\x09\x09ifNil: [ ^ false ]\x0a\x09\x09ifNotNil: [ :class |\x0a\x09\x09class includesBehavior: (Smalltalk current at: anAnnouncement class theNonMetaClass name) ]", messageSends: ["ifNil:ifNotNil:", "includesBehavior:", "at:", "name", "theNonMetaClass", "class", "current", "announcementClass"], referencedClasses: ["Smalltalk"] }), smalltalk.AnnouncementSubscription); smalltalk.addClass('Announcer', smalltalk.Object, ['registry', 'subscriptions'], 'Kernel-Announcements'); smalltalk.Announcer.comment="The code is based on the announcements as [described by Vassili Bykov](http://www.cincomsmalltalk.com/userblogs/vbykov/blogView?searchCategory=Announcements%20Framework).\x0aThe Announcer holds annoncement subscriptions (`AnnouncementSubscription`) in a private registry.\x0a\x0aUse `#on:do:` to register subscriptions." smalltalk.addMethod( smalltalk.method({ selector: "announce:", category: 'announcing', fn: function (anAnnouncement){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self["@subscriptions"])._do_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(each)._deliver_(anAnnouncement); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},smalltalk.Announcer)})}, args: ["anAnnouncement"], source: "announce: anAnnouncement\x0a\x09subscriptions do: [:each |\x0a\x09\x09each deliver: anAnnouncement]", messageSends: ["do:", "deliver:"], referencedClasses: [] }), smalltalk.Announcer); smalltalk.addMethod( smalltalk.method({ selector: "initialize", category: 'initialization', fn: function (){ var self=this; function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)} return smalltalk.withContext(function($ctx1) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []); self["@subscriptions"]=_st($Array())._new(); return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Announcer)})}, args: [], source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := Array new", messageSends: ["initialize", "new"], referencedClasses: ["Array"] }), smalltalk.Announcer); smalltalk.addMethod( smalltalk.method({ selector: "on:do:", category: 'subscribing', fn: function (aClass,aBlock){ var self=this; function $AnnouncementSubscription(){return smalltalk.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)} return smalltalk.withContext(function($ctx1) { var $1,$2; $1=_st($AnnouncementSubscription())._new(); _st($1)._block_(aBlock); _st($1)._announcementClass_(aClass); $2=_st($1)._yourself(); _st(self["@subscriptions"])._add_($2); return self}, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},smalltalk.Announcer)})}, args: ["aClass", "aBlock"], source: "on: aClass do: aBlock\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09block: aBlock;\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)", messageSends: ["add:", "block:", "new", "announcementClass:", "yourself"], referencedClasses: ["AnnouncementSubscription"] }), smalltalk.Announcer); smalltalk.addClass('SystemAnnouncer', smalltalk.Announcer, [], 'Kernel-Announcements'); smalltalk.SystemAnnouncer.comment="My unique instance #current is the global announcer handling all Amber system-related announces" smalltalk.SystemAnnouncer.klass.iVarNames = ['current']; smalltalk.addMethod( smalltalk.method({ selector: "current", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=self["@current"]; if(($receiver = $2) == nil || $receiver == undefined){ self["@current"]=smalltalk.Announcer.klass.fn.prototype._new.apply(_st(self), []); $1=self["@current"]; } else { $1=$2; }; return $1; }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.SystemAnnouncer.klass)})}, args: [], source: "current\x0a\x09^ current ifNil: [ current := super new ]", messageSends: ["ifNil:", "new"], referencedClasses: [] }), smalltalk.SystemAnnouncer.klass); smalltalk.addMethod( smalltalk.method({ selector: "new", category: 'instance creation', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._shouldNotImplement(); return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.SystemAnnouncer.klass)})}, args: [], source: "new\x0a\x09self shouldNotImplement", messageSends: ["shouldNotImplement"], referencedClasses: [] }), smalltalk.SystemAnnouncer.klass); smalltalk.addClass('SystemAnnouncement', smalltalk.Object, ['theClass'], 'Kernel-Announcements'); smalltalk.SystemAnnouncement.comment="I am the superclass of all system announcements" smalltalk.addMethod( smalltalk.method({ selector: "theClass", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@theClass"]; return $1; }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.SystemAnnouncement)})}, args: [], source: "theClass\x0a\x09^ theClass", messageSends: [], referencedClasses: [] }), smalltalk.SystemAnnouncement); smalltalk.addMethod( smalltalk.method({ selector: "theClass:", category: 'accessing', fn: function (aClass){ var self=this; return smalltalk.withContext(function($ctx1) { self["@theClass"]=aClass; return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.SystemAnnouncement)})}, args: ["aClass"], source: "theClass: aClass\x0a\x09theClass := aClass", messageSends: [], referencedClasses: [] }), smalltalk.SystemAnnouncement); smalltalk.addClass('ClassAnnouncement', smalltalk.SystemAnnouncement, ['theClass'], 'Kernel-Announcements'); smalltalk.addMethod( smalltalk.method({ selector: "theClass", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@theClass"]; return $1; }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ClassAnnouncement)})}, args: [], source: "theClass\x0a\x09^ theClass", messageSends: [], referencedClasses: [] }), smalltalk.ClassAnnouncement); smalltalk.addMethod( smalltalk.method({ selector: "theClass:", category: 'accessing', fn: function (aClass){ var self=this; return smalltalk.withContext(function($ctx1) { self["@theClass"]=aClass; return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.ClassAnnouncement)})}, args: ["aClass"], source: "theClass: aClass\x0a\x09theClass := aClass", messageSends: [], referencedClasses: [] }), smalltalk.ClassAnnouncement); smalltalk.addClass('ClassAdded', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements'); smalltalk.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods" smalltalk.addClass('ClassCommentChanged', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements'); smalltalk.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)" smalltalk.addClass('ClassDefinitionChanged', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements'); smalltalk.ClassDefinitionChanged.comment="I am emitted when the defintion of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:" smalltalk.addClass('ClassMoved', smalltalk.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements'); smalltalk.addMethod( smalltalk.method({ selector: "oldPackage", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@oldPackage"]; return $1; }, function($ctx1) {$ctx1.fill(self,"oldPackage",{},smalltalk.ClassMoved)})}, args: [], source: "oldPackage\x0a\x09^ oldPackage", messageSends: [], referencedClasses: [] }), smalltalk.ClassMoved); smalltalk.addMethod( smalltalk.method({ selector: "oldPackage:", category: 'accessing', fn: function (aPackage){ var self=this; return smalltalk.withContext(function($ctx1) { self["@oldPackage"]=aPackage; return self}, function($ctx1) {$ctx1.fill(self,"oldPackage:",{aPackage:aPackage},smalltalk.ClassMoved)})}, args: ["aPackage"], source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage", messageSends: [], referencedClasses: [] }), smalltalk.ClassMoved); smalltalk.addClass('ClassRemoved', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements'); smalltalk.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:" smalltalk.addClass('ClassRenamed', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements'); smalltalk.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:" smalltalk.addClass('MethodAnnouncement', smalltalk.SystemAnnouncement, ['method'], 'Kernel-Announcements'); smalltalk.addMethod( smalltalk.method({ selector: "method", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@method"]; return $1; }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.MethodAnnouncement)})}, args: [], source: "method\x0a\x09^ method", messageSends: [], referencedClasses: [] }), smalltalk.MethodAnnouncement); smalltalk.addMethod( smalltalk.method({ selector: "method:", category: 'accessing', fn: function (aCompiledMethod){ var self=this; return smalltalk.withContext(function($ctx1) { self["@method"]=aCompiledMethod; return self}, function($ctx1) {$ctx1.fill(self,"method:",{aCompiledMethod:aCompiledMethod},smalltalk.MethodAnnouncement)})}, args: ["aCompiledMethod"], source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod", messageSends: [], referencedClasses: [] }), smalltalk.MethodAnnouncement); smalltalk.addClass('MethodAdded', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements'); smalltalk.addClass('MethodModified', smalltalk.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements'); smalltalk.addMethod( smalltalk.method({ selector: "oldMethod", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@oldMethod"]; return $1; }, function($ctx1) {$ctx1.fill(self,"oldMethod",{},smalltalk.MethodModified)})}, args: [], source: "oldMethod\x0a\x09^ oldMethod", messageSends: [], referencedClasses: [] }), smalltalk.MethodModified); smalltalk.addMethod( smalltalk.method({ selector: "oldMethod:", category: 'accessing', fn: function (aMethod){ var self=this; return smalltalk.withContext(function($ctx1) { self["@oldMethod"]=aMethod; return self}, function($ctx1) {$ctx1.fill(self,"oldMethod:",{aMethod:aMethod},smalltalk.MethodModified)})}, args: ["aMethod"], source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod", messageSends: [], referencedClasses: [] }), smalltalk.MethodModified); smalltalk.addClass('MethodMoved', smalltalk.MethodAnnouncement, ['oldProtocol'], 'Kernel-Announcements'); smalltalk.addMethod( smalltalk.method({ selector: "oldProtocol", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@oldProtocol"]; return $1; }, function($ctx1) {$ctx1.fill(self,"oldProtocol",{},smalltalk.MethodMoved)})}, args: [], source: "oldProtocol\x0a\x09^ oldProtocol", messageSends: [], referencedClasses: [] }), smalltalk.MethodMoved); smalltalk.addMethod( smalltalk.method({ selector: "oldProtocol:", category: 'accessing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { self["@oldProtocol"]=aString; return self}, function($ctx1) {$ctx1.fill(self,"oldProtocol:",{aString:aString},smalltalk.MethodMoved)})}, args: ["aString"], source: "oldProtocol: aString\x0a\x09oldProtocol := aString", messageSends: [], referencedClasses: [] }), smalltalk.MethodMoved); smalltalk.addClass('MethodRemoved', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements'); smalltalk.addClass('PackageAnnouncement', smalltalk.SystemAnnouncement, ['package'], 'Kernel-Announcements'); smalltalk.addMethod( smalltalk.method({ selector: "package", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@package"]; return $1; }, function($ctx1) {$ctx1.fill(self,"package",{},smalltalk.PackageAnnouncement)})}, args: [], source: "package\x0a\x09^ package", messageSends: [], referencedClasses: [] }), smalltalk.PackageAnnouncement); smalltalk.addMethod( smalltalk.method({ selector: "package:", category: 'accessing', fn: function (aPackage){ var self=this; return smalltalk.withContext(function($ctx1) { self["@package"]=aPackage; return self}, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage},smalltalk.PackageAnnouncement)})}, args: ["aPackage"], source: "package: aPackage\x0a\x09package := aPackage", messageSends: [], referencedClasses: [] }), smalltalk.PackageAnnouncement); smalltalk.addClass('PackageAdded', smalltalk.PackageAnnouncement, [], 'Kernel-Announcements'); smalltalk.addClass('PackageRemoved', smalltalk.PackageAnnouncement, [], 'Kernel-Announcements'); smalltalk.addClass('ProtocolAnnouncement', smalltalk.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements'); smalltalk.addMethod( smalltalk.method({ selector: "protocol", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@protocol"]; return $1; }, function($ctx1) {$ctx1.fill(self,"protocol",{},smalltalk.ProtocolAnnouncement)})}, args: [], source: "protocol\x0a\x09^ protocol", messageSends: [], referencedClasses: [] }), smalltalk.ProtocolAnnouncement); smalltalk.addMethod( smalltalk.method({ selector: "protocol:", category: 'accessing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { self["@protocol"]=aString; return self}, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString},smalltalk.ProtocolAnnouncement)})}, args: ["aString"], source: "protocol: aString\x0a\x09protocol := aString", messageSends: [], referencedClasses: [] }), smalltalk.ProtocolAnnouncement); smalltalk.addMethod( smalltalk.method({ selector: "theClass", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@theClass"]; return $1; }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ProtocolAnnouncement)})}, args: [], source: "theClass\x0a\x09^ theClass", messageSends: [], referencedClasses: [] }), smalltalk.ProtocolAnnouncement); smalltalk.addMethod( smalltalk.method({ selector: "theClass:", category: 'accessing', fn: function (aClass){ var self=this; return smalltalk.withContext(function($ctx1) { self["@theClass"]=aClass; return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.ProtocolAnnouncement)})}, args: ["aClass"], source: "theClass: aClass\x0a\x09theClass := aClass", messageSends: [], referencedClasses: [] }), smalltalk.ProtocolAnnouncement); smalltalk.addClass('ProtocolAdded', smalltalk.ProtocolAnnouncement, [], 'Kernel-Announcements'); smalltalk.addClass('ProtocolRemoved', smalltalk.ProtocolAnnouncement, [], 'Kernel-Announcements'); smalltalk.addPackage('AmberCli'); smalltalk.addClass('AmberCli', smalltalk.Object, [], 'AmberCli'); smalltalk.AmberCli.comment="I am the Amber CLI (CommandLine Interface) tool which runs on Node.js.\x0a\x0aMy responsibility is to start different Amber programs like the FileServer or the Repl.\x0aWhich program to start is determined by the first commandline parameters passed to the AmberCli executable.\x0aUse `help` to get a list of all available options.\x0aAny further commandline parameters are passed to the specific program.\x0a\x0a## Commands\x0a\x0aNew commands can be added by creating a class side method in the `commands` protocol which takes one parameter.\x0aThis parameter is an array of all commandline options + values passed on to the program.\x0aAny `camelCaseCommand` is transformed into a commandline parameter of the form `camel-case-command` and vice versa." smalltalk.addMethod( smalltalk.method({ selector: "commandLineSwitches", category: 'commandline', fn: function (){ var self=this; var switches; return smalltalk.withContext(function($ctx1) { var $1; switches=_st(_st(_st(self)._class())._methodsInProtocol_("commands"))._collect_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(each)._selector(); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); switches=_st(switches)._select_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(each)._match_("^[^:]*:$"); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); switches=_st(switches)._collect_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(_st(_st(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase(); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); $1=switches; return $1; }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},smalltalk.AmberCli.klass)})}, args: [], source: "commandLineSwitches\x0a\x09\x22Collect all methodnames from the 'commands' protocol of the class\x0a\x09 and select the ones with only one parameter.\x0a\x09 Then remove the ':' at the end of the name.\x0a\x09 Additionally all uppercase letters are made lowercase and preceded by a '-'.\x0a\x09 Example: fallbackPage: becomes --fallback-page.\x0a\x09 Return the Array containing the commandline switches.\x22\x0a\x09| switches |\x0a\x09switches := ((self class methodsInProtocol: 'commands') collect: [ :each | each selector]).\x0a\x09switches := switches select: [ :each | each match: '^[^:]*:$'].\x0a\x09switches :=switches collect: [ :each |\x0a\x09\x09(each allButLast replace: '([A-Z])' with: '-$1') asLowercase].\x0a\x09^switches", messageSends: ["collect:", "selector", "methodsInProtocol:", "class", "select:", "match:", "asLowercase", "replace:with:", "allButLast"], referencedClasses: [] }), smalltalk.AmberCli.klass); smalltalk.addMethod( smalltalk.method({ selector: "handleArguments:", category: 'commandline', fn: function (args){ var self=this; var selector; function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)} return smalltalk.withContext(function($ctx1) { selector=_st(self)._selectorForCommandLineSwitch_(_st(args)._first()); _st(args)._remove_(_st(args)._first()); _st(self)._perform_withArguments_(selector,_st($Array())._with_(args)); return self}, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},smalltalk.AmberCli.klass)})}, args: ["args"], source: "handleArguments: args\x0a\x09| selector |\x0a\x0a\x09selector := self selectorForCommandLineSwitch: (args first).\x0a\x09args remove: args first.\x0a\x09self perform: selector withArguments: (Array with: args)", messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"], referencedClasses: ["Array"] }), smalltalk.AmberCli.klass); smalltalk.addMethod( smalltalk.method({ selector: "help:", category: 'commands', fn: function (args){ var self=this; return smalltalk.withContext(function($ctx1) { _st(console)._log_("Available Commands:"); _st(_st(self)._commandLineSwitches())._do_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(console)._log_(each); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"help:",{args:args},smalltalk.AmberCli.klass)})}, args: ["args"], source: "help: args\x0a\x09console log: 'Available Commands:'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]", messageSends: ["log:", "do:", "commandLineSwitches"], referencedClasses: [] }), smalltalk.AmberCli.klass); smalltalk.addMethod( smalltalk.method({ selector: "main", category: 'startup', fn: function (){ var self=this; var args; return smalltalk.withContext(function($ctx1) { var $1,$2; args=_st(process)._argv(); _st(args)._removeFrom_to_((1),(3)); $1=_st(args)._isEmpty(); if(smalltalk.assert($1)){ _st(self)._help_(nil); } else { $2=_st(self)._handleArguments_(args); return $2; }; return self}, function($ctx1) {$ctx1.fill(self,"main",{args:args},smalltalk.AmberCli.klass)})}, args: [], source: "main\x0a\x09\x22Main entry point for Amber applications.\x0a\x09Parses commandline arguments and starts the according subprogram.\x22\x0a\x09| args |\x0a\x09args := process argv.\x0a\x09\x22Remove the first args which contain the path to the node executable and the script file.\x22\x0a\x09args removeFrom: 1 to: 3.\x0a\x09\x0a\x09(args isEmpty)\x0a\x09\x09ifTrue: [self help: nil]\x0a\x09\x09ifFalse: [^self handleArguments: args]", messageSends: ["argv", "removeFrom:to:", "ifTrue:ifFalse:", "help:", "handleArguments:", "isEmpty"], referencedClasses: [] }), smalltalk.AmberCli.klass); smalltalk.addMethod( smalltalk.method({ selector: "repl:", category: 'commands', fn: function (args){ var self=this; function $Repl(){return smalltalk.Repl||(typeof Repl=="undefined"?nil:Repl)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st($Repl())._new())._createInterface(); return $1; }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},smalltalk.AmberCli.klass)})}, args: ["args"], source: "repl: args\x0a\x09^Repl new createInterface", messageSends: ["createInterface", "new"], referencedClasses: ["Repl"] }), smalltalk.AmberCli.klass); smalltalk.addMethod( smalltalk.method({ selector: "selectorForCommandLineSwitch:", category: 'commandline', fn: function (aSwitch){ var self=this; var command,selector; return smalltalk.withContext(function($ctx1) { var $1,$2; $1=_st(_st(self)._commandLineSwitches())._includes_(aSwitch); if(smalltalk.assert($1)){ selector=_st(_st(aSwitch)._replace_with_("-[a-z]",(function(each){ return smalltalk.withContext(function($ctx2) { return _st(_st(each)._second())._asUppercase(); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}))).__comma(":"); selector; } else { selector="help:"; selector; }; $2=selector; return $2; }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},smalltalk.AmberCli.klass)})}, args: ["aSwitch"], source: "selectorForCommandLineSwitch: aSwitch\x0a\x09\x22Add ':' at the end and replace all occurences of a lowercase letter preceded by a '-' with the Uppercase letter.\x0a\x09 Example: fallback-page becomes fallbackPage:.\x0a\x09 If no correct selector is found return 'help:'\x22\x0a\x09 | command selector |\x0a\x0a\x09 (self commandLineSwitches includes: aSwitch)\x0a\x09 ifTrue: [ selector := (aSwitch replace: '-[a-z]' with: [ :each | each second asUppercase ]), ':']\x0a\x09 ifFalse: [ selector := 'help:' ].\x0a\x09^selector", messageSends: ["ifTrue:ifFalse:", ",", "replace:with:", "asUppercase", "second", "includes:", "commandLineSwitches"], referencedClasses: [] }), smalltalk.AmberCli.klass); smalltalk.addMethod( smalltalk.method({ selector: "serve:", category: 'commands', fn: function (args){ var self=this; function $FileServer(){return smalltalk.FileServer||(typeof FileServer=="undefined"?nil:FileServer)} return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st($FileServer())._createServerWithArguments_(args))._start(); return $1; }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},smalltalk.AmberCli.klass)})}, args: ["args"], source: "serve: args\x0a\x09^(FileServer createServerWithArguments: args) start", messageSends: ["start", "createServerWithArguments:"], referencedClasses: ["FileServer"] }), smalltalk.AmberCli.klass); smalltalk.addClass('FileServer', smalltalk.Object, ['path', 'http', 'fs', 'url', 'host', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'AmberCli'); smalltalk.FileServer.comment="I am the Amber Smalltalk FileServer.\x0aMy runtime requirement is a functional Node.js executable.\x0a\x0aTo start a FileServer instance on port `4000` use the following code:\x0a\x0a FileServer new start\x0a\x0aA parameterized instance can be created with the following code:\x0a\x0a FileServer createServerWithArguments: options\x0a\x0aHere, `options` is an array of commandline style strings each followed by a value e.g. `#('--port', '6000', '--host', '0.0.0.0')`.\x0aA list of all available parameters can be printed to the commandline by passing `--help` as parameter.\x0aSee the `Options` section for further details on how options are mapped to instance methods.\x0a\x0aAfter startup FileServer checks if the directory layout required by Amber is present and logs a warning on absence.\x0a\x0a\x0a## Options\x0a\x0aEach option is of the form `--some-option-string` which is transformed into a selector of the format `someOptionString:`.\x0aThe trailing `--` gets removed, each `-[a-z]` gets transformed into the according uppercase letter, and a `:` is appended to create a selector which takes a single argument.\x0aAfterwards, the selector gets executed on the `FileServer` instance with the value following in the options array as parameter.\x0a\x0a## Adding new commandline parameters\x0a\x0aAdding new commandline parameters to `FileServer` is as easy as adding a new single parameter method to the `accessing` protocol." smalltalk.addMethod( smalltalk.method({ selector: "base64Decode:", category: 'private', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { return (new Buffer(aString, 'base64').toString()); return self}, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},smalltalk.FileServer)})}, args: ["aString"], source: "base64Decode: aString\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.FileServer); smalltalk.addMethod( smalltalk.method({ selector: "basePath", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=self["@basePath"]; if(($receiver = $2) == nil || $receiver == undefined){ $1="./"; } else { $1=$2; }; return $1; }, function($ctx1) {$ctx1.fill(self,"basePath",{},smalltalk.FileServer)})}, args: [], source: "basePath\x0a\x09^basePath ifNil: ['./']", messageSends: ["ifNil:"], referencedClasses: [] }), smalltalk.FileServer); smalltalk.addMethod( smalltalk.method({ selector: "basePath:", category: 'accessing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { self["@basePath"]=aString; return self}, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},smalltalk.FileServer)})}, args: ["aString"], source: "basePath: aString\x0a\x09basePath := aString", messageSends: [], referencedClasses: [] }), smalltalk.FileServer); smalltalk.addMethod( smalltalk.method({ selector: "checkDirectoryLayout", category: 'initialization', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1,$2,$3; $1=_st(self["@fs"])._existsSync_(_st(_st(self)._basePath()).__comma("index.html")); if(! smalltalk.assert($1)){ _st(console)._warn_("Warning: project directory does not contain index.html"); }; $2=_st(self["@fs"])._existsSync_(_st(_st(self)._basePath()).__comma("st")); if(! smalltalk.assert($2)){ _st(console)._warn_("Warning: project directory is missing an \x22st\x22 directory"); }; $3=_st(self["@fs"])._existsSync_(_st(_st(self)._basePath()).__comma("js")); if(! smalltalk.assert($3)){ _st(console)._warn_("Warning: project directory is missing a \x22js\x22 directory"); }; return self}, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},smalltalk.FileServer)})}, args: [], source: "checkDirectoryLayout\x0a\x09(fs existsSync: self basePath, 'index.html') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory does not contain index.html'].\x0a\x09(fs existsSync: self basePath, 'st') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory is missing an \x22st\x22 directory'].\x0a\x09(fs existsSync: self basePath, 'js') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory is missing a \x22js\x22 directory'].", messageSends: ["ifFalse:", "warn:", "existsSync:", ",", "basePath"], referencedClasses: [] }), smalltalk.FileServer); smalltalk.addMethod( smalltalk.method({ selector: "fallbackPage", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@fallbackPage"]; return $1; }, function($ctx1) {$ctx1.fill(self,"fallbackPage",{},smalltalk.FileServer)})}, args: [], source: "fallbackPage\x0a\x09^fallbackPage", messageSends: [], referencedClasses: [] }), smalltalk.FileServer); smalltalk.addMethod( smalltalk.method({ selector: "fallbackPage:", category: 'accessing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { self["@fallbackPage"]=aString; return self}, function($ctx1) {$ctx1.fill(self,"fallbackPage:",{aString:aString},smalltalk.FileServer)})}, args: ["aString"], source: "fallbackPage: aString\x0a\x09fallbackPage := aString", messageSends: [], referencedClasses: [] }), smalltalk.FileServer); smalltalk.addMethod( smalltalk.method({ selector: "handleGETRequest:respondTo:", category: 'request handling', fn: function (aRequest,aResponse){ var self=this; var uri,filename; return smalltalk.withContext(function($ctx1) { var $1; uri=_st(_st(self["@url"])._parse_(_st(aRequest)._url()))._pathname(); filename=_st(self["@path"])._join_with_(_st(self)._basePath(),uri); _st(self["@fs"])._exists_do_(filename,(function(aBoolean){ return smalltalk.withContext(function($ctx2) { $1=aBoolean; if(smalltalk.assert($1)){ return _st(self)._respondFileNamed_to_(filename,aResponse); } else { return _st(self)._respondNotFoundTo_(aResponse); }; }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},smalltalk.FileServer)})}, args: ["aRequest", "aResponse"], source: "handleGETRequest: aRequest respondTo: aResponse\x0a\x09| uri filename |\x0a\x09uri := (url parse: aRequest url) pathname.\x0a\x09filename := path join: self basePath with: uri.\x0a\x09fs exists: filename do: [:aBoolean |\x0a\x09\x09aBoolean\x0a\x09\x09\x09ifFalse: [self respondNotFoundTo: aResponse]\x0a\x09\x09\x09ifTrue: [self respondFileNamed: filename to: aResponse]]", messageSends: ["pathname", "parse:", "url", "join:with:", "basePath", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "respondFileNamed:to:"], referencedClasses: [] }), smalltalk.FileServer); smalltalk.addMethod( smalltalk.method({ selector: "handleOPTIONSRequest:respondTo:", category: 'request handling', fn: function (aRequest,aResponse){ var self=this; return smalltalk.withContext(function($ctx1) { _st(aResponse)._writeHead_options_((200),smalltalk.HashedCollection._fromPairs_([_st("Access-Control-Allow-Origin").__minus_gt("*"),_st("Access-Control-Allow-Methods").__minus_gt("GET, PUT, POST, DELETE, OPTIONS"),_st("Access-Control-Allow-Headers").__minus_gt("Content-Type, Accept"),_st("Content-Length").__minus_gt((0)),_st("Access-Control-Max-Age").__minus_gt((10))])); _st(aResponse)._end(); return self}, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},smalltalk.FileServer)})}, args: ["aRequest", "aResponse"], source: "handleOPTIONSRequest: aRequest respondTo: aResponse\x0a\x09aResponse writeHead: 200 options: #{'Access-Control-Allow-Origin' -> '*'.\x0a\x09\x09\x09\x09\x09'Access-Control-Allow-Methods' -> 'GET, PUT, POST, DELETE, OPTIONS'.\x0a\x09\x09\x09\x09\x09'Access-Control-Allow-Headers' -> 'Content-Type, Accept'.\x0a\x09\x09\x09\x09\x09'Content-Length' -> 0.\x0a\x09\x09\x09\x09\x09'Access-Control-Max-Age' -> 10}.\x0a\x09aResponse end", messageSends: ["writeHead:options:", "->", "end"], referencedClasses: [] }), smalltalk.FileServer); smalltalk.addMethod( smalltalk.method({ selector: "handlePUTRequest:respondTo:", category: 'request handling', fn: function (aRequest,aResponse){ var self=this; var file,stream; return smalltalk.withContext(function($ctx1) { var $1,$2; $1=_st(self)._isAuthenticated_(aRequest); if(! smalltalk.assert($1)){ _st(self)._respondAuthenticationRequiredTo_(aResponse); return nil; }; file=_st(".").__comma(_st(aRequest)._url()); stream=_st(self["@fs"])._createWriteStream_(file); _st(stream)._on_do_("error",(function(error){ return smalltalk.withContext(function($ctx2) { _st(console)._warn_(_st("Error creating WriteStream for file ").__comma(file)); _st(console)._warn_(" Did you forget to create the necessary js/ or st/ directory in your project?"); _st(console)._warn_(_st(" The exact error is: ").__comma(error)); return _st(self)._respondNotCreatedTo_(aResponse); }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1)})})); _st(stream)._on_do_("close",(function(){ return smalltalk.withContext(function($ctx2) { return _st(self)._respondCreatedTo_(aResponse); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); _st(aRequest)._setEncoding_("utf8"); _st(aRequest)._on_do_("data",(function(data){ return smalltalk.withContext(function($ctx2) { return _st(stream)._write_(data); }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1)})})); _st(aRequest)._on_do_("end",(function(){ return smalltalk.withContext(function($ctx2) { $2=_st(stream)._writable(); if(smalltalk.assert($2)){ return _st(stream)._end(); }; }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},smalltalk.FileServer)})}, args: ["aRequest", "aResponse"], source: "handlePUTRequest: aRequest respondTo: aResponse\x0a\x09| file stream |\x0a\x09(self isAuthenticated: aRequest)\x0a\x09\x09ifFalse: [self respondAuthenticationRequiredTo: aResponse. ^nil].\x0a\x0a\x09file := '.', aRequest url.\x0a\x09stream := fs createWriteStream: file.\x0a\x0a\x09stream on: 'error' do: [:error |\x0a\x09\x09console warn: 'Error creating WriteStream for file ', file.\x0a\x09\x09console warn: ' Did you forget to create the necessary js/ or st/ directory in your project?'.\x0a\x09\x09console warn: ' The exact error is: ', error.\x0a\x09\x09self respondNotCreatedTo: aResponse].\x0a\x0a\x09stream on: 'close' do: [\x0a\x09\x09self respondCreatedTo: aResponse].\x0a\x0a\x09aRequest setEncoding: 'utf8'.\x0a\x09aRequest on: 'data' do: [:data |\x0a\x09\x09stream write: data].\x0a\x0a\x09aRequest on: 'end' do: [\x0a\x09\x09stream writable ifTrue: [stream end]]", messageSends: ["ifFalse:", "respondAuthenticationRequiredTo:", "isAuthenticated:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "end", "writable"], referencedClasses: [] }), smalltalk.FileServer); smalltalk.addMethod( smalltalk.method({ selector: "handleRequest:respondTo:", category: 'request handling', fn: function (aRequest,aResponse){ var self=this; return smalltalk.withContext(function($ctx1) { var $1,$2,$3; $1=_st(_st(aRequest)._method()).__eq("PUT"); if(smalltalk.assert($1)){ _st(self)._handlePUTRequest_respondTo_(aRequest,aResponse); }; $2=_st(_st(aRequest)._method()).__eq("GET"); if(smalltalk.assert($2)){ _st(self)._handleGETRequest_respondTo_(aRequest,aResponse); }; $3=_st(_st(aRequest)._method()).__eq("OPTIONS"); if(smalltalk.assert($3)){ _st(self)._handleOPTIONSRequest_respondTo_(aRequest,aResponse); }; return self}, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},smalltalk.FileServer)})}, args: ["aRequest", "aResponse"], source: "handleRequest: aRequest respondTo: aResponse\x0a\x09aRequest method = 'PUT'\x0a\x09\x09ifTrue: [self handlePUTRequest: aRequest respondTo: aResponse].\x0a\x09aRequest method = 'GET'\x0a\x09\x09ifTrue:[self handleGETRequest: aRequest respondTo: aResponse].\x0a\x09aRequest method = 'OPTIONS'\x0a\x09\x09ifTrue:[self handleOPTIONSRequest: aRequest respondTo: aResponse]", messageSends: ["ifTrue:", "handlePUTRequest:respondTo:", "=", "method", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"], referencedClasses: [] }), smalltalk.FileServer); smalltalk.addMethod( smalltalk.method({ selector: "host", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@host"]; return $1; }, function($ctx1) {$ctx1.fill(self,"host",{},smalltalk.FileServer)})}, args: [], source: "host\x0a\x09^host", messageSends: [], referencedClasses: [] }), smalltalk.FileServer); smalltalk.addMethod( smalltalk.method({ selector: "host:", category: 'accessing', fn: function (hostname){ var self=this; return smalltalk.withContext(function($ctx1) { self["@host"]=hostname; return self}, function($ctx1) {$ctx1.fill(self,"host:",{hostname:hostname},smalltalk.FileServer)})}, args: ["hostname"], source: "host: hostname\x0a\x09host := hostname", messageSends: [], referencedClasses: [] }), smalltalk.FileServer); smalltalk.addMethod( smalltalk.method({ selector: "initialize", category: 'initialization', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []); self["@path"]=_st(self)._require_("path"); self["@http"]=_st(self)._require_("http"); self["@fs"]=_st(self)._require_("fs"); self["@util"]=_st(self)._require_("util"); self["@url"]=_st(self)._require_("url"); self["@host"]=_st(_st(self)._class())._defaultHost(); self["@port"]=_st(_st(self)._class())._defaultPort(); self["@username"]=nil; self["@password"]=nil; self["@fallbackPage"]=nil; return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.FileServer)})}, args: [], source: "initialize\x0a\x09super initialize.\x0a\x09path := self require: 'path'.\x0a\x09http := self require: 'http'.\x0a\x09fs := self require: 'fs'.\x0a\x09util := self require: 'util'.\x0a\x09url := self require: 'url'.\x0a\x09host := self class defaultHost.\x0a\x09port := self class defaultPort.\x0a\x09username := nil.\x0a\x09password := nil.\x0a\x09fallbackPage := nil.", messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"], referencedClasses: [] }), smalltalk.FileServer); smalltalk.addMethod( smalltalk.method({ selector: "isAuthenticated:", category: 'private', fn: function (aRequest){ var self=this; var header,token,auth,parts; return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4,$5; $1=_st(_st(self["@username"])._isNil())._and_((function(){ return smalltalk.withContext(function($ctx2) { return _st(self["@password"])._isNil(); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); if(smalltalk.assert($1)){ return true; }; $2=_st(_st(aRequest)._headers())._at_("authorization"); if(($receiver = $2) == nil || $receiver == undefined){ header=""; } else { header=$2; }; $3=_st(header)._isEmpty(); if(smalltalk.assert($3)){ return false; } else { $4=_st(header)._tokenize_(" "); if(($receiver = $4) == nil || $receiver == undefined){ token=""; } else { token=$4; }; token; auth=_st(self)._base64Decode_(_st(token)._at_((2))); auth; parts=_st(auth)._tokenize_(":"); parts; $5=_st(_st(self["@username"]).__eq(_st(parts)._at_((1))))._and_((function(){ return smalltalk.withContext(function($ctx2) { return _st(self["@password"]).__eq(_st(parts)._at_((2))); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); if(smalltalk.assert($5)){ return true; } else { return false; }; }; return self}, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},smalltalk.FileServer)})}, args: ["aRequest"], source: "isAuthenticated: aRequest\x0a\x09\x22Basic HTTP Auth: http://stackoverflow.com/a/5957629/293175\x0a\x09 and https://gist.github.com/1686663\x22\x0a\x09| header token auth parts|\x0a\x0a\x09(username isNil and: [password isNil]) ifTrue: [^true].\x0a\x0a\x09\x22get authentication header\x22\x0a\x09header := (aRequest headers at: 'authorization') ifNil:[''].\x0a\x09(header isEmpty)\x0a\x09ifTrue: [^false]\x0a\x09ifFalse: [\x0a\x09\x09\x22get authentication token\x22\x0a\x09\x09token := (header tokenize: ' ') ifNil:[''].\x0a\x09\x09\x22convert back from base64\x22\x0a\x09\x09auth := self base64Decode: (token at: 2).\x0a\x09\x09\x22split token at colon\x22\x0a\x09\x09parts := auth tokenize: ':'.\x0a\x0a\x09\x09((username = (parts at: 1)) and: [password = (parts at: 2)])\x0a\x09\x09\x09ifTrue: [^true]\x0a\x09\x09\x09ifFalse: [^false]\x0a\x09].", messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifTrue:ifFalse:", "tokenize:", "base64Decode:", "=", "isEmpty"], referencedClasses: [] }), smalltalk.FileServer); smalltalk.addMethod( smalltalk.method({ selector: "password:", category: 'accessing', fn: function (aPassword){ var self=this; return smalltalk.withContext(function($ctx1) { self["@password"]=aPassword; return self}, function($ctx1) {$ctx1.fill(self,"password:",{aPassword:aPassword},smalltalk.FileServer)})}, args: ["aPassword"], source: "password: aPassword\x0a\x09password := aPassword.", messageSends: [], referencedClasses: [] }), smalltalk.FileServer); smalltalk.addMethod( smalltalk.method({ selector: "port", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=self["@port"]; return $1; }, function($ctx1) {$ctx1.fill(self,"port",{},smalltalk.FileServer)})}, args: [], source: "port\x0a\x09^port", messageSends: [], referencedClasses: [] }), smalltalk.FileServer); smalltalk.addMethod( smalltalk.method({ selector: "port:", category: 'accessing', fn: function (aNumber){ var self=this; return smalltalk.withContext(function($ctx1) { self["@port"]=aNumber; return self}, function($ctx1) {$ctx1.fill(self,"port:",{aNumber:aNumber},smalltalk.FileServer)})}, args: ["aNumber"], source: "port: aNumber\x0a\x09port := aNumber", messageSends: [], referencedClasses: [] }), smalltalk.FileServer); smalltalk.addMethod( smalltalk.method({ selector: "require:", category: 'private', fn: function (aModuleString){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(require)._value_(aModuleString); return $1; }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},smalltalk.FileServer)})}, args: ["aModuleString"], source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString", messageSends: ["value:"], referencedClasses: [] }), smalltalk.FileServer); smalltalk.addMethod( smalltalk.method({ selector: "respondAuthenticationRequiredTo:", category: 'request handling', fn: function (aResponse){ var self=this; return smalltalk.withContext(function($ctx1) { var $1,$2; $1=aResponse; _st($1)._writeHead_options_((401),smalltalk.HashedCollection._fromPairs_([_st("WWW-Authenticate").__minus_gt("Basic realm=\x22Secured Developer Area\x22")])); _st($1)._write_("Authentication needed"); $2=_st($1)._end(); return self}, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},smalltalk.FileServer)})}, args: ["aResponse"], source: "respondAuthenticationRequiredTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 401 options: #{'WWW-Authenticate' -> 'Basic realm=\x22Secured Developer Area\x22'};\x0a\x09\x09write: 'Authentication needed';\x0a\x09\x09end.", messageSends: ["writeHead:options:", "->", "write:", "end"], referencedClasses: [] }), smalltalk.FileServer); smalltalk.addMethod( smalltalk.method({ selector: "respondCreatedTo:", category: 'request handling', fn: function (aResponse){ var self=this; return smalltalk.withContext(function($ctx1) { var $1,$2; $1=aResponse; _st($1)._writeHead_options_((201),smalltalk.HashedCollection._fromPairs_([_st("Content-Type").__minus_gt("text/plain"),_st("Access-Control-Allow-Origin").__minus_gt("*")])); $2=_st($1)._end(); return self}, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},smalltalk.FileServer)})}, args: ["aResponse"], source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.", messageSends: ["writeHead:options:", "->", "end"], referencedClasses: [] }), smalltalk.FileServer); smalltalk.addMethod( smalltalk.method({ selector: "respondFileNamed:to:", category: 'request handling', fn: function (aFilename,aResponse){ var self=this; var type,filename; return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4,$5; filename=aFilename; $1=_st(_st(self["@fs"])._statSync_(aFilename))._isDirectory(); if(smalltalk.assert($1)){ filename=_st(filename).__comma("index.html"); filename; }; _st(self["@fs"])._readFile_do_(filename,(function(ex,file){ return smalltalk.withContext(function($ctx2) { $2=_st(ex)._notNil(); if(smalltalk.assert($2)){ _st(console)._log_(_st(filename).__comma(" does not exist")); return _st(self)._respondInternalErrorTo_(aResponse); } else { type=_st(_st(self)._class())._mimeTypeFor_(filename); type; $3=_st(type).__eq("application/javascript"); if(smalltalk.assert($3)){ type=_st(type).__comma(";charset=utf-8"); type; }; $4=aResponse; _st($4)._writeHead_options_((200),smalltalk.HashedCollection._fromPairs_([_st("Content-Type").__minus_gt(type)])); _st($4)._write_encoding_(file,"binary"); $5=_st($4)._end(); return $5; }; }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},smalltalk.FileServer)})}, args: ["aFilename", "aResponse"], source: "respondFileNamed: aFilename to: aResponse\x0a\x09| type filename |\x0a\x0a\x09filename := aFilename.\x0a\x09(fs statSync: aFilename) isDirectory ifTrue: [\x0a\x09\x09filename := filename, 'index.html'].\x0a\x0a\x09fs readFile: filename do: [:ex :file |\x0a\x09\x09ex notNil \x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09console log: filename, ' does not exist'.\x0a\x09\x09\x09\x09self respondInternalErrorTo: aResponse]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09type := self class mimeTypeFor: filename.\x0a\x09\x09\x09\x09type = 'application/javascript'\x0a\x09\x09\x09\x09\x09ifTrue: [ type:=type,';charset=utf-8' ].\x0a\x09\x09\x09\x09aResponse \x0a\x09\x09\x09\x09\x09writeHead: 200 options: #{'Content-Type' -> type};\x0a\x09\x09\x09\x09\x09write: file encoding: 'binary';\x0a\x09\x09\x09\x09\x09end]]", messageSends: ["ifTrue:", ",", "isDirectory", "statSync:", "readFile:do:", "ifTrue:ifFalse:", "log:", "respondInternalErrorTo:", "mimeTypeFor:", "class", "=", "writeHead:options:", "->", "write:encoding:", "end", "notNil"], referencedClasses: [] }), smalltalk.FileServer); smalltalk.addMethod( smalltalk.method({ selector: "respondInternalErrorTo:", category: 'request handling', fn: function (aResponse){ var self=this; return smalltalk.withContext(function($ctx1) { var $1,$2; $1=aResponse; _st($1)._writeHead_options_((500),smalltalk.HashedCollection._fromPairs_([_st("Content-Type").__minus_gt("text/plain")])); _st($1)._write_("500 Internal server error"); $2=_st($1)._end(); return self}, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},smalltalk.FileServer)})}, args: ["aResponse"], source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end", messageSends: ["writeHead:options:", "->", "write:", "end"], referencedClasses: [] }), smalltalk.FileServer); smalltalk.addMethod( smalltalk.method({ selector: "respondNotCreatedTo:", category: 'request handling', fn: function (aResponse){ var self=this; return smalltalk.withContext(function($ctx1) { var $1,$2; $1=aResponse; _st($1)._writeHead_options_((400),smalltalk.HashedCollection._fromPairs_([_st("Content-Type").__minus_gt("text/plain")])); _st($1)._write_("File could not be created. Did you forget to create the st/js directories on the server?"); $2=_st($1)._end(); return self}, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},smalltalk.FileServer)})}, args: ["aResponse"], source: "respondNotCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 400 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: 'File could not be created. Did you forget to create the st/js directories on the server?';\x0a\x09\x09end.", messageSends: ["writeHead:options:", "->", "write:", "end"], referencedClasses: [] }), smalltalk.FileServer); smalltalk.addMethod( smalltalk.method({ selector: "respondNotFoundTo:", category: 'request handling', fn: function (aResponse){ var self=this; return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4; $1=_st(_st(self)._fallbackPage())._isNil(); if(! smalltalk.assert($1)){ $2=_st(self)._respondFileNamed_to_(_st(self)._fallbackPage(),aResponse); return $2; }; $3=aResponse; _st($3)._writeHead_options_((404),smalltalk.HashedCollection._fromPairs_([_st("Content-Type").__minus_gt("text/plain")])); _st($3)._write_("404 Not found"); $4=_st($3)._end(); return self}, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},smalltalk.FileServer)})}, args: ["aResponse"], source: "respondNotFoundTo: aResponse\x0a\x09self fallbackPage isNil ifFalse: [^self respondFileNamed: self fallbackPage to: aResponse].\x0a\x09aResponse \x0a\x09\x09writeHead: 404 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '404 Not found';\x0a\x09\x09end", messageSends: ["ifFalse:", "respondFileNamed:to:", "fallbackPage", "isNil", "writeHead:options:", "->", "write:", "end"], referencedClasses: [] }), smalltalk.FileServer); smalltalk.addMethod( smalltalk.method({ selector: "respondOKTo:", category: 'request handling', fn: function (aResponse){ var self=this; return smalltalk.withContext(function($ctx1) { var $1,$2; $1=aResponse; _st($1)._writeHead_options_((200),smalltalk.HashedCollection._fromPairs_([_st("Content-Type").__minus_gt("text/plain"),_st("Access-Control-Allow-Origin").__minus_gt("*")])); $2=_st($1)._end(); return self}, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},smalltalk.FileServer)})}, args: ["aResponse"], source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.", messageSends: ["writeHead:options:", "->", "end"], referencedClasses: [] }), smalltalk.FileServer); smalltalk.addMethod( smalltalk.method({ selector: "start", category: 'starting', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1,$2; _st(self)._checkDirectoryLayout(); $1=_st(self["@http"])._createServer_((function(request,response){ return smalltalk.withContext(function($ctx2) { return _st(self)._handleRequest_respondTo_(request,response); }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1)})})); _st($1)._on_do_("error",(function(error){ return smalltalk.withContext(function($ctx2) { return _st(console)._log_(_st("Error starting server: ").__comma(error)); }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1)})})); _st($1)._on_do_("listening",(function(){ return smalltalk.withContext(function($ctx2) { return _st(console)._log_(_st(_st(_st("Starting file server on ").__comma(_st(self)._host())).__comma(":")).__comma(_st(_st(self)._port())._asString())); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); $2=_st($1)._listen_host_(_st(self)._port(),_st(self)._host()); return self}, function($ctx1) {$ctx1.fill(self,"start",{},smalltalk.FileServer)})}, args: [], source: "start\x0a\x09\x22Checks if required directory layout is present (issue warning if not).\x0a\x09 Afterwards start the server.\x22\x0a\x09self checkDirectoryLayout.\x0a\x09(http createServer: [:request :response |\x0a\x09 self handleRequest: request respondTo: response])\x0a\x09 on: 'error' do: [:error | console log: 'Error starting server: ', error];\x0a\x09 on: 'listening' do: [console log: 'Starting file server on ', self host, ':', self port asString];\x0a\x09 listen: self port host: self host.", messageSends: ["checkDirectoryLayout", "on:do:", "log:", ",", "createServer:", "handleRequest:respondTo:", "asString", "port", "host", "listen:host:"], referencedClasses: [] }), smalltalk.FileServer); smalltalk.addMethod( smalltalk.method({ selector: "startOn:", category: 'starting', fn: function (aPort){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self)._port_(aPort); _st(self)._start(); return self}, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},smalltalk.FileServer)})}, args: ["aPort"], source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start", messageSends: ["port:", "start"], referencedClasses: [] }), smalltalk.FileServer); smalltalk.addMethod( smalltalk.method({ selector: "username:", category: 'accessing', fn: function (aUsername){ var self=this; return smalltalk.withContext(function($ctx1) { self["@username"]=aUsername; return self}, function($ctx1) {$ctx1.fill(self,"username:",{aUsername:aUsername},smalltalk.FileServer)})}, args: ["aUsername"], source: "username: aUsername\x0a\x09username := aUsername.", messageSends: [], referencedClasses: [] }), smalltalk.FileServer); smalltalk.addMethod( smalltalk.method({ selector: "writeData:toFileNamed:", category: 'private', fn: function (data,aFilename){ var self=this; return smalltalk.withContext(function($ctx1) { _st(console)._log_(aFilename); return self}, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},smalltalk.FileServer)})}, args: ["data", "aFilename"], source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename", messageSends: ["log:"], referencedClasses: [] }), smalltalk.FileServer); smalltalk.FileServer.klass.iVarNames = ['mimeTypes']; smalltalk.addMethod( smalltalk.method({ selector: "commandLineSwitches", category: 'accessing', fn: function (){ var self=this; var switches; return smalltalk.withContext(function($ctx1) { var $1; switches=_st(_st(self)._methodsInProtocol_("accessing"))._collect_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(each)._selector(); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); switches=_st(switches)._select_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(each)._match_("^[^:]*:$"); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); switches=_st(switches)._collect_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(_st(_st(_st(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1"); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); $1=switches; return $1; }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},smalltalk.FileServer.klass)})}, args: [], source: "commandLineSwitches\x0a\x09\x22Collect all methodnames from the 'accessing' protocol\x0a\x09 and select the ones with only one parameter.\x0a\x09 Then remove the ':' at the end of the name\x0a\x09 and add a '--' at the beginning.\x0a\x09 Additionally all uppercase letters are made lowercase and preceded by a '-'.\x0a\x09 Example: fallbackPage: becomes --fallback-page.\x0a\x09 Return the Array containing the commandline switches.\x22\x0a\x09| switches |\x0a\x09switches := ((self methodsInProtocol: 'accessing') collect: [ :each | each selector]).\x0a\x09switches := switches select: [ :each | each match: '^[^:]*:$'].\x0a\x09switches :=switches collect: [ :each |\x0a\x09\x09(each allButLast replace: '([A-Z])' with: '-$1') asLowercase replace: '^([a-z])' with: '--$1' ].\x0a\x09^switches", messageSends: ["collect:", "selector", "methodsInProtocol:", "select:", "match:", "replace:with:", "asLowercase", "allButLast"], referencedClasses: [] }), smalltalk.FileServer.klass); smalltalk.addMethod( smalltalk.method({ selector: "createServerWithArguments:", category: 'initialization', fn: function (options){ var self=this; var server,popFront,front,optionName,optionValue,switches; function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)} return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4,$5; var $early={}; try { switches=_st(self)._commandLineSwitches(); server=_st(self)._new(); _st(options)._ifEmpty_((function(){ return smalltalk.withContext(function($ctx2) { $1=server; throw $early=[$1]; }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); $2=_st(_st(options)._size())._even(); if(! smalltalk.assert($2)){ _st(console)._log_("Using default parameters."); _st(console)._log_(_st("Wrong commandline options or not enough arguments for: ").__comma(options)); _st(console)._log_(_st("Use any of the following ones: ").__comma(switches)); $3=server; return $3; }; popFront=(function(args){ return smalltalk.withContext(function($ctx2) { front=_st(args)._first(); front; _st(args)._remove_(front); return front; }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1)})}); _st((function(){ return smalltalk.withContext(function($ctx2) { return _st(options)._notEmpty(); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){ return smalltalk.withContext(function($ctx2) { optionName=_st(popFront)._value_(options); optionName; optionValue=_st(popFront)._value_(options); optionValue; $4=_st(switches)._includes_(optionName); if(smalltalk.assert($4)){ optionName=_st(self)._selectorForCommandLineSwitch_(optionName); optionName; return _st(server)._perform_withArguments_(optionName,_st($Array())._with_(optionValue)); } else { _st(console)._log_(_st(optionName).__comma(" is not a valid commandline option")); return _st(console)._log_(_st("Use any of the following ones: ").__comma(switches)); }; }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); $5=server; return $5; } catch(e) {if(e===$early)return e[0]; throw e} }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},smalltalk.FileServer.klass)})}, args: ["options"], source: "createServerWithArguments: options\x0a\x09\x22If options are empty return a default FileServer instance.\x0a\x09 If options are given loop through them and set the passed in values\x0a\x09 on the FileServer instance.\x0a\x09 \x0a\x09 Commanline options map directly to methods in the 'accessing' protocol\x0a\x09 taking one parameter.\x0a\x09 Adding a method to this protocol makes it directly settable through\x0a\x09 command line options.\x0a\x09 \x22\x0a\x09| server popFront front optionName optionValue switches |\x0a\x0a\x09switches := self commandLineSwitches.\x0a\x0a\x09server := self new.\x0a\x0a\x09options ifEmpty: [^server].\x0a\x0a\x09(options size even) ifFalse: [\x0a\x09\x09console log: 'Using default parameters.'.\x0a\x09\x09console log: 'Wrong commandline options or not enough arguments for: ' , options.\x0a\x09\x09console log: 'Use any of the following ones: ', switches.\x0a\x09\x09^server].\x0a\x0a\x09popFront := [:args |\x0a\x09\x09front := args first.\x0a\x09\x09args remove: front.\x0a\x09\x09front].\x0a\x0a\x09[options notEmpty] whileTrue: [\x0a\x09\x09optionName := popFront value: options.\x0a\x09\x09optionValue := popFront value: options.\x0a\x0a\x09\x09(switches includes: optionName) ifTrue: [\x0a\x09\x09\x09optionName := self selectorForCommandLineSwitch: optionName.\x0a\x09\x09\x09server perform: optionName withArguments: (Array with: optionValue)]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09console log: optionName, ' is not a valid commandline option'.\x0a\x09\x09\x09\x09console log: 'Use any of the following ones: ', switches ]].\x0a\x09^server.", messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "log:", ",", "even", "size", "first", "remove:", "whileTrue:", "value:", "ifTrue:ifFalse:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:", "includes:", "notEmpty"], referencedClasses: ["Array"] }), smalltalk.FileServer.klass); smalltalk.addMethod( smalltalk.method({ selector: "defaultHost", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return "127.0.0.1"; }, function($ctx1) {$ctx1.fill(self,"defaultHost",{},smalltalk.FileServer.klass)})}, args: [], source: "defaultHost\x0a\x09^'127.0.0.1'", messageSends: [], referencedClasses: [] }), smalltalk.FileServer.klass); smalltalk.addMethod( smalltalk.method({ selector: "defaultMimeTypes", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=smalltalk.HashedCollection._fromPairs_([_st("%").__minus_gt("application/x-trash"),_st("323").__minus_gt("text/h323"),_st("abw").__minus_gt("application/x-abiword"),_st("ai").__minus_gt("application/postscript"),_st("aif").__minus_gt("audio/x-aiff"),_st("aifc").__minus_gt("audio/x-aiff"),_st("aiff").__minus_gt("audio/x-aiff"),_st("alc").__minus_gt("chemical/x-alchemy"),_st("art").__minus_gt("image/x-jg"),_st("asc").__minus_gt("text/plain"),_st("asf").__minus_gt("video/x-ms-asf"),_st("asn").__minus_gt("chemical/x-ncbi-asn1-spec"),_st("aso").__minus_gt("chemical/x-ncbi-asn1-binary"),_st("asx").__minus_gt("video/x-ms-asf"),_st("au").__minus_gt("audio/basic"),_st("avi").__minus_gt("video/x-msvideo"),_st("b").__minus_gt("chemical/x-molconn-Z"),_st("bak").__minus_gt("application/x-trash"),_st("bat").__minus_gt("application/x-msdos-program"),_st("bcpio").__minus_gt("application/x-bcpio"),_st("bib").__minus_gt("text/x-bibtex"),_st("bin").__minus_gt("application/octet-stream"),_st("bmp").__minus_gt("image/x-ms-bmp"),_st("book").__minus_gt("application/x-maker"),_st("bsd").__minus_gt("chemical/x-crossfire"),_st("c").__minus_gt("text/x-csrc"),_st("c++").__minus_gt("text/x-c++src"),_st("c3d").__minus_gt("chemical/x-chem3d"),_st("cac").__minus_gt("chemical/x-cache"),_st("cache").__minus_gt("chemical/x-cache"),_st("cascii").__minus_gt("chemical/x-cactvs-binary"),_st("cat").__minus_gt("application/vnd.ms-pki.seccat"),_st("cbin").__minus_gt("chemical/x-cactvs-binary"),_st("cc").__minus_gt("text/x-c++src"),_st("cdf").__minus_gt("application/x-cdf"),_st("cdr").__minus_gt("image/x-coreldraw"),_st("cdt").__minus_gt("image/x-coreldrawtemplate"),_st("cdx").__minus_gt("chemical/x-cdx"),_st("cdy").__minus_gt("application/vnd.cinderella"),_st("cef").__minus_gt("chemical/x-cxf"),_st("cer").__minus_gt("chemical/x-cerius"),_st("chm").__minus_gt("chemical/x-chemdraw"),_st("chrt").__minus_gt("application/x-kchart"),_st("cif").__minus_gt("chemical/x-cif"),_st("class").__minus_gt("application/java-vm"),_st("cls").__minus_gt("text/x-tex"),_st("cmdf").__minus_gt("chemical/x-cmdf"),_st("cml").__minus_gt("chemical/x-cml"),_st("cod").__minus_gt("application/vnd.rim.cod"),_st("com").__minus_gt("application/x-msdos-program"),_st("cpa").__minus_gt("chemical/x-compass"),_st("cpio").__minus_gt("application/x-cpio"),_st("cpp").__minus_gt("text/x-c++src"),_st("cpt").__minus_gt("image/x-corelphotopaint"),_st("crl").__minus_gt("application/x-pkcs7-crl"),_st("crt").__minus_gt("application/x-x509-ca-cert"),_st("csf").__minus_gt("chemical/x-cache-csf"),_st("csh").__minus_gt("text/x-csh"),_st("csm").__minus_gt("chemical/x-csml"),_st("csml").__minus_gt("chemical/x-csml"),_st("css").__minus_gt("text/css"),_st("csv").__minus_gt("text/comma-separated-values"),_st("ctab").__minus_gt("chemical/x-cactvs-binary"),_st("ctx").__minus_gt("chemical/x-ctx"),_st("cu").__minus_gt("application/cu-seeme"),_st("cub").__minus_gt("chemical/x-gaussian-cube"),_st("cxf").__minus_gt("chemical/x-cxf"),_st("cxx").__minus_gt("text/x-c++src"),_st("dat").__minus_gt("chemical/x-mopac-input"),_st("dcr").__minus_gt("application/x-director"),_st("deb").__minus_gt("application/x-debian-package"),_st("dif").__minus_gt("video/dv"),_st("diff").__minus_gt("text/plain"),_st("dir").__minus_gt("application/x-director"),_st("djv").__minus_gt("image/vnd.djvu"),_st("djvu").__minus_gt("image/vnd.djvu"),_st("dl").__minus_gt("video/dl"),_st("dll").__minus_gt("application/x-msdos-program"),_st("dmg").__minus_gt("application/x-apple-diskimage"),_st("dms").__minus_gt("application/x-dms"),_st("doc").__minus_gt("application/msword"),_st("dot").__minus_gt("application/msword"),_st("dv").__minus_gt("video/dv"),_st("dvi").__minus_gt("application/x-dvi"),_st("dx").__minus_gt("chemical/x-jcamp-dx"),_st("dxr").__minus_gt("application/x-director"),_st("emb").__minus_gt("chemical/x-embl-dl-nucleotide"),_st("embl").__minus_gt("chemical/x-embl-dl-nucleotide"),_st("ent").__minus_gt("chemical/x-pdb"),_st("eps").__minus_gt("application/postscript"),_st("etx").__minus_gt("text/x-setext"),_st("exe").__minus_gt("application/x-msdos-program"),_st("ez").__minus_gt("application/andrew-inset"),_st("fb").__minus_gt("application/x-maker"),_st("fbdoc").__minus_gt("application/x-maker"),_st("fch").__minus_gt("chemical/x-gaussian-checkpoint"),_st("fchk").__minus_gt("chemical/x-gaussian-checkpoint"),_st("fig").__minus_gt("application/x-xfig"),_st("flac").__minus_gt("application/x-flac"),_st("fli").__minus_gt("video/fli"),_st("fm").__minus_gt("application/x-maker"),_st("frame").__minus_gt("application/x-maker"),_st("frm").__minus_gt("application/x-maker"),_st("gal").__minus_gt("chemical/x-gaussian-log"),_st("gam").__minus_gt("chemical/x-gamess-input"),_st("gamin").__minus_gt("chemical/x-gamess-input"),_st("gau").__minus_gt("chemical/x-gaussian-input"),_st("gcd").__minus_gt("text/x-pcs-gcd"),_st("gcf").__minus_gt("application/x-graphing-calculator"),_st("gcg").__minus_gt("chemical/x-gcg8-sequence"),_st("gen").__minus_gt("chemical/x-genbank"),_st("gf").__minus_gt("application/x-tex-gf"),_st("gif").__minus_gt("image/gif"),_st("gjc").__minus_gt("chemical/x-gaussian-input"),_st("gjf").__minus_gt("chemical/x-gaussian-input"),_st("gl").__minus_gt("video/gl"),_st("gnumeric").__minus_gt("application/x-gnumeric"),_st("gpt").__minus_gt("chemical/x-mopac-graph"),_st("gsf").__minus_gt("application/x-font"),_st("gsm").__minus_gt("audio/x-gsm"),_st("gtar").__minus_gt("application/x-gtar"),_st("h").__minus_gt("text/x-chdr"),_st("h++").__minus_gt("text/x-c++hdr"),_st("hdf").__minus_gt("application/x-hdf"),_st("hh").__minus_gt("text/x-c++hdr"),_st("hin").__minus_gt("chemical/x-hin"),_st("hpp").__minus_gt("text/x-c++hdr"),_st("hqx").__minus_gt("application/mac-binhex40"),_st("hs").__minus_gt("text/x-haskell"),_st("hta").__minus_gt("application/hta"),_st("htc").__minus_gt("text/x-component"),_st("htm").__minus_gt("text/html"),_st("html").__minus_gt("text/html"),_st("hxx").__minus_gt("text/x-c++hdr"),_st("ica").__minus_gt("application/x-ica"),_st("ice").__minus_gt("x-conference/x-cooltalk"),_st("ico").__minus_gt("image/x-icon"),_st("ics").__minus_gt("text/calendar"),_st("icz").__minus_gt("text/calendar"),_st("ief").__minus_gt("image/ief"),_st("iges").__minus_gt("model/iges"),_st("igs").__minus_gt("model/iges"),_st("iii").__minus_gt("application/x-iphone"),_st("inp").__minus_gt("chemical/x-gamess-input"),_st("ins").__minus_gt("application/x-internet-signup"),_st("iso").__minus_gt("application/x-iso9660-image"),_st("isp").__minus_gt("application/x-internet-signup"),_st("ist").__minus_gt("chemical/x-isostar"),_st("istr").__minus_gt("chemical/x-isostar"),_st("jad").__minus_gt("text/vnd.sun.j2me.app-descriptor"),_st("jar").__minus_gt("application/java-archive"),_st("java").__minus_gt("text/x-java"),_st("jdx").__minus_gt("chemical/x-jcamp-dx"),_st("jmz").__minus_gt("application/x-jmol"),_st("jng").__minus_gt("image/x-jng"),_st("jnlp").__minus_gt("application/x-java-jnlp-file"),_st("jpe").__minus_gt("image/jpeg"),_st("jpeg").__minus_gt("image/jpeg"),_st("jpg").__minus_gt("image/jpeg"),_st("js").__minus_gt("application/javascript"),_st("kar").__minus_gt("audio/midi"),_st("key").__minus_gt("application/pgp-keys"),_st("kil").__minus_gt("application/x-killustrator"),_st("kin").__minus_gt("chemical/x-kinemage"),_st("kpr").__minus_gt("application/x-kpresenter"),_st("kpt").__minus_gt("application/x-kpresenter"),_st("ksp").__minus_gt("application/x-kspread"),_st("kwd").__minus_gt("application/x-kword"),_st("kwt").__minus_gt("application/x-kword"),_st("latex").__minus_gt("application/x-latex"),_st("lha").__minus_gt("application/x-lha"),_st("lhs").__minus_gt("text/x-literate-haskell"),_st("lsf").__minus_gt("video/x-la-asf"),_st("lsx").__minus_gt("video/x-la-asf"),_st("ltx").__minus_gt("text/x-tex"),_st("lzh").__minus_gt("application/x-lzh"),_st("lzx").__minus_gt("application/x-lzx"),_st("m3u").__minus_gt("audio/x-mpegurl"),_st("m4a").__minus_gt("audio/mpeg"),_st("maker").__minus_gt("application/x-maker"),_st("man").__minus_gt("application/x-troff-man"),_st("mcif").__minus_gt("chemical/x-mmcif"),_st("mcm").__minus_gt("chemical/x-macmolecule"),_st("mdb").__minus_gt("application/msaccess"),_st("me").__minus_gt("application/x-troff-me"),_st("mesh").__minus_gt("model/mesh"),_st("mid").__minus_gt("audio/midi"),_st("midi").__minus_gt("audio/midi"),_st("mif").__minus_gt("application/x-mif"),_st("mm").__minus_gt("application/x-freemind"),_st("mmd").__minus_gt("chemical/x-macromodel-input"),_st("mmf").__minus_gt("application/vnd.smaf"),_st("mml").__minus_gt("text/mathml"),_st("mmod").__minus_gt("chemical/x-macromodel-input"),_st("mng").__minus_gt("video/x-mng"),_st("moc").__minus_gt("text/x-moc"),_st("mol").__minus_gt("chemical/x-mdl-molfile"),_st("mol2").__minus_gt("chemical/x-mol2"),_st("moo").__minus_gt("chemical/x-mopac-out"),_st("mop").__minus_gt("chemical/x-mopac-input"),_st("mopcrt").__minus_gt("chemical/x-mopac-input"),_st("mov").__minus_gt("video/quicktime"),_st("movie").__minus_gt("video/x-sgi-movie"),_st("mp2").__minus_gt("audio/mpeg"),_st("mp3").__minus_gt("audio/mpeg"),_st("mp4").__minus_gt("video/mp4"),_st("mpc").__minus_gt("chemical/x-mopac-input"),_st("mpe").__minus_gt("video/mpeg"),_st("mpeg").__minus_gt("video/mpeg"),_st("mpega").__minus_gt("audio/mpeg"),_st("mpg").__minus_gt("video/mpeg"),_st("mpga").__minus_gt("audio/mpeg"),_st("ms").__minus_gt("application/x-troff-ms"),_st("msh").__minus_gt("model/mesh"),_st("msi").__minus_gt("application/x-msi"),_st("mvb").__minus_gt("chemical/x-mopac-vib"),_st("mxu").__minus_gt("video/vnd.mpegurl"),_st("nb").__minus_gt("application/mathematica"),_st("nc").__minus_gt("application/x-netcdf"),_st("nwc").__minus_gt("application/x-nwc"),_st("o").__minus_gt("application/x-object"),_st("oda").__minus_gt("application/oda"),_st("odb").__minus_gt("application/vnd.oasis.opendocument.database"),_st("odc").__minus_gt("application/vnd.oasis.opendocument.chart"),_st("odf").__minus_gt("application/vnd.oasis.opendocument.formula"),_st("odg").__minus_gt("application/vnd.oasis.opendocument.graphics"),_st("odi").__minus_gt("application/vnd.oasis.opendocument.image"),_st("odm").__minus_gt("application/vnd.oasis.opendocument.text-master"),_st("odp").__minus_gt("application/vnd.oasis.opendocument.presentation"),_st("ods").__minus_gt("application/vnd.oasis.opendocument.spreadsheet"),_st("odt").__minus_gt("application/vnd.oasis.opendocument.text"),_st("ogg").__minus_gt("application/ogg"),_st("old").__minus_gt("application/x-trash"),_st("oth").__minus_gt("application/vnd.oasis.opendocument.text-web"),_st("oza").__minus_gt("application/x-oz-application"),_st("p").__minus_gt("text/x-pascal"),_st("p7r").__minus_gt("application/x-pkcs7-certreqresp"),_st("pac").__minus_gt("application/x-ns-proxy-autoconfig"),_st("pas").__minus_gt("text/x-pascal"),_st("pat").__minus_gt("image/x-coreldrawpattern"),_st("pbm").__minus_gt("image/x-portable-bitmap"),_st("pcf").__minus_gt("application/x-font"),_st("pcf.Z").__minus_gt("application/x-font"),_st("pcx").__minus_gt("image/pcx"),_st("pdb").__minus_gt("chemical/x-pdb"),_st("pdf").__minus_gt("application/pdf"),_st("pfa").__minus_gt("application/x-font"),_st("pfb").__minus_gt("application/x-font"),_st("pgm").__minus_gt("image/x-portable-graymap"),_st("pgn").__minus_gt("application/x-chess-pgn"),_st("pgp").__minus_gt("application/pgp-signature"),_st("pk").__minus_gt("application/x-tex-pk"),_st("pl").__minus_gt("text/x-perl"),_st("pls").__minus_gt("audio/x-scpls"),_st("pm").__minus_gt("text/x-perl"),_st("png").__minus_gt("image/png"),_st("pnm").__minus_gt("image/x-portable-anymap"),_st("pot").__minus_gt("text/plain"),_st("ppm").__minus_gt("image/x-portable-pixmap"),_st("pps").__minus_gt("application/vnd.ms-powerpoint"),_st("ppt").__minus_gt("application/vnd.ms-powerpoint"),_st("prf").__minus_gt("application/pics-rules"),_st("prt").__minus_gt("chemical/x-ncbi-asn1-ascii"),_st("ps").__minus_gt("application/postscript"),_st("psd").__minus_gt("image/x-photoshop"),_st("psp").__minus_gt("text/x-psp"),_st("py").__minus_gt("text/x-python"),_st("pyc").__minus_gt("application/x-python-code"),_st("pyo").__minus_gt("application/x-python-code"),_st("qt").__minus_gt("video/quicktime"),_st("qtl").__minus_gt("application/x-quicktimeplayer"),_st("ra").__minus_gt("audio/x-realaudio"),_st("ram").__minus_gt("audio/x-pn-realaudio"),_st("rar").__minus_gt("application/rar"),_st("ras").__minus_gt("image/x-cmu-raster"),_st("rd").__minus_gt("chemical/x-mdl-rdfile"),_st("rdf").__minus_gt("application/rdf+xml"),_st("rgb").__minus_gt("image/x-rgb"),_st("rm").__minus_gt("audio/x-pn-realaudio"),_st("roff").__minus_gt("application/x-troff"),_st("ros").__minus_gt("chemical/x-rosdal"),_st("rpm").__minus_gt("application/x-redhat-package-manager"),_st("rss").__minus_gt("application/rss+xml"),_st("rtf").__minus_gt("text/rtf"),_st("rtx").__minus_gt("text/richtext"),_st("rxn").__minus_gt("chemical/x-mdl-rxnfile"),_st("sct").__minus_gt("text/scriptlet"),_st("sd").__minus_gt("chemical/x-mdl-sdfile"),_st("sd2").__minus_gt("audio/x-sd2"),_st("sda").__minus_gt("application/vnd.stardivision.draw"),_st("sdc").__minus_gt("application/vnd.stardivision.calc"),_st("sdd").__minus_gt("application/vnd.stardivision.impress"),_st("sdf").__minus_gt("chemical/x-mdl-sdfile"),_st("sdp").__minus_gt("application/vnd.stardivision.impress"),_st("sdw").__minus_gt("application/vnd.stardivision.writer"),_st("ser").__minus_gt("application/java-serialized-object"),_st("sgf").__minus_gt("application/x-go-sgf"),_st("sgl").__minus_gt("application/vnd.stardivision.writer-global"),_st("sh").__minus_gt("text/x-sh"),_st("shar").__minus_gt("application/x-shar"),_st("shtml").__minus_gt("text/html"),_st("sid").__minus_gt("audio/prs.sid"),_st("sik").__minus_gt("application/x-trash"),_st("silo").__minus_gt("model/mesh"),_st("sis").__minus_gt("application/vnd.symbian.install"),_st("sit").__minus_gt("application/x-stuffit"),_st("skd").__minus_gt("application/x-koan"),_st("skm").__minus_gt("application/x-koan"),_st("skp").__minus_gt("application/x-koan"),_st("skt").__minus_gt("application/x-koan"),_st("smf").__minus_gt("application/vnd.stardivision.math"),_st("smi").__minus_gt("application/smil"),_st("smil").__minus_gt("application/smil"),_st("snd").__minus_gt("audio/basic"),_st("spc").__minus_gt("chemical/x-galactic-spc"),_st("spl").__minus_gt("application/x-futuresplash"),_st("src").__minus_gt("application/x-wais-source"),_st("stc").__minus_gt("application/vnd.sun.xml.calc.template"),_st("std").__minus_gt("application/vnd.sun.xml.draw.template"),_st("sti").__minus_gt("application/vnd.sun.xml.impress.template"),_st("stl").__minus_gt("application/vnd.ms-pki.stl"),_st("stw").__minus_gt("application/vnd.sun.xml.writer.template"),_st("sty").__minus_gt("text/x-tex"),_st("sv4cpio").__minus_gt("application/x-sv4cpio"),_st("sv4crc").__minus_gt("application/x-sv4crc"),_st("svg").__minus_gt("image/svg+xml"),_st("svgz").__minus_gt("image/svg+xml"),_st("sw").__minus_gt("chemical/x-swissprot"),_st("swf").__minus_gt("application/x-shockwave-flash"),_st("swfl").__minus_gt("application/x-shockwave-flash"),_st("sxc").__minus_gt("application/vnd.sun.xml.calc"),_st("sxd").__minus_gt("application/vnd.sun.xml.draw"),_st("sxg").__minus_gt("application/vnd.sun.xml.writer.global"),_st("sxi").__minus_gt("application/vnd.sun.xml.impress"),_st("sxm").__minus_gt("application/vnd.sun.xml.math"),_st("sxw").__minus_gt("application/vnd.sun.xml.writer"),_st("t").__minus_gt("application/x-troff"),_st("tar").__minus_gt("application/x-tar"),_st("taz").__minus_gt("application/x-gtar"),_st("tcl").__minus_gt("text/x-tcl"),_st("tex").__minus_gt("text/x-tex"),_st("texi").__minus_gt("application/x-texinfo"),_st("texinfo").__minus_gt("application/x-texinfo"),_st("text").__minus_gt("text/plain"),_st("tgf").__minus_gt("chemical/x-mdl-tgf"),_st("tgz").__minus_gt("application/x-gtar"),_st("tif").__minus_gt("image/tiff"),_st("tiff").__minus_gt("image/tiff"),_st("tk").__minus_gt("text/x-tcl"),_st("tm").__minus_gt("text/texmacs"),_st("torrent").__minus_gt("application/x-bittorrent"),_st("tr").__minus_gt("application/x-troff"),_st("ts").__minus_gt("text/texmacs"),_st("tsp").__minus_gt("application/dsptype"),_st("tsv").__minus_gt("text/tab-separated-values"),_st("txt").__minus_gt("text/plain"),_st("udeb").__minus_gt("application/x-debian-package"),_st("uls").__minus_gt("text/iuls"),_st("ustar").__minus_gt("application/x-ustar"),_st("val").__minus_gt("chemical/x-ncbi-asn1-binary"),_st("vcd").__minus_gt("application/x-cdlink"),_st("vcf").__minus_gt("text/x-vcard"),_st("vcs").__minus_gt("text/x-vcalendar"),_st("vmd").__minus_gt("chemical/x-vmd"),_st("vms").__minus_gt("chemical/x-vamas-iso14976"),_st("vor").__minus_gt("application/vnd.stardivision.writer"),_st("vrm").__minus_gt("x-world/x-vrml"),_st("vrml").__minus_gt("x-world/x-vrml"),_st("vsd").__minus_gt("application/vnd.visio"),_st("wad").__minus_gt("application/x-doom"),_st("wav").__minus_gt("audio/x-wav"),_st("wax").__minus_gt("audio/x-ms-wax"),_st("wbmp").__minus_gt("image/vnd.wap.wbmp"),_st("wbxml").__minus_gt("application/vnd.wap.wbxml"),_st("wk").__minus_gt("application/x-123"),_st("wm").__minus_gt("video/x-ms-wm"),_st("wma").__minus_gt("audio/x-ms-wma"),_st("wmd").__minus_gt("application/x-ms-wmd"),_st("wml").__minus_gt("text/vnd.wap.wml"),_st("wmlc").__minus_gt("application/vnd.wap.wmlc"),_st("wmls").__minus_gt("text/vnd.wap.wmlscript"),_st("wmlsc").__minus_gt("application/vnd.wap.wmlscriptc"),_st("wmv").__minus_gt("video/x-ms-wmv"),_st("wmx").__minus_gt("video/x-ms-wmx"),_st("wmz").__minus_gt("application/x-ms-wmz"),_st("wp5").__minus_gt("application/wordperfect5.1"),_st("wpd").__minus_gt("application/wordperfect"),_st("wrl").__minus_gt("x-world/x-vrml"),_st("wsc").__minus_gt("text/scriptlet"),_st("wvx").__minus_gt("video/x-ms-wvx"),_st("wz").__minus_gt("application/x-wingz"),_st("xbm").__minus_gt("image/x-xbitmap"),_st("xcf").__minus_gt("application/x-xcf"),_st("xht").__minus_gt("application/xhtml+xml"),_st("xhtml").__minus_gt("application/xhtml+xml"),_st("xlb").__minus_gt("application/vnd.ms-excel"),_st("xls").__minus_gt("application/vnd.ms-excel"),_st("xlt").__minus_gt("application/vnd.ms-excel"),_st("xml").__minus_gt("application/xml"),_st("xpi").__minus_gt("application/x-xpinstall"),_st("xpm").__minus_gt("image/x-xpixmap"),_st("xsl").__minus_gt("application/xml"),_st("xtel").__minus_gt("chemical/x-xtel"),_st("xul").__minus_gt("application/vnd.mozilla.xul+xml"),_st("xwd").__minus_gt("image/x-xwindowdump"),_st("xyz").__minus_gt("chemical/x-xyz"),_st("zip").__minus_gt("application/zip"),_st("zmt").__minus_gt("chemical/x-mopac-input"),_st("~").__minus_gt("application/x-trash")]); return $1; }, function($ctx1) {$ctx1.fill(self,"defaultMimeTypes",{},smalltalk.FileServer.klass)})}, args: [], source: "defaultMimeTypes\x0a\x09^ #{\x0a\x09\x09'%' -> 'application/x-trash'.\x0a\x09\x09'323' -> 'text/h323'.\x0a\x09\x09'abw' -> 'application/x-abiword'.\x0a\x09\x09'ai' -> 'application/postscript'.\x0a\x09\x09'aif' -> 'audio/x-aiff'.\x0a\x09\x09'aifc' -> 'audio/x-aiff'.\x0a\x09\x09'aiff' -> 'audio/x-aiff'.\x0a\x09\x09'alc' -> 'chemical/x-alchemy'.\x0a\x09\x09'art' -> 'image/x-jg'.\x0a\x09\x09'asc' -> 'text/plain'.\x0a\x09\x09'asf' -> 'video/x-ms-asf'.\x0a\x09\x09'asn' -> 'chemical/x-ncbi-asn1-spec'.\x0a\x09\x09'aso' -> 'chemical/x-ncbi-asn1-binary'.\x0a\x09\x09'asx' -> 'video/x-ms-asf'.\x0a\x09\x09'au' -> 'audio/basic'.\x0a\x09\x09'avi' -> 'video/x-msvideo'.\x0a\x09\x09'b' -> 'chemical/x-molconn-Z'.\x0a\x09\x09'bak' -> 'application/x-trash'.\x0a\x09\x09'bat' -> 'application/x-msdos-program'.\x0a\x09\x09'bcpio' -> 'application/x-bcpio'.\x0a\x09\x09'bib' -> 'text/x-bibtex'.\x0a\x09\x09'bin' -> 'application/octet-stream'.\x0a\x09\x09'bmp' -> 'image/x-ms-bmp'.\x0a\x09\x09'book' -> 'application/x-maker'.\x0a\x09\x09'bsd' -> 'chemical/x-crossfire'.\x0a\x09\x09'c' -> 'text/x-csrc'.\x0a\x09\x09'c++' -> 'text/x-c++src'.\x0a\x09\x09'c3d' -> 'chemical/x-chem3d'.\x0a\x09\x09'cac' -> 'chemical/x-cache'.\x0a\x09\x09'cache' -> 'chemical/x-cache'.\x0a\x09\x09'cascii' -> 'chemical/x-cactvs-binary'.\x0a\x09\x09'cat' -> 'application/vnd.ms-pki.seccat'.\x0a\x09\x09'cbin' -> 'chemical/x-cactvs-binary'.\x0a\x09\x09'cc' -> 'text/x-c++src'.\x0a\x09\x09'cdf' -> 'application/x-cdf'.\x0a\x09\x09'cdr' -> 'image/x-coreldraw'.\x0a\x09\x09'cdt' -> 'image/x-coreldrawtemplate'.\x0a\x09\x09'cdx' -> 'chemical/x-cdx'.\x0a\x09\x09'cdy' -> 'application/vnd.cinderella'.\x0a\x09\x09'cef' -> 'chemical/x-cxf'.\x0a\x09\x09'cer' -> 'chemical/x-cerius'.\x0a\x09\x09'chm' -> 'chemical/x-chemdraw'.\x0a\x09\x09'chrt' -> 'application/x-kchart'.\x0a\x09\x09'cif' -> 'chemical/x-cif'.\x0a\x09\x09'class' -> 'application/java-vm'.\x0a\x09\x09'cls' -> 'text/x-tex'.\x0a\x09\x09'cmdf' -> 'chemical/x-cmdf'.\x0a\x09\x09'cml' -> 'chemical/x-cml'.\x0a\x09\x09'cod' -> 'application/vnd.rim.cod'.\x0a\x09\x09'com' -> 'application/x-msdos-program'.\x0a\x09\x09'cpa' -> 'chemical/x-compass'.\x0a\x09\x09'cpio' -> 'application/x-cpio'.\x0a\x09\x09'cpp' -> 'text/x-c++src'.\x0a\x09\x09'cpt' -> 'image/x-corelphotopaint'.\x0a\x09\x09'crl' -> 'application/x-pkcs7-crl'.\x0a\x09\x09'crt' -> 'application/x-x509-ca-cert'.\x0a\x09\x09'csf' -> 'chemical/x-cache-csf'.\x0a\x09\x09'csh' -> 'text/x-csh'.\x0a\x09\x09'csm' -> 'chemical/x-csml'.\x0a\x09\x09'csml' -> 'chemical/x-csml'.\x0a\x09\x09'css' -> 'text/css'.\x0a\x09\x09'csv' -> 'text/comma-separated-values'.\x0a\x09\x09'ctab' -> 'chemical/x-cactvs-binary'.\x0a\x09\x09'ctx' -> 'chemical/x-ctx'.\x0a\x09\x09'cu' -> 'application/cu-seeme'.\x0a\x09\x09'cub' -> 'chemical/x-gaussian-cube'.\x0a\x09\x09'cxf' -> 'chemical/x-cxf'.\x0a\x09\x09'cxx' -> 'text/x-c++src'.\x0a\x09\x09'dat' -> 'chemical/x-mopac-input'.\x0a\x09\x09'dcr' -> 'application/x-director'.\x0a\x09\x09'deb' -> 'application/x-debian-package'.\x0a\x09\x09'dif' -> 'video/dv'.\x0a\x09\x09'diff' -> 'text/plain'.\x0a\x09\x09'dir' -> 'application/x-director'.\x0a\x09\x09'djv' -> 'image/vnd.djvu'.\x0a\x09\x09'djvu' -> 'image/vnd.djvu'.\x0a\x09\x09'dl' -> 'video/dl'.\x0a\x09\x09'dll' -> 'application/x-msdos-program'.\x0a\x09\x09'dmg' -> 'application/x-apple-diskimage'.\x0a\x09\x09'dms' -> 'application/x-dms'.\x0a\x09\x09'doc' -> 'application/msword'.\x0a\x09\x09'dot' -> 'application/msword'.\x0a\x09\x09'dv' -> 'video/dv'.\x0a\x09\x09'dvi' -> 'application/x-dvi'.\x0a\x09\x09'dx' -> 'chemical/x-jcamp-dx'.\x0a\x09\x09'dxr' -> 'application/x-director'.\x0a\x09\x09'emb' -> 'chemical/x-embl-dl-nucleotide'.\x0a\x09\x09'embl' -> 'chemical/x-embl-dl-nucleotide'.\x0a\x09\x09'ent' -> 'chemical/x-pdb'.\x0a\x09\x09'eps' -> 'application/postscript'.\x0a\x09\x09'etx' -> 'text/x-setext'.\x0a\x09\x09'exe' -> 'application/x-msdos-program'.\x0a\x09\x09'ez' -> 'application/andrew-inset'.\x0a\x09\x09'fb' -> 'application/x-maker'.\x0a\x09\x09'fbdoc' -> 'application/x-maker'.\x0a\x09\x09'fch' -> 'chemical/x-gaussian-checkpoint'.\x0a\x09\x09'fchk' -> 'chemical/x-gaussian-checkpoint'.\x0a\x09\x09'fig' -> 'application/x-xfig'.\x0a\x09\x09'flac' -> 'application/x-flac'.\x0a\x09\x09'fli' -> 'video/fli'.\x0a\x09\x09'fm' -> 'application/x-maker'.\x0a\x09\x09'frame' -> 'application/x-maker'.\x0a\x09\x09'frm' -> 'application/x-maker'.\x0a\x09\x09'gal' -> 'chemical/x-gaussian-log'.\x0a\x09\x09'gam' -> 'chemical/x-gamess-input'.\x0a\x09\x09'gamin' -> 'chemical/x-gamess-input'.\x0a\x09\x09'gau' -> 'chemical/x-gaussian-input'.\x0a\x09\x09'gcd' -> 'text/x-pcs-gcd'.\x0a\x09\x09'gcf' -> 'application/x-graphing-calculator'.\x0a\x09\x09'gcg' -> 'chemical/x-gcg8-sequence'.\x0a\x09\x09'gen' -> 'chemical/x-genbank'.\x0a\x09\x09'gf' -> 'application/x-tex-gf'.\x0a\x09\x09'gif' -> 'image/gif'.\x0a\x09\x09'gjc' -> 'chemical/x-gaussian-input'.\x0a\x09\x09'gjf' -> 'chemical/x-gaussian-input'.\x0a\x09\x09'gl' -> 'video/gl'.\x0a\x09\x09'gnumeric' -> 'application/x-gnumeric'.\x0a\x09\x09'gpt' -> 'chemical/x-mopac-graph'.\x0a\x09\x09'gsf' -> 'application/x-font'.\x0a\x09\x09'gsm' -> 'audio/x-gsm'.\x0a\x09\x09'gtar' -> 'application/x-gtar'.\x0a\x09\x09'h' -> 'text/x-chdr'.\x0a\x09\x09'h++' -> 'text/x-c++hdr'.\x0a\x09\x09'hdf' -> 'application/x-hdf'.\x0a\x09\x09'hh' -> 'text/x-c++hdr'.\x0a\x09\x09'hin' -> 'chemical/x-hin'.\x0a\x09\x09'hpp' -> 'text/x-c++hdr'.\x0a\x09\x09'hqx' -> 'application/mac-binhex40'.\x0a\x09\x09'hs' -> 'text/x-haskell'.\x0a\x09\x09'hta' -> 'application/hta'.\x0a\x09\x09'htc' -> 'text/x-component'.\x0a\x09\x09'htm' -> 'text/html'.\x0a\x09\x09'html' -> 'text/html'.\x0a\x09\x09'hxx' -> 'text/x-c++hdr'.\x0a\x09\x09'ica' -> 'application/x-ica'.\x0a\x09\x09'ice' -> 'x-conference/x-cooltalk'.\x0a\x09\x09'ico' -> 'image/x-icon'.\x0a\x09\x09'ics' -> 'text/calendar'.\x0a\x09\x09'icz' -> 'text/calendar'.\x0a\x09\x09'ief' -> 'image/ief'.\x0a\x09\x09'iges' -> 'model/iges'.\x0a\x09\x09'igs' -> 'model/iges'.\x0a\x09\x09'iii' -> 'application/x-iphone'.\x0a\x09\x09'inp' -> 'chemical/x-gamess-input'.\x0a\x09\x09'ins' -> 'application/x-internet-signup'.\x0a\x09\x09'iso' -> 'application/x-iso9660-image'.\x0a\x09\x09'isp' -> 'application/x-internet-signup'.\x0a\x09\x09'ist' -> 'chemical/x-isostar'.\x0a\x09\x09'istr' -> 'chemical/x-isostar'.\x0a\x09\x09'jad' -> 'text/vnd.sun.j2me.app-descriptor'.\x0a\x09\x09'jar' -> 'application/java-archive'.\x0a\x09\x09'java' -> 'text/x-java'.\x0a\x09\x09'jdx' -> 'chemical/x-jcamp-dx'.\x0a\x09\x09'jmz' -> 'application/x-jmol'.\x0a\x09\x09'jng' -> 'image/x-jng'.\x0a\x09\x09'jnlp' -> 'application/x-java-jnlp-file'.\x0a\x09\x09'jpe' -> 'image/jpeg'.\x0a\x09\x09'jpeg' -> 'image/jpeg'.\x0a\x09\x09'jpg' -> 'image/jpeg'.\x0a\x09\x09'js' -> 'application/javascript'.\x0a\x09\x09'kar' -> 'audio/midi'.\x0a\x09\x09'key' -> 'application/pgp-keys'.\x0a\x09\x09'kil' -> 'application/x-killustrator'.\x0a\x09\x09'kin' -> 'chemical/x-kinemage'.\x0a\x09\x09'kpr' -> 'application/x-kpresenter'.\x0a\x09\x09'kpt' -> 'application/x-kpresenter'.\x0a\x09\x09'ksp' -> 'application/x-kspread'.\x0a\x09\x09'kwd' -> 'application/x-kword'.\x0a\x09\x09'kwt' -> 'application/x-kword'.\x0a\x09\x09'latex' -> 'application/x-latex'.\x0a\x09\x09'lha' -> 'application/x-lha'.\x0a\x09\x09'lhs' -> 'text/x-literate-haskell'.\x0a\x09\x09'lsf' -> 'video/x-la-asf'.\x0a\x09\x09'lsx' -> 'video/x-la-asf'.\x0a\x09\x09'ltx' -> 'text/x-tex'.\x0a\x09\x09'lzh' -> 'application/x-lzh'.\x0a\x09\x09'lzx' -> 'application/x-lzx'.\x0a\x09\x09'm3u' -> 'audio/x-mpegurl'.\x0a\x09\x09'm4a' -> 'audio/mpeg'.\x0a\x09\x09'maker' -> 'application/x-maker'.\x0a\x09\x09'man' -> 'application/x-troff-man'.\x0a\x09\x09'mcif' -> 'chemical/x-mmcif'.\x0a\x09\x09'mcm' -> 'chemical/x-macmolecule'.\x0a\x09\x09'mdb' -> 'application/msaccess'.\x0a\x09\x09'me' -> 'application/x-troff-me'.\x0a\x09\x09'mesh' -> 'model/mesh'.\x0a\x09\x09'mid' -> 'audio/midi'.\x0a\x09\x09'midi' -> 'audio/midi'.\x0a\x09\x09'mif' -> 'application/x-mif'.\x0a\x09\x09'mm' -> 'application/x-freemind'.\x0a\x09\x09'mmd' -> 'chemical/x-macromodel-input'.\x0a\x09\x09'mmf' -> 'application/vnd.smaf'.\x0a\x09\x09'mml' -> 'text/mathml'.\x0a\x09\x09'mmod' -> 'chemical/x-macromodel-input'.\x0a\x09\x09'mng' -> 'video/x-mng'.\x0a\x09\x09'moc' -> 'text/x-moc'.\x0a\x09\x09'mol' -> 'chemical/x-mdl-molfile'.\x0a\x09\x09'mol2' -> 'chemical/x-mol2'.\x0a\x09\x09'moo' -> 'chemical/x-mopac-out'.\x0a\x09\x09'mop' -> 'chemical/x-mopac-input'.\x0a\x09\x09'mopcrt' -> 'chemical/x-mopac-input'.\x0a\x09\x09'mov' -> 'video/quicktime'.\x0a\x09\x09'movie' -> 'video/x-sgi-movie'.\x0a\x09\x09'mp2' -> 'audio/mpeg'.\x0a\x09\x09'mp3' -> 'audio/mpeg'.\x0a\x09\x09'mp4' -> 'video/mp4'.\x0a\x09\x09'mpc' -> 'chemical/x-mopac-input'.\x0a\x09\x09'mpe' -> 'video/mpeg'.\x0a\x09\x09'mpeg' -> 'video/mpeg'.\x0a\x09\x09'mpega' -> 'audio/mpeg'.\x0a\x09\x09'mpg' -> 'video/mpeg'.\x0a\x09\x09'mpga' -> 'audio/mpeg'.\x0a\x09\x09'ms' -> 'application/x-troff-ms'.\x0a\x09\x09'msh' -> 'model/mesh'.\x0a\x09\x09'msi' -> 'application/x-msi'.\x0a\x09\x09'mvb' -> 'chemical/x-mopac-vib'.\x0a\x09\x09'mxu' -> 'video/vnd.mpegurl'.\x0a\x09\x09'nb' -> 'application/mathematica'.\x0a\x09\x09'nc' -> 'application/x-netcdf'.\x0a\x09\x09'nwc' -> 'application/x-nwc'.\x0a\x09\x09'o' -> 'application/x-object'.\x0a\x09\x09'oda' -> 'application/oda'.\x0a\x09\x09'odb' -> 'application/vnd.oasis.opendocument.database'.\x0a\x09\x09'odc' -> 'application/vnd.oasis.opendocument.chart'.\x0a\x09\x09'odf' -> 'application/vnd.oasis.opendocument.formula'.\x0a\x09\x09'odg' -> 'application/vnd.oasis.opendocument.graphics'.\x0a\x09\x09'odi' -> 'application/vnd.oasis.opendocument.image'.\x0a\x09\x09'odm' -> 'application/vnd.oasis.opendocument.text-master'.\x0a\x09\x09'odp' -> 'application/vnd.oasis.opendocument.presentation'.\x0a\x09\x09'ods' -> 'application/vnd.oasis.opendocument.spreadsheet'.\x0a\x09\x09'odt' -> 'application/vnd.oasis.opendocument.text'.\x0a\x09\x09'ogg' -> 'application/ogg'.\x0a\x09\x09'old' -> 'application/x-trash'.\x0a\x09\x09'oth' -> 'application/vnd.oasis.opendocument.text-web'.\x0a\x09\x09'oza' -> 'application/x-oz-application'.\x0a\x09\x09'p' -> 'text/x-pascal'.\x0a\x09\x09'p7r' -> 'application/x-pkcs7-certreqresp'.\x0a\x09\x09'pac' -> 'application/x-ns-proxy-autoconfig'.\x0a\x09\x09'pas' -> 'text/x-pascal'.\x0a\x09\x09'pat' -> 'image/x-coreldrawpattern'.\x0a\x09\x09'pbm' -> 'image/x-portable-bitmap'.\x0a\x09\x09'pcf' -> 'application/x-font'.\x0a\x09\x09'pcf.Z' -> 'application/x-font'.\x0a\x09\x09'pcx' -> 'image/pcx'.\x0a\x09\x09'pdb' -> 'chemical/x-pdb'.\x0a\x09\x09'pdf' -> 'application/pdf'.\x0a\x09\x09'pfa' -> 'application/x-font'.\x0a\x09\x09'pfb' -> 'application/x-font'.\x0a\x09\x09'pgm' -> 'image/x-portable-graymap'.\x0a\x09\x09'pgn' -> 'application/x-chess-pgn'.\x0a\x09\x09'pgp' -> 'application/pgp-signature'.\x0a\x09\x09'pk' -> 'application/x-tex-pk'.\x0a\x09\x09'pl' -> 'text/x-perl'.\x0a\x09\x09'pls' -> 'audio/x-scpls'.\x0a\x09\x09'pm' -> 'text/x-perl'.\x0a\x09\x09'png' -> 'image/png'.\x0a\x09\x09'pnm' -> 'image/x-portable-anymap'.\x0a\x09\x09'pot' -> 'text/plain'.\x0a\x09\x09'ppm' -> 'image/x-portable-pixmap'.\x0a\x09\x09'pps' -> 'application/vnd.ms-powerpoint'.\x0a\x09\x09'ppt' -> 'application/vnd.ms-powerpoint'.\x0a\x09\x09'prf' -> 'application/pics-rules'.\x0a\x09\x09'prt' -> 'chemical/x-ncbi-asn1-ascii'.\x0a\x09\x09'ps' -> 'application/postscript'.\x0a\x09\x09'psd' -> 'image/x-photoshop'.\x0a\x09\x09'psp' -> 'text/x-psp'.\x0a\x09\x09'py' -> 'text/x-python'.\x0a\x09\x09'pyc' -> 'application/x-python-code'.\x0a\x09\x09'pyo' -> 'application/x-python-code'.\x0a\x09\x09'qt' -> 'video/quicktime'.\x0a\x09\x09'qtl' -> 'application/x-quicktimeplayer'.\x0a\x09\x09'ra' -> 'audio/x-realaudio'.\x0a\x09\x09'ram' -> 'audio/x-pn-realaudio'.\x0a\x09\x09'rar' -> 'application/rar'.\x0a\x09\x09'ras' -> 'image/x-cmu-raster'.\x0a\x09\x09'rd' -> 'chemical/x-mdl-rdfile'.\x0a\x09\x09'rdf' -> 'application/rdf+xml'.\x0a\x09\x09'rgb' -> 'image/x-rgb'.\x0a\x09\x09'rm' -> 'audio/x-pn-realaudio'.\x0a\x09\x09'roff' -> 'application/x-troff'.\x0a\x09\x09'ros' -> 'chemical/x-rosdal'.\x0a\x09\x09'rpm' -> 'application/x-redhat-package-manager'.\x0a\x09\x09'rss' -> 'application/rss+xml'.\x0a\x09\x09'rtf' -> 'text/rtf'.\x0a\x09\x09'rtx' -> 'text/richtext'.\x0a\x09\x09'rxn' -> 'chemical/x-mdl-rxnfile'.\x0a\x09\x09'sct' -> 'text/scriptlet'.\x0a\x09\x09'sd' -> 'chemical/x-mdl-sdfile'.\x0a\x09\x09'sd2' -> 'audio/x-sd2'.\x0a\x09\x09'sda' -> 'application/vnd.stardivision.draw'.\x0a\x09\x09'sdc' -> 'application/vnd.stardivision.calc'.\x0a\x09\x09'sdd' -> 'application/vnd.stardivision.impress'.\x0a\x09\x09'sdf' -> 'chemical/x-mdl-sdfile'.\x0a\x09\x09'sdp' -> 'application/vnd.stardivision.impress'.\x0a\x09\x09'sdw' -> 'application/vnd.stardivision.writer'.\x0a\x09\x09'ser' -> 'application/java-serialized-object'.\x0a\x09\x09'sgf' -> 'application/x-go-sgf'.\x0a\x09\x09'sgl' -> 'application/vnd.stardivision.writer-global'.\x0a\x09\x09'sh' -> 'text/x-sh'.\x0a\x09\x09'shar' -> 'application/x-shar'.\x0a\x09\x09'shtml' -> 'text/html'.\x0a\x09\x09'sid' -> 'audio/prs.sid'.\x0a\x09\x09'sik' -> 'application/x-trash'.\x0a\x09\x09'silo' -> 'model/mesh'.\x0a\x09\x09'sis' -> 'application/vnd.symbian.install'.\x0a\x09\x09'sit' -> 'application/x-stuffit'.\x0a\x09\x09'skd' -> 'application/x-koan'.\x0a\x09\x09'skm' -> 'application/x-koan'.\x0a\x09\x09'skp' -> 'application/x-koan'.\x0a\x09\x09'skt' -> 'application/x-koan'.\x0a\x09\x09'smf' -> 'application/vnd.stardivision.math'.\x0a\x09\x09'smi' -> 'application/smil'.\x0a\x09\x09'smil' -> 'application/smil'.\x0a\x09\x09'snd' -> 'audio/basic'.\x0a\x09\x09'spc' -> 'chemical/x-galactic-spc'.\x0a\x09\x09'spl' -> 'application/x-futuresplash'.\x0a\x09\x09'src' -> 'application/x-wais-source'.\x0a\x09\x09'stc' -> 'application/vnd.sun.xml.calc.template'.\x0a\x09\x09'std' -> 'application/vnd.sun.xml.draw.template'.\x0a\x09\x09'sti' -> 'application/vnd.sun.xml.impress.template'.\x0a\x09\x09'stl' -> 'application/vnd.ms-pki.stl'.\x0a\x09\x09'stw' -> 'application/vnd.sun.xml.writer.template'.\x0a\x09\x09'sty' -> 'text/x-tex'.\x0a\x09\x09'sv4cpio' -> 'application/x-sv4cpio'.\x0a\x09\x09'sv4crc' -> 'application/x-sv4crc'.\x0a\x09\x09'svg' -> 'image/svg+xml'.\x0a\x09\x09'svgz' -> 'image/svg+xml'.\x0a\x09\x09'sw' -> 'chemical/x-swissprot'.\x0a\x09\x09'swf' -> 'application/x-shockwave-flash'.\x0a\x09\x09'swfl' -> 'application/x-shockwave-flash'.\x0a\x09\x09'sxc' -> 'application/vnd.sun.xml.calc'.\x0a\x09\x09'sxd' -> 'application/vnd.sun.xml.draw'.\x0a\x09\x09'sxg' -> 'application/vnd.sun.xml.writer.global'.\x0a\x09\x09'sxi' -> 'application/vnd.sun.xml.impress'.\x0a\x09\x09'sxm' -> 'application/vnd.sun.xml.math'.\x0a\x09\x09'sxw' -> 'application/vnd.sun.xml.writer'.\x0a\x09\x09't' -> 'application/x-troff'.\x0a\x09\x09'tar' -> 'application/x-tar'.\x0a\x09\x09'taz' -> 'application/x-gtar'.\x0a\x09\x09'tcl' -> 'text/x-tcl'.\x0a\x09\x09'tex' -> 'text/x-tex'.\x0a\x09\x09'texi' -> 'application/x-texinfo'.\x0a\x09\x09'texinfo' -> 'application/x-texinfo'.\x0a\x09\x09'text' -> 'text/plain'.\x0a\x09\x09'tgf' -> 'chemical/x-mdl-tgf'.\x0a\x09\x09'tgz' -> 'application/x-gtar'.\x0a\x09\x09'tif' -> 'image/tiff'.\x0a\x09\x09'tiff' -> 'image/tiff'.\x0a\x09\x09'tk' -> 'text/x-tcl'.\x0a\x09\x09'tm' -> 'text/texmacs'.\x0a\x09\x09'torrent' -> 'application/x-bittorrent'.\x0a\x09\x09'tr' -> 'application/x-troff'.\x0a\x09\x09'ts' -> 'text/texmacs'.\x0a\x09\x09'tsp' -> 'application/dsptype'.\x0a\x09\x09'tsv' -> 'text/tab-separated-values'.\x0a\x09\x09'txt' -> 'text/plain'.\x0a\x09\x09'udeb' -> 'application/x-debian-package'.\x0a\x09\x09'uls' -> 'text/iuls'.\x0a\x09\x09'ustar' -> 'application/x-ustar'.\x0a\x09\x09'val' -> 'chemical/x-ncbi-asn1-binary'.\x0a\x09\x09'vcd' -> 'application/x-cdlink'.\x0a\x09\x09'vcf' -> 'text/x-vcard'.\x0a\x09\x09'vcs' -> 'text/x-vcalendar'.\x0a\x09\x09'vmd' -> 'chemical/x-vmd'.\x0a\x09\x09'vms' -> 'chemical/x-vamas-iso14976'.\x0a\x09\x09'vor' -> 'application/vnd.stardivision.writer'.\x0a\x09\x09'vrm' -> 'x-world/x-vrml'.\x0a\x09\x09'vrml' -> 'x-world/x-vrml'.\x0a\x09\x09'vsd' -> 'application/vnd.visio'.\x0a\x09\x09'wad' -> 'application/x-doom'.\x0a\x09\x09'wav' -> 'audio/x-wav'.\x0a\x09\x09'wax' -> 'audio/x-ms-wax'.\x0a\x09\x09'wbmp' -> 'image/vnd.wap.wbmp'.\x0a\x09\x09'wbxml' -> 'application/vnd.wap.wbxml'.\x0a\x09\x09'wk' -> 'application/x-123'.\x0a\x09\x09'wm' -> 'video/x-ms-wm'.\x0a\x09\x09'wma' -> 'audio/x-ms-wma'.\x0a\x09\x09'wmd' -> 'application/x-ms-wmd'.\x0a\x09\x09'wml' -> 'text/vnd.wap.wml'.\x0a\x09\x09'wmlc' -> 'application/vnd.wap.wmlc'.\x0a\x09\x09'wmls' -> 'text/vnd.wap.wmlscript'.\x0a\x09\x09'wmlsc' -> 'application/vnd.wap.wmlscriptc'.\x0a\x09\x09'wmv' -> 'video/x-ms-wmv'.\x0a\x09\x09'wmx' -> 'video/x-ms-wmx'.\x0a\x09\x09'wmz' -> 'application/x-ms-wmz'.\x0a\x09\x09'wp5' -> 'application/wordperfect5.1'.\x0a\x09\x09'wpd' -> 'application/wordperfect'.\x0a\x09\x09'wrl' -> 'x-world/x-vrml'.\x0a\x09\x09'wsc' -> 'text/scriptlet'.\x0a\x09\x09'wvx' -> 'video/x-ms-wvx'.\x0a\x09\x09'wz' -> 'application/x-wingz'.\x0a\x09\x09'xbm' -> 'image/x-xbitmap'.\x0a\x09\x09'xcf' -> 'application/x-xcf'.\x0a\x09\x09'xht' -> 'application/xhtml+xml'.\x0a\x09\x09'xhtml' -> 'application/xhtml+xml'.\x0a\x09\x09'xlb' -> 'application/vnd.ms-excel'.\x0a\x09\x09'xls' -> 'application/vnd.ms-excel'.\x0a\x09\x09'xlt' -> 'application/vnd.ms-excel'.\x0a\x09\x09'xml' -> 'application/xml'.\x0a\x09\x09'xpi' -> 'application/x-xpinstall'.\x0a\x09\x09'xpm' -> 'image/x-xpixmap'.\x0a\x09\x09'xsl' -> 'application/xml'.\x0a\x09\x09'xtel' -> 'chemical/x-xtel'.\x0a\x09\x09'xul' -> 'application/vnd.mozilla.xul+xml'.\x0a\x09\x09'xwd' -> 'image/x-xwindowdump'.\x0a\x09\x09'xyz' -> 'chemical/x-xyz'.\x0a\x09\x09'zip' -> 'application/zip'.\x0a\x09\x09'zmt' -> 'chemical/x-mopac-input'.\x0a\x09\x09'~' -> 'application/x-trash'\x0a\x09}", messageSends: ["->"], referencedClasses: [] }), smalltalk.FileServer.klass); smalltalk.addMethod( smalltalk.method({ selector: "defaultPort", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=(4000); return $1; }, function($ctx1) {$ctx1.fill(self,"defaultPort",{},smalltalk.FileServer.klass)})}, args: [], source: "defaultPort\x0a\x09^4000", messageSends: [], referencedClasses: [] }), smalltalk.FileServer.klass); smalltalk.addMethod( smalltalk.method({ selector: "main", category: 'initialization', fn: function (){ var self=this; var fileServer,args; function $FileServer(){return smalltalk.FileServer||(typeof FileServer=="undefined"?nil:FileServer)} return smalltalk.withContext(function($ctx1) { var $1,$2; var $early={}; try { args=_st(process)._argv(); _st(args)._removeFrom_to_((1),(3)); _st(args)._detect_ifNone_((function(each){ return smalltalk.withContext(function($ctx2) { $1=_st(each).__eq("--help"); if(smalltalk.assert($1)){ return _st($FileServer())._printHelp(); }; }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){ return smalltalk.withContext(function($ctx2) { fileServer=_st($FileServer())._createServerWithArguments_(args); fileServer; $2=_st(fileServer)._start(); throw $early=[$2]; }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); return self} catch(e) {if(e===$early)return e[0]; throw e} }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},smalltalk.FileServer.klass)})}, args: [], source: "main\x0a\x09\x22Main entry point for Amber applications.\x0a\x09 Creates and starts a FileServer instance.\x22\x0a\x09| fileServer args |\x0a\x09args := process argv.\x0a\x09\x22Remove the first args which contain the path to the node executable and the script file.\x22\x0a\x09args removeFrom: 1 to: 3.\x0a\x0a\x09args detect: [ :each |\x0a\x09\x09(each = '--help') ifTrue: [FileServer printHelp]]\x0a\x09ifNone: [\x0a\x09\x09fileServer := FileServer createServerWithArguments: args.\x0a\x09\x09^fileServer start]", messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "printHelp", "=", "createServerWithArguments:", "start"], referencedClasses: ["FileServer"] }), smalltalk.FileServer.klass); smalltalk.addMethod( smalltalk.method({ selector: "mimeTypeFor:", category: 'accessing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(self)._mimeTypes())._at_ifAbsent_(_st(aString)._replace_with_(".*[\x5c.]",""),(function(){ return smalltalk.withContext(function($ctx2) { return "text/plain"; }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},smalltalk.FileServer.klass)})}, args: ["aString"], source: "mimeTypeFor: aString\x0a\x09^self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']", messageSends: ["at:ifAbsent:", "replace:with:", "mimeTypes"], referencedClasses: [] }), smalltalk.FileServer.klass); smalltalk.addMethod( smalltalk.method({ selector: "mimeTypes", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$1; $2=self["@mimeTypes"]; if(($receiver = $2) == nil || $receiver == undefined){ self["@mimeTypes"]=_st(self)._defaultMimeTypes(); $1=self["@mimeTypes"]; } else { $1=$2; }; return $1; }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},smalltalk.FileServer.klass)})}, args: [], source: "mimeTypes\x0a\x09^mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]", messageSends: ["ifNil:", "defaultMimeTypes"], referencedClasses: [] }), smalltalk.FileServer.klass); smalltalk.addMethod( smalltalk.method({ selector: "printHelp", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { _st(console)._log_("Available commandline options are:"); _st(console)._log_("--help"); _st(_st(self)._commandLineSwitches())._do_((function(each){ return smalltalk.withContext(function($ctx2) { return _st(console)._log_(_st(each).__comma(" ")); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"printHelp",{},smalltalk.FileServer.klass)})}, args: [], source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' ']", messageSends: ["log:", "do:", ",", "commandLineSwitches"], referencedClasses: [] }), smalltalk.FileServer.klass); smalltalk.addMethod( smalltalk.method({ selector: "selectorForCommandLineSwitch:", category: 'accessing', fn: function (aSwitch){ var self=this; return smalltalk.withContext(function($ctx1) { var $1; $1=_st(_st(_st(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){ return smalltalk.withContext(function($ctx2) { return _st(_st(each)._second())._asUppercase(); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}))).__comma(":"); return $1; }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},smalltalk.FileServer.klass)})}, args: ["aSwitch"], source: "selectorForCommandLineSwitch: aSwitch\x0a\x09\x22Remove the trailing '--', add ':' at the end\x0a\x09 and replace all occurences of a lowercase letter preceded by a '-' with\x0a\x09 the Uppercase letter.\x0a\x09 Example: --fallback-page becomes fallbackPage:\x22\x0a\x09^((aSwitch replace: '^--' with: '')\x0a\x09\x09replace: '-[a-z]' with: [ :each | each second asUppercase ]), ':'", messageSends: [",", "replace:with:", "asUppercase", "second"], referencedClasses: [] }), smalltalk.FileServer.klass); smalltalk.addClass('Repl', smalltalk.Object, ['readline', 'interface', 'util'], 'AmberCli'); smalltalk.Repl.comment="I am a class representing a REPL (Read Evaluate Print Loop) and provide a command line interface to Amber Smalltalk.\x0aOn the prompt you can type Amber statements which will be evaluated after pressing .\x0aThe evaluation is comparable with executing a 'DoIt' in a workspace.\x0a\x0aMy runtime requirement is a functional Node.js executable with working Readline support." smalltalk.addMethod( smalltalk.method({ selector: "close", category: 'actions', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { _st(_st(process)._stdin())._destroy(); return self}, function($ctx1) {$ctx1.fill(self,"close",{},smalltalk.Repl)})}, args: [], source: "close\x0a\x09process stdin destroy", messageSends: ["destroy", "stdin"], referencedClasses: [] }), smalltalk.Repl); smalltalk.addMethod( smalltalk.method({ selector: "createInterface", category: 'actions', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { self["@interface"]=_st(self["@readline"])._createInterface_stdout_(_st(process)._stdin(),_st(process)._stdout()); _st(self["@interface"])._on_do_("line",(function(buffer){ return smalltalk.withContext(function($ctx2) { return _st(self)._eval_(buffer); }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1)})})); _st(self["@interface"])._on_do_("close",(function(){ return smalltalk.withContext(function($ctx2) { return _st(self)._close(); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})); _st(self)._setPrompt(); _st(self["@interface"])._prompt(); return self}, function($ctx1) {$ctx1.fill(self,"createInterface",{},smalltalk.Repl)})}, args: [], source: "createInterface\x0a\x09\x22No completion for now\x22\x0a\x09interface := readline createInterface: process stdin stdout: process stdout.\x0a\x09interface on: 'line' do: [:buffer | self eval: buffer].\x0a\x09interface on: 'close' do: [self close].\x0a\x09self setPrompt.\x0a\x09interface prompt", messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "eval:", "close", "setPrompt", "prompt"], referencedClasses: [] }), smalltalk.Repl); smalltalk.addMethod( smalltalk.method({ selector: "eval:", category: 'actions', fn: function (buffer){ var self=this; var result; function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)} function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)} function $ErrorHandler(){return smalltalk.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)} return smalltalk.withContext(function($ctx1) { var $1,$2; $1=_st(buffer)._isEmpty(); if(! smalltalk.assert($1)){ _st(self)._try_catch_((function(){ return smalltalk.withContext(function($ctx2) { result=_st(_st($Compiler())._new())._evaluateExpression_(buffer); result; return _st($Transcript())._show_(result); }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(e){ return smalltalk.withContext(function($ctx2) { $2=_st(e)._isSmalltalkError(); if(smalltalk.assert($2)){ return _st(_st($ErrorHandler())._new())._handleError_(e); } else { return _st(_st(process)._stdout())._write_(_st(e)._jsStack()); }; }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1)})})); }; _st(self["@interface"])._prompt(); return self}, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer,result:result},smalltalk.Repl)})}, args: ["buffer"], source: "eval: buffer\x0a\x09| result |\x0a\x09buffer isEmpty ifFalse: [\x0a\x09\x09self try: [\x0a\x09\x09\x09result := Compiler new evaluateExpression: buffer.\x0a\x09\x09\x09Transcript show: result]\x0a\x09\x09catch: [:e |\x0a\x09\x09\x09e isSmalltalkError\x0a\x09\x09\x09 ifTrue: [ErrorHandler new handleError: e]\x0a\x09\x09\x09 ifFalse: [process stdout write: e jsStack]]].\x0a\x09interface prompt", messageSends: ["ifFalse:", "try:catch:", "evaluateExpression:", "new", "show:", "ifTrue:ifFalse:", "handleError:", "write:", "jsStack", "stdout", "isSmalltalkError", "isEmpty", "prompt"], referencedClasses: ["Compiler", "Transcript", "ErrorHandler"] }), smalltalk.Repl); smalltalk.addMethod( smalltalk.method({ selector: "initialize", category: 'initialization', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []); self["@readline"]=_st(require)._value_("readline"); self["@util"]=_st(require)._value_("util"); return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Repl)})}, args: [], source: "initialize\x0a\x09super initialize.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'", messageSends: ["initialize", "value:"], referencedClasses: [] }), smalltalk.Repl); smalltalk.addMethod( smalltalk.method({ selector: "prompt", category: 'accessing', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { return "amber >> "; }, function($ctx1) {$ctx1.fill(self,"prompt",{},smalltalk.Repl)})}, args: [], source: "prompt\x0a\x09^'amber >> '", messageSends: [], referencedClasses: [] }), smalltalk.Repl); smalltalk.addMethod( smalltalk.method({ selector: "setPrompt", category: 'actions', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self["@interface"])._setPrompt_(_st(self)._prompt()); return self}, function($ctx1) {$ctx1.fill(self,"setPrompt",{},smalltalk.Repl)})}, args: [], source: "setPrompt\x0a\x09interface setPrompt: self prompt", messageSends: ["setPrompt:", "prompt"], referencedClasses: [] }), smalltalk.Repl); smalltalk.addMethod( smalltalk.method({ selector: "main", category: 'not yet classified', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { _st(_st(self)._new())._createInterface(); return self}, function($ctx1) {$ctx1.fill(self,"main",{},smalltalk.Repl.klass)})}, args: [], source: "main\x0a\x09self new createInterface", messageSends: ["createInterface", "new"], referencedClasses: [] }), smalltalk.Repl.klass); (function () { var inBrowser = typeof amber !== "undefined" && typeof amber.load === "function"; function init() { smalltalk.initialize(); /* Similar to jQuery(document).ready() */ if (inBrowser && amber.smalltalkReady) { amber.smalltalkReady(); } } if (inBrowser) { // init is lengthy process done in JavaScript. // setTimeout here postpones it, so DOM ready // event can occur sooner, thus load process // may appear optically faster. setTimeout(init, 0); } else { // In certain configurations, setTimeout is not feasible. // It is mainly for `amberc`-produced concatenated // node.js programs. There, the actual "main" appears // immediately after init, so it must happens synchronously. init(); } })();smalltalk.AmberCli._main()