Browse Source

exception does not make Trapped stale

Herbert Vojčík 11 years ago
parent
commit
f6a245ed12
2 changed files with 26 additions and 18 deletions
  1. 17 9
      lib/js/Trapped-Backend.js
  2. 9 9
      lib/st/Trapped-Backend.st

+ 17 - 9
lib/js/Trapped-Backend.js

@@ -263,31 +263,39 @@ selector: "run",
 category: 'action',
 fn: function (){
 var self=this;
-var needsClean;
+function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
 return smalltalk.withContext(function($ctx1) { 
 var $1,$2,$3;
+_st((function(){
+var needsClean;
+return smalltalk.withContext(function($ctx2) {
 needsClean=false;
+needsClean;
 self._do_((function(each){
-return smalltalk.withContext(function($ctx2) {
+return smalltalk.withContext(function($ctx3) {
 $1=_st(each)._isFlagged();
 if(smalltalk.assert($1)){
 _st(each)._run();
+};
 $2=_st(each)._isEnabled();
 if(! smalltalk.assert($2)){
 needsClean=true;
 return needsClean;
 };
-};
-}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
+}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})}));
 $3=needsClean;
 if(smalltalk.assert($3)){
-self._clean();
+return self._clean();
 };
-return self}, function($ctx1) {$ctx1.fill(self,"run",{needsClean:needsClean},smalltalk.KeyedPubSubBase)})},
+}, function($ctx2) {$ctx2.fillBlock({needsClean:needsClean},$ctx1)})}))._on_do_($Error(),(function(){
+return smalltalk.withContext(function($ctx2) {
+return self._dirty_(true);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"run",{},smalltalk.KeyedPubSubBase)})},
 args: [],
-source: "run\x0a\x09| needsClean |\x0a    needsClean := false.\x0a\x09self do: [ :each |\x0a\x09\x09each isFlagged ifTrue: [\x0a            each run.\x0a            each isEnabled ifFalse: [ needsClean := true ]\x0a        ]\x0a\x09].\x0a    needsClean ifTrue: [ self clean ]",
-messageSends: ["do:", "ifTrue:", "run", "ifFalse:", "isEnabled", "isFlagged", "clean"],
-referencedClasses: []
+source: "run\x0a\x09[\x0a\x09\x09| needsClean |\x0a\x09    needsClean := false.\x0a\x09\x09self do: [ :each |\x0a\x09\x09\x09each isFlagged ifTrue: [ each run ].\x0a\x09        each isEnabled ifFalse: [ needsClean := true ]\x0a\x09\x09].\x0a    \x09needsClean ifTrue: [ self clean ]\x0a\x09] on: Error do: [ self dirty: true ]",
+messageSends: ["on:do:", "dirty:", "do:", "ifTrue:", "run", "isFlagged", "ifFalse:", "isEnabled", "clean"],
+referencedClasses: ["Error"]
 }),
 smalltalk.KeyedPubSubBase);
 

+ 9 - 9
lib/st/Trapped-Backend.st

@@ -115,15 +115,15 @@ on: key hook: aBlock
 !
 
 run
-	| needsClean |
-    needsClean := false.
-	self do: [ :each |
-		each isFlagged ifTrue: [
-            each run.
-            each isEnabled ifFalse: [ needsClean := true ]
-        ]
-	].
-    needsClean ifTrue: [ self clean ]
+	[
+		| needsClean |
+	    needsClean := false.
+		self do: [ :each |
+			each isFlagged ifTrue: [ each run ].
+	        each isEnabled ifFalse: [ needsClean := true ]
+		].
+    	needsClean ifTrue: [ self clean ]
+	] on: Error do: [ self dirty: true ]
 !
 
 subscriptionFactory: aBlock