@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
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { createComponent as _$createComponent, memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import { Block, List, MemberDeclaration,
|
|
2
|
+
import { Block, 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,51 +21,36 @@ const getModifiers = makeModifiers(["new"]);
|
|
|
23
21
|
* ```
|
|
24
22
|
*/
|
|
25
23
|
export function InterfaceProperty(props) {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
if (scope.kind !== "member" || scope.name !== "interface-decl") {
|
|
29
|
-
throw new Error("can't define an interface method outside of an interface scope");
|
|
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 propertySymbol = createPropertySymbol(props.name, {
|
|
25
|
+
refkeys: props.refkey
|
|
39
26
|
});
|
|
40
27
|
const modifiers = computeModifiersPrefix([getAccessModifier(props), getModifiers(props)]);
|
|
41
28
|
// note that scope wraps the method decl so that the params get the correct scope
|
|
42
29
|
return _$createComponent(MemberDeclaration, {
|
|
43
30
|
symbol: propertySymbol,
|
|
44
31
|
get children() {
|
|
45
|
-
return _$createComponent(
|
|
46
|
-
|
|
32
|
+
return [_$createComponent(DocWhen, {
|
|
33
|
+
get doc() {
|
|
34
|
+
return props.doc;
|
|
35
|
+
}
|
|
36
|
+
}), _$createComponent(AttributeList, {
|
|
37
|
+
get attributes() {
|
|
38
|
+
return props.attributes;
|
|
39
|
+
},
|
|
40
|
+
endline: true
|
|
41
|
+
}), modifiers, _$memo(() => props.type), _$memo(() => props.nullable && "?"), " ", _$createComponent(MemberName, {}), " ", _$createComponent(Block, {
|
|
42
|
+
newline: true,
|
|
43
|
+
inline: true,
|
|
47
44
|
get children() {
|
|
48
|
-
return
|
|
49
|
-
|
|
50
|
-
return props.doc;
|
|
51
|
-
}
|
|
52
|
-
}), _$createComponent(AttributeList, {
|
|
53
|
-
get attributes() {
|
|
54
|
-
return props.attributes;
|
|
55
|
-
},
|
|
56
|
-
endline: true
|
|
57
|
-
}), modifiers, _$memo(() => props.type), _$memo(() => props.nullable && "?"), " ", name, " ", _$createComponent(Block, {
|
|
58
|
-
newline: true,
|
|
59
|
-
inline: true,
|
|
45
|
+
return _$createComponent(List, {
|
|
46
|
+
joiner: " ",
|
|
60
47
|
get children() {
|
|
61
|
-
return _$
|
|
62
|
-
joiner: " ",
|
|
63
|
-
get children() {
|
|
64
|
-
return [_$memo(() => props.get && "get;"), _$memo(() => props.set && "set;")];
|
|
65
|
-
}
|
|
66
|
-
});
|
|
48
|
+
return [_$memo(() => props.get && "get;"), _$memo(() => props.set && "set;")];
|
|
67
49
|
}
|
|
68
|
-
})
|
|
50
|
+
});
|
|
69
51
|
}
|
|
70
|
-
});
|
|
52
|
+
})];
|
|
71
53
|
}
|
|
72
54
|
});
|
|
73
|
-
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=property.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Block","List","MemberDeclaration","MemberName","computeModifiersPrefix","getAccessModifier","makeModifiers","createPropertySymbol","AttributeList","DocWhen","getModifiers","InterfaceProperty","props","propertySymbol","name","refkeys","refkey","modifiers","_$createComponent","symbol","children","doc","attributes","endline","_$memo","type","nullable","newline","inline","joiner","get","set"],"sources":["../../../../src/components/interface/property.tsx"],"sourcesContent":[null],"mappings":";AAAA,SACEA,KAAK,EAELC,IAAI,EACJC,iBAAiB,EACjBC,UAAU,QAEL,gBAAgB;AACvB,SAEEC,sBAAsB,EACtBC,iBAAiB,EACjBC,aAAa,QACR,oBAAoB;AAC3B,SAASC,oBAAoB,QAAQ,4BAA4B;AACjE,SAASC,aAAa;AACtB,SAASC,OAAO;;AAEhB;;AA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face
|
|
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 interface TestInterface
|
|
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 interface TestInterface
|
|
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 interface TestInterface
|
|
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 interface TestInterface
|
|
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 interface TestInterface
|
|
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 interface TestInterface
|
|
138
138
|
{
|
|
139
|
-
|
|
139
|
+
string TestProp { get; set; }
|
|
140
140
|
}
|
|
141
141
|
`);
|
|
142
142
|
});
|
|
@@ -159,8 +159,8 @@ it("specify doc comment", () => {
|
|
|
159
159
|
})).toRenderTo(`
|
|
160
160
|
interface Test
|
|
161
161
|
{
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
/// This is a test
|
|
163
|
+
string Method { get; set; }
|
|
164
164
|
}
|
|
165
165
|
`);
|
|
166
166
|
});
|
|
@@ -182,8 +182,9 @@ it("specify attributes", () => {
|
|
|
182
182
|
})).toRenderTo(`
|
|
183
183
|
public interface TestInterface
|
|
184
184
|
{
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
[Test]
|
|
186
|
+
int Test { get; set; }
|
|
187
187
|
}
|
|
188
188
|
`);
|
|
189
|
-
});
|
|
189
|
+
});
|
|
190
|
+
//# sourceMappingURL=property.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["describe","expect","it","TestNamespace","Attribute","InterfaceDeclaration","InterfaceProperty","Wrapper","props","_$createComponent","children","name","each","accessModifier","_$mergeProps","type","get","toRenderTo","methodModifier","set","doc","attributes"],"sources":["../../../../src/components/interface/property.test.tsx"],"sourcesContent":[null],"mappings":";AACA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,aAAa;AACtB,SAASC,SAAS;AAClB,SAASC,oBAAoB;AAC7B,SAASC,iBAAiB;AAE1B,MAAMC,OAAO,GAAIC,KAA6B,IAAAC,iBAAA,CAC3CN,aAAa;EAAA,IAAAO,SAAA;IAAA,OAAAD,iBAAA,CACXJ,oBAAoB;MAAA;MAAQM,IAAI;MAAA,IAAAD,SAAA;QAAA,OAC9BF,KAAK,CAACE,QAAQ;MAAA;IAAA;EAAA;AAAA,EAGpB;AAEDV,QAAQ,CAAC,WAAW,EAAE,MAAM;EAC1BA,QAAQ,CAAC,kBAAkB,EAAE,MAAM;IACjCE,EAAE,CAACU,IAAI,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,CAAU,CAAC,CA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AAI;YACJC,GAAG;YACHG,GAAG;YACHC,GAAG;UAAA;QAAA;MAAA;IAAA;EAAA,EAIX,CAAC,CAACH,UAAU,CAAC;AACf;AACA;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,iBAAiB;QAChBK,IAAI;QACJI,IAAI;QAAA,IACJM,UAAUA,CAAA;UAAA,OAAE,CAAAZ,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":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Children } from "@alloy-js/core";
|
|
2
|
+
export interface InvocationExpressionProps {
|
|
3
|
+
target: Children;
|
|
4
|
+
/**
|
|
5
|
+
* Arguments to pass to the invocation.
|
|
6
|
+
*/
|
|
7
|
+
args?: Children[];
|
|
8
|
+
/**
|
|
9
|
+
* Generic type arguments for the invocation.
|
|
10
|
+
*/
|
|
11
|
+
typeArgs?: Children[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A call to a function or method.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
*
|
|
18
|
+
* ```jsx
|
|
19
|
+
* <InvocationExpression target="Foo" typeArgs={["T"]} args={["x"]} />
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* Renders to:
|
|
23
|
+
*
|
|
24
|
+
* ```csharp
|
|
25
|
+
* Foo<T>("x");
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function InvocationExpression(props: InvocationExpressionProps): Children;
|
|
29
|
+
//# sourceMappingURL=invocation-expression.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invocation-expression.d.ts","sourceRoot":"","sources":["../../../../src/components/invocation-expression/invocation-expression.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA2B,MAAM,gBAAgB,CAAC;AAEnE,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,QAAQ,CAAC;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;CACvB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,YA8BpE"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { memo as _$memo, createComponent as _$createComponent, createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { For, Indent, Show, Wrap } from "@alloy-js/core";
|
|
3
|
+
/**
|
|
4
|
+
* A call to a function or method.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
*
|
|
8
|
+
* ```jsx
|
|
9
|
+
* <InvocationExpression target="Foo" typeArgs={["T"]} args={["x"]} />
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* Renders to:
|
|
13
|
+
*
|
|
14
|
+
* ```csharp
|
|
15
|
+
* Foo<T>("x");
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export function InvocationExpression(props) {
|
|
19
|
+
return _$createIntrinsic("group", {
|
|
20
|
+
get children() {
|
|
21
|
+
return [_$memo(() => props.target), _$createComponent(Show, {
|
|
22
|
+
get when() {
|
|
23
|
+
return !!props.typeArgs && props.typeArgs.length > 0;
|
|
24
|
+
},
|
|
25
|
+
get children() {
|
|
26
|
+
return ["<", _$createComponent(Wrap, {
|
|
27
|
+
get when() {
|
|
28
|
+
return props.typeArgs.length > 1;
|
|
29
|
+
},
|
|
30
|
+
"with": Indent,
|
|
31
|
+
props: {
|
|
32
|
+
softline: true,
|
|
33
|
+
trailingBreak: true
|
|
34
|
+
},
|
|
35
|
+
get children() {
|
|
36
|
+
return _$createComponent(For, {
|
|
37
|
+
get each() {
|
|
38
|
+
return props.typeArgs ?? [];
|
|
39
|
+
},
|
|
40
|
+
comma: true,
|
|
41
|
+
line: true,
|
|
42
|
+
children: typeArg => typeArg
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}), ">"];
|
|
46
|
+
}
|
|
47
|
+
}), "(", _$createComponent(Wrap, {
|
|
48
|
+
get when() {
|
|
49
|
+
return !!props.args && props.args.length > 1;
|
|
50
|
+
},
|
|
51
|
+
"with": Indent,
|
|
52
|
+
props: {
|
|
53
|
+
softline: true,
|
|
54
|
+
trailingBreak: true
|
|
55
|
+
},
|
|
56
|
+
get children() {
|
|
57
|
+
return _$createComponent(For, {
|
|
58
|
+
get each() {
|
|
59
|
+
return props.args ?? [];
|
|
60
|
+
},
|
|
61
|
+
comma: true,
|
|
62
|
+
line: true,
|
|
63
|
+
children: arg => arg
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}), ")"];
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=invocation-expression.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["For","Indent","Show","Wrap","InvocationExpression","props","_$createIntrinsic","children","_$memo","target","_$createComponent","when","typeArgs","length","softline","trailingBreak","each","comma","line","typeArg","args","arg"],"sources":["../../../../src/components/invocation-expression/invocation-expression.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAAmBA,GAAG,EAAEC,MAAM,EAAEC,IAAI,EAAEC,IAAI,QAAQ,gBAAgB;AAclE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAACC,KAAgC,EAAE;EACrE,OAAAC,iB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{"version":3,"file":"invocation-expression.test.d.ts","sourceRoot":"","sources":["../../../../src/components/invocation-expression/invocation-expression.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { createComponent as _$createComponent, createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { ClassDeclaration } from "#components/class/declaration.js";
|
|
3
|
+
import { Method } from "#components/method/method.js";
|
|
4
|
+
import { TestNamespace } from "#test/utils.js";
|
|
5
|
+
import { namekey } from "@alloy-js/core";
|
|
6
|
+
import { describe, expect, it } from "vitest";
|
|
7
|
+
import { InvocationExpression } from "./invocation-expression.js";
|
|
8
|
+
it("makes a call with no arguments", () => {
|
|
9
|
+
const template = _$createComponent(InvocationExpression, {
|
|
10
|
+
target: "Foo"
|
|
11
|
+
});
|
|
12
|
+
expect(template).toRenderTo(`Foo()`);
|
|
13
|
+
});
|
|
14
|
+
it("makes a call with arguments", () => {
|
|
15
|
+
const template = _$createComponent(InvocationExpression, {
|
|
16
|
+
target: "Foo",
|
|
17
|
+
args: ["42", `"string"`]
|
|
18
|
+
});
|
|
19
|
+
expect(template).toRenderTo(`Foo(42, "string")`);
|
|
20
|
+
});
|
|
21
|
+
it("makes a call with type parameters", () => {
|
|
22
|
+
const template = _$createComponent(InvocationExpression, {
|
|
23
|
+
target: "Foo",
|
|
24
|
+
typeArgs: ["Bar", "Baz"]
|
|
25
|
+
});
|
|
26
|
+
expect(template).toRenderTo(`Foo<Bar, Baz>()`);
|
|
27
|
+
});
|
|
28
|
+
it("makes a call to a method", () => {
|
|
29
|
+
const cls = namekey("TestClass");
|
|
30
|
+
const method = namekey("Method");
|
|
31
|
+
const template = _$createComponent(TestNamespace, {
|
|
32
|
+
get children() {
|
|
33
|
+
return [_$createComponent(ClassDeclaration, {
|
|
34
|
+
name: cls,
|
|
35
|
+
get children() {
|
|
36
|
+
return _$createComponent(Method, {
|
|
37
|
+
name: method,
|
|
38
|
+
children: "return 1;"
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}), _$createIntrinsic("hbr", {}), _$createComponent(InvocationExpression, {
|
|
42
|
+
target: method
|
|
43
|
+
}), ";"];
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
expect(template).toRenderTo(`
|
|
47
|
+
class TestClass
|
|
48
|
+
{
|
|
49
|
+
void Method()
|
|
50
|
+
{
|
|
51
|
+
return 1;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
TestClass.Method();
|
|
55
|
+
`);
|
|
56
|
+
});
|
|
57
|
+
describe("formatting", () => {
|
|
58
|
+
it("doesn't break one long argument", () => {
|
|
59
|
+
const template = _$createComponent(InvocationExpression, {
|
|
60
|
+
target: "Foo",
|
|
61
|
+
args: ["oneLongArgument"]
|
|
62
|
+
});
|
|
63
|
+
expect(template).toRenderTo(`Foo(oneLongArgument)`, {
|
|
64
|
+
printWidth: 10
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
it("breaks multiple arguments", () => {
|
|
68
|
+
const template = _$createComponent(InvocationExpression, {
|
|
69
|
+
target: "Foo",
|
|
70
|
+
args: ["oneLongArgument", "anotherLongArgument"]
|
|
71
|
+
});
|
|
72
|
+
expect(template).toRenderTo(`
|
|
73
|
+
Foo(
|
|
74
|
+
oneLongArgument,
|
|
75
|
+
anotherLongArgument
|
|
76
|
+
)
|
|
77
|
+
`, {
|
|
78
|
+
printWidth: 10
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
it("doesn't break one long type argument", () => {
|
|
82
|
+
const template = _$createComponent(InvocationExpression, {
|
|
83
|
+
target: "Foo",
|
|
84
|
+
typeArgs: ["oneLongArgument"]
|
|
85
|
+
});
|
|
86
|
+
expect(template).toRenderTo(`Foo<oneLongArgument>()`, {
|
|
87
|
+
printWidth: 10
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
it("breaks multiple type arguments", () => {
|
|
91
|
+
const template = _$createComponent(InvocationExpression, {
|
|
92
|
+
target: "Foo",
|
|
93
|
+
typeArgs: ["oneLongArgument", "anotherLongArgument"]
|
|
94
|
+
});
|
|
95
|
+
expect(template).toRenderTo(`
|
|
96
|
+
Foo<
|
|
97
|
+
oneLongArgument,
|
|
98
|
+
anotherLongArgument
|
|
99
|
+
>()
|
|
100
|
+
`, {
|
|
101
|
+
printWidth: 10
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
//# sourceMappingURL=invocation-expression.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ClassDeclaration","Method","TestNamespace","namekey","describe","expect","it","InvocationExpression","template","_$createComponent","target","toRenderTo","args","typeArgs","cls","method","children","name","_$createIntrinsic","printWidth"],"sources":["../../../../src/components/invocation-expression/invocation-expression.test.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,gBAAgB;AACzB,SAASC,MAAM;AACf,SAASC,aAAa;AACtB,SAASC,OAAO,QAAQ,gBAAgB;AACxC,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,oBAAoB;AAE7BD,EAAE,CAAC,gCAAgC,EAAE,MAAM;EACzC,MAAME,QAAQ,GAAAC,iBAAA,CAAIF,oBAAoB;IAACG,MAAM;EAAA,EAAS;EACtDL,MAAM,CAACG,QAAQ,CAAC,CAACG,UAAU,CAAC,OAAO,CAAC;AACtC,CAAC,CAAC;AAEFL,EAAE,CAAC,6BAA6B,EAAE,MAAM;EACtC,MAAME,QAAQ,GAAAC,iBAAA,CACXF,oBAAoB;IAACG,MAAM;IAAOE,IAAI,EAAE,CAAC,IAAI,EAAE,UAAU;EAAC,EAC5D;EACDP,MAAM,CAACG,QAAQ,CAAC,CAACG,UAAU,CAAC,mBAAmB,CAAC;AAClD,CAAC,CAAC;AAEFL,EAAE,CAAC,mCAAmC,EAAE,MAAM;EAC5C,MAAME,QAAQ,GAAAC,iBAAA,CACXF,oBAAoB;IAACG,MAAM;IAAO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,CAACG,UAAU,CACzB;AACN;AACA;AACA;AACA;AACA,OAAO,EACD;MAAEQ,UAAU,EAAE;IAAG,CACnB,CAAC;EACH,CAAC,CAAC;EAEFb,EAAE,CAAC,sCAAsC,EAAE,MAAM;IAC/C,MAAME,QAAQ,GAAAC,iBAAA,CACXF,oBAAoB;MAACG,MAAM;MAAOG,QAAQ,EAAE,CAAC,iBAAiB;IAAC,EACjE;IACDR,MAAM,CAACG,QAAQ,CAAC,CAACG,UAAU,CAAC,wBAAwB,EAAE;MAAEQ,UAAU,EAAE;IAAG,CAAC,CAAC;EAC3E,CAAC,CAAC;EAEFb,EAAE,CAAC,gCAAgC,EAAE,MAAM;IACzC,MAAME,QAAQ,GAAAC,iBAAA,CACXF,oBAAoB;MACnBG,MAAM;MACNG,QAAQ,EAAE,CAAC,iBAAiB,EAAE,qBAAqB;IAAC,EAEvD;IACDR,MAAM,CAACG,QAAQ,CAAC,CAACG,UAAU,CACzB;AACN;AACA;AACA;AACA;AACA,OAAO,EACD;MAAEQ,UAAU,EAAE;IAAG,CACnB,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ScopePropsWithInfo, ScopePropsWithValue } from "@alloy-js/core";
|
|
2
|
+
export interface LexicalScopePropsWithScopeValue extends ScopePropsWithValue {
|
|
3
|
+
}
|
|
4
|
+
export interface LeixcalScopePropsWithScopeInfo extends ScopePropsWithInfo {
|
|
5
|
+
}
|
|
6
|
+
export type LexicalScopeProps = LexicalScopePropsWithScopeValue | LeixcalScopePropsWithScopeInfo;
|
|
7
|
+
export declare function LexicalScope(props: LexicalScopeProps): import("@alloy-js/core").Children;
|
|
8
|
+
//# sourceMappingURL=lexical-scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lexical-scope.d.ts","sourceRoot":"","sources":["../../../src/components/lexical-scope.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAIhF,MAAM,WAAW,+BAAgC,SAAQ,mBAAmB;CAAG;AAC/E,MAAM,WAAW,8BAA+B,SAAQ,kBAAkB;CAAG;AAE7E,MAAM,MAAM,iBAAiB,GACzB,+BAA+B,GAC/B,8BAA8B,CAAC;AAEnC,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,qCAiBpD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { Scope } from "@alloy-js/core";
|
|
3
|
+
import { useCSharpScope } from "../scopes/contexts.js";
|
|
4
|
+
import { CSharpLexicalScope } from "../scopes/lexical.js";
|
|
5
|
+
export function LexicalScope(props) {
|
|
6
|
+
let scope;
|
|
7
|
+
if ("value" in props) {
|
|
8
|
+
if (!(props.value instanceof CSharpLexicalScope)) {
|
|
9
|
+
throw new Error("LexicalScope value must be a CSharpLexicalScope instance");
|
|
10
|
+
}
|
|
11
|
+
scope = props.value;
|
|
12
|
+
} else {
|
|
13
|
+
const parentScope = useCSharpScope();
|
|
14
|
+
scope = new CSharpLexicalScope(props.name ?? "lexical scope", parentScope, {
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return _$createComponent(Scope, {
|
|
19
|
+
value: scope,
|
|
20
|
+
get children() {
|
|
21
|
+
return props.children;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=lexical-scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Scope","useCSharpScope","CSharpLexicalScope","LexicalScope","props","scope","value","Error","parentScope","name","_$createComponent","children"],"sources":["../../../src/components/lexical-scope.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,KAAK,QAAiD,gBAAgB;AAC/E,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SAASC,kBAAkB,QAAQ,sBAAsB;AASzD,OAAO,SAASC,YAAYA,CAACC,KAAwB,EAAE;EACrD,IAAIC,KAAK;EACT,IAAI,OAAO,IAAID,KAAK,EAAE;IACpB,IAAI,EAAEA,KAAK,CAACE,KAAK,YAAYJ,kBAAkB,CAAC,EAAE;MAChD,MAAM,IAAIK,KAAK,CACb,0DACF,CAAC;IACH;IACAF,KAAK,GAAGD,KAAK,CAACE,KAAK;EACrB,CAAC,MAAM;IACL,MAAME,WAAW,GAAGP,cAAc,CAAC,CAAC;IACpCI,KAAK,GAAG,IAAIH,kBAAkB,CAACE,KAAK,CAACK,IAAI,IAAI,eAAe,EAAED,WAAW,EAAE;MACzE,GAAGJ;IACL,CAAC,CAAC;EACJ;EAEA,OAAAM,iBAAA,CAAQV,KAAK;IAACM,KAAK,EAAED,KAAK;IAAA,IAAAM,SAAA;MAAA,OAAGP,KAAK,CAACO,QAAQ;IAAA;EAAA;AAC7C","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
|
import { ParameterProps } from "../parameters/parameters.jsx";
|
|
@@ -14,9 +14,12 @@ export interface MethodModifiers {
|
|
|
14
14
|
readonly readonly?: boolean;
|
|
15
15
|
}
|
|
16
16
|
export interface MethodProps extends AccessModifiers, MethodModifiers {
|
|
17
|
-
name: string;
|
|
17
|
+
name: string | Namekey;
|
|
18
18
|
refkey?: Refkey;
|
|
19
19
|
children?: Children;
|
|
20
|
+
/**
|
|
21
|
+
* An array of parameter descriptors.
|
|
22
|
+
*/
|
|
20
23
|
parameters?: Array<ParameterProps>;
|
|
21
24
|
returns?: Children;
|
|
22
25
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"method.d.ts","sourceRoot":"","sources":["../../../../src/components/method/method.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAGR,MAAM,EAEP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,EAKhB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"method.d.ts","sourceRoot":"","sources":["../../../../src/components/method/method.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAGR,OAAO,EACP,MAAM,EAEP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,EAKhB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAiB,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE7E,OAAO,EAAE,cAAc,EAAc,MAAM,8BAA8B,CAAC;AAE1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAG3E,yCAAyC;AACzC,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAaD,MAAM,WAAW,WAAY,SAAQ,eAAe,EAAE,eAAe;IACnE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB;;OAEG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,QAAQ,CAAC;IAEnB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,kBAAkB;IAClB,GAAG,CAAC,EAAE,QAAQ,CAAC;IAEf;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,CAAC,kBAAkB,GAAG,MAAM,CAAC,EAAE,CAAC;IAEjD;;;;;;;;;;;;;;;OAeG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC;IAE5B;;;;;;;;;;;;OAYG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAGD,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,YAsCxC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { createComponent as _$createComponent, memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import { Block, MemberDeclaration,
|
|
2
|
+
import { Block, MemberDeclaration, MemberName, Scope } from "@alloy-js/core";
|
|
3
3
|
import { computeModifiersPrefix, getAccessModifier, getAsyncModifier, makeModifiers } from "../../modifiers.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { CSharpMemberScope, useCSharpScope } from "../../symbols/scopes.js";
|
|
4
|
+
import { createMethodScope } from "../../scopes/factories.js";
|
|
5
|
+
import { createMethodSymbol } from "../../symbols/factories.js";
|
|
7
6
|
import { AttributeList } from "../attributes/attributes.js";
|
|
8
7
|
import { DocWhen } from "../doc/comment.js";
|
|
9
8
|
import { Parameters } from "../parameters/parameters.js";
|
|
@@ -18,20 +17,12 @@ const getMethodModifier = makeModifiers(["abstract", "sealed", "static", "virtua
|
|
|
18
17
|
|
|
19
18
|
// a C# class method
|
|
20
19
|
export function Method(props) {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
if (scope.kind !== "member" || scope.name !== "class-decl" && scope.name !== "struct-decl") {
|
|
24
|
-
throw new Error("can't define a class method outside of a class or struct scope");
|
|
25
|
-
}
|
|
26
|
-
const methodSymbol = new CSharpOutputSymbol(name, {
|
|
27
|
-
scope,
|
|
28
|
-
refkeys: props.refkey ?? refkey(props.name)
|
|
20
|
+
const methodSymbol = createMethodSymbol(props.name, {
|
|
21
|
+
refkeys: props.refkey
|
|
29
22
|
});
|
|
30
23
|
|
|
31
24
|
// scope for method declaration
|
|
32
|
-
const methodScope =
|
|
33
|
-
owner: methodSymbol
|
|
34
|
-
});
|
|
25
|
+
const methodScope = createMethodScope();
|
|
35
26
|
const returns = props.returns ?? (props.async ? "Task" : "void");
|
|
36
27
|
const modifiers = computeModifiersPrefix([getAccessModifier(props), getMethodModifier(props), getAsyncModifier(props.async)]);
|
|
37
28
|
// note that scope wraps the method decl so that the params get the correct scope
|
|
@@ -50,7 +41,7 @@ export function Method(props) {
|
|
|
50
41
|
return props.attributes;
|
|
51
42
|
},
|
|
52
43
|
endline: true
|
|
53
|
-
}), modifiers, returns, " ",
|
|
44
|
+
}), modifiers, returns, " ", _$createComponent(MemberName, {}), _$memo(() => _$memo(() => !!props.typeParameters)() && _$createComponent(TypeParameters, {
|
|
54
45
|
get parameters() {
|
|
55
46
|
return props.typeParameters;
|
|
56
47
|
}
|
|
@@ -79,4 +70,5 @@ export function Method(props) {
|
|
|
79
70
|
}
|
|
80
71
|
const ExpressionBody = props => {
|
|
81
72
|
return [" => ", _$memo(() => props.children), ";"];
|
|
82
|
-
};
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=method.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Block","MemberDeclaration","MemberName","Scope","computeModifiersPrefix","getAccessModifier","getAsyncModifier","makeModifiers","createMethodScope","createMethodSymbol","AttributeList","DocWhen","Parameters","TypeParameterConstraints","TypeParameters","getMethodModifier","Method","props","methodSymbol","name","refkeys","refkey","methodScope","returns","async","modifiers","_$createComponent","symbol","children","value","doc","attributes","endline","_$memo","typeParameters","parameters","abstract","expression","ExpressionBody","newline"],"sources":["../../../../src/components/method/method.tsx"],"sourcesContent":[null],"mappings":";AAAA,SACEA,KAAK,EAELC,iBAAiB,EACjBC,UAAU,EAGVC,KAAK,QACA,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AA,OAAEd,KAAK,CAACc,UAAU;YAAA;YAAEC,OAAO;UAAA,IACnDP,SAAS,EACTF,OAAO,OAAAG,iBAAA,CAAGxB,UAAU,OAAA+B,MAAA,OACpBA,MAAA,SAAAhB,KAAK,CAACiB,cAAc,OAAAR,iBAAA,CAClBZ,cAAc;YAAA,IAACqB,UAAUA,CAAA;cAAA,OAAElB,KAAK,CAACiB,cAAc;YAAA;UAAA,EACjD,GAAAR,iBAAA,CACAd,UAAU;YAAA,IAACuB,UAAUA,CAAA;cAAA,OAAElB,KAAK,CAACkB,UAAU;YAAA;UAAA,IAAAF,MAAA,OACvCA,MAAA,SAAAhB,KAAK,CAACiB,cAAc,OAAAR,iBAAA,CAClBb,wBAAwB;YAAA,IAACsB,UAAUA,CAAA;cAAA,OAAElB,KAAK,CAACiB,cAAc;YAAA;UAAA,EAC3D,GAAAD,MAAA,OACAA,MAAA,SAAAhB,KAAK,CAACmB,QAAQ,MACb,GAAG,GACHH,MAAA,SAAAhB,KAAK,CAACoB,UAAU,MAAAX,iBAAA,CACfY,cAAc;YAAA,IAAAV,SAAA;cAAA,OAAEX,KAAK,CAACW,QAAQ;YAAA;UAAA,KAAAF,iBAAA,CAC9B1B,KAAK;YAACuC,OAAO;YAAA,IAAAX,SAAA;cAAA,OAAEX,KAAK,CAACW,QAAQ;YAAA;UAAA,EAAS;QAAA;MAAA;IAAA;EAAA;AAIjD;AAEA,MAAMU,cAAc,GAAIrB,KAA8B,IAAK;EACzD,QAEK,MAAM,EAAAgB,MAAA,OACNhB,KAAK,CAACW,QAAQ;AAGrB,CAAC","ignoreList":[]}
|
|
@@ -27,7 +27,7 @@ describe("modifiers", () => {
|
|
|
27
27
|
})).toRenderTo(`
|
|
28
28
|
public class TestClass
|
|
29
29
|
{
|
|
30
|
-
|
|
30
|
+
${accessModifier} void MethodOne() {}
|
|
31
31
|
}
|
|
32
32
|
`);
|
|
33
33
|
});
|
|
@@ -45,7 +45,7 @@ describe("modifiers", () => {
|
|
|
45
45
|
})).toRenderTo(`
|
|
46
46
|
public class TestClass
|
|
47
47
|
{
|
|
48
|
-
|
|
48
|
+
${methodModifier} void MethodOne() {}
|
|
49
49
|
}
|
|
50
50
|
`);
|
|
51
51
|
});
|
|
@@ -60,7 +60,7 @@ describe("modifiers", () => {
|
|
|
60
60
|
})).toRenderTo(`
|
|
61
61
|
public class TestClass
|
|
62
62
|
{
|
|
63
|
-
|
|
63
|
+
abstract void MethodOne();
|
|
64
64
|
}
|
|
65
65
|
`);
|
|
66
66
|
});
|
|
@@ -76,7 +76,7 @@ describe("modifiers", () => {
|
|
|
76
76
|
})).toRenderTo(`
|
|
77
77
|
public class TestClass
|
|
78
78
|
{
|
|
79
|
-
|
|
79
|
+
async Task MethodOne() {}
|
|
80
80
|
}
|
|
81
81
|
`);
|
|
82
82
|
});
|
|
@@ -94,7 +94,7 @@ describe("modifiers", () => {
|
|
|
94
94
|
})).toRenderTo(`
|
|
95
95
|
public class TestClass
|
|
96
96
|
{
|
|
97
|
-
|
|
97
|
+
public abstract async Task MethodOne();
|
|
98
98
|
}
|
|
99
99
|
`);
|
|
100
100
|
});
|
|
@@ -109,7 +109,7 @@ it("applies PascalCase naming policy", () => {
|
|
|
109
109
|
})).toRenderTo(`
|
|
110
110
|
public class TestClass
|
|
111
111
|
{
|
|
112
|
-
|
|
112
|
+
void MethodOne() {}
|
|
113
113
|
}
|
|
114
114
|
`);
|
|
115
115
|
});
|
|
@@ -134,7 +134,7 @@ it("defines params and return type", () => {
|
|
|
134
134
|
expect(res).toRenderTo(`
|
|
135
135
|
public class TestClass
|
|
136
136
|
{
|
|
137
|
-
|
|
137
|
+
public string MethodOne(int intParam, string stringParam) {}
|
|
138
138
|
}
|
|
139
139
|
`);
|
|
140
140
|
});
|
|
@@ -154,8 +154,8 @@ it("specify doc comment", () => {
|
|
|
154
154
|
})).toRenderTo(`
|
|
155
155
|
class Test
|
|
156
156
|
{
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
/// This is a test
|
|
158
|
+
void Method() {}
|
|
159
159
|
}
|
|
160
160
|
`);
|
|
161
161
|
});
|
|
@@ -177,8 +177,9 @@ it("use expression body form", () => {
|
|
|
177
177
|
})).toRenderTo(`
|
|
178
178
|
class Test
|
|
179
179
|
{
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
/// This is a test
|
|
181
|
+
void Method() => this.MyProperty.Value;
|
|
182
182
|
}
|
|
183
183
|
`);
|
|
184
|
-
});
|
|
184
|
+
});
|
|
185
|
+
//# sourceMappingURL=method.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["describe","expect","it","TestNamespace","ClassDeclaration","Method","Wrapper","props","_$createComponent","children","name","each","accessModifier","_$mergeProps","toRenderTo","methodModifier","abstract","async","returns","params","type","res","parameters","doc","expression"],"sources":["../../../../src/components/method/method.test.tsx"],"sourcesContent":[null],"mappings":";AACA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,aAAa;AACtB,SAASC,gBAAgB,EAAEC,MAAM,QAAQ,gBAAgB;AAEzD,MAAMC,OAAO,GAAIC,KAA6B,IAAAC,iBAAA,CAC3CL,aAAa;EAAA,IAAAM,SAAA;IAAA,OAAAD,iBAAA,CACXJ,gBAAgB;MAAA;MAAQM,IAAI;MAAA,IAAAD,SAAA;QAAA,OAC1BF,KAAK,CAACE,QAAQ;MAAA;IAAA;EAAA;AAAA,EAGpB;AAEDT,QAAQ,CAAC,WAAW,EAAE,MAAM;EAC1BA,QAAQ,CAAC,kBAAkB,EAAE,MAAM;IACjCE,EAAE,CAACS,IAAI,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,CAAU,CAAC,CAC9D,IAAI,EACHC,cAAc,IAAK;MAClBX,MAAM,CAAAO,iBAAA,CACHF,OAAO;QAAA,IAAAG,SAAA;UAAA,OAAAD,iBAAA,CACLH,MAAM,EAAAQ,YAAA,CAAK;YAAE,CAACD,cAAc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