[VER] v0.3.9-alpha
All checks were successful
Release Build / build-windows-x64 (push) Successful in 1m0s
Release Build / build-linux-x64 (push) Successful in 1m2s

[Feat] is 操作符现在可以直接判断内置数据类型, 如 10 is Int
[Fix] evalMemberExpr的lhs可以为右值,修复原来限制为左值的BUG,如调用一个函数返回结果为struct且访问member触发此bug
[Impl] 可更换的std::dynamic_pointer_cast更换为static版本,更快!
[Feat] 增加标准库 std.time,以及用到的builtin: __ftime_now_ns,但目前 Time类有点BUG
[...] 剩下的忘了
This commit is contained in:
2026-01-15 17:51:01 +08:00
parent ccf80536b3
commit d398d457b5
10 changed files with 199 additions and 41 deletions

View File

@@ -1,10 +1,12 @@
#pragma once
#include "Ast/Statements/InterfaceDefSt.hpp"
#include "Ast/functionParameters.hpp"
#include <Ast/Statements/InterfaceDefSt.hpp>
#include <Ast/functionParameters.hpp>
#include <Core/fig_string.hpp>
#include <Value/value.hpp>
#include <Core/runtimeTime.hpp>
#include <chrono>
#include <numeric>
#include <unordered_map>
#include <functional>
@@ -65,6 +67,7 @@ namespace Fig
{u8"__fvalue_double_parse", 1},
{u8"__fvalue_double_from", 1},
{u8"__fvalue_string_from", 1},
{u8"__ftime_now_ns", 0},
/* math start */
{u8"__fmath_acos", 1},
{u8"__fmath_acosh", 1},
@@ -194,6 +197,15 @@ namespace Fig
ObjectPtr val = args[0];
return std::make_shared<Object>(val->toStringIO());
}},
{u8"__ftime_now_ns",
[](const std::vector<ObjectPtr> &args) -> ObjectPtr {
// returns nanoseconds
using namespace Fig::Time;
auto now = Clock::now();
return std::make_shared<Object>(static_cast<ValueType::IntClass>(
std::chrono::duration_cast<std::chrono::nanoseconds>(now - start_time).count()));
}},
/* math start */
{u8"__fmath_acos",
[](const std::vector<ObjectPtr> &args) -> ObjectPtr {