};
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) \
}
void AddPrev(CYStatement *statement) {
- CYLast(statement) = statements_;
+ CYSetLast(statement) = statements_;
statements_ = statement;
}
}
void AddPrev(CYExpression *expression) {
- CYLast(expression) = expressions_;
+ CYSetLast(expression) = expressions_;
expressions_ = expression;
}
namespace Syntax {
CYExpression *New::AddArgument(CYContext &context, CYExpression *value) {
- CYLast(arguments_) = $ CYArgument(value);
+ CYSetLast(arguments_) = $ CYArgument(value);
return this;
}