X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/cde20a5add55cd85f55405acf6d60c2eafc2b575..fb726fc55e2a79b03564be97d5057e28805d84f0:/Replace.cpp?ds=sidebyside diff --git a/Replace.cpp b/Replace.cpp index b804ce3..e6b761f 100644 --- a/Replace.cpp +++ b/Replace.cpp @@ -213,15 +213,7 @@ CYProperty *CYDeclarations::Property(CYContext &context) { $T(NULL) } CYCompound *CYDeclarations::Replace(CYContext &context) { - CYCompound *compound; - if (next_ == NULL) compound: - compound = $ CYCompound(); - else { - compound = next_->Replace(context); - if (compound == NULL) - goto compound; - } - + CYCompound *compound(next_ == NULL ? $ CYCompound() : next_->Replace(context)); if (CYAssignment *assignment = declaration_->Assignment(context)) compound->AddPrev(assignment); return compound; @@ -461,10 +453,7 @@ namespace cy { namespace Syntax { CYExpression *New::AddArgument(CYContext &context, CYExpression *value) { - CYArgument **argument(&arguments_); - while (*argument != NULL) - argument = &(*argument)->next_; - *argument = $ CYArgument(value); + CYSetLast(arguments_, $ CYArgument(value)); return this; } @@ -557,8 +546,8 @@ void CYProgram::Replace(CYContext &context) { IdentifierUsages usages; if (offset < context.rename_.size()) - for (CYIdentifier *i(context.rename_[offset].identifier_); i != NULL; i = i->next_) - usages.insert(i); + CYForEach (i, context.rename_[offset].identifier_) + usages.insert(i); // XXX: totalling the probable occurrences and sorting by them would improve the result for (CYIdentifierUsageVector::const_iterator i(context.rename_.begin()); i != context.rename_.end(); ++i, ++offset) { @@ -590,7 +579,7 @@ void CYProgram::Replace(CYContext &context) { // XXX: at some point, this could become a keyword } - for (CYIdentifier *identifier(i->identifier_); identifier != NULL; identifier = identifier->next_) + CYForEach (identifier, i->identifier_) identifier->Set(name); } } @@ -632,6 +621,9 @@ CYScope::CYScope(CYScopeType type, CYContext &context, CYStatement *&statements) context_.scope_ = this; } +CYScope::~CYScope() { +} + void CYScope::Close() { context_.scope_ = parent_; Scope(context_, statements_);