[Fix] 修复科学表达式数字解析的问题(Lexer引起) 由 Satklomi发现,感谢 [Feat] 增加Compiler相关定义,将开发BytecodeVM [Tip] Evaluator进入Bug fix阶段,新功能延缓开发。转向VM
29 lines
642 B
C++
29 lines
642 B
C++
#include <VMValue/VMValue.hpp>
|
|
|
|
#include <cassert>
|
|
#include <string>
|
|
|
|
namespace Fig
|
|
{
|
|
FString Value::toString() const
|
|
{
|
|
if (static_cast<int>(type) > static_cast<int>(Double))
|
|
{
|
|
return heap->toString();
|
|
}
|
|
switch (type)
|
|
{
|
|
case Null:
|
|
return u8"null";
|
|
case Bool:
|
|
return (b ? u8"true" : u8"false");
|
|
case Int:
|
|
return FString(std::to_string(i));
|
|
case Double:
|
|
return FString(std::to_string(d));
|
|
|
|
default:
|
|
assert(false);
|
|
}
|
|
}
|
|
}; |