MCPcopy Create free account
hub / github.com/MikePopoloski/slang / eval

Method eval

source/ast/builtins/ArrayMethods.cpp:796–818  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

794 }
795
796 ConstantValue eval(EvalContext& context, const Args& args, SourceRange,
797 const CallExpression::SystemCallInfo&) const final {
798 auto lval = args[0]->evalLValue(context);
799 auto cv = args[1]->eval(context);
800 if (!lval || !cv)
801 return nullptr;
802
803 auto target = lval.resolve();
804 SLANG_ASSERT(target && target->isQueue());
805
806 auto& q = *target->queue();
807 if (front)
808 q.push_front(std::move(cv));
809 else
810 q.push_back(std::move(cv));
811
812 q.resizeToBound();
813
814 if (!context.checkMaxValue(*target, args[0]->sourceRange))
815 return nullptr;
816
817 return NullConstant;
818 }
819
820private:
821 bool front;

Callers

nothing calls this directly

Calls 5

evalLValueMethod · 0.80
push_backMethod · 0.80
checkMaxValueMethod · 0.80
evalMethod · 0.45
resolveMethod · 0.45

Tested by

no test coverage detected