]> git.saurik.com Git - cycript.git/commitdiff
Replaced function closure 'for each'..in compilation with a with closure.
authorJay Freeman (saurik) <saurik@saurik.com>
Mon, 19 Oct 2009 22:20:11 +0000 (22:20 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Mon, 19 Oct 2009 22:20:11 +0000 (22:20 +0000)
Output.cpp

index 75802883eeafa85f0f250cb32963c4b0f0e69feb..a5d97430c3e2b0cc9a2601099082b5374ecc1e56 100644 (file)
@@ -360,14 +360,8 @@ void CYFor::Output(std::ostream &out) const {
 }
 
 void CYForEachIn::Output(std::ostream &out) const {
-    const char *name(initialiser_->ForEachIn());
+    out << "with({$cys:0,$cyt:0}){";
 
-    if (name != NULL) {
-        out << '{';
-        out << "var " << name << ';';
-    }
-
-    out << "(function($cys,$cyt){";
     out << "$cys=";
     set_->Output(out, CYPA, CYNoFlags);
     out << ";";
@@ -379,10 +373,9 @@ void CYForEachIn::Output(std::ostream &out) const {
 
     code_->Show(out);
 
-    out << "}}());";
+    out << '}';
 
-    if (name != NULL)
-        out << '}';
+    out << '}';
 }
 
 void CYForEachInComprehension::Begin_(std::ostream &out) const {