@alloy-js/csharp 0.21.0-dev.0 → 0.21.0-dev.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/scripts/components/library-interface.d.ts +9 -0
- package/dist/scripts/components/library-interface.d.ts.map +1 -0
- package/dist/scripts/components/library-interface.js +43 -0
- package/dist/scripts/components/library-interface.js.map +1 -0
- package/dist/scripts/components/namespace-directory.d.ts +7 -0
- package/dist/scripts/components/namespace-directory.d.ts.map +1 -0
- package/dist/scripts/components/namespace-directory.js +96 -0
- package/dist/scripts/components/namespace-directory.js.map +1 -0
- package/dist/scripts/generate-builtins.d.ts +11 -0
- package/dist/scripts/generate-builtins.d.ts.map +1 -0
- package/dist/scripts/generate-builtins.js +35 -0
- package/dist/scripts/generate-builtins.js.map +1 -0
- package/dist/scripts/process-docfx.d.ts +3 -0
- package/dist/scripts/process-docfx.d.ts.map +1 -0
- package/dist/scripts/process-docfx.js +288 -0
- package/dist/scripts/process-docfx.js.map +1 -0
- package/dist/src/access.d.ts +13 -0
- package/dist/src/access.d.ts.map +1 -0
- package/dist/src/access.js +65 -0
- package/dist/src/access.js.map +1 -0
- package/dist/src/access.test.d.ts +2 -0
- package/dist/src/access.test.d.ts.map +1 -0
- package/dist/src/access.test.js +43 -0
- package/dist/src/access.test.js.map +1 -0
- package/dist/src/builtins/Microsoft/Win32/SafeHandles/index.d.ts +32 -0
- package/dist/src/builtins/Microsoft/Win32/SafeHandles/index.d.ts.map +1 -0
- package/dist/src/builtins/Microsoft/Win32/SafeHandles/index.js +117 -0
- package/dist/src/builtins/Microsoft/Win32/SafeHandles/index.js.map +1 -0
- package/dist/src/builtins/Microsoft/Win32/index.d.ts +6 -0
- package/dist/src/builtins/Microsoft/Win32/index.d.ts.map +1 -0
- package/dist/src/builtins/Microsoft/Win32/index.js +5 -0
- package/dist/src/builtins/Microsoft/Win32/index.js.map +1 -0
- package/dist/src/builtins/Microsoft/index.d.ts +6 -0
- package/dist/src/builtins/Microsoft/index.d.ts.map +1 -0
- package/dist/src/builtins/Microsoft/index.js +5 -0
- package/dist/src/builtins/Microsoft/index.js.map +1 -0
- package/dist/src/builtins/System/Buffers/Text/index.d.ts +31 -0
- package/dist/src/builtins/System/Buffers/Text/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Buffers/Text/index.js +122 -0
- package/dist/src/builtins/System/Buffers/Text/index.js.map +1 -0
- package/dist/src/builtins/System/Buffers/index.d.ts +57 -0
- package/dist/src/builtins/System/Buffers/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Buffers/index.js +214 -0
- package/dist/src/builtins/System/Buffers/index.js.map +1 -0
- package/dist/src/builtins/System/CodeDom/Compiler/index.d.ts +31 -0
- package/dist/src/builtins/System/CodeDom/Compiler/index.d.ts.map +1 -0
- package/dist/src/builtins/System/CodeDom/Compiler/index.js +131 -0
- package/dist/src/builtins/System/CodeDom/Compiler/index.js.map +1 -0
- package/dist/src/builtins/System/CodeDom/index.d.ts +6 -0
- package/dist/src/builtins/System/CodeDom/index.d.ts.map +1 -0
- package/dist/src/builtins/System/CodeDom/index.js +5 -0
- package/dist/src/builtins/System/CodeDom/index.js.map +1 -0
- package/dist/src/builtins/System/Collections/Generic/index.d.ts +99 -0
- package/dist/src/builtins/System/Collections/Generic/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Collections/Generic/index.js +342 -0
- package/dist/src/builtins/System/Collections/Generic/index.js.map +1 -0
- package/dist/src/builtins/System/Collections/ObjectModel/index.d.ts +49 -0
- package/dist/src/builtins/System/Collections/ObjectModel/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Collections/ObjectModel/index.js +185 -0
- package/dist/src/builtins/System/Collections/ObjectModel/index.js.map +1 -0
- package/dist/src/builtins/System/Collections/index.d.ts +142 -0
- package/dist/src/builtins/System/Collections/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Collections/index.js +634 -0
- package/dist/src/builtins/System/Collections/index.js.map +1 -0
- package/dist/src/builtins/System/ComponentModel/index.d.ts +24 -0
- package/dist/src/builtins/System/ComponentModel/index.d.ts.map +1 -0
- package/dist/src/builtins/System/ComponentModel/index.js +86 -0
- package/dist/src/builtins/System/ComponentModel/index.js.map +1 -0
- package/dist/src/builtins/System/Configuration/Assemblies/index.d.ts +19 -0
- package/dist/src/builtins/System/Configuration/Assemblies/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Configuration/Assemblies/index.js +69 -0
- package/dist/src/builtins/System/Configuration/Assemblies/index.js.map +1 -0
- package/dist/src/builtins/System/Configuration/index.d.ts +6 -0
- package/dist/src/builtins/System/Configuration/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Configuration/index.js +5 -0
- package/dist/src/builtins/System/Configuration/index.js.map +1 -0
- package/dist/src/builtins/System/Diagnostics/CodeAnalysis/index.d.ts +155 -0
- package/dist/src/builtins/System/Diagnostics/CodeAnalysis/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Diagnostics/CodeAnalysis/index.js +705 -0
- package/dist/src/builtins/System/Diagnostics/CodeAnalysis/index.js.map +1 -0
- package/dist/src/builtins/System/Diagnostics/index.d.ts +115 -0
- package/dist/src/builtins/System/Diagnostics/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Diagnostics/index.js +509 -0
- package/dist/src/builtins/System/Diagnostics/index.js.map +1 -0
- package/dist/src/builtins/System/Globalization/index.d.ts +737 -0
- package/dist/src/builtins/System/Globalization/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Globalization/index.js +3848 -0
- package/dist/src/builtins/System/Globalization/index.js.map +1 -0
- package/dist/src/builtins/System/IO/Enumeration/index.d.ts +53 -0
- package/dist/src/builtins/System/IO/Enumeration/index.d.ts.map +1 -0
- package/dist/src/builtins/System/IO/Enumeration/index.js +218 -0
- package/dist/src/builtins/System/IO/Enumeration/index.js.map +1 -0
- package/dist/src/builtins/System/IO/index.d.ts +622 -0
- package/dist/src/builtins/System/IO/index.d.ts.map +1 -0
- package/dist/src/builtins/System/IO/index.js +3083 -0
- package/dist/src/builtins/System/IO/index.js.map +1 -0
- package/dist/src/builtins/System/Net/index.d.ts +14 -0
- package/dist/src/builtins/System/Net/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Net/index.js +41 -0
- package/dist/src/builtins/System/Net/index.js.map +1 -0
- package/dist/src/builtins/System/Numerics/index.d.ts +204 -0
- package/dist/src/builtins/System/Numerics/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Numerics/index.js +952 -0
- package/dist/src/builtins/System/Numerics/index.js.map +1 -0
- package/dist/src/builtins/System/Reflection/index.d.ts +918 -0
- package/dist/src/builtins/System/Reflection/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Reflection/index.js +4675 -0
- package/dist/src/builtins/System/Reflection/index.js.map +1 -0
- package/dist/src/builtins/System/Resources/index.d.ts +56 -0
- package/dist/src/builtins/System/Resources/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Resources/index.js +235 -0
- package/dist/src/builtins/System/Resources/index.js.map +1 -0
- package/dist/src/builtins/System/Runtime/CompilerServices/index.d.ts +396 -0
- package/dist/src/builtins/System/Runtime/CompilerServices/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Runtime/CompilerServices/index.js +1531 -0
- package/dist/src/builtins/System/Runtime/CompilerServices/index.js.map +1 -0
- package/dist/src/builtins/System/Runtime/ConstrainedExecution/index.d.ts +29 -0
- package/dist/src/builtins/System/Runtime/ConstrainedExecution/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Runtime/ConstrainedExecution/index.js +103 -0
- package/dist/src/builtins/System/Runtime/ConstrainedExecution/index.js.map +1 -0
- package/dist/src/builtins/System/Runtime/ExceptionServices/index.d.ts +20 -0
- package/dist/src/builtins/System/Runtime/ExceptionServices/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Runtime/ExceptionServices/index.js +62 -0
- package/dist/src/builtins/System/Runtime/ExceptionServices/index.js.map +1 -0
- package/dist/src/builtins/System/Runtime/InteropServices/Marshalling/index.d.ts +84 -0
- package/dist/src/builtins/System/Runtime/InteropServices/Marshalling/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Runtime/InteropServices/Marshalling/index.js +310 -0
- package/dist/src/builtins/System/Runtime/InteropServices/Marshalling/index.js.map +1 -0
- package/dist/src/builtins/System/Runtime/InteropServices/Swift/index.d.ts +18 -0
- package/dist/src/builtins/System/Runtime/InteropServices/Swift/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Runtime/InteropServices/Swift/index.js +49 -0
- package/dist/src/builtins/System/Runtime/InteropServices/Swift/index.js.map +1 -0
- package/dist/src/builtins/System/Runtime/InteropServices/index.d.ts +165 -0
- package/dist/src/builtins/System/Runtime/InteropServices/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Runtime/InteropServices/index.js +774 -0
- package/dist/src/builtins/System/Runtime/InteropServices/index.js.map +1 -0
- package/dist/src/builtins/System/Runtime/Remoting/index.d.ts +10 -0
- package/dist/src/builtins/System/Runtime/Remoting/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Runtime/Remoting/index.js +18 -0
- package/dist/src/builtins/System/Runtime/Remoting/index.js.map +1 -0
- package/dist/src/builtins/System/Runtime/Serialization/index.d.ts +118 -0
- package/dist/src/builtins/System/Runtime/Serialization/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Runtime/Serialization/index.js +468 -0
- package/dist/src/builtins/System/Runtime/Serialization/index.js.map +1 -0
- package/dist/src/builtins/System/Runtime/Versioning/index.d.ts +81 -0
- package/dist/src/builtins/System/Runtime/Versioning/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Runtime/Versioning/index.js +336 -0
- package/dist/src/builtins/System/Runtime/Versioning/index.js.map +1 -0
- package/dist/src/builtins/System/Runtime/index.d.ts +65 -0
- package/dist/src/builtins/System/Runtime/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Runtime/index.js +243 -0
- package/dist/src/builtins/System/Runtime/index.js.map +1 -0
- package/dist/src/builtins/System/Security/Cryptography/index.d.ts +9 -0
- package/dist/src/builtins/System/Security/Cryptography/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Security/Cryptography/index.js +14 -0
- package/dist/src/builtins/System/Security/Cryptography/index.js.map +1 -0
- package/dist/src/builtins/System/Security/Permissions/index.d.ts +67 -0
- package/dist/src/builtins/System/Security/Permissions/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Security/Permissions/index.js +325 -0
- package/dist/src/builtins/System/Security/Permissions/index.js.map +1 -0
- package/dist/src/builtins/System/Security/Principal/index.d.ts +27 -0
- package/dist/src/builtins/System/Security/Principal/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Security/Principal/index.js +104 -0
- package/dist/src/builtins/System/Security/Principal/index.js.map +1 -0
- package/dist/src/builtins/System/Security/index.d.ts +141 -0
- package/dist/src/builtins/System/Security/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Security/index.js +590 -0
- package/dist/src/builtins/System/Security/index.js.map +1 -0
- package/dist/src/builtins/System/Text/Unicode/index.d.ts +12 -0
- package/dist/src/builtins/System/Text/Unicode/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Text/Unicode/index.js +31 -0
- package/dist/src/builtins/System/Text/Unicode/index.js.map +1 -0
- package/dist/src/builtins/System/Text/index.d.ts +268 -0
- package/dist/src/builtins/System/Text/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Text/index.js +1278 -0
- package/dist/src/builtins/System/Text/index.js.map +1 -0
- package/dist/src/builtins/System/Threading/Tasks/Sources/index.d.ts +32 -0
- package/dist/src/builtins/System/Threading/Tasks/Sources/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Threading/Tasks/Sources/index.js +117 -0
- package/dist/src/builtins/System/Threading/Tasks/Sources/index.js.map +1 -0
- package/dist/src/builtins/System/Threading/Tasks/index.d.ts +140 -0
- package/dist/src/builtins/System/Threading/Tasks/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Threading/Tasks/index.js +621 -0
- package/dist/src/builtins/System/Threading/Tasks/index.js.map +1 -0
- package/dist/src/builtins/System/Threading/index.d.ts +92 -0
- package/dist/src/builtins/System/Threading/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Threading/index.js +372 -0
- package/dist/src/builtins/System/Threading/index.js.map +1 -0
- package/dist/src/builtins/System/index.d.ts +2746 -0
- package/dist/src/builtins/System/index.d.ts.map +1 -0
- package/dist/src/builtins/System/index.js +13070 -0
- package/dist/src/builtins/System/index.js.map +1 -0
- package/dist/src/builtins/index.d.ts +3 -0
- package/dist/src/builtins/index.d.ts.map +1 -0
- package/dist/src/builtins/index.js +3 -0
- package/dist/src/builtins/index.js.map +1 -0
- package/dist/src/components/access-expression/access-expression.d.ts +3 -3
- package/dist/src/components/access-expression/access-expression.d.ts.map +1 -1
- package/dist/src/components/enum/declaration.d.ts +2 -2
- package/dist/src/components/enum/declaration.d.ts.map +1 -1
- package/dist/src/components/enum/declaration.js +3 -3
- package/dist/src/components/enum/declaration.js.map +1 -1
- package/dist/src/components/enum/declaration.ref.test.js +1 -1
- package/dist/src/components/enum/declaration.test.js +15 -1
- package/dist/src/components/enum/declaration.test.js.map +1 -1
- package/dist/src/components/enum/member.d.ts +2 -2
- package/dist/src/components/enum/member.d.ts.map +1 -1
- package/dist/src/components/enum/member.js +3 -3
- package/dist/src/components/enum/member.js.map +1 -1
- package/dist/src/components/enum/member.test.js +24 -1
- package/dist/src/components/enum/member.test.js.map +1 -1
- package/dist/src/components/field/field.d.ts +2 -2
- package/dist/src/components/field/field.d.ts.map +1 -1
- package/dist/src/components/field/field.js.map +1 -1
- package/dist/src/components/field/field.test.js +19 -1
- package/dist/src/components/field/field.test.js.map +1 -1
- package/dist/src/components/if/if-statement.d.ts +25 -0
- package/dist/src/components/if/if-statement.d.ts.map +1 -0
- package/dist/src/components/if/if-statement.js +36 -0
- package/dist/src/components/if/if-statement.js.map +1 -0
- package/dist/src/components/if/if-statement.test.d.ts +2 -0
- package/dist/src/components/if/if-statement.test.d.ts.map +1 -0
- package/dist/src/components/if/if-statement.test.js +29 -0
- package/dist/src/components/if/if-statement.test.js.map +1 -0
- package/dist/src/components/index.d.ts +4 -2
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +4 -3
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/components/interface/declaration.d.ts +1 -1
- package/dist/src/components/interface/declaration.d.ts.map +1 -1
- package/dist/src/components/interface/declaration.js +3 -3
- package/dist/src/components/interface/declaration.js.map +1 -1
- package/dist/src/components/interface/declaration.test.js +14 -1
- package/dist/src/components/interface/declaration.test.js.map +1 -1
- package/dist/src/components/interface/method.d.ts +2 -2
- package/dist/src/components/interface/method.d.ts.map +1 -1
- package/dist/src/components/interface/method.js.map +1 -1
- package/dist/src/components/interface/method.test.js +17 -1
- package/dist/src/components/interface/method.test.js.map +1 -1
- package/dist/src/components/interface/property.d.ts +2 -2
- package/dist/src/components/interface/property.d.ts.map +1 -1
- package/dist/src/components/interface/property.js.map +1 -1
- package/dist/src/components/interface/property.test.js +19 -0
- package/dist/src/components/interface/property.test.js.map +1 -1
- package/dist/src/components/method/method.js +10 -2
- package/dist/src/components/method/method.js.map +1 -1
- package/dist/src/components/method/method.test.js +61 -0
- package/dist/src/components/method/method.test.js.map +1 -1
- package/dist/src/components/namespace/namespace-name.d.ts +10 -0
- package/dist/src/components/namespace/namespace-name.d.ts.map +1 -0
- package/dist/src/components/namespace/namespace-name.js +20 -0
- package/dist/src/components/namespace/namespace-name.js.map +1 -0
- package/dist/src/components/{namespace.d.ts → namespace/namespace.d.ts} +3 -1
- package/dist/src/components/namespace/namespace.d.ts.map +1 -0
- package/dist/src/components/{namespace.js → namespace/namespace.js} +12 -13
- package/dist/src/components/namespace/namespace.js.map +1 -0
- package/dist/src/components/namespace/namespace.test.d.ts.map +1 -0
- package/dist/src/components/namespace/namespace.test.js +207 -0
- package/dist/src/components/namespace/namespace.test.js.map +1 -0
- package/dist/src/components/namespace.ref.test.js +42 -10
- package/dist/src/components/namespace.ref.test.js.map +1 -1
- package/dist/src/components/parameters/parameters.d.ts.map +1 -1
- package/dist/src/components/parameters/parameters.js +2 -2
- package/dist/src/components/parameters/parameters.js.map +1 -1
- package/dist/src/components/property/property.d.ts.map +1 -1
- package/dist/src/components/property/property.js +21 -12
- package/dist/src/components/property/property.js.map +1 -1
- package/dist/src/components/property/property.test.js +28 -0
- package/dist/src/components/property/property.test.js.map +1 -1
- package/dist/src/components/record/declaration.d.ts +1 -1
- package/dist/src/components/record/declaration.d.ts.map +1 -1
- package/dist/src/components/record/declaration.js +3 -4
- package/dist/src/components/record/declaration.js.map +1 -1
- package/dist/src/components/record/declaration.test.js +14 -1
- package/dist/src/components/record/declaration.test.js.map +1 -1
- package/dist/src/components/source-file/source-file.d.ts.map +1 -1
- package/dist/src/components/source-file/source-file.js +6 -4
- package/dist/src/components/source-file/source-file.js.map +1 -1
- package/dist/src/components/source-file/source-file.test.js +1 -1
- package/dist/src/components/source-file/using.test.d.ts.map +1 -0
- package/dist/{test → src/components/source-file}/using.test.js +30 -49
- package/dist/src/components/source-file/using.test.js.map +1 -0
- package/dist/src/components/stc/index.d.ts +1 -1
- package/dist/src/components/stc/index.d.ts.map +1 -1
- package/dist/src/components/stc/index.js +1 -1
- package/dist/src/components/stc/index.js.map +1 -1
- package/dist/src/components/struct/declaration.d.ts +1 -1
- package/dist/src/components/struct/declaration.d.ts.map +1 -1
- package/dist/src/components/struct/declaration.js +3 -3
- package/dist/src/components/struct/declaration.js.map +1 -1
- package/dist/src/components/struct/declaration.test.js +14 -1
- package/dist/src/components/struct/declaration.test.js.map +1 -1
- package/dist/src/components/type-parameters/type-parameter.d.ts +2 -2
- package/dist/src/components/type-parameters/type-parameter.d.ts.map +1 -1
- package/dist/src/components/type-parameters/type-parameter.js.map +1 -1
- package/dist/src/components/type-parameters/type-parameters.test.js +14 -0
- package/dist/src/components/type-parameters/type-parameters.test.js.map +1 -1
- package/dist/src/components/using/using.d.ts +28 -0
- package/dist/src/components/using/using.d.ts.map +1 -0
- package/dist/src/components/using/using.js +37 -0
- package/dist/src/components/using/using.js.map +1 -0
- package/dist/src/components/using/using.test.d.ts +2 -0
- package/dist/src/components/using/using.test.d.ts.map +1 -0
- package/dist/src/components/using/using.test.js +19 -0
- package/dist/src/components/using/using.test.js.map +1 -0
- package/dist/src/components/var/declaration.d.ts +4 -2
- package/dist/src/components/var/declaration.d.ts.map +1 -1
- package/dist/src/components/var/declaration.js +17 -3
- package/dist/src/components/var/declaration.js.map +1 -1
- package/dist/src/components/var/declaration.test.js +22 -1
- package/dist/src/components/var/declaration.test.js.map +1 -1
- package/dist/src/contexts/global-namespace.d.ts +1 -0
- package/dist/src/contexts/global-namespace.d.ts.map +1 -1
- package/dist/src/contexts/global-namespace.js +6 -1
- package/dist/src/contexts/global-namespace.js.map +1 -1
- package/dist/src/create-library.d.ts +62 -0
- package/dist/src/create-library.d.ts.map +1 -0
- package/dist/src/create-library.js +128 -0
- package/dist/src/create-library.js.map +1 -0
- package/dist/src/create-library.test.d.ts +10 -0
- package/dist/src/create-library.test.d.ts.map +1 -0
- package/dist/src/create-library.test.js +220 -0
- package/dist/src/create-library.test.js.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/name-policy.d.ts +1 -1
- package/dist/src/name-policy.d.ts.map +1 -1
- package/dist/src/name-policy.js +1 -0
- package/dist/src/name-policy.js.map +1 -1
- package/dist/src/symbols/factories.d.ts +1 -1
- package/dist/src/symbols/factories.d.ts.map +1 -1
- package/dist/src/symbols/factories.js +27 -7
- package/dist/src/symbols/factories.js.map +1 -1
- package/dist/src/symbols/named-type.d.ts +3 -3
- package/dist/src/symbols/named-type.d.ts.map +1 -1
- package/dist/src/symbols/named-type.js.map +1 -1
- package/dist/src/symbols/namespace.d.ts +2 -2
- package/dist/src/symbols/namespace.d.ts.map +1 -1
- package/dist/src/symbols/namespace.js.map +1 -1
- package/dist/src/symbols/reference.d.ts.map +1 -1
- package/dist/src/symbols/reference.js +3 -3
- package/dist/src/symbols/reference.js.map +1 -1
- package/dist/test/utils.d.ts +4 -2
- package/dist/test/utils.d.ts.map +1 -1
- package/dist/test/utils.js +5 -4
- package/dist/test/utils.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -3
- package/scripts/components/library-interface.tsx +41 -0
- package/scripts/components/namespace-directory.tsx +104 -0
- package/scripts/generate-builtins.tsx +35 -0
- package/scripts/process-docfx.tsx +309 -0
- package/src/access.test.tsx +49 -0
- package/src/access.tsx +70 -0
- package/src/builtins/Microsoft/Win32/SafeHandles/index.ts +147 -0
- package/src/builtins/Microsoft/Win32/index.ts +8 -0
- package/src/builtins/Microsoft/index.ts +8 -0
- package/src/builtins/System/Buffers/Text/index.ts +150 -0
- package/src/builtins/System/Buffers/index.ts +267 -0
- package/src/builtins/System/CodeDom/Compiler/index.ts +160 -0
- package/src/builtins/System/CodeDom/index.ts +8 -0
- package/src/builtins/System/Collections/Generic/index.ts +439 -0
- package/src/builtins/System/Collections/ObjectModel/index.ts +232 -0
- package/src/builtins/System/Collections/index.ts +771 -0
- package/src/builtins/System/ComponentModel/index.ts +108 -0
- package/src/builtins/System/Configuration/Assemblies/index.ts +85 -0
- package/src/builtins/System/Configuration/index.ts +8 -0
- package/src/builtins/System/Diagnostics/CodeAnalysis/index.ts +858 -0
- package/src/builtins/System/Diagnostics/index.ts +620 -0
- package/src/builtins/System/Globalization/index.ts +4583 -0
- package/src/builtins/System/IO/Enumeration/index.ts +269 -0
- package/src/builtins/System/IO/index.ts +3701 -0
- package/src/builtins/System/Net/index.ts +52 -0
- package/src/builtins/System/Numerics/index.ts +1184 -0
- package/src/builtins/System/Reflection/index.ts +5591 -0
- package/src/builtins/System/Resources/index.ts +289 -0
- package/src/builtins/System/Runtime/CompilerServices/index.ts +1929 -0
- package/src/builtins/System/Runtime/ConstrainedExecution/index.ts +129 -0
- package/src/builtins/System/Runtime/ExceptionServices/index.ts +80 -0
- package/src/builtins/System/Runtime/InteropServices/Marshalling/index.ts +394 -0
- package/src/builtins/System/Runtime/InteropServices/Swift/index.ts +65 -0
- package/src/builtins/System/Runtime/InteropServices/index.ts +934 -0
- package/src/builtins/System/Runtime/Remoting/index.ts +25 -0
- package/src/builtins/System/Runtime/Serialization/index.ts +584 -0
- package/src/builtins/System/Runtime/Versioning/index.ts +415 -0
- package/src/builtins/System/Runtime/index.ts +298 -0
- package/src/builtins/System/Security/Cryptography/index.ts +20 -0
- package/src/builtins/System/Security/Permissions/index.ts +390 -0
- package/src/builtins/System/Security/Principal/index.ts +129 -0
- package/src/builtins/System/Security/index.ts +725 -0
- package/src/builtins/System/Text/Unicode/index.ts +40 -0
- package/src/builtins/System/Text/index.ts +1542 -0
- package/src/builtins/System/Threading/Tasks/Sources/index.ts +147 -0
- package/src/builtins/System/Threading/Tasks/index.ts +757 -0
- package/src/builtins/System/Threading/index.ts +460 -0
- package/src/builtins/System/index.ts +15803 -0
- package/src/builtins/index.ts +2 -0
- package/src/components/access-expression/access-expression.tsx +2 -2
- package/src/components/enum/declaration.ref.test.tsx +1 -1
- package/src/components/enum/declaration.test.tsx +14 -1
- package/src/components/enum/declaration.tsx +4 -3
- package/src/components/enum/member.test.tsx +22 -1
- package/src/components/enum/member.tsx +4 -4
- package/src/components/field/field.test.tsx +14 -1
- package/src/components/field/field.tsx +2 -2
- package/src/components/if/if-statement.test.tsx +26 -0
- package/src/components/if/if-statement.tsx +50 -0
- package/src/components/index.ts +4 -2
- package/src/components/interface/declaration.test.tsx +11 -1
- package/src/components/interface/declaration.tsx +3 -4
- package/src/components/interface/method.test.tsx +14 -1
- package/src/components/interface/method.tsx +2 -1
- package/src/components/interface/property.test.tsx +13 -0
- package/src/components/interface/property.tsx +2 -1
- package/src/components/method/method.test.tsx +49 -0
- package/src/components/method/method.tsx +7 -4
- package/src/components/namespace/namespace-name.tsx +31 -0
- package/src/components/namespace/namespace.test.tsx +145 -0
- package/src/components/{namespace.tsx → namespace/namespace.tsx} +12 -15
- package/src/components/namespace.ref.test.tsx +34 -9
- package/src/components/parameters/parameters.tsx +7 -2
- package/src/components/property/property.test.tsx +25 -0
- package/src/components/property/property.tsx +22 -11
- package/src/components/record/declaration.test.tsx +11 -1
- package/src/components/record/declaration.tsx +3 -4
- package/src/components/source-file/source-file.test.tsx +1 -1
- package/src/components/source-file/source-file.tsx +4 -4
- package/src/components/source-file/using.test.tsx +94 -0
- package/src/components/stc/index.ts +1 -1
- package/src/components/struct/declaration.test.tsx +11 -1
- package/src/components/struct/declaration.tsx +3 -4
- package/src/components/type-parameters/type-parameter.tsx +2 -1
- package/src/components/type-parameters/type-parameters.test.tsx +9 -0
- package/src/components/using/using.test.tsx +15 -0
- package/src/components/using/using.tsx +52 -0
- package/src/components/var/declaration.test.tsx +16 -1
- package/src/components/var/declaration.tsx +17 -2
- package/src/contexts/global-namespace.ts +8 -1
- package/src/create-library.test.tsx +202 -0
- package/src/create-library.ts +270 -0
- package/src/index.ts +2 -0
- package/src/name-policy.ts +3 -1
- package/src/symbols/factories.ts +47 -10
- package/src/symbols/named-type.ts +3 -3
- package/src/symbols/namespace.ts +2 -2
- package/src/symbols/reference.tsx +10 -3
- package/temp/api.json +3934 -683
- package/test/utils.tsx +6 -3
- package/tsconfig.json +11 -2
- package/dist/src/components/UsingDirective.d.ts +0 -10
- package/dist/src/components/UsingDirective.d.ts.map +0 -1
- package/dist/src/components/UsingDirective.js +0 -15
- package/dist/src/components/UsingDirective.js.map +0 -1
- package/dist/src/components/namespace.d.ts.map +0 -1
- package/dist/src/components/namespace.js.map +0 -1
- package/dist/src/components/namespace.test.d.ts.map +0 -1
- package/dist/src/components/namespace.test.js +0 -79
- package/dist/src/components/namespace.test.js.map +0 -1
- package/dist/test/using.test.d.ts.map +0 -1
- package/dist/test/using.test.js.map +0 -1
- package/src/components/UsingDirective.tsx +0 -28
- package/src/components/namespace.test.tsx +0 -52
- package/test/using.test.tsx +0 -118
- /package/dist/src/components/{namespace.test.d.ts → namespace/namespace.test.d.ts} +0 -0
- /package/dist/{test → src/components/source-file}/using.test.d.ts +0 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { VarDeclaration } from "#components/index.js";
|
|
2
|
+
import { InvocationExpression } from "#components/invocation-expression/invocation-expression.jsx";
|
|
3
|
+
import { TestNamespace } from "#test/utils.jsx";
|
|
4
|
+
import { List, memberRefkey, namekey, toRefkey } from "@alloy-js/core";
|
|
5
|
+
import { beforeEach, expect, it } from "vitest";
|
|
6
|
+
import { IO } from "./builtins/System/index.js";
|
|
7
|
+
import {
|
|
8
|
+
getGlobalNamespace,
|
|
9
|
+
resetGlobalNamespace,
|
|
10
|
+
} from "./contexts/global-namespace.js";
|
|
11
|
+
import { createLibrary } from "./create-library.js";
|
|
12
|
+
import { NamespaceSymbol } from "./symbols/namespace.js";
|
|
13
|
+
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
resetGlobalNamespace();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("Creates symbols on demand", () => {
|
|
19
|
+
const System = createLibrary("System", {
|
|
20
|
+
String: {
|
|
21
|
+
kind: "class",
|
|
22
|
+
members: {
|
|
23
|
+
Special: { kind: "class", members: { BeSpecial: { kind: "field" } } },
|
|
24
|
+
Substring: { kind: "method" },
|
|
25
|
+
Length: { kind: "field" },
|
|
26
|
+
Empty: { kind: "field", isStatic: true },
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const globalNamespace = getGlobalNamespace(undefined);
|
|
32
|
+
const systemNs = globalNamespace.members.symbolNames.get("System")!;
|
|
33
|
+
expect(systemNs).toBeUndefined();
|
|
34
|
+
const _ = toRefkey(System);
|
|
35
|
+
const systemNs2 = globalNamespace.members.symbolNames.get("System")!;
|
|
36
|
+
expect(systemNs2).toBeDefined();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("Can reference types which haven't been created yet", () => {
|
|
40
|
+
const System = createLibrary("System", {
|
|
41
|
+
String: {
|
|
42
|
+
kind: "class",
|
|
43
|
+
members: {
|
|
44
|
+
Special: { kind: "property", type: () => SomeNs.SomeType },
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const SomeNs = createLibrary("SomeNs", {
|
|
50
|
+
SomeType: {
|
|
51
|
+
kind: "class",
|
|
52
|
+
members: {},
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const globalNamespace = getGlobalNamespace(undefined);
|
|
57
|
+
const _ = toRefkey(System.String.Special);
|
|
58
|
+
const systemNs2 = globalNamespace.members.symbolNames.get("System")!;
|
|
59
|
+
expect(systemNs2).toBeDefined();
|
|
60
|
+
const someNs = globalNamespace.members.symbolNames.get("SomeNs")!;
|
|
61
|
+
expect(someNs).toBeDefined();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("Works with nested namespaces", () => {
|
|
65
|
+
const IO = createLibrary("System.IO", {
|
|
66
|
+
BinaryReader: {
|
|
67
|
+
kind: "class",
|
|
68
|
+
members: {},
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const globalNamespace = getGlobalNamespace(undefined);
|
|
73
|
+
const systemNs = globalNamespace.members.symbolNames.get("System")!;
|
|
74
|
+
expect(systemNs).toBeUndefined();
|
|
75
|
+
const _ = toRefkey(IO.BinaryReader);
|
|
76
|
+
const systemNs2 = globalNamespace.members.symbolNames.get("System")!;
|
|
77
|
+
expect(systemNs2).toBeDefined();
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it("Doesn't create duplicate namespaces", () => {
|
|
81
|
+
const IO = createLibrary("System.IO", {
|
|
82
|
+
BinaryReader: { kind: "class", members: {} },
|
|
83
|
+
BinaryWriter: { kind: "class", members: {} },
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const Collections = createLibrary("System.Collections", {
|
|
87
|
+
ArrayList: { kind: "class", members: {} },
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
const _refkeys = [
|
|
91
|
+
toRefkey(IO.BinaryReader),
|
|
92
|
+
toRefkey(IO.BinaryWriter),
|
|
93
|
+
toRefkey(Collections.ArrayList),
|
|
94
|
+
];
|
|
95
|
+
|
|
96
|
+
const globalNamespace = getGlobalNamespace(undefined);
|
|
97
|
+
const systemNs = globalNamespace.members.symbolNames.get(
|
|
98
|
+
"System",
|
|
99
|
+
)! as NamespaceSymbol;
|
|
100
|
+
expect(systemNs).toBeDefined();
|
|
101
|
+
const ioNs = systemNs.members.symbolNames.get("IO")!;
|
|
102
|
+
expect(ioNs).toBeDefined();
|
|
103
|
+
const collectionsNs = systemNs.members.symbolNames.get("Collections")!;
|
|
104
|
+
expect(collectionsNs).toBeDefined();
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it("renders as a refkey", () => {
|
|
108
|
+
const IO = createLibrary("System.IO", {
|
|
109
|
+
BinaryReader: {
|
|
110
|
+
kind: "class",
|
|
111
|
+
members: {},
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
expect(
|
|
116
|
+
<TestNamespace>
|
|
117
|
+
new <InvocationExpression target={IO.BinaryReader} />;
|
|
118
|
+
</TestNamespace>,
|
|
119
|
+
).toRenderTo(`
|
|
120
|
+
using System.IO;
|
|
121
|
+
|
|
122
|
+
new BinaryReader();
|
|
123
|
+
`);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it("has a refkey getter", () => {
|
|
127
|
+
const IO = createLibrary("System.IO", {
|
|
128
|
+
BinaryReader: {
|
|
129
|
+
kind: "class",
|
|
130
|
+
members: {},
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
const ioKey = toRefkey(IO);
|
|
135
|
+
expect(ioKey).toBeDefined();
|
|
136
|
+
const brKey = toRefkey(IO.BinaryReader);
|
|
137
|
+
expect(brKey).toBeDefined();
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it("works to reference members", () => {
|
|
141
|
+
const IO = createLibrary("System.IO", {
|
|
142
|
+
BinaryReader: {
|
|
143
|
+
kind: "class",
|
|
144
|
+
members: {
|
|
145
|
+
ReadString: { kind: "method" },
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
const reader = namekey("reader");
|
|
151
|
+
|
|
152
|
+
expect(
|
|
153
|
+
<TestNamespace>
|
|
154
|
+
<VarDeclaration name={reader} type={IO.BinaryReader}>
|
|
155
|
+
new <InvocationExpression target={IO.BinaryReader} />
|
|
156
|
+
</VarDeclaration>
|
|
157
|
+
<hbr />
|
|
158
|
+
<InvocationExpression
|
|
159
|
+
target={memberRefkey(reader, IO.BinaryReader.ReadString)}
|
|
160
|
+
/>
|
|
161
|
+
;
|
|
162
|
+
</TestNamespace>,
|
|
163
|
+
).toRenderTo(`
|
|
164
|
+
using System.IO;
|
|
165
|
+
|
|
166
|
+
BinaryReader reader = new BinaryReader();
|
|
167
|
+
reader.ReadString();
|
|
168
|
+
`);
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
it("has built-ins available", () => {
|
|
172
|
+
const info = namekey("info");
|
|
173
|
+
|
|
174
|
+
const template = (
|
|
175
|
+
<TestNamespace>
|
|
176
|
+
<List>
|
|
177
|
+
<VarDeclaration name={info}>
|
|
178
|
+
new {IO.FileInfo}("test.txt")
|
|
179
|
+
</VarDeclaration>
|
|
180
|
+
<VarDeclaration name="directoryName">
|
|
181
|
+
{memberRefkey(info, "DirectoryName", "Length")}
|
|
182
|
+
</VarDeclaration>
|
|
183
|
+
</List>
|
|
184
|
+
</TestNamespace>
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
expect(template).toRenderTo(`
|
|
188
|
+
using System.IO;
|
|
189
|
+
|
|
190
|
+
var info = new FileInfo("test.txt");
|
|
191
|
+
var directoryName = info.DirectoryName?.Length;
|
|
192
|
+
`);
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
<VarDeclaration name={info}>
|
|
197
|
+
new {IO.FileInfo}("test.txt")
|
|
198
|
+
</VarDeclaration>
|
|
199
|
+
<VarDeclaration name="directoryName">
|
|
200
|
+
{access(info, "DirectoryName", "Length")}
|
|
201
|
+
</VarDeclaration>
|
|
202
|
+
*/
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Binder,
|
|
3
|
+
LibrarySymbolReference,
|
|
4
|
+
refkey,
|
|
5
|
+
REFKEYABLE,
|
|
6
|
+
TO_SYMBOL,
|
|
7
|
+
useBinder,
|
|
8
|
+
} from "@alloy-js/core";
|
|
9
|
+
import { getGlobalNamespace } from "./contexts/global-namespace.js";
|
|
10
|
+
import { MethodKinds, MethodSymbol } from "./index.js";
|
|
11
|
+
import { CSharpSymbol } from "./symbols/csharp.js";
|
|
12
|
+
import { NamedTypeSymbol } from "./symbols/named-type.js";
|
|
13
|
+
import { NamespaceSymbol } from "./symbols/namespace.js";
|
|
14
|
+
|
|
15
|
+
export interface MemberDescriptor {
|
|
16
|
+
kind: string;
|
|
17
|
+
type?: LibrarySymbolReference | (() => LibrarySymbolReference);
|
|
18
|
+
isOverride?: boolean;
|
|
19
|
+
isAbstract?: boolean;
|
|
20
|
+
isVirtual?: boolean;
|
|
21
|
+
isStatic?: boolean;
|
|
22
|
+
isSealed?: boolean;
|
|
23
|
+
isExtern?: boolean;
|
|
24
|
+
isReadOnly?: boolean;
|
|
25
|
+
isNullable?: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface NamespaceDescriptor<M> {
|
|
29
|
+
kind: "namespace";
|
|
30
|
+
members: M;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface FieldDescriptor extends MemberDescriptor {
|
|
34
|
+
kind: "field";
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface MethodDescriptor extends MemberDescriptor {
|
|
38
|
+
kind: "method";
|
|
39
|
+
methodKind: MethodKinds;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface NamedTypeDescriptor<M> {
|
|
43
|
+
kind: string;
|
|
44
|
+
members: M;
|
|
45
|
+
isAbstract?: boolean;
|
|
46
|
+
isStatic?: boolean;
|
|
47
|
+
isSealed?: boolean;
|
|
48
|
+
}
|
|
49
|
+
export interface ClassDescriptor<M> extends NamedTypeDescriptor<M> {
|
|
50
|
+
kind: "class";
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface PropertyDescriptor extends MemberDescriptor {
|
|
54
|
+
kind: "property";
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface InterfaceDescriptor<M> extends NamedTypeDescriptor<M> {
|
|
58
|
+
kind: "interface";
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface EnumDescriptor<M> extends NamedTypeDescriptor<M> {
|
|
62
|
+
kind: "enum";
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface StructDescriptor<M> extends NamedTypeDescriptor<M> {
|
|
66
|
+
kind: "struct";
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface RecordDescriptor<M> extends NamedTypeDescriptor<M> {
|
|
70
|
+
kind: "record";
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface GenericDescriptor {
|
|
74
|
+
kind: "generic";
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export type Descriptor =
|
|
78
|
+
| FieldDescriptor
|
|
79
|
+
| MethodDescriptor
|
|
80
|
+
| PropertyDescriptor
|
|
81
|
+
| NamespaceDescriptor<any>
|
|
82
|
+
| ClassDescriptor<any>
|
|
83
|
+
| InterfaceDescriptor<any>
|
|
84
|
+
| EnumDescriptor<any>
|
|
85
|
+
| StructDescriptor<any>
|
|
86
|
+
| RecordDescriptor<any>
|
|
87
|
+
| GenericDescriptor;
|
|
88
|
+
|
|
89
|
+
export type ResolveDescriptor<D> =
|
|
90
|
+
D extends NamedTypeDescriptor<infer M> ?
|
|
91
|
+
LibrarySymbolReference & { [K in keyof M]: ResolveDescriptor<M[K]> }
|
|
92
|
+
: LibrarySymbolReference;
|
|
93
|
+
|
|
94
|
+
export type LibraryFrom<T> = {
|
|
95
|
+
[K in keyof T]: ResolveDescriptor<T[K]>;
|
|
96
|
+
} & LibrarySymbolReference;
|
|
97
|
+
|
|
98
|
+
interface InternalContext {
|
|
99
|
+
binder(): Binder;
|
|
100
|
+
ownerSymbol(): NamedTypeSymbol;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function createLibrary<T extends Record<string, Descriptor>>(
|
|
104
|
+
rootNs: string,
|
|
105
|
+
props: T,
|
|
106
|
+
): LibraryFrom<T> {
|
|
107
|
+
let binder: Binder | undefined = undefined;
|
|
108
|
+
let ownerSymbol: NamespaceSymbol | undefined = undefined;
|
|
109
|
+
const namespaceNames = rootNs.split(".");
|
|
110
|
+
|
|
111
|
+
return createSymbolEntry(
|
|
112
|
+
namespaceNames.at(-1)!,
|
|
113
|
+
{
|
|
114
|
+
kind: "namespace",
|
|
115
|
+
members: props,
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
binder() {
|
|
119
|
+
if (!binder) {
|
|
120
|
+
binder = useBinder();
|
|
121
|
+
}
|
|
122
|
+
return binder!;
|
|
123
|
+
},
|
|
124
|
+
ownerSymbol() {
|
|
125
|
+
if (ownerSymbol) {
|
|
126
|
+
return ownerSymbol;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const binder = this.binder();
|
|
130
|
+
ownerSymbol = getGlobalNamespace(binder);
|
|
131
|
+
for (const name of namespaceNames.slice(0, -1)) {
|
|
132
|
+
if (ownerSymbol!.members.symbolNames.has(name)) {
|
|
133
|
+
ownerSymbol = ownerSymbol!.members.symbolNames.get(
|
|
134
|
+
name,
|
|
135
|
+
)! as NamespaceSymbol;
|
|
136
|
+
} else {
|
|
137
|
+
ownerSymbol = new NamespaceSymbol(name, ownerSymbol!, {
|
|
138
|
+
binder,
|
|
139
|
+
refkeys: refkey(),
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return ownerSymbol;
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
) as LibraryFrom<T>;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function createSymbolEntry(
|
|
151
|
+
name: string,
|
|
152
|
+
descriptor: Descriptor,
|
|
153
|
+
context: InternalContext,
|
|
154
|
+
): LibrarySymbolReference {
|
|
155
|
+
let symbol: CSharpSymbol | undefined = undefined;
|
|
156
|
+
|
|
157
|
+
function getSymbol() {
|
|
158
|
+
if (symbol) return symbol;
|
|
159
|
+
|
|
160
|
+
symbol = createSymbolFromDescriptor(
|
|
161
|
+
name,
|
|
162
|
+
descriptor,
|
|
163
|
+
context,
|
|
164
|
+
initializeMembers,
|
|
165
|
+
);
|
|
166
|
+
return symbol;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const newContext: InternalContext = {
|
|
170
|
+
binder: context.binder,
|
|
171
|
+
ownerSymbol() {
|
|
172
|
+
return getSymbol() as NamedTypeSymbol;
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
function initializeMembers() {
|
|
177
|
+
for (const key of Object.keys(obj)) {
|
|
178
|
+
if (typeof key === "symbol") continue;
|
|
179
|
+
(obj as any)[key][TO_SYMBOL]();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const obj: LibrarySymbolReference & Record<string, unknown> = {
|
|
184
|
+
[REFKEYABLE]() {
|
|
185
|
+
return getSymbol().refkeys[0];
|
|
186
|
+
},
|
|
187
|
+
[TO_SYMBOL]() {
|
|
188
|
+
return getSymbol();
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
switch (descriptor.kind) {
|
|
193
|
+
case "class":
|
|
194
|
+
case "namespace":
|
|
195
|
+
case "interface":
|
|
196
|
+
case "enum":
|
|
197
|
+
case "struct":
|
|
198
|
+
case "record":
|
|
199
|
+
for (const [memberName, memberDesc] of Object.entries(
|
|
200
|
+
descriptor.members,
|
|
201
|
+
) as any) {
|
|
202
|
+
obj[memberName] = createSymbolEntry(memberName, memberDesc, newContext);
|
|
203
|
+
}
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return obj;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function createSymbolFromDescriptor(
|
|
211
|
+
name: string,
|
|
212
|
+
descriptor: Descriptor,
|
|
213
|
+
context: InternalContext,
|
|
214
|
+
lazyMemberInitializer: () => void,
|
|
215
|
+
): CSharpSymbol {
|
|
216
|
+
const ownerSymbol = context.ownerSymbol();
|
|
217
|
+
const binder = context.binder();
|
|
218
|
+
|
|
219
|
+
switch (descriptor.kind) {
|
|
220
|
+
case "namespace":
|
|
221
|
+
if (ownerSymbol.members.symbolNames.has(name)) {
|
|
222
|
+
return ownerSymbol.members.symbolNames.get(name)! as NamespaceSymbol;
|
|
223
|
+
}
|
|
224
|
+
return new NamespaceSymbol(name, ownerSymbol as NamespaceSymbol, {
|
|
225
|
+
binder,
|
|
226
|
+
refkeys: refkey(),
|
|
227
|
+
lazyMemberInitializer,
|
|
228
|
+
});
|
|
229
|
+
case "class":
|
|
230
|
+
case "enum":
|
|
231
|
+
case "interface":
|
|
232
|
+
case "struct":
|
|
233
|
+
case "record":
|
|
234
|
+
return new NamedTypeSymbol(name, ownerSymbol.members, descriptor.kind, {
|
|
235
|
+
binder,
|
|
236
|
+
refkeys: refkey(),
|
|
237
|
+
lazyMemberInitializer,
|
|
238
|
+
});
|
|
239
|
+
case "method":
|
|
240
|
+
return new MethodSymbol(
|
|
241
|
+
name,
|
|
242
|
+
ownerSymbol.members,
|
|
243
|
+
descriptor.methodKind,
|
|
244
|
+
{
|
|
245
|
+
binder,
|
|
246
|
+
refkeys: refkey(),
|
|
247
|
+
},
|
|
248
|
+
);
|
|
249
|
+
case "field":
|
|
250
|
+
case "property":
|
|
251
|
+
return new CSharpSymbol(name, ownerSymbol.members, {
|
|
252
|
+
binder,
|
|
253
|
+
refkeys: refkey(),
|
|
254
|
+
type:
|
|
255
|
+
descriptor.type === undefined ? undefined
|
|
256
|
+
: typeof descriptor.type === "function" ?
|
|
257
|
+
descriptor.type()[TO_SYMBOL]()
|
|
258
|
+
: descriptor.type[TO_SYMBOL](),
|
|
259
|
+
isNullable: descriptor.isNullable,
|
|
260
|
+
lazyMemberInitializer,
|
|
261
|
+
});
|
|
262
|
+
case "generic":
|
|
263
|
+
return new CSharpSymbol(name, ownerSymbol.members, {
|
|
264
|
+
binder,
|
|
265
|
+
refkeys: refkey(),
|
|
266
|
+
});
|
|
267
|
+
default:
|
|
268
|
+
throw "Unsupported";
|
|
269
|
+
}
|
|
270
|
+
}
|
package/src/index.ts
CHANGED
package/src/name-policy.ts
CHANGED
|
@@ -17,7 +17,8 @@ export type CSharpElements =
|
|
|
17
17
|
| "class-method"
|
|
18
18
|
| "class-property"
|
|
19
19
|
| "parameter"
|
|
20
|
-
| "type-parameter"
|
|
20
|
+
| "type-parameter"
|
|
21
|
+
| "namespace";
|
|
21
22
|
|
|
22
23
|
// creates the C# naming policy
|
|
23
24
|
export function createCSharpNamePolicy(): core.NamePolicy<CSharpElements> {
|
|
@@ -33,6 +34,7 @@ export function createCSharpNamePolicy(): core.NamePolicy<CSharpElements> {
|
|
|
33
34
|
case "class-method":
|
|
34
35
|
case "type-parameter":
|
|
35
36
|
case "class-property":
|
|
37
|
+
case "namespace":
|
|
36
38
|
return changecase.pascalCase(name);
|
|
37
39
|
case "constant":
|
|
38
40
|
return changecase.constantCase(name);
|
package/src/symbols/factories.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
useBinder,
|
|
7
7
|
} from "@alloy-js/core";
|
|
8
8
|
import { getGlobalNamespace } from "../contexts/global-namespace.js";
|
|
9
|
+
import { useNamespaceContext } from "../contexts/namespace.js";
|
|
9
10
|
import { CSharpElements, useCSharpNamePolicy } from "../name-policy.js";
|
|
10
11
|
import { CSharpClassScope } from "../scopes/class.js";
|
|
11
12
|
import { useCSharpScope, useNamedTypeScope } from "../scopes/contexts.js";
|
|
@@ -13,10 +14,7 @@ import { CSharpScope } from "../scopes/csharp.js";
|
|
|
13
14
|
import { CSharpLexicalScope } from "../scopes/lexical.js";
|
|
14
15
|
import { CSharpMethodScope } from "../scopes/method.js";
|
|
15
16
|
import { CSharpNamedTypeScope } from "../scopes/named-type.js";
|
|
16
|
-
import {
|
|
17
|
-
CSharpNamespaceScope,
|
|
18
|
-
useEnclosingNamespaceScope,
|
|
19
|
-
} from "../scopes/namespace.js";
|
|
17
|
+
import { CSharpNamespaceScope } from "../scopes/namespace.js";
|
|
20
18
|
import { CSharpSourceFileScope } from "../scopes/source-file.js";
|
|
21
19
|
import { CSharpSymbol, CSharpSymbolOptions } from "./csharp.js";
|
|
22
20
|
import { MethodKinds, MethodSymbol } from "./method.js";
|
|
@@ -118,13 +116,52 @@ export function createNamedTypeSymbol(
|
|
|
118
116
|
);
|
|
119
117
|
}
|
|
120
118
|
|
|
121
|
-
export function createNamespaceSymbol(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
119
|
+
export function createNamespaceSymbol(
|
|
120
|
+
name: string | Namekey | (string | Namekey)[],
|
|
121
|
+
options: CSharpSymbolOptions = {},
|
|
122
|
+
): NamespaceSymbol {
|
|
123
|
+
const scope = useNamespaceContext();
|
|
124
|
+
const parentSymbol = scope?.symbol ?? getGlobalNamespace(useBinder());
|
|
125
|
+
const names = normalizeNamespaceName(name);
|
|
126
|
+
let current = parentSymbol;
|
|
127
|
+
for (const name of names) {
|
|
128
|
+
current = createNamespaceSymbolInternal(name, current, options);
|
|
129
|
+
}
|
|
130
|
+
return current;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function normalizeNamespaceName(
|
|
134
|
+
name: string | Namekey | (string | Namekey)[],
|
|
135
|
+
): (string | Namekey)[] {
|
|
136
|
+
if (Array.isArray(name)) {
|
|
137
|
+
return name;
|
|
138
|
+
}
|
|
139
|
+
if (typeof name === "string" && name.includes(".")) {
|
|
140
|
+
return name.split(".");
|
|
126
141
|
}
|
|
127
|
-
return
|
|
142
|
+
return [name];
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function createNamespaceSymbolInternal(
|
|
146
|
+
name: string | Namekey,
|
|
147
|
+
parentSymbol: NamespaceSymbol,
|
|
148
|
+
options: CSharpSymbolOptions = {},
|
|
149
|
+
): NamespaceSymbol {
|
|
150
|
+
const namePolicy =
|
|
151
|
+
options.namePolicy ?? useCSharpNamePolicy().for("namespace");
|
|
152
|
+
const expectedName = namePolicy(typeof name === "string" ? name : name.name);
|
|
153
|
+
if (parentSymbol.members.symbolNames.has(expectedName)) {
|
|
154
|
+
return parentSymbol.members.symbolNames.get(
|
|
155
|
+
expectedName,
|
|
156
|
+
)! as NamespaceSymbol;
|
|
157
|
+
}
|
|
158
|
+
return withCleanup(
|
|
159
|
+
new NamespaceSymbol(
|
|
160
|
+
name,
|
|
161
|
+
parentSymbol,
|
|
162
|
+
withNamePolicy(options, "namespace"),
|
|
163
|
+
),
|
|
164
|
+
);
|
|
128
165
|
}
|
|
129
166
|
|
|
130
167
|
export interface CreateMethodSymbolOptions extends CSharpSymbolOptions {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Namekey, OutputSpace
|
|
2
|
-
import { CSharpSymbol } from "./csharp.js";
|
|
1
|
+
import { Namekey, OutputSpace } from "@alloy-js/core";
|
|
2
|
+
import { CSharpSymbol, CSharpSymbolOptions } from "./csharp.js";
|
|
3
3
|
|
|
4
4
|
// represents a symbol from a .cs file. Class, enum, interface etc.
|
|
5
5
|
|
|
@@ -25,7 +25,7 @@ export class NamedTypeSymbol extends CSharpSymbol {
|
|
|
25
25
|
name: string | Namekey,
|
|
26
26
|
spaces: OutputSpace[] | OutputSpace | undefined,
|
|
27
27
|
kind: NamedTypeTypeKind,
|
|
28
|
-
options?:
|
|
28
|
+
options?: CSharpSymbolOptions,
|
|
29
29
|
) {
|
|
30
30
|
super(name, spaces, options);
|
|
31
31
|
this.#typeKind = kind;
|
package/src/symbols/namespace.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OutputSymbolOptions } from "@alloy-js/core";
|
|
1
|
+
import { Namekey, OutputSymbolOptions } from "@alloy-js/core";
|
|
2
2
|
import { NamedTypeSymbol } from "./named-type.js";
|
|
3
3
|
|
|
4
4
|
export interface NamespaceSymbolOptions extends OutputSymbolOptions {
|
|
@@ -11,7 +11,7 @@ export interface NamespaceSymbolOptions extends OutputSymbolOptions {
|
|
|
11
11
|
export class NamespaceSymbol extends NamedTypeSymbol {
|
|
12
12
|
public readonly symbolKind = "namespace";
|
|
13
13
|
constructor(
|
|
14
|
-
name: string,
|
|
14
|
+
name: string | Namekey,
|
|
15
15
|
parentNamespace?: NamespaceSymbol,
|
|
16
16
|
options?: NamespaceSymbolOptions,
|
|
17
17
|
) {
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { AccessExpression } from "#components/access-expression/access-expression.jsx";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Children,
|
|
4
|
+
memo,
|
|
5
|
+
OutputSymbol,
|
|
6
|
+
Refkey,
|
|
7
|
+
resolve,
|
|
8
|
+
unresolvedRefkey,
|
|
9
|
+
} from "@alloy-js/core";
|
|
3
10
|
import { CSharpScope } from "../scopes/csharp.js";
|
|
4
11
|
import { CSharpNamespaceScope } from "../scopes/namespace.js";
|
|
5
12
|
import { useSourceFileScope } from "../scopes/source-file.js";
|
|
@@ -17,7 +24,7 @@ export function ref(
|
|
|
17
24
|
const resolveResult = resolve<CSharpScope, CSharpSymbol>(refkey as Refkey);
|
|
18
25
|
return memo(() => {
|
|
19
26
|
if (resolveResult.value === undefined) {
|
|
20
|
-
return [
|
|
27
|
+
return [unresolvedRefkey(refkey), undefined];
|
|
21
28
|
}
|
|
22
29
|
|
|
23
30
|
const result = resolveResult.value;
|
|
@@ -26,7 +33,7 @@ export function ref(
|
|
|
26
33
|
|
|
27
34
|
if (!commonScope) {
|
|
28
35
|
// this shouldn't be possible in csharp.
|
|
29
|
-
return [
|
|
36
|
+
return [unresolvedRefkey(refkey), undefined];
|
|
30
37
|
}
|
|
31
38
|
|
|
32
39
|
if (
|