修复了parser解析initexpr模式判断错误的问题。修复标准库改名忘改的问题

This commit is contained in:
2026-02-04 20:34:35 +08:00
parent b4b6d409b5
commit 50ca68b1a4
4 changed files with 128 additions and 20 deletions

View File

@@ -5,7 +5,7 @@
Copyright © 2025 PuqiAR. All rights reserved.
*/
import std.value; // `type` function and string_from
// import std.value; // `type` function and string_from
struct FormatError
@@ -37,7 +37,7 @@ public func format(objects ...) -> Any
}
var fmt := objects[0];
var fmtType := value.type(fmt);
var fmtType := type(fmt);
if fmtType != "String"
{
throw new FormatError{"arg 0 (fmt) must be String type, got " + fmtType};
@@ -88,7 +88,7 @@ public func format(objects ...) -> Any
throw new FormatError{"require enough format expression"};
}
result += value.string_from(objects[argIndex]);
result += objects[argIndex] as String;
argIndex += 1;
i = endIndex + 1;
@@ -116,7 +116,7 @@ public func format(objects ...) -> Any
public func formatByListArgs(objects) -> Any
{
if value.type(objects) != "List"
if not (objects is List)
{
return null;
}
@@ -126,7 +126,7 @@ if objects.length() < 1
}
var fmt := objects[0];
var fmtType := value.type(fmt);
var fmtType := type(fmt);
if fmtType != "String"
{
throw new FormatError{"arg 0 (fmt) must be String type, got " + fmtType};
@@ -177,7 +177,7 @@ if objects.length() < 1
throw new FormatError{"require enough format expression"};
}
result += value.string_from(objects[argIndex]);
result += objects[argIndex] as String;
argIndex += 1;
i = endIndex + 1;