mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
fix(semantic): add interfaces and functions to SymbolFlags::ClassExcludes (#6057)
This brings ClassExcludes into alignment with TypeScript.
This commit is contained in:
parent
93d509db2b
commit
933a7431b1
2 changed files with 19 additions and 2 deletions
|
|
@ -475,3 +475,18 @@ fn test_module_like_declarations() {
|
||||||
"A symbol should not be created for global augmentation declarations."
|
"A symbol should not be created for global augmentation declarations."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_class_merging() {
|
||||||
|
// classes can be merged with interfaces, resulting in a single symbol
|
||||||
|
SemanticTester::ts(
|
||||||
|
"
|
||||||
|
class Foo {}
|
||||||
|
interface Foo {}
|
||||||
|
",
|
||||||
|
)
|
||||||
|
.has_root_symbol("Foo")
|
||||||
|
.contains_flags(SymbolFlags::Class)
|
||||||
|
.contains_flags(SymbolFlags::Interface)
|
||||||
|
.test();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -100,8 +100,10 @@ bitflags! {
|
||||||
const Ambient = 1 << 19;
|
const Ambient = 1 << 19;
|
||||||
|
|
||||||
const Enum = Self::ConstEnum.bits() | Self::RegularEnum.bits();
|
const Enum = Self::ConstEnum.bits() | Self::RegularEnum.bits();
|
||||||
|
|
||||||
const Variable = Self::FunctionScopedVariable.bits() | Self::BlockScopedVariable.bits();
|
const Variable = Self::FunctionScopedVariable.bits() | Self::BlockScopedVariable.bits();
|
||||||
|
|
||||||
|
const BlockScoped = Self::BlockScopedVariable.bits() | Self::Enum.bits() | Self::Class.bits();
|
||||||
|
|
||||||
const Value = Self::Variable.bits() | Self::Class.bits() | Self::Enum.bits() | Self::EnumMember.bits() | Self::ValueModule.bits();
|
const Value = Self::Variable.bits() | Self::Class.bits() | Self::Enum.bits() | Self::EnumMember.bits() | Self::ValueModule.bits();
|
||||||
const Type = Self::Class.bits() | Self::Interface.bits() | Self::Enum.bits() | Self::EnumMember.bits() | Self::TypeLiteral.bits() | Self::TypeParameter.bits() | Self::TypeAlias.bits();
|
const Type = Self::Class.bits() | Self::Interface.bits() | Self::Enum.bits() | Self::EnumMember.bits() | Self::TypeLiteral.bits() | Self::TypeParameter.bits() | Self::TypeAlias.bits();
|
||||||
|
|
||||||
|
|
@ -113,7 +115,7 @@ bitflags! {
|
||||||
/// they can not merge with anything in the value space
|
/// they can not merge with anything in the value space
|
||||||
const BlockScopedVariableExcludes = Self::Value.bits();
|
const BlockScopedVariableExcludes = Self::Value.bits();
|
||||||
|
|
||||||
const ClassExcludes = (Self::Value.bits() | Self::TypeAlias.bits()) & !Self::ValueModule.bits() ;
|
const ClassExcludes = (Self::Value.bits() | Self::TypeAlias.bits()) & !(Self::ValueModule.bits() | Self::Interface.bits() | Self::Function.bits());
|
||||||
const ImportBindingExcludes = Self::Import.bits() | Self::TypeImport.bits();
|
const ImportBindingExcludes = Self::Import.bits() | Self::TypeImport.bits();
|
||||||
// Type specific excludes
|
// Type specific excludes
|
||||||
const TypeAliasExcludes = Self::Type.bits();
|
const TypeAliasExcludes = Self::Type.bits();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue