@alloy-js/csharp 0.20.0-dev.3 → 0.20.0-dev.4
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 +3 -13
- package/dist/src/components/Reference.d.ts.map +1 -1
- package/dist/src/components/Reference.js +5 -1
- package/dist/src/components/SourceFile.d.ts +8 -9
- package/dist/src/components/SourceFile.d.ts.map +1 -1
- package/dist/src/components/SourceFile.js +69 -45
- 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 +3 -1
- 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 +18 -32
- package/dist/src/components/class/declaration.test.js +171 -193
- package/dist/src/components/constructor/constructor.d.ts.map +1 -1
- package/dist/src/components/constructor/constructor.js +11 -16
- package/dist/src/components/constructor/constructor.test.js +10 -19
- 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 +54 -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 +120 -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 +39 -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 +29 -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 +28 -0
- package/dist/src/components/field/field.d.ts.map +1 -1
- package/dist/src/components/field/field.js +9 -14
- package/dist/src/components/field/field.test.js +7 -7
- package/dist/src/components/index.d.ts +5 -2
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +5 -2
- package/dist/src/components/interface/declaration.d.ts.map +1 -1
- package/dist/src/components/interface/declaration.js +19 -21
- package/dist/src/components/interface/declaration.test.js +26 -35
- package/dist/src/components/interface/method.d.ts.map +1 -1
- package/dist/src/components/interface/method.js +7 -15
- package/dist/src/components/interface/method.test.js +38 -47
- package/dist/src/components/interface/property.d.ts.map +1 -1
- package/dist/src/components/interface/property.js +21 -36
- package/dist/src/components/interface/property.test.js +11 -11
- 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 +24 -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 +7 -13
- package/dist/src/components/method/method.test.js +11 -11
- 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 +24 -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 +44 -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 +46 -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 +181 -0
- package/dist/src/components/namespace.test.d.ts.map +1 -0
- package/dist/src/components/namespace.test.js +78 -0
- package/dist/src/components/parameters/parameters.d.ts +2 -2
- package/dist/src/components/parameters/parameters.d.ts.map +1 -1
- package/dist/src/components/parameters/parameters.js +12 -11
- 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 +87 -0
- package/dist/src/components/property/property.d.ts.map +1 -1
- package/dist/src/components/property/property.js +21 -36
- package/dist/src/components/property/property.test.js +14 -14
- package/dist/src/components/record/declaration.d.ts.map +1 -1
- package/dist/src/components/record/declaration.js +8 -12
- package/dist/src/components/record/declaration.test.js +6 -13
- package/dist/src/components/struct/declaration.d.ts.map +1 -1
- package/dist/src/components/struct/declaration.js +4 -6
- package/dist/src/components/struct/declaration.test.js +30 -39
- package/dist/src/components/type-parameters/type-parameter.d.ts.map +1 -1
- package/dist/src/components/type-parameters/type-parameter.js +7 -10
- package/dist/src/components/type-parameters/type-parameters.test.js +3 -3
- package/dist/src/components/var/declaration.d.ts.map +1 -1
- package/dist/src/components/var/declaration.js +6 -8
- package/dist/src/components/var/declaration.test.js +11 -20
- 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 +24 -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 +5 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/modifiers.d.ts +11 -0
- package/dist/src/modifiers.d.ts.map +1 -1
- 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 +10 -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 +33 -0
- package/dist/src/scopes/csharp.d.ts +8 -0
- package/dist/src/scopes/csharp.d.ts.map +1 -0
- package/dist/src/scopes/csharp.js +11 -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 +23 -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 +9 -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 +7 -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 +13 -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 +32 -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 +38 -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 +43 -0
- package/dist/src/symbols/csharp.d.ts +76 -0
- package/dist/src/symbols/csharp.d.ts.map +1 -0
- package/dist/src/symbols/csharp.js +222 -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 +86 -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 -3
- 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 +15 -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 +30 -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 +44 -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 +36 -43
- package/dist/test/project-directory.test.js +12 -16
- package/dist/test/sourcefile.test.js +7 -19
- package/dist/test/using.test.js +18 -16
- package/dist/test/utils.js +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -2
- package/src/components/Declaration.tsx +3 -6
- package/src/components/Reference.tsx +3 -1
- package/src/components/SourceFile.tsx +68 -55
- package/src/components/UsingDirective.tsx +12 -2
- package/src/components/class/declaration.test.tsx +120 -143
- package/src/components/class/declaration.tsx +19 -32
- package/src/components/constructor/constructor.test.tsx +10 -16
- package/src/components/constructor/constructor.tsx +13 -27
- 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 -14
- package/src/components/index.ts +5 -2
- 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 -19
- package/src/components/interface/property.test.tsx +11 -11
- package/src/components/interface/property.tsx +15 -33
- package/src/components/lexical-scope.tsx +29 -0
- package/src/components/method/method.test.tsx +11 -11
- package/src/components/method/method.tsx +12 -18
- 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 +71 -0
- package/src/components/parameters/parameters.tsx +9 -16
- package/src/components/property/property.test.tsx +14 -14
- package/src/components/property/property.tsx +17 -38
- package/src/components/record/declaration.test.tsx +5 -12
- package/src/components/record/declaration.tsx +10 -11
- 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/global-namespace.ts +29 -0
- package/src/contexts/namespace.ts +13 -0
- package/src/index.ts +1 -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 +18 -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 +307 -0
- package/src/symbols/factories.ts +199 -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.ts +47 -50
- package/temp/api.json +6251 -2454
- package/test/project-directory.test.tsx +12 -16
- package/test/sourcefile.test.tsx +7 -21
- package/test/using.test.tsx +18 -16
- package/test/utils.tsx +1 -1
- package/dist/src/components/EnumDeclaration.d.ts.map +0 -1
- package/dist/src/components/EnumDeclaration.js +0 -82
- 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/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 -20
- package/dist/src/symbols/scopes.d.ts.map +0 -1
- package/dist/src/symbols/scopes.js +0 -42
- 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/src/components/EnumDeclaration.tsx +0 -98
- package/src/components/Namespace.tsx +0 -35
- package/src/symbols/csharp-output-symbol.ts +0 -22
- package/src/symbols/scopes.ts +0 -61
- package/test/enum.test.tsx +0 -149
- package/test/namespace.test.tsx +0 -55
- /package/dist/{test → src/components}/namespace.test.d.ts +0 -0
|
@@ -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, makeModifiers } from "../../modifiers.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { CSharpMemberScope, useCSharpMemberScope } 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,17 +17,10 @@ const getMethodModifier = makeModifiers(["new"]);
|
|
|
18
17
|
|
|
19
18
|
// a C# interface method
|
|
20
19
|
export function InterfaceMethod(props) {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
const methodSymbol = new CSharpOutputSymbol(name, {
|
|
24
|
-
scope,
|
|
25
|
-
refkeys: props.refkey ?? refkey(props.name)
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
// scope for method declaration
|
|
29
|
-
const methodScope = new CSharpMemberScope("method-decl", {
|
|
30
|
-
owner: methodSymbol
|
|
20
|
+
const methodSymbol = createMethodSymbol(props.name, {
|
|
21
|
+
refkeys: props.refkey
|
|
31
22
|
});
|
|
23
|
+
const methodScope = createMethodScope();
|
|
32
24
|
const modifiers = computeModifiersPrefix([getAccessModifier(props), getMethodModifier(props)]);
|
|
33
25
|
// note that scope wraps the method decl so that the params get the correct scope
|
|
34
26
|
return _$createComponent(MemberDeclaration, {
|
|
@@ -46,7 +38,7 @@ export function InterfaceMethod(props) {
|
|
|
46
38
|
return props.attributes;
|
|
47
39
|
},
|
|
48
40
|
endline: true
|
|
49
|
-
}), modifiers, _$memo(() => props.returns ?? "void"), " ",
|
|
41
|
+
}), modifiers, _$memo(() => props.returns ?? "void"), " ", _$createComponent(MemberName, {}), _$memo(() => _$memo(() => !!props.typeParameters)() && _$createComponent(TypeParameters, {
|
|
50
42
|
get parameters() {
|
|
51
43
|
return props.typeParameters;
|
|
52
44
|
}
|
|
@@ -3,7 +3,6 @@ import { refkey } from "@alloy-js/core";
|
|
|
3
3
|
import { describe, expect, it } from "vitest";
|
|
4
4
|
import { TestNamespace } from "../../../test/utils.js";
|
|
5
5
|
import { Attribute } from "../attributes/attributes.js";
|
|
6
|
-
import { SourceFile } from "../SourceFile.js";
|
|
7
6
|
import { InterfaceDeclaration } from "./declaration.js";
|
|
8
7
|
import { InterfaceMethod } from "./method.js";
|
|
9
8
|
const Wrapper = props => _$createComponent(TestNamespace, {
|
|
@@ -31,7 +30,7 @@ describe("modifiers", () => {
|
|
|
31
30
|
})).toRenderTo(`
|
|
32
31
|
public interface TestInterface
|
|
33
32
|
{
|
|
34
|
-
|
|
33
|
+
${accessModifier} void MethodOne();
|
|
35
34
|
}
|
|
36
35
|
`);
|
|
37
36
|
});
|
|
@@ -49,7 +48,7 @@ describe("modifiers", () => {
|
|
|
49
48
|
})).toRenderTo(`
|
|
50
49
|
public interface TestInterface
|
|
51
50
|
{
|
|
52
|
-
|
|
51
|
+
${methodModifier} void MethodOne();
|
|
53
52
|
}
|
|
54
53
|
`);
|
|
55
54
|
});
|
|
@@ -67,7 +66,7 @@ describe("modifiers", () => {
|
|
|
67
66
|
})).toRenderTo(`
|
|
68
67
|
public interface TestInterface
|
|
69
68
|
{
|
|
70
|
-
|
|
69
|
+
public new Task MethodOne();
|
|
71
70
|
}
|
|
72
71
|
`);
|
|
73
72
|
});
|
|
@@ -82,7 +81,7 @@ it("applies PascalCase naming policy", () => {
|
|
|
82
81
|
})).toRenderTo(`
|
|
83
82
|
public interface TestInterface
|
|
84
83
|
{
|
|
85
|
-
|
|
84
|
+
void MethodOne();
|
|
86
85
|
}
|
|
87
86
|
`);
|
|
88
87
|
});
|
|
@@ -107,7 +106,7 @@ it("defines params and return type", () => {
|
|
|
107
106
|
expect(res).toRenderTo(`
|
|
108
107
|
public interface TestInterface
|
|
109
108
|
{
|
|
110
|
-
|
|
109
|
+
public string MethodOne(int intParam, string stringParam);
|
|
111
110
|
}
|
|
112
111
|
`);
|
|
113
112
|
});
|
|
@@ -129,7 +128,7 @@ it("defines optional param", () => {
|
|
|
129
128
|
expect(res).toRenderTo(`
|
|
130
129
|
public interface TestInterface
|
|
131
130
|
{
|
|
132
|
-
|
|
131
|
+
public string MethodOne(int? intParam);
|
|
133
132
|
}
|
|
134
133
|
`);
|
|
135
134
|
});
|
|
@@ -151,7 +150,7 @@ it("defines optional param with default", () => {
|
|
|
151
150
|
expect(res).toRenderTo(`
|
|
152
151
|
public interface TestInterface
|
|
153
152
|
{
|
|
154
|
-
|
|
153
|
+
public string MethodOne(int intParam = 12);
|
|
155
154
|
}
|
|
156
155
|
`);
|
|
157
156
|
});
|
|
@@ -171,8 +170,8 @@ it("specify doc comment", () => {
|
|
|
171
170
|
})).toRenderTo(`
|
|
172
171
|
interface Test
|
|
173
172
|
{
|
|
174
|
-
|
|
175
|
-
|
|
173
|
+
/// This is a test
|
|
174
|
+
void Method();
|
|
176
175
|
}
|
|
177
176
|
`);
|
|
178
177
|
});
|
|
@@ -191,8 +190,8 @@ it("specify attributes", () => {
|
|
|
191
190
|
})).toRenderTo(`
|
|
192
191
|
public interface TestInterface
|
|
193
192
|
{
|
|
194
|
-
|
|
195
|
-
|
|
193
|
+
[Test]
|
|
194
|
+
void Test();
|
|
196
195
|
}
|
|
197
196
|
`);
|
|
198
197
|
});
|
|
@@ -207,39 +206,31 @@ describe("with type parameters", () => {
|
|
|
207
206
|
}];
|
|
208
207
|
expect(_$createComponent(TestNamespace, {
|
|
209
208
|
get children() {
|
|
210
|
-
return _$createComponent(
|
|
211
|
-
|
|
209
|
+
return _$createComponent(InterfaceDeclaration, {
|
|
210
|
+
"public": true,
|
|
211
|
+
name: "TestInterface",
|
|
212
212
|
get children() {
|
|
213
|
-
return _$createComponent(
|
|
213
|
+
return _$createComponent(InterfaceMethod, {
|
|
214
|
+
name: "Test",
|
|
214
215
|
"public": true,
|
|
215
|
-
|
|
216
|
-
get
|
|
217
|
-
return
|
|
218
|
-
name: "
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
type: typeParameters[0].refkey
|
|
225
|
-
}];
|
|
226
|
-
},
|
|
227
|
-
get returns() {
|
|
228
|
-
return typeParameters[0].refkey;
|
|
229
|
-
}
|
|
230
|
-
});
|
|
216
|
+
typeParameters: typeParameters,
|
|
217
|
+
get parameters() {
|
|
218
|
+
return [{
|
|
219
|
+
name: "paramA",
|
|
220
|
+
type: typeParameters[0].refkey
|
|
221
|
+
}];
|
|
222
|
+
},
|
|
223
|
+
get returns() {
|
|
224
|
+
return typeParameters[0].refkey;
|
|
231
225
|
}
|
|
232
226
|
});
|
|
233
227
|
}
|
|
234
228
|
});
|
|
235
229
|
}
|
|
236
230
|
})).toRenderTo(`
|
|
237
|
-
|
|
231
|
+
public interface TestInterface
|
|
238
232
|
{
|
|
239
|
-
public
|
|
240
|
-
{
|
|
241
|
-
public T Test<T, U>(T paramA);
|
|
242
|
-
}
|
|
233
|
+
public T Test<T, U>(T paramA);
|
|
243
234
|
}
|
|
244
235
|
`);
|
|
245
236
|
});
|
|
@@ -263,12 +254,12 @@ describe("with type parameters", () => {
|
|
|
263
254
|
})).toRenderTo(`
|
|
264
255
|
public interface TestInterface
|
|
265
256
|
{
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
257
|
+
public void Test<T, U>()
|
|
258
|
+
where T : IFoo
|
|
259
|
+
where U : IBar
|
|
260
|
+
{
|
|
261
|
+
// Body
|
|
262
|
+
}
|
|
272
263
|
}
|
|
273
264
|
`);
|
|
274
265
|
});
|
|
@@ -282,18 +273,18 @@ describe("formatting", () => {
|
|
|
282
273
|
name: "Handle",
|
|
283
274
|
parameters: [{
|
|
284
275
|
name: "message",
|
|
285
|
-
type: "Some.Quite.Long.Type.That.Will.Split"
|
|
276
|
+
type: "Some.Quite.Long.Type.That.Will.Split.At.One.Hundred.Chars.Line.Width"
|
|
286
277
|
}],
|
|
287
278
|
typeParameters: ["T"],
|
|
288
|
-
returns: "Some.Quite.Long.Type.That.Will.Split"
|
|
279
|
+
returns: "Some.Quite.Long.Type.That.Will.Split.At.One.Hundred.Chars.Line.Width"
|
|
289
280
|
});
|
|
290
281
|
}
|
|
291
282
|
})).toRenderTo(`
|
|
292
283
|
public interface TestInterface
|
|
293
284
|
{
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
285
|
+
public Some.Quite.Long.Type.That.Will.Split.At.One.Hundred.Chars.Line.Width Handle<T>(
|
|
286
|
+
Some.Quite.Long.Type.That.Will.Split.At.One.Hundred.Chars.Line.Width message
|
|
287
|
+
);
|
|
297
288
|
}
|
|
298
289
|
`);
|
|
299
290
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"property.d.ts","sourceRoot":"","sources":["../../../../src/components/interface/property.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAIR,MAAM,
|
|
1
|
+
{"version":3,"file":"property.d.ts","sourceRoot":"","sources":["../../../../src/components/interface/property.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAIR,MAAM,EACP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,EAIhB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAiB,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAG7E,yCAAyC;AACzC,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;CACxB;AAKD,MAAM,WAAW,sBACf,SAAQ,eAAe,EACrB,0BAA0B;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,oBAAoB;IACpB,IAAI,EAAE,QAAQ,CAAC;IAEf,uCAAuC;IACvC,GAAG,CAAC,EAAE,OAAO,CAAC;IAEd,uCAAuC;IACvC,GAAG,CAAC,EAAE,OAAO,CAAC;IAEd,kBAAkB;IAClB,GAAG,CAAC,EAAE,QAAQ,CAAC;IAEf;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;;;;;;;;;;;OAeG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC;CAC7B;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,YAyB9D"}
|
|
@@ -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, useCSharpMemberScope } 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,48 +21,35 @@ const getModifiers = makeModifiers(["new"]);
|
|
|
23
21
|
* ```
|
|
24
22
|
*/
|
|
25
23
|
export function InterfaceProperty(props) {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
const propertySymbol = new CSharpOutputSymbol(name, {
|
|
29
|
-
scope,
|
|
30
|
-
refkeys: props.refkey ?? refkey(props.name)
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
// scope for property declaration
|
|
34
|
-
const propertyScope = new CSharpMemberScope("property-decl", {
|
|
35
|
-
owner: propertySymbol
|
|
24
|
+
const propertySymbol = createPropertySymbol(props.name, {
|
|
25
|
+
refkeys: props.refkey
|
|
36
26
|
});
|
|
37
27
|
const modifiers = computeModifiersPrefix([getAccessModifier(props), getModifiers(props)]);
|
|
38
28
|
// note that scope wraps the method decl so that the params get the correct scope
|
|
39
29
|
return _$createComponent(MemberDeclaration, {
|
|
40
30
|
symbol: propertySymbol,
|
|
41
31
|
get children() {
|
|
42
|
-
return _$createComponent(
|
|
43
|
-
|
|
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,
|
|
44
44
|
get children() {
|
|
45
|
-
return
|
|
46
|
-
|
|
47
|
-
return props.doc;
|
|
48
|
-
}
|
|
49
|
-
}), _$createComponent(AttributeList, {
|
|
50
|
-
get attributes() {
|
|
51
|
-
return props.attributes;
|
|
52
|
-
},
|
|
53
|
-
endline: true
|
|
54
|
-
}), modifiers, _$memo(() => props.type), _$memo(() => props.nullable && "?"), " ", name, " ", _$createComponent(Block, {
|
|
55
|
-
newline: true,
|
|
56
|
-
inline: true,
|
|
45
|
+
return _$createComponent(List, {
|
|
46
|
+
joiner: " ",
|
|
57
47
|
get children() {
|
|
58
|
-
return _$
|
|
59
|
-
joiner: " ",
|
|
60
|
-
get children() {
|
|
61
|
-
return [_$memo(() => props.get && "get;"), _$memo(() => props.set && "set;")];
|
|
62
|
-
}
|
|
63
|
-
});
|
|
48
|
+
return [_$memo(() => props.get && "get;"), _$memo(() => props.set && "set;")];
|
|
64
49
|
}
|
|
65
|
-
})
|
|
50
|
+
});
|
|
66
51
|
}
|
|
67
|
-
});
|
|
52
|
+
})];
|
|
68
53
|
}
|
|
69
54
|
});
|
|
70
55
|
}
|
|
@@ -31,7 +31,7 @@ describe("modifiers", () => {
|
|
|
31
31
|
})).toRenderTo(`
|
|
32
32
|
public interface TestInterface
|
|
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,8 @@ 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
|
});
|
|
@@ -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,24 @@
|
|
|
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
|
+
}
|
|
@@ -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, useCSharpMemberScope } 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,17 +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
|
-
const methodSymbol = new CSharpOutputSymbol(name, {
|
|
24
|
-
scope,
|
|
25
|
-
refkeys: props.refkey ?? refkey(props.name)
|
|
20
|
+
const methodSymbol = createMethodSymbol(props.name, {
|
|
21
|
+
refkeys: props.refkey
|
|
26
22
|
});
|
|
27
23
|
|
|
28
24
|
// scope for method declaration
|
|
29
|
-
const methodScope =
|
|
30
|
-
owner: methodSymbol
|
|
31
|
-
});
|
|
25
|
+
const methodScope = createMethodScope();
|
|
32
26
|
const returns = props.returns ?? (props.async ? "Task" : "void");
|
|
33
27
|
const modifiers = computeModifiersPrefix([getAccessModifier(props), getMethodModifier(props), getAsyncModifier(props.async)]);
|
|
34
28
|
// note that scope wraps the method decl so that the params get the correct scope
|
|
@@ -47,7 +41,7 @@ export function Method(props) {
|
|
|
47
41
|
return props.attributes;
|
|
48
42
|
},
|
|
49
43
|
endline: true
|
|
50
|
-
}), modifiers, returns, " ",
|
|
44
|
+
}), modifiers, returns, " ", _$createComponent(MemberName, {}), _$memo(() => _$memo(() => !!props.typeParameters)() && _$createComponent(TypeParameters, {
|
|
51
45
|
get parameters() {
|
|
52
46
|
return props.typeParameters;
|
|
53
47
|
}
|
|
@@ -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,8 @@ 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
|
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ScopePropsWithInfo, ScopePropsWithValue } from "@alloy-js/core";
|
|
2
|
+
export interface MethodScopePropsWithScopeValue extends ScopePropsWithValue {
|
|
3
|
+
}
|
|
4
|
+
export interface MethodScopePropsWithScopeInfo extends ScopePropsWithInfo {
|
|
5
|
+
}
|
|
6
|
+
export type MethodScopeProps = MethodScopePropsWithScopeValue | MethodScopePropsWithScopeInfo;
|
|
7
|
+
export declare function MethodScope(props: MethodScopeProps): import("@alloy-js/core").Children;
|
|
8
|
+
//# sourceMappingURL=method-scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"method-scope.d.ts","sourceRoot":"","sources":["../../../src/components/method-scope.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAIhF,MAAM,WAAW,8BAA+B,SAAQ,mBAAmB;CAAG;AAC9E,MAAM,WAAW,6BAA8B,SAAQ,kBAAkB;CAAG;AAE5E,MAAM,MAAM,gBAAgB,GACxB,8BAA8B,GAC9B,6BAA6B,CAAC;AAElC,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,qCAelD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { CSharpMethodScope } from "../scopes/method.js";
|
|
5
|
+
export function MethodScope(props) {
|
|
6
|
+
let scope;
|
|
7
|
+
if ("value" in props) {
|
|
8
|
+
if (!(props.value instanceof CSharpMethodScope)) {
|
|
9
|
+
throw new Error("MethodScope value must be a CSharpMethodScope instance");
|
|
10
|
+
}
|
|
11
|
+
scope = props.value;
|
|
12
|
+
} else {
|
|
13
|
+
const parentScope = useCSharpScope();
|
|
14
|
+
scope = new CSharpMethodScope(props.name ?? "method scope", parentScope, {
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return _$createComponent(Scope, {
|
|
19
|
+
value: scope,
|
|
20
|
+
get children() {
|
|
21
|
+
return props.children;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Children } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { NamespaceSymbol } from "../symbols/namespace.js";
|
|
3
|
+
export interface NamespaceScopProps {
|
|
4
|
+
symbol: NamespaceSymbol;
|
|
5
|
+
children: Children;
|
|
6
|
+
}
|
|
7
|
+
export declare function NamespaceScope(props: NamespaceScopProps): Children;
|
|
8
|
+
export interface NamespaceScopesProps {
|
|
9
|
+
symbol: NamespaceSymbol;
|
|
10
|
+
children: Children;
|
|
11
|
+
}
|
|
12
|
+
export declare function NamespaceScopes(props: NamespaceScopesProps): Children;
|
|
13
|
+
//# sourceMappingURL=namespace-scopes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace-scopes.d.ts","sourceRoot":"","sources":["../../../src/components/namespace-scopes.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAGtD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,kBAAkB,YAOvD;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,YAkB1D"}
|