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

Commit d44999a

Browse files
committed
feat(core): 添加函数和方法的记忆化属性
- 在 Function 结构中添加 is_memoized 字段,用于标记记忆化函数 - 在 Method 结构中添加 is_memoized 字段,用于标记记忆化方法 - 此特性支持 Issue #89 和 Issue #93 的实现
1 parent e2148f4 commit d44999a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/ast.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ pub enum Statement {
265265
EnumDeclaration(Enum), // 枚举声明
266266
// 模式匹配语句
267267
Match(Expression, Vec<MatchArm>), // match语句:匹配表达式和匹配分支列表
268+
268269
// 未来可以扩展更多语句类型
269270
}
270271

@@ -283,6 +284,7 @@ pub struct Function {
283284
pub return_type: Type,
284285
pub body: Vec<Statement>,
285286
pub where_clause: Vec<TypeConstraint>, // where子句中的约束
287+
pub is_memoized: bool, // 是否为记忆化函数
286288
}
287289

288290
#[derive(Debug, Clone)]
@@ -334,6 +336,7 @@ pub struct Method {
334336
pub is_virtual: bool, // 是否为虚方法
335337
pub is_override: bool, // 是否重写父类方法
336338
pub is_abstract: bool, // 是否为抽象方法
339+
pub is_memoized: bool, // 是否为记忆化方法
337340
pub where_clause: Vec<TypeConstraint>, // where子句中的约束
338341
}
339342

0 commit comments

Comments
 (0)