From: Jay Freeman (saurik) Date: Fri, 8 Jun 2012 22:03:59 +0000 (-0700) Subject: Refactor CYSetLast to return a reference to the eol. X-Git-Tag: v0.9.458~14 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/abadba191738e5d27797718fccf50d82ffe7b0b6 Refactor CYSetLast to return a reference to the eol. --- diff --git a/List.hpp b/List.hpp index 92d64e1..f4762f2 100644 --- a/List.hpp +++ b/List.hpp @@ -42,14 +42,14 @@ struct CYNext { }; template -void CYSetLast(Type_ *&list, Type_ *item) { +Type_ *&CYLast(Type_ *&list) { if (list == NULL) - list = item; + return list; else { Type_ *next(list); while (next->next_ != NULL) next = next->next_; - next->next_ = item; + return next->next_; } } diff --git a/Parser.hpp b/Parser.hpp index c53d132..57dd993 100644 --- a/Parser.hpp +++ b/Parser.hpp @@ -430,7 +430,7 @@ struct CYBlock : } void AddPrev(CYStatement *statement) { - CYSetLast(statement, statements_); + CYLast(statement) = statements_; statements_ = statement; } @@ -619,7 +619,7 @@ struct CYCompound : } void AddPrev(CYExpression *expression) { - CYSetLast(expression, expressions_); + CYLast(expression) = expressions_; expressions_ = expression; } diff --git a/Replace.cpp b/Replace.cpp index d40c8f3..c70aab8 100644 --- a/Replace.cpp +++ b/Replace.cpp @@ -513,7 +513,7 @@ namespace cy { namespace Syntax { CYExpression *New::AddArgument(CYContext &context, CYExpression *value) { - CYSetLast(arguments_, $ CYArgument(value)); + CYLast(arguments_) = $ CYArgument(value); return this; }