| 811 | } // namespace |
| 812 | |
| 813 | std::vector<FieldRef> FieldsInExpression(const Expression& expr) { |
| 814 | if (expr.literal()) return {}; |
| 815 | |
| 816 | if (auto ref = expr.field_ref()) { |
| 817 | return {*ref}; |
| 818 | } |
| 819 | |
| 820 | std::vector<FieldRef> fields; |
| 821 | for (const Expression& arg : CallNotNull(expr)->arguments) { |
| 822 | auto argument_fields = FieldsInExpression(arg); |
| 823 | std::move(argument_fields.begin(), argument_fields.end(), std::back_inserter(fields)); |
| 824 | } |
| 825 | return fields; |
| 826 | } |
| 827 | |
| 828 | bool ExpressionHasFieldRefs(const Expression& expr) { |
| 829 | if (expr.literal()) return false; |