| 854 | } |
| 855 | |
| 856 | ConstantValue eval(EvalContext& context, const Args& args, SourceRange, |
| 857 | const CallExpression::SystemCallInfo&) const final { |
| 858 | auto lval = args[0]->evalLValue(context); |
| 859 | auto ci = args[1]->eval(context); |
| 860 | auto cv = args[2]->eval(context); |
| 861 | if (!lval || !ci || !cv) |
| 862 | return nullptr; |
| 863 | |
| 864 | auto target = lval.resolve(); |
| 865 | SLANG_ASSERT(target && target->isQueue()); |
| 866 | |
| 867 | auto& q = *target->queue(); |
| 868 | std::optional<int32_t> index = ci.integer().as<int32_t>(); |
| 869 | if (!index || *index < 0 || size_t(*index) >= q.size() + 1) { |
| 870 | context.addDiag(diag::ConstEvalDynamicArrayIndex, args[1]->sourceRange) |
| 871 | << ci << *args[0]->type << q.size() + 1; |
| 872 | return NullConstant; |
| 873 | } |
| 874 | |
| 875 | q.insert(q.begin() + *index, std::move(cv)); |
| 876 | q.resizeToBound(); |
| 877 | |
| 878 | if (!context.checkMaxValue(*target, args[0]->sourceRange)) |
| 879 | return nullptr; |
| 880 | |
| 881 | return NullConstant; |
| 882 | } |
| 883 | }; |
| 884 | |
| 885 | class QueueDeleteMethod : public SystemSubroutine { |
nothing calls this directly
no test coverage detected