mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
refactor(semantic): remove defunct code setting ScopeFlags twice (#4286)
Scope flags for functions is set when the scope is created. Remove redundant code that sets them again.
This commit is contained in:
parent
2c7bb9f6c8
commit
c5731a5431
1 changed files with 10 additions and 22 deletions
|
|
@ -151,28 +151,16 @@ impl<'a> Binder for Function<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// bind scope flags: Constructor | GetAccessor | SetAccessor
|
// Bind scope flags: GetAccessor | SetAccessor
|
||||||
if let Some(kind) = builder.nodes.parent_kind(builder.current_node_id) {
|
if let Some(AstKind::ObjectProperty(prop)) =
|
||||||
match kind {
|
builder.nodes.parent_kind(builder.current_node_id)
|
||||||
AstKind::MethodDefinition(def) => {
|
{
|
||||||
let flag = builder.scope.get_flags_mut(current_scope_id);
|
let flag = builder.scope.get_flags_mut(current_scope_id);
|
||||||
*flag |= match def.kind {
|
match prop.kind {
|
||||||
MethodDefinitionKind::Constructor => ScopeFlags::Constructor,
|
PropertyKind::Get => *flag |= ScopeFlags::GetAccessor,
|
||||||
MethodDefinitionKind::Get => ScopeFlags::GetAccessor,
|
PropertyKind::Set => *flag |= ScopeFlags::SetAccessor,
|
||||||
MethodDefinitionKind::Set => ScopeFlags::SetAccessor,
|
PropertyKind::Init => {}
|
||||||
MethodDefinitionKind::Method => ScopeFlags::empty(),
|
};
|
||||||
};
|
|
||||||
}
|
|
||||||
AstKind::ObjectProperty(prop) => {
|
|
||||||
let flag = builder.scope.get_flags_mut(current_scope_id);
|
|
||||||
*flag |= match prop.kind {
|
|
||||||
PropertyKind::Get => ScopeFlags::GetAccessor,
|
|
||||||
PropertyKind::Set => ScopeFlags::SetAccessor,
|
|
||||||
PropertyKind::Init => ScopeFlags::empty(),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue