Skip to content
This repository was archived by the owner on Aug 18, 2025. It is now read-only.

Commit edc0d80

Browse files
committed
修复命名空间类型判断逻辑,所有使用的命名空间现在统一为代码命名空间,库的命名空间由各自的库文件声明。
1 parent 7358922 commit edc0d80

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/parser/program_parser.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,9 @@ pub fn parse_program(parser: &mut ParserBase) -> Result<Program, String> {
126126
// 期望 ";" 符号
127127
parser.expect(";")?;
128128

129-
// 🔧 修复:根据命名空间名称判断类型
130-
// std是内置命名空间,不是外部库
131-
let namespace_type = if path.len() == 1 && (path[0] == "io" || path[0] == "time" || path[0] == "math" || path[0] == "fs" || path[0] == "os" || path[0] == "http" || path[0] == "json") {
132-
crate::ast::NamespaceType::Library // 库命名空间
133-
} else {
134-
crate::ast::NamespaceType::Code // 代码命名空间(包括std)
135-
};
129+
// � v0.6.2 修复:所有 using ns 都应该是代码命名空间
130+
// 库的命名空间由各自的库文件(library_等)自行声明
131+
let namespace_type = crate::ast::NamespaceType::Code;
136132

137133
// 添加到命名空间导入列表
138134
imported_namespaces.push((namespace_type, path));

0 commit comments

Comments
 (0)