From abadba191738e5d27797718fccf50d82ffe7b0b6 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Fri, 8 Jun 2012 15:03:59 -0700 Subject: [PATCH] Refactor CYSetLast to return a reference to the eol. --- List.hpp | 6 +++--- Parser.hpp | 4 ++-- Replace.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) 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; } -- 2.49.0