]> git.saurik.com Git - cycript.git/commitdiff
Remove CYPA and replace with saner inline constant CYAssign::Precedence_.
authorJay Freeman (saurik) <saurik@saurik.com>
Mon, 12 Jul 2010 00:30:02 +0000 (00:30 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Mon, 12 Jul 2010 00:30:02 +0000 (00:30 +0000)
ObjectiveC/Output.mm
Output.cpp
Parser.hpp

index 3f360a8d589c7d8fc2a014933602814fe7341d0c..91696cbba288da01b2917eeabc8548872aa95e85 100644 (file)
@@ -61,7 +61,7 @@ void CYClass::Output(CYOutput &out, CYFlags flags) const {
     out << "return $cyc;";
     out << "}(";
     if (super_ != NULL)
-        super_->Output(out, CYPA, CYNoFlags);
+        super_->Output(out, CYAssign::Precedence_, CYNoFlags);
     else
         out << "null";
     out << "))";
@@ -96,7 +96,7 @@ void CYMessage::Output(CYOutput &out, bool replace) const {
 }
 
 void CYProtocol::Output(CYOutput &out) const {
-    name_->Output(out, CYPA, CYNoFlags);
+    name_->Output(out, CYAssign::Precedence_, CYNoFlags);
     if (next_ != NULL)
         out << ',' << ' ' << *next_;
 }
@@ -123,7 +123,7 @@ void CYSend::Output(CYOutput &out, CYFlags flags) const {
 
 void CYSendDirect::Output(CYOutput &out, CYFlags flags) const {
     out << '[';
-    self_->Output(out, CYPA, CYNoFlags);
+    self_->Output(out, CYAssign::Precedence_, CYNoFlags);
     CYSend::Output(out, flags);
     out << ']';
 }
index d5d403c30118dba1cd765ff7d1661d8c89e387cc..6e70b6b94c68d25adb6a205392243a6524d03235 100644 (file)
@@ -144,7 +144,7 @@ void CYArgument::Output(CYOutput &out) const {
             out << ':' << ' ';
     }
     if (value_ != NULL)
-        value_->Output(out, CYPA, CYNoFlags);
+        value_->Output(out, CYAssign::Precedence_, CYNoFlags);
     if (next_ != NULL) {
         if (next_->name_ == NULL)
             out << ',';
@@ -241,9 +241,9 @@ void CYCondition::Output(CYOutput &out, CYFlags flags) const {
     test_->Output(out, Precedence() - 1, CYLeft(flags));
     out << ' ' << '?' << ' ';
     if (true_ != NULL)
-        true_->Output(out, CYPA, CYNoFlags);
+        true_->Output(out, CYAssign::Precedence_, CYNoFlags);
     out << ' ' << ':' << ' ';
-    false_->Output(out, CYPA, CYRight(flags));
+    false_->Output(out, CYAssign::Precedence_, CYRight(flags));
 }
 
 void CYContinue::Output(CYOutput &out, CYFlags flags) const {
@@ -278,7 +278,7 @@ void CYDeclaration::Output(CYOutput &out, CYFlags flags) const {
     //out.out_ << ':' << identifier_->usage_ << '#' << identifier_->offset_;
     if (initialiser_ != NULL) {
         out << ' ' << '=' << ' ';
-        initialiser_->Output(out, CYPA, CYRight(flags));
+        initialiser_->Output(out, CYAssign::Precedence_, CYRight(flags));
     }
 }
 
@@ -323,7 +323,7 @@ void CYDoWhile::Output(CYOutput &out, CYFlags flags) const {
 
 void CYElement::Output(CYOutput &out) const {
     if (value_ != NULL)
-        value_->Output(out, CYPA, CYNoFlags);
+        value_->Output(out, CYAssign::Precedence_, CYNoFlags);
     if (next_ != NULL || value_ == NULL) {
         out << ',';
         if (next_ != NULL && next_->value_ != NULL)
@@ -343,7 +343,7 @@ void CYExpress::Output(CYOutput &out, CYFlags flags) const {
 }
 
 void CYExpression::ClassName(CYOutput &out, bool object) const {
-    Output(out, CYPA, CYNoFlags);
+    Output(out, CYAssign::Precedence_, CYNoFlags);
 }
 
 const char *CYExpression::ForEachIn() const {
@@ -549,7 +549,7 @@ void CYObject::Output(CYOutput &out, CYFlags flags) const {
 
 void CYOptionalFunctionParameter::Output(CYOutput &out) const {
     out << *name_ << '=';
-    initializer_->Output(out, CYPA, CYNoFlags);
+    initializer_->Output(out, CYAssign::Precedence_, CYNoFlags);
     if (next_ != NULL)
         out << ',' << ' ' << *next_;
 }
@@ -576,7 +576,7 @@ void CYProperty::Output(CYOutput &out) const {
     out << '\t';
     name_->PropertyName(out);
     out << ':' << ' ';
-    value_->Output(out, CYPA, CYNoFlags);
+    value_->Output(out, CYAssign::Precedence_, CYNoFlags);
     if (next_ != NULL)
         out << ',' << '\n' << *next_;
     else
index 12a5afd85b27d1b76b6cc68c3f26a48364bc5ae4..54ad617abbfcae0fb63e4703958bf8f66af36ed7 100644 (file)
@@ -22,9 +22,6 @@
 #ifndef CYPARSER_HPP
 #define CYPARSER_HPP
 
-// XXX: wtf is this here?!
-#define CYPA 16
-
 #include <iostream>
 
 #include <string>
@@ -586,8 +583,9 @@ struct CYExpression :
     }
 
 #define CYPrecedence(value) \
+    static const unsigned Precedence_ = value; \
     virtual unsigned Precedence() const { \
-        return value; \
+        return Precedence_; \
     }
 
 #define CYRightHand(value) \