| 37 | /* isFirstArgLValue */ true) {} |
| 38 | |
| 39 | ConstantValue eval(EvalContext& context, const Args& args, SourceRange, |
| 40 | const CallExpression::SystemCallInfo&) const final { |
| 41 | auto strCv = args[0]->evalLValue(context); |
| 42 | auto indexCv = args[1]->eval(context); |
| 43 | auto charCv = args[2]->eval(context); |
| 44 | if (!strCv || !indexCv || !charCv) |
| 45 | return nullptr; |
| 46 | |
| 47 | const std::string& str = strCv.load().str(); |
| 48 | int32_t index = indexCv.integer().as<int32_t>().value(); |
| 49 | uint8_t c = charCv.integer().as<uint8_t>().value(); |
| 50 | |
| 51 | if (c == 0 || index < 0 || size_t(index) >= str.length()) |
| 52 | return NullConstant; |
| 53 | |
| 54 | strCv.addIndex(index, nullptr); |
| 55 | strCv.store(SVInt(8, c, false)); |
| 56 | return NullConstant; |
| 57 | } |
| 58 | }; |
| 59 | |
| 60 | class StringGetcMethod : public SimpleSystemSubroutine { |