mirror of
https://github.com/voltrevo/ValueScript.git
synced 2026-04-18 03:00:27 -04:00
decl_or_param_pat -> pat
This commit is contained in:
@@ -349,12 +349,12 @@ impl FunctionCompiler {
|
||||
match functionish {
|
||||
Functionish::Fn(fn_) => {
|
||||
for (i, p) in fn_.params.iter().enumerate() {
|
||||
self.decl_or_param_pat(&p.pat, ¶m_registers[i], false, scope);
|
||||
self.pat(&p.pat, ¶m_registers[i], false, scope);
|
||||
}
|
||||
}
|
||||
Functionish::Arrow(arrow) => {
|
||||
for (i, p) in arrow.params.iter().enumerate() {
|
||||
self.decl_or_param_pat(p, ¶m_registers[i], false, scope);
|
||||
self.pat(p, ¶m_registers[i], false, scope);
|
||||
}
|
||||
}
|
||||
Functionish::Constructor(_, constructor) => {
|
||||
@@ -364,7 +364,7 @@ impl FunctionCompiler {
|
||||
// TODO (Diagnostic emitted elsewhere)
|
||||
}
|
||||
swc_ecma_ast::ParamOrTsParamProp::Param(p) => {
|
||||
self.decl_or_param_pat(&p.pat, ¶m_registers[i], false, scope);
|
||||
self.pat(&p.pat, ¶m_registers[i], false, scope);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -372,7 +372,7 @@ impl FunctionCompiler {
|
||||
};
|
||||
}
|
||||
|
||||
pub fn decl_or_param_pat(
|
||||
pub fn pat(
|
||||
&mut self,
|
||||
pat: &swc_ecma_ast::Pat,
|
||||
register: &String,
|
||||
@@ -407,7 +407,7 @@ impl FunctionCompiler {
|
||||
}
|
||||
Pat::Assign(assign) => {
|
||||
self.default_expr(&assign.right, register, scope);
|
||||
self.decl_or_param_pat(&assign.left, register, false, scope);
|
||||
self.pat(&assign.left, register, false, scope);
|
||||
}
|
||||
Pat::Array(array) => {
|
||||
for (i, elem_opt) in array.elems.iter().enumerate() {
|
||||
@@ -422,7 +422,7 @@ impl FunctionCompiler {
|
||||
.definition
|
||||
.push(format!(" sub %{} {} %{}", register, i, elem_reg));
|
||||
|
||||
self.decl_or_param_pat(elem, &elem_reg, false, scope);
|
||||
self.pat(elem, &elem_reg, false, scope);
|
||||
}
|
||||
|
||||
if !skip_release {
|
||||
@@ -449,8 +449,7 @@ impl FunctionCompiler {
|
||||
|
||||
ec.fnc.definition.push(sub_instr);
|
||||
|
||||
ec.fnc
|
||||
.decl_or_param_pat(&kv.value, ¶m_reg, false, scope);
|
||||
ec.fnc.pat(&kv.value, ¶m_reg, false, scope);
|
||||
}
|
||||
ObjectPatProp::Assign(assign) => {
|
||||
let key = assign.key.sym.to_string();
|
||||
@@ -1171,7 +1170,7 @@ impl FunctionCompiler {
|
||||
ec.compile(expr, Some(target_register.clone()));
|
||||
drop(ec);
|
||||
|
||||
self.decl_or_param_pat(&decl.name, &target_register, false, scope);
|
||||
self.pat(&decl.name, &target_register, false, scope);
|
||||
}
|
||||
None => match &decl.name {
|
||||
swc_ecma_ast::Pat::Ident(_) => {
|
||||
|
||||
Reference in New Issue
Block a user