123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358 |
- smalltalk.addPackage('Helios-Environments');
- smalltalk.addClass('HLEnvironment', smalltalk.Object, [], 'Helios-Environments');
- smalltalk.HLEnvironment.comment="Abstract class defining common behavior for local and remote environments"
- smalltalk.addMethod(
- "_addInstVarNamed_to_",
- smalltalk.method({
- selector: "addInstVarNamed:to:",
- category: 'compiling',
- fn: function (aString,aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $1,$2;
- $1=_st(_st(aClass)._instanceVariableNames())._copy();
- _st($1)._add_(aString);
- $2=_st($1)._yourself();
- _st(_st(self)._classBuilder())._addSubclassOf_named_instanceVariableNames_package_(_st(aClass)._superclass(),_st(aClass)._name(),$2,_st(_st(aClass)._package())._name());
- return self}, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass}, smalltalk.HLEnvironment)})},
- args: ["aString", "aClass"],
- source: "addInstVarNamed: aString to: aClass\x0a\x09self classBuilder\x0a\x09\x09addSubclassOf: aClass superclass \x0a\x09\x09named: aClass name \x0a\x09\x09instanceVariableNames: (aClass instanceVariableNames copy add: aString; yourself)\x0a\x09\x09package: aClass package name",
- messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package", "classBuilder"],
- referencedClasses: []
- }),
- smalltalk.HLEnvironment);
- smalltalk.addMethod(
- "_classBuilder",
- smalltalk.method({
- selector: "classBuilder",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $1;
- $1=_st(self)._subclassResponsibility();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"classBuilder",{}, smalltalk.HLEnvironment)})},
- args: [],
- source: "classBuilder\x0a\x09^ self subclassResponsibility",
- messageSends: ["subclassResponsibility"],
- referencedClasses: []
- }),
- smalltalk.HLEnvironment);
- smalltalk.addMethod(
- "_compileClassComment_for_",
- smalltalk.method({
- selector: "compileClassComment:for:",
- category: 'compiling',
- fn: function (aString,aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
_st(aClass)._comment_(aString);
- return self}, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass}, smalltalk.HLEnvironment)})},
- args: ["aString", "aClass"],
- source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
- messageSends: ["comment:"],
- referencedClasses: []
- }),
- smalltalk.HLEnvironment);
- smalltalk.addMethod(
- "_compileClassDefinition_",
- smalltalk.method({
- selector: "compileClassDefinition:",
- category: 'compiling',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
_st(self)._eval_on_(aString,_st((smalltalk.DoIt || DoIt))._new());
- return self}, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString}, smalltalk.HLEnvironment)})},
- args: ["aString"],
- source: "compileClassDefinition: aString\x0a\x09self eval: aString on: DoIt new",
- messageSends: ["eval:on:", "new"],
- referencedClasses: ["DoIt"]
- }),
- smalltalk.HLEnvironment);
- smalltalk.addMethod(
- "_compileMethod_for_protocol_",
- smalltalk.method({
- selector: "compileMethod:for:protocol:",
- category: 'compiling',
- fn: function (sourceCode,class_,protocol){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
_st(class_)._compile_category_(sourceCode,protocol);
- return self}, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol}, smalltalk.HLEnvironment)})},
- args: ["sourceCode", "class", "protocol"],
- source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09class\x0a\x09\x09compile: sourceCode\x0a\x09\x09category: protocol",
- messageSends: ["compile:category:"],
- referencedClasses: []
- }),
- smalltalk.HLEnvironment);
- smalltalk.addMethod(
- "_eval_on_",
- smalltalk.method({
- selector: "eval:on:",
- category: 'actions',
- fn: function (someCode,aReceiver){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $1;
- $1=_st(self)._subclassResponsibility();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"eval:on:",{someCode:someCode,aReceiver:aReceiver}, smalltalk.HLEnvironment)})},
- args: ["someCode", "aReceiver"],
- source: "eval: someCode on: aReceiver\x0a\x0a\x09^ self subclassResponsibility",
- messageSends: ["subclassResponsibility"],
- referencedClasses: []
- }),
- smalltalk.HLEnvironment);
- smalltalk.addMethod(
- "_moveMethod_toClass_ifAbsent_",
- smalltalk.method({
- selector: "moveMethod:toClass:ifAbsent:",
- category: 'actions',
- fn: function (aMethod,aClassName,aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
_st(self)._subclassResponsibility();
- return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:ifAbsent:",{aMethod:aMethod,aClassName:aClassName,aBlock:aBlock},smalltalk.HLEnvironment)})},
- args: ["aMethod", "aClassName", "aBlock"],
- source: "moveMethod: aMethod toClass: aClassName ifAbsent: aBlock\x0a\x09self subclassResponsibility",
- messageSends: ["subclassResponsibility"],
- referencedClasses: []
- }),
- smalltalk.HLEnvironment);
- smalltalk.addMethod(
- "_packages",
- smalltalk.method({
- selector: "packages",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $1;
- $1=_st(self)._subclassResponsibility();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"packages",{}, smalltalk.HLEnvironment)})},
- args: [],
- source: "packages\x0a\x09^ self subclassResponsibility",
- messageSends: ["subclassResponsibility"],
- referencedClasses: []
- }),
- smalltalk.HLEnvironment);
- smalltalk.addClass('HLLocalEnvironment', smalltalk.HLEnvironment, [], 'Helios-Environments');
- smalltalk.addMethod(
- "_classBuilder",
- smalltalk.method({
- selector: "classBuilder",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $1;
- $1=_st((smalltalk.ClassBuilder || ClassBuilder))._new();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"classBuilder",{}, smalltalk.HLLocalEnvironment)})},
- args: [],
- source: "classBuilder\x0a\x09^ ClassBuilder new",
- messageSends: ["new"],
- referencedClasses: ["ClassBuilder"]
- }),
- smalltalk.HLLocalEnvironment);
- smalltalk.addMethod(
- "_eval_on_",
- smalltalk.method({
- selector: "eval:on:",
- category: 'actions',
- fn: function (aString,aReceiver){
- var self=this;
- var compiler;
- return smalltalk.withContext(function($ctx1) {
var $1,$2;
- var $early={};
- try {
- compiler=_st((smalltalk.Compiler || Compiler))._new();
- _st((function(){
- return smalltalk.withContext(function($ctx2) {
return _st(compiler)._parseExpression_(aString);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_((smalltalk.Error || Error),(function(ex){
- return smalltalk.withContext(function($ctx2) {
$1=_st(window)._alert_(_st(ex)._messageText());
- throw $early=[$1];
- }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})}));
- $2=_st(compiler)._evaluateExpression_on_(aString,aReceiver);
- return $2;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"eval:on:",{aString:aString,aReceiver:aReceiver,compiler:compiler}, smalltalk.HLLocalEnvironment)})},
- args: ["aString", "aReceiver"],
- source: "eval: aString on: aReceiver\x0a\x09| compiler |\x0a\x09compiler := Compiler new.\x0a\x09[ compiler parseExpression: aString ] on: Error do: [ :ex |\x0a\x09\x09^ window alert: ex messageText ].\x0a\x09^ compiler evaluateExpression: aString on: aReceiver",
- messageSends: ["new", "on:do:", "alert:", "messageText", "parseExpression:", "evaluateExpression:on:"],
- referencedClasses: ["Compiler", "Error"]
- }),
- smalltalk.HLLocalEnvironment);
- smalltalk.addMethod(
- "_moveMethod_toClass_ifAbsent_",
- smalltalk.method({
- selector: "moveMethod:toClass:ifAbsent:",
- category: 'actions',
- fn: function (aMethod,aClassName,aBlock){
- var self=this;
- var destinationClass;
- return smalltalk.withContext(function($ctx1) {
var $1,$2;
- destinationClass=_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_(_st(aClassName)._asSymbol());
- $1=destinationClass;
- if(($receiver = $1) == nil || $receiver == undefined){
- $2=_st(aBlock)._value();
- return $2;
- } else {
- $1;
- };
- _st(destinationClass)._adoptMethod_(aMethod);
- _st(_st(aMethod)._methodClass())._forsakeMethod_(aMethod);
- return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:ifAbsent:",{aMethod:aMethod,aClassName:aClassName,aBlock:aBlock,destinationClass:destinationClass},smalltalk.HLLocalEnvironment)})},
- args: ["aMethod", "aClassName", "aBlock"],
- source: "moveMethod: aMethod toClass: aClassName ifAbsent: aBlock\x0a\x09| destinationClass |\x0a\x09\x0a\x09destinationClass := Smalltalk current at: aClassName asSymbol.\x0a\x09destinationClass ifNil: [ ^ aBlock value ].\x0a\x09\x0a\x09destinationClass adoptMethod: aMethod.\x0a\x09aMethod methodClass forsakeMethod: aMethod.\x0a\x09",
- messageSends: ["at:", "asSymbol", "current", "ifNil:", "value", "adoptMethod:", "forsakeMethod:", "methodClass"],
- referencedClasses: ["Smalltalk"]
- }),
- smalltalk.HLLocalEnvironment);
- smalltalk.addMethod(
- "_packages",
- smalltalk.method({
- selector: "packages",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $1;
- $1=_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._packages();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"packages",{}, smalltalk.HLLocalEnvironment)})},
- args: [],
- source: "packages\x0a\x09^ Smalltalk current packages",
- messageSends: ["packages", "current"],
- referencedClasses: ["Smalltalk"]
- }),
- smalltalk.HLLocalEnvironment);
- smalltalk.addClass('HLRemoteEnvironment', smalltalk.HLEnvironment, [], 'Helios-Environments');
- smalltalk.addMethod(
- "_eval_on_",
- smalltalk.method({
- selector: "eval:on:",
- category: 'actions',
- fn: function (someCode,aReceiver){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
_st(self)._notYetImplemented();
- return self}, function($ctx1) {$ctx1.fill(self,"eval:on:",{someCode:someCode,aReceiver:aReceiver}, smalltalk.HLRemoteEnvironment)})},
- args: ["someCode", "aReceiver"],
- source: "eval: someCode on: aReceiver\x0a\x0a\x09\x22Note for future self and friends:\x0a whatever way this compilation happens on the other side, \x0a it should return a proxy to the remote resulting object\x22\x0a \x0a self notYetImplemented",
- messageSends: ["notYetImplemented"],
- referencedClasses: []
- }),
- smalltalk.HLRemoteEnvironment);
- smalltalk.addMethod(
- "_packages",
- smalltalk.method({
- selector: "packages",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
return self}, function($ctx1) {$ctx1.fill(self,"packages",{}, smalltalk.HLRemoteEnvironment)})},
- args: [],
- source: "packages\x0a\x09\x22Answer the remote environment's packages\x22\x0a \x0a\x09\x22to-do\x22\x0a \x0a \x22Note for future self and friends:\x0a the problem with remote stuff is that the answers shouldn't be expected to be\x0a received in a syncrhonous fashion. Everything network is asyc, so you *are going to deal with callbacks* here\x22",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.HLRemoteEnvironment);
- smalltalk.addClass('HLRemoteObject', smalltalk.Object, [], 'Helios-Environments');
- smalltalk.HLRemoteObject.comment="This is a local proxy to a remote object.\x0aTipically useful for evaluating and inspecting and interacting with instances of a remote VM.\x0a"
- smalltalk.addMethod(
- "_doesNotUnderstand_",
- smalltalk.method({
- selector: "doesNotUnderstand:",
- category: 'actions',
- fn: function (aMessage){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
return self}, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage}, smalltalk.HLRemoteObject)})},
- args: ["aMessage"],
- source: "doesNotUnderstand: aMessage\x0a\x0a\x09\x22to-do\x0a\x0a\x09aham, blah blah\x0a\x0a\x09super doesNotUnderstand: aMessage\x22",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.HLRemoteObject);
- smalltalk.addMethod(
- "_inspectOn_",
- smalltalk.method({
- selector: "inspectOn:",
- category: 'actions',
- fn: function (anInspector){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
return self}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector}, smalltalk.HLRemoteObject)})},
- args: ["anInspector"],
- source: "inspectOn: anInspector\x0a\x0a\x09\x22to-do\x22\x0a\x0a\x09\x22this is a source of so much fun...\x22\x0a",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.HLRemoteObject);
- smalltalk.addMethod(
- "_printString",
- smalltalk.method({
- selector: "printString",
- category: 'actions',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
return "this is a remote object";
- }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.HLRemoteObject)})},
- args: [],
- source: "printString\x0a\x09^ 'this is a remote object'",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.HLRemoteObject);
- smalltalk.addMethod(
- "_adoptMethod_",
- smalltalk.method({
- selector: "adoptMethod:",
- category: '*Helios-Environments',
- fn: function (aMethod){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $1,$2;
- $1=self;
- _st($1)._compile_(_st(aMethod)._source());
- $2=_st($1)._category_(_st(aMethod)._protocol());
- return self}, function($ctx1) {$ctx1.fill(self,"adoptMethod:",{aMethod:aMethod},smalltalk.Behavior)})},
- args: ["aMethod"],
- source: "adoptMethod: aMethod\x0a\x09self \x0a\x09\x09compile: aMethod source;\x0a\x09\x09category: aMethod protocol.",
- messageSends: ["compile:", "source", "category:", "protocol"],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- "_forsakeMethod_",
- smalltalk.method({
- selector: "forsakeMethod:",
- category: '*Helios-Environments',
- fn: function (aMethod){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
_st(self)._removeCompiledMethod_(aMethod);
- return self}, function($ctx1) {$ctx1.fill(self,"forsakeMethod:",{aMethod:aMethod},smalltalk.Behavior)})},
- args: ["aMethod"],
- source: "forsakeMethod: aMethod\x0a\x09self removeCompiledMethod: aMethod",
- messageSends: ["removeCompiledMethod:"],
- referencedClasses: []
- }),
- smalltalk.Behavior);
|