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

Method eval

source/ast/builtins/StringMethods.cpp:204–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

202 builtins.realType, true) {}
203
204 ConstantValue eval(EvalContext& context, const Args& args, SourceRange,
205 const CallExpression::SystemCallInfo&) const final {
206 auto cv = args[0]->eval(context);
207 if (!cv)
208 return nullptr;
209
210 std::string str = cv.str();
211 std::erase(str, '_');
212
213 double result = strToDouble(str).value_or(0.0);
214 return real_t(result);
215 }
216};
217
218class StringItoAMethod : public SimpleSystemSubroutine {

Callers

nothing calls this directly

Calls 5

strToDoubleFunction · 0.85
real_tFunction · 0.85
strMethod · 0.80
eraseFunction · 0.50
evalMethod · 0.45

Tested by

no test coverage detected