| 736 | } |
| 737 | |
| 738 | ConstantValue eval(EvalContext& context, const Args& args, SourceRange, |
| 739 | const CallExpression::SystemCallInfo&) const final { |
| 740 | auto lval = args[0]->evalLValue(context); |
| 741 | if (!lval) |
| 742 | return nullptr; |
| 743 | |
| 744 | auto target = lval.resolve(); |
| 745 | SLANG_ASSERT(target && target->isQueue()); |
| 746 | |
| 747 | auto& q = *target->queue(); |
| 748 | if (q.empty()) { |
| 749 | context.addDiag(diag::ConstEvalEmptyQueue, args[0]->sourceRange); |
| 750 | return args[0]->type->getArrayElementType()->getDefaultValue(); |
| 751 | } |
| 752 | |
| 753 | ConstantValue result = front ? std::move(q.front()) : std::move(q.back()); |
| 754 | if (front) |
| 755 | q.pop_front(); |
| 756 | else |
| 757 | q.pop_back(); |
| 758 | |
| 759 | return result; |
| 760 | } |
| 761 | |
| 762 | private: |
| 763 | bool front; |
no test coverage detected