From: Jay Freeman (saurik) Date: Mon, 19 Oct 2009 22:20:11 +0000 (+0000) Subject: Replaced function closure 'for each'..in compilation with a with closure. X-Git-Tag: v0.9.432~314 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/6f926cee9d6b259845cd91069cb7c6f488d1eed6 Replaced function closure 'for each'..in compilation with a with closure. --- diff --git a/Output.cpp b/Output.cpp index 7580288..a5d9743 100644 --- a/Output.cpp +++ b/Output.cpp @@ -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 {