Browse Source

Merge remote branch 'upstream/master'

Göran Krampe 13 years ago
parent
commit
c25188a6b9
13 changed files with 449 additions and 419 deletions
  1. 5 5
      js/Benchfib.js
  2. 24 24
      js/Canvas.js
  3. 32 14
      js/Compiler.js
  4. 11 11
      js/IDE.js
  5. 112 126
      js/Kernel.js
  6. 16 16
      js/Parser.js
  7. 38 6
      js/boot.js
  8. 5 5
      st/Benchfib.st
  9. 24 24
      st/Canvas.st
  10. 11 4
      st/Compiler.st
  11. 12 12
      st/IDE.st
  12. 155 168
      st/Kernel.st
  13. 4 4
      st/Parser.st

+ 5 - 5
js/Benchfib.js

@@ -9,10 +9,10 @@ fn: function (){
 var self=this;
 var result=nil;
 result=smalltalk.send((0), "_tinyBenchmarks", []);
-console.log('0 tinyBenchmarks => ' + result);;
+smalltalk.send(console, "_log_", [smalltalk.send(unescape("0%20tinyBenchmarks%20%3D%3E%20"), "__plus", [result])]);
 return self;},
-source: unescape('main%0A%0A%09%7C%20result%20%7C%0A%09result%20%3A%3D%200%20tinyBenchmarks.%0A%09%7B%27console.log%28%27%270%20tinyBenchmarks%20%3D%3E%20%27%27%20+%20result%29%3B%27%7D'),
-messageSends: ["tinyBenchmarks"],
+source: unescape('main%0A%0A%09%7C%20result%20%7C%0A%09result%20%3A%3D%200%20tinyBenchmarks.%0A%09console%20log%3A%20%270%20tinyBenchmarks%20%3D%3E%20%27%20+%20result'),
+messageSends: ["tinyBenchmarks", "log:", unescape("+")],
 referencedClasses: []
 }),
 smalltalk.Benchfib.klass);
@@ -91,7 +91,7 @@ return 1;
 } else {
 return (this-1)._jsbenchFib() + (this-2)._jsbenchFib() + 1;};
 return self;},
-source: unescape('jsbenchFib%0A%20%0A%09%7B%27if%20%28this%20%3C%202%29%20%7B%0Areturn%201%3B%0A%7D%20else%20%7B%0Areturn%20%28this-1%29._jsbenchFib%28%29%20+%20%28this-2%29._jsbenchFib%28%29%20+%201%3B%7D%27%7D'),
+source: unescape('jsbenchFib%0A%20%0A%09%3Cif%20%28this%20%3C%202%29%20%7B%0Areturn%201%3B%0A%7D%20else%20%7B%0Areturn%20%28this-1%29._jsbenchFib%28%29%20+%20%28this-2%29._jsbenchFib%28%29%20+%201%3B%7D%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -127,7 +127,7 @@ for (var z=0;z<this;z++) {
 }
 return count;
 return self;},
-source: unescape('jsbenchmark%0A%0A%7B%27%0Avar%20size%20%3D%208190%3B%0Avar%20count%3B%0Afor%20%28var%20z%3D0%3Bz%3Cthis%3Bz++%29%20%7B%0A%20%20count%20%3D%200%3B%0A%20%20var%20flags%20%3D%20new%20Array%28%29%3B%0A%20%20for%20%28var%20p%3D0%3B%20p%3Csize%3B%20p++%29%20%7B%0A%20%20%20%20flags%5Bp%5D%20%3D%20true%3B%0A%20%20%7D%0A%20%20for%20%28var%20i%3D1%3Bi%3C%3Dsize%3Bi++%29%20%7B%0A%20%20%20%20if%20%28flags%5Bi-1%5D%29%20%7B%0A%20%20%20%20%20%20var%20prime%20%3D%20i+1%3B%0A%20%20%20%20%20%20var%20k%20%3D%20i%20+%20prime%3B%0A%20%20%20%20%20%20while%20%28k%20%3C%3D%20size%29%20%7B%0A%20%20%20%20%20%20%20%20flags%5Bk-1%5D%20%3D%20false%3B%0A%20%20%20%20%20%20%20%20k%20%3D%20k%20+%20prime%3B%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20count%20%3D%20count%20+%201%3B%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D%0Areturn%20count%27%7D%0A'),
+source: unescape('jsbenchmark%0A%0A%3C%0Avar%20size%20%3D%208190%3B%0Avar%20count%3B%0Afor%20%28var%20z%3D0%3Bz%3Cthis%3Bz++%29%20%7B%0A%20%20count%20%3D%200%3B%0A%20%20var%20flags%20%3D%20new%20Array%28%29%3B%0A%20%20for%20%28var%20p%3D0%3B%20p%3Csize%3B%20p++%29%20%7B%0A%20%20%20%20flags%5Bp%5D%20%3D%20true%3B%0A%20%20%7D%0A%20%20for%20%28var%20i%3D1%3Bi%3C%3Dsize%3Bi++%29%20%7B%0A%20%20%20%20if%20%28flags%5Bi-1%5D%29%20%7B%0A%20%20%20%20%20%20var%20prime%20%3D%20i+1%3B%0A%20%20%20%20%20%20var%20k%20%3D%20i%20+%20prime%3B%0A%20%20%20%20%20%20while%20%28k%20%3C%3D%20size%29%20%7B%0A%20%20%20%20%20%20%20%20flags%5Bk-1%5D%20%3D%20false%3B%0A%20%20%20%20%20%20%20%20k%20%3D%20k%20+%20prime%3B%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20count%20%3D%20count%20+%201%3B%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D%0Areturn%20count%3E'),
 messageSends: [],
 referencedClasses: []
 }),

+ 24 - 24
js/Canvas.js

@@ -8,7 +8,7 @@ fn: function (aString){
 var self=this;
 self.fillStyle = String(aString);
 return self;},
-source: unescape('fillStyle%3A%20aString%0A%09%7B%27self.fillStyle%20%3D%20String%28aString%29%27%7D'),
+source: unescape('fillStyle%3A%20aString%0A%09%3Cself.fillStyle%20%3D%20String%28aString%29%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -23,7 +23,7 @@ fn: function (){
 var self=this;
 self.beginPath();
 return self;},
-source: unescape('beginPath%0A%09%7B%27self.beginPath%28%29%27%7D'),
+source: unescape('beginPath%0A%09%3Cself.beginPath%28%29%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -38,7 +38,7 @@ fn: function (){
 var self=this;
 self.closePath();
 return self;},
-source: unescape('closePath%0A%09%7B%27self.closePath%28%29%27%7D'),
+source: unescape('closePath%0A%09%3Cself.closePath%28%29%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -53,7 +53,7 @@ fn: function (){
 var self=this;
 self.fill();
 return self;},
-source: unescape('fill%0A%09%7B%27self.fill%28%29%27%7D'),
+source: unescape('fill%0A%09%3Cself.fill%28%29%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -68,7 +68,7 @@ fn: function (){
 var self=this;
 self.stroke();
 return self;},
-source: unescape('stroke%0A%09%7B%27self.stroke%28%29%27%7D'),
+source: unescape('stroke%0A%09%3Cself.stroke%28%29%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -83,7 +83,7 @@ fn: function (aPoint){
 var self=this;
 self.moveTo(aPoint._x(), aPoint._y());
 return self;},
-source: unescape('moveTo%3A%20aPoint%0A%09%7B%27self.moveTo%28aPoint._x%28%29%2C%20aPoint._y%28%29%29%27%7D'),
+source: unescape('moveTo%3A%20aPoint%0A%09%3Cself.moveTo%28aPoint._x%28%29%2C%20aPoint._y%28%29%29%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -98,7 +98,7 @@ fn: function (aPoint){
 var self=this;
 self.lineTo(aPoint._x(), aPoint._y());
 return self;},
-source: unescape('lineTo%3A%20aPoint%0A%09%7B%27self.lineTo%28aPoint._x%28%29%2C%20aPoint._y%28%29%29%27%7D'),
+source: unescape('lineTo%3A%20aPoint%0A%09%3Cself.lineTo%28aPoint._x%28%29%2C%20aPoint._y%28%29%29%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -113,7 +113,7 @@ fn: function (aPoint, aNumber, aNumber2, aNumber3, aBoolean){
 var self=this;
 self.arc(aPoint._x(), aPoint._y(), aNumber, aNumber2, aNumber3, aBoolean);
 return self;},
-source: unescape('arcTo%3A%20aPoint%20radius%3A%20aNumber%20startAngle%3A%20aNumber2%20endAngle%3A%20aNumber3%20anticlockwise%3A%20aBoolean%0A%09%7B%27self.arc%28aPoint._x%28%29%2C%20aPoint._y%28%29%2C%20aNumber%2C%20aNumber2%2C%20aNumber3%2C%20aBoolean%29%27%7D'),
+source: unescape('arcTo%3A%20aPoint%20radius%3A%20aNumber%20startAngle%3A%20aNumber2%20endAngle%3A%20aNumber3%20anticlockwise%3A%20aBoolean%0A%09%3Cself.arc%28aPoint._x%28%29%2C%20aPoint._y%28%29%2C%20aNumber%2C%20aNumber2%2C%20aNumber3%2C%20aBoolean%29%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -143,7 +143,7 @@ fn: function (aPoint, anotherPoint){
 var self=this;
 self.fillRect(aPoint._x(), aPoint._y(), anotherPoint._x(), anotherPoint._y());
 return self;},
-source: unescape('fillRectFrom%3A%20aPoint%20to%3A%20anotherPoint%0A%09%7B%27self.fillRect%28aPoint._x%28%29%2C%20aPoint._y%28%29%2C%20anotherPoint._x%28%29%2C%20anotherPoint._y%28%29%29%27%7D'),
+source: unescape('fillRectFrom%3A%20aPoint%20to%3A%20anotherPoint%0A%09%3Cself.fillRect%28aPoint._x%28%29%2C%20aPoint._y%28%29%2C%20anotherPoint._x%28%29%2C%20anotherPoint._y%28%29%29%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -158,7 +158,7 @@ fn: function (aPoint, anotherPoint){
 var self=this;
 self.strokeRect(aPoint._x(), aPoint._y(), anotherPoint._x(), anotherPoint._y());
 return self;},
-source: unescape('strokeRectFrom%3A%20aPoint%20to%3A%20anotherPoint%0A%09%7B%27self.strokeRect%28aPoint._x%28%29%2C%20aPoint._y%28%29%2C%20anotherPoint._x%28%29%2C%20anotherPoint._y%28%29%29%27%7D'),
+source: unescape('strokeRectFrom%3A%20aPoint%20to%3A%20anotherPoint%0A%09%3Cself.strokeRect%28aPoint._x%28%29%2C%20aPoint._y%28%29%2C%20anotherPoint._x%28%29%2C%20anotherPoint._y%28%29%29%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -173,7 +173,7 @@ fn: function (aPoint, anotherPoint){
 var self=this;
 self.fillRect(aPoint._x(), aPoint._y(), anotherPoint._x(), anotherPoint._y());
 return self;},
-source: unescape('clearRectFrom%3A%20aPoint%20to%3A%20anotherPoint%0A%09%7B%27self.fillRect%28aPoint._x%28%29%2C%20aPoint._y%28%29%2C%20anotherPoint._x%28%29%2C%20anotherPoint._y%28%29%29%27%7D'),
+source: unescape('clearRectFrom%3A%20aPoint%20to%3A%20anotherPoint%0A%09%3Cself.fillRect%28aPoint._x%28%29%2C%20aPoint._y%28%29%2C%20anotherPoint._x%28%29%2C%20anotherPoint._y%28%29%29%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -188,7 +188,7 @@ fn: function (aString){
 var self=this;
 self.strokeStyle = String(aString);
 return self;},
-source: unescape('strokeStyle%3A%20aString%0A%09%7B%27self.strokeStyle%20%3D%20String%28aString%29%27%7D'),
+source: unescape('strokeStyle%3A%20aString%0A%09%3Cself.strokeStyle%20%3D%20String%28aString%29%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -203,7 +203,7 @@ fn: function (aNumber){
 var self=this;
 self.lineWidth = aNumber;
 return self;},
-source: unescape('lineWidth%3A%20aNumber%0A%09%7B%27self.lineWidth%20%3D%20aNumber%27%7D'),
+source: unescape('lineWidth%3A%20aNumber%0A%09%3Cself.lineWidth%20%3D%20aNumber%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -219,7 +219,7 @@ fn: function (aTagBrush){
 var self=this;
 return aTagBrush._element().getContext('2d');
 return self;},
-source: unescape('tagBrush%3A%20aTagBrush%0A%09%7B%27return%20aTagBrush._element%28%29.getContext%28%27%272d%27%27%29%27%7D'),
+source: unescape('tagBrush%3A%20aTagBrush%0A%09%3Creturn%20aTagBrush._element%28%29.getContext%28%272d%27%29%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -801,7 +801,7 @@ fn: function (anElement){
 var self=this;
 self['@element'].appendChild(anElement);
 return self;},
-source: unescape('appendChild%3A%20anElement%0A%20%20%20%20%7B%27self%5B%27%27@element%27%27%5D.appendChild%28anElement%29%27%7D'),
+source: unescape('appendChild%3A%20anElement%0A%20%20%20%20%3Cself%5B%27@element%27%5D.appendChild%28anElement%29%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -831,7 +831,7 @@ fn: function (aString, aValue){
 var self=this;
 self['@element'].setAttribute(aString, aValue);
 return self;},
-source: unescape('at%3A%20aString%20put%3A%20aValue%0A%20%20%20%20%7B%27self%5B%27%27@element%27%27%5D.setAttribute%28aString%2C%20aValue%29%27%7D'),
+source: unescape('at%3A%20aString%20put%3A%20aValue%0A%20%20%20%20%3Cself%5B%27@element%27%5D.setAttribute%28aString%2C%20aValue%29%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -846,7 +846,7 @@ fn: function (aString){
 var self=this;
 self['@element'].removeAttribute(aString);
 return self;},
-source: unescape('removeAt%3A%20aString%0A%20%20%20%20%7B%27self%5B%27%27@element%27%27%5D.removeAttribute%28aString%29%27%7D'),
+source: unescape('removeAt%3A%20aString%0A%20%20%20%20%3Cself%5B%27@element%27%5D.removeAttribute%28aString%29%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -982,7 +982,7 @@ fn: function (){
 var self=this;
 return smalltalk.JQuery._from_(jQuery(self['@element']));
 return self;},
-source: unescape('asJQuery%0A%09%7B%27return%20smalltalk.JQuery._from_%28jQuery%28self%5B%27%27@element%27%27%5D%29%29%27%7D'),
+source: unescape('asJQuery%0A%09%3Creturn%20smalltalk.JQuery._from_%28jQuery%28self%5B%27@element%27%5D%29%29%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -1117,7 +1117,7 @@ fn: function (aString){
 var self=this;
 return document.createElement(String(aString));
 return self;},
-source: unescape('createElementFor%3A%20aString%0A%09%7B%27return%20document.createElement%28String%28aString%29%29%27%7D'),
+source: unescape('createElementFor%3A%20aString%0A%09%3Creturn%20document.createElement%28String%28aString%29%29%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -1132,7 +1132,7 @@ fn: function (aString){
 var self=this;
 return document.createTextNode(String(aString));
 return self;},
-source: unescape('createTextNodeFor%3A%20aString%0A%09%7B%27return%20document.createTextNode%28String%28aString%29%29%27%7D'),
+source: unescape('createTextNodeFor%3A%20aString%0A%09%3Creturn%20document.createTextNode%28String%28aString%29%29%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -1211,7 +1211,7 @@ fn: function (aString){
 var self=this;
 alert(aString);
 return self;},
-source: unescape('alert%3A%20aString%0A%20%20%20%20%7B%27alert%28aString%29%27%7D'),
+source: unescape('alert%3A%20aString%0A%20%20%20%20%3Calert%28aString%29%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -1226,7 +1226,7 @@ fn: function (aString){
 var self=this;
 return window.confirm(aString);
 return self;},
-source: unescape('confirm%3A%20aString%0A%20%20%20%20%7B%27return%20window.confirm%28aString%29%27%7D'),
+source: unescape('confirm%3A%20aString%0A%20%20%20%20%3Creturn%20window.confirm%28aString%29%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -1256,7 +1256,7 @@ fn: function (aString, anotherString){
 var self=this;
 return window.prompt(aString, anotherString);
 return self;},
-source: unescape('prompt%3A%20aString%20default%3A%20anotherString%0A%20%20%20%20%7B%27return%20window.prompt%28aString%2C%20anotherString%29%27%7D'),
+source: unescape('prompt%3A%20aString%20default%3A%20anotherString%0A%20%20%20%20%3Creturn%20window.prompt%28aString%2C%20anotherString%29%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -1326,7 +1326,7 @@ fn: function (){
 var self=this;
 return document.createElement('canvas');
 return self;},
-source: unescape('createElement%0A%09%7B%27return%20document.createElement%28%27%27canvas%27%27%29%27%7D'),
+source: unescape('createElement%0A%09%3Creturn%20document.createElement%28%27canvas%27%29%3E'),
 messageSends: [],
 referencedClasses: []
 }),

+ 32 - 14
js/Compiler.js

@@ -288,7 +288,7 @@ return (function($rec){smalltalk.send($rec, "_receiver_", [smalltalk.send(self,
 return self;},
 source: unescape('cascadeNodeWithMessages%3A%20aCollection%0A%09%7C%20first%20%7C%0A%09first%20%3A%3D%20SendNode%20new%0A%09%20%20%20%20selector%3A%20self%20selector%3B%0A%09%20%20%20%20arguments%3A%20self%20arguments%3B%0A%09%20%20%20%20yourself.%0A%09%5ECascadeNode%20new%0A%09%20%20%20%20receiver%3A%20self%20receiver%3B%0A%09%20%20%20%20nodes%3A%20%28Array%20with%3A%20first%29%2C%20aCollection%3B%0A%09%20%20%20%20yourself'),
 messageSends: ["selector:", "selector", "arguments:", "arguments", "yourself", "new", "receiver:", "receiver", "nodes:", unescape("%2C"), "with:"],
-referencedClasses: [smalltalk.SendNode,smalltalk.Array,smalltalk.CascadeNode]
+referencedClasses: [smalltalk.SendNode,smalltalk.Array,smalltalk.nil]
 }),
 smalltalk.SendNode);
 
@@ -525,7 +525,7 @@ return (function($rec){smalltalk.send($rec, "_nodes_", [smalltalk.send(self, "_n
 return self;},
 source: unescape('asBlockSequenceNode%0A%09%5EBlockSequenceNode%20new%0A%09%20%20%20%20nodes%3A%20self%20nodes%3B%0A%09%20%20%20%20temps%3A%20self%20temps%3B%0A%09%20%20%20%20yourself'),
 messageSends: ["nodes:", "nodes", "temps:", "temps", "yourself", "new"],
-referencedClasses: [smalltalk.BlockSequenceNode]
+referencedClasses: [smalltalk.nil]
 }),
 smalltalk.SequenceNode);
 
@@ -1005,7 +1005,7 @@ return smalltalk.send(smalltalk.send(smalltalk.DoIt, "_new", []), "_doIt", []);
 return self;},
 source: unescape('loadExpression%3A%20aString%0A%09DoIt%20addCompiledMethod%3A%20%28self%20eval%3A%20%28self%20compileExpression%3A%20aString%29%29.%0A%09%5EDoIt%20new%20doIt'),
 messageSends: ["addCompiledMethod:", "eval:", "compileExpression:", "doIt", "new"],
-referencedClasses: [smalltalk.DoIt]
+referencedClasses: [smalltalk.nil]
 }),
 smalltalk.Compiler);
 
@@ -1016,10 +1016,13 @@ selector: 'load:forClass:',
 category: 'compiling',
 fn: function (aString, aClass){
 var self=this;
-return smalltalk.send(self, "_eval_", [smalltalk.send(self, "_compile_forClass_", [aString, aClass])]);
+var compiled=nil;
+compiled=smalltalk.send(self, "_eval_", [smalltalk.send(self, "_compile_forClass_", [aString, aClass])]);
+smalltalk.send(self, "_setupClass_", [aClass]);
+return compiled;
 return self;},
-source: unescape('load%3A%20aString%20forClass%3A%20aClass%0A%09%5Eself%20eval%3A%20%28self%20compile%3A%20aString%20forClass%3A%20aClass%29'),
-messageSends: ["eval:", "compile:forClass:"],
+source: unescape('load%3A%20aString%20forClass%3A%20aClass%0A%09%7C%20compiled%20%7C%0A%09compiled%20%3A%3D%20self%20eval%3A%20%28self%20compile%3A%20aString%20forClass%3A%20aClass%29.%0A%09self%20setupClass%3A%20aClass.%0A%09%5Ecompiled'),
+messageSends: ["eval:", "compile:forClass:", "setupClass:"],
 referencedClasses: []
 }),
 smalltalk.Compiler);
@@ -1052,7 +1055,7 @@ return smalltalk.send(self, "_compileNode_", [smalltalk.send(self, "_parseExpres
 return self;},
 source: unescape('compileExpression%3A%20aString%0A%09self%20currentClass%3A%20DoIt.%0A%09%5Eself%20compileNode%3A%20%28self%20parseExpression%3A%20aString%29'),
 messageSends: ["currentClass:", "compileNode:", "parseExpression:"],
-referencedClasses: [smalltalk.DoIt]
+referencedClasses: [smalltalk.nil]
 }),
 smalltalk.Compiler);
 
@@ -1065,7 +1068,7 @@ fn: function (aString){
 var self=this;
 return eval(aString);
 return self;},
-source: unescape('eval%3A%20aString%0A%09%7B%27return%20eval%28aString%29%27%7D'),
+source: unescape('eval%3A%20aString%0A%09%3Creturn%20eval%28aString%29%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -1353,10 +1356,10 @@ selector: 'visitJSStatementNode:',
 category: 'visiting',
 fn: function (aNode){
 var self=this;
-smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(aNode, "_source", []), "_value", []), "_replace_with_", [unescape("%27%27"), unescape("%27")])]);
+smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(aNode, "_source", []), "_replace_with_", [unescape("%3E%3E"), unescape("%3E")])]);
 return self;},
-source: unescape('visitJSStatementNode%3A%20aNode%0A%09stream%20nextPutAll%3A%20%28aNode%20source%20value%20replace%3A%20%27%27%27%27%27%27%20with%3A%20%27%27%27%27%29'),
-messageSends: ["nextPutAll:", "replace:with:", "value", "source"],
+source: unescape('visitJSStatementNode%3A%20aNode%0A%09stream%20nextPutAll%3A%20%28aNode%20source%20replace%3A%20%27%3E%3E%27%20with%3A%20%27%3E%27%29'),
+messageSends: ["nextPutAll:", "replace:with:", "source"],
 referencedClasses: []
 }),
 smalltalk.Compiler);
@@ -1513,6 +1516,21 @@ referencedClasses: []
 }),
 smalltalk.Compiler);
 
+smalltalk.addMethod(
+'_setupClass_',
+smalltalk.method({
+selector: 'setupClass:',
+category: 'compiling',
+fn: function (aClass){
+var self=this;
+smalltalk.init(aClass);
+return self;},
+source: unescape('setupClass%3A%20aClass%0A%09%3Csmalltalk.init%28aClass%29%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Compiler);
+
 
 smalltalk.addMethod(
 '_recompile_',
@@ -1555,10 +1573,10 @@ selector: 'doIt',
 category: '',
 fn: function (){
 var self=this;
-return smalltalk.send((function(){return smalltalk.send("abc", "_trimLeft_", ["az"]);}), "_value", []);
+return smalltalk.send((function(){return self["@"+'foo'];}), "_value", []);
 return self;},
-source: unescape('doIt%20%5E%5B%27abc%27%20trimLeft%3A%20%27az%27%5D%20value'),
-messageSends: ["value", "trimLeft:"],
+source: unescape('doIt%20%5E%5B%3Cself%5B%22@%22+%27foo%27%5D%3E%5D%20value'),
+messageSends: ["value"],
 referencedClasses: []
 }),
 smalltalk.DoIt);

+ 11 - 11
js/IDE.js

@@ -36,9 +36,9 @@ selector: 'updatePosition',
 category: 'actions',
 fn: function (){
 var self=this;
-jQuery('#jtalk').css('top', '').css('bottom', '27px');;
+jQuery('#jtalk').css('top', '').css('bottom', '27px');
 return self;},
-source: unescape('updatePosition%0A%20%20%20%20%7B%27jQuery%28%27%27%23jtalk%27%27%29.css%28%27%27top%27%27%2C%20%27%27%27%27%27%27%29.css%28%27%27bottom%27%27%2C%20%27%2727px%27%27%29%3B%27%7D'),
+source: unescape('updatePosition%0A%20%20%20%20%3CjQuery%28%27%23jtalk%27%29.css%28%27top%27%2C%20%27%27%29.css%28%27bottom%27%2C%20%2727px%27%29%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -85,9 +85,9 @@ jQuery('#jtalk').resizable({
 	handles: 'n', 
 	resize: aBlock,
 	minHeight: 230
-});;
+});
 return self;},
-source: unescape('onResize%3A%20aBlock%0A%20%20%20%20%7B%27jQuery%28%27%27%23jtalk%27%27%29.resizable%28%7B%0A%09handles%3A%20%27%27n%27%27%2C%20%0A%09resize%3A%20aBlock%2C%0A%09minHeight%3A%20230%0A%7D%29%3B%27%7D'),
+source: unescape('onResize%3A%20aBlock%0A%20%20%20%20%3CjQuery%28%27%23jtalk%27%29.resizable%28%7B%0A%09handles%3A%20%27n%27%2C%20%0A%09resize%3A%20aBlock%2C%0A%09minHeight%3A%20230%0A%7D%29%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -102,7 +102,7 @@ fn: function (aBlock){
 var self=this;
 jQuery(window).resize(aBlock);
 return self;},
-source: unescape('onWindowResize%3A%20aBlock%0A%20%20%20%20%7B%27jQuery%28window%29.resize%28aBlock%29%27%7D'),
+source: unescape('onWindowResize%3A%20aBlock%0A%20%20%20%20%3CjQuery%28window%29.resize%28aBlock%29%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -442,7 +442,7 @@ fn: function (){
 var self=this;
 return document.selection;
 return self;},
-source: unescape('selection%0A%20%20%20%20%7B%27return%20document.selection%27%7D'),
+source: unescape('selection%0A%20%20%20%20%3Creturn%20document.selection%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -457,7 +457,7 @@ fn: function (){
 var self=this;
 return jQuery('.jt_workspace')[0].selectionStart;
 return self;},
-source: unescape('selectionStart%0A%20%20%20%20%7B%27return%20jQuery%28%27%27.jt_workspace%27%27%29%5B0%5D.selectionStart%27%7D'),
+source: unescape('selectionStart%0A%20%20%20%20%3Creturn%20jQuery%28%27.jt_workspace%27%29%5B0%5D.selectionStart%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -472,7 +472,7 @@ fn: function (){
 var self=this;
 return jQuery('.jt_workspace')[0].selectionEnd;
 return self;},
-source: unescape('selectionEnd%0A%20%20%20%20%7B%27return%20jQuery%28%27%27.jt_workspace%27%27%29%5B0%5D.selectionEnd%27%7D'),
+source: unescape('selectionEnd%0A%20%20%20%20%3Creturn%20jQuery%28%27.jt_workspace%27%29%5B0%5D.selectionEnd%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -487,7 +487,7 @@ fn: function (anInteger){
 var self=this;
 jQuery('.jt_workspace')[0].selectionStart = anInteger;
 return self;},
-source: unescape('selectionStart%3A%20anInteger%0A%20%20%20%20%7B%27jQuery%28%27%27.jt_workspace%27%27%29%5B0%5D.selectionStart%20%3D%20anInteger%27%7D'),
+source: unescape('selectionStart%3A%20anInteger%0A%20%20%20%20%3CjQuery%28%27.jt_workspace%27%29%5B0%5D.selectionStart%20%3D%20anInteger%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -502,7 +502,7 @@ fn: function (anInteger){
 var self=this;
 jQuery('.jt_workspace')[0].selectionEnd = anInteger;
 return self;},
-source: unescape('selectionEnd%3A%20anInteger%0A%20%20%20%20%7B%27jQuery%28%27%27.jt_workspace%27%27%29%5B0%5D.selectionEnd%20%3D%20anInteger%27%7D'),
+source: unescape('selectionEnd%3A%20anInteger%0A%20%20%20%20%3CjQuery%28%27.jt_workspace%27%29%5B0%5D.selectionEnd%20%3D%20anInteger%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -554,7 +554,7 @@ if(anEvent.ctrlKey) {
 		}
 	};
 return self;},
-source: unescape('handleKeyDown%3A%20anEvent%0A%20%20%20%20%7B%27if%28anEvent.ctrlKey%29%20%7B%0A%09%09if%28anEvent.keyCode%20%3D%3D%3D%2080%29%20%7B%20//ctrl+p%0A%09%09%09self._printIt%28%29%3B%0A%09%09%09anEvent.preventDefault%28%29%3B%0A%09%09%09return%20false%3B%0A%09%09%7D%0A%09%09if%28anEvent.keyCode%20%3D%3D%3D%2068%29%20%7B%20//ctrl+d%0A%09%09%09self._doIt%28%29%3B%0A%09%09%09anEvent.preventDefault%28%29%3B%0A%09%09%09return%20false%3B%0A%09%09%7D%0A%09%09if%28anEvent.keyCode%20%3D%3D%3D%2073%29%20%7B%20//ctrl+i%0A%09%09%09self._inspectIt%28%29%3B%0A%09%09%09anEvent.preventDefault%28%29%3B%0A%09%09%09return%20false%3B%0A%09%09%7D%0A%09%7D%27%7D'),
+source: unescape('handleKeyDown%3A%20anEvent%0A%20%20%20%20%3Cif%28anEvent.ctrlKey%29%20%7B%0A%09%09if%28anEvent.keyCode%20%3D%3D%3D%2080%29%20%7B%20//ctrl+p%0A%09%09%09self._printIt%28%29%3B%0A%09%09%09anEvent.preventDefault%28%29%3B%0A%09%09%09return%20false%3B%0A%09%09%7D%0A%09%09if%28anEvent.keyCode%20%3D%3D%3D%2068%29%20%7B%20//ctrl+d%0A%09%09%09self._doIt%28%29%3B%0A%09%09%09anEvent.preventDefault%28%29%3B%0A%09%09%09return%20false%3B%0A%09%09%7D%0A%09%09if%28anEvent.keyCode%20%3D%3D%3D%2073%29%20%7B%20//ctrl+i%0A%09%09%09self._inspectIt%28%29%3B%0A%09%09%09anEvent.preventDefault%28%29%3B%0A%09%09%09return%20false%3B%0A%09%09%7D%0A%09%7D%3E'),
 messageSends: [],
 referencedClasses: []
 }),

File diff suppressed because it is too large
+ 112 - 126
js/Kernel.js


File diff suppressed because it is too large
+ 16 - 16
js/Parser.js


+ 38 - 6
js/boot.js

@@ -74,6 +74,7 @@ function Smalltalk(){
 	}
 	that.category = spec.category || "";
 	that.fn.prototype.methods = {};
+	that.fn.prototype.inheritedMethods = {};
 	that.fn.prototype.klass = that;
 
 	return that;
@@ -85,6 +86,7 @@ function Smalltalk(){
     st.method = function(spec) {
 	var that = new SmalltalkMethod();
 	that.selector          = spec.selector;
+	that.jsSelector        = spec.jsSelector;
 	that.category          = spec.category;
 	that.source            = spec.source;
 	that.messageSends      = spec.messageSends || [];
@@ -98,17 +100,32 @@ function Smalltalk(){
 
     st.init = function(klass) {
 	var subclasses = st.subclasses(klass);
+	var methods;
+
+	// Initializing inst vars
 	for(var i=0;i<klass.iVarNames.length;i++) {
 	    klass.fn.prototype["@"+klass.iVarNames[i]] = nil;
 	}
+
 	if(klass.superclass && klass.superclass !== nil) {
-	    klass.fn.prototype.__proto__ = klass.superclass.fn.prototype;
+	    methods = st.methods(klass.superclass);
+
+	    //Methods linking
+	    for(var i in methods) {
+		if(!klass.fn.prototype.methods[i]) {
+		    klass.fn.prototype.inheritedMethods[i] = methods[i];
+		    klass.fn.prototype[methods[i].jsSelector] = methods[i].fn;
+		}
+	    }
+
+	    //Instance variables linking
 	    for(var i=0;i<klass.superclass.iVarNames.length;i++) {
 		if(!klass["@"+klass.superclass.iVarNames[i]]) {
 		    klass.fn.prototype["@"+klass.superclass.iVarNames[i]] = nil;
 		}
 	    }
 	}
+
 	for(var i=0;i<subclasses.length;i++) {
      	    st.init(subclasses[i]);
 	}
@@ -130,8 +147,20 @@ function Smalltalk(){
 	return classes
     };
 
-    /* Answer the direct subclasses of a given class.
-       This is computed dynamically */
+    /* Answer all methods (included inherited ones) of klass. */
+
+    st.methods = function(klass) {
+	var methods = {};
+	for(var i in klass.fn.prototype.methods) {
+	    methods[i] = klass.fn.prototype.methods[i]
+	}
+	for(var i in klass.fn.prototype.inheritedMethods) {
+	    methods[i] = klass.fn.prototype.inheritedMethods[i]
+	}
+	return methods;
+    }
+
+    /* Answer the direct subclasses of klass. */
 
     st.subclasses = function(klass) {
 	var subclasses = [];
@@ -186,6 +215,7 @@ function Smalltalk(){
 	klass.fn.prototype[jsSelector] = method.fn;
 	klass.fn.prototype.methods[method.selector] = method;
 	method.methodClass = klass;
+	method.jsSelector = jsSelector;
     };
 
     /* Handles Smalltalk message send. Automatically converts undefined to the nil object.
@@ -230,16 +260,18 @@ function Smalltalk(){
 	   keyword only, but keeping all message arguments.
 
 	   Example:
-	   "self do: aBlock with: anObjec"t -> "self.do(aBlock, anObject)" */
+	   "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)" */
 
-	var jsSelector = selector.replace(/^_/, '').replace(/_.*/g, '');
+	var jsSelector = selector
+	    .replace(/^_/, '')
+	    .replace(/_.*/g, '');
 	var jsProperty = receiver[jsSelector];
 	if(typeof jsProperty === "function") {
 	    return jsProperty.apply(receiver, args);
 	} else if(jsProperty !== undefined) {
 	    return jsProperty
 	}
-	throw(receiver + ' is not a Jtalk object and ' + jsSelector + ' is undefined')
+	smalltalk.Error._signal_(receiver + ' is not a Jtalk object and "' + jsSelector + '" is undefined')
     }
 
 	

+ 5 - 5
st/Benchfib.st

@@ -8,7 +8,7 @@ main
 
 	| result |
 	result := 0 tinyBenchmarks.
-	{'console.log(''0 tinyBenchmarks => '' + result);'}
+	console log: '0 tinyBenchmarks => ' + result
 ! !
 
 !Number methodsFor: '*Benchfib'!
@@ -70,15 +70,15 @@ tinyBenchmarks
 
 jsbenchFib
  
-	{'if (this < 2) {
+	<if (this < 2) {
 return 1;
 } else {
-return (this-1)._jsbenchFib() + (this-2)._jsbenchFib() + 1;}'}
+return (this-1)._jsbenchFib() + (this-2)._jsbenchFib() + 1;}>
 !
 
 jsbenchmark
 
-{'
+<
 var size = 8190;
 var count;
 for (var z=0;z<this;z++) {
@@ -99,7 +99,7 @@ for (var z=0;z<this;z++) {
     }
   }
 }
-return count'}
+return count>
 !
 
 jstinyBenchmarks

+ 24 - 24
st/Canvas.st

@@ -5,7 +5,7 @@ Object subclass: #CanvasRenderingContext
 !CanvasRenderingContext methodsFor: 'drawing arcs'!
 
 arcTo: aPoint radius: aNumber startAngle: aNumber2 endAngle: aNumber3 anticlockwise: aBoolean
-	{'self.arc(aPoint._x(), aPoint._y(), aNumber, aNumber2, aNumber3, aBoolean)'}
+	<self.arc(aPoint._x(), aPoint._y(), aNumber, aNumber2, aNumber3, aBoolean)>
 !
 
 arcTo: aPoint radius: aNumber
@@ -15,59 +15,59 @@ arcTo: aPoint radius: aNumber
 !CanvasRenderingContext methodsFor: 'drawing paths'!
 
 fillStyle: aString
-	{'self.fillStyle = String(aString)'}
+	<self.fillStyle = String(aString)>
 !
 
 beginPath
-	{'self.beginPath()'}
+	<self.beginPath()>
 !
 
 closePath
-	{'self.closePath()'}
+	<self.closePath()>
 !
 
 fill
-	{'self.fill()'}
+	<self.fill()>
 !
 
 stroke
-	{'self.stroke()'}
+	<self.stroke()>
 !
 
 moveTo: aPoint
-	{'self.moveTo(aPoint._x(), aPoint._y())'}
+	<self.moveTo(aPoint._x(), aPoint._y())>
 !
 
 lineTo: aPoint
-	{'self.lineTo(aPoint._x(), aPoint._y())'}
+	<self.lineTo(aPoint._x(), aPoint._y())>
 !
 
 strokeStyle: aString
-	{'self.strokeStyle = String(aString)'}
+	<self.strokeStyle = String(aString)>
 !
 
 lineWidth: aNumber
-	{'self.lineWidth = aNumber'}
+	<self.lineWidth = aNumber>
 ! !
 
 !CanvasRenderingContext methodsFor: 'drawing rectangles'!
 
 fillRectFrom: aPoint to: anotherPoint
-	{'self.fillRect(aPoint._x(), aPoint._y(), anotherPoint._x(), anotherPoint._y())'}
+	<self.fillRect(aPoint._x(), aPoint._y(), anotherPoint._x(), anotherPoint._y())>
 !
 
 strokeRectFrom: aPoint to: anotherPoint
-	{'self.strokeRect(aPoint._x(), aPoint._y(), anotherPoint._x(), anotherPoint._y())'}
+	<self.strokeRect(aPoint._x(), aPoint._y(), anotherPoint._x(), anotherPoint._y())>
 !
 
 clearRectFrom: aPoint to: anotherPoint
-	{'self.fillRect(aPoint._x(), aPoint._y(), anotherPoint._x(), anotherPoint._y())'}
+	<self.fillRect(aPoint._x(), aPoint._y(), anotherPoint._x(), anotherPoint._y())>
 ! !
 
 !CanvasRenderingContext class methodsFor: 'instance creation'!
 
 tagBrush: aTagBrush
-	{'return aTagBrush._element().getContext(''2d'')'}
+	<return aTagBrush._element().getContext('2d')>
 ! !
 
 Object subclass: #HTMLCanvas
@@ -250,7 +250,7 @@ appendBlock: aBlock
 !
 
 appendChild: anElement
-    {'self[''@element''].appendChild(anElement)'}
+    <self['@element'].appendChild(anElement)>
 !
 
 appendString: aString
@@ -260,11 +260,11 @@ appendString: aString
 !TagBrush methodsFor: 'attributes'!
 
 at: aString put: aValue
-    {'self[''@element''].setAttribute(aString, aValue)'}
+    <self['@element'].setAttribute(aString, aValue)>
 !
 
 removeAt: aString
-    {'self[''@element''].removeAttribute(aString)'}
+    <self['@element'].removeAttribute(aString)>
 !
 
 class: aString
@@ -294,7 +294,7 @@ style: aString
 !TagBrush methodsFor: 'converting'!
 
 asJQuery
-	{'return smalltalk.JQuery._from_(jQuery(self[''@element'']))'}
+	<return smalltalk.JQuery._from_(jQuery(self['@element']))>
 !
 
 asJQueryDo: aBlock
@@ -341,11 +341,11 @@ initializeFromString: aString canvas: aCanvas
 !TagBrush methodsFor: 'private'!
 
 createElementFor: aString
-	{'return document.createElement(String(aString))'}
+	<return document.createElement(String(aString))>
 !
 
 createTextNodeFor: aString
-	{'return document.createTextNode(String(aString))'}
+	<return document.createTextNode(String(aString))>
 ! !
 
 !TagBrush class methodsFor: 'instance creation'!
@@ -369,11 +369,11 @@ root
 !Widget methodsFor: 'actions'!
 
 alert: aString
-    {'alert(aString)'}
+    <alert(aString)>
 !
 
 confirm: aString
-    {'return window.confirm(aString)'}
+    <return window.confirm(aString)>
 !
 
 prompt: aString
@@ -381,7 +381,7 @@ prompt: aString
 !
 
 prompt: aString default: anotherString
-    {'return window.prompt(aString, anotherString)'}
+    <return window.prompt(aString, anotherString)>
 !
 
 update
@@ -429,7 +429,7 @@ initializeWithCanvas: aCanvas
 !CanvasBrush methodsFor: 'private'!
 
 createElement
-	{'return document.createElement(''canvas'')'}
+	<return document.createElement('canvas')>
 ! !
 
 !CanvasBrush class methodsFor: 'instance creation'!

+ 11 - 4
st/Compiler.st

@@ -413,7 +413,10 @@ loadExpression: aString
 !
 
 load: aString forClass: aClass
-	^self eval: (self compile: aString forClass: aClass)
+	| compiled |
+	compiled := self eval: (self compile: aString forClass: aClass).
+	self setupClass: aClass.
+	^compiled
 !
 
 compile: aString forClass: aClass
@@ -427,7 +430,7 @@ compileExpression: aString
 !
 
 eval: aString
-	{'return eval(aString)'}
+	<return eval(aString)>
 !
 
 compile: aString
@@ -459,6 +462,10 @@ recompile: aClass
 recompileAll
 	Smalltalk current classes do: [:each |
 		self recompile: each]
+!
+
+setupClass: aClass
+	<smalltalk.init(aClass)>
 ! !
 
 !Compiler methodsFor: 'initialization'!
@@ -655,7 +662,7 @@ visitVariableNode: aNode
 !
 
 visitJSStatementNode: aNode
-	stream nextPutAll: (aNode source value replace: '''''' with: '''')
+	stream nextPutAll: (aNode source replace: '>>' with: '>')
 !
 
 visitFailure: aFailure
@@ -683,6 +690,6 @@ Object subclass: #DoIt
 
 !DoIt methodsFor: ''!
 
-doIt ^['abc' trimLeft: 'az'] value
+doIt ^[<self["@"+'foo']>] value
 ! !
 

+ 12 - 12
st/IDE.st

@@ -15,7 +15,7 @@ updateBodyMargin
 !
 
 updatePosition
-    {'jQuery(''#jtalk'').css(''top'', '''''').css(''bottom'', ''27px'');'}
+    <jQuery('#jtalk').css('top', '').css('bottom', '27px')>
 !
 
 removeBodyMargin
@@ -27,15 +27,15 @@ setBodyMargin: anInteger
 !
 
 onResize: aBlock
-    {'jQuery(''#jtalk'').resizable({
-	handles: ''n'', 
+    <jQuery('#jtalk').resizable({
+	handles: 'n', 
 	resize: aBlock,
 	minHeight: 230
-});'}
+})>
 !
 
 onWindowResize: aBlock
-    {'jQuery(window).resize(aBlock)'}
+    <jQuery(window).resize(aBlock)>
 !
 
 open
@@ -215,23 +215,23 @@ label
 !
 
 selection
-    {'return document.selection'}
+    <return document.selection>
 !
 
 selectionStart
-    {'return jQuery(''.jt_workspace'')[0].selectionStart'}
+    <return jQuery('.jt_workspace')[0].selectionStart>
 !
 
 selectionEnd
-    {'return jQuery(''.jt_workspace'')[0].selectionEnd'}
+    <return jQuery('.jt_workspace')[0].selectionEnd>
 !
 
 selectionStart: anInteger
-    {'jQuery(''.jt_workspace'')[0].selectionStart = anInteger'}
+    <jQuery('.jt_workspace')[0].selectionStart = anInteger>
 !
 
 selectionEnd: anInteger
-    {'jQuery(''.jt_workspace'')[0].selectionEnd = anInteger'}
+    <jQuery('.jt_workspace')[0].selectionEnd = anInteger>
 !
 
 currentLine
@@ -249,7 +249,7 @@ currentLine
 !Workspace methodsFor: 'actions'!
 
 handleKeyDown: anEvent
-    {'if(anEvent.ctrlKey) {
+    <if(anEvent.ctrlKey) {
 		if(anEvent.keyCode === 80) { //ctrl+p
 			self._printIt();
 			anEvent.preventDefault();
@@ -265,7 +265,7 @@ handleKeyDown: anEvent
 			anEvent.preventDefault();
 			return false;
 		}
-	}'}
+	}>
 !
 
 clearWorkspace

File diff suppressed because it is too large
+ 155 - 168
st/Kernel.st


+ 4 - 4
st/Parser.st

@@ -621,10 +621,10 @@ parser
 		    node first cascadeNodeWithMessages: 
 			(node second collect: [:each | each third])].
 
-	jsStatement := '{' asParser, ws, string, ws, '}' asParser
-	    ==> [:node | JSStatementNode new
-			     source: node third;
-			     yourself].
+	jsStatement := '<' asParser, ('>>' asParser / ('>' asParser not, PPAnyParser new)) star flatten, '>' asParser
+		==> [:node | JSStatementNode new
+			source: node second;
+			yourself].
 
 	expression parser: assignment / cascade / keywordSend / binarySend / jsStatement.
 

Some files were not shown because too many files changed in this diff