UNPKG

amber

Version:

An implementation of the Smalltalk language that runs on top of the JS runtime.

1,378 lines (1,303 loc) 156 kB
define(["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects", "amber_core/Kernel-Promises"], function($boot){"use strict"; if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver; var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals; $core.addPackage("Kernel-Infrastructure"); ($core.packageDescriptors||$core.packages)["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); }; ($core.packageDescriptors||$core.packages)["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"}; $core.addClass("AmberBootstrapInitialization", $globals.Object, [], "Kernel-Infrastructure"); $core.addMethod( $core.method({ selector: "organizeClasses", protocol: "organization", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv($recv($globals.Smalltalk)._classes())._do_((function(each){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); return $recv(each)._enterOrganization(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); //>>excludeEnd("ctx"); })); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"organizeClasses",{},$globals.AmberBootstrapInitialization.a$cls)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "organizeClasses\x0a\x09Smalltalk classes do: [ :each | each enterOrganization ]", referencedClasses: ["Smalltalk"], //>>excludeEnd("ide"); messageSends: ["do:", "classes", "enterOrganization"] }), $globals.AmberBootstrapInitialization.a$cls); $core.addMethod( $core.method({ selector: "organizeMethods", protocol: "organization", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv($recv($globals.Smalltalk)._classes())._do_((function(eachClass){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); return $recv($recv(eachClass)._definedMethods())._do_((function(eachMethod){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx3) { //>>excludeEnd("ctx"); return $recv($recv(eachMethod)._methodClass())._methodOrganizationEnter_andLeave_(eachMethod,nil); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx3) {$ctx3.fillBlock({eachMethod:eachMethod},$ctx2,2)}); //>>excludeEnd("ctx"); })); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({eachClass:eachClass},$ctx1,1)}); //>>excludeEnd("ctx"); })); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["do:"]=1; //>>excludeEnd("ctx"); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"organizeMethods",{},$globals.AmberBootstrapInitialization.a$cls)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "organizeMethods\x0a\x09Smalltalk classes do: [ :eachClass |\x0a\x09\x09eachClass definedMethods do: [ :eachMethod |\x0a\x09\x09\x09eachMethod methodClass methodOrganizationEnter: eachMethod andLeave: nil ] ]", referencedClasses: ["Smalltalk"], //>>excludeEnd("ide"); messageSends: ["do:", "classes", "definedMethods", "methodOrganizationEnter:andLeave:", "methodClass"] }), $globals.AmberBootstrapInitialization.a$cls); $core.addMethod( $core.method({ selector: "run", protocol: "public api", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv($globals.SmalltalkImage)._initialize(); $self._organizeClasses(); $self._organizeMethods(); $recv($globals.Smalltalk)._postLoad(); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.AmberBootstrapInitialization.a$cls)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "run\x0a\x09SmalltalkImage initialize.\x0a\x09self\x0a\x09\x09organizeClasses;\x0a\x09\x09organizeMethods.\x0a\x09Smalltalk postLoad", referencedClasses: ["SmalltalkImage", "Smalltalk"], //>>excludeEnd("ide"); messageSends: ["initialize", "organizeClasses", "organizeMethods", "postLoad"] }), $globals.AmberBootstrapInitialization.a$cls); $core.addClass("JSObjectProxy", $globals.ProtoObject, ["jsObject"], "Kernel-Infrastructure"); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.JSObjectProxy.comment="I handle sending messages to JavaScript objects, making JavaScript object accessing from Amber fully transparent.\x0aMy instances make intensive use of `#doesNotUnderstand:`.\x0a\x0aMy instances are automatically created by Amber whenever a message is sent to a JavaScript object.\x0a\x0a## Usage 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\x0aAmber 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`."; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "=", protocol: "comparing", fn: function (anObject){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $2,$1; $2=$recv(anObject)._class(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["class"]=1; //>>excludeEnd("ctx"); $1=$recv($2).__eq_eq($self._class()); if(!$core.assert($1)){ return false; } return $recv($globals.JSObjectProxy)._compareJSObjectOfProxy_withProxy_(self,anObject); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject", referencedClasses: ["JSObjectProxy"], //>>excludeEnd("ide"); messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"] }), $globals.JSObjectProxy); $core.addMethod( $core.method({ selector: "asJavaScriptObject", protocol: "converting", fn: function (){ var self=this,$self=this; return $self["@jsObject"]; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asJavaScriptObject\x0a\x09\x22Answers the receiver in a stringify-friendly fashion\x22\x0a\x0a\x09^ jsObject", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.JSObjectProxy); $core.addMethod( $core.method({ selector: "at:", protocol: "accessing", fn: function (aString){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); return $self['@jsObject'][aString]; return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "at: aString\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString]'>", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.JSObjectProxy); $core.addMethod( $core.method({ selector: "at:ifAbsent:", protocol: "accessing", fn: function (aString,aBlock){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var obj = $self['@jsObject']; return aString in obj ? obj[aString] : aBlock._value(); ; return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); 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<inlineJS: '\x0a\x09\x09var obj = $self[''@jsObject''];\x0a\x09\x09return aString in obj ? obj[aString] : aBlock._value();\x0a\x09'>", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.JSObjectProxy); $core.addMethod( $core.method({ selector: "at:ifPresent:", protocol: "accessing", fn: function (aString,aBlock){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var obj = $self['@jsObject']; return aString in obj ? aBlock._value_(obj[aString]) : nil; ; return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); 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<inlineJS: '\x0a\x09\x09var obj = $self[''@jsObject''];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : nil;\x0a\x09'>", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.JSObjectProxy); $core.addMethod( $core.method({ selector: "at:ifPresent:ifAbsent:", protocol: "accessing", fn: function (aString,aBlock,anotherBlock){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var obj = $self['@jsObject']; return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value(); ; return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); 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<inlineJS: '\x0a\x09\x09var obj = $self[''@jsObject''];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();\x0a\x09'>", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.JSObjectProxy); $core.addMethod( $core.method({ selector: "at:put:", protocol: "accessing", fn: function (aString,anObject){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); return $self['@jsObject'][aString] = anObject; return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "anObject"], source: "at: aString put: anObject\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString] = anObject'>", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.JSObjectProxy); $core.addMethod( $core.method({ selector: "catch:", protocol: "promises", fn: function (aBlock){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1,$2; $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then")); if($core.assert($1)){ return $recv($recv($globals.TThenable).__gt_gt("catch:"))._sendTo_arguments_($self["@jsObject"],[aBlock]); } else { $2=( //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, //>>excludeEnd("ctx"); ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._catch_.apply($self, [aBlock])); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; //>>excludeEnd("ctx");; return $2; } return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.JSObjectProxy)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "catch: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #catch:) sendTo: jsObject arguments: {aBlock} ]\x0a\x09ifFalse: [ ^ super catch: aBlock ]", referencedClasses: ["NativeFunction", "TThenable"], //>>excludeEnd("ide"); messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "catch:"] }), $globals.JSObjectProxy); $core.addMethod( $core.method({ selector: "doesNotUnderstand:", protocol: "proxy", fn: function (aMessage){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1,$receiver; $1=$recv($globals.JSObjectProxy)._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self); if(($receiver = $1) == null || $receiver.a$nil){ return ( //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, //>>excludeEnd("ctx"); ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($self, [aMessage])); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; //>>excludeEnd("ctx");; } else { var jsSelector; jsSelector=$receiver; return $recv($globals.JSObjectProxy)._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self); } //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aMessage"], source: "doesNotUnderstand: aMessage\x0a\x09^ (JSObjectProxy lookupProperty: aMessage selector asJavaScriptPropertyName ofProxy: self)\x0a\x09\x09ifNil: [ super doesNotUnderstand: aMessage ]\x0a\x09\x09ifNotNil: [ :jsSelector | \x0a\x09\x09\x09JSObjectProxy \x0a\x09\x09\x09\x09forwardMessage: jsSelector \x0a\x09\x09\x09\x09withArguments: aMessage arguments\x0a\x09\x09\x09\x09ofProxy: self ]", referencedClasses: ["JSObjectProxy"], //>>excludeEnd("ide"); messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"] }), $globals.JSObjectProxy); $core.addMethod( $core.method({ selector: "in:", protocol: "accessing", fn: function (aValuable){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); return $recv(aValuable)._value_($self["@jsObject"]); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aValuable"], source: "in: aValuable\x0a\x09^ aValuable value: jsObject", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["value:"] }), $globals.JSObjectProxy); $core.addMethod( $core.method({ selector: "jsObject", protocol: "accessing", fn: function (){ var self=this,$self=this; return $self["@jsObject"]; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "jsObject\x0a\x09^ jsObject", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.JSObjectProxy); $core.addMethod( $core.method({ selector: "keysAndValuesDo:", protocol: "enumerating", fn: function (aBlock){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var o = $self['@jsObject']; for(var i in o) { aBlock._value_value_(i, o[i]); } ; return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "keysAndValuesDo: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var o = $self[''@jsObject''];\x0a\x09\x09for(var i in o) {\x0a\x09\x09\x09aBlock._value_value_(i, o[i]);\x0a\x09\x09}\x0a\x09'>", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.JSObjectProxy); $core.addMethod( $core.method({ selector: "on:do:", protocol: "promises", fn: function (aClass,aBlock){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1,$2; $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then")); if($core.assert($1)){ return $recv($recv($globals.TThenable).__gt_gt("on:do:"))._sendTo_arguments_($self["@jsObject"],[aClass,aBlock]); } else { $2=( //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, //>>excludeEnd("ctx"); ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._on_do_.apply($self, [aClass,aBlock])); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; //>>excludeEnd("ctx");; return $2; } return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass", "aBlock"], source: "on: aClass do: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #on:do:) sendTo: jsObject arguments: {aClass. aBlock} ]\x0a\x09ifFalse: [ ^ super on: aClass do: aBlock ]", referencedClasses: ["NativeFunction", "TThenable"], //>>excludeEnd("ide"); messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "on:do:"] }), $globals.JSObjectProxy); $core.addMethod( $core.method({ selector: "printOn:", protocol: "printing", fn: function (aStream){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv(aStream)._nextPutAll_($self._printString()); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aStream"], source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["nextPutAll:", "printString"] }), $globals.JSObjectProxy); $core.addMethod( $core.method({ selector: "printString", protocol: "printing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var js = $self['@jsObject']; return js.toString ? js.toString() : Object.prototype.toString.call(js) ; return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "printString\x0a\x09<inlineJS: '\x0a\x09\x09var js = $self[''@jsObject''];\x0a\x09\x09return js.toString\x0a\x09\x09\x09? js.toString()\x0a\x09\x09\x09: Object.prototype.toString.call(js)\x0a\x09'>", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.JSObjectProxy); $core.addMethod( $core.method({ selector: "putOn:", protocol: "streaming", fn: function (aStream){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv(aStream)._nextPutJSObject_($self["@jsObject"]); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aStream"], source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["nextPutJSObject:"] }), $globals.JSObjectProxy); $core.addMethod( $core.method({ selector: "removeKey:", protocol: "accessing", fn: function (aString){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); delete $self['@jsObject'][aString]; return aString; return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aString:aString},$globals.JSObjectProxy)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "removeKey: aString\x0a\x09<inlineJS: 'delete $self[''@jsObject''][aString]; return aString'>", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.JSObjectProxy); $core.addMethod( $core.method({ selector: "then:", protocol: "promises", fn: function (aBlockOrArray){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1,$2; $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then")); if($core.assert($1)){ return $recv($recv($globals.TThenable).__gt_gt("then:"))._sendTo_arguments_($self["@jsObject"],[aBlockOrArray]); } else { $2=( //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, //>>excludeEnd("ctx"); ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._then_.apply($self, [aBlockOrArray])); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; //>>excludeEnd("ctx");; return $2; } return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.JSObjectProxy)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlockOrArray"], source: "then: aBlockOrArray\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #then:) sendTo: jsObject arguments: {aBlockOrArray} ]\x0a\x09ifFalse: [ ^ super then: aBlockOrArray ]", referencedClasses: ["NativeFunction", "TThenable"], //>>excludeEnd("ide"); messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "then:"] }), $globals.JSObjectProxy); $core.addMethod( $core.method({ selector: "addObjectVariablesTo:ofProxy:", protocol: "proxy", fn: function (aDictionary,aProxy){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var jsObject = aProxy['@jsObject']; for(var i in jsObject) { aDictionary._at_put_(i, jsObject[i]); } ; return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.a$cls)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aDictionary", "aProxy"], source: "addObjectVariablesTo: aDictionary ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09var jsObject = aProxy[''@jsObject''];\x0a\x09\x09for(var i in jsObject) {\x0a\x09\x09\x09aDictionary._at_put_(i, jsObject[i]);\x0a\x09\x09}\x0a\x09'>", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.JSObjectProxy.a$cls); $core.addMethod( $core.method({ selector: "compareJSObjectOfProxy:withProxy:", protocol: "proxy", fn: function (aProxy,anotherProxy){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var anotherJSObject = anotherProxy.a$cls ? anotherProxy["@jsObject"] : anotherProxy; return aProxy["@jsObject"] === anotherJSObject; return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.a$cls)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aProxy", "anotherProxy"], source: "compareJSObjectOfProxy: aProxy withProxy: anotherProxy\x0a<inlineJS: '\x0a\x09var anotherJSObject = anotherProxy.a$cls ? anotherProxy[\x22@jsObject\x22] : anotherProxy;\x0a\x09return aProxy[\x22@jsObject\x22] === anotherJSObject\x0a'>", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.JSObjectProxy.a$cls); $core.addMethod( $core.method({ selector: "forwardMessage:withArguments:ofProxy:", protocol: "proxy", fn: function (aString,anArray,aProxy){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); return $core.accessJavaScript(aProxy._jsObject(), aString, anArray); ; return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.a$cls)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "anArray", "aProxy"], source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09'>", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.JSObjectProxy.a$cls); $core.addMethod( $core.method({ selector: "jsObject:ofProxy:", protocol: "proxy", fn: function (aJSObject,aProxy){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); aProxy['@jsObject'] = aJSObject; return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.a$cls)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aJSObject", "aProxy"], source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<inlineJS: 'aProxy[''@jsObject''] = aJSObject'>", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.JSObjectProxy.a$cls); $core.addMethod( $core.method({ selector: "lookupProperty:ofProxy:", protocol: "proxy", fn: function (aString,aProxy){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); return aString in aProxy._jsObject() ? aString : nil; return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.a$cls)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "aProxy"], source: "lookupProperty: aString ofProxy: aProxy\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<inlineJS: 'return aString in aProxy._jsObject() ? aString : nil'>", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.JSObjectProxy.a$cls); $core.addMethod( $core.method({ selector: "null", protocol: "accessing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); return null; return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"null",{},$globals.JSObjectProxy.a$cls)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "null\x0a\x09<inlineJS: 'return null'>", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.JSObjectProxy.a$cls); $core.addMethod( $core.method({ selector: "on:", protocol: "instance creation", fn: function (aJSObject){ var self=this,$self=this; var instance; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); instance=$self._new(); $self._jsObject_ofProxy_(aJSObject,instance); return instance; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.a$cls)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aJSObject"], source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["new", "jsObject:ofProxy:"] }), $globals.JSObjectProxy.a$cls); $core.addMethod( $core.method({ selector: "undefined", protocol: "accessing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); return undefined; return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"undefined",{},$globals.JSObjectProxy.a$cls)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "undefined\x0a\x09<inlineJS: 'return undefined'>", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.JSObjectProxy.a$cls); $core.addClass("Organizer", $globals.Object, ["elements"], "Kernel-Infrastructure"); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances."; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "addElement:", protocol: "accessing", fn: function (anObject){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv($self._elements())._add_(anObject); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "addElement: anObject\x0a\x09self elements add: anObject", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["add:", "elements"] }), $globals.Organizer); $core.addMethod( $core.method({ selector: "elements", protocol: "accessing", fn: function (){ var self=this,$self=this; return $self["@elements"]; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "elements\x0a\x09^ elements", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.Organizer); $core.addMethod( $core.method({ selector: "initialize", protocol: "initialization", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); ( //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, //>>excludeEnd("ctx"); ($globals.Organizer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, [])); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; //>>excludeEnd("ctx");; $self["@elements"]=$recv($globals.Set)._new(); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Organizer)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "initialize\x0a\x09super initialize.\x0a\x09elements := Set new", referencedClasses: ["Set"], //>>excludeEnd("ide"); messageSends: ["initialize", "new"] }), $globals.Organizer); $core.addMethod( $core.method({ selector: "removeElement:", protocol: "accessing", fn: function (anObject){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv($self._elements())._remove_ifAbsent_(anObject,(function(){ })); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "removeElement: anObject\x0a\x09self elements remove: anObject ifAbsent: []", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["remove:ifAbsent:", "elements"] }), $globals.Organizer); $core.addClass("ClassOrganizer", $globals.Organizer, ["traitOrBehavior"], "Kernel-Infrastructure"); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes."; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "addElement:", protocol: "accessing", fn: function (aString){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1,$3,$2; ( //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, //>>excludeEnd("ctx"); ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._addElement_.apply($self, [aString])); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; //>>excludeEnd("ctx");; $1=$recv($globals.SystemAnnouncer)._current(); $3=$recv($globals.ProtocolAdded)._new(); $recv($3)._protocol_(aString); $recv($3)._theClass_($self._theClass()); $2=$recv($3)._yourself(); $recv($1)._announce_($2); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); 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)", referencedClasses: ["SystemAnnouncer", "ProtocolAdded"], //>>excludeEnd("ide"); messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"] }), $globals.ClassOrganizer); $core.addMethod( $core.method({ selector: "removeElement:", protocol: "accessing", fn: function (aString){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1,$3,$2; ( //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, //>>excludeEnd("ctx"); ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._removeElement_.apply($self, [aString])); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; //>>excludeEnd("ctx");; $1=$recv($globals.SystemAnnouncer)._current(); $3=$recv($globals.ProtocolRemoved)._new(); $recv($3)._protocol_(aString); $recv($3)._theClass_($self._theClass()); $2=$recv($3)._yourself(); $recv($1)._announce_($2); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); 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)", referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"], //>>excludeEnd("ide"); messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"] }), $globals.ClassOrganizer); $core.addMethod( $core.method({ selector: "theClass", protocol: "accessing", fn: function (){ var self=this,$self=this; return $self["@traitOrBehavior"]; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "theClass\x0a\x09^ traitOrBehavior", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.ClassOrganizer); $core.addMethod( $core.method({ selector: "theClass:", protocol: "accessing", fn: function (aClass){ var self=this,$self=this; $self["@traitOrBehavior"]=aClass; return self; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass"], source: "theClass: aClass\x0a\x09traitOrBehavior := aClass", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.ClassOrganizer); $core.addMethod( $core.method({ selector: "on:", protocol: "instance creation", fn: function (aClass){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1; $1=$self._new(); $recv($1)._theClass_(aClass); return $recv($1)._yourself(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.ClassOrganizer.a$cls)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aClass"], source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["theClass:", "new", "yourself"] }), $globals.ClassOrganizer.a$cls); $core.addClass("PackageOrganizer", $globals.Organizer, [], "Kernel-Infrastructure"); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information."; //>>excludeEnd("ide"); $core.addClass("Package", $globals.Object, ["evalBlock", "basicTransport", "name", "transport", "imports", "dirty", "organization"], "Kernel-Infrastructure"); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.Package.comment="I am 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\x0aEach package has a name and can be queried for its classes, but it will then resort to a reverse scan of all classes to find them.\x0a\x0a## API\x0a\x0aPackages are manipulated through \x22Smalltalk current\x22, like for example finding one based on a name or with `Package class >> #name` directly:\x0a\x0a Smalltalk current packageAt: 'Kernel'\x0a Package 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 can 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.\x0a\x0aYou can fetch a package from the server:\x0a\x0a\x09Package load: 'Additional-Examples'"; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "basicTransport", protocol: "private", fn: function (){ var self=this,$self=this; return $self["@basicTransport"]; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09^ basicTransport", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.Package); $core.addMethod( $core.method({ selector: "beClean", protocol: "accessing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1,$3,$2; $self["@dirty"]=false; $1=$recv($globals.SystemAnnouncer)._current(); $3=$recv($globals.PackageClean)._new(); $recv($3)._package_(self); $2=$recv($3)._yourself(); $recv($1)._announce_($2); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)", referencedClasses: ["SystemAnnouncer", "PackageClean"], //>>excludeEnd("ide"); messageSends: ["announce:", "current", "package:", "new", "yourself"] }), $globals.Package); $core.addMethod( $core.method({ selector: "beDirty", protocol: "accessing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1,$3,$2; $self["@dirty"]=true; $1=$recv($globals.SystemAnnouncer)._current(); $3=$recv($globals.PackageDirty)._new(); $recv($3)._package_(self); $2=$recv($3)._yourself(); $recv($1)._announce_($2); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)", referencedClasses: ["SystemAnnouncer", "PackageDirty"], //>>excludeEnd("ide"); messageSends: ["announce:", "current", "package:", "new", "yourself"] }), $globals.Package); $core.addMethod( $core.method({ selector: "classTemplate", protocol: "accessing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); return $recv($globals.String)._streamContents_((function(stream){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); $recv(stream)._write_("Object subclass: #NameOfSubclass"); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["write:"]=1; //>>excludeEnd("ctx"); $recv(stream)._lf(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["lf"]=1; //>>excludeEnd("ctx"); $recv(stream)._tab(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["tab"]=1; //>>excludeEnd("ctx"); $recv(stream)._write_("instanceVariableNames: ''"); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["write:"]=2; //>>excludeEnd("ctx"); $recv(stream)._lf(); $recv(stream)._tab(); $recv(stream)._write_("package: "); return $recv(stream)._print_($self._name()); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)}); //>>excludeEnd("ctx"); })); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "classTemplate\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09write: 'Object subclass: #NameOfSubclass'; lf;\x0a\x09\x09tab; write: 'instanceVariableNames: '''''; lf;\x0a\x09\x09tab; write: 'package: '; print: self name ]", referencedClasses: ["String"], //>>excludeEnd("ide"); messageSends: ["streamContents:", "write:", "lf", "tab", "print:", "name"] }), $globals.Package); $core.addMethod( $core.method({ selector: "classes", protocol: "classes", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); return $recv($recv($self._organization())._elements())._copy(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "classes\x0a\x09^ self organization elements copy", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["copy", "elements", "organization"] }), $globals.Package); $core.addMethod( $core.method({ selector: "definition", protocol: "accessing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1; return $recv($globals.String)._streamContents_((function(stream){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); $1=$recv($self._class())._name(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["name"]=1; //>>excludeEnd("ctx"); $recv(stream)._write_($1); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["write:"]=1; //>>excludeEnd("ctx"); $recv(stream)._lf(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["lf"]=1; //>>excludeEnd("ctx"); $recv(stream)._tab(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["tab"]=1; //>>excludeEnd("ctx"); $recv(stream)._write_("named: "); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["write:"]=2; //>>excludeEnd("ctx"); $recv(stream)._print_($self._name()); $recv(stream)._lf(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["lf"]=2; //>>excludeEnd("ctx"); $recv(stream)._tab(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["tab"]=2; //>>excludeEnd("ctx"); $recv(stream)._write_(["imports: ",$self._importsDefinition()]); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["write:"]=3; //>>excludeEnd("ctx"); $recv(stream)._lf(); $recv(stream)._tab(); return $recv(stream)._write_(["transport: (",$recv($self._transport())._definition(),")"]); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)}); //>>excludeEnd("ctx"); })); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09write: self class name; lf;\x0a\x09\x09tab; write: 'named: '; print: self name; lf;\x0a\x09\x09tab; write: { 'imports: '. self importsDefinition }; lf;\x0a\x09\x09tab; write: { 'transport: ('. self transport definition. ')' } ]", referencedClasses: ["String"], //>>excludeEnd("ide"); messageSends: ["streamContents:", "write:", "name", "class", "lf", "tab", "print:", "importsDefinition", "definition", "transport"] }), $globals.Package); $core.addMethod( $core.method({ selector: "eval:", protocol: "evaluating", fn: function (aString){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1,$receiver; $1=$self["@evalBlock"]; if(($receiver = $1) == null || $receiver.a$nil){ return $recv($globals.Compiler)._eval_(aString); } else { return $recv($self["@evalBlock"])._value_(aString); } //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Package)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "eval: aString\x0a\x09^ evalBlock\x0a\x09\x09ifNotNil: [ evalBlock value: aString ]\x0a\x09\x09ifNil: [ Compiler eval: aString ]", referencedClasses: ["Compiler"], //>>excludeEnd("ide"); messageSends: ["ifNotNil:ifNil:", "value:", "eval:"] }), $globals.Package); $core.addMethod( $core.method({ selector: "evalBlock", protocol: "accessing", fn: function (){ var self=this,$self=this; return $self["@evalBlock"]; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "evalBlock\x0a\x09^ evalBlock", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.Package); $core.addMethod( $core.method({ selector: "evalBlock:", protocol: "accessing", fn: function (aBlock){ var self=this,$self=this; $self["@evalBlock"]=aBlock; return self; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "evalBlock: aBlock\x0a\x09evalBlock := aBlock", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.Package); $core.addMethod( $core.method({ selector: "imports", protocol: "accessing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); v