]> git.saurik.com Git - cycript.git/commitdiff
Split CYLast into CYSetLast (eol) and CYGetLast.
authorJay Freeman (saurik) <saurik@saurik.com>
Fri, 8 Jun 2012 22:12:53 +0000 (15:12 -0700)
committerJay Freeman (saurik) <saurik@saurik.com>
Fri, 8 Jun 2012 22:16:28 +0000 (15:16 -0700)
List.hpp
Parser.hpp
Replace.cpp

index f4762f224875a291ffdffaad9cb30b20995de0ec..6fd07312729b054a8486cfe9123baadb4ee5d4ae 100644 (file)
--- a/List.hpp
+++ b/List.hpp
@@ -42,15 +42,25 @@ struct CYNext {
 };
 
 template <typename Type_>
-Type_ *&CYLast(Type_ *&list) {
+Type_ *&CYSetLast(Type_ *&list) {
     if (list == NULL)
         return list;
-    else {
-        Type_ *next(list);
-        while (next->next_ != NULL)
-            next = next->next_;
-        return next->next_;
-    }
+
+    Type_ *next(list);
+    while (next->next_ != NULL)
+        next = next->next_;
+    return next->next_;
+}
+
+template <typename Type_>
+Type_ *CYGetLast(Type_ *list) {
+    if (list == NULL)
+        return NULL;
+
+    Type_ *next(list);
+    while (next->next_ != NULL)
+        next = next->next_;
+    return next;
 }
 
 #define CYForEach(value, list) \
index 57dd99356686e7405039f4cfa17c6777bf365ca8..c26e6d298fb8d61815feeb9d8a214656651f6c89 100644 (file)
@@ -430,7 +430,7 @@ struct CYBlock :
     }
 
     void AddPrev(CYStatement *statement) {
-        CYLast(statement) = statements_;
+        CYSetLast(statement) = statements_;
         statements_ = statement;
     }
 
@@ -619,7 +619,7 @@ struct CYCompound :
     }
 
     void AddPrev(CYExpression *expression) {
-        CYLast(expression) = expressions_;
+        CYSetLast(expression) = expressions_;
         expressions_ = expression;
     }
 
index c70aab8f62d09a2f9bcd41e3c365b44c0e7e9f63..3e063081b1aeea731244e5a12f09683136d5be5e 100644 (file)
@@ -513,7 +513,7 @@ namespace cy {
 namespace Syntax {
 
 CYExpression *New::AddArgument(CYContext &context, CYExpression *value) {
-    CYLast(arguments_) = $ CYArgument(value);
+    CYSetLast(arguments_) = $ CYArgument(value);
     return this;
 }