xlat_exp_foreach(head, node) {
switch (node->type){
case XLAT_FUNC:
- if (!type || (type & XLAT_FUNC)) {
- ret = walker(node, uctx);
- if (ret < 0) return ret;
- }
-
/*
- * Now evaluate the function's arguments
+ * Evaluate the function's arguments
+ * first, as they may get moved around
+ * when the function is instantiated.
*/
if (xlat_exp_head(node->call.args)) {
ret = xlat_eval_walk(node->call.args, walker, type, uctx);
if (ret < 0) return ret;
}
+
+ if (!type || (type & XLAT_FUNC)) {
+ ret = walker(node, uctx);
+ if (ret < 0) return ret;
+ }
break;
case XLAT_FUNC_UNRESOLVED: