Browse Source

Merge remote-tracking branch 'upstream/master'

Laurent Laffont 12 years ago
parent
commit
39c55725e3
6 changed files with 39 additions and 206 deletions
  1. 13 6
      bin/jtalkc
  2. 1 1
      js/Compiler.deploy.js
  3. 0 64
      js/SUnit.deploy.js
  4. 0 84
      js/SUnit.js
  5. 25 13
      js/boot.js
  6. 0 38
      st/SUnit.st

+ 13 - 6
bin/jtalkc

@@ -236,11 +236,17 @@ do
    TOADD="$TOADD $RESOLVED"
 done
 
-# Define our Compiler loading supplied libraries
-OURCOMPILER="$COMPILER $TOLOAD init $JTALK/bin/$NODECOMPILE"
-
-# Resolve OURCOMPILER
-for FILE in $OURCOMPILER
+# Resolve COMPILER
+for FILE in $COMPILER
+do
+   resolvejs $FILE
+   TOOURCOMPILER="$TOOURCOMPILER $RESOLVED"
+done
+# Add supplied libraries to load (they are already resolved)
+TOOURCOMPILER="$TOOURCOMPILER$TOLOAD"
+THEREST="init $JTALK/bin/$NODECOMPILE"
+# Resolve init and nodecompile
+for FILE in $THEREST
 do
    resolvejs $FILE
    TOOURCOMPILER="$TOOURCOMPILER $RESOLVED"
@@ -298,8 +304,9 @@ done
 cat $TOOURCOMPILER > $TMPDIR/compiler.js
  
 # Compile all collected .st files to .js
-echo "Loading libraries $TOOURCOMPILER and compiling ..."
+echo "Loading libraries$TOOURCOMPILER and compiling ..."
 node $TMPDIR/compiler.js $DEPLOY $SUFFIX $COMPILE
+echo node $TMPDIR/compiler.js $DEPLOY $SUFFIX $COMPILE
 
 # Verify all .js files corresponding to .st files were created, otherwise exit
 IFS=" "

File diff suppressed because it is too large
+ 1 - 1
js/Compiler.deploy.js


+ 0 - 64
js/SUnit.deploy.js

@@ -146,42 +146,6 @@ smalltalk.TestCase);
 
 
 
-smalltalk.addClass('ExampleTest', smalltalk.TestCase, ['test'], 'SUnit');
-smalltalk.addMethod(
-'_testFailure',
-smalltalk.method({
-selector: 'testFailure',
-fn: function (){
-var self=this;
-smalltalk.send(self, "_deny_", [true]);
-return self;}
-}),
-smalltalk.ExampleTest);
-
-smalltalk.addMethod(
-'_testPasses',
-smalltalk.method({
-selector: 'testPasses',
-fn: function (){
-var self=this;
-smalltalk.send((100000), "_timesRepeat_", [(function(){return smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "__plus", [(1)]), "__eq", [(2)])]);})]);
-return self;}
-}),
-smalltalk.ExampleTest);
-
-smalltalk.addMethod(
-'_testError',
-smalltalk.method({
-selector: 'testError',
-fn: function (){
-var self=this;
-smalltalk.send(self, "_assert_", [smalltalk.send((1), "_foo", [])]);
-return self;}
-}),
-smalltalk.ExampleTest);
-
-
-
 smalltalk.addClass('ProgressBar', smalltalk.TabWidget, ['percent', 'progressDiv', 'div'], 'SUnit');
 smalltalk.addMethod(
 '_percent',
@@ -783,31 +747,3 @@ smalltalk.TestResult);
 
 
 
-smalltalk.addClass('ExampleTest2', smalltalk.TestCase, [], 'SUnit');
-smalltalk.addMethod(
-'_testPasses',
-smalltalk.method({
-selector: 'testPasses',
-fn: function (){
-var self=this;
-smalltalk.send((100000), "_timesRepeat_", [(function(){return smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "__plus", [(1)]), "__eq", [(2)])]);})]);
-return self;}
-}),
-smalltalk.ExampleTest2);
-
-
-
-smalltalk.addClass('ExampleTest3', smalltalk.TestCase, [], 'SUnit');
-smalltalk.addMethod(
-'_testPasses',
-smalltalk.method({
-selector: 'testPasses',
-fn: function (){
-var self=this;
-smalltalk.send((100000), "_timesRepeat_", [(function(){return smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "__plus", [(1)]), "__eq", [(2)])]);})]);
-return self;}
-}),
-smalltalk.ExampleTest3);
-
-
-

+ 0 - 84
js/SUnit.js

@@ -198,54 +198,6 @@ smalltalk.TestCase);
 
 
 
-smalltalk.addClass('ExampleTest', smalltalk.TestCase, ['test'], 'SUnit');
-smalltalk.addMethod(
-'_testFailure',
-smalltalk.method({
-selector: 'testFailure',
-category: 'not yet classified',
-fn: function (){
-var self=this;
-smalltalk.send(self, "_deny_", [true]);
-return self;},
-source: unescape('testFailure%0A%09self%20deny%3A%20true'),
-messageSends: ["deny:"],
-referencedClasses: []
-}),
-smalltalk.ExampleTest);
-
-smalltalk.addMethod(
-'_testPasses',
-smalltalk.method({
-selector: 'testPasses',
-category: 'not yet classified',
-fn: function (){
-var self=this;
-smalltalk.send((100000), "_timesRepeat_", [(function(){return smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "__plus", [(1)]), "__eq", [(2)])]);})]);
-return self;},
-source: unescape('testPasses%0A%09100000%20timesRepeat%3A%20%5Bself%20assert%3A%201%20+%201%20%3D%202%5D'),
-messageSends: ["timesRepeat:", "assert:", unescape("%3D"), unescape("+")],
-referencedClasses: []
-}),
-smalltalk.ExampleTest);
-
-smalltalk.addMethod(
-'_testError',
-smalltalk.method({
-selector: 'testError',
-category: 'not yet classified',
-fn: function (){
-var self=this;
-smalltalk.send(self, "_assert_", [smalltalk.send((1), "_foo", [])]);
-return self;},
-source: unescape('testError%0A%09self%20assert%3A%201%20foo'),
-messageSends: ["assert:", "foo"],
-referencedClasses: []
-}),
-smalltalk.ExampleTest);
-
-
-
 smalltalk.addClass('ProgressBar', smalltalk.TabWidget, ['percent', 'progressDiv', 'div'], 'SUnit');
 smalltalk.addMethod(
 '_percent',
@@ -1051,39 +1003,3 @@ smalltalk.TestResult);
 
 
 
-smalltalk.addClass('ExampleTest2', smalltalk.TestCase, [], 'SUnit');
-smalltalk.addMethod(
-'_testPasses',
-smalltalk.method({
-selector: 'testPasses',
-category: 'not yet classified',
-fn: function (){
-var self=this;
-smalltalk.send((100000), "_timesRepeat_", [(function(){return smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "__plus", [(1)]), "__eq", [(2)])]);})]);
-return self;},
-source: unescape('testPasses%0A%09100000%20timesRepeat%3A%20%5Bself%20assert%3A%201%20+%201%20%3D%202%5D'),
-messageSends: ["timesRepeat:", "assert:", unescape("%3D"), unescape("+")],
-referencedClasses: []
-}),
-smalltalk.ExampleTest2);
-
-
-
-smalltalk.addClass('ExampleTest3', smalltalk.TestCase, [], 'SUnit');
-smalltalk.addMethod(
-'_testPasses',
-smalltalk.method({
-selector: 'testPasses',
-category: 'not yet classified',
-fn: function (){
-var self=this;
-smalltalk.send((100000), "_timesRepeat_", [(function(){return smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "__plus", [(1)]), "__eq", [(2)])]);})]);
-return self;},
-source: unescape('testPasses%0A%09100000%20timesRepeat%3A%20%5Bself%20assert%3A%201%20+%201%20%3D%202%5D'),
-messageSends: ["timesRepeat:", "assert:", unescape("%3D"), unescape("+")],
-referencedClasses: []
-}),
-smalltalk.ExampleTest3);
-
-
-

+ 25 - 13
js/boot.js

@@ -315,14 +315,19 @@ function Smalltalk(){
 	smalltalk.Error._signal_(receiver + ' is not a Jtalk object and "' + jsSelector + '" is undefined')
     };
 
+
+    /* Reuse old contexts stored in oldContexts */
+
+    st.oldContexts = [];
+
 	
     /* Handle thisContext pseudo variable */
     
     pushContext = function(receiver, selector, temps) {
 	if(thisContext) {
-	    return thisContext = thisContext.newContext({receiver: receiver, selector: selector, temps: temps});
+	    return thisContext = thisContext.newContext(receiver, selector, temps);
 	} else {
-	    return thisContext = new SmalltalkMethodContext({receiver: receiver, selector: selector, temps: temps});
+	    return thisContext = new SmalltalkMethodContext(receiver, selector, temps);
 	}
     };
 
@@ -395,21 +400,29 @@ function Smalltalk(){
     st.setDevelopmentMode();
 }
 
-function SmalltalkMethodContext(spec) {
+function SmalltalkMethodContext(receiver, selector, temps, home) {
     var that = this;
-    spec = spec || {};
-    that.homeContext = spec.homeContext;
-    that.selector = spec.selector;
-    that.receiver = spec.receiver;
-    that.temps = spec.temps || {};
-
-    that.newContext = function(spec) {
-	spec = spec || {};
-	return new SmalltalkMethodContext({homeContext: that, receiver: spec.receiver, selector: spec.selector, temps: spec.temps});
+    that.receiver = receiver;
+    that.selector = selector;
+    that.temps = temps || {};
+    that.homeContext = home;
+
+    that.newContext = function(receiver, selector, temps) {
+	var c = smalltalk.oldContexts.pop();
+	if(c) {
+	    c.homeContext = that;
+	    c.receiver = receiver;
+	    c.selector = selector;
+	    c.temps = temps || {};
+	} else {
+	    c = new SmalltalkMethodContext(receiver, selector, temps, that);
+	}
+	return c;
     }
 
     that.removeYourself = function() {
 	thisContext = that.homeContext;
+	smalltalk.oldContexts.push(that);
     }
 }
 
@@ -419,7 +432,6 @@ var nil = new SmalltalkNil();
 var smalltalk = new Smalltalk();
 var thisContext = undefined;
 
-
 /* Utilities */
 
 Array.prototype.remove = function(s){

+ 0 - 38
st/SUnit.st

@@ -76,24 +76,6 @@ assert: aBoolean description: aString
 	aBoolean ifFalse: [self signalFailure: aString]
 ! !
 
-TestCase subclass: #ExampleTest
-	instanceVariableNames: 'test'
-	category: 'SUnit'!
-
-!ExampleTest methodsFor: 'not yet classified'!
-
-testFailure
-	self deny: true
-!
-
-testPasses
-	100000 timesRepeat: [self assert: 1 + 1 = 2]
-!
-
-testError
-	self assert: 1 foo
-! !
-
 TabWidget subclass: #ProgressBar
 	instanceVariableNames: 'percent progressDiv div'
 	category: 'SUnit'!
@@ -440,23 +422,3 @@ initialize
 	total := 0
 ! !
 
-TestCase subclass: #ExampleTest2
-	instanceVariableNames: ''
-	category: 'SUnit'!
-
-!ExampleTest2 methodsFor: 'not yet classified'!
-
-testPasses
-	100000 timesRepeat: [self assert: 1 + 1 = 2]
-! !
-
-TestCase subclass: #ExampleTest3
-	instanceVariableNames: ''
-	category: 'SUnit'!
-
-!ExampleTest3 methodsFor: 'not yet classified'!
-
-testPasses
-	100000 timesRepeat: [self assert: 1 + 1 = 2]
-! !
-

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