Browse Source

More changes for Nemo (and Pharo compat.)

Nicolas Petton 11 years ago
parent
commit
7e32984d7a
6 changed files with 241 additions and 45 deletions
  1. 33 1
      js/Kernel-Classes.deploy.js
  2. 45 3
      js/Kernel-Classes.js
  3. 43 13
      js/Nemo.deploy.js
  4. 64 19
      js/Nemo.js
  5. 22 3
      st/Kernel-Classes.st
  6. 34 6
      st/Nemo.st

+ 33 - 1
js/Kernel-Classes.deploy.js

@@ -122,7 +122,12 @@ smalltalk.method({
 selector: "compile:category:",
 fn: function (aString, anotherString){
 var self=this;
-(function($rec){smalltalk.send($rec, "_install_forClass_category_", [aString, self, anotherString]);return smalltalk.send($rec, "_setupClass_", [self]);})(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []));
+var compiler=nil;
+var method=nil;
+(compiler=smalltalk.send((smalltalk.Compiler || Compiler), "_new", []));
+(method=smalltalk.send(compiler, "_install_forClass_category_", [aString, self, anotherString]));
+smalltalk.send(compiler, "_setupClass_", [self]);
+return smalltalk.send(method, "_selector", []);
 return self;}
 }),
 smalltalk.Behavior);
@@ -274,6 +279,17 @@ return self;}
 }),
 smalltalk.Behavior);
 
+smalltalk.addMethod(
+"_removeSelector_",
+smalltalk.method({
+selector: "removeSelector:",
+fn: function (aString){
+var self=this;
+smalltalk.send(self, "_removeCompiledMethod_", [smalltalk.send(self, "_methodAt_", [aString])]);
+return self;}
+}),
+smalltalk.Behavior);
+
 smalltalk.addMethod(
 "_subclasses",
 smalltalk.method({
@@ -444,6 +460,22 @@ smalltalk.Class);
 
 
 smalltalk.addClass('Metaclass', smalltalk.Behavior, [], 'Kernel-Classes');
+smalltalk.addMethod(
+"_definition",
+smalltalk.method({
+selector: "definition",
+fn: function (){
+var self=this;
+var stream=nil;
+(stream=smalltalk.send("", "_writeStream", []));
+(function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(self, "_asString", [])]);return smalltalk.send($rec, "_nextPutAll_", [" instanceVariableNames: '"]);})(stream);
+smalltalk.send(smalltalk.send(self, "_instanceVariableNames", []), "_do_separatedBy_", [(function(each){return smalltalk.send(stream, "_nextPutAll_", [each]);}), (function(){return smalltalk.send(stream, "_nextPutAll_", [" "]);})]);
+smalltalk.send(stream, "_nextPutAll_", ["'"]);
+return smalltalk.send(stream, "_contents", []);
+return self;}
+}),
+smalltalk.Metaclass);
+
 smalltalk.addMethod(
 "_instanceClass",
 smalltalk.method({

+ 45 - 3
js/Kernel-Classes.js

@@ -174,11 +174,16 @@ selector: "compile:category:",
 category: 'compiling',
 fn: function (aString, anotherString){
 var self=this;
-(function($rec){smalltalk.send($rec, "_install_forClass_category_", [aString, self, anotherString]);return smalltalk.send($rec, "_setupClass_", [self]);})(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []));
+var compiler=nil;
+var method=nil;
+(compiler=smalltalk.send((smalltalk.Compiler || Compiler), "_new", []));
+(method=smalltalk.send(compiler, "_install_forClass_category_", [aString, self, anotherString]));
+smalltalk.send(compiler, "_setupClass_", [self]);
+return smalltalk.send(method, "_selector", []);
 return self;},
 args: ["aString", "anotherString"],
-source: "compile: aString category: anotherString\x0a\x09Compiler new\x0a\x09\x09install: aString forClass: self category: anotherString;\x0a\x09\x09setupClass: self",
-messageSends: ["install:forClass:category:", "setupClass:", "new"],
+source: "compile: aString category: anotherString\x0a\x09| compiler method |\x0a\x09compiler := Compiler new.\x0a\x09method := compiler install: aString forClass: self category: anotherString.\x0a\x09compiler setupClass: self.\x0a\x09^ method selector",
+messageSends: ["new", "install:forClass:category:", "setupClass:", "selector"],
 referencedClasses: ["Compiler"]
 }),
 smalltalk.Behavior);
@@ -390,6 +395,22 @@ referencedClasses: []
 }),
 smalltalk.Behavior);
 
+smalltalk.addMethod(
+"_removeSelector_",
+smalltalk.method({
+selector: "removeSelector:",
+category: 'compiling',
+fn: function (aString){
+var self=this;
+smalltalk.send(self, "_removeCompiledMethod_", [smalltalk.send(self, "_methodAt_", [aString])]);
+return self;},
+args: ["aString"],
+source: "removeSelector: aString\x0a\x09self removeCompiledMethod: (self methodAt: aString)",
+messageSends: ["removeCompiledMethod:", "methodAt:"],
+referencedClasses: []
+}),
+smalltalk.Behavior);
+
 smalltalk.addMethod(
 "_subclasses",
 smalltalk.method({
@@ -632,6 +653,27 @@ smalltalk.Class);
 
 smalltalk.addClass('Metaclass', smalltalk.Behavior, [], 'Kernel-Classes');
 smalltalk.Metaclass.comment="Metaclass is the root of the class hierarchy.\x0a\x0aMetaclass instances are metaclasses, one for each real class. \x0aMetaclass instances have a single instance, which they hold onto, which is the class that they are the metaclass of."
+smalltalk.addMethod(
+"_definition",
+smalltalk.method({
+selector: "definition",
+category: 'accessing',
+fn: function (){
+var self=this;
+var stream=nil;
+(stream=smalltalk.send("", "_writeStream", []));
+(function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(self, "_asString", [])]);return smalltalk.send($rec, "_nextPutAll_", [" instanceVariableNames: '"]);})(stream);
+smalltalk.send(smalltalk.send(self, "_instanceVariableNames", []), "_do_separatedBy_", [(function(each){return smalltalk.send(stream, "_nextPutAll_", [each]);}), (function(){return smalltalk.send(stream, "_nextPutAll_", [" "]);})]);
+smalltalk.send(stream, "_nextPutAll_", ["'"]);
+return smalltalk.send(stream, "_contents", []);
+return self;},
+args: [],
+source: "definition\x0a\x09 | stream |\x0a\x09stream := '' writeStream.\x0a\x09stream \x0a\x09    nextPutAll: self asString;\x0a\x09    nextPutAll: ' instanceVariableNames: '''.\x0a\x09self instanceVariableNames\x0a\x09    do: [:each | stream nextPutAll: each]\x0a\x09    separatedBy: [stream nextPutAll: ' '].\x0a\x09stream nextPutAll: ''''.\x0a    ^stream contents",
+messageSends: ["writeStream", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames", "contents"],
+referencedClasses: []
+}),
+smalltalk.Metaclass);
+
 smalltalk.addMethod(
 "_instanceClass",
 smalltalk.method({

+ 43 - 13
js/Nemo.deploy.js

@@ -27,9 +27,9 @@ smalltalk.addMethod(
 "_createLocalSocketOn_",
 smalltalk.method({
 selector: "createLocalSocketOn:",
-fn: function (aPort){
-var self=this;
-return smalltalk.send(self, "_createSocketOn_", [smalltalk.send(smalltalk.send("ws://localhost:", "__comma", [smalltalk.send(aPort, "_asString", [])]), "__comma", ["/nemo"])]);
+fn: function (aPort){
+var self=this;
+return smalltalk.send(self, "_createSocketOn_", [smalltalk.send(smalltalk.send("ws://localhost:", "__comma", [smalltalk.send(aPort, "_asString", [])]), "__comma", ["/nemo"])]);
 return self;}
 }),
 smalltalk.NemoConnection);
@@ -38,11 +38,11 @@ smalltalk.addMethod(
 "_createSocketOn_",
 smalltalk.method({
 selector: "createSocketOn:",
-fn: function (uri){
-var self=this;
-(self['@socket']=new WebSocket(uri));
-smalltalk.send(self['@socket'], "_at_put_", ["onmessage", (function(message){return smalltalk.send(self, "_handleMessage_", [message]);})]);
-smalltalk.send(self['@socket'], "_at_put_", ["onerror", (function(err){return smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", [err]);})]);
+fn: function (uri){
+var self=this;
+(self['@socket']=new WebSocket(uri));
+smalltalk.send(self['@socket'], "_at_put_", ["onmessage", (function(message){return smalltalk.send(self, "_handleMessage_", [message]);})]);
+smalltalk.send(self['@socket'], "_at_put_", ["onerror", (function(err){return smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", [err]);})]);
 return self;}
 }),
 smalltalk.NemoConnection);
@@ -69,10 +69,7 @@ try{var string=nil;
 var result=nil;
 (string=smalltalk.send(aMessage, "_data", []));
 ((($receiver = smalltalk.send(string, "_isString", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return (function(){throw $early=[self]})();})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (function(){throw $early=[self]})();})]));
-smalltalk.send((smalltalk.Transcript || Transcript), "_show_", [string]);
-(result=smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []), "_evaluateExpression_", [string]));
-smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", [result]);
-smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", [smalltalk.send(result, "_asNemoString", [])]);
+smalltalk.send((function(){return (result=smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []), "_evaluateExpression_", [string]));}), "_on_do_", [(smalltalk.Error || Error), (function(ex){return (function(){throw $early=[smalltalk.send(self['@socket'], "_send_", [smalltalk.send(ex, "_asNemoString", [])])]})();})]);
 smalltalk.send(self['@socket'], "_send_", [smalltalk.send(result, "_asNemoString", [])]);
 return self;
 } catch(e) {if(e===$early)return e[0]; throw e}}
@@ -143,11 +140,22 @@ smalltalk.method({
 selector: "asNemo",
 fn: function (){
 var self=this;
-return (function($rec){smalltalk.send($rec, "_at_put_", ["name", smalltalk.send(self, "_name", [])]);smalltalk.send($rec, "_at_put_", ["superclass", (($receiver = smalltalk.send(self, "_superclass", [])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(smalltalk.send(self, "_superclass", []), "_name", []);})() : nil]);smalltalk.send($rec, "_at_put_", ["classComment", smalltalk.send(self, "_comment", [])]);smalltalk.send($rec, "_at_put_", ["definition", smalltalk.send(self, "_definition", [])]);smalltalk.send($rec, "_at_put_", ["package", smalltalk.send(self, "_category", [])]);return smalltalk.send($rec, "_asNemo", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
+return (function($rec){smalltalk.send($rec, "_at_put_", ["name", smalltalk.send(self, "_name", [])]);smalltalk.send($rec, "_at_put_", ["superclass", (($receiver = smalltalk.send(self, "_superclass", [])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(smalltalk.send(self, "_superclass", []), "_name", []);})() : nil]);smalltalk.send($rec, "_at_put_", ["classComment", smalltalk.send(self, "_comment", [])]);smalltalk.send($rec, "_at_put_", ["definition", smalltalk.send(self, "_definition", [])]);smalltalk.send($rec, "_at_put_", ["package", smalltalk.send(self, "_category", [])]);smalltalk.send($rec, "_at_put_", ["instVarNames", smalltalk.send(self, "_instanceVariableNames", [])]);return smalltalk.send($rec, "_asNemo", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
 return self;}
 }),
 smalltalk.Class);
 
+smalltalk.addMethod(
+"_asNemo",
+smalltalk.method({
+selector: "asNemo",
+fn: function (){
+var self=this;
+return (function($rec){smalltalk.send($rec, "_at_put_", ["definition", smalltalk.send(self, "_definition", [])]);smalltalk.send($rec, "_at_put_", ["instVarNames", smalltalk.send(self, "_instanceVariableNames", [])]);return smalltalk.send($rec, "_asNemo", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
+return self;}
+}),
+smalltalk.Metaclass);
+
 smalltalk.addMethod(
 "_asNemo",
 smalltalk.method({
@@ -195,6 +203,28 @@ return self;}
 }),
 smalltalk.String);
 
+smalltalk.addMethod(
+"_asNemo",
+smalltalk.method({
+selector: "asNemo",
+fn: function (){
+var self=this;
+return (function($rec){smalltalk.send($rec, "_at_put_", ["name", smalltalk.send(self, "_selector", [])]);smalltalk.send($rec, "_at_put_", ["protocol", smalltalk.send(self, "_category", [])]);smalltalk.send($rec, "_at_put_", ["sourceCode", smalltalk.send(self, "_source", [])]);smalltalk.send($rec, "_at_put_", ["compiledSource", smalltalk.send(smalltalk.send(self, "_fn", []), "_compiledSource", [])]);smalltalk.send($rec, "_at_put_", ["messageSends", smalltalk.send(self, "_messageSends", [])]);return smalltalk.send($rec, "_asNemo", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
+return self;}
+}),
+smalltalk.CompiledMethod);
+
+smalltalk.addMethod(
+"_asNemo",
+smalltalk.method({
+selector: "asNemo",
+fn: function (){
+var self=this;
+return (function($rec){smalltalk.send($rec, "_at_put_", ["error", smalltalk.send(self, "_messageText", [])]);return smalltalk.send($rec, "_asNemo", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
+return self;}
+}),
+smalltalk.Error);
+
 smalltalk.addMethod(
 "_asNemo",
 smalltalk.method({

+ 64 - 19
js/Nemo.js

@@ -38,12 +38,12 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "createLocalSocketOn:",
 category: 'not yet classified',
-fn: function (aPort){
-var self=this;
-return smalltalk.send(self, "_createSocketOn_", [smalltalk.send(smalltalk.send("ws://localhost:", "__comma", [smalltalk.send(aPort, "_asString", [])]), "__comma", ["/nemo"])]);
+fn: function (aPort){
+var self=this;
+return smalltalk.send(self, "_createSocketOn_", [smalltalk.send(smalltalk.send("ws://localhost:", "__comma", [smalltalk.send(aPort, "_asString", [])]), "__comma", ["/nemo"])]);
 return self;},
 args: ["aPort"],
-source: "createLocalSocketOn: aPort\x0a\x0a\x09^ self createSocketOn: 'ws://localhost:',aPort asString,'/nemo'",
+source: "createLocalSocketOn: aPort\x0a\x0a\x09^ self createSocketOn: 'ws://localhost:', aPort asString, '/nemo'",
 messageSends: ["createSocketOn:", ",", "asString"],
 referencedClasses: []
 }),
@@ -54,11 +54,11 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "createSocketOn:",
 category: 'not yet classified',
-fn: function (uri){
-var self=this;
-(self['@socket']=new WebSocket(uri));
-smalltalk.send(self['@socket'], "_at_put_", ["onmessage", (function(message){return smalltalk.send(self, "_handleMessage_", [message]);})]);
-smalltalk.send(self['@socket'], "_at_put_", ["onerror", (function(err){return smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", [err]);})]);
+fn: function (uri){
+var self=this;
+(self['@socket']=new WebSocket(uri));
+smalltalk.send(self['@socket'], "_at_put_", ["onmessage", (function(message){return smalltalk.send(self, "_handleMessage_", [message]);})]);
+smalltalk.send(self['@socket'], "_at_put_", ["onerror", (function(err){return smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", [err]);})]);
 return self;},
 args: ["uri"],
 source: "createSocketOn: uri\x0a\x09socket := <new WebSocket(uri)>.\x0a\x09socket at: 'onmessage' put: [ :message | self handleMessage: message ].\x0a\x09socket at: 'onerror' put: [ :err | console log: err ]",
@@ -95,17 +95,14 @@ try{var string=nil;
 var result=nil;
 (string=smalltalk.send(aMessage, "_data", []));
 ((($receiver = smalltalk.send(string, "_isString", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return (function(){throw $early=[self]})();})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (function(){throw $early=[self]})();})]));
-smalltalk.send((smalltalk.Transcript || Transcript), "_show_", [string]);
-(result=smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []), "_evaluateExpression_", [string]));
-smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", [result]);
-smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", [smalltalk.send(result, "_asNemoString", [])]);
+smalltalk.send((function(){return (result=smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []), "_evaluateExpression_", [string]));}), "_on_do_", [(smalltalk.Error || Error), (function(ex){return (function(){throw $early=[smalltalk.send(self['@socket'], "_send_", [smalltalk.send(ex, "_asNemoString", [])])]})();})]);
 smalltalk.send(self['@socket'], "_send_", [smalltalk.send(result, "_asNemoString", [])]);
 return self;
 } catch(e) {if(e===$early)return e[0]; throw e}},
 args: ["aMessage"],
-source: "handleMessage: aMessage\x0a\x09| string result |\x0a\x0a\x09string := aMessage data.\x0a\x09string isString ifFalse: [ ^ self ].\x0a\x0a\x09Transcript show: string.\x0a\x0a\x09result := Compiler new evaluateExpression: string.\x0a\x09console log: result.\x0a\x09console log: result asNemoString.\x0a\x09socket send: result asNemoString",
-messageSends: ["data", "ifFalse:", "isString", "show:", "evaluateExpression:", "new", "log:", "asNemoString", "send:"],
-referencedClasses: ["Transcript", "Compiler"]
+source: "handleMessage: aMessage\x0a\x09| string result |\x0a\x0a\x09string := aMessage data.\x0a\x09string isString ifFalse: [ ^ self ].\x0a\x0a\x09[ result := Compiler new evaluateExpression: string ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :ex | ^ socket send: ex asNemoString ].\x0a\x09socket send: result asNemoString",
+messageSends: ["data", "ifFalse:", "isString", "on:do:", "evaluateExpression:", "new", "send:", "asNemoString"],
+referencedClasses: ["Compiler", "Error"]
 }),
 smalltalk.NemoConnection);
 
@@ -199,15 +196,31 @@ selector: "asNemo",
 category: '*Nemo',
 fn: function (){
 var self=this;
-return (function($rec){smalltalk.send($rec, "_at_put_", ["name", smalltalk.send(self, "_name", [])]);smalltalk.send($rec, "_at_put_", ["superclass", (($receiver = smalltalk.send(self, "_superclass", [])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(smalltalk.send(self, "_superclass", []), "_name", []);})() : nil]);smalltalk.send($rec, "_at_put_", ["classComment", smalltalk.send(self, "_comment", [])]);smalltalk.send($rec, "_at_put_", ["definition", smalltalk.send(self, "_definition", [])]);smalltalk.send($rec, "_at_put_", ["package", smalltalk.send(self, "_category", [])]);return smalltalk.send($rec, "_asNemo", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
+return (function($rec){smalltalk.send($rec, "_at_put_", ["name", smalltalk.send(self, "_name", [])]);smalltalk.send($rec, "_at_put_", ["superclass", (($receiver = smalltalk.send(self, "_superclass", [])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(smalltalk.send(self, "_superclass", []), "_name", []);})() : nil]);smalltalk.send($rec, "_at_put_", ["classComment", smalltalk.send(self, "_comment", [])]);smalltalk.send($rec, "_at_put_", ["definition", smalltalk.send(self, "_definition", [])]);smalltalk.send($rec, "_at_put_", ["package", smalltalk.send(self, "_category", [])]);smalltalk.send($rec, "_at_put_", ["instVarNames", smalltalk.send(self, "_instanceVariableNames", [])]);return smalltalk.send($rec, "_asNemo", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
 return self;},
 args: [],
-source: "asNemo\x0a\x09^ Dictionary new\x0a\x09\x09at: 'name' put: self name;\x0a\x09\x09at: 'superclass' put: (self superclass ifNotNil: [ self superclass name ]);\x0a\x09\x09at: 'classComment' put: self comment;\x0a\x09\x09at: 'definition' put: self definition;\x0a\x09\x09at: 'package' put: self category;\x0a\x09\x09asNemo",
-messageSends: ["at:put:", "name", "ifNotNil:", "superclass", "comment", "definition", "category", "asNemo", "new"],
+source: "asNemo\x0a\x09^ Dictionary new\x0a\x09\x09at: 'name' put: self name;\x0a\x09\x09at: 'superclass' put: (self superclass ifNotNil: [ self superclass name ]);\x0a\x09\x09at: 'classComment' put: self comment;\x0a\x09\x09at: 'definition' put: self definition;\x0a\x09\x09at: 'package' put: self category;\x0a\x09\x09at: 'instVarNames' put: self instanceVariableNames;\x0a\x09\x09asNemo",
+messageSends: ["at:put:", "name", "ifNotNil:", "superclass", "comment", "definition", "category", "instanceVariableNames", "asNemo", "new"],
 referencedClasses: ["Dictionary"]
 }),
 smalltalk.Class);
 
+smalltalk.addMethod(
+"_asNemo",
+smalltalk.method({
+selector: "asNemo",
+category: '*Nemo',
+fn: function (){
+var self=this;
+return (function($rec){smalltalk.send($rec, "_at_put_", ["definition", smalltalk.send(self, "_definition", [])]);smalltalk.send($rec, "_at_put_", ["instVarNames", smalltalk.send(self, "_instanceVariableNames", [])]);return smalltalk.send($rec, "_asNemo", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
+return self;},
+args: [],
+source: "asNemo\x0a\x09^ Dictionary new\x0a\x09\x09at: 'definition' put: self definition;\x0a\x09\x09at: 'instVarNames' put: self instanceVariableNames;\x0a\x09\x09asNemo",
+messageSends: ["at:put:", "definition", "instanceVariableNames", "asNemo", "new"],
+referencedClasses: ["Dictionary"]
+}),
+smalltalk.Metaclass);
+
 smalltalk.addMethod(
 "_asNemo",
 smalltalk.method({
@@ -275,6 +288,38 @@ referencedClasses: []
 }),
 smalltalk.String);
 
+smalltalk.addMethod(
+"_asNemo",
+smalltalk.method({
+selector: "asNemo",
+category: '*Nemo',
+fn: function (){
+var self=this;
+return (function($rec){smalltalk.send($rec, "_at_put_", ["name", smalltalk.send(self, "_selector", [])]);smalltalk.send($rec, "_at_put_", ["protocol", smalltalk.send(self, "_category", [])]);smalltalk.send($rec, "_at_put_", ["sourceCode", smalltalk.send(self, "_source", [])]);smalltalk.send($rec, "_at_put_", ["compiledSource", smalltalk.send(smalltalk.send(self, "_fn", []), "_compiledSource", [])]);smalltalk.send($rec, "_at_put_", ["messageSends", smalltalk.send(self, "_messageSends", [])]);return smalltalk.send($rec, "_asNemo", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
+return self;},
+args: [],
+source: "asNemo\x0a\x09^ Dictionary new\x0a\x09\x09at: 'name' put: self selector;\x0a\x09\x09at: 'protocol' put: self category;\x0a\x09\x09at: 'sourceCode' put: self source;\x0a\x09\x09at: 'compiledSource' put: self fn compiledSource;\x0a\x09\x09at: 'messageSends' put: self messageSends;\x0a\x09\x09asNemo",
+messageSends: ["at:put:", "selector", "category", "source", "compiledSource", "fn", "messageSends", "asNemo", "new"],
+referencedClasses: ["Dictionary"]
+}),
+smalltalk.CompiledMethod);
+
+smalltalk.addMethod(
+"_asNemo",
+smalltalk.method({
+selector: "asNemo",
+category: '*Nemo',
+fn: function (){
+var self=this;
+return (function($rec){smalltalk.send($rec, "_at_put_", ["error", smalltalk.send(self, "_messageText", [])]);return smalltalk.send($rec, "_asNemo", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
+return self;},
+args: [],
+source: "asNemo\x0a\x09^ Dictionary new\x0a\x09\x09at: 'error' put: self messageText;\x0a\x09\x09asNemo",
+messageSends: ["at:put:", "messageText", "asNemo", "new"],
+referencedClasses: ["Dictionary"]
+}),
+smalltalk.Error);
+
 smalltalk.addMethod(
 "_asNemo",
 smalltalk.method({

+ 22 - 3
st/Kernel-Classes.st

@@ -130,15 +130,21 @@ compile: aString
 !
 
 compile: aString category: anotherString
-	Compiler new
-		install: aString forClass: self category: anotherString;
-		setupClass: self
+	| compiler method |
+	compiler := Compiler new.
+	method := compiler install: aString forClass: self category: anotherString.
+	compiler setupClass: self.
+	^ method selector
 !
 
 removeCompiledMethod: aMethod
 	<delete self.fn.prototype[aMethod.selector._asSelector()];
 	delete self.fn.prototype.methods[aMethod.selector];
 	smalltalk.init(self);>
+!
+
+removeSelector: aString
+	self removeCompiledMethod: (self methodAt: aString)
 ! !
 
 !Behavior methodsFor: 'instance creation'!
@@ -259,6 +265,19 @@ Metaclass instances have a single instance, which they hold onto, which is the c
 
 !Metaclass methodsFor: 'accessing'!
 
+definition
+	 | stream |
+	stream := '' writeStream.
+	stream 
+	    nextPutAll: self asString;
+	    nextPutAll: ' instanceVariableNames: '''.
+	self instanceVariableNames
+	    do: [:each | stream nextPutAll: each]
+	    separatedBy: [stream nextPutAll: ' '].
+	stream nextPutAll: ''''.
+    ^stream contents
+!
+
 instanceClass
 	<return self.instanceClass>
 !

+ 34 - 6
st/Nemo.st

@@ -17,7 +17,7 @@ createDefaultSocket
 
 createLocalSocketOn: aPort
 
-	^ self createSocketOn: 'ws://localhost:',aPort asString,'/nemo'
+	^ self createSocketOn: 'ws://localhost:', aPort asString, '/nemo'
 !
 
 createSocketOn: uri
@@ -37,11 +37,9 @@ handleMessage: aMessage
 	string := aMessage data.
 	string isString ifFalse: [ ^ self ].
 
-	Transcript show: string.
-
-	result := Compiler new evaluateExpression: string.
-	console log: result.
-	console log: result asNemoString.
+	[ result := Compiler new evaluateExpression: string ]
+		on: Error
+		do: [ :ex | ^ socket send: ex asNemoString ].
 	socket send: result asNemoString
 !
 
@@ -81,6 +79,16 @@ asNemo
 		at: 'classComment' put: self comment;
 		at: 'definition' put: self definition;
 		at: 'package' put: self category;
+		at: 'instVarNames' put: self instanceVariableNames;
+		asNemo
+! !
+
+!Metaclass methodsFor: '*Nemo'!
+
+asNemo
+	^ Dictionary new
+		at: 'definition' put: self definition;
+		at: 'instVarNames' put: self instanceVariableNames;
 		asNemo
 ! !
 
@@ -112,6 +120,26 @@ asNemo
 	^ self
 ! !
 
+!CompiledMethod methodsFor: '*Nemo'!
+
+asNemo
+	^ Dictionary new
+		at: 'name' put: self selector;
+		at: 'protocol' put: self category;
+		at: 'sourceCode' put: self source;
+		at: 'compiledSource' put: self fn compiledSource;
+		at: 'messageSends' put: self messageSends;
+		asNemo
+! !
+
+!Error methodsFor: '*Nemo'!
+
+asNemo
+	^ Dictionary new
+		at: 'error' put: self messageText;
+		asNemo
+! !
+
 !Package methodsFor: '*Nemo'!
 
 asNemo