]> git.saurik.com Git - cycript.git/blobdiff - Output.cpp
Move scoping to CYDeclaration::Assignment from Replace.
[cycript.git] / Output.cpp
index 6e70b6b94c68d25adb6a205392243a6524d03235..122f6c725db7dfcd16045f4e6caf9b7876a3f418 100644 (file)
 
 #include <sstream>
 
-_finline CYFlags operator ~(CYFlags rhs) {
-    return static_cast<CYFlags>(~static_cast<unsigned>(rhs));
-}
-
-_finline CYFlags operator &(CYFlags lhs, CYFlags rhs) {
-    return static_cast<CYFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs));
-}
-
-_finline CYFlags operator |(CYFlags lhs, CYFlags rhs) {
-    return static_cast<CYFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs));
-}
-
-_finline CYFlags &operator |=(CYFlags &lhs, CYFlags rhs) {
-    return lhs = lhs | rhs;
-}
-
-_finline CYFlags CYLeft(CYFlags flags) {
-    return flags & ~(CYNoDangle | CYNoInteger);
-}
-
-_finline CYFlags CYRight(CYFlags flags) {
-    return flags & ~CYNoBF;
-}
-
-_finline CYFlags CYCenter(CYFlags flags) {
-    return CYLeft(CYRight(flags));
-}
-
 void CYOutput::Terminate() {
     out_ << ';';
     mode_ = NoMode;
@@ -264,10 +236,6 @@ void CYClause::Output(CYOutput &out) const {
     out << next_;
 }
 
-const char *CYDeclaration::ForEachIn() const {
-    return identifier_->Word();
-}
-
 void CYDeclaration::ForIn(CYOutput &out, CYFlags flags) const {
     out << "var";
     Output(out, CYRight(flags));
@@ -346,10 +314,6 @@ void CYExpression::ClassName(CYOutput &out, bool object) const {
     Output(out, CYAssign::Precedence_, CYNoFlags);
 }
 
-const char *CYExpression::ForEachIn() const {
-    return NULL;
-}
-
 void CYExpression::For(CYOutput &out) const {
     Output(out, CYNoIn);
 }
@@ -378,8 +342,12 @@ void CYFor::Output(CYOutput &out, CYFlags flags) const {
     if (initialiser_ != NULL)
         initialiser_->For(out);
     out.Terminate();
+    if (test_ != NULL)
+        out << ' ';
     out << test_;
     out.Terminate();
+    if (increment_ != NULL)
+        out << ' ';
     out << increment_;
     out << ')';
     code_->Single(out, CYRight(flags));
@@ -460,7 +428,7 @@ void CYIf::Output(CYOutput &out, CYFlags flags) const {
     true_->Single(out, jacks);
 
     if (false_ != NULL) {
-        out << "else";
+        out << '\t' << "else";
         false_->Single(out, right);
     }
 
@@ -607,7 +575,7 @@ void CYRubyProc::Output(CYOutput &out, CYFlags flags) const {
 
 void CYStatement::Multiple(CYOutput &out, CYFlags flags) const {
     bool first(true);
-    for (const CYStatement *next(this); next != NULL; next = next->next_) {
+    CYForEach (next, this) {
         bool last(next->next_ == NULL);
         CYFlags jacks(first ? last ? flags : CYLeft(flags) : last ? CYRight(flags) : CYCenter(flags));
         first = false;