mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-24 02:31:13 +08:00
refactor: 移除代码注释中的文档内部编号引用
This commit is contained in:
@@ -159,7 +159,7 @@ pub(crate) struct CompileCtx {
|
||||
pub(crate) builtin_reg_map: Vec<(String, u8)>,
|
||||
pub(crate) sub_modules: Vec<CompiledModule>,
|
||||
/// Register holding `this` in the enclosing function context.
|
||||
/// Used by arrow functions to capture lexical `this` (D-01).
|
||||
/// Used by arrow functions to capture lexical `this`.
|
||||
/// Initialized to 254 (conventional this register) at the top level.
|
||||
pub(crate) enclosing_this_reg: u8,
|
||||
pub(crate) in_derived_constructor: bool,
|
||||
|
||||
@@ -4,7 +4,7 @@ impl Compiler {
|
||||
pub(in crate::emitter) fn emit_arrow_function_expression(
|
||||
&self, arrow: &oxide_parser::ArrowFunctionExpression, ctx: &mut CompileCtx,
|
||||
) -> Result<u8, String> {
|
||||
// Rest params not yet supported (D-06 placeholder)
|
||||
// Rest params not yet supported
|
||||
if let Some(_rest) = &arrow.params.rest {
|
||||
return Err("rest params in arrow functions not yet supported".into());
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ impl Compiler {
|
||||
let key_reg = ctx.alloc_reg();
|
||||
ctx.emit_load_const(key_reg, idx);
|
||||
let val_reg = self.emit_expression(&p.value, ctx)?;
|
||||
// Name inference (D-04): if property value is an arrow function,
|
||||
// Name inference: if property value is an arrow function,
|
||||
// set the compiled sub_module's function_name to the property key.
|
||||
if matches!(&p.value, Expression::ArrowFunctionExpression(_)) {
|
||||
if let Some(sub_mod) = ctx.sub_modules.last_mut() {
|
||||
|
||||
@@ -76,7 +76,7 @@ fn compile_arrow_name_inference() {
|
||||
.sub_modules
|
||||
.iter()
|
||||
.any(|m| m.is_arrow && m.function_name.as_deref() == Some("myArrow"));
|
||||
assert!(named, "arrow function should have function_name='myArrow' from D-04 inference");
|
||||
assert!(named, "arrow function should have function_name='myArrow' from name inference");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user