feat: 支持 class 静态方法与静态 super

This commit is contained in:
爱特每羊队
2026-06-09 09:59:42 +08:00
parent 5638638909
commit b2540f427b
4 changed files with 90 additions and 8 deletions
+3
View File
@@ -72,6 +72,7 @@ pub(crate) struct CompileCtx {
pub(crate) enclosing_this_reg: u8,
pub(crate) in_derived_constructor: bool,
pub(crate) in_instance_method: bool,
pub(crate) in_static_method: bool,
}
impl CompileCtx {
@@ -93,6 +94,7 @@ impl CompileCtx {
enclosing_this_reg: 254, // conventional this register at top level
in_derived_constructor: false,
in_instance_method: false,
in_static_method: false,
}
}
@@ -303,6 +305,7 @@ impl Compiler {
ctx.enclosing_this_reg = parent_ctx.enclosing_this_reg;
ctx.in_derived_constructor = parent_ctx.in_derived_constructor;
ctx.in_instance_method = parent_ctx.in_instance_method;
ctx.in_static_method = parent_ctx.in_static_method;
// Inherit parent's global scope entries so previously-declared function names
// are visible from within the body.