feat: 添加内置函数支持(len, typeof, push, pop),更新相关错误处理和测试用例

This commit is contained in:
0264408
2026-06-16 19:03:47 +08:00
parent 18fa53cf4a
commit 75c1d230ad
7 changed files with 314 additions and 9 deletions
+21
View File
@@ -0,0 +1,21 @@
// Quick smoke test for new builtins
print("--- len ---")
print(len("hello"))
print(len([1, 2, 3]))
print(len({a: 1, b: 2, c: 3}))
print("--- typeof ---")
print(typeof(42))
print(typeof("hi"))
print(typeof(true))
print(typeof(nil))
print(typeof([1, 2]))
print(typeof({a: 1}))
print(typeof(print))
print("--- push/pop ---")
let arr = [1, 2]
print("push:", push(arr, 3))
print("arr:", arr)
print("pop:", pop(arr))
print("arr:", arr)