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

Method eval

source/ast/builtins/ArrayMethods.cpp:660–669  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

658 }
659
660 ConstantValue eval(EvalContext& context, const Args& args, SourceRange,
661 const CallExpression::SystemCallInfo&) const final {
662 auto array = args[0]->eval(context);
663 auto index = args[1]->eval(context);
664 if (!array || !index)
665 return nullptr;
666
667 bool exists = array.map()->count(index);
668 return SVInt(32, exists ? 1 : 0, true);
669 }
670};
671
672class AssocArrayTraversalMethod : public SystemSubroutine {

Callers

nothing calls this directly

Calls 3

SVIntFunction · 0.85
evalMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected