X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/690cf1a8442f51ef6d03d9a0a4fb4ee2e9bb714d..1cf12770640ddf1ea2e0656fec69d61b7389dc3c:/Output.cpp diff --git a/Output.cpp b/Output.cpp index 084bf71..51134c7 100644 --- a/Output.cpp +++ b/Output.cpp @@ -329,7 +329,7 @@ void CYExpression::Output(CYOutput &out) const { Output(out, CYNoFlags); } -void CYExpression::Output(CYOutput &out, unsigned precedence, CYFlags flags) const { +void CYExpression::Output(CYOutput &out, int precedence, CYFlags flags) const { if (precedence < Precedence() || (flags & CYNoRightHand) != 0 && RightHand()) out << '(' << *this << ')'; else @@ -474,6 +474,69 @@ void CYLabel::Output(CYOutput &out, CYFlags flags) const { statement_->Single(out, CYRight(flags)); } +void CYTypeArrayOf::Output(CYOutput &out, CYIdentifier *identifier) const { + next_->Output(out, Precedence(), identifier); + out << '['; + out << size_; + out << ']'; +} + +void CYTypeBlockWith::Output(CYOutput &out, CYIdentifier *identifier) const { + out << '(' << '^'; + next_->Output(out, Precedence(), identifier); + out << ')' << '(' << parameters_ << ')'; +} + +void CYTypeConstant::Output(CYOutput &out, CYIdentifier *identifier) const { + out << "const"; + next_->Output(out, Precedence(), identifier); +} + +void CYTypeFunctionWith::Output(CYOutput &out, CYIdentifier *identifier) const { + next_->Output(out, Precedence(), identifier); + out << '(' << parameters_ << ')'; +} + +void CYTypePointerTo::Output(CYOutput &out, CYIdentifier *identifier) const { + out << '*'; + next_->Output(out, Precedence(), identifier); +} + +void CYTypeVolatile::Output(CYOutput &out, CYIdentifier *identifier) const { + out << "volatile"; + next_->Output(out, Precedence(), identifier); +} + +void CYTypeModifier::Output(CYOutput &out, int precedence, CYIdentifier *identifier) const { + if (this == NULL) { + out << identifier; + return; + } + + bool protect(precedence > Precedence()); + + if (protect) + out << '('; + Output(out, identifier); + if (protect) + out << ')'; +} + +void CYTypedIdentifier::Output(CYOutput &out) const { + type_->Output(out, 0, CYNoFlags); + modifier_->Output(out, 0, identifier_); +} + +void CYEncodedType::Output(CYOutput &out, CYFlags flags) const { + out << "@encode(" << typed_ << ")"; +} + +void CYTypedParameter::Output(CYOutput &out) const { + out << typed_; + if (next_ != NULL) + out << ',' << ' ' << next_; +} + void CYLambda::Output(CYOutput &out, CYFlags flags) const { // XXX: this is seriously wrong out << "[]("; @@ -482,6 +545,10 @@ void CYLambda::Output(CYOutput &out, CYFlags flags) const { out << "}"; } +void CYTypeDefinition::Output(CYOutput &out, CYFlags flags) const { + out << "typedef" << *typed_; +} + void CYLetStatement::Output(CYOutput &out, CYFlags flags) const { out << "let" << ' ' << '(' << *declarations_ << ')'; code_->Single(out, CYRight(flags));