@alloy-js/csharp 0.15.0 → 0.17.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog - @alloy-js/csharp
2
2
 
3
+ ## 0.17.0
4
+
5
+ No changes, version bump only.
6
+
7
+ ## 0.16.0
8
+
9
+ No changes, version bump only.
10
+
3
11
  ## 0.15.0
4
12
 
5
13
  No changes, version bump only.
@@ -1 +1 @@
1
- {"version":3,"file":"Class.d.ts","sourceRoot":"","sources":["../../../src/components/Class.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AACvC,OAAO,EACL,cAAc,EAGd,cAAc,EACf,MAAM,iBAAiB,CAAC;AAKzB,OAAO,EAAE,cAAc,EAAc,MAAM,iBAAiB,CAAC;AAG7D,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;CAC9C;AAGD,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,iBA2DtC;AAED,MAAM,WAAW,qBAAqB;IACpC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,UAAU,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IACnC,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC;IAC3B,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;CAC1B;AAGD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,iBAqC5D;AAGD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC;IACpB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;CACtB;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,iBAyBlD;AAGD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;IACzB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,UAAU,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;CACzB;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,iBAsClD"}
1
+ {"version":3,"file":"Class.d.ts","sourceRoot":"","sources":["../../../src/components/Class.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AACvC,OAAO,EACL,cAAc,EAGd,cAAc,EACf,MAAM,iBAAiB,CAAC;AAKzB,OAAO,EAAE,cAAc,EAAc,MAAM,iBAAiB,CAAC;AAG7D,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;CAC9C;AAGD,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,iBAoDtC;AAED,MAAM,WAAW,qBAAqB;IACpC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,UAAU,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IACnC,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC;IAC3B,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;CAC1B;AAGD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,iBAiC5D;AAGD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC;IACpB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;CACtB;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,iBAwBlD;AAGD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;IACzB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,UAAU,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;CACzB;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,iBAkClD"}
@@ -2,7 +2,8 @@ import { createComponent as _$createComponent, createIntrinsic as _$createIntrin
2
2
  import * as core from "@alloy-js/core";
3
3
  import { getAccessModifier, getMethodModifier } from "../modifiers.js";
4
4
  import { useCSharpNamePolicy } from "../name-policy.js";
5
- import { createCSharpMemberScope, useCSharpScope } from "../symbols/scopes.js";
5
+ import { CSharpOutputSymbol } from "../symbols/csharp-output-symbol.js";
6
+ import { CSharpMemberScope, useCSharpScope } from "../symbols/scopes.js";
6
7
  import { Name } from "./Name.js";
7
8
  import { Parameters } from "./Parameters.js";
8
9
 
@@ -11,18 +12,17 @@ import { Parameters } from "./Parameters.js";
11
12
  // a C# class declaration
12
13
  export function Class(props) {
13
14
  const name = useCSharpNamePolicy().getName(props.name, "class");
14
- const scope = useCSharpScope();
15
- const thisClassSymbol = scope.binder.createSymbol({
16
- name,
17
- scope,
18
- refkey: props.refkey
15
+ const thisClassSymbol = new CSharpOutputSymbol(name, {
16
+ refkeys: props.refkey
19
17
  });
20
18
 
21
19
  // this creates a new scope for the class definition.
22
20
  // members will automatically "inherit" this scope so
23
21
  // that refkeys to them will produce the fully-qualified
24
22
  // name e.g. Foo.Bar.
25
- const thisClassScope = createCSharpMemberScope(scope.binder, scope, thisClassSymbol, "class-decl");
23
+ const thisClassScope = new CSharpMemberScope("class-decl", {
24
+ owner: thisClassSymbol
25
+ });
26
26
  let typeParams;
27
27
  if (props.typeParameters) {
28
28
  const typeParamNames = new Array();
@@ -30,10 +30,9 @@ export function Class(props) {
30
30
  typeParamNames.push(useCSharpNamePolicy().getName(entry[0], "type-parameter"));
31
31
  // create a symbol for each type param so its
32
32
  // refkey resolves to the type param's name
33
- scope.binder.createSymbol({
34
- name: entry[0],
33
+ new CSharpOutputSymbol(entry[0], {
35
34
  scope: thisClassScope,
36
- refkey: entry[1]
35
+ refkeys: entry[1]
37
36
  });
38
37
  }
39
38
  typeParams = _$createIntrinsic("group", {
@@ -73,14 +72,15 @@ export function ClassConstructor(props) {
73
72
 
74
73
  // fetch the class name from the scope
75
74
  const name = useCSharpNamePolicy().getName(scope.owner.name, "class-method");
76
- const ctorSymbol = scope.binder.createSymbol({
77
- name: name,
75
+ const ctorSymbol = new CSharpOutputSymbol(name, {
78
76
  scope,
79
- refkey: props.refkey ?? core.refkey(name)
77
+ refkeys: props.refkey ?? core.refkey(name)
80
78
  });
81
79
 
82
80
  // scope for ctor declaration
83
- const ctorDeclScope = createCSharpMemberScope(scope.binder, scope, ctorSymbol, "constructor-decl");
81
+ const ctorDeclScope = new CSharpMemberScope("constructor-decl", {
82
+ owner: ctorSymbol
83
+ });
84
84
  const accessModifier = getAccessModifier(props.accessModifier);
85
85
  const params = props.parameters ? _$createComponent(Parameters, {
86
86
  get parameters() {
@@ -120,10 +120,9 @@ export function ClassMember(props) {
120
120
  if (scope.kind !== "member" || scope.name !== "class-decl") {
121
121
  throw new Error("can't define a class member outside of a class-decl scope");
122
122
  }
123
- const memberSymbol = scope.binder.createSymbol({
124
- name: name,
123
+ const memberSymbol = new CSharpOutputSymbol(name, {
125
124
  scope,
126
- refkey: props.refkey ?? core.refkey(props.name)
125
+ refkeys: props.refkey ?? core.refkey(props.name)
127
126
  });
128
127
  return _$createComponent(core.Declaration, {
129
128
  symbol: memberSymbol,
@@ -142,14 +141,15 @@ export function ClassMethod(props) {
142
141
  if (scope.kind !== "member" || scope.name !== "class-decl") {
143
142
  throw new Error("can't define a class method outside of a class scope");
144
143
  }
145
- const methodSymbol = scope.binder.createSymbol({
146
- name: name,
144
+ const methodSymbol = new CSharpOutputSymbol(name, {
147
145
  scope,
148
- refkey: props.refkey ?? core.refkey(props.name)
146
+ refkeys: props.refkey ?? core.refkey(props.name)
149
147
  });
150
148
 
151
149
  // scope for method declaration
152
- const methodScope = createCSharpMemberScope(scope.binder, scope, methodSymbol, "method-decl");
150
+ const methodScope = new CSharpMemberScope("method-decl", {
151
+ owner: methodSymbol
152
+ });
153
153
  const accessModifier = getAccessModifier(props.accessModifier);
154
154
  const methodModifier = getMethodModifier(props.methodModifier);
155
155
  const params = props.parameters ? _$createComponent(Parameters, {
@@ -1 +1 @@
1
- {"version":3,"file":"Declaration.d.ts","sourceRoot":"","sources":["../../../src/components/Declaration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAIvC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;CAC1B;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,iBAGlD"}
1
+ {"version":3,"file":"Declaration.d.ts","sourceRoot":"","sources":["../../../src/components/Declaration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAIvC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;CAC1B;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,iBAMlD"}
@@ -1,12 +1,14 @@
1
1
  import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
2
2
  import * as core from "@alloy-js/core";
3
- import { createCSharpSymbol } from "../symbols/csharp-output-symbol.js";
3
+ import { CSharpOutputSymbol } from "../symbols/csharp-output-symbol.js";
4
4
 
5
5
  // properties for creating a declaration
6
6
 
7
7
  // declares a symbol in the program (class, enum, interface etc)
8
8
  export function Declaration(props) {
9
- const sym = createCSharpSymbol(props);
9
+ const sym = new CSharpOutputSymbol(props.name, {
10
+ refkeys: props.refkey
11
+ });
10
12
  return _$createComponent(core.Declaration, {
11
13
  symbol: sym,
12
14
  get children() {
@@ -1 +1 @@
1
- {"version":3,"file":"Enum.d.ts","sourceRoot":"","sources":["../../../src/components/Enum.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,cAAc,EAAqB,MAAM,iBAAiB,CAAC;AAOpE,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;IACzB,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAGD,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,iBAgCpC;AAGD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;CACtB;AAGD,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,iBAoBhD"}
1
+ {"version":3,"file":"Enum.d.ts","sourceRoot":"","sources":["../../../src/components/Enum.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,cAAc,EAAqB,MAAM,iBAAiB,CAAC;AAOpE,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;IACzB,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAGD,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,iBA8BpC;AAGD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;CACtB;AAGD,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,iBAmBhD"}
@@ -2,7 +2,8 @@ import { memo as _$memo, createComponent as _$createComponent } from "@alloy-js/
2
2
  import * as core from "@alloy-js/core";
3
3
  import { getAccessModifier } from "../modifiers.js";
4
4
  import { useCSharpNamePolicy } from "../name-policy.js";
5
- import { createCSharpMemberScope, useCSharpScope } from "../symbols/scopes.js";
5
+ import { CSharpOutputSymbol } from "../symbols/csharp-output-symbol.js";
6
+ import { CSharpMemberScope, useCSharpScope } from "../symbols/scopes.js";
6
7
  import { Name } from "./Name.js";
7
8
 
8
9
  // properties for creating an enum
@@ -11,18 +12,20 @@ import { Name } from "./Name.js";
11
12
  export function Enum(props) {
12
13
  const name = useCSharpNamePolicy().getName(props.name, "enum");
13
14
  const scope = useCSharpScope();
14
- const thisEnumSymbol = scope.binder.createSymbol({
15
- name: name,
15
+ const thisEnumSymbol = new CSharpOutputSymbol(name, {
16
16
  scope,
17
- refkey: props.refkey ?? core.refkey(props.name)
17
+ refkeys: props.refkey ?? core.refkey(props.name)
18
18
  });
19
19
 
20
20
  // this creates a new scope for the enum definition.
21
21
  // members will automatically "inherit" this scope so
22
22
  // that refkeys to them will produce the fully-qualified
23
23
  // name e.g. Foo.Bar.
24
- const thisEnumScope = createCSharpMemberScope(scope.binder, scope, thisEnumSymbol, "enum-decl");
25
- return _$createComponent(core.Declaration, {
24
+ const thisEnumScope = new CSharpMemberScope("enum-decl", {
25
+ parent: scope,
26
+ owner: thisEnumSymbol
27
+ });
28
+ if (thisEnumScope.owner) return _$createComponent(core.Declaration, {
26
29
  symbol: thisEnumSymbol,
27
30
  get children() {
28
31
  return [_$memo(() => getAccessModifier(props.accessModifier)), "enum ", _$createComponent(Name, {}), _$memo(() => !props.children && ";"), _$memo(() => _$memo(() => !!props.children)() && _$createComponent(core.Scope, {
@@ -49,10 +52,9 @@ export function EnumMember(props) {
49
52
  throw new Error("can't define an enum member outside of an enum-decl scope");
50
53
  }
51
54
  const name = useCSharpNamePolicy().getName(props.name, "enum-member");
52
- const thisEnumValueSymbol = scope.binder.createSymbol({
53
- name: name,
55
+ const thisEnumValueSymbol = new CSharpOutputSymbol(name, {
54
56
  scope,
55
- refkey: props.refkey ?? core.refkey(props.name)
57
+ refkeys: props.refkey ?? core.refkey(props.name)
56
58
  });
57
59
  return _$createComponent(core.Declaration, {
58
60
  symbol: thisEnumValueSymbol,
@@ -1 +1 @@
1
- {"version":3,"file":"Namespace.d.ts","sourceRoot":"","sources":["../../../src/components/Namespace.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAIvC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd;AAKD,wBAAgB,YAAY,IAAI,gBAAgB,GAAG,SAAS,CAE3D;AAGD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;CAC1B;AAGD,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,iBAgB9C"}
1
+ {"version":3,"file":"Namespace.d.ts","sourceRoot":"","sources":["../../../src/components/Namespace.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAIvC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd;AAKD,wBAAgB,YAAY,IAAI,gBAAgB,GAAG,SAAS,CAE3D;AAGD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;CAC1B;AAGD,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,iBAY9C"}
@@ -1,6 +1,6 @@
1
1
  import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
2
2
  import * as core from "@alloy-js/core";
3
- import { createCSharpNamespaceScope } from "../symbols/scopes.js";
3
+ import { CSharpNamespaceScope } from "../symbols/scopes.js";
4
4
 
5
5
  // contains the info for the current namespace
6
6
 
@@ -15,7 +15,7 @@ export function useNamespace() {
15
15
 
16
16
  // a C# namespace. contains one or more source files
17
17
  export function Namespace(props) {
18
- const scope = createCSharpNamespaceScope(core.useBinder(), core.useScope(), props.name);
18
+ const scope = new CSharpNamespaceScope(props.name);
19
19
  const namespaceCtx = {
20
20
  name: props.name
21
21
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Parameters.d.ts","sourceRoot":"","sources":["../../../src/components/Parameters.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAMvC,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC;CAC5B;AAGD,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,iBAuB9C;AAED,MAAM,WAAW,eAAe;IAE9B,UAAU,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;CACnC;AAGD,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,iBAMhD"}
1
+ {"version":3,"file":"Parameters.d.ts","sourceRoot":"","sources":["../../../src/components/Parameters.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAMvC,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC;CAC5B;AAGD,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,iBAsB9C;AAED,MAAM,WAAW,eAAe;IAE9B,UAAU,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;CACnC;AAGD,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,iBAMhD"}
@@ -1,6 +1,7 @@
1
1
  import { memo as _$memo, createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
2
2
  import * as core from "@alloy-js/core";
3
3
  import { useCSharpNamePolicy } from "../name-policy.js";
4
+ import { CSharpOutputSymbol } from "../symbols/csharp-output-symbol.js";
4
5
  import { useCSharpScope } from "../symbols/scopes.js";
5
6
  import { Name } from "./Name.js";
6
7
  // a constructor/method parameter
@@ -10,10 +11,9 @@ export function Parameter(props) {
10
11
  if (scope.kind !== "member" || scope.name !== "constructor-decl" && scope.name !== "method-decl") {
11
12
  throw new Error("can't define a parameter outside of a constructor-decl or method-decl scope");
12
13
  }
13
- const memberSymbol = scope.binder.createSymbol({
14
- name: name,
14
+ const memberSymbol = new CSharpOutputSymbol(name, {
15
15
  scope,
16
- refkey: props.refkey ?? core.refkey(props.name)
16
+ refkeys: props.refkey ?? core.refkey(props.name)
17
17
  });
18
18
  return _$createComponent(core.Declaration, {
19
19
  symbol: memberSymbol,
@@ -1,8 +1,8 @@
1
1
  import * as core from "@alloy-js/core";
2
- import { DeclarationProps } from "../components/Declaration.jsx";
3
2
  import { CSharpOutputScope } from "./scopes.js";
4
- export interface CSharpOutputSymbol extends core.OutputSymbol {
5
- scope: CSharpOutputScope;
3
+ export declare class CSharpOutputSymbol extends core.OutputSymbol {
4
+ get scope(): CSharpOutputScope;
5
+ set scope(value: CSharpOutputScope);
6
+ constructor(name: string, options?: core.OutputSymbolOptions);
6
7
  }
7
- export declare function createCSharpSymbol(props: DeclarationProps): CSharpOutputSymbol;
8
8
  //# sourceMappingURL=csharp-output-symbol.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"csharp-output-symbol.d.ts","sourceRoot":"","sources":["../../../src/symbols/csharp-output-symbol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,YAAY;IAC3D,KAAK,EAAE,iBAAiB,CAAC;CAC1B;AAGD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,sBAezD"}
1
+ {"version":3,"file":"csharp-output-symbol.d.ts","sourceRoot":"","sources":["../../../src/symbols/csharp-output-symbol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAEvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAIhD,qBAAa,kBAAmB,SAAQ,IAAI,CAAC,YAAY;IACvD,IAAI,KAAK,IAGQ,iBAAiB,CADjC;IACD,IAAI,KAAK,CAAC,KAAK,EAAE,iBAAiB,EAEjC;gBAEW,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB;CAO7D"}
@@ -1,19 +1,19 @@
1
1
  import * as core from "@alloy-js/core";
2
2
  import { useNamespace } from "../components/Namespace.js";
3
-
4
3
  // represents a symbol from a .cs file. Class, enum, interface etc.
5
4
 
6
- // creates a new C# symbol
7
- export function createCSharpSymbol(props) {
8
- const scope = core.useScope();
9
- const namespaceCtx = useNamespace();
10
- if (!namespaceCtx) {
11
- throw new Error("symbol must be declared inside a namespace");
5
+ export class CSharpOutputSymbol extends core.OutputSymbol {
6
+ get scope() {
7
+ return super.scope;
8
+ }
9
+ set scope(value) {
10
+ super.scope = value;
11
+ }
12
+ constructor(name, options) {
13
+ const namespaceCtx = useNamespace();
14
+ if (!namespaceCtx) {
15
+ throw new Error("symbol must be declared inside a namespace");
16
+ }
17
+ super(name, options);
12
18
  }
13
- const sym = scope.binder.createSymbol({
14
- name: props.name,
15
- scope,
16
- refkey: props.refkey ?? core.refkey(props.name)
17
- });
18
- return sym;
19
19
  }
@@ -1,16 +1,14 @@
1
1
  import * as core from "@alloy-js/core";
2
2
  import { CSharpOutputSymbol } from "./csharp-output-symbol.js";
3
- export interface CSharpNamespaceScope extends core.OutputScope {
4
- kind: "namespace";
3
+ export declare class CSharpNamespaceScope extends core.OutputScope {
4
+ get kind(): string;
5
5
  }
6
- export declare function createCSharpNamespaceScope(binder: core.Binder, parent: core.OutputScope | undefined, name: string): CSharpNamespaceScope;
7
6
  export type CSharpMemberScopeName = "class-decl" | "constructor-decl" | "enum-decl" | "method-decl";
8
- export interface CSharpMemberScope extends core.OutputScope {
9
- kind: "member";
10
- name: CSharpMemberScopeName;
11
- owner: CSharpOutputSymbol;
7
+ export declare class CSharpMemberScope extends core.OutputScope {
8
+ get kind(): string;
9
+ get name(): CSharpMemberScopeName;
10
+ get owner(): CSharpOutputSymbol;
12
11
  }
13
- export declare function createCSharpMemberScope(binder: core.Binder, parent: core.OutputScope, owner: CSharpOutputSymbol, name: CSharpMemberScopeName): CSharpMemberScope;
14
12
  export type CSharpOutputScope = CSharpMemberScope | CSharpNamespaceScope;
15
13
  export declare function useCSharpScope(): CSharpOutputScope;
16
14
  //# sourceMappingURL=scopes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scopes.d.ts","sourceRoot":"","sources":["../../../src/symbols/scopes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG/D,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,WAAW;IAC5D,IAAI,EAAE,WAAW,CAAC;CACnB;AAGD,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,MAAM,EAAE,IAAI,CAAC,WAAW,GAAG,SAAS,EACpC,IAAI,EAAE,MAAM,GACX,oBAAoB,CAMtB;AAGD,MAAM,MAAM,qBAAqB,GAC7B,YAAY,GACZ,kBAAkB,GAClB,WAAW,GACX,aAAa,CAAC;AAKlB,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,WAAW;IACzD,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,qBAAqB,CAAC;IAC5B,KAAK,EAAE,kBAAkB,CAAC;CAC3B;AAID,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,MAAM,EAAE,IAAI,CAAC,WAAW,EACxB,KAAK,EAAE,kBAAkB,EACzB,IAAI,EAAE,qBAAqB,GAC1B,iBAAiB,CAOnB;AAGD,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,GAAG,oBAAoB,CAAC;AAGzE,wBAAgB,cAAc,IAAI,iBAAiB,CAElD"}
1
+ {"version":3,"file":"scopes.d.ts","sourceRoot":"","sources":["../../../src/symbols/scopes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG/D,qBAAa,oBAAqB,SAAQ,IAAI,CAAC,WAAW;IACxD,IAAI,IAAI,WAEP;CACF;AAGD,MAAM,MAAM,qBAAqB,GAC7B,YAAY,GACZ,kBAAkB,GAClB,WAAW,GACX,aAAa,CAAC;AAKlB,qBAAa,iBAAkB,SAAQ,IAAI,CAAC,WAAW;IACrD,IAAI,IAAI,WAEP;IAED,IAAI,IAAI,IACe,qBAAqB,CAC3C;IAED,IAAI,KAAK,IACe,kBAAkB,CACzC;CACF;AAGD,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,GAAG,oBAAoB,CAAC;AAGzE,wBAAgB,cAAc,IAAI,iBAAiB,CAElD"}
@@ -1,14 +1,9 @@
1
1
  import * as core from "@alloy-js/core";
2
-
3
2
  // indicates that the scope for a symbols is at the namespace level
4
-
5
- // creates a new namespace scope
6
- export function createCSharpNamespaceScope(binder, parent, name) {
7
- return binder.createScope({
8
- kind: "namespace",
9
- name,
10
- parent
11
- });
3
+ export class CSharpNamespaceScope extends core.OutputScope {
4
+ get kind() {
5
+ return "namespace";
6
+ }
12
7
  }
13
8
 
14
9
  // the kind of member scope. i.e. are we in an enum, class, etc
@@ -16,16 +11,16 @@ export function createCSharpNamespaceScope(binder, parent, name) {
16
11
  // indicates that the scope for a symbol resides within a type
17
12
  // e.g. for an enum value, class field etc, these would have
18
13
  // member scope where the owner is the containing type.
19
-
20
- // creates a new member scope.
21
- // parent is the owning symbol.
22
- export function createCSharpMemberScope(binder, parent, owner, name) {
23
- return binder.createScope({
24
- kind: "member",
25
- name: name,
26
- owner,
27
- parent
28
- });
14
+ export class CSharpMemberScope extends core.OutputScope {
15
+ get kind() {
16
+ return "member";
17
+ }
18
+ get name() {
19
+ return super.name;
20
+ }
21
+ get owner() {
22
+ return super.owner;
23
+ }
29
24
  }
30
25
 
31
26
  // contains the possible scopes where a declaration can reside