فهرست منبع

Not using non-local return.

Herbert Vojčík 11 سال پیش
والد
کامیت
8f72367fa6
3فایلهای تغییر یافته به همراه9 افزوده شده و 20 حذف شده
  1. 3 8
      js/Compiler-AST.deploy.js
  2. 5 10
      js/Compiler-AST.js
  3. 1 2
      st/Compiler-AST.st

+ 3 - 8
js/Compiler-AST.deploy.js

@@ -193,22 +193,17 @@ selector: "subtreeNeedsAliasing",
 fn: function (){
 var self=this;
 var $1;
-var $early={};
-try {
 $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_shouldBeAliased",[]),"_or_",[(function(){
 return smalltalk.send(self,"_shouldBeInlined",[]);
 })]),"_or_",[(function(){
-smalltalk.send(smalltalk.send(self,"_nodes",[]),"_detect_ifNone_",[(function(node){
+return smalltalk.send(smalltalk.send(smalltalk.send(self,"_nodes",[]),"_detect_ifNone_",[(function(node){
 return smalltalk.send(node,"_subtreeNeedsAliasing",[]);
 }),(function(){
-throw $early=[false];
-})]);
-return true;
+return false;
+})]),"_~_eq",[false]);
 })]);
 return $1;
 }
-catch(e) {if(e===$early)return e[0]; throw e}
-}
 }),
 smalltalk.Node);
 

+ 5 - 10
js/Compiler-AST.js

@@ -270,25 +270,20 @@ category: 'accessing',
 fn: function (){
 var self=this;
 var $1;
-var $early={};
-try {
 $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_shouldBeAliased",[]),"_or_",[(function(){
 return smalltalk.send(self,"_shouldBeInlined",[]);
 })]),"_or_",[(function(){
-smalltalk.send(smalltalk.send(self,"_nodes",[]),"_detect_ifNone_",[(function(node){
+return smalltalk.send(smalltalk.send(smalltalk.send(self,"_nodes",[]),"_detect_ifNone_",[(function(node){
 return smalltalk.send(node,"_subtreeNeedsAliasing",[]);
 }),(function(){
-throw $early=[false];
-})]);
-return true;
+return false;
+})]),"_~_eq",[false]);
 })]);
 return $1;
-}
-catch(e) {if(e===$early)return e[0]; throw e}
 },
 args: [],
-source: "subtreeNeedsAliasing\x0a    ^(self shouldBeAliased or: [ self shouldBeInlined ]) or: [\x0a        self nodes detect: [ :node | node subtreeNeedsAliasing ] ifNone: [ ^false ].\x0a        true\x0a    ]",
-messageSends: ["or:", "detect:ifNone:", "subtreeNeedsAliasing", "nodes", "shouldBeInlined", "shouldBeAliased"],
+source: "subtreeNeedsAliasing\x0a    ^(self shouldBeAliased or: [ self shouldBeInlined ]) or: [\x0a        (self nodes detect: [ :node | node subtreeNeedsAliasing ] ifNone: [ false ]) ~= false\x0a    ]",
+messageSends: ["or:", "~=", "detect:ifNone:", "subtreeNeedsAliasing", "nodes", "shouldBeInlined", "shouldBeAliased"],
 referencedClasses: []
 }),
 smalltalk.Node);

+ 1 - 2
st/Compiler-AST.st

@@ -33,8 +33,7 @@ shouldBeInlined: aBoolean
 
 subtreeNeedsAliasing
     ^(self shouldBeAliased or: [ self shouldBeInlined ]) or: [
-        self nodes detect: [ :node | node subtreeNeedsAliasing ] ifNone: [ ^false ].
-        true
+        (self nodes detect: [ :node | node subtreeNeedsAliasing ] ifNone: [ false ]) ~= false
     ]
 ! !