@alloy-js/csharp 0.20.0-dev.1 → 0.20.0-dev.10
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/src/components/Declaration.d.ts +2 -2
- package/dist/src/components/Declaration.d.ts.map +1 -1
- package/dist/src/components/Declaration.js +5 -14
- package/dist/src/components/Declaration.js.map +1 -0
- package/dist/src/components/Name.js +2 -1
- package/dist/src/components/Name.js.map +1 -0
- package/dist/src/components/ProjectDirectory.js +2 -1
- package/dist/src/components/ProjectDirectory.js.map +1 -0
- package/dist/src/components/Reference.d.ts.map +1 -1
- package/dist/src/components/Reference.js +7 -2
- package/dist/src/components/Reference.js.map +1 -0
- package/dist/src/components/UsingDirective.d.ts +5 -1
- package/dist/src/components/UsingDirective.d.ts.map +1 -1
- package/dist/src/components/UsingDirective.js +5 -2
- package/dist/src/components/UsingDirective.js.map +1 -0
- package/dist/src/components/access-expression/access-expression.d.ts +54 -0
- package/dist/src/components/access-expression/access-expression.d.ts.map +1 -0
- package/dist/src/components/access-expression/access-expression.js +277 -0
- package/dist/src/components/access-expression/access-expression.js.map +1 -0
- package/dist/src/components/access-expression/access-expression.test.d.ts +2 -0
- package/dist/src/components/access-expression/access-expression.test.d.ts.map +1 -0
- package/dist/src/components/access-expression/access-expression.test.js +336 -0
- package/dist/src/components/access-expression/access-expression.test.js.map +1 -0
- package/dist/src/components/access-expression/part-descriptors.d.ts +32 -0
- package/dist/src/components/access-expression/part-descriptors.d.ts.map +1 -0
- package/dist/src/components/access-expression/part-descriptors.js +99 -0
- package/dist/src/components/access-expression/part-descriptors.js.map +1 -0
- package/dist/src/components/attributes/attributes.js +2 -1
- package/dist/src/components/attributes/attributes.js.map +1 -0
- package/dist/src/components/attributes/attributes.test.js +2 -1
- package/dist/src/components/attributes/attributes.test.js.map +1 -0
- package/dist/src/components/class/declaration.d.ts +2 -2
- package/dist/src/components/class/declaration.d.ts.map +1 -1
- package/dist/src/components/class/declaration.js +21 -34
- package/dist/src/components/class/declaration.js.map +1 -0
- package/dist/src/components/class/declaration.test.js +199 -200
- package/dist/src/components/class/declaration.test.js.map +1 -0
- package/dist/src/components/constructor/constructor.d.ts.map +1 -1
- package/dist/src/components/constructor/constructor.js +13 -20
- package/dist/src/components/constructor/constructor.js.map +1 -0
- package/dist/src/components/constructor/constructor.test.js +12 -20
- package/dist/src/components/constructor/constructor.test.js.map +1 -0
- package/dist/src/components/doc/comment.js +2 -1
- package/dist/src/components/doc/comment.js.map +1 -0
- package/dist/src/components/doc/comment.test.js +2 -1
- package/dist/src/components/doc/comment.test.js.map +1 -0
- package/dist/src/components/doc/from-markdown.js +2 -1
- package/dist/src/components/doc/from-markdown.js.map +1 -0
- package/dist/src/components/doc/from-markdown.test.js +2 -1
- package/dist/src/components/doc/from-markdown.test.js.map +1 -0
- package/dist/src/components/{EnumDeclaration.d.ts → enum/declaration.d.ts} +6 -11
- package/dist/src/components/enum/declaration.d.ts.map +1 -0
- package/dist/src/components/enum/declaration.js +55 -0
- package/dist/src/components/enum/declaration.js.map +1 -0
- package/dist/src/components/enum/declaration.ref.test.d.ts +2 -0
- package/dist/src/components/enum/declaration.ref.test.d.ts.map +1 -0
- package/dist/src/components/enum/declaration.ref.test.js +121 -0
- package/dist/src/components/enum/declaration.ref.test.js.map +1 -0
- package/dist/src/components/enum/declaration.test.d.ts +2 -0
- package/dist/src/components/enum/declaration.test.d.ts.map +1 -0
- package/dist/src/components/enum/declaration.test.js +40 -0
- package/dist/src/components/enum/declaration.test.js.map +1 -0
- package/dist/src/components/enum/member.d.ts +7 -0
- package/dist/src/components/enum/member.d.ts.map +1 -0
- package/dist/src/components/enum/member.js +30 -0
- package/dist/src/components/enum/member.js.map +1 -0
- package/dist/src/components/enum/member.test.d.ts +2 -0
- package/dist/src/components/enum/member.test.d.ts.map +1 -0
- package/dist/src/components/enum/member.test.js +29 -0
- package/dist/src/components/enum/member.test.js.map +1 -0
- package/dist/src/components/field/field.d.ts.map +1 -1
- package/dist/src/components/field/field.js +11 -18
- package/dist/src/components/field/field.js.map +1 -0
- package/dist/src/components/field/field.test.js +9 -8
- package/dist/src/components/field/field.test.js.map +1 -0
- package/dist/src/components/index.d.ts +7 -3
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +9 -4
- package/dist/src/components/index.js.map +1 -0
- package/dist/src/components/interface/declaration.d.ts.map +1 -1
- package/dist/src/components/interface/declaration.js +21 -22
- package/dist/src/components/interface/declaration.js.map +1 -0
- package/dist/src/components/interface/declaration.test.js +28 -36
- package/dist/src/components/interface/declaration.test.js.map +1 -0
- package/dist/src/components/interface/method.d.ts.map +1 -1
- package/dist/src/components/interface/method.js +9 -19
- package/dist/src/components/interface/method.js.map +1 -0
- package/dist/src/components/interface/method.test.js +40 -48
- package/dist/src/components/interface/method.test.js.map +1 -0
- package/dist/src/components/interface/property.d.ts.map +1 -1
- package/dist/src/components/interface/property.js +23 -40
- package/dist/src/components/interface/property.js.map +1 -0
- package/dist/src/components/interface/property.test.js +13 -12
- package/dist/src/components/interface/property.test.js.map +1 -0
- package/dist/src/components/invocation-expression/invocation-expression.d.ts +29 -0
- package/dist/src/components/invocation-expression/invocation-expression.d.ts.map +1 -0
- package/dist/src/components/invocation-expression/invocation-expression.js +70 -0
- package/dist/src/components/invocation-expression/invocation-expression.js.map +1 -0
- package/dist/src/components/invocation-expression/invocation-expression.test.d.ts +2 -0
- package/dist/src/components/invocation-expression/invocation-expression.test.d.ts.map +1 -0
- package/dist/src/components/invocation-expression/invocation-expression.test.js +105 -0
- package/dist/src/components/invocation-expression/invocation-expression.test.js.map +1 -0
- package/dist/src/components/lexical-scope.d.ts +8 -0
- package/dist/src/components/lexical-scope.d.ts.map +1 -0
- package/dist/src/components/lexical-scope.js +25 -0
- package/dist/src/components/lexical-scope.js.map +1 -0
- package/dist/src/components/method/method.d.ts +5 -2
- package/dist/src/components/method/method.d.ts.map +1 -1
- package/dist/src/components/method/method.js +9 -17
- package/dist/src/components/method/method.js.map +1 -0
- package/dist/src/components/method/method.test.js +13 -12
- package/dist/src/components/method/method.test.js.map +1 -0
- package/dist/src/components/method-scope.d.ts +8 -0
- package/dist/src/components/method-scope.d.ts.map +1 -0
- package/dist/src/components/method-scope.js +25 -0
- package/dist/src/components/method-scope.js.map +1 -0
- package/dist/src/components/namespace-scopes.d.ts +13 -0
- package/dist/src/components/namespace-scopes.d.ts.map +1 -0
- package/dist/src/components/namespace-scopes.js +45 -0
- package/dist/src/components/namespace-scopes.js.map +1 -0
- package/dist/src/components/namespace.d.ts +7 -0
- package/dist/src/components/namespace.d.ts.map +1 -0
- package/dist/src/components/namespace.js +47 -0
- package/dist/src/components/namespace.js.map +1 -0
- package/dist/src/components/namespace.ref.test.d.ts +2 -0
- package/dist/src/components/namespace.ref.test.d.ts.map +1 -0
- package/dist/src/components/namespace.ref.test.js +182 -0
- package/dist/src/components/namespace.ref.test.js.map +1 -0
- package/dist/src/components/namespace.test.d.ts.map +1 -0
- package/dist/src/components/namespace.test.js +79 -0
- package/dist/src/components/namespace.test.js.map +1 -0
- package/dist/src/components/parameters/parameters.d.ts +2 -3
- package/dist/src/components/parameters/parameters.d.ts.map +1 -1
- package/dist/src/components/parameters/parameters.js +15 -15
- package/dist/src/components/parameters/parameters.js.map +1 -0
- package/dist/src/components/parameters/parameters.test.d.ts +2 -0
- package/dist/src/components/parameters/parameters.test.d.ts.map +1 -0
- package/dist/src/components/parameters/parameters.test.js +154 -0
- package/dist/src/components/parameters/parameters.test.js.map +1 -0
- package/dist/src/components/property/property.d.ts +2 -2
- package/dist/src/components/property/property.d.ts.map +1 -1
- package/dist/src/components/property/property.js +30 -40
- package/dist/src/components/property/property.js.map +1 -0
- package/dist/src/components/property/property.test.js +16 -15
- package/dist/src/components/property/property.test.js.map +1 -0
- package/dist/src/components/record/declaration.d.ts +18 -0
- package/dist/src/components/record/declaration.d.ts.map +1 -1
- package/dist/src/components/record/declaration.js +21 -14
- package/dist/src/components/record/declaration.js.map +1 -0
- package/dist/src/components/record/declaration.test.js +52 -4
- package/dist/src/components/record/declaration.test.js.map +1 -0
- package/dist/src/components/source-file/source-file.d.ts +19 -0
- package/dist/src/components/source-file/source-file.d.ts.map +1 -0
- package/dist/src/components/source-file/source-file.js +59 -0
- package/dist/src/components/source-file/source-file.js.map +1 -0
- package/dist/src/components/source-file/source-file.test.d.ts +2 -0
- package/dist/src/components/source-file/source-file.test.d.ts.map +1 -0
- package/dist/src/components/source-file/source-file.test.js +136 -0
- package/dist/src/components/source-file/source-file.test.js.map +1 -0
- package/dist/src/components/stc/index.js +2 -1
- package/dist/src/components/stc/index.js.map +1 -0
- package/dist/src/components/struct/declaration.d.ts.map +1 -1
- package/dist/src/components/struct/declaration.js +6 -7
- package/dist/src/components/struct/declaration.js.map +1 -0
- package/dist/src/components/struct/declaration.test.js +32 -40
- package/dist/src/components/struct/declaration.test.js.map +1 -0
- package/dist/src/components/type-parameters/type-parameter-constraints.js +2 -1
- package/dist/src/components/type-parameters/type-parameter-constraints.js.map +1 -0
- package/dist/src/components/type-parameters/type-parameter-constraints.test.js +2 -1
- package/dist/src/components/type-parameters/type-parameter-constraints.test.js.map +1 -0
- package/dist/src/components/type-parameters/type-parameter.d.ts.map +1 -1
- package/dist/src/components/type-parameters/type-parameter.js +9 -11
- package/dist/src/components/type-parameters/type-parameter.js.map +1 -0
- package/dist/src/components/type-parameters/type-parameters.js +2 -1
- package/dist/src/components/type-parameters/type-parameters.js.map +1 -0
- package/dist/src/components/type-parameters/type-parameters.test.js +5 -4
- package/dist/src/components/type-parameters/type-parameters.test.js.map +1 -0
- package/dist/src/components/var/declaration.d.ts.map +1 -1
- package/dist/src/components/var/declaration.js +8 -9
- package/dist/src/components/var/declaration.js.map +1 -0
- package/dist/src/components/var/declaration.test.js +13 -21
- package/dist/src/components/var/declaration.test.js.map +1 -0
- package/dist/src/contexts/format-options.d.ts +5 -0
- package/dist/src/contexts/format-options.d.ts.map +1 -0
- package/dist/src/contexts/format-options.js +9 -0
- package/dist/src/contexts/format-options.js.map +1 -0
- package/dist/src/contexts/global-namespace.d.ts +5 -0
- package/dist/src/contexts/global-namespace.d.ts.map +1 -0
- package/dist/src/contexts/global-namespace.js +25 -0
- package/dist/src/contexts/global-namespace.js.map +1 -0
- package/dist/src/contexts/namespace.d.ts +8 -0
- package/dist/src/contexts/namespace.d.ts.map +1 -0
- package/dist/src/contexts/namespace.js +6 -0
- package/dist/src/contexts/namespace.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 +4 -1
- package/dist/src/index.js.map +1 -0
- package/dist/src/modifiers.d.ts +11 -0
- package/dist/src/modifiers.d.ts.map +1 -1
- package/dist/src/modifiers.js +2 -1
- package/dist/src/modifiers.js.map +1 -0
- package/dist/src/name-policy.js +2 -1
- package/dist/src/name-policy.js.map +1 -0
- package/dist/src/scopes/class.d.ts +10 -0
- package/dist/src/scopes/class.d.ts.map +1 -0
- package/dist/src/scopes/class.js +11 -0
- package/dist/src/scopes/class.js.map +1 -0
- package/dist/src/scopes/contexts.d.ts +9 -0
- package/dist/src/scopes/contexts.d.ts.map +1 -0
- package/dist/src/scopes/contexts.js +34 -0
- package/dist/src/scopes/contexts.js.map +1 -0
- package/dist/src/scopes/csharp.d.ts +10 -0
- package/dist/src/scopes/csharp.d.ts.map +1 -0
- package/dist/src/scopes/csharp.js +15 -0
- package/dist/src/scopes/csharp.js.map +1 -0
- package/dist/src/scopes/factories.d.ts +9 -0
- package/dist/src/scopes/factories.d.ts.map +1 -0
- package/dist/src/scopes/factories.js +24 -0
- package/dist/src/scopes/factories.js.map +1 -0
- package/dist/src/scopes/index.d.ts +10 -0
- package/dist/src/scopes/index.d.ts.map +1 -0
- package/dist/src/scopes/index.js +10 -0
- package/dist/src/scopes/index.js.map +1 -0
- package/dist/src/scopes/lexical.d.ts +7 -0
- package/dist/src/scopes/lexical.d.ts.map +1 -0
- package/dist/src/scopes/lexical.js +8 -0
- package/dist/src/scopes/lexical.js.map +1 -0
- package/dist/src/scopes/method.d.ts +9 -0
- package/dist/src/scopes/method.d.ts.map +1 -0
- package/dist/src/scopes/method.js +14 -0
- package/dist/src/scopes/method.js.map +1 -0
- package/dist/src/scopes/named-type.d.ts +22 -0
- package/dist/src/scopes/named-type.d.ts.map +1 -0
- package/dist/src/scopes/named-type.js +33 -0
- package/dist/src/scopes/named-type.js.map +1 -0
- package/dist/src/scopes/namespace.d.ts +11 -0
- package/dist/src/scopes/namespace.d.ts.map +1 -0
- package/dist/src/scopes/namespace.js +39 -0
- package/dist/src/scopes/namespace.js.map +1 -0
- package/dist/src/scopes/source-file.d.ts +16 -0
- package/dist/src/scopes/source-file.d.ts.map +1 -0
- package/dist/src/scopes/source-file.js +44 -0
- package/dist/src/scopes/source-file.js.map +1 -0
- package/dist/src/symbols/csharp.d.ts +87 -0
- package/dist/src/symbols/csharp.d.ts.map +1 -0
- package/dist/src/symbols/csharp.js +246 -0
- package/dist/src/symbols/csharp.js.map +1 -0
- package/dist/src/symbols/factories.d.ts +25 -0
- package/dist/src/symbols/factories.d.ts.map +1 -0
- package/dist/src/symbols/factories.js +93 -0
- package/dist/src/symbols/factories.js.map +1 -0
- package/dist/src/symbols/index.d.ts +5 -2
- package/dist/src/symbols/index.d.ts.map +1 -1
- package/dist/src/symbols/index.js +6 -2
- package/dist/src/symbols/index.js.map +1 -0
- package/dist/src/symbols/method.d.ts +13 -0
- package/dist/src/symbols/method.d.ts.map +1 -0
- package/dist/src/symbols/method.js +16 -0
- package/dist/src/symbols/method.js.map +1 -0
- package/dist/src/symbols/named-type.d.ts +19 -0
- package/dist/src/symbols/named-type.d.ts.map +1 -0
- package/dist/src/symbols/named-type.js +31 -0
- package/dist/src/symbols/named-type.js.map +1 -0
- package/dist/src/symbols/namespace.d.ts +22 -0
- package/dist/src/symbols/namespace.d.ts.map +1 -0
- package/dist/src/symbols/namespace.js +45 -0
- package/dist/src/symbols/namespace.js.map +1 -0
- package/dist/src/symbols/reference.d.ts +2 -2
- package/dist/src/symbols/reference.d.ts.map +1 -1
- package/dist/src/symbols/reference.js +50 -44
- package/dist/src/symbols/reference.js.map +1 -0
- package/dist/test/project-directory.test.js +20 -19
- package/dist/test/project-directory.test.js.map +1 -0
- package/dist/test/using.test.js +23 -21
- package/dist/test/using.test.js.map +1 -0
- package/dist/test/utils.d.ts.map +1 -1
- package/dist/test/utils.js +7 -4
- package/dist/test/utils.js.map +1 -0
- package/dist/test/vitest.setup.js +2 -1
- package/dist/test/vitest.setup.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -6
- package/src/components/Declaration.tsx +3 -6
- package/src/components/Reference.tsx +3 -1
- package/src/components/UsingDirective.tsx +12 -2
- package/src/components/access-expression/access-expression.test.tsx +284 -0
- package/src/components/access-expression/access-expression.tsx +375 -0
- package/src/components/access-expression/part-descriptors.ts +175 -0
- package/src/components/class/declaration.test.tsx +142 -150
- package/src/components/class/declaration.tsx +20 -32
- package/src/components/constructor/constructor.test.tsx +10 -16
- package/src/components/constructor/constructor.tsx +13 -32
- package/src/components/enum/declaration.ref.test.tsx +93 -0
- package/src/components/enum/declaration.test.tsx +34 -0
- package/src/components/enum/declaration.tsx +65 -0
- package/src/components/enum/member.test.tsx +24 -0
- package/src/components/enum/member.tsx +36 -0
- package/src/components/field/field.test.tsx +7 -7
- package/src/components/field/field.tsx +12 -22
- package/src/components/index.ts +7 -3
- package/src/components/interface/declaration.test.tsx +26 -32
- package/src/components/interface/declaration.tsx +16 -18
- package/src/components/interface/method.test.tsx +38 -44
- package/src/components/interface/method.tsx +7 -20
- package/src/components/interface/property.test.tsx +11 -11
- package/src/components/interface/property.tsx +15 -34
- package/src/components/invocation-expression/invocation-expression.test.tsx +101 -0
- package/src/components/invocation-expression/invocation-expression.tsx +60 -0
- package/src/components/lexical-scope.tsx +29 -0
- package/src/components/method/method.test.tsx +11 -11
- package/src/components/method/method.tsx +12 -23
- package/src/components/method-scope.tsx +27 -0
- package/src/components/namespace-scopes.tsx +44 -0
- package/src/components/namespace.ref.test.tsx +139 -0
- package/src/components/namespace.test.tsx +52 -0
- package/src/components/namespace.tsx +45 -0
- package/src/components/parameters/parameters.test.tsx +117 -0
- package/src/components/parameters/parameters.tsx +11 -23
- package/src/components/property/property.test.tsx +14 -14
- package/src/components/property/property.tsx +23 -41
- package/src/components/record/declaration.test.tsx +47 -3
- package/src/components/record/declaration.tsx +34 -11
- package/src/components/source-file/source-file.test.tsx +96 -0
- package/src/components/source-file/source-file.tsx +98 -0
- package/src/components/struct/declaration.test.tsx +16 -22
- package/src/components/struct/declaration.tsx +4 -6
- package/src/components/type-parameters/type-parameter.tsx +14 -11
- package/src/components/type-parameters/type-parameters.test.tsx +4 -4
- package/src/components/var/declaration.test.tsx +8 -14
- package/src/components/var/declaration.tsx +12 -6
- package/src/contexts/format-options.ts +14 -0
- package/src/contexts/global-namespace.ts +29 -0
- package/src/contexts/namespace.ts +13 -0
- package/src/index.ts +2 -0
- package/src/modifiers.ts +14 -0
- package/src/scopes/class.ts +12 -0
- package/src/scopes/contexts.ts +45 -0
- package/src/scopes/csharp.ts +23 -0
- package/src/scopes/factories.ts +45 -0
- package/src/scopes/index.ts +9 -0
- package/src/scopes/lexical.ts +10 -0
- package/src/scopes/method.ts +22 -0
- package/src/scopes/named-type.ts +44 -0
- package/src/scopes/namespace.ts +59 -0
- package/src/scopes/source-file.ts +67 -0
- package/src/symbols/csharp.ts +339 -0
- package/src/symbols/factories.ts +215 -0
- package/src/symbols/index.ts +5 -2
- package/src/symbols/method.ts +26 -0
- package/src/symbols/named-type.ts +54 -0
- package/src/symbols/namespace.ts +62 -0
- package/src/symbols/reference.tsx +64 -0
- package/temp/api.json +6919 -2532
- package/test/project-directory.test.tsx +14 -16
- package/test/using.test.tsx +21 -21
- package/test/utils.tsx +2 -1
- package/tsconfig.json +4 -1
- package/tsdoc-metadata.json +1 -1
- package/dist/src/components/EnumDeclaration.d.ts.map +0 -1
- package/dist/src/components/EnumDeclaration.js +0 -85
- package/dist/src/components/Namespace.d.ts +0 -11
- package/dist/src/components/Namespace.d.ts.map +0 -1
- package/dist/src/components/Namespace.js +0 -33
- package/dist/src/components/SourceFile.d.ts +0 -14
- package/dist/src/components/SourceFile.d.ts.map +0 -1
- package/dist/src/components/SourceFile.js +0 -69
- package/dist/src/symbols/csharp-output-symbol.d.ts +0 -8
- package/dist/src/symbols/csharp-output-symbol.d.ts.map +0 -1
- package/dist/src/symbols/csharp-output-symbol.js +0 -19
- package/dist/src/symbols/scopes.d.ts +0 -14
- package/dist/src/symbols/scopes.d.ts.map +0 -1
- package/dist/src/symbols/scopes.js +0 -31
- package/dist/test/enum.test.d.ts +0 -2
- package/dist/test/enum.test.d.ts.map +0 -1
- package/dist/test/enum.test.js +0 -178
- package/dist/test/namespace.test.d.ts.map +0 -1
- package/dist/test/namespace.test.js +0 -81
- package/dist/test/sourcefile.test.d.ts +0 -2
- package/dist/test/sourcefile.test.d.ts.map +0 -1
- package/dist/test/sourcefile.test.js +0 -58
- package/src/components/EnumDeclaration.tsx +0 -99
- package/src/components/Namespace.tsx +0 -35
- package/src/components/SourceFile.tsx +0 -78
- package/src/symbols/csharp-output-symbol.ts +0 -22
- package/src/symbols/reference.ts +0 -65
- package/src/symbols/scopes.ts +0 -41
- package/test/enum.test.tsx +0 -149
- package/test/namespace.test.tsx +0 -55
- package/test/sourcefile.test.tsx +0 -47
- /package/dist/{test → src/components}/namespace.test.d.ts +0 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { memo as _$memo, createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { ClassDeclaration } from "#components/class/declaration.js";
|
|
3
|
+
import { Method } from "#components/method/method.js";
|
|
4
|
+
import { Property } from "#components/property/property.js";
|
|
5
|
+
import { List, memberRefkey, namekey } from "@alloy-js/core";
|
|
6
|
+
import { expect, it } from "vitest";
|
|
7
|
+
import { TestNamespace } from "../../../test/utils.js";
|
|
8
|
+
const Wrapper = props => _$createComponent(TestNamespace, {
|
|
9
|
+
get children() {
|
|
10
|
+
return _$createComponent(ClassDeclaration, {
|
|
11
|
+
"public": true,
|
|
12
|
+
name: "TestClass",
|
|
13
|
+
get children() {
|
|
14
|
+
return props.children;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
it("can be referenced", () => {
|
|
20
|
+
const param1Key = namekey("param1");
|
|
21
|
+
const param2Key = namekey("param2");
|
|
22
|
+
expect(_$createComponent(Wrapper, {
|
|
23
|
+
get children() {
|
|
24
|
+
return _$createComponent(Method, {
|
|
25
|
+
name: "MethodOne",
|
|
26
|
+
parameters: [{
|
|
27
|
+
name: param1Key,
|
|
28
|
+
type: "T1"
|
|
29
|
+
}, {
|
|
30
|
+
name: param2Key,
|
|
31
|
+
type: "T2"
|
|
32
|
+
}]
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
})).toRenderTo(`
|
|
36
|
+
public class TestClass
|
|
37
|
+
{
|
|
38
|
+
void MethodOne(T1 param1, T2 param2) {}
|
|
39
|
+
}
|
|
40
|
+
`);
|
|
41
|
+
});
|
|
42
|
+
it("members can be referenced", () => {
|
|
43
|
+
const classKey = namekey("TestType");
|
|
44
|
+
const methodKey = namekey("TestMethod");
|
|
45
|
+
const param1Key = namekey("param1");
|
|
46
|
+
expect(_$createComponent(TestNamespace, {
|
|
47
|
+
get children() {
|
|
48
|
+
return _$createComponent(List, {
|
|
49
|
+
get children() {
|
|
50
|
+
return [_$createComponent(ClassDeclaration, {
|
|
51
|
+
name: classKey,
|
|
52
|
+
get children() {
|
|
53
|
+
return _$createComponent(Method, {
|
|
54
|
+
name: methodKey
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}), _$createComponent(ClassDeclaration, {
|
|
58
|
+
name: "Test",
|
|
59
|
+
get children() {
|
|
60
|
+
return _$createComponent(Method, {
|
|
61
|
+
name: "Test",
|
|
62
|
+
parameters: [{
|
|
63
|
+
name: param1Key,
|
|
64
|
+
type: classKey
|
|
65
|
+
}],
|
|
66
|
+
get children() {
|
|
67
|
+
return ["return ", _$memo(() => memberRefkey(param1Key, methodKey)), "();"];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
})];
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
})).toRenderTo(`
|
|
76
|
+
class TestType
|
|
77
|
+
{
|
|
78
|
+
void TestMethod() {}
|
|
79
|
+
}
|
|
80
|
+
class Test
|
|
81
|
+
{
|
|
82
|
+
void Test(TestType param1)
|
|
83
|
+
{
|
|
84
|
+
return param1.TestMethod();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
`);
|
|
88
|
+
});
|
|
89
|
+
it("members can be referenced when the parameter is nullable", () => {
|
|
90
|
+
const propTypeKey = namekey("PropType");
|
|
91
|
+
const propTypePropKey = namekey("Field");
|
|
92
|
+
const classKey = namekey("TestType");
|
|
93
|
+
const propKey = namekey("TestProp");
|
|
94
|
+
const param1Key = namekey("param1");
|
|
95
|
+
expect(_$createComponent(TestNamespace, {
|
|
96
|
+
get children() {
|
|
97
|
+
return _$createComponent(List, {
|
|
98
|
+
get children() {
|
|
99
|
+
return [_$createComponent(ClassDeclaration, {
|
|
100
|
+
name: propTypeKey,
|
|
101
|
+
get children() {
|
|
102
|
+
return _$createComponent(Property, {
|
|
103
|
+
name: propTypePropKey,
|
|
104
|
+
type: "string",
|
|
105
|
+
nullable: true
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}), _$createComponent(ClassDeclaration, {
|
|
109
|
+
name: classKey,
|
|
110
|
+
get children() {
|
|
111
|
+
return _$createComponent(Property, {
|
|
112
|
+
name: propKey,
|
|
113
|
+
type: propTypeKey,
|
|
114
|
+
nullable: true
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}), _$createComponent(ClassDeclaration, {
|
|
118
|
+
name: "Test",
|
|
119
|
+
get children() {
|
|
120
|
+
return _$createComponent(Method, {
|
|
121
|
+
name: "Test",
|
|
122
|
+
parameters: [{
|
|
123
|
+
name: param1Key,
|
|
124
|
+
type: classKey,
|
|
125
|
+
optional: true
|
|
126
|
+
}],
|
|
127
|
+
get children() {
|
|
128
|
+
return ["return ", _$memo(() => memberRefkey(param1Key, propKey, propTypePropKey)), ";"];
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
})];
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
})).toRenderTo(`
|
|
137
|
+
class PropType
|
|
138
|
+
{
|
|
139
|
+
string? Field { }
|
|
140
|
+
}
|
|
141
|
+
class TestType
|
|
142
|
+
{
|
|
143
|
+
PropType? TestProp { }
|
|
144
|
+
}
|
|
145
|
+
class Test
|
|
146
|
+
{
|
|
147
|
+
void Test(TestType? param1)
|
|
148
|
+
{
|
|
149
|
+
return param1?.TestProp?.Field;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
`);
|
|
153
|
+
});
|
|
154
|
+
//# sourceMappingURL=parameters.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ClassDeclaration","Method","Property","List","memberRefkey","namekey","expect","it","TestNamespace","Wrapper","props","_$createComponent","children","name","param1Key","param2Key","parameters","type","toRenderTo","classKey","methodKey","_$memo","propTypeKey","propTypePropKey","propKey","nullable","optional"],"sources":["../../../../src/components/parameters/parameters.test.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,gBAAgB;AACzB,SAASC,MAAM;AACf,SAASC,QAAQ;AACjB,SAASC,IAAI,EAAEC,YAAY,EAAEC,OAAO,QAAQ,gBAAgB;AAE5D,SAASC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AACnC,SAASC,aAAa;AAEtB,MAAMC,OAAO,GAAIC,KAA6B,IAAAC,iBAAA,CAC3CH,aAAa;EAAA,IAAAI,SAAA;IAAA,OAAAD,iBAAA,CACXX,gBAAgB;MAA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;kBAAEH,IAAI,EAAEC,SAAS;kBAAEG,IAAI,EAAEE,QAAQ;kBAAEO,QAAQ,EAAE;gBAAK,CAAC,CAAC;gBAAA,IAAAd,SAAA;kBAAA,mBAAAS,MAAA,OAEzDjB,YAAY,CAACU,SAAS,EAAEU,OAAO,EAAED,eAAe,CAAC;gBAAA;cAAA;YAAA;UAAA;QAAA;MAAA;IAAA;EAAA,EAKnE,CAAC,CAACL,UAAU,CAAC;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Children, Refkey } from "@alloy-js/core";
|
|
1
|
+
import { Children, Namekey, Refkey } from "@alloy-js/core";
|
|
2
2
|
import { AccessModifiers } from "../../modifiers.js";
|
|
3
3
|
import { AttributesProp } from "../attributes/attributes.jsx";
|
|
4
4
|
/** Property modifiers. */
|
|
@@ -19,7 +19,7 @@ export interface PropertyModifiers {
|
|
|
19
19
|
}
|
|
20
20
|
/** Properties for {@link Property} component */
|
|
21
21
|
export interface PropertyProps extends AccessModifiers, PropertyModifiers {
|
|
22
|
-
name: string;
|
|
22
|
+
name: Namekey | string;
|
|
23
23
|
refkey?: Refkey;
|
|
24
24
|
/** Property type */
|
|
25
25
|
type: Children;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"property.d.ts","sourceRoot":"","sources":["../../../../src/components/property/property.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,
|
|
1
|
+
{"version":3,"file":"property.d.ts","sourceRoot":"","sources":["../../../../src/components/property/property.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAMR,OAAO,EACP,MAAM,EACP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,EAIhB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAiB,cAAc,EAAE,MAAM,8B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ent as _$createComponent, memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import { Block, code, List, MemberDeclaration,
|
|
2
|
+
import { Block, code, createSymbolSlot, List, MemberDeclaration, MemberName } from "@alloy-js/core";
|
|
3
3
|
import { computeModifiersPrefix, getAccessModifier, makeModifiers } from "../../modifiers.js";
|
|
4
|
-
import {
|
|
5
|
-
import { CSharpOutputSymbol } from "../../symbols/csharp-output-symbol.js";
|
|
6
|
-
import { CSharpMemberScope, useCSharpScope } from "../../symbols/scopes.js";
|
|
4
|
+
import { createPropertySymbol } from "../../symbols/factories.js";
|
|
7
5
|
import { AttributeList } from "../attributes/attributes.js";
|
|
8
6
|
import { DocWhen } from "../doc/comment.js";
|
|
9
7
|
|
|
@@ -23,19 +21,11 @@ const getModifiers = makeModifiers(["new", "static", "virtual", "sealed", "overr
|
|
|
23
21
|
* ```
|
|
24
22
|
*/
|
|
25
23
|
export function Property(props) {
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const propertySymbol = new CSharpOutputSymbol(name, {
|
|
32
|
-
scope,
|
|
33
|
-
refkeys: props.refkey ?? refkey(props.name)
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// scope for property declaration
|
|
37
|
-
const propertyScope = new CSharpMemberScope("property-decl", {
|
|
38
|
-
owner: propertySymbol
|
|
24
|
+
const TypeSlot = createSymbolSlot();
|
|
25
|
+
const propertySymbol = createPropertySymbol(props.name, {
|
|
26
|
+
refkeys: props.refkey,
|
|
27
|
+
isNullable: props.nullable,
|
|
28
|
+
type: TypeSlot.firstSymbol
|
|
39
29
|
});
|
|
40
30
|
const modifiers = computeModifiersPrefix([getAccessModifier(props), getModifiers(props)]);
|
|
41
31
|
if (props.init && props.set) {
|
|
@@ -45,32 +35,32 @@ export function Property(props) {
|
|
|
45
35
|
return _$createComponent(MemberDeclaration, {
|
|
46
36
|
symbol: propertySymbol,
|
|
47
37
|
get children() {
|
|
48
|
-
return _$createComponent(
|
|
49
|
-
|
|
38
|
+
return [_$createComponent(DocWhen, {
|
|
39
|
+
get doc() {
|
|
40
|
+
return props.doc;
|
|
41
|
+
}
|
|
42
|
+
}), _$createComponent(AttributeList, {
|
|
43
|
+
get attributes() {
|
|
44
|
+
return props.attributes;
|
|
45
|
+
},
|
|
46
|
+
endline: true
|
|
47
|
+
}), modifiers, _$createComponent(TypeSlot, {
|
|
50
48
|
get children() {
|
|
51
|
-
return
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
endline: true
|
|
60
|
-
}), modifiers, _$memo(() => props.type), _$memo(() => props.nullable && "?"), " ", name, " ", _$createComponent(Block, {
|
|
61
|
-
newline: true,
|
|
62
|
-
inline: true,
|
|
49
|
+
return props.type;
|
|
50
|
+
}
|
|
51
|
+
}), _$memo(() => props.nullable && "?"), " ", _$createComponent(MemberName, {}), " ", _$createComponent(Block, {
|
|
52
|
+
newline: true,
|
|
53
|
+
inline: true,
|
|
54
|
+
get children() {
|
|
55
|
+
return _$createComponent(List, {
|
|
56
|
+
joiner: " ",
|
|
63
57
|
get children() {
|
|
64
|
-
return _$
|
|
65
|
-
joiner: " ",
|
|
66
|
-
get children() {
|
|
67
|
-
return [_$memo(() => props.get && "get;"), _$memo(() => props.set && "set;"), _$memo(() => props.init && "init;")];
|
|
68
|
-
}
|
|
69
|
-
});
|
|
58
|
+
return [_$memo(() => props.get && "get;"), _$memo(() => props.set && "set;"), _$memo(() => props.init && "init;")];
|
|
70
59
|
}
|
|
71
|
-
})
|
|
60
|
+
});
|
|
72
61
|
}
|
|
73
|
-
});
|
|
62
|
+
}), _$memo(() => props.initializer && code` = ${props.initializer};`)];
|
|
74
63
|
}
|
|
75
64
|
});
|
|
76
|
-
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=property.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Block","code","createSymbolSlot","List","MemberDeclaration","MemberName","computeModifiersPrefix","getAccessModifier","makeModifiers","createPropertySymbol","AttributeList","DocWhen","getModifiers","Property","props","TypeSlot","propertySymbol","name","refkeys","refkey","isNullable","nullable","type","firstSymbol","modifiers","init","set","Error","_$createComponent","symbol","children","doc","attributes","endline","_$memo","newline","inline","joiner","get","initializer"],"sources":["../../../../src/components/property/property.tsx"],"sourcesContent":[null],"mappings":";AAAA,SACEA,KAAK,EAELC,IAAI,EACJC,gBAAgB,EAChBC,IAAI,EACJC,iBAAiB,EACjBC,UAAU,QAGL,gBAAgB;AACvB,SAEEC,sBAAsB,EACtBC,iBAAiB,EACjBC,aAAa,QACR,oBAAoB;AAC3B,SAASC,oBAAoB,QAAQ,4BAA4B;AACjE,SAASC,aAAa;AACtB,SAASC,OAAO;;AAEhB;;AAiBA,MAAMC,YAAY,GAAGJ,aAAa,CAAoB,CACpD,KAAK,EACL,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,UAAU,EACV,UAAU,EACV,QAAQ,EACR,UAAU,EACV,UAAU,CACX,CAAC;;AAEF;;AA2DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASK,QAAQA,CAACC,KAAoB,EAAE;EAC7C,MAAMC,QAAQ,GAAGb,gBAAgB,CAAC,CAAC;EAEnC,MAAMc,cAAc,GAAGP,oBAAoB,CAACK,KAAK,CAACG,IAAI,EAAE;IACtDC,OAAO,EAAEJ,KAAK,CAACK,MAAM;IACrBC,UAAU,EAAEN,KAAK,CAACO,QAAQ;IAC1BC,IAAI,EAAEP,QAAQ,CAACQ;EACjB,CAAC,CAAC;EAEF,MAAMC,SAAS,GAAGlB,sBAAsB,CAAC,CACvCC,iBAAiB,CAACO,KAAK,CAAC,EACxBF,YAAY,CAACE,KAAK,CAAC,CACpB,CAAC;EAEF,IAAIA,KAAK,CAACW,IAAI,IAAIX,KAAK,CAACY,GAAG,EAAE;IAC3B,MAAM,IAAIC,KAAK,CACb,qDAAqDV,IAAI,GAC3D,CAAC;EACH;EACA;EACA,OAAAW,iBAAA,CACGxB,iBAAiB;IAACyB,MAAM,EAAEb,cAAc;IAAA,IAAAc,SAAA;MAAA,QAAAF,iBAAA,CACtCjB,OAAO;QAAA,IAACoB,GAAGA,CAAA;UAAA,OAAEjB,KAAK,CAACiB,GAAG;QAAA;MAAA,IAAAH,iBAAA,CACtBlB,aAAa;QAAA,IAACsB,UAAUA,CAAA;UAAA,OAAElB,KAAK,CAACkB,UAAU;QAAA;QAAEC,OAAO;MAAA,IACnDT,SAAS,EAAAI,iBAAA,CACTb,QAAQ;QAAA,IAAAe,SAAA;UAAA,OAAEhB,KAAK,CAACQ,IAAI;QAAA;MAAA,IAAAY,MAAA,OACpBpB,KAAK,CAACO,QAAQ,IAAI,GAAG,QAAAO,iBAAA,CAAGvB,UAAU,OAAI,GAAG,EAAAuB,iBAAA,CACzC5B,KAAK;QAACmC,OAAO;QAACC,MAAM;QAAA,IAAAN,SAAA;UAAA,OAAAF,iBAAA,CAClBzB,IAAI;YAACkC,MAAM;YAAA,IAAAP,SAAA;cAAA,QAAAI,MAAA,OACTpB,KAAK,CAACwB,GAAG,IAAI,MAAM,GAAAJ,MAAA,OACnBpB,KAAK,CAACY,GAAG,IAAI,MAAM,GAAAQ,MAAA,OACnBpB,KAAK,CAACW,IAAI,IAAI,OAAO;YAAA;UAAA;QAAA;MAAA,IAAAS,MAAA,OAGzBpB,KAAK,CAACyB,WAAW,IAAItC,IAAI,MAAMa,KAAK,CAACyB,WAAW,GAAG;IAAA;EAAA;AAG1D","ignoreList":[]}
|
|
@@ -31,7 +31,7 @@ describe("modifiers", () => {
|
|
|
31
31
|
})).toRenderTo(`
|
|
32
32
|
public class TestClass
|
|
33
33
|
{
|
|
34
|
-
|
|
34
|
+
${accessModifier} string TestProp { get; }
|
|
35
35
|
}
|
|
36
36
|
`);
|
|
37
37
|
});
|
|
@@ -51,7 +51,7 @@ describe("modifiers", () => {
|
|
|
51
51
|
})).toRenderTo(`
|
|
52
52
|
public class TestClass
|
|
53
53
|
{
|
|
54
|
-
|
|
54
|
+
${methodModifier} string TestProp { get; }
|
|
55
55
|
}
|
|
56
56
|
`);
|
|
57
57
|
});
|
|
@@ -70,7 +70,7 @@ describe("modifiers", () => {
|
|
|
70
70
|
})).toRenderTo(`
|
|
71
71
|
public class TestClass
|
|
72
72
|
{
|
|
73
|
-
|
|
73
|
+
public new string TestProp { get; }
|
|
74
74
|
}
|
|
75
75
|
`);
|
|
76
76
|
});
|
|
@@ -87,7 +87,7 @@ it("applies PascalCase naming policy", () => {
|
|
|
87
87
|
})).toRenderTo(`
|
|
88
88
|
public class TestClass
|
|
89
89
|
{
|
|
90
|
-
|
|
90
|
+
string TestProp { get; }
|
|
91
91
|
}
|
|
92
92
|
`);
|
|
93
93
|
});
|
|
@@ -103,7 +103,7 @@ it("has getter only", () => {
|
|
|
103
103
|
})).toRenderTo(`
|
|
104
104
|
public class TestClass
|
|
105
105
|
{
|
|
106
|
-
|
|
106
|
+
string TestProp { get; }
|
|
107
107
|
}
|
|
108
108
|
`);
|
|
109
109
|
});
|
|
@@ -119,7 +119,7 @@ it("has setter only", () => {
|
|
|
119
119
|
})).toRenderTo(`
|
|
120
120
|
public class TestClass
|
|
121
121
|
{
|
|
122
|
-
|
|
122
|
+
string TestProp { set; }
|
|
123
123
|
}
|
|
124
124
|
`);
|
|
125
125
|
});
|
|
@@ -136,7 +136,7 @@ it("has getter and setter", () => {
|
|
|
136
136
|
})).toRenderTo(`
|
|
137
137
|
public class TestClass
|
|
138
138
|
{
|
|
139
|
-
|
|
139
|
+
string TestProp { get; set; }
|
|
140
140
|
}
|
|
141
141
|
`);
|
|
142
142
|
});
|
|
@@ -153,7 +153,7 @@ it("has getter and init", () => {
|
|
|
153
153
|
})).toRenderTo(`
|
|
154
154
|
public class TestClass
|
|
155
155
|
{
|
|
156
|
-
|
|
156
|
+
string TestProp { get; init; }
|
|
157
157
|
}
|
|
158
158
|
`);
|
|
159
159
|
});
|
|
@@ -176,8 +176,8 @@ it("specify doc comment", () => {
|
|
|
176
176
|
})).toRenderTo(`
|
|
177
177
|
class Test
|
|
178
178
|
{
|
|
179
|
-
|
|
180
|
-
|
|
179
|
+
/// This is a test
|
|
180
|
+
string Method { get; set; }
|
|
181
181
|
}
|
|
182
182
|
`);
|
|
183
183
|
});
|
|
@@ -195,7 +195,7 @@ it("specify nullable property", () => {
|
|
|
195
195
|
})).toRenderTo(`
|
|
196
196
|
public class TestClass
|
|
197
197
|
{
|
|
198
|
-
|
|
198
|
+
string? TestProp { get; set; }
|
|
199
199
|
}
|
|
200
200
|
`);
|
|
201
201
|
});
|
|
@@ -213,7 +213,7 @@ it("specify initializer", () => {
|
|
|
213
213
|
})).toRenderTo(`
|
|
214
214
|
public class TestClass
|
|
215
215
|
{
|
|
216
|
-
|
|
216
|
+
string TestProp { get; set; } = "abc";
|
|
217
217
|
}
|
|
218
218
|
`);
|
|
219
219
|
});
|
|
@@ -235,8 +235,9 @@ it("specify attributes", () => {
|
|
|
235
235
|
})).toRenderTo(`
|
|
236
236
|
public class TestClass
|
|
237
237
|
{
|
|
238
|
-
|
|
239
|
-
|
|
238
|
+
[Test]
|
|
239
|
+
int Test { get; set; }
|
|
240
240
|
}
|
|
241
241
|
`);
|
|
242
|
-
});
|
|
242
|
+
});
|
|
243
|
+
//# sourceMappingURL=property.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["describe","expect","it","TestNamespace","Attribute","ClassDeclaration","Property","Wrapper","props","_$createComponent","children","name","each","accessModifier","_$mergeProps","type","get","toRenderTo","methodModifier","set","init","doc","nullable","initializer","attributes"],"sources":["../../../../src/components/property/property.test.tsx"],"sourcesContent":[null],"mappings":";AACA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,aAAa;AACtB,SAASC,SAAS;AAClB,SAASC,gBAAgB;AACzB,SAASC,QAAQ;AAEjB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EAAE,CAAC,qBAAqB,EAAE,MAAM;EAC9BD,MAAM,CAAAQ,iBAAA,CACHF,OAAO;IAAA,IAAAG,SAAA;MAAA,OAAAD,iBAAA,CACLH,QAAQ;QAACK,IAAI;QAAYI,IAAI;QAAUC,GAAG;QAACG,GAAG;QAACI,WAAW,EAAE;MAAO;IAAA;EAAA,EAExE,CAAC,CAACN,UAAU,CAAC;AACf;AACA;AACA;AACA;AACA,GAAG,CAAC;AACJ,CAAC,CAAC;AAEFf,EAAE,CAAC,oBAAoB,EAAE,MAAM;EAC7BD,MAAM,CAAAQ,iBAAA,CACHF,OAAO;IAAA,IAAAG,SAAA;MAAA,OAAAD,iBAAA,CACLH,QAAQ;QACPK,IAAI;QACJI,IAAI;QAAA,IACJS,UAAUA,CAAA;UAAA,OAAE,CAAAf,iBAAA,CAAEL,SAAS;YAACO,IAAI;UAAA,GAAW;QAAA;QACvCK,GAAG;QACHG,GAAG;MAAA;IAAA;EAAA,EAGT,CAAC,CAACF,UAAU,CAAC;AACf;AACA;AACA;AACA;AACA;AACA,GAAG,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as core from "@alloy-js/core";
|
|
2
2
|
import { AccessModifiers } from "../../modifiers.js";
|
|
3
|
+
import { ParameterProps } from "../parameters/parameters.jsx";
|
|
3
4
|
export interface RecordModifiers {
|
|
4
5
|
readonly partial?: boolean;
|
|
5
6
|
}
|
|
@@ -10,6 +11,23 @@ export interface RecordDeclarationProps extends Omit<core.DeclarationProps, "nam
|
|
|
10
11
|
doc?: core.Children;
|
|
11
12
|
refkey?: core.Refkey;
|
|
12
13
|
typeParameters?: Record<string, core.Refkey>;
|
|
14
|
+
/**
|
|
15
|
+
* Set the primary constructor parameters
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <ClassDeclaration name="MyClass" primaryConstructor={[
|
|
19
|
+
* {name: "value", type: "int"}
|
|
20
|
+
* ]}>
|
|
21
|
+
* ```
|
|
22
|
+
* This will produce:
|
|
23
|
+
* ```csharp
|
|
24
|
+
* public class MyClass(int value)
|
|
25
|
+
* {
|
|
26
|
+
*
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
primaryConstructor?: ParameterProps[];
|
|
13
31
|
}
|
|
14
32
|
/**
|
|
15
33
|
* CSharp record declaration.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declaration.d.ts","sourceRoot":"","sources":["../../../../src/components/record/declaration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AACvC,OAAO,EACL,eAAe,EAIhB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"declaration.d.ts","sourceRoot":"","sources":["../../../../src/components/record/declaration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AACvC,OAAO,EACL,eAAe,EAIhB,MAAM,oBAAoB,CAAC;AAS5B,OAAO,EAAE,cAAc,EAAc,MAAM,8BAA8B,CAAC;AAE1E,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAID,2DAA2D;AAC3D,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,EAC7C,eAAe,EACf,eAAe;IACjB,IAAI,EAAE,MAAM,CAAC;IAEb,kBAAkB;IAClB,GAAG,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAE7C;;;;;;;;;;;;;;;OAeG;IACH,kBAAkB,CAAC,EAAE,cAAc,EAAE,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,iBAyD9D"}
|
|
@@ -2,10 +2,11 @@ import { createComponent as _$createComponent, createIntrinsic as _$createIntrin
|
|
|
2
2
|
import * as core from "@alloy-js/core";
|
|
3
3
|
import { computeModifiersPrefix, getAccessModifier, makeModifiers } from "../../modifiers.js";
|
|
4
4
|
import { useCSharpNamePolicy } from "../../name-policy.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { createClassScope } from "../../scopes/factories.js";
|
|
6
|
+
import { createNamedTypeSymbol, createTypeParameterSymbol } from "../../symbols/factories.js";
|
|
7
7
|
import { DocWhen } from "../doc/comment.js";
|
|
8
8
|
import { Name } from "../Name.js";
|
|
9
|
+
import { Parameters } from "../parameters/parameters.js";
|
|
9
10
|
const getRecordModifiers = makeModifiers(["partial"]);
|
|
10
11
|
|
|
11
12
|
/** Props to use the {@link RecordDeclaration} component */
|
|
@@ -32,17 +33,13 @@ const getRecordModifiers = makeModifiers(["partial"]);
|
|
|
32
33
|
*/
|
|
33
34
|
export function RecordDeclaration(props) {
|
|
34
35
|
const name = useCSharpNamePolicy().getName(props.name, "record");
|
|
35
|
-
const thisRecordSymbol = new CSharpOutputSymbol(name, {
|
|
36
|
-
refkeys: props.refkey
|
|
37
|
-
});
|
|
38
36
|
|
|
39
|
-
//
|
|
40
|
-
//
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const thisRecordScope = new CSharpMemberScope("record-decl", {
|
|
44
|
-
owner: thisRecordSymbol
|
|
37
|
+
// records don't have their own type kind but instead use class or struct
|
|
38
|
+
// depending on what kind of record we have.
|
|
39
|
+
const thisRecordSymbol = createNamedTypeSymbol(name, "record", {
|
|
40
|
+
refkeys: props.refkey
|
|
45
41
|
});
|
|
42
|
+
const thisRecordScope = createClassScope(thisRecordSymbol);
|
|
46
43
|
let typeParams;
|
|
47
44
|
if (props.typeParameters) {
|
|
48
45
|
const typeParamNames = new Array();
|
|
@@ -50,7 +47,7 @@ export function RecordDeclaration(props) {
|
|
|
50
47
|
typeParamNames.push(useCSharpNamePolicy().getName(entry[0], "type-parameter"));
|
|
51
48
|
// create a symbol for each type param so its
|
|
52
49
|
// refkey resolves to the type param's name
|
|
53
|
-
|
|
50
|
+
createTypeParameterSymbol(entry[0], {
|
|
54
51
|
scope: thisRecordScope,
|
|
55
52
|
refkeys: entry[1]
|
|
56
53
|
});
|
|
@@ -74,7 +71,16 @@ export function RecordDeclaration(props) {
|
|
|
74
71
|
get doc() {
|
|
75
72
|
return props.doc;
|
|
76
73
|
}
|
|
77
|
-
}), modifiers, "record ", _$createComponent(Name, {}), typeParams, _$memo(() => _$memo(() => !!props.
|
|
74
|
+
}), modifiers, "record ", _$createComponent(Name, {}), typeParams, _$memo(() => _$memo(() => !!props.primaryConstructor)() && _$createComponent(core.Scope, {
|
|
75
|
+
value: thisRecordScope,
|
|
76
|
+
get children() {
|
|
77
|
+
return _$createComponent(Parameters, {
|
|
78
|
+
get parameters() {
|
|
79
|
+
return props.primaryConstructor;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
})), _$memo(() => _$memo(() => !!props.children)() ? _$createComponent(core.Block, {
|
|
78
84
|
newline: true,
|
|
79
85
|
get children() {
|
|
80
86
|
return _$createComponent(core.Scope, {
|
|
@@ -87,4 +93,5 @@ export function RecordDeclaration(props) {
|
|
|
87
93
|
}) : ";")];
|
|
88
94
|
}
|
|
89
95
|
});
|
|
90
|
-
}
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=declaration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["core","computeModifiersPrefix","getAccessModifier","makeModifiers","useCSharpNamePolicy","createClassScope","createNamedTypeSymbol","createTypeParameterSymbol","DocWhen","Name","Parameters","getRecordModifiers","RecordDeclaration","props","name","getName","thisRecordSymbol","refkeys","refkey","thisRecordScope","typeParams","typeParameters","typeParamNames","Array","entry","Object","entries","push","scope","_$createIntrinsic","children","_$createComponent","For","each","comma","line","modifiers","Declaration","symbol","doc","_$memo","primaryConstructor","Scope","value","parameters","Block","newline"],"sources":["../../../../src/components/record/declaration.tsx"],"sourcesContent":[null],"mappings":";AAAA,OAAO,KAAKA,IAAI,MAAM,gBAAgB;AACtC,SAEEC,sBAAsB,EACtBC,iBAAiB,EACjBC,aAAa,QACR,oBAAoB;AAC3B,SAASC,mBAAmB,QAAQ,sBAAsB;AAC1D,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,SACEC,qBAAqB,EACrBC,yBAAyB,QACpB,4BAA4B;AACnC,SAASC,OAAO;AAChB,SAASC,IAAI;AACb,SAAyBC,UAAU;AAMnC,MAAMC,kBAAkB,GAAGR,aAAa,CAAkB,CAAC,SAAS,CAAC,CAAC;;AAEtE;;AA+BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASS,iBAAiBA,CAACC,KAA6B,EAAE;EAC/D,MAAMC,IAAI,GAAGV,mBAAmB,CAAC,CAAC,CAACW,OAAO,CAACF,KAAK,CAACC,IAAI,EAAG,QAAQ,CAAC;;EAEjE;EACA;EACA,MAAME,gBAAgB,GAAGV,qBAAqB,CAACQ,IAAI,EAAE,QAAQ,EAAE;IAC7DG,OAAO,EAAEJ,KAAK,CAACK;EACjB,CAAC,CAAC;EAEF,MAAMC,eAAe,GAAGd,gBAAgB,CAACW,gBAAgB,CAAC;EAE1D,IAAII,UAAyB;EAC7B,IAAIP,KAAK,CAACQ,cAAc,EAAE;IACxB,MAAMC,cAAc,GAAG,IAAIC,KAAK,CAAS,CAAC;IAC1C,KAAK,MAAMC,KAAK,IAAIC,MAAM,CAACC,OAAO,CAACb,KAAK,CAACQ,cAAc,CAAC,EAAE;MACxDC,cAAc,CAACK,IAAI,CACjBvB,mBAAmB,CAAC,CAAC,CAACW,OAAO,CAACS,KAAK,CAAC,CAAC,CAAC,EAAE,gBA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,KAAK;YAACC,KAAK,EAAExB,eAAe;YAAA,IAAAW,SAAA;cAAA,OAAGjB,KAAK,CAACiB,QAAQ;YAAA;UAAA;QAAA;MAAA,KAErD,GAAG;IAAA;EAAA;AAGX","ignoreList":[]}
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import { createComponent as _$createComponent, mergeProps as _$mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { code, refkey } from "@alloy-js/core";
|
|
2
3
|
import { describe, expect, it } from "vitest";
|
|
3
4
|
import { TestNamespace } from "../../../test/utils.js";
|
|
4
5
|
import { Property } from "../property/property.js";
|
|
5
6
|
import { RecordDeclaration } from "./declaration.js";
|
|
6
|
-
|
|
7
|
+
|
|
8
|
+
// Remove Wrapper that added <SourceFile> because TestNamespace already does
|
|
9
|
+
function Wrapper({
|
|
10
|
+
children
|
|
11
|
+
}) {
|
|
12
|
+
return _$createComponent(TestNamespace, {
|
|
13
|
+
children: children
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
it("declares record with no members", () => {
|
|
7
17
|
expect(_$createComponent(TestNamespace, {
|
|
8
18
|
get children() {
|
|
9
19
|
return _$createComponent(RecordDeclaration, {
|
|
@@ -68,7 +78,7 @@ it("specify doc comment", () => {
|
|
|
68
78
|
record TestRecord;
|
|
69
79
|
`);
|
|
70
80
|
});
|
|
71
|
-
it("specify
|
|
81
|
+
it("specify record property inside", () => {
|
|
72
82
|
expect(_$createComponent(TestNamespace, {
|
|
73
83
|
get children() {
|
|
74
84
|
return _$createComponent(RecordDeclaration, {
|
|
@@ -88,7 +98,45 @@ it("specify class property inside", () => {
|
|
|
88
98
|
/// This is a test
|
|
89
99
|
record TestRecord
|
|
90
100
|
{
|
|
91
|
-
|
|
101
|
+
string Prop { get; set; }
|
|
92
102
|
}
|
|
93
103
|
`);
|
|
94
|
-
});
|
|
104
|
+
});
|
|
105
|
+
describe("constructor", () => {
|
|
106
|
+
it("declares primary constructor with args", () => {
|
|
107
|
+
const paramNameRefkey = refkey();
|
|
108
|
+
const paramSizeRefkey = refkey();
|
|
109
|
+
const ctorParams = [{
|
|
110
|
+
name: "name",
|
|
111
|
+
type: "string",
|
|
112
|
+
refkey: paramNameRefkey
|
|
113
|
+
}, {
|
|
114
|
+
name: "size",
|
|
115
|
+
type: "int",
|
|
116
|
+
refkey: paramSizeRefkey
|
|
117
|
+
}];
|
|
118
|
+
expect(_$createComponent(Wrapper, {
|
|
119
|
+
get children() {
|
|
120
|
+
return _$createComponent(RecordDeclaration, {
|
|
121
|
+
"public": true,
|
|
122
|
+
name: "Test",
|
|
123
|
+
primaryConstructor: ctorParams,
|
|
124
|
+
get children() {
|
|
125
|
+
return _$createComponent(Property, {
|
|
126
|
+
name: "PrettyName",
|
|
127
|
+
type: "string",
|
|
128
|
+
get: true,
|
|
129
|
+
initializer: code`$"{${paramNameRefkey}} {${paramSizeRefkey}}"`
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
})).toRenderTo(`
|
|
135
|
+
public record Test(string name, int size)
|
|
136
|
+
{
|
|
137
|
+
string PrettyName { get; } = $"{name} {size}";
|
|
138
|
+
}
|
|
139
|
+
`);
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
//# sourceMappingURL=declaration.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["code","refkey","describe","expect","it","TestNamespace","Property","RecordDeclaration","Wrapper","children","_$createComponent","name","toRenderTo","each","mod","_$mergeProps","partial","doc","get","set","type","paramNameRefkey","paramSizeRefkey","ctorParams","primaryConstructor","initializer"],"sources":["../../../../src/components/record/declaration.test.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAAmBA,IAAI,EAAEC,MAAM,QAAQ,gBAAgB;AACvD,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,aAAa;AACtB,SAASC,QAAQ;AACjB,SAASC,iBAAiB;;AAE1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AA,IAAAC,SAAA;QAAA,OAAAC,iBAAA,CACLH,iBAAiB;UAAA;UAAQI,IAAI;UAAQa,kBAAkB,EAAED,UAAU;UAAA,IAAAd,SAAA;YAAA,OAAAC,iBAAA,CACjEJ,QAAQ;cACPK,IAAI;cACJS,IAAI;cACJF,GAAG;cACHO,WAAW,EAAEzB,IAAI,MAAMqB,eAAe,MAAMC,eAAe;YAAI;UAAA;QAAA;MAAA;IAAA,EAIvE,CAAC,CAACV,UAAU,CAAC;AACjB;AACA;AACA;AACA;AACA,GAAG,CAAC;EACF,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Children } from "@alloy-js/core";
|
|
2
|
+
import { CSharpFormatOptions } from "../../contexts/format-options.js";
|
|
3
|
+
/**
|
|
4
|
+
* Props for {@link SourceFile} component
|
|
5
|
+
*/
|
|
6
|
+
export interface SourceFileProps extends CSharpFormatOptions {
|
|
7
|
+
/** Path of the source file */
|
|
8
|
+
path: string;
|
|
9
|
+
/** Source file content */
|
|
10
|
+
children?: Children;
|
|
11
|
+
/**
|
|
12
|
+
* A list of using directives to explicitly include. Note that providing
|
|
13
|
+
* explicit usings is not necessary when referencing symbols via refkeys.
|
|
14
|
+
*/
|
|
15
|
+
using?: string[];
|
|
16
|
+
}
|
|
17
|
+
/** A C# source file exists within the context of a namespace contains using statements and declarations */
|
|
18
|
+
export declare function SourceFile(props: SourceFileProps): Children;
|
|
19
|
+
//# sourceMappingURL=source-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-file.d.ts","sourceRoot":"","sources":["../../../../src/components/source-file/source-file.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,QAAQ,EAKT,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,mBAAmB,EAEpB,MAAM,kCAAkC,CAAC;AAM1C;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,mBAAmB;IAC1D,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IAEb,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,2GAA2G;AAC3G,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,YA2DhD"}
|