|
@@ -2,1425 +2,1132 @@ define("amber_core/Kernel-Infrastructure", ["amber_vm/smalltalk", "amber_vm/nil"
|
|
smalltalk.addPackage('Kernel-Infrastructure');
|
|
smalltalk.addPackage('Kernel-Infrastructure');
|
|
smalltalk.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
|
|
smalltalk.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
|
|
|
|
|
|
-smalltalk.addClass('AbstractProxy', smalltalk.ProtoObject, [], 'Kernel-Infrastructure');
|
|
|
|
-smalltalk.AbstractProxy.comment="I provide a basic set of methods for proxies handling `#doesNotUnderstand:` so that inspectors, debuggers, etc. won't fail.";
|
|
|
|
|
|
+smalltalk.addClass('InspectorHandler', smalltalk.Object, [], 'Kernel-Infrastructure');
|
|
|
|
+smalltalk.InspectorHandler.comment="I am responsible for inspecting object.\x0a\x0aMy class-side `inspector` inst var holds the current inspector I'm delegating object inspection to.\x0a\x0aThe default inspector object is the transcript.";
|
|
|
|
+
|
|
|
|
+smalltalk.InspectorHandler.klass.iVarNames = ['inspector'];
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "asString",
|
|
|
|
-category: 'converting',
|
|
|
|
-fn: function (){
|
|
|
|
|
|
+selector: "inspect:",
|
|
|
|
+category: 'registration',
|
|
|
|
+fn: function (anObject){
|
|
var self=this;
|
|
var self=this;
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
var $1;
|
|
var $1;
|
|
-$1=self._printString();
|
|
|
|
|
|
+$1=_st(self._inspector())._inspect_(anObject);
|
|
return $1;
|
|
return $1;
|
|
-}, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.AbstractProxy)})},
|
|
|
|
-args: [],
|
|
|
|
-source: "asString\x0a\x09^ self printString",
|
|
|
|
-messageSends: ["printString"],
|
|
|
|
-referencedClasses: []
|
|
|
|
-}),
|
|
|
|
-smalltalk.AbstractProxy);
|
|
|
|
-
|
|
|
|
-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.AbstractProxy)})},
|
|
|
|
-args: [],
|
|
|
|
-source: "class\x0a\x09<return self.klass>",
|
|
|
|
-messageSends: [],
|
|
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},smalltalk.InspectorHandler.klass)})},
|
|
|
|
+args: ["anObject"],
|
|
|
|
+source: "inspect: anObject\x0a\x09^ self inspector inspect: anObject",
|
|
|
|
+messageSends: ["inspect:", "inspector"],
|
|
referencedClasses: []
|
|
referencedClasses: []
|
|
}),
|
|
}),
|
|
-smalltalk.AbstractProxy);
|
|
|
|
-
|
|
|
|
-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.AbstractProxy)})},
|
|
|
|
-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.AbstractProxy);
|
|
|
|
|
|
+smalltalk.InspectorHandler.klass);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "identityHash",
|
|
|
|
|
|
+selector: "inspector",
|
|
category: 'accessing',
|
|
category: 'accessing',
|
|
fn: function (){
|
|
fn: function (){
|
|
var self=this;
|
|
var self=this;
|
|
|
|
+function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
|
|
return smalltalk.withContext(function($ctx1) {
|
|
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.AbstractProxy)})},
|
|
|
|
|
|
+var $2,$1;
|
|
|
|
+$2=self["@inspector"];
|
|
|
|
+if(($receiver = $2) == nil || $receiver == null){
|
|
|
|
+self["@inspector"]=$Transcript();
|
|
|
|
+$1=self["@inspector"];
|
|
|
|
+} else {
|
|
|
|
+$1=$2;
|
|
|
|
+};
|
|
|
|
+return $1;
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"inspector",{},smalltalk.InspectorHandler.klass)})},
|
|
args: [],
|
|
args: [],
|
|
-source: "identityHash\x0a\x09<\x0a\x09\x09var hash=self.identityHash;\x0a\x09\x09if (hash) return hash;\x0a\x09\x09hash=smalltalk.nextId();\x0a\x09\x09Object.defineProperty(self, 'identityHash', {value:hash});\x0a\x09\x09return hash;\x0a\x09>",
|
|
|
|
-messageSends: [],
|
|
|
|
-referencedClasses: []
|
|
|
|
|
|
+source: "inspector\x0a\x09^ inspector ifNil: [ inspector := Transcript ]",
|
|
|
|
+messageSends: ["ifNil:"],
|
|
|
|
+referencedClasses: ["Transcript"]
|
|
}),
|
|
}),
|
|
-smalltalk.AbstractProxy);
|
|
|
|
|
|
+smalltalk.InspectorHandler.klass);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "initialize",
|
|
|
|
-category: 'initialization',
|
|
|
|
-fn: function (){
|
|
|
|
|
|
+selector: "register:",
|
|
|
|
+category: 'registration',
|
|
|
|
+fn: function (anInspector){
|
|
var self=this;
|
|
var self=this;
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.AbstractProxy)})},
|
|
|
|
-args: [],
|
|
|
|
-source: "initialize",
|
|
|
|
|
|
+self["@inspector"]=anInspector;
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"register:",{anInspector:anInspector},smalltalk.InspectorHandler.klass)})},
|
|
|
|
+args: ["anInspector"],
|
|
|
|
+source: "register: anInspector\x0a\x09inspector := anInspector",
|
|
messageSends: [],
|
|
messageSends: [],
|
|
referencedClasses: []
|
|
referencedClasses: []
|
|
}),
|
|
}),
|
|
-smalltalk.AbstractProxy);
|
|
|
|
|
|
+smalltalk.InspectorHandler.klass);
|
|
|
|
|
|
-smalltalk.addMethod(
|
|
|
|
-smalltalk.method({
|
|
|
|
-selector: "inspect",
|
|
|
|
-category: 'inspecting',
|
|
|
|
-fn: function (){
|
|
|
|
-var self=this;
|
|
|
|
-function $InspectorHandler(){return smalltalk.InspectorHandler||(typeof InspectorHandler=="undefined"?nil:InspectorHandler)}
|
|
|
|
-return smalltalk.withContext(function($ctx1) {
|
|
|
|
-_st($InspectorHandler())._inspect_(self);
|
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"inspect",{},smalltalk.AbstractProxy)})},
|
|
|
|
-args: [],
|
|
|
|
-source: "inspect\x0a\x09InspectorHandler inspect: self",
|
|
|
|
-messageSends: ["inspect:"],
|
|
|
|
-referencedClasses: ["InspectorHandler"]
|
|
|
|
-}),
|
|
|
|
-smalltalk.AbstractProxy);
|
|
|
|
|
|
|
|
|
|
+smalltalk.addClass('InterfacingObject', smalltalk.Object, [], 'Kernel-Infrastructure');
|
|
|
|
+smalltalk.InterfacingObject.comment="I am superclass of all object that interface with user or environment. `Widget` and a few other classes are subclasses of me. I delegate all of the above APIs to `PlatformInterface`.\x0a\x0a## API\x0a\x0a self alert: 'Hey, there is a problem'.\x0a self confirm: 'Affirmative?'.\x0a self prompt: 'Your name:'.\x0a\x0a self ajax: #{\x0a 'url' -> '/patch.js'. 'type' -> 'GET'. dataType->'script'\x0a }.";
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "inspectOn:",
|
|
|
|
-category: 'inspecting',
|
|
|
|
-fn: function (anInspector){
|
|
|
|
|
|
+selector: "ajax:",
|
|
|
|
+category: 'actions',
|
|
|
|
+fn: function (anObject){
|
|
var self=this;
|
|
var self=this;
|
|
|
|
+function $PlatformInterface(){return smalltalk.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector},smalltalk.AbstractProxy)})},
|
|
|
|
-args: ["anInspector"],
|
|
|
|
-source: "inspectOn: anInspector",
|
|
|
|
-messageSends: [],
|
|
|
|
-referencedClasses: []
|
|
|
|
|
|
+var $1;
|
|
|
|
+$1=_st($PlatformInterface())._ajax_(anObject);
|
|
|
|
+return $1;
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},smalltalk.InterfacingObject)})},
|
|
|
|
+args: ["anObject"],
|
|
|
|
+source: "ajax: anObject\x0a\x09^ PlatformInterface ajax: anObject",
|
|
|
|
+messageSends: ["ajax:"],
|
|
|
|
+referencedClasses: ["PlatformInterface"]
|
|
}),
|
|
}),
|
|
-smalltalk.AbstractProxy);
|
|
|
|
|
|
+smalltalk.InterfacingObject);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "instVarAt:",
|
|
|
|
-category: 'accessing',
|
|
|
|
|
|
+selector: "alert:",
|
|
|
|
+category: 'actions',
|
|
fn: function (aString){
|
|
fn: function (aString){
|
|
var self=this;
|
|
var self=this;
|
|
|
|
+function $PlatformInterface(){return smalltalk.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
- return self['@'+aString] ;
|
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},smalltalk.AbstractProxy)})},
|
|
|
|
|
|
+var $1;
|
|
|
|
+$1=_st($PlatformInterface())._alert_(aString);
|
|
|
|
+return $1;
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},smalltalk.InterfacingObject)})},
|
|
args: ["aString"],
|
|
args: ["aString"],
|
|
-source: "instVarAt: aString\x0a\x09< return self['@'+aString] >",
|
|
|
|
-messageSends: [],
|
|
|
|
-referencedClasses: []
|
|
|
|
|
|
+source: "alert: aString\x0a\x09^ PlatformInterface alert: aString",
|
|
|
|
+messageSends: ["alert:"],
|
|
|
|
+referencedClasses: ["PlatformInterface"]
|
|
}),
|
|
}),
|
|
-smalltalk.AbstractProxy);
|
|
|
|
|
|
+smalltalk.InterfacingObject);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "instVarAt:put:",
|
|
|
|
-category: 'accessing',
|
|
|
|
-fn: function (aString,anObject){
|
|
|
|
|
|
+selector: "confirm:",
|
|
|
|
+category: 'actions',
|
|
|
|
+fn: function (aString){
|
|
var self=this;
|
|
var self=this;
|
|
|
|
+function $PlatformInterface(){return smalltalk.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
- self['@' + aString] = anObject ;
|
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},smalltalk.AbstractProxy)})},
|
|
|
|
-args: ["aString", "anObject"],
|
|
|
|
-source: "instVarAt: aString put: anObject\x0a\x09< self['@' + aString] = anObject >",
|
|
|
|
-messageSends: [],
|
|
|
|
-referencedClasses: []
|
|
|
|
|
|
+var $1;
|
|
|
|
+$1=_st($PlatformInterface())._confirm_(aString);
|
|
|
|
+return $1;
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},smalltalk.InterfacingObject)})},
|
|
|
|
+args: ["aString"],
|
|
|
|
+source: "confirm: aString\x0a\x09^ PlatformInterface confirm: aString",
|
|
|
|
+messageSends: ["confirm:"],
|
|
|
|
+referencedClasses: ["PlatformInterface"]
|
|
}),
|
|
}),
|
|
-smalltalk.AbstractProxy);
|
|
|
|
|
|
+smalltalk.InterfacingObject);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "perform:",
|
|
|
|
-category: 'message handling',
|
|
|
|
|
|
+selector: "prompt:",
|
|
|
|
+category: 'actions',
|
|
fn: function (aString){
|
|
fn: function (aString){
|
|
var self=this;
|
|
var self=this;
|
|
|
|
+function $PlatformInterface(){return smalltalk.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
var $1;
|
|
var $1;
|
|
-$1=self._perform_withArguments_(aString,[]);
|
|
|
|
|
|
+$1=_st($PlatformInterface())._prompt_(aString);
|
|
return $1;
|
|
return $1;
|
|
-}, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},smalltalk.AbstractProxy)})},
|
|
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},smalltalk.InterfacingObject)})},
|
|
args: ["aString"],
|
|
args: ["aString"],
|
|
-source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
|
|
|
|
-messageSends: ["perform:withArguments:"],
|
|
|
|
-referencedClasses: []
|
|
|
|
|
|
+source: "prompt: aString\x0a\x09^ PlatformInterface prompt: aString",
|
|
|
|
+messageSends: ["prompt:"],
|
|
|
|
+referencedClasses: ["PlatformInterface"]
|
|
}),
|
|
}),
|
|
-smalltalk.AbstractProxy);
|
|
|
|
|
|
+smalltalk.InterfacingObject);
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+smalltalk.addClass('Environment', smalltalk.InterfacingObject, [], 'Kernel-Infrastructure');
|
|
|
|
+smalltalk.Environment.comment="I provide an unified entry point to manipulate Amber packages, classes and methods.\x0a\x0aTypical use cases include IDEs, remote access and restricting browsing.";
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "perform:withArguments:",
|
|
|
|
-category: 'message handling',
|
|
|
|
-fn: function (aString,aCollection){
|
|
|
|
|
|
+selector: "addInstVarNamed:to:",
|
|
|
|
+category: 'compiling',
|
|
|
|
+fn: function (aString,aClass){
|
|
var self=this;
|
|
var self=this;
|
|
return smalltalk.withContext(function($ctx1) {
|
|
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.AbstractProxy)})},
|
|
|
|
-args: ["aString", "aCollection"],
|
|
|
|
-source: "perform: aString withArguments: aCollection\x0a\x09<return smalltalk.send(self, aString._asSelector(), aCollection)>",
|
|
|
|
-messageSends: [],
|
|
|
|
|
|
+var $1,$2,$3,$4,$5;
|
|
|
|
+$1=self._classBuilder();
|
|
|
|
+$2=_st(aClass)._superclass();
|
|
|
|
+$3=_st(aClass)._name();
|
|
|
|
+$ctx1.sendIdx["name"]=1;
|
|
|
|
+$4=_st(_st(aClass)._instanceVariableNames())._copy();
|
|
|
|
+_st($4)._add_(aString);
|
|
|
|
+$5=_st($4)._yourself();
|
|
|
|
+_st($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$5,_st(_st(aClass)._package())._name());
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},smalltalk.Environment)})},
|
|
|
|
+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:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"],
|
|
referencedClasses: []
|
|
referencedClasses: []
|
|
}),
|
|
}),
|
|
-smalltalk.AbstractProxy);
|
|
|
|
|
|
+smalltalk.Environment);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "printOn:",
|
|
|
|
-category: 'printing',
|
|
|
|
-fn: function (aStream){
|
|
|
|
|
|
+selector: "allSelectors",
|
|
|
|
+category: 'accessing',
|
|
|
|
+fn: function (){
|
|
var self=this;
|
|
var self=this;
|
|
|
|
+function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-var $5,$4,$3,$2,$1;
|
|
|
|
-$5=self._class();
|
|
|
|
-$ctx1.sendIdx["class"]=1;
|
|
|
|
-$4=_st($5)._name();
|
|
|
|
-$ctx1.sendIdx["name"]=1;
|
|
|
|
-$3=_st($4)._first();
|
|
|
|
-$2=_st($3)._isVowel();
|
|
|
|
-if(smalltalk.assert($2)){
|
|
|
|
-$1="an ";
|
|
|
|
-} else {
|
|
|
|
-$1="a ";
|
|
|
|
-};
|
|
|
|
-_st(aStream)._nextPutAll_($1);
|
|
|
|
-$ctx1.sendIdx["nextPutAll:"]=1;
|
|
|
|
-_st(aStream)._nextPutAll_(_st(self._class())._name());
|
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.AbstractProxy)})},
|
|
|
|
-args: ["aStream"],
|
|
|
|
-source: "printOn: aStream\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: []
|
|
|
|
|
|
+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.AbstractProxy);
|
|
|
|
|
|
+smalltalk.Environment);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "printString",
|
|
|
|
-category: 'printing',
|
|
|
|
|
|
+selector: "availableClassNames",
|
|
|
|
+category: 'accessing',
|
|
fn: function (){
|
|
fn: function (){
|
|
var self=this;
|
|
var self=this;
|
|
-function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
|
|
|
|
|
|
+function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
var $1;
|
|
var $1;
|
|
-$1=_st($String())._streamContents_((function(str){
|
|
|
|
|
|
+$1=_st(_st(_st($Smalltalk())._current())._classes())._collect_((function(each){
|
|
return smalltalk.withContext(function($ctx2) {
|
|
return smalltalk.withContext(function($ctx2) {
|
|
-return self._printOn_(str);
|
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)})}));
|
|
|
|
|
|
+return _st(each)._name();
|
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
|
|
return $1;
|
|
return $1;
|
|
-}, function($ctx1) {$ctx1.fill(self,"printString",{},smalltalk.AbstractProxy)})},
|
|
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},smalltalk.Environment)})},
|
|
args: [],
|
|
args: [],
|
|
-source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
|
|
|
|
-messageSends: ["streamContents:", "printOn:"],
|
|
|
|
-referencedClasses: ["String"]
|
|
|
|
|
|
+source: "availableClassNames\x0a\x09^ Smalltalk current classes \x0a\x09\x09collect: [ :each | each name ]",
|
|
|
|
+messageSends: ["collect:", "classes", "current", "name"],
|
|
|
|
+referencedClasses: ["Smalltalk"]
|
|
}),
|
|
}),
|
|
-smalltalk.AbstractProxy);
|
|
|
|
|
|
+smalltalk.Environment);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "yourself",
|
|
|
|
|
|
+selector: "availablePackageNames",
|
|
category: 'accessing',
|
|
category: 'accessing',
|
|
fn: function (){
|
|
fn: function (){
|
|
var self=this;
|
|
var self=this;
|
|
|
|
+function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-return self;
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"yourself",{},smalltalk.AbstractProxy)})},
|
|
|
|
|
|
+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,1)})}));
|
|
|
|
+return $1;
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},smalltalk.Environment)})},
|
|
args: [],
|
|
args: [],
|
|
-source: "yourself\x0a\x09^ self",
|
|
|
|
-messageSends: [],
|
|
|
|
-referencedClasses: []
|
|
|
|
|
|
+source: "availablePackageNames\x0a\x09^ Smalltalk current packages \x0a\x09\x09collect: [ :each | each name ]",
|
|
|
|
+messageSends: ["collect:", "packages", "current", "name"],
|
|
|
|
+referencedClasses: ["Smalltalk"]
|
|
}),
|
|
}),
|
|
-smalltalk.AbstractProxy);
|
|
|
|
-
|
|
|
|
|
|
+smalltalk.Environment);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "heliosClass",
|
|
|
|
-category: 'helios',
|
|
|
|
-fn: function (){
|
|
|
|
|
|
+selector: "availableProtocolsFor:",
|
|
|
|
+category: 'accessing',
|
|
|
|
+fn: function (aClass){
|
|
var self=this;
|
|
var self=this;
|
|
|
|
+var protocols;
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-return "class";
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.AbstractProxy.klass)})},
|
|
|
|
-args: [],
|
|
|
|
-source: "heliosClass\x0a\x09^ 'class'",
|
|
|
|
-messageSends: [],
|
|
|
|
|
|
+var $1,$2;
|
|
|
|
+protocols=_st(aClass)._protocols();
|
|
|
|
+$1=_st(aClass)._superclass();
|
|
|
|
+$ctx1.sendIdx["superclass"]=1;
|
|
|
|
+if(($receiver = $1) == nil || $receiver == null){
|
|
|
|
+$1;
|
|
|
|
+} else {
|
|
|
|
+_st(protocols)._addAll_(self._availableProtocolsFor_(_st(aClass)._superclass()));
|
|
|
|
+};
|
|
|
|
+$2=_st(_st(protocols)._asSet())._asArray();
|
|
|
|
+return $2;
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},smalltalk.Environment)})},
|
|
|
|
+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:", "superclass", "addAll:", "availableProtocolsFor:", "asArray", "asSet"],
|
|
referencedClasses: []
|
|
referencedClasses: []
|
|
}),
|
|
}),
|
|
-smalltalk.AbstractProxy.klass);
|
|
|
|
|
|
+smalltalk.Environment);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "initialize",
|
|
|
|
-category: 'initialization',
|
|
|
|
|
|
+selector: "classBuilder",
|
|
|
|
+category: 'accessing',
|
|
fn: function (){
|
|
fn: function (){
|
|
var self=this;
|
|
var self=this;
|
|
|
|
+function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.AbstractProxy.klass)})},
|
|
|
|
|
|
+var $1;
|
|
|
|
+$1=_st($ClassBuilder())._new();
|
|
|
|
+return $1;
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"classBuilder",{},smalltalk.Environment)})},
|
|
args: [],
|
|
args: [],
|
|
-source: "initialize",
|
|
|
|
-messageSends: [],
|
|
|
|
-referencedClasses: []
|
|
|
|
|
|
+source: "classBuilder\x0a\x09^ ClassBuilder new",
|
|
|
|
+messageSends: ["new"],
|
|
|
|
+referencedClasses: ["ClassBuilder"]
|
|
}),
|
|
}),
|
|
-smalltalk.AbstractProxy.klass);
|
|
|
|
-
|
|
|
|
|
|
+smalltalk.Environment);
|
|
|
|
|
|
-smalltalk.addClass('JSObjectProxy', smalltalk.AbstractProxy, ['jsObject'], 'Kernel-Infrastructure');
|
|
|
|
-smalltalk.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`.";
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "addObjectVariablesTo:",
|
|
|
|
-category: 'proxy',
|
|
|
|
-fn: function (aDictionary){
|
|
|
|
|
|
+selector: "classNamed:",
|
|
|
|
+category: 'accessing',
|
|
|
|
+fn: function (aString){
|
|
var self=this;
|
|
var self=this;
|
|
|
|
+function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
|
|
return smalltalk.withContext(function($ctx1) {
|
|
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: []
|
|
|
|
|
|
+var $2,$1;
|
|
|
|
+$2=_st(_st($Smalltalk())._current())._at_(_st(aString)._asSymbol());
|
|
|
|
+if(($receiver = $2) == nil || $receiver == null){
|
|
|
|
+$1=self._error_("Invalid class name");
|
|
|
|
+} else {
|
|
|
|
+$1=$2;
|
|
|
|
+};
|
|
|
|
+return $1;
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},smalltalk.Environment)})},
|
|
|
|
+args: ["aString"],
|
|
|
|
+source: "classNamed: aString\x0a\x09^ (Smalltalk current at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
|
|
|
|
+messageSends: ["ifNil:", "at:", "current", "asSymbol", "error:"],
|
|
|
|
+referencedClasses: ["Smalltalk"]
|
|
}),
|
|
}),
|
|
-smalltalk.JSObjectProxy);
|
|
|
|
|
|
+smalltalk.Environment);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "asJSON",
|
|
|
|
-category: 'enumerating',
|
|
|
|
|
|
+selector: "classes",
|
|
|
|
+category: 'accessing',
|
|
fn: function (){
|
|
fn: function (){
|
|
var self=this;
|
|
var self=this;
|
|
|
|
+function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
var $1;
|
|
var $1;
|
|
-$1=self["@jsObject"];
|
|
|
|
|
|
+$1=_st(_st($Smalltalk())._current())._classes();
|
|
return $1;
|
|
return $1;
|
|
-}, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.JSObjectProxy)})},
|
|
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Environment)})},
|
|
args: [],
|
|
args: [],
|
|
-source: "asJSON\x0a\x09\x22Answers the receiver in a stringyfy-friendly fashion\x22\x0a\x0a\x09^ jsObject",
|
|
|
|
-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<return self['@jsObject'][aString]>",
|
|
|
|
-messageSends: [],
|
|
|
|
-referencedClasses: []
|
|
|
|
|
|
+source: "classes\x0a\x09^ Smalltalk current classes",
|
|
|
|
+messageSends: ["classes", "current"],
|
|
|
|
+referencedClasses: ["Smalltalk"]
|
|
}),
|
|
}),
|
|
-smalltalk.JSObjectProxy);
|
|
|
|
|
|
+smalltalk.Environment);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "at:ifAbsent:",
|
|
|
|
-category: 'accessing',
|
|
|
|
-fn: function (aString,aBlock){
|
|
|
|
|
|
+selector: "commitPackage:",
|
|
|
|
+category: 'actions',
|
|
|
|
+fn: function (aPackage){
|
|
var self=this;
|
|
var self=this;
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-
|
|
|
|
- var obj = self['@jsObject'];
|
|
|
|
- return aString in obj ? obj[aString] : aBlock._value();
|
|
|
|
- ;
|
|
|
|
-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._value();\x0a\x09>",
|
|
|
|
-messageSends: [],
|
|
|
|
|
|
+_st(aPackage)._commit();
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"commitPackage:",{aPackage:aPackage},smalltalk.Environment)})},
|
|
|
|
+args: ["aPackage"],
|
|
|
|
+source: "commitPackage: aPackage\x0a\x09aPackage commit",
|
|
|
|
+messageSends: ["commit"],
|
|
referencedClasses: []
|
|
referencedClasses: []
|
|
}),
|
|
}),
|
|
-smalltalk.JSObjectProxy);
|
|
|
|
|
|
+smalltalk.Environment);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "at:ifPresent:",
|
|
|
|
-category: 'accessing',
|
|
|
|
-fn: function (aString,aBlock){
|
|
|
|
|
|
+selector: "compileClassComment:for:",
|
|
|
|
+category: 'compiling',
|
|
|
|
+fn: function (aString,aClass){
|
|
var self=this;
|
|
var self=this;
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-
|
|
|
|
- var obj = self['@jsObject'];
|
|
|
|
- return aString in obj ? aBlock._value_(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._value_(obj[aString]) : nil;\x0a\x09>",
|
|
|
|
-messageSends: [],
|
|
|
|
|
|
+_st(aClass)._comment_(aString);
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},smalltalk.Environment)})},
|
|
|
|
+args: ["aString", "aClass"],
|
|
|
|
+source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
|
|
|
|
+messageSends: ["comment:"],
|
|
referencedClasses: []
|
|
referencedClasses: []
|
|
}),
|
|
}),
|
|
-smalltalk.JSObjectProxy);
|
|
|
|
|
|
+smalltalk.Environment);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "at:ifPresent:ifAbsent:",
|
|
|
|
-category: 'accessing',
|
|
|
|
-fn: function (aString,aBlock,anotherBlock){
|
|
|
|
|
|
+selector: "compileClassDefinition:",
|
|
|
|
+category: 'compiling',
|
|
|
|
+fn: function (aString){
|
|
var self=this;
|
|
var self=this;
|
|
|
|
+function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-
|
|
|
|
- var obj = self['@jsObject'];
|
|
|
|
- return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
|
|
|
|
- ;
|
|
|
|
-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._value_(obj[aString]) : anotherBlock._value();\x0a\x09>",
|
|
|
|
-messageSends: [],
|
|
|
|
-referencedClasses: []
|
|
|
|
|
|
+self._eval_on_(aString,_st($DoIt())._new());
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},smalltalk.Environment)})},
|
|
|
|
+args: ["aString"],
|
|
|
|
+source: "compileClassDefinition: aString\x0a\x09self eval: aString on: DoIt new",
|
|
|
|
+messageSends: ["eval:on:", "new"],
|
|
|
|
+referencedClasses: ["DoIt"]
|
|
}),
|
|
}),
|
|
-smalltalk.JSObjectProxy);
|
|
|
|
|
|
+smalltalk.Environment);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "at:put:",
|
|
|
|
-category: 'accessing',
|
|
|
|
-fn: function (aString,anObject){
|
|
|
|
|
|
+selector: "compileMethod:for:protocol:",
|
|
|
|
+category: 'compiling',
|
|
|
|
+fn: function (sourceCode,class_,protocol){
|
|
var self=this;
|
|
var self=this;
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-return 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<return self['@jsObject'][aString] = anObject>",
|
|
|
|
-messageSends: [],
|
|
|
|
|
|
+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.Environment)})},
|
|
|
|
+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: []
|
|
referencedClasses: []
|
|
}),
|
|
}),
|
|
-smalltalk.JSObjectProxy);
|
|
|
|
|
|
+smalltalk.Environment);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "doesNotUnderstand:",
|
|
|
|
-category: 'proxy',
|
|
|
|
-fn: function (aMessage){
|
|
|
|
|
|
+selector: "copyClass:to:",
|
|
|
|
+category: 'actions',
|
|
|
|
+fn: function (aClass,aClassName){
|
|
var self=this;
|
|
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) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-var $2,$1;
|
|
|
|
-$2=self._lookupProperty_(_st(_st(aMessage)._selector())._asJavaScriptSelector());
|
|
|
|
-if(($receiver = $2) == nil || $receiver == null){
|
|
|
|
-$1=smalltalk.JSObjectProxy.superclass.fn.prototype._doesNotUnderstand_.apply(_st(self), [aMessage]);
|
|
|
|
|
|
+var $1,$2;
|
|
|
|
+$1=_st(_st($Smalltalk())._current())._at_(aClassName);
|
|
|
|
+if(($receiver = $1) == nil || $receiver == null){
|
|
|
|
+$1;
|
|
} else {
|
|
} else {
|
|
-var jsSelector;
|
|
|
|
-jsSelector=$receiver;
|
|
|
|
-$1=self._forwardMessage_withArguments_(jsSelector,_st(aMessage)._arguments());
|
|
|
|
|
|
+$2=_st("A class named ".__comma(aClassName)).__comma(" already exists");
|
|
|
|
+$ctx1.sendIdx[","]=1;
|
|
|
|
+self._error_($2);
|
|
};
|
|
};
|
|
-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:", "lookupProperty:", "asJavaScriptSelector", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:", "arguments"],
|
|
|
|
-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",self._jsObject());
|
|
|
|
-_st(anInspector)._setLabel_(self._printString());
|
|
|
|
-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"]
|
|
|
|
|
|
+_st(_st($ClassBuilder())._new())._copyClass_named_(aClass,aClassName);
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},smalltalk.Environment)})},
|
|
|
|
+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",
|
|
|
|
+messageSends: ["ifNotNil:", "at:", "current", "error:", ",", "copyClass:named:", "new"],
|
|
|
|
+referencedClasses: ["Smalltalk", "ClassBuilder"]
|
|
}),
|
|
}),
|
|
-smalltalk.JSObjectProxy);
|
|
|
|
|
|
+smalltalk.Environment);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "jsObject",
|
|
|
|
|
|
+selector: "doItReceiver",
|
|
category: 'accessing',
|
|
category: 'accessing',
|
|
fn: function (){
|
|
fn: function (){
|
|
var self=this;
|
|
var self=this;
|
|
|
|
+function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
var $1;
|
|
var $1;
|
|
-$1=self["@jsObject"];
|
|
|
|
|
|
+$1=_st($DoIt())._new();
|
|
return $1;
|
|
return $1;
|
|
-}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxy)})},
|
|
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},smalltalk.Environment)})},
|
|
args: [],
|
|
args: [],
|
|
-source: "jsObject\x0a\x09^ jsObject",
|
|
|
|
-messageSends: [],
|
|
|
|
-referencedClasses: []
|
|
|
|
|
|
+source: "doItReceiver\x0a\x09^ DoIt new",
|
|
|
|
+messageSends: ["new"],
|
|
|
|
+referencedClasses: ["DoIt"]
|
|
}),
|
|
}),
|
|
-smalltalk.JSObjectProxy);
|
|
|
|
|
|
+smalltalk.Environment);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "jsObject:",
|
|
|
|
-category: 'accessing',
|
|
|
|
-fn: function (aJSObject){
|
|
|
|
|
|
+selector: "eval:on:",
|
|
|
|
+category: 'actions',
|
|
|
|
+fn: function (aString,aReceiver){
|
|
var self=this;
|
|
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) {
|
|
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._value_value_(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._value_value_(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<return aString in self._jsObject() ? aString : nil>",
|
|
|
|
-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_(self._printString());
|
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.JSObjectProxy)})},
|
|
|
|
-args: ["aStream"],
|
|
|
|
-source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
|
|
|
|
-messageSends: ["nextPutAll:", "printString"],
|
|
|
|
-referencedClasses: []
|
|
|
|
-}),
|
|
|
|
-smalltalk.JSObjectProxy);
|
|
|
|
-
|
|
|
|
-smalltalk.addMethod(
|
|
|
|
-smalltalk.method({
|
|
|
|
-selector: "printString",
|
|
|
|
-category: 'printing',
|
|
|
|
-fn: function (){
|
|
|
|
-var self=this;
|
|
|
|
-return smalltalk.withContext(function($ctx1) {
|
|
|
|
-
|
|
|
|
- var js = self['@jsObject'];
|
|
|
|
- return js.toString
|
|
|
|
- ? js.toString()
|
|
|
|
- : Object.prototype.toString.call(js)
|
|
|
|
- ;
|
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"printString",{},smalltalk.JSObjectProxy)})},
|
|
|
|
-args: [],
|
|
|
|
-source: "printString\x0a\x09<\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>",
|
|
|
|
-messageSends: [],
|
|
|
|
-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=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: []
|
|
|
|
|
|
+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,1)})}))._on_do_($Error(),(function(ex){
|
|
|
|
+return smalltalk.withContext(function($ctx2) {
|
|
|
|
+$1=self._alert_(_st(ex)._messageText());
|
|
|
|
+throw $early=[$1];
|
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})}));
|
|
|
|
+$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.Environment)})},
|
|
|
|
+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^ self alert: ex messageText ].\x0a\x09^ compiler evaluateExpression: aString on: aReceiver",
|
|
|
|
+messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"],
|
|
|
|
+referencedClasses: ["Compiler", "Error"]
|
|
}),
|
|
}),
|
|
-smalltalk.JSObjectProxy.klass);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-smalltalk.addClass('InspectorHandler', smalltalk.Object, [], 'Kernel-Infrastructure');
|
|
|
|
-smalltalk.InspectorHandler.comment="I am responsible for inspecting object.\x0a\x0aMy class-side `inspector` inst var holds the current inspector I'm delegating object inspection to.\x0a\x0aThe default inspector object is the transcript.";
|
|
|
|
|
|
+smalltalk.Environment);
|
|
|
|
|
|
-smalltalk.InspectorHandler.klass.iVarNames = ['inspector'];
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "inspect:",
|
|
|
|
-category: 'registration',
|
|
|
|
-fn: function (anObject){
|
|
|
|
|
|
+selector: "evaluate:on:do:",
|
|
|
|
+category: 'error handling',
|
|
|
|
+fn: function (aBlock,anErrorClass,exceptionBlock){
|
|
var self=this;
|
|
var self=this;
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
var $1;
|
|
var $1;
|
|
-$1=_st(self._inspector())._inspect_(anObject);
|
|
|
|
-return $1;
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},smalltalk.InspectorHandler.klass)})},
|
|
|
|
-args: ["anObject"],
|
|
|
|
-source: "inspect: anObject\x0a\x09^ self inspector inspect: anObject",
|
|
|
|
-messageSends: ["inspect:", "inspector"],
|
|
|
|
-referencedClasses: []
|
|
|
|
-}),
|
|
|
|
-smalltalk.InspectorHandler.klass);
|
|
|
|
-
|
|
|
|
-smalltalk.addMethod(
|
|
|
|
-smalltalk.method({
|
|
|
|
-selector: "inspector",
|
|
|
|
-category: 'accessing',
|
|
|
|
-fn: function (){
|
|
|
|
-var self=this;
|
|
|
|
-function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
|
|
|
|
-return smalltalk.withContext(function($ctx1) {
|
|
|
|
-var $2,$1;
|
|
|
|
-$2=self["@inspector"];
|
|
|
|
-if(($receiver = $2) == nil || $receiver == null){
|
|
|
|
-self["@inspector"]=$Transcript();
|
|
|
|
-$1=self["@inspector"];
|
|
|
|
|
|
+self._try_catch_(aBlock,(function(exception){
|
|
|
|
+return smalltalk.withContext(function($ctx2) {
|
|
|
|
+$1=_st(exception)._isKindOf_(self._classNamed_(_st(anErrorClass)._name()));
|
|
|
|
+if(smalltalk.assert($1)){
|
|
|
|
+return _st(exceptionBlock)._value_(exception);
|
|
} else {
|
|
} else {
|
|
-$1=$2;
|
|
|
|
|
|
+return _st(exception)._signal();
|
|
};
|
|
};
|
|
-return $1;
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"inspector",{},smalltalk.InspectorHandler.klass)})},
|
|
|
|
-args: [],
|
|
|
|
-source: "inspector\x0a\x09^ inspector ifNil: [ inspector := Transcript ]",
|
|
|
|
-messageSends: ["ifNil:"],
|
|
|
|
-referencedClasses: ["Transcript"]
|
|
|
|
-}),
|
|
|
|
-smalltalk.InspectorHandler.klass);
|
|
|
|
-
|
|
|
|
-smalltalk.addMethod(
|
|
|
|
-smalltalk.method({
|
|
|
|
-selector: "register:",
|
|
|
|
-category: 'registration',
|
|
|
|
-fn: function (anInspector){
|
|
|
|
-var self=this;
|
|
|
|
-return smalltalk.withContext(function($ctx1) {
|
|
|
|
-self["@inspector"]=anInspector;
|
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"register:",{anInspector:anInspector},smalltalk.InspectorHandler.klass)})},
|
|
|
|
-args: ["anInspector"],
|
|
|
|
-source: "register: anInspector\x0a\x09inspector := anInspector",
|
|
|
|
-messageSends: [],
|
|
|
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)})}));
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},smalltalk.Environment)})},
|
|
|
|
+args: ["aBlock", "anErrorClass", "exceptionBlock"],
|
|
|
|
+source: "evaluate: aBlock on: anErrorClass do: exceptionBlock\x0a\x09\x22Evaluate a block and catch exceptions happening on the environment stack\x22\x0a\x09\x0a\x09self try: aBlock catch: [ :exception | \x0a\x09\x09(exception isKindOf: (self classNamed: anErrorClass name))\x0a\x09\x09\x09ifTrue: [ exceptionBlock value: exception ]\x0a \x09\x09\x09ifFalse: [ exception signal ] ]",
|
|
|
|
+messageSends: ["try:catch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "signal"],
|
|
referencedClasses: []
|
|
referencedClasses: []
|
|
}),
|
|
}),
|
|
-smalltalk.InspectorHandler.klass);
|
|
|
|
-
|
|
|
|
|
|
+smalltalk.Environment);
|
|
|
|
|
|
-smalltalk.addClass('InterfacingObject', smalltalk.Object, [], 'Kernel-Infrastructure');
|
|
|
|
-smalltalk.InterfacingObject.comment="I am superclass of all object that interface with user or environment. `Widget` and a few other classes are subclasses of me. I delegate all of the above APIs to `PlatformInterface`.\x0a\x0a## API\x0a\x0a self alert: 'Hey, there is a problem'.\x0a self confirm: 'Affirmative?'.\x0a self prompt: 'Your name:'.\x0a\x0a self ajax: #{\x0a 'url' -> '/patch.js'. 'type' -> 'GET'. dataType->'script'\x0a }.";
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "ajax:",
|
|
|
|
|
|
+selector: "inspect:",
|
|
category: 'actions',
|
|
category: 'actions',
|
|
fn: function (anObject){
|
|
fn: function (anObject){
|
|
var self=this;
|
|
var self=this;
|
|
-function $PlatformInterface(){return smalltalk.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
|
|
|
|
|
|
+function $InspectorHandler(){return smalltalk.InspectorHandler||(typeof InspectorHandler=="undefined"?nil:InspectorHandler)}
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-var $1;
|
|
|
|
-$1=_st($PlatformInterface())._ajax_(anObject);
|
|
|
|
-return $1;
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},smalltalk.InterfacingObject)})},
|
|
|
|
|
|
+_st(_st($InspectorHandler())._inspector())._inspect_(anObject);
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},smalltalk.Environment)})},
|
|
args: ["anObject"],
|
|
args: ["anObject"],
|
|
-source: "ajax: anObject\x0a\x09^ PlatformInterface ajax: anObject",
|
|
|
|
-messageSends: ["ajax:"],
|
|
|
|
-referencedClasses: ["PlatformInterface"]
|
|
|
|
-}),
|
|
|
|
-smalltalk.InterfacingObject);
|
|
|
|
-
|
|
|
|
-smalltalk.addMethod(
|
|
|
|
-smalltalk.method({
|
|
|
|
-selector: "alert:",
|
|
|
|
-category: 'actions',
|
|
|
|
-fn: function (aString){
|
|
|
|
-var self=this;
|
|
|
|
-function $PlatformInterface(){return smalltalk.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
|
|
|
|
-return smalltalk.withContext(function($ctx1) {
|
|
|
|
-var $1;
|
|
|
|
-$1=_st($PlatformInterface())._alert_(aString);
|
|
|
|
-return $1;
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},smalltalk.InterfacingObject)})},
|
|
|
|
-args: ["aString"],
|
|
|
|
-source: "alert: aString\x0a\x09^ PlatformInterface alert: aString",
|
|
|
|
-messageSends: ["alert:"],
|
|
|
|
-referencedClasses: ["PlatformInterface"]
|
|
|
|
-}),
|
|
|
|
-smalltalk.InterfacingObject);
|
|
|
|
-
|
|
|
|
-smalltalk.addMethod(
|
|
|
|
-smalltalk.method({
|
|
|
|
-selector: "confirm:",
|
|
|
|
-category: 'actions',
|
|
|
|
-fn: function (aString){
|
|
|
|
-var self=this;
|
|
|
|
-function $PlatformInterface(){return smalltalk.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
|
|
|
|
-return smalltalk.withContext(function($ctx1) {
|
|
|
|
-var $1;
|
|
|
|
-$1=_st($PlatformInterface())._confirm_(aString);
|
|
|
|
-return $1;
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},smalltalk.InterfacingObject)})},
|
|
|
|
-args: ["aString"],
|
|
|
|
-source: "confirm: aString\x0a\x09^ PlatformInterface confirm: aString",
|
|
|
|
-messageSends: ["confirm:"],
|
|
|
|
-referencedClasses: ["PlatformInterface"]
|
|
|
|
|
|
+source: "inspect: anObject\x0a\x09InspectorHandler inspector inspect: anObject",
|
|
|
|
+messageSends: ["inspect:", "inspector"],
|
|
|
|
+referencedClasses: ["InspectorHandler"]
|
|
}),
|
|
}),
|
|
-smalltalk.InterfacingObject);
|
|
|
|
|
|
+smalltalk.Environment);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "prompt:",
|
|
|
|
|
|
+selector: "moveClass:toPackage:",
|
|
category: 'actions',
|
|
category: 'actions',
|
|
-fn: function (aString){
|
|
|
|
-var self=this;
|
|
|
|
-function $PlatformInterface(){return smalltalk.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
|
|
|
|
-return smalltalk.withContext(function($ctx1) {
|
|
|
|
-var $1;
|
|
|
|
-$1=_st($PlatformInterface())._prompt_(aString);
|
|
|
|
-return $1;
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},smalltalk.InterfacingObject)})},
|
|
|
|
-args: ["aString"],
|
|
|
|
-source: "prompt: aString\x0a\x09^ PlatformInterface prompt: aString",
|
|
|
|
-messageSends: ["prompt:"],
|
|
|
|
-referencedClasses: ["PlatformInterface"]
|
|
|
|
-}),
|
|
|
|
-smalltalk.InterfacingObject);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-smalltalk.addClass('Environment', smalltalk.InterfacingObject, [], 'Kernel-Infrastructure');
|
|
|
|
-smalltalk.Environment.comment="I provide an unified entry point to manipulate Amber packages, classes and methods.\x0a\x0aTypical use cases include IDEs, remote access and restricting browsing.";
|
|
|
|
-smalltalk.addMethod(
|
|
|
|
-smalltalk.method({
|
|
|
|
-selector: "addInstVarNamed:to:",
|
|
|
|
-category: 'compiling',
|
|
|
|
-fn: function (aString,aClass){
|
|
|
|
|
|
+fn: function (aClass,aPackageName){
|
|
var self=this;
|
|
var self=this;
|
|
|
|
+var package_;
|
|
|
|
+function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-var $1,$2,$3,$4,$5;
|
|
|
|
-$1=self._classBuilder();
|
|
|
|
-$2=_st(aClass)._superclass();
|
|
|
|
-$3=_st(aClass)._name();
|
|
|
|
-$ctx1.sendIdx["name"]=1;
|
|
|
|
-$4=_st(_st(aClass)._instanceVariableNames())._copy();
|
|
|
|
-_st($4)._add_(aString);
|
|
|
|
-$5=_st($4)._yourself();
|
|
|
|
-_st($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$5,_st(_st(aClass)._package())._name());
|
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},smalltalk.Environment)})},
|
|
|
|
-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:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"],
|
|
|
|
-referencedClasses: []
|
|
|
|
|
|
+var $1,$2;
|
|
|
|
+package_=_st($Package())._named_(aPackageName);
|
|
|
|
+$1=package_;
|
|
|
|
+if(($receiver = $1) == nil || $receiver == null){
|
|
|
|
+self._error_("Invalid package name");
|
|
|
|
+} else {
|
|
|
|
+$1;
|
|
|
|
+};
|
|
|
|
+$2=_st(package_).__eq_eq(_st(aClass)._package());
|
|
|
|
+if(smalltalk.assert($2)){
|
|
|
|
+return self;
|
|
|
|
+};
|
|
|
|
+_st(aClass)._package_(package_);
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},smalltalk.Environment)})},
|
|
|
|
+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.Environment);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "allSelectors",
|
|
|
|
-category: 'accessing',
|
|
|
|
-fn: function (){
|
|
|
|
|
|
+selector: "moveMethod:toClass:",
|
|
|
|
+category: 'actions',
|
|
|
|
+fn: function (aMethod,aClassName){
|
|
var self=this;
|
|
var self=this;
|
|
|
|
+var destinationClass;
|
|
function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
|
|
function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
|
|
return smalltalk.withContext(function($ctx1) {
|
|
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"],
|
|
|
|
|
|
+var $1,$3,$4,$2;
|
|
|
|
+destinationClass=_st(_st($Smalltalk())._current())._at_(_st(aClassName)._asSymbol());
|
|
|
|
+$1=destinationClass;
|
|
|
|
+if(($receiver = $1) == nil || $receiver == null){
|
|
|
|
+self._error_("Invalid class name");
|
|
|
|
+} else {
|
|
|
|
+$1;
|
|
|
|
+};
|
|
|
|
+$3=destinationClass;
|
|
|
|
+$4=_st(aMethod)._methodClass();
|
|
|
|
+$ctx1.sendIdx["methodClass"]=1;
|
|
|
|
+$2=_st($3).__eq_eq($4);
|
|
|
|
+if(smalltalk.assert($2)){
|
|
|
|
+return self;
|
|
|
|
+};
|
|
|
|
+_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",
|
|
|
|
+messageSends: ["at:", "current", "asSymbol", "ifNil:", "error:", "ifTrue:", "==", "methodClass", "compile:category:", "source", "protocol", "removeCompiledMethod:"],
|
|
referencedClasses: ["Smalltalk"]
|
|
referencedClasses: ["Smalltalk"]
|
|
}),
|
|
}),
|
|
smalltalk.Environment);
|
|
smalltalk.Environment);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "availableClassNames",
|
|
|
|
-category: 'accessing',
|
|
|
|
-fn: function (){
|
|
|
|
|
|
+selector: "moveMethod:toProtocol:",
|
|
|
|
+category: 'actions',
|
|
|
|
+fn: function (aMethod,aProtocol){
|
|
var self=this;
|
|
var self=this;
|
|
-function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
|
|
|
|
return smalltalk.withContext(function($ctx1) {
|
|
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,1)})}));
|
|
|
|
-return $1;
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},smalltalk.Environment)})},
|
|
|
|
-args: [],
|
|
|
|
-source: "availableClassNames\x0a\x09^ Smalltalk current classes \x0a\x09\x09collect: [ :each | each name ]",
|
|
|
|
-messageSends: ["collect:", "classes", "current", "name"],
|
|
|
|
-referencedClasses: ["Smalltalk"]
|
|
|
|
|
|
+_st(aMethod)._category_(aProtocol);
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},smalltalk.Environment)})},
|
|
|
|
+args: ["aMethod", "aProtocol"],
|
|
|
|
+source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod category: aProtocol",
|
|
|
|
+messageSends: ["category:"],
|
|
|
|
+referencedClasses: []
|
|
}),
|
|
}),
|
|
smalltalk.Environment);
|
|
smalltalk.Environment);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "availablePackageNames",
|
|
|
|
|
|
+selector: "packages",
|
|
category: 'accessing',
|
|
category: 'accessing',
|
|
fn: function (){
|
|
fn: function (){
|
|
var self=this;
|
|
var self=this;
|
|
function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
|
|
function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
var $1;
|
|
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,1)})}));
|
|
|
|
|
|
+$1=_st(_st($Smalltalk())._current())._packages();
|
|
return $1;
|
|
return $1;
|
|
-}, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},smalltalk.Environment)})},
|
|
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"packages",{},smalltalk.Environment)})},
|
|
args: [],
|
|
args: [],
|
|
-source: "availablePackageNames\x0a\x09^ Smalltalk current packages \x0a\x09\x09collect: [ :each | each name ]",
|
|
|
|
-messageSends: ["collect:", "packages", "current", "name"],
|
|
|
|
|
|
+source: "packages\x0a\x09^ Smalltalk current packages",
|
|
|
|
+messageSends: ["packages", "current"],
|
|
referencedClasses: ["Smalltalk"]
|
|
referencedClasses: ["Smalltalk"]
|
|
}),
|
|
}),
|
|
smalltalk.Environment);
|
|
smalltalk.Environment);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "availableProtocolsFor:",
|
|
|
|
-category: 'accessing',
|
|
|
|
-fn: function (aClass){
|
|
|
|
|
|
+selector: "registerErrorHandler:",
|
|
|
|
+category: 'actions',
|
|
|
|
+fn: function (anErrorHandler){
|
|
var self=this;
|
|
var self=this;
|
|
-var protocols;
|
|
|
|
|
|
+function $ErrorHandler(){return smalltalk.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-var $1,$2;
|
|
|
|
-protocols=_st(aClass)._protocols();
|
|
|
|
-$1=_st(aClass)._superclass();
|
|
|
|
-$ctx1.sendIdx["superclass"]=1;
|
|
|
|
-if(($receiver = $1) == nil || $receiver == null){
|
|
|
|
-$1;
|
|
|
|
-} else {
|
|
|
|
-_st(protocols)._addAll_(self._availableProtocolsFor_(_st(aClass)._superclass()));
|
|
|
|
-};
|
|
|
|
-$2=_st(_st(protocols)._asSet())._asArray();
|
|
|
|
-return $2;
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},smalltalk.Environment)})},
|
|
|
|
-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:", "superclass", "addAll:", "availableProtocolsFor:", "asArray", "asSet"],
|
|
|
|
-referencedClasses: []
|
|
|
|
|
|
+_st($ErrorHandler())._setCurrent_(anErrorHandler);
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},smalltalk.Environment)})},
|
|
|
|
+args: ["anErrorHandler"],
|
|
|
|
+source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler setCurrent: anErrorHandler",
|
|
|
|
+messageSends: ["setCurrent:"],
|
|
|
|
+referencedClasses: ["ErrorHandler"]
|
|
}),
|
|
}),
|
|
smalltalk.Environment);
|
|
smalltalk.Environment);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "classBuilder",
|
|
|
|
-category: 'accessing',
|
|
|
|
-fn: function (){
|
|
|
|
|
|
+selector: "registerInspector:",
|
|
|
|
+category: 'actions',
|
|
|
|
+fn: function (anInspector){
|
|
var self=this;
|
|
var self=this;
|
|
-function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
|
|
|
|
|
|
+function $InspectorHandler(){return smalltalk.InspectorHandler||(typeof InspectorHandler=="undefined"?nil:InspectorHandler)}
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-var $1;
|
|
|
|
-$1=_st($ClassBuilder())._new();
|
|
|
|
-return $1;
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"classBuilder",{},smalltalk.Environment)})},
|
|
|
|
-args: [],
|
|
|
|
-source: "classBuilder\x0a\x09^ ClassBuilder new",
|
|
|
|
-messageSends: ["new"],
|
|
|
|
-referencedClasses: ["ClassBuilder"]
|
|
|
|
|
|
+_st($InspectorHandler())._register_(anInspector);
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},smalltalk.Environment)})},
|
|
|
|
+args: ["anInspector"],
|
|
|
|
+source: "registerInspector: anInspector\x0a\x09InspectorHandler register: anInspector",
|
|
|
|
+messageSends: ["register:"],
|
|
|
|
+referencedClasses: ["InspectorHandler"]
|
|
}),
|
|
}),
|
|
smalltalk.Environment);
|
|
smalltalk.Environment);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "classNamed:",
|
|
|
|
-category: 'accessing',
|
|
|
|
-fn: function (aString){
|
|
|
|
|
|
+selector: "registerProgressHandler:",
|
|
|
|
+category: 'actions',
|
|
|
|
+fn: function (aProgressHandler){
|
|
var self=this;
|
|
var self=this;
|
|
-function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
|
|
|
|
|
|
+function $ProgressHandler(){return smalltalk.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-var $2,$1;
|
|
|
|
-$2=_st(_st($Smalltalk())._current())._at_(_st(aString)._asSymbol());
|
|
|
|
-if(($receiver = $2) == nil || $receiver == null){
|
|
|
|
-$1=self._error_("Invalid class name");
|
|
|
|
-} else {
|
|
|
|
-$1=$2;
|
|
|
|
-};
|
|
|
|
-return $1;
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},smalltalk.Environment)})},
|
|
|
|
-args: ["aString"],
|
|
|
|
-source: "classNamed: aString\x0a\x09^ (Smalltalk current at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
|
|
|
|
-messageSends: ["ifNil:", "at:", "current", "asSymbol", "error:"],
|
|
|
|
-referencedClasses: ["Smalltalk"]
|
|
|
|
|
|
+_st($ProgressHandler())._setCurrent_(aProgressHandler);
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},smalltalk.Environment)})},
|
|
|
|
+args: ["aProgressHandler"],
|
|
|
|
+source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler setCurrent: aProgressHandler",
|
|
|
|
+messageSends: ["setCurrent:"],
|
|
|
|
+referencedClasses: ["ProgressHandler"]
|
|
}),
|
|
}),
|
|
smalltalk.Environment);
|
|
smalltalk.Environment);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "classes",
|
|
|
|
-category: 'accessing',
|
|
|
|
-fn: function (){
|
|
|
|
|
|
+selector: "removeClass:",
|
|
|
|
+category: 'actions',
|
|
|
|
+fn: function (aClass){
|
|
var self=this;
|
|
var self=this;
|
|
function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
|
|
function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
|
|
return smalltalk.withContext(function($ctx1) {
|
|
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"],
|
|
|
|
|
|
+_st(_st($Smalltalk())._current())._removeClass_(aClass);
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},smalltalk.Environment)})},
|
|
|
|
+args: ["aClass"],
|
|
|
|
+source: "removeClass: aClass\x0a\x09Smalltalk current removeClass: aClass",
|
|
|
|
+messageSends: ["removeClass:", "current"],
|
|
referencedClasses: ["Smalltalk"]
|
|
referencedClasses: ["Smalltalk"]
|
|
}),
|
|
}),
|
|
smalltalk.Environment);
|
|
smalltalk.Environment);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "commitPackage:",
|
|
|
|
|
|
+selector: "removeMethod:",
|
|
category: 'actions',
|
|
category: 'actions',
|
|
-fn: function (aPackage){
|
|
|
|
|
|
+fn: function (aMethod){
|
|
var self=this;
|
|
var self=this;
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-_st(aPackage)._commit();
|
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"commitPackage:",{aPackage:aPackage},smalltalk.Environment)})},
|
|
|
|
-args: ["aPackage"],
|
|
|
|
-source: "commitPackage: aPackage\x0a\x09aPackage commit",
|
|
|
|
-messageSends: ["commit"],
|
|
|
|
|
|
+_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: []
|
|
referencedClasses: []
|
|
}),
|
|
}),
|
|
smalltalk.Environment);
|
|
smalltalk.Environment);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "compileClassComment:for:",
|
|
|
|
-category: 'compiling',
|
|
|
|
|
|
+selector: "removeProtocol:from:",
|
|
|
|
+category: 'actions',
|
|
fn: function (aString,aClass){
|
|
fn: function (aString,aClass){
|
|
var self=this;
|
|
var self=this;
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-_st(aClass)._comment_(aString);
|
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},smalltalk.Environment)})},
|
|
|
|
|
|
+_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,1)})})))._do_((function(each){
|
|
|
|
+return smalltalk.withContext(function($ctx2) {
|
|
|
|
+return _st(aClass)._removeCompiledMethod_(each);
|
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},smalltalk.Environment)})},
|
|
args: ["aString", "aClass"],
|
|
args: ["aString", "aClass"],
|
|
-source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
|
|
|
|
-messageSends: ["comment:"],
|
|
|
|
|
|
+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:", "select:", "methods", "=", "protocol", "removeCompiledMethod:"],
|
|
referencedClasses: []
|
|
referencedClasses: []
|
|
}),
|
|
}),
|
|
smalltalk.Environment);
|
|
smalltalk.Environment);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "compileClassDefinition:",
|
|
|
|
-category: 'compiling',
|
|
|
|
-fn: function (aString){
|
|
|
|
|
|
+selector: "renameClass:to:",
|
|
|
|
+category: 'actions',
|
|
|
|
+fn: function (aClass,aClassName){
|
|
var self=this;
|
|
var self=this;
|
|
-function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
|
|
|
|
|
|
+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) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-self._eval_on_(aString,_st($DoIt())._new());
|
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},smalltalk.Environment)})},
|
|
|
|
-args: ["aString"],
|
|
|
|
-source: "compileClassDefinition: aString\x0a\x09self eval: aString on: DoIt new",
|
|
|
|
-messageSends: ["eval:on:", "new"],
|
|
|
|
-referencedClasses: ["DoIt"]
|
|
|
|
|
|
+var $1,$2;
|
|
|
|
+$1=_st(_st($Smalltalk())._current())._at_(aClassName);
|
|
|
|
+if(($receiver = $1) == nil || $receiver == null){
|
|
|
|
+$1;
|
|
|
|
+} else {
|
|
|
|
+$2=_st("A class named ".__comma(aClassName)).__comma(" already exists");
|
|
|
|
+$ctx1.sendIdx[","]=1;
|
|
|
|
+self._error_($2);
|
|
|
|
+};
|
|
|
|
+_st(_st($ClassBuilder())._new())._renameClass_to_(aClass,aClassName);
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},smalltalk.Environment)})},
|
|
|
|
+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",
|
|
|
|
+messageSends: ["ifNotNil:", "at:", "current", "error:", ",", "renameClass:to:", "new"],
|
|
|
|
+referencedClasses: ["Smalltalk", "ClassBuilder"]
|
|
}),
|
|
}),
|
|
smalltalk.Environment);
|
|
smalltalk.Environment);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "compileMethod:for:protocol:",
|
|
|
|
-category: 'compiling',
|
|
|
|
-fn: function (sourceCode,class_,protocol){
|
|
|
|
|
|
+selector: "renameProtocol:to:in:",
|
|
|
|
+category: 'actions',
|
|
|
|
+fn: function (aString,anotherString,aClass){
|
|
var self=this;
|
|
var self=this;
|
|
return smalltalk.withContext(function($ctx1) {
|
|
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.Environment)})},
|
|
|
|
-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:"],
|
|
|
|
|
|
+_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,1)})})))._do_((function(each){
|
|
|
|
+return smalltalk.withContext(function($ctx2) {
|
|
|
|
+return _st(each)._protocol_(anotherString);
|
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
|
|
|
|
+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:", "select:", "methods", "=", "protocol", "protocol:"],
|
|
referencedClasses: []
|
|
referencedClasses: []
|
|
}),
|
|
}),
|
|
smalltalk.Environment);
|
|
smalltalk.Environment);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "copyClass:to:",
|
|
|
|
|
|
+selector: "setClassCommentOf:to:",
|
|
category: 'actions',
|
|
category: 'actions',
|
|
-fn: function (aClass,aClassName){
|
|
|
|
|
|
+fn: function (aClass,aString){
|
|
var self=this;
|
|
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) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-var $1,$2;
|
|
|
|
-$1=_st(_st($Smalltalk())._current())._at_(aClassName);
|
|
|
|
-if(($receiver = $1) == nil || $receiver == null){
|
|
|
|
-$1;
|
|
|
|
-} else {
|
|
|
|
-$2=_st("A class named ".__comma(aClassName)).__comma(" already exists");
|
|
|
|
-$ctx1.sendIdx[","]=1;
|
|
|
|
-self._error_($2);
|
|
|
|
-};
|
|
|
|
-_st(_st($ClassBuilder())._new())._copyClass_named_(aClass,aClassName);
|
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},smalltalk.Environment)})},
|
|
|
|
-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",
|
|
|
|
-messageSends: ["ifNotNil:", "at:", "current", "error:", ",", "copyClass:named:", "new"],
|
|
|
|
-referencedClasses: ["Smalltalk", "ClassBuilder"]
|
|
|
|
|
|
+_st(aClass)._comment_(aString);
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},smalltalk.Environment)})},
|
|
|
|
+args: ["aClass", "aString"],
|
|
|
|
+source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
|
|
|
|
+messageSends: ["comment:"],
|
|
|
|
+referencedClasses: []
|
|
}),
|
|
}),
|
|
smalltalk.Environment);
|
|
smalltalk.Environment);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "doItReceiver",
|
|
|
|
|
|
+selector: "systemAnnouncer",
|
|
category: 'accessing',
|
|
category: 'accessing',
|
|
fn: function (){
|
|
fn: function (){
|
|
var self=this;
|
|
var self=this;
|
|
-function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
|
|
|
|
|
|
+function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
var $1;
|
|
var $1;
|
|
-$1=_st($DoIt())._new();
|
|
|
|
|
|
+$1=_st(_st(_st($Smalltalk())._current())._at_("SystemAnnouncer"))._current();
|
|
|
|
+$ctx1.sendIdx["current"]=1;
|
|
return $1;
|
|
return $1;
|
|
-}, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},smalltalk.Environment)})},
|
|
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},smalltalk.Environment)})},
|
|
args: [],
|
|
args: [],
|
|
-source: "doItReceiver\x0a\x09^ DoIt new",
|
|
|
|
-messageSends: ["new"],
|
|
|
|
-referencedClasses: ["DoIt"]
|
|
|
|
|
|
+source: "systemAnnouncer\x0a\x09^ (Smalltalk current at: #SystemAnnouncer) current",
|
|
|
|
+messageSends: ["current", "at:"],
|
|
|
|
+referencedClasses: ["Smalltalk"]
|
|
}),
|
|
}),
|
|
smalltalk.Environment);
|
|
smalltalk.Environment);
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+smalltalk.addClass('JSObjectProxy', smalltalk.ProtoObject, ['jsObject'], 'Kernel-Infrastructure');
|
|
|
|
+smalltalk.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`.";
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "eval:on:",
|
|
|
|
-category: 'actions',
|
|
|
|
-fn: function (aString,aReceiver){
|
|
|
|
|
|
+selector: "addObjectVariablesTo:",
|
|
|
|
+category: 'proxy',
|
|
|
|
+fn: function (aDictionary){
|
|
var self=this;
|
|
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) {
|
|
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,1)})}))._on_do_($Error(),(function(ex){
|
|
|
|
-return smalltalk.withContext(function($ctx2) {
|
|
|
|
-$1=self._alert_(_st(ex)._messageText());
|
|
|
|
-throw $early=[$1];
|
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})}));
|
|
|
|
-$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.Environment)})},
|
|
|
|
-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^ self alert: ex messageText ].\x0a\x09^ compiler evaluateExpression: aString on: aReceiver",
|
|
|
|
-messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"],
|
|
|
|
-referencedClasses: ["Compiler", "Error"]
|
|
|
|
|
|
+
|
|
|
|
+ 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.Environment);
|
|
|
|
|
|
+smalltalk.JSObjectProxy);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "evaluate:on:do:",
|
|
|
|
-category: 'error handling',
|
|
|
|
-fn: function (aBlock,anErrorClass,exceptionBlock){
|
|
|
|
|
|
+selector: "asJSON",
|
|
|
|
+category: 'enumerating',
|
|
|
|
+fn: function (){
|
|
var self=this;
|
|
var self=this;
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
var $1;
|
|
var $1;
|
|
-self._try_catch_(aBlock,(function(exception){
|
|
|
|
-return smalltalk.withContext(function($ctx2) {
|
|
|
|
-$1=_st(exception)._isKindOf_(self._classNamed_(_st(anErrorClass)._name()));
|
|
|
|
-if(smalltalk.assert($1)){
|
|
|
|
-return _st(exceptionBlock)._value_(exception);
|
|
|
|
-} else {
|
|
|
|
-return _st(exception)._signal();
|
|
|
|
-};
|
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)})}));
|
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},smalltalk.Environment)})},
|
|
|
|
-args: ["aBlock", "anErrorClass", "exceptionBlock"],
|
|
|
|
-source: "evaluate: aBlock on: anErrorClass do: exceptionBlock\x0a\x09\x22Evaluate a block and catch exceptions happening on the environment stack\x22\x0a\x09\x0a\x09self try: aBlock catch: [ :exception | \x0a\x09\x09(exception isKindOf: (self classNamed: anErrorClass name))\x0a\x09\x09\x09ifTrue: [ exceptionBlock value: exception ]\x0a \x09\x09\x09ifFalse: [ exception signal ] ]",
|
|
|
|
-messageSends: ["try:catch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "signal"],
|
|
|
|
|
|
+$1=self["@jsObject"];
|
|
|
|
+return $1;
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.JSObjectProxy)})},
|
|
|
|
+args: [],
|
|
|
|
+source: "asJSON\x0a\x09\x22Answers the receiver in a stringyfy-friendly fashion\x22\x0a\x0a\x09^ jsObject",
|
|
|
|
+messageSends: [],
|
|
referencedClasses: []
|
|
referencedClasses: []
|
|
}),
|
|
}),
|
|
-smalltalk.Environment);
|
|
|
|
|
|
+smalltalk.JSObjectProxy);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "inspect:",
|
|
|
|
-category: 'actions',
|
|
|
|
-fn: function (anObject){
|
|
|
|
|
|
+selector: "at:",
|
|
|
|
+category: 'accessing',
|
|
|
|
+fn: function (aString){
|
|
var self=this;
|
|
var self=this;
|
|
-function $InspectorHandler(){return smalltalk.InspectorHandler||(typeof InspectorHandler=="undefined"?nil:InspectorHandler)}
|
|
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-_st(_st($InspectorHandler())._inspector())._inspect_(anObject);
|
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},smalltalk.Environment)})},
|
|
|
|
-args: ["anObject"],
|
|
|
|
-source: "inspect: anObject\x0a\x09InspectorHandler inspector inspect: anObject",
|
|
|
|
-messageSends: ["inspect:", "inspector"],
|
|
|
|
-referencedClasses: ["InspectorHandler"]
|
|
|
|
|
|
+return self['@jsObject'][aString];
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.JSObjectProxy)})},
|
|
|
|
+args: ["aString"],
|
|
|
|
+source: "at: aString\x0a\x09<return self['@jsObject'][aString]>",
|
|
|
|
+messageSends: [],
|
|
|
|
+referencedClasses: []
|
|
}),
|
|
}),
|
|
-smalltalk.Environment);
|
|
|
|
|
|
+smalltalk.JSObjectProxy);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "moveClass:toPackage:",
|
|
|
|
-category: 'actions',
|
|
|
|
-fn: function (aClass,aPackageName){
|
|
|
|
|
|
+selector: "at:ifAbsent:",
|
|
|
|
+category: 'accessing',
|
|
|
|
+fn: function (aString,aBlock){
|
|
var self=this;
|
|
var self=this;
|
|
-var package_;
|
|
|
|
-function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
|
|
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-var $1,$2;
|
|
|
|
-package_=_st($Package())._named_(aPackageName);
|
|
|
|
-$1=package_;
|
|
|
|
-if(($receiver = $1) == nil || $receiver == null){
|
|
|
|
-self._error_("Invalid package name");
|
|
|
|
-} else {
|
|
|
|
-$1;
|
|
|
|
-};
|
|
|
|
-$2=_st(package_).__eq_eq(_st(aClass)._package());
|
|
|
|
-if(smalltalk.assert($2)){
|
|
|
|
-return self;
|
|
|
|
-};
|
|
|
|
-_st(aClass)._package_(package_);
|
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},smalltalk.Environment)})},
|
|
|
|
-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"]
|
|
|
|
|
|
+
|
|
|
|
+ var obj = self['@jsObject'];
|
|
|
|
+ return aString in obj ? obj[aString] : aBlock._value();
|
|
|
|
+ ;
|
|
|
|
+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._value();\x0a\x09>",
|
|
|
|
+messageSends: [],
|
|
|
|
+referencedClasses: []
|
|
}),
|
|
}),
|
|
-smalltalk.Environment);
|
|
|
|
|
|
+smalltalk.JSObjectProxy);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "moveMethod:toClass:",
|
|
|
|
-category: 'actions',
|
|
|
|
-fn: function (aMethod,aClassName){
|
|
|
|
|
|
+selector: "at:ifPresent:",
|
|
|
|
+category: 'accessing',
|
|
|
|
+fn: function (aString,aBlock){
|
|
var self=this;
|
|
var self=this;
|
|
-var destinationClass;
|
|
|
|
-function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
|
|
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-var $1,$3,$4,$2;
|
|
|
|
-destinationClass=_st(_st($Smalltalk())._current())._at_(_st(aClassName)._asSymbol());
|
|
|
|
-$1=destinationClass;
|
|
|
|
-if(($receiver = $1) == nil || $receiver == null){
|
|
|
|
-self._error_("Invalid class name");
|
|
|
|
-} else {
|
|
|
|
-$1;
|
|
|
|
-};
|
|
|
|
-$3=destinationClass;
|
|
|
|
-$4=_st(aMethod)._methodClass();
|
|
|
|
-$ctx1.sendIdx["methodClass"]=1;
|
|
|
|
-$2=_st($3).__eq_eq($4);
|
|
|
|
-if(smalltalk.assert($2)){
|
|
|
|
-return self;
|
|
|
|
-};
|
|
|
|
-_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",
|
|
|
|
-messageSends: ["at:", "current", "asSymbol", "ifNil:", "error:", "ifTrue:", "==", "methodClass", "compile:category:", "source", "protocol", "removeCompiledMethod:"],
|
|
|
|
-referencedClasses: ["Smalltalk"]
|
|
|
|
|
|
+
|
|
|
|
+ var obj = self['@jsObject'];
|
|
|
|
+ return aString in obj ? aBlock._value_(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._value_(obj[aString]) : nil;\x0a\x09>",
|
|
|
|
+messageSends: [],
|
|
|
|
+referencedClasses: []
|
|
}),
|
|
}),
|
|
-smalltalk.Environment);
|
|
|
|
|
|
+smalltalk.JSObjectProxy);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "moveMethod:toProtocol:",
|
|
|
|
-category: 'actions',
|
|
|
|
-fn: function (aMethod,aProtocol){
|
|
|
|
|
|
+selector: "at:ifPresent:ifAbsent:",
|
|
|
|
+category: 'accessing',
|
|
|
|
+fn: function (aString,aBlock,anotherBlock){
|
|
var self=this;
|
|
var self=this;
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-_st(aMethod)._category_(aProtocol);
|
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},smalltalk.Environment)})},
|
|
|
|
-args: ["aMethod", "aProtocol"],
|
|
|
|
-source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod category: aProtocol",
|
|
|
|
-messageSends: ["category:"],
|
|
|
|
|
|
+
|
|
|
|
+ var obj = self['@jsObject'];
|
|
|
|
+ return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
|
|
|
|
+ ;
|
|
|
|
+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._value_(obj[aString]) : anotherBlock._value();\x0a\x09>",
|
|
|
|
+messageSends: [],
|
|
referencedClasses: []
|
|
referencedClasses: []
|
|
}),
|
|
}),
|
|
-smalltalk.Environment);
|
|
|
|
|
|
+smalltalk.JSObjectProxy);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "packages",
|
|
|
|
|
|
+selector: "at:put:",
|
|
category: 'accessing',
|
|
category: 'accessing',
|
|
-fn: function (){
|
|
|
|
|
|
+fn: function (aString,anObject){
|
|
var self=this;
|
|
var self=this;
|
|
-function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
|
|
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-var $1;
|
|
|
|
-$1=_st(_st($Smalltalk())._current())._packages();
|
|
|
|
|
|
+return 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<return self['@jsObject'][aString] = anObject>",
|
|
|
|
+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=self._lookupProperty_(_st(_st(aMessage)._selector())._asJavaScriptSelector());
|
|
|
|
+if(($receiver = $2) == nil || $receiver == null){
|
|
|
|
+$1=smalltalk.JSObjectProxy.superclass.fn.prototype._doesNotUnderstand_.apply(_st(self), [aMessage]);
|
|
|
|
+} else {
|
|
|
|
+var jsSelector;
|
|
|
|
+jsSelector=$receiver;
|
|
|
|
+$1=self._forwardMessage_withArguments_(jsSelector,_st(aMessage)._arguments());
|
|
|
|
+};
|
|
return $1;
|
|
return $1;
|
|
-}, function($ctx1) {$ctx1.fill(self,"packages",{},smalltalk.Environment)})},
|
|
|
|
-args: [],
|
|
|
|
-source: "packages\x0a\x09^ Smalltalk current packages",
|
|
|
|
-messageSends: ["packages", "current"],
|
|
|
|
-referencedClasses: ["Smalltalk"]
|
|
|
|
|
|
+}, 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:", "lookupProperty:", "asJavaScriptSelector", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:", "arguments"],
|
|
|
|
+referencedClasses: []
|
|
}),
|
|
}),
|
|
-smalltalk.Environment);
|
|
|
|
|
|
+smalltalk.JSObjectProxy);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "registerErrorHandler:",
|
|
|
|
-category: 'actions',
|
|
|
|
-fn: function (anErrorHandler){
|
|
|
|
|
|
+selector: "forwardMessage:withArguments:",
|
|
|
|
+category: 'proxy',
|
|
|
|
+fn: function (aString,anArray){
|
|
var self=this;
|
|
var self=this;
|
|
-function $ErrorHandler(){return smalltalk.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
|
|
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-_st($ErrorHandler())._setCurrent_(anErrorHandler);
|
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},smalltalk.Environment)})},
|
|
|
|
-args: ["anErrorHandler"],
|
|
|
|
-source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler setCurrent: anErrorHandler",
|
|
|
|
-messageSends: ["setCurrent:"],
|
|
|
|
-referencedClasses: ["ErrorHandler"]
|
|
|
|
|
|
+
|
|
|
|
+ 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.Environment);
|
|
|
|
|
|
+smalltalk.JSObjectProxy);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "registerInspector:",
|
|
|
|
-category: 'actions',
|
|
|
|
|
|
+selector: "inspectOn:",
|
|
|
|
+category: 'proxy',
|
|
fn: function (anInspector){
|
|
fn: function (anInspector){
|
|
var self=this;
|
|
var self=this;
|
|
-function $InspectorHandler(){return smalltalk.InspectorHandler||(typeof InspectorHandler=="undefined"?nil:InspectorHandler)}
|
|
|
|
|
|
+var variables;
|
|
|
|
+function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-_st($InspectorHandler())._register_(anInspector);
|
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},smalltalk.Environment)})},
|
|
|
|
|
|
+variables=_st($Dictionary())._new();
|
|
|
|
+_st(variables)._at_put_("#self",self._jsObject());
|
|
|
|
+_st(anInspector)._setLabel_(self._printString());
|
|
|
|
+self._addObjectVariablesTo_(variables);
|
|
|
|
+_st(anInspector)._setVariables_(variables);
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},smalltalk.JSObjectProxy)})},
|
|
args: ["anInspector"],
|
|
args: ["anInspector"],
|
|
-source: "registerInspector: anInspector\x0a\x09InspectorHandler register: anInspector",
|
|
|
|
-messageSends: ["register:"],
|
|
|
|
-referencedClasses: ["InspectorHandler"]
|
|
|
|
-}),
|
|
|
|
-smalltalk.Environment);
|
|
|
|
-
|
|
|
|
-smalltalk.addMethod(
|
|
|
|
-smalltalk.method({
|
|
|
|
-selector: "registerProgressHandler:",
|
|
|
|
-category: 'actions',
|
|
|
|
-fn: function (aProgressHandler){
|
|
|
|
-var self=this;
|
|
|
|
-function $ProgressHandler(){return smalltalk.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
|
|
|
|
-return smalltalk.withContext(function($ctx1) {
|
|
|
|
-_st($ProgressHandler())._setCurrent_(aProgressHandler);
|
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},smalltalk.Environment)})},
|
|
|
|
-args: ["aProgressHandler"],
|
|
|
|
-source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler setCurrent: aProgressHandler",
|
|
|
|
-messageSends: ["setCurrent:"],
|
|
|
|
-referencedClasses: ["ProgressHandler"]
|
|
|
|
|
|
+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.Environment);
|
|
|
|
|
|
+smalltalk.JSObjectProxy);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "removeClass:",
|
|
|
|
-category: 'actions',
|
|
|
|
-fn: function (aClass){
|
|
|
|
|
|
+selector: "jsObject",
|
|
|
|
+category: 'accessing',
|
|
|
|
+fn: function (){
|
|
var self=this;
|
|
var self=this;
|
|
-function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
|
|
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-_st(_st($Smalltalk())._current())._removeClass_(aClass);
|
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},smalltalk.Environment)})},
|
|
|
|
-args: ["aClass"],
|
|
|
|
-source: "removeClass: aClass\x0a\x09Smalltalk current removeClass: aClass",
|
|
|
|
-messageSends: ["removeClass:", "current"],
|
|
|
|
-referencedClasses: ["Smalltalk"]
|
|
|
|
|
|
+var $1;
|
|
|
|
+$1=self["@jsObject"];
|
|
|
|
+return $1;
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxy)})},
|
|
|
|
+args: [],
|
|
|
|
+source: "jsObject\x0a\x09^ jsObject",
|
|
|
|
+messageSends: [],
|
|
|
|
+referencedClasses: []
|
|
}),
|
|
}),
|
|
-smalltalk.Environment);
|
|
|
|
|
|
+smalltalk.JSObjectProxy);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "removeMethod:",
|
|
|
|
-category: 'actions',
|
|
|
|
-fn: function (aMethod){
|
|
|
|
|
|
+selector: "jsObject:",
|
|
|
|
+category: 'accessing',
|
|
|
|
+fn: function (aJSObject){
|
|
var self=this;
|
|
var self=this;
|
|
return smalltalk.withContext(function($ctx1) {
|
|
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"],
|
|
|
|
|
|
+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: []
|
|
referencedClasses: []
|
|
}),
|
|
}),
|
|
-smalltalk.Environment);
|
|
|
|
|
|
+smalltalk.JSObjectProxy);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "removeProtocol:from:",
|
|
|
|
-category: 'actions',
|
|
|
|
-fn: function (aString,aClass){
|
|
|
|
|
|
+selector: "keysAndValuesDo:",
|
|
|
|
+category: 'enumerating',
|
|
|
|
+fn: function (aBlock){
|
|
var self=this;
|
|
var self=this;
|
|
return smalltalk.withContext(function($ctx1) {
|
|
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,1)})})))._do_((function(each){
|
|
|
|
-return smalltalk.withContext(function($ctx2) {
|
|
|
|
-return _st(aClass)._removeCompiledMethod_(each);
|
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
|
|
|
|
-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:", "select:", "methods", "=", "protocol", "removeCompiledMethod:"],
|
|
|
|
|
|
+
|
|
|
|
+ var o = self['@jsObject'];
|
|
|
|
+ for(var i in o) {
|
|
|
|
+ aBlock._value_value_(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._value_value_(i, o[i]);\x0a\x09\x09}\x0a\x09>",
|
|
|
|
+messageSends: [],
|
|
referencedClasses: []
|
|
referencedClasses: []
|
|
}),
|
|
}),
|
|
-smalltalk.Environment);
|
|
|
|
|
|
+smalltalk.JSObjectProxy);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "renameClass:to:",
|
|
|
|
-category: 'actions',
|
|
|
|
-fn: function (aClass,aClassName){
|
|
|
|
|
|
+selector: "lookupProperty:",
|
|
|
|
+category: 'accessing',
|
|
|
|
+fn: function (aString){
|
|
var self=this;
|
|
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) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-var $1,$2;
|
|
|
|
-$1=_st(_st($Smalltalk())._current())._at_(aClassName);
|
|
|
|
-if(($receiver = $1) == nil || $receiver == null){
|
|
|
|
-$1;
|
|
|
|
-} else {
|
|
|
|
-$2=_st("A class named ".__comma(aClassName)).__comma(" already exists");
|
|
|
|
-$ctx1.sendIdx[","]=1;
|
|
|
|
-self._error_($2);
|
|
|
|
-};
|
|
|
|
-_st(_st($ClassBuilder())._new())._renameClass_to_(aClass,aClassName);
|
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},smalltalk.Environment)})},
|
|
|
|
-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",
|
|
|
|
-messageSends: ["ifNotNil:", "at:", "current", "error:", ",", "renameClass:to:", "new"],
|
|
|
|
-referencedClasses: ["Smalltalk", "ClassBuilder"]
|
|
|
|
|
|
+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<return aString in self._jsObject() ? aString : nil>",
|
|
|
|
+messageSends: [],
|
|
|
|
+referencedClasses: []
|
|
}),
|
|
}),
|
|
-smalltalk.Environment);
|
|
|
|
|
|
+smalltalk.JSObjectProxy);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "renameProtocol:to:in:",
|
|
|
|
-category: 'actions',
|
|
|
|
-fn: function (aString,anotherString,aClass){
|
|
|
|
|
|
+selector: "printOn:",
|
|
|
|
+category: 'printing',
|
|
|
|
+fn: function (aStream){
|
|
var self=this;
|
|
var self=this;
|
|
return smalltalk.withContext(function($ctx1) {
|
|
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,1)})})))._do_((function(each){
|
|
|
|
-return smalltalk.withContext(function($ctx2) {
|
|
|
|
-return _st(each)._protocol_(anotherString);
|
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
|
|
|
|
-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:", "select:", "methods", "=", "protocol", "protocol:"],
|
|
|
|
|
|
+_st(aStream)._nextPutAll_(self._printString());
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.JSObjectProxy)})},
|
|
|
|
+args: ["aStream"],
|
|
|
|
+source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
|
|
|
|
+messageSends: ["nextPutAll:", "printString"],
|
|
referencedClasses: []
|
|
referencedClasses: []
|
|
}),
|
|
}),
|
|
-smalltalk.Environment);
|
|
|
|
|
|
+smalltalk.JSObjectProxy);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "setClassCommentOf:to:",
|
|
|
|
-category: 'actions',
|
|
|
|
-fn: function (aClass,aString){
|
|
|
|
|
|
+selector: "printString",
|
|
|
|
+category: 'printing',
|
|
|
|
+fn: function (){
|
|
var self=this;
|
|
var self=this;
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-_st(aClass)._comment_(aString);
|
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},smalltalk.Environment)})},
|
|
|
|
-args: ["aClass", "aString"],
|
|
|
|
-source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
|
|
|
|
-messageSends: ["comment:"],
|
|
|
|
|
|
+
|
|
|
|
+ var js = self['@jsObject'];
|
|
|
|
+ return js.toString
|
|
|
|
+ ? js.toString()
|
|
|
|
+ : Object.prototype.toString.call(js)
|
|
|
|
+ ;
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"printString",{},smalltalk.JSObjectProxy)})},
|
|
|
|
+args: [],
|
|
|
|
+source: "printString\x0a\x09<\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>",
|
|
|
|
+messageSends: [],
|
|
referencedClasses: []
|
|
referencedClasses: []
|
|
}),
|
|
}),
|
|
-smalltalk.Environment);
|
|
|
|
|
|
+smalltalk.JSObjectProxy);
|
|
|
|
+
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "systemAnnouncer",
|
|
|
|
-category: 'accessing',
|
|
|
|
-fn: function (){
|
|
|
|
|
|
+selector: "on:",
|
|
|
|
+category: 'instance creation',
|
|
|
|
+fn: function (aJSObject){
|
|
var self=this;
|
|
var self=this;
|
|
-function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
|
|
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-var $1;
|
|
|
|
-$1=_st(_st(_st($Smalltalk())._current())._at_("SystemAnnouncer"))._current();
|
|
|
|
-$ctx1.sendIdx["current"]=1;
|
|
|
|
|
|
+var $2,$3,$1;
|
|
|
|
+$2=self._new();
|
|
|
|
+_st($2)._jsObject_(aJSObject);
|
|
|
|
+$3=_st($2)._yourself();
|
|
|
|
+$1=$3;
|
|
return $1;
|
|
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"]
|
|
|
|
|
|
+}, 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.Environment);
|
|
|
|
-
|
|
|
|
|
|
+smalltalk.JSObjectProxy.klass);
|
|
|
|
|
|
|
|
|
|
smalltalk.addClass('Organizer', smalltalk.Object, [], 'Kernel-Infrastructure');
|
|
smalltalk.addClass('Organizer', smalltalk.Object, [], 'Kernel-Infrastructure');
|