From 8351aa30d8842a047a3b2b987dd75bc0590882a6 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Mon, 12 Jul 2010 00:30:02 +0000 Subject: [PATCH] Remove CYPA and replace with saner inline constant CYAssign::Precedence_. --- ObjectiveC/Output.mm | 6 +++--- Output.cpp | 16 ++++++++-------- Parser.hpp | 6 ++---- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/ObjectiveC/Output.mm b/ObjectiveC/Output.mm index 3f360a8..91696cb 100644 --- a/ObjectiveC/Output.mm +++ b/ObjectiveC/Output.mm @@ -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 << ']'; } diff --git a/Output.cpp b/Output.cpp index d5d403c..6e70b6b 100644 --- a/Output.cpp +++ b/Output.cpp @@ -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 diff --git a/Parser.hpp b/Parser.hpp index 12a5afd..54ad617 100644 --- a/Parser.hpp +++ b/Parser.hpp @@ -22,9 +22,6 @@ #ifndef CYPARSER_HPP #define CYPARSER_HPP -// XXX: wtf is this here?! -#define CYPA 16 - #include #include @@ -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) \ -- 2.45.2