@alloy-js/csharp 0.20.0-dev.2 → 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 +19 -33
- package/dist/src/components/class/declaration.test.js +192 -193
- package/dist/src/components/constructor/constructor.d.ts.map +1 -1
- package/dist/src/components/constructor/constructor.js +11 -19
- 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 -17
- 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 -18
- 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 -39
- 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 -16
- 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 -14
- 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 -39
- package/dist/src/components/property/property.test.js +14 -14
- 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 +19 -13
- package/dist/src/components/record/declaration.test.js +50 -3
- 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 +8 -4
- 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 +138 -143
- package/src/components/class/declaration.tsx +20 -33
- 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 +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 -20
- package/src/components/interface/property.test.tsx +11 -11
- package/src/components/interface/property.tsx +15 -34
- 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 +71 -0
- package/src/components/parameters/parameters.tsx +9 -21
- package/src/components/property/property.test.tsx +14 -14
- package/src/components/property/property.tsx +17 -41
- package/src/components/record/declaration.test.tsx +47 -3
- package/src/components/record/declaration.tsx +34 -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 +6152 -2151
- 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/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/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/src/components/EnumDeclaration.tsx +0 -99
- package/src/components/Namespace.tsx +0 -35
- package/src/symbols/csharp-output-symbol.ts +0 -22
- package/src/symbols/scopes.ts +0 -41
- 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
package/dist/src/modifiers.d.ts
CHANGED
|
@@ -6,6 +6,17 @@ export interface AccessModifiers {
|
|
|
6
6
|
readonly internal?: boolean;
|
|
7
7
|
readonly file?: boolean;
|
|
8
8
|
}
|
|
9
|
+
export interface NonAccessModifiers {
|
|
10
|
+
readonly override?: boolean;
|
|
11
|
+
readonly abstract?: boolean;
|
|
12
|
+
readonly virtual?: boolean;
|
|
13
|
+
readonly static?: boolean;
|
|
14
|
+
readonly sealed?: boolean;
|
|
15
|
+
readonly extern?: boolean;
|
|
16
|
+
readonly readOnly?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface DeclarationModifiers extends AccessModifiers, NonAccessModifiers {
|
|
19
|
+
}
|
|
9
20
|
export declare const getAccessModifier: (data: AccessModifiers) => string;
|
|
10
21
|
export declare function getAsyncModifier(async?: boolean): string;
|
|
11
22
|
/** Resolve the modifier prefix */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modifiers.d.ts","sourceRoot":"","sources":["../../src/modifiers.ts"],"names":[],"mappings":"AAGA,yBAAyB;AACzB,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,eAAO,MAAM,iBAAiB,mCAM5B,CAAC;AAEH,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAExD;AAED,kCAAkC;AAClC,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,GACnC,MAAM,CAGR;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,IAC1C,MAAM,CAAC,YAMhB"}
|
|
1
|
+
{"version":3,"file":"modifiers.d.ts","sourceRoot":"","sources":["../../src/modifiers.ts"],"names":[],"mappings":"AAGA,yBAAyB;AACzB,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,oBACf,SAAQ,eAAe,EACrB,kBAAkB;CAAG;AAEzB,eAAO,MAAM,iBAAiB,mCAM5B,CAAC;AAEH,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAExD;AAED,kCAAkC;AAClC,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,GACnC,MAAM,CAGR;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,IAC1C,MAAM,CAAC,YAMhB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { OutputSpace } from "@alloy-js/core";
|
|
2
|
+
import { CSharpNamedTypeScope } from "./named-type.js";
|
|
3
|
+
export declare class CSharpClassScope extends CSharpNamedTypeScope {
|
|
4
|
+
/**
|
|
5
|
+
* For now, we stuff class parameters into the member scope. This is to ensure
|
|
6
|
+
* name conflicts are handled correctly.
|
|
7
|
+
*/
|
|
8
|
+
get parameters(): OutputSpace;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=class.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"class.d.ts","sourceRoot":"","sources":["../../../src/scopes/class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD,qBAAa,gBAAiB,SAAQ,oBAAoB;IACxD;;;OAGG;IACH,IAAI,UAAU,IAAI,WAAW,CAE5B;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CSharpNamedTypeScope } from "./named-type.js";
|
|
2
|
+
export class CSharpClassScope extends CSharpNamedTypeScope {
|
|
3
|
+
/**
|
|
4
|
+
* For now, we stuff class parameters into the member scope. This is to ensure
|
|
5
|
+
* name conflicts are handled correctly.
|
|
6
|
+
*/
|
|
7
|
+
get parameters() {
|
|
8
|
+
return this.members;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CSharpScope } from "./csharp.js";
|
|
2
|
+
import { CSharpLexicalScope } from "./lexical.js";
|
|
3
|
+
import { CSharpMethodScope } from "./method.js";
|
|
4
|
+
import { CSharpNamedTypeScope } from "./named-type.js";
|
|
5
|
+
export declare function useCSharpScope(): CSharpScope;
|
|
6
|
+
export declare function useNamedTypeScope(): CSharpNamedTypeScope;
|
|
7
|
+
export declare function useMethodScope(): CSharpMethodScope;
|
|
8
|
+
export declare function useLexicalScope(): CSharpLexicalScope;
|
|
9
|
+
//# sourceMappingURL=contexts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contexts.d.ts","sourceRoot":"","sources":["../../../src/scopes/contexts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD,wBAAgB,cAAc,gBAO7B;AAED,wBAAgB,iBAAiB,yBAShC;AAED,wBAAgB,cAAc,sBAQ7B;AAED,wBAAgB,eAAe,uBAQ9B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useScope } from "@alloy-js/core";
|
|
2
|
+
import { CSharpScope } from "./csharp.js";
|
|
3
|
+
import { CSharpLexicalScope } from "./lexical.js";
|
|
4
|
+
import { CSharpMethodScope } from "./method.js";
|
|
5
|
+
import { CSharpNamedTypeScope } from "./named-type.js";
|
|
6
|
+
export function useCSharpScope() {
|
|
7
|
+
const scope = useScope();
|
|
8
|
+
if (!(scope instanceof CSharpScope)) {
|
|
9
|
+
throw new Error("Expected a C# scope, got a different kind of scope.");
|
|
10
|
+
}
|
|
11
|
+
return scope;
|
|
12
|
+
}
|
|
13
|
+
export function useNamedTypeScope() {
|
|
14
|
+
const scope = useCSharpScope();
|
|
15
|
+
if (!(scope instanceof CSharpNamedTypeScope)) {
|
|
16
|
+
throw new Error("Expected a named type scope, got a " + scope.constructor.name);
|
|
17
|
+
}
|
|
18
|
+
return scope;
|
|
19
|
+
}
|
|
20
|
+
export function useMethodScope() {
|
|
21
|
+
const scope = useScope();
|
|
22
|
+
if (!(scope instanceof CSharpMethodScope)) {
|
|
23
|
+
throw new Error(`Expected a method scope, but got ${scope.constructor.name}.`);
|
|
24
|
+
}
|
|
25
|
+
return scope;
|
|
26
|
+
}
|
|
27
|
+
export function useLexicalScope() {
|
|
28
|
+
const scope = useScope();
|
|
29
|
+
if (!(scope instanceof CSharpLexicalScope)) {
|
|
30
|
+
throw new Error(`Expected a lexical scope, but got ${scope.constructor.name}.`);
|
|
31
|
+
}
|
|
32
|
+
return scope;
|
|
33
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OutputScope, OutputScopeOptions } from "@alloy-js/core";
|
|
2
|
+
import { NamespaceSymbol } from "../symbols/namespace.js";
|
|
3
|
+
export declare class CSharpScope extends OutputScope {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(name: string, parent: CSharpScope | undefined, options?: OutputScopeOptions);
|
|
6
|
+
get enclosingNamespace(): NamespaceSymbol | undefined;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=csharp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csharp.d.ts","sourceRoot":"","sources":["../../../src/scopes/csharp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,qBAAa,WAAY,SAAQ,WAAW;;gBAExC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,OAAO,CAAC,EAAE,kBAAkB;IAO9B,IAAI,kBAAkB,gCAErB;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { OutputScope } from "@alloy-js/core";
|
|
2
|
+
export class CSharpScope extends OutputScope {
|
|
3
|
+
constructor(name, parent, options) {
|
|
4
|
+
super(name, parent, options);
|
|
5
|
+
this.#namespaceSymbol = parent?.enclosingNamespace;
|
|
6
|
+
}
|
|
7
|
+
#namespaceSymbol;
|
|
8
|
+
get enclosingNamespace() {
|
|
9
|
+
return this.#namespaceSymbol;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { OutputScopeOptions } from "@alloy-js/core";
|
|
2
|
+
import { NamedTypeSymbol } from "../symbols/named-type.js";
|
|
3
|
+
import { CSharpClassScope } from "./class.js";
|
|
4
|
+
import { CSharpMethodScope } from "./method.js";
|
|
5
|
+
import { CSharpNamedTypeScope } from "./named-type.js";
|
|
6
|
+
export declare function createNamedTypeScope(ownerSymbol: NamedTypeSymbol, options?: OutputScopeOptions): CSharpNamedTypeScope;
|
|
7
|
+
export declare function createClassScope(ownerSymbol: NamedTypeSymbol, options?: OutputScopeOptions): CSharpClassScope;
|
|
8
|
+
export declare function createMethodScope(options?: OutputScopeOptions): CSharpMethodScope;
|
|
9
|
+
//# sourceMappingURL=factories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factories.d.ts","sourceRoot":"","sources":["../../../src/scopes/factories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAGvD,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,eAAe,EAC5B,OAAO,GAAE,kBAAuB,wBAcjC;AAED,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,eAAe,EAC5B,OAAO,GAAE,kBAAuB,oBAYjC;AACD,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,kBAAuB,qBAGjE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CSharpClassScope } from "./class.js";
|
|
2
|
+
import { useCSharpScope, useNamedTypeScope } from "./contexts.js";
|
|
3
|
+
import { CSharpMethodScope } from "./method.js";
|
|
4
|
+
import { CSharpNamedTypeScope } from "./named-type.js";
|
|
5
|
+
import { CSharpSourceFileScope } from "./source-file.js";
|
|
6
|
+
export function createNamedTypeScope(ownerSymbol, options = {}) {
|
|
7
|
+
const currentScope = useCSharpScope();
|
|
8
|
+
if (!(currentScope instanceof CSharpNamedTypeScope) && !(currentScope instanceof CSharpSourceFileScope)) {
|
|
9
|
+
throw new Error("Can't create C# type declaration scope inside of " + currentScope.constructor.name);
|
|
10
|
+
}
|
|
11
|
+
return new CSharpNamedTypeScope(ownerSymbol, currentScope, options);
|
|
12
|
+
}
|
|
13
|
+
export function createClassScope(ownerSymbol, options = {}) {
|
|
14
|
+
const currentScope = useCSharpScope();
|
|
15
|
+
if (!(currentScope instanceof CSharpNamedTypeScope) && !(currentScope instanceof CSharpSourceFileScope)) {
|
|
16
|
+
throw new Error("Can't create C# class scope inside of " + currentScope.constructor.name);
|
|
17
|
+
}
|
|
18
|
+
return new CSharpClassScope(ownerSymbol, currentScope, options);
|
|
19
|
+
}
|
|
20
|
+
export function createMethodScope(options = {}) {
|
|
21
|
+
const parentScope = useNamedTypeScope();
|
|
22
|
+
return new CSharpMethodScope("method scope", parentScope, options);
|
|
23
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./class.js";
|
|
2
|
+
export * from "./contexts.js";
|
|
3
|
+
export * from "./csharp.js";
|
|
4
|
+
export * from "./factories.js";
|
|
5
|
+
export * from "./lexical.js";
|
|
6
|
+
export * from "./method.js";
|
|
7
|
+
export * from "./named-type.js";
|
|
8
|
+
export * from "./namespace.js";
|
|
9
|
+
export * from "./source-file.js";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/scopes/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./class.js";
|
|
2
|
+
export * from "./contexts.js";
|
|
3
|
+
export * from "./csharp.js";
|
|
4
|
+
export * from "./factories.js";
|
|
5
|
+
export * from "./lexical.js";
|
|
6
|
+
export * from "./method.js";
|
|
7
|
+
export * from "./named-type.js";
|
|
8
|
+
export * from "./namespace.js";
|
|
9
|
+
export * from "./source-file.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type OutputSpace } from "@alloy-js/core";
|
|
2
|
+
import { CSharpScope } from "./csharp.js";
|
|
3
|
+
export declare class CSharpLexicalScope extends CSharpScope {
|
|
4
|
+
static readonly declarationSpaces: string[];
|
|
5
|
+
get localVariables(): OutputSpace;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=lexical.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lexical.d.ts","sourceRoot":"","sources":["../../../src/scopes/lexical.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,qBAAa,kBAAmB,SAAQ,WAAW;IACjD,gBAAuB,iBAAiB,WAAuB;IAE/D,IAAI,cAAc,IAAI,WAAW,CAEhC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { OutputSpace } from "@alloy-js/core";
|
|
2
|
+
import { CSharpLexicalScope } from "./lexical.js";
|
|
3
|
+
export declare class CSharpMethodScope extends CSharpLexicalScope {
|
|
4
|
+
static readonly declarationSpaces: string[];
|
|
5
|
+
get localVariables(): OutputSpace;
|
|
6
|
+
get parameters(): OutputSpace;
|
|
7
|
+
get typeParameters(): OutputSpace;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=method.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"method.d.ts","sourceRoot":"","sources":["../../../src/scopes/method.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,qBAAa,iBAAkB,SAAQ,kBAAkB;IACvD,gBAAuB,iBAAiB,WAItC;IAEF,IAAI,cAAc,IAAI,WAAW,CAEhC;IAED,IAAI,UAAU,IAAI,WAAW,CAE5B;IAED,IAAI,cAAc,IAAI,WAAW,CAEhC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CSharpLexicalScope } from "./lexical.js";
|
|
2
|
+
export class CSharpMethodScope extends CSharpLexicalScope {
|
|
3
|
+
static declarationSpaces = ["local-variables", "parameters", "type-parameters"];
|
|
4
|
+
get localVariables() {
|
|
5
|
+
return this.spaceFor("local-variables");
|
|
6
|
+
}
|
|
7
|
+
get parameters() {
|
|
8
|
+
return this.spaceFor("parameters");
|
|
9
|
+
}
|
|
10
|
+
get typeParameters() {
|
|
11
|
+
return this.spaceFor("type-parameters");
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type OutputScopeOptions } from "@alloy-js/core";
|
|
2
|
+
import { NamedTypeSymbol } from "../symbols/named-type.js";
|
|
3
|
+
import { CSharpScope } from "./csharp.js";
|
|
4
|
+
import { CSharpSourceFileScope } from "./source-file.js";
|
|
5
|
+
/**
|
|
6
|
+
* This scope contains NamedTypeSymbols for types that are declared in
|
|
7
|
+
* containers like namespaces. This scope is a member scope which whose
|
|
8
|
+
* member symbol is a NamedTypeSymbol.
|
|
9
|
+
*/
|
|
10
|
+
export declare class CSharpNamedTypeScope extends CSharpScope {
|
|
11
|
+
static readonly declarationSpaces: never[];
|
|
12
|
+
constructor(ownerSymbol: NamedTypeSymbol, parentScope: CSharpNamedTypeScope | CSharpSourceFileScope | undefined, options?: OutputScopeOptions);
|
|
13
|
+
get ownerSymbol(): NamedTypeSymbol;
|
|
14
|
+
get enclosingNamespace(): import("../index.js").NamespaceSymbol | undefined;
|
|
15
|
+
get members(): import("@alloy-js/core").OutputMemberSpace;
|
|
16
|
+
/**
|
|
17
|
+
* For now, we stuff type parameters into the member scope. This is to ensure
|
|
18
|
+
* name conflicts are handled correctly.
|
|
19
|
+
*/
|
|
20
|
+
get typeParameters(): import("@alloy-js/core").OutputMemberSpace;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=named-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"named-type.d.ts","sourceRoot":"","sources":["../../../src/scopes/named-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,WAAW;IACnD,gBAAuB,iBAAiB,UAAM;gBAG5C,WAAW,EAAE,eAAe,EAC5B,WAAW,EAAE,oBAAoB,GAAG,qBAAqB,GAAG,SAAS,EACrE,OAAO,GAAE,kBAAuB;IAQlC,IAAI,WAAW,IAAI,eAAe,CAEjC;IAED,IAAI,kBAAkB,sDAErB;IAED,IAAI,OAAO,+CAEV;IAED;;;OAGG;IACH,IAAI,cAAc,+CAEjB;CACF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { CSharpScope } from "./csharp.js";
|
|
2
|
+
/**
|
|
3
|
+
* This scope contains NamedTypeSymbols for types that are declared in
|
|
4
|
+
* containers like namespaces. This scope is a member scope which whose
|
|
5
|
+
* member symbol is a NamedTypeSymbol.
|
|
6
|
+
*/
|
|
7
|
+
export class CSharpNamedTypeScope extends CSharpScope {
|
|
8
|
+
static declarationSpaces = [];
|
|
9
|
+
constructor(ownerSymbol, parentScope, options = {}) {
|
|
10
|
+
super(`${ownerSymbol.name} scope`, parentScope, {
|
|
11
|
+
ownerSymbol,
|
|
12
|
+
...options
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
get ownerSymbol() {
|
|
16
|
+
return super.ownerSymbol;
|
|
17
|
+
}
|
|
18
|
+
get enclosingNamespace() {
|
|
19
|
+
return this.ownerSymbol.enclosingNamespace;
|
|
20
|
+
}
|
|
21
|
+
get members() {
|
|
22
|
+
return this.ownerSymbol.members;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* For now, we stuff type parameters into the member scope. This is to ensure
|
|
27
|
+
* name conflicts are handled correctly.
|
|
28
|
+
*/
|
|
29
|
+
get typeParameters() {
|
|
30
|
+
return this.ownerSymbol.members;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { NamespaceSymbol } from "../symbols/namespace.js";
|
|
2
|
+
import { CSharpNamedTypeScope } from "./named-type.js";
|
|
3
|
+
import { CSharpSourceFileScope } from "./source-file.js";
|
|
4
|
+
export declare class CSharpNamespaceScope extends CSharpNamedTypeScope {
|
|
5
|
+
constructor(namespaceSymbol: NamespaceSymbol, parentScope?: CSharpNamespaceScope | CSharpSourceFileScope);
|
|
6
|
+
get ownerSymbol(): NamespaceSymbol;
|
|
7
|
+
}
|
|
8
|
+
export declare function createCSharpNamespaceScope(namespaceSymbol: NamespaceSymbol): CSharpNamespaceScope;
|
|
9
|
+
export declare function useEnclosingNamespaceScope(): CSharpNamespaceScope | undefined;
|
|
10
|
+
export declare function useNamespace(): CSharpNamespaceScope;
|
|
11
|
+
//# sourceMappingURL=namespace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace.d.ts","sourceRoot":"","sources":["../../../src/scopes/namespace.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,qBAAa,oBAAqB,SAAQ,oBAAoB;gBAE1D,eAAe,EAAE,eAAe,EAChC,WAAW,CAAC,EAAE,oBAAoB,GAAG,qBAAqB;IAO5D,IAAI,WAAW,IACe,eAAe,CAC5C;CACF;AAED,wBAAgB,0BAA0B,CAAC,eAAe,EAAE,eAAe,wBAiB1E;AAED,wBAAgB,0BAA0B,IAAI,oBAAoB,GAAG,SAAS,CAO7E;AAED,wBAAgB,YAAY,yBAU3B"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useScope } from "@alloy-js/core";
|
|
2
|
+
import { CSharpNamedTypeScope } from "./named-type.js";
|
|
3
|
+
import { CSharpSourceFileScope } from "./source-file.js";
|
|
4
|
+
export class CSharpNamespaceScope extends CSharpNamedTypeScope {
|
|
5
|
+
constructor(namespaceSymbol, parentScope) {
|
|
6
|
+
super(namespaceSymbol, parentScope, {
|
|
7
|
+
binder: namespaceSymbol.binder
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
get ownerSymbol() {
|
|
11
|
+
return super.ownerSymbol;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export function createCSharpNamespaceScope(namespaceSymbol) {
|
|
15
|
+
const parentScope = useScope();
|
|
16
|
+
if (parentScope && !(parentScope instanceof CSharpNamespaceScope || parentScope instanceof CSharpSourceFileScope)) {
|
|
17
|
+
throw new Error("Namespaces can only be created within a namespace or source file");
|
|
18
|
+
}
|
|
19
|
+
const scope = new CSharpNamespaceScope(namespaceSymbol, parentScope);
|
|
20
|
+
return scope;
|
|
21
|
+
}
|
|
22
|
+
export function useEnclosingNamespaceScope() {
|
|
23
|
+
const currentScope = useScope();
|
|
24
|
+
if (!(currentScope instanceof CSharpNamespaceScope)) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
return currentScope;
|
|
28
|
+
}
|
|
29
|
+
export function useNamespace() {
|
|
30
|
+
let scope = useScope();
|
|
31
|
+
while (scope) {
|
|
32
|
+
if (scope instanceof CSharpNamespaceScope) {
|
|
33
|
+
return scope;
|
|
34
|
+
}
|
|
35
|
+
scope = scope.parent;
|
|
36
|
+
}
|
|
37
|
+
throw new Error("A namespace is not in scope");
|
|
38
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { OutputScopeOptions } from "@alloy-js/core";
|
|
2
|
+
import { NamespaceSymbol } from "../symbols/namespace.js";
|
|
3
|
+
import { CSharpLexicalScope } from "./lexical.js";
|
|
4
|
+
import { CSharpNamespaceScope } from "./namespace.js";
|
|
5
|
+
export declare class CSharpSourceFileScope extends CSharpLexicalScope {
|
|
6
|
+
#private;
|
|
7
|
+
constructor(name: string, parent?: CSharpNamespaceScope, options?: OutputScopeOptions);
|
|
8
|
+
get usings(): import("@vue/reactivity").ShallowReactive<Set<NamespaceSymbol>>;
|
|
9
|
+
get parent(): CSharpNamespaceScope;
|
|
10
|
+
set parent(v: CSharpNamespaceScope);
|
|
11
|
+
addUsing(using: NamespaceSymbol): void;
|
|
12
|
+
get hasBlockNamespace(): boolean;
|
|
13
|
+
set hasBlockNamespace(value: boolean);
|
|
14
|
+
}
|
|
15
|
+
export declare function useSourceFileScope(): CSharpSourceFileScope | undefined;
|
|
16
|
+
//# sourceMappingURL=source-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-file.d.ts","sourceRoot":"","sources":["../../../src/scopes/source-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAOnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEtD,qBAAa,qBAAsB,SAAQ,kBAAkB;;gBAIzD,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,oBAAoB,EAC7B,OAAO,CAAC,EAAE,kBAAkB;IAI9B,IAAI,MAAM,oEAET;IAED,IAAI,MAAM,IAII,oBAAoB,CAFjC;IAED,IAAI,MAAM,CAAC,CAAC,EAAE,oBAAoB,EAEjC;IAED,QAAQ,CAAC,KAAK,EAAE,eAAe;IAK/B,IAAI,iBAAiB,IAKQ,OAAO,CAFnC;IAED,IAAI,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAOnC;CACF;AAED,wBAAgB,kBAAkB,sCAUjC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { shallowReactive, track, TrackOpTypes, trigger, TriggerOpTypes, useScope } from "@alloy-js/core";
|
|
2
|
+
import { CSharpLexicalScope } from "./lexical.js";
|
|
3
|
+
export class CSharpSourceFileScope extends CSharpLexicalScope {
|
|
4
|
+
#usings = shallowReactive(new Set());
|
|
5
|
+
constructor(name, parent, options) {
|
|
6
|
+
super(name, parent, options);
|
|
7
|
+
}
|
|
8
|
+
get usings() {
|
|
9
|
+
return this.#usings;
|
|
10
|
+
}
|
|
11
|
+
get parent() {
|
|
12
|
+
return super.parent;
|
|
13
|
+
}
|
|
14
|
+
set parent(v) {
|
|
15
|
+
super.parent = v;
|
|
16
|
+
}
|
|
17
|
+
addUsing(using) {
|
|
18
|
+
this.#usings.add(using);
|
|
19
|
+
}
|
|
20
|
+
#hasBlockNamespace = false;
|
|
21
|
+
get hasBlockNamespace() {
|
|
22
|
+
track(this, TrackOpTypes.GET, "hasBlockNamespace");
|
|
23
|
+
return this.#hasBlockNamespace;
|
|
24
|
+
}
|
|
25
|
+
set hasBlockNamespace(value) {
|
|
26
|
+
const old = this.#hasBlockNamespace;
|
|
27
|
+
if (this.#hasBlockNamespace === value) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
this.#hasBlockNamespace = value;
|
|
31
|
+
trigger(this, TriggerOpTypes.SET, "hasBlockNamespace", value, old);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export function useSourceFileScope() {
|
|
35
|
+
let scope = useScope();
|
|
36
|
+
while (scope) {
|
|
37
|
+
if (scope instanceof CSharpSourceFileScope) {
|
|
38
|
+
return scope;
|
|
39
|
+
}
|
|
40
|
+
scope = scope.parent;
|
|
41
|
+
}
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Namekey, OutputSpace, OutputSymbol, OutputSymbolOptions } from "@alloy-js/core";
|
|
2
|
+
import { AccessModifiers, NonAccessModifiers } from "../modifiers.js";
|
|
3
|
+
import { NamespaceSymbol } from "./namespace.js";
|
|
4
|
+
export type DeclaredAccessibility = "private" | "protected" | "internal" | "public";
|
|
5
|
+
export interface CSharpSymbolOptions extends OutputSymbolOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The accessibility of the symbol.
|
|
8
|
+
*/
|
|
9
|
+
accessibility?: DeclaredAccessibility;
|
|
10
|
+
isOverride?: boolean;
|
|
11
|
+
isAbstract?: boolean;
|
|
12
|
+
isVirtual?: boolean;
|
|
13
|
+
isStatic?: boolean;
|
|
14
|
+
isSealed?: boolean;
|
|
15
|
+
isExtern?: boolean;
|
|
16
|
+
isReadOnly?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export type CSharpSymbolKinds = "symbol" | "named-type" | "method" | "field" | "property" | "namespace" | "event";
|
|
19
|
+
/**
|
|
20
|
+
* This is the base type for all symbols in C#.
|
|
21
|
+
*
|
|
22
|
+
* Many subtypes of this symbol exist for specific purposes. However, this symbol
|
|
23
|
+
* may be used in cases where a more specific symbol is not required.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
*
|
|
27
|
+
* This is roughly equivalent to the Roslyn ISymbol interface:
|
|
28
|
+
* https://learn.microsoft.com/en-us/dotnet/api/microsoft.codeanalysis.isymbol?view=roslyn-dotnet-4.13.0
|
|
29
|
+
*/
|
|
30
|
+
export declare class CSharpSymbol extends OutputSymbol {
|
|
31
|
+
#private;
|
|
32
|
+
readonly symbolKind: CSharpSymbolKinds;
|
|
33
|
+
constructor(name: string | Namekey, spaces: OutputSpace[] | OutputSpace | undefined, options?: CSharpSymbolOptions);
|
|
34
|
+
get enclosingNamespace(): NamespaceSymbol | undefined;
|
|
35
|
+
get accessibility(): DeclaredAccessibility | undefined;
|
|
36
|
+
set accessibility(value: DeclaredAccessibility | undefined);
|
|
37
|
+
copy(): CSharpSymbol;
|
|
38
|
+
/**
|
|
39
|
+
* Whether this symbol is static.
|
|
40
|
+
*/
|
|
41
|
+
get isStatic(): boolean;
|
|
42
|
+
set isStatic(value: boolean);
|
|
43
|
+
/**
|
|
44
|
+
* Whether this symbol is virtual.
|
|
45
|
+
*/
|
|
46
|
+
get isVirtual(): boolean;
|
|
47
|
+
set isVirtual(value: boolean);
|
|
48
|
+
/**
|
|
49
|
+
* Whether this symbol is abstract.
|
|
50
|
+
*/
|
|
51
|
+
get isAbstract(): boolean;
|
|
52
|
+
set isAbstract(value: boolean);
|
|
53
|
+
/**
|
|
54
|
+
* Whether this symbol is override.
|
|
55
|
+
*/
|
|
56
|
+
get isOverride(): boolean;
|
|
57
|
+
set isOverride(value: boolean);
|
|
58
|
+
/**
|
|
59
|
+
* Whether this symbol is sealed.
|
|
60
|
+
*/
|
|
61
|
+
get isSealed(): boolean;
|
|
62
|
+
set isSealed(value: boolean);
|
|
63
|
+
/**
|
|
64
|
+
* Whether this symbol is extern.
|
|
65
|
+
*/
|
|
66
|
+
get isExtern(): boolean;
|
|
67
|
+
set isExtern(value: boolean);
|
|
68
|
+
/**
|
|
69
|
+
* Whether this symbol is readonly.
|
|
70
|
+
*/
|
|
71
|
+
get isReadOnly(): boolean;
|
|
72
|
+
set isReadOnly(value: boolean);
|
|
73
|
+
}
|
|
74
|
+
export declare function accessibilityFromProps(props: AccessModifiers): "public" | "protected" | "private" | "internal";
|
|
75
|
+
export declare function nonAccessibilityFromProps(props: NonAccessModifiers): CSharpSymbolOptions;
|
|
76
|
+
//# sourceMappingURL=csharp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csharp.d.ts","sourceRoot":"","sources":["../../../src/symbols/csharp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAGP,WAAW,EACX,YAAY,EACZ,mBAAmB,EAMpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,MAAM,MAAM,qBAAqB,GAC7B,SAAS,GACT,WAAW,GACX,UAAU,GACV,QAAQ,CAAC;AAEb,MAAM,WAAW,mBAAoB,SAAQ,mBAAmB;IAC9D;;OAEG;IACH,aAAa,CAAC,EAAE,qBAAqB,CAAC;IACtC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,MAAM,iBAAiB,GACzB,QAAQ,GACR,YAAY,GACZ,QAAQ,GACR,OAAO,GACP,UAAU,GACV,WAAW,GACX,OAAO,CAAC;AACZ;;;;;;;;;;GAUG;AACH,qBAAa,YAAa,SAAQ,YAAY;;IAC5C,SAAgB,UAAU,EAAE,iBAAiB,CAAY;gBAGvD,IAAI,EAAE,MAAM,GAAG,OAAO,EACtB,MAAM,EAAE,WAAW,EAAE,GAAG,WAAW,GAAG,SAAS,EAC/C,OAAO,GAAE,mBAAwB;IAcnC,IAAI,kBAAkB,IAAI,eAAe,GAAG,SAAS,CA4BpD;IAGD,IAAI,aAAa,IAKQ,qBAAqB,GAAG,SAAS,CAFzD;IAED,IAAI,aAAa,CAAC,KAAK,EAAE,qBAAqB,GAAG,SAAS,EASzD;IAED,IAAI;IAyBJ;;OAEG;IACH,IAAI,QAAQ,IAAI,OAAO,CAGtB;IAED,IAAI,QAAQ,CAAC,KAAK,EAAE,OAAO,EAS1B;IAGD;;OAEG;IACH,IAAI,SAAS,IAAI,OAAO,CAGvB;IACD,IAAI,SAAS,CAAC,KAAK,EAAE,OAAO,EAS3B;IAID;;OAEG;IACH,IAAI,UAAU,IAAI,OAAO,CAGxB;IACD,IAAI,UAAU,CAAC,KAAK,EAAE,OAAO,EAS5B;IAGD;;OAEG;IACH,IAAI,UAAU,IAAI,OAAO,CAGxB;IACD,IAAI,UAAU,CAAC,KAAK,EAAE,OAAO,EAS5B;IAGD;;OAEG;IACH,IAAI,QAAQ,IAAI,OAAO,CAGtB;IACD,IAAI,QAAQ,CAAC,KAAK,EAAE,OAAO,EAS1B;IAGD;;OAEG;IACH,IAAI,QAAQ,IAAI,OAAO,CAGtB;IACD,IAAI,QAAQ,CAAC,KAAK,EAAE,OAAO,EAS1B;IAGD;;OAEG;IACH,IAAI,UAAU,IAAI,OAAO,CAGxB;IACD,IAAI,UAAU,CAAC,KAAK,EAAE,OAAO,EAS5B;CAEF;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,eAAe,mDAQ5D;AAED,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,kBAAkB,GACxB,mBAAmB,CAUrB"}
|