@alloy-js/go 0.3.2-dev.2 → 0.3.3
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 +8 -0
- package/dist/dev/src/builtins/fmt/fmt.js.map +1 -1
- package/dist/dev/src/builtins/index.js.map +1 -1
- package/dist/dev/src/builtins/io/io.js.map +1 -1
- package/dist/dev/src/builtins/net/net.js.map +1 -1
- package/dist/dev/src/builtins/time/time.js.map +1 -1
- package/dist/dev/src/components/ImportStatement.js +6 -6
- package/dist/dev/src/components/ImportStatement.js.map +1 -1
- package/dist/dev/src/components/ModuleDirectory.js +2 -2
- package/dist/dev/src/components/ModuleDirectory.js.map +1 -1
- package/dist/dev/src/components/Name.js.map +1 -1
- package/dist/dev/src/components/Reference.js.map +1 -1
- package/dist/dev/src/components/SourceDirectory.js +2 -2
- package/dist/dev/src/components/SourceDirectory.js.map +1 -1
- package/dist/dev/src/components/SourceFile.js +12 -12
- package/dist/dev/src/components/SourceFile.js.map +1 -1
- package/dist/dev/src/components/doc/comment.js.map +1 -1
- package/dist/dev/src/components/doc/comment.test.js +39 -39
- package/dist/dev/src/components/doc/comment.test.js.map +1 -1
- package/dist/dev/src/components/function/function.js +26 -26
- package/dist/dev/src/components/function/function.js.map +1 -1
- package/dist/dev/src/components/function/function.test.js +55 -55
- package/dist/dev/src/components/function/function.test.js.map +1 -1
- package/dist/dev/src/components/index.js.map +1 -1
- package/dist/dev/src/components/interface/declaration.js +10 -10
- package/dist/dev/src/components/interface/declaration.js.map +1 -1
- package/dist/dev/src/components/interface/interface.test.js +84 -84
- package/dist/dev/src/components/interface/interface.test.js.map +1 -1
- package/dist/dev/src/components/package.test.js +12 -12
- package/dist/dev/src/components/package.test.js.map +1 -1
- package/dist/dev/src/components/parameters/parameters.js +13 -13
- package/dist/dev/src/components/parameters/parameters.js.map +1 -1
- package/dist/dev/src/components/parameters/typeparameters.js +11 -11
- package/dist/dev/src/components/parameters/typeparameters.js.map +1 -1
- package/dist/dev/src/components/pointer/pointer.js.map +1 -1
- package/dist/dev/src/components/stc/index.js.map +1 -1
- package/dist/dev/src/components/struct/declaration.js +12 -12
- package/dist/dev/src/components/struct/declaration.js.map +1 -1
- package/dist/dev/src/components/struct/struct.test.js +132 -132
- package/dist/dev/src/components/struct/struct.test.js.map +1 -1
- package/dist/dev/src/components/type/declaration.js +12 -12
- package/dist/dev/src/components/type/declaration.js.map +1 -1
- package/dist/dev/src/components/var/declaration.js +15 -15
- package/dist/dev/src/components/var/declaration.js.map +1 -1
- package/dist/dev/src/components/var/var-declaration.test.js +56 -56
- package/dist/dev/src/components/var/var-declaration.test.js.map +1 -1
- package/dist/dev/src/context/package.js.map +1 -1
- package/dist/dev/src/create-module.js.map +1 -1
- package/dist/dev/src/create-module.test.js +8 -8
- package/dist/dev/src/create-module.test.js.map +1 -1
- package/dist/dev/src/index.js.map +1 -1
- package/dist/dev/src/name-policy.js.map +1 -1
- package/dist/dev/src/scopes/contexts.js.map +1 -1
- package/dist/dev/src/scopes/factories.js.map +1 -1
- package/dist/dev/src/scopes/function.js.map +1 -1
- package/dist/dev/src/scopes/go.js.map +1 -1
- package/dist/dev/src/scopes/index.js.map +1 -1
- package/dist/dev/src/scopes/lexical.js +1 -0
- package/dist/dev/src/scopes/lexical.js.map +1 -1
- package/dist/dev/src/scopes/module.js.map +1 -1
- package/dist/dev/src/scopes/named-type.js +1 -0
- package/dist/dev/src/scopes/named-type.js.map +1 -1
- package/dist/dev/src/scopes/package.js.map +1 -1
- package/dist/dev/src/scopes/source-file.js.map +1 -1
- package/dist/dev/src/symbols/factories.js.map +1 -1
- package/dist/dev/src/symbols/function.js.map +1 -1
- package/dist/dev/src/symbols/go.js.map +1 -1
- package/dist/dev/src/symbols/index.js.map +1 -1
- package/dist/dev/src/symbols/named-type.js.map +1 -1
- package/dist/dev/src/symbols/package.js.map +1 -1
- package/dist/dev/src/symbols/reference.js.map +1 -1
- package/dist/dev/src/symbols/type-parameter.js.map +1 -1
- package/dist/dev/test/utils.js +4 -4
- package/dist/dev/test/utils.js.map +1 -1
- package/dist/dev/test/vitest.setup.js.map +1 -1
- package/dist/src/builtins/fmt/fmt.d.ts.map +1 -1
- package/dist/src/builtins/fmt/fmt.js.map +1 -1
- package/dist/src/builtins/index.js.map +1 -1
- package/dist/src/builtins/io/io.d.ts.map +1 -1
- package/dist/src/builtins/io/io.js.map +1 -1
- package/dist/src/builtins/net/net.d.ts.map +1 -1
- package/dist/src/builtins/net/net.js.map +1 -1
- package/dist/src/builtins/time/time.d.ts.map +1 -1
- package/dist/src/builtins/time/time.js.map +1 -1
- package/dist/src/components/ImportStatement.d.ts +2 -2
- package/dist/src/components/ImportStatement.d.ts.map +1 -1
- package/dist/src/components/ImportStatement.js.map +1 -1
- package/dist/src/components/ModuleDirectory.d.ts +1 -1
- package/dist/src/components/ModuleDirectory.d.ts.map +1 -1
- package/dist/src/components/ModuleDirectory.js.map +1 -1
- package/dist/src/components/Name.js.map +1 -1
- package/dist/src/components/Reference.d.ts +1 -1
- package/dist/src/components/Reference.d.ts.map +1 -1
- package/dist/src/components/Reference.js.map +1 -1
- package/dist/src/components/SourceDirectory.d.ts +1 -1
- package/dist/src/components/SourceDirectory.d.ts.map +1 -1
- package/dist/src/components/SourceDirectory.js.map +1 -1
- package/dist/src/components/SourceFile.d.ts.map +1 -1
- package/dist/src/components/SourceFile.js +1 -1
- package/dist/src/components/SourceFile.js.map +1 -1
- package/dist/src/components/doc/comment.js.map +1 -1
- package/dist/src/components/doc/comment.test.js.map +1 -1
- package/dist/src/components/function/function.d.ts +3 -3
- package/dist/src/components/function/function.d.ts.map +1 -1
- package/dist/src/components/function/function.js +1 -1
- package/dist/src/components/function/function.js.map +1 -1
- package/dist/src/components/function/function.test.js.map +1 -1
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/components/interface/declaration.d.ts +3 -3
- package/dist/src/components/interface/declaration.d.ts.map +1 -1
- package/dist/src/components/interface/declaration.js.map +1 -1
- package/dist/src/components/interface/interface.test.js.map +1 -1
- package/dist/src/components/package.test.js.map +1 -1
- package/dist/src/components/parameters/parameters.d.ts +1 -1
- package/dist/src/components/parameters/parameters.d.ts.map +1 -1
- package/dist/src/components/parameters/parameters.js.map +1 -1
- package/dist/src/components/parameters/typeparameters.d.ts +1 -1
- package/dist/src/components/parameters/typeparameters.d.ts.map +1 -1
- package/dist/src/components/parameters/typeparameters.js.map +1 -1
- package/dist/src/components/pointer/pointer.d.ts +1 -1
- package/dist/src/components/pointer/pointer.d.ts.map +1 -1
- package/dist/src/components/pointer/pointer.js.map +1 -1
- package/dist/src/components/stc/index.d.ts.map +1 -1
- package/dist/src/components/stc/index.js.map +1 -1
- package/dist/src/components/struct/declaration.d.ts +2 -2
- package/dist/src/components/struct/declaration.d.ts.map +1 -1
- package/dist/src/components/struct/declaration.js.map +1 -1
- package/dist/src/components/struct/struct.test.js +2 -2
- package/dist/src/components/struct/struct.test.js.map +1 -1
- package/dist/src/components/type/declaration.d.ts +3 -3
- package/dist/src/components/type/declaration.d.ts.map +1 -1
- package/dist/src/components/type/declaration.js.map +1 -1
- package/dist/src/components/var/declaration.d.ts +1 -1
- package/dist/src/components/var/declaration.d.ts.map +1 -1
- package/dist/src/components/var/declaration.js.map +1 -1
- package/dist/src/components/var/var-declaration.test.js.map +1 -1
- package/dist/src/context/package.d.ts +2 -2
- package/dist/src/context/package.d.ts.map +1 -1
- package/dist/src/context/package.js.map +1 -1
- package/dist/src/create-module.d.ts +1 -1
- package/dist/src/create-module.d.ts.map +1 -1
- package/dist/src/create-module.js.map +1 -1
- package/dist/src/create-module.test.js +1 -1
- package/dist/src/create-module.test.js.map +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/name-policy.d.ts +1 -1
- package/dist/src/name-policy.d.ts.map +1 -1
- package/dist/src/name-policy.js.map +1 -1
- package/dist/src/scopes/contexts.d.ts.map +1 -1
- package/dist/src/scopes/contexts.js.map +1 -1
- package/dist/src/scopes/factories.d.ts +2 -2
- package/dist/src/scopes/factories.d.ts.map +1 -1
- package/dist/src/scopes/factories.js.map +1 -1
- package/dist/src/scopes/function.d.ts.map +1 -1
- package/dist/src/scopes/function.js.map +1 -1
- package/dist/src/scopes/go.d.ts +3 -2
- package/dist/src/scopes/go.d.ts.map +1 -1
- package/dist/src/scopes/go.js.map +1 -1
- package/dist/src/scopes/index.js.map +1 -1
- package/dist/src/scopes/lexical.d.ts.map +1 -1
- package/dist/src/scopes/lexical.js +1 -0
- package/dist/src/scopes/lexical.js.map +1 -1
- package/dist/src/scopes/module.d.ts.map +1 -1
- package/dist/src/scopes/module.js.map +1 -1
- package/dist/src/scopes/named-type.d.ts +3 -3
- package/dist/src/scopes/named-type.d.ts.map +1 -1
- package/dist/src/scopes/named-type.js +1 -0
- package/dist/src/scopes/named-type.js.map +1 -1
- package/dist/src/scopes/package.d.ts.map +1 -1
- package/dist/src/scopes/package.js.map +1 -1
- package/dist/src/scopes/source-file.d.ts +3 -3
- package/dist/src/scopes/source-file.d.ts.map +1 -1
- package/dist/src/scopes/source-file.js.map +1 -1
- package/dist/src/symbols/factories.d.ts +5 -3
- package/dist/src/symbols/factories.d.ts.map +1 -1
- package/dist/src/symbols/factories.js.map +1 -1
- package/dist/src/symbols/function.d.ts +4 -3
- package/dist/src/symbols/function.d.ts.map +1 -1
- package/dist/src/symbols/function.js.map +1 -1
- package/dist/src/symbols/go.d.ts +3 -2
- package/dist/src/symbols/go.d.ts.map +1 -1
- package/dist/src/symbols/go.js.map +1 -1
- package/dist/src/symbols/index.js.map +1 -1
- package/dist/src/symbols/named-type.d.ts +3 -2
- package/dist/src/symbols/named-type.d.ts.map +1 -1
- package/dist/src/symbols/named-type.js.map +1 -1
- package/dist/src/symbols/package.d.ts +1 -1
- package/dist/src/symbols/package.d.ts.map +1 -1
- package/dist/src/symbols/package.js.map +1 -1
- package/dist/src/symbols/reference.d.ts +1 -1
- package/dist/src/symbols/reference.d.ts.map +1 -1
- package/dist/src/symbols/reference.js.map +1 -1
- package/dist/src/symbols/type-parameter.d.ts +3 -2
- package/dist/src/symbols/type-parameter.d.ts.map +1 -1
- package/dist/src/symbols/type-parameter.js.map +1 -1
- package/dist/test/utils.d.ts +1 -1
- package/dist/test/utils.d.ts.map +1 -1
- package/dist/test/utils.js.map +1 -1
- package/dist/test/vitest.setup.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docs/api/components/FunctionDeclaration.md +11 -11
- package/docs/api/components/FunctionParameter.md +1 -1
- package/docs/api/components/FunctionReceiver.md +6 -6
- package/docs/api/components/InterfaceDeclaration.md +5 -5
- package/docs/api/components/InterfaceEmbed.md +5 -5
- package/docs/api/components/InterfaceFunction.md +7 -7
- package/docs/api/components/InterfaceTypeDeclaration.md +12 -12
- package/docs/api/components/ModuleDirectory.md +5 -5
- package/docs/api/components/SingleImportStatement.md +7 -7
- package/docs/api/components/SourceDirectory.md +5 -5
- package/docs/api/components/SourceFile.md +8 -8
- package/docs/api/components/StructDeclaration.md +5 -5
- package/docs/api/components/StructEmbed.md +5 -5
- package/docs/api/components/StructMember.md +7 -7
- package/docs/api/components/StructTypeDeclaration.md +12 -12
- package/docs/api/components/TypeConstraint.md +4 -4
- package/docs/api/components/TypeDeclaration.md +9 -9
- package/docs/api/components/TypeParameter.md +1 -1
- package/docs/api/components/TypeParameters.md +3 -3
- package/docs/api/components/VariableDeclaration.md +8 -8
- package/docs/api/functions/createAnonymousTypeSymbol.md +3 -3
- package/docs/api/functions/createFunctionScope.md +5 -5
- package/docs/api/functions/createFunctionSymbol.md +12 -12
- package/docs/api/functions/createInterfaceMemberSymbol.md +3 -3
- package/docs/api/functions/createNamedTypeScope.md +5 -5
- package/docs/api/functions/createNestedStructSymbol.md +3 -3
- package/docs/api/functions/createParameterSymbol.md +12 -12
- package/docs/api/functions/createPropertySymbol.md +12 -12
- package/docs/api/functions/createStructMemberSymbol.md +3 -3
- package/docs/api/functions/createTypeParameterSymbol.md +3 -3
- package/docs/api/functions/createTypeSymbol.md +3 -3
- package/docs/api/functions/createVariableSymbol.md +12 -12
- package/docs/api/types/CreateTypeParameterSymbolOptions.md +3 -3
- package/docs/api/types/EmbedDescriptor.md +1 -1
- package/docs/api/types/FieldDescriptor.md +1 -1
- package/docs/api/types/FunctionDescriptor.md +1 -1
- package/docs/api/types/GoNamedTypeScope.md +1 -1
- package/docs/api/types/InterfaceDescriptor.md +1 -1
- package/docs/api/types/MemberDescriptor.md +4 -4
- package/docs/api/types/MethodDescriptor.md +1 -1
- package/docs/api/types/NamedTypeSymbolOptions.md +3 -3
- package/docs/api/types/PackageDescriptor.md +1 -1
- package/docs/api/types/SourceFileHeaderProps.md +5 -5
- package/docs/api/types/StructDescriptor.md +1 -1
- package/docs/api/types/TypeDescriptor.md +1 -1
- package/docs/api/types/VariableDescriptor.md +1 -1
- package/package.json +8 -8
- package/src/builtins/fmt/fmt.ts +2 -1
- package/src/builtins/io/io.ts +2 -1
- package/src/builtins/net/net.ts +2 -1
- package/src/builtins/time/time.ts +2 -1
- package/src/components/ImportStatement.tsx +3 -2
- package/src/components/ModuleDirectory.tsx +3 -1
- package/src/components/Reference.tsx +3 -1
- package/src/components/SourceDirectory.tsx +2 -1
- package/src/components/SourceFile.tsx +2 -1
- package/src/components/doc/comment.test.tsx +1 -0
- package/src/components/function/function.test.tsx +3 -1
- package/src/components/function/function.tsx +20 -24
- package/src/components/interface/declaration.tsx +13 -15
- package/src/components/interface/interface.test.tsx +1 -0
- package/src/components/package.test.tsx +1 -0
- package/src/components/parameters/parameters.tsx +3 -9
- package/src/components/parameters/typeparameters.tsx +3 -9
- package/src/components/pointer/pointer.tsx +1 -1
- package/src/components/stc/index.ts +1 -0
- package/src/components/struct/declaration.tsx +12 -14
- package/src/components/struct/struct.test.tsx +3 -2
- package/src/components/type/declaration.tsx +9 -8
- package/src/components/var/declaration.tsx +6 -3
- package/src/components/var/var-declaration.test.tsx +1 -0
- package/src/context/package.ts +4 -2
- package/src/create-module.test.tsx +5 -2
- package/src/create-module.ts +26 -23
- package/src/name-policy.ts +2 -1
- package/src/scopes/contexts.ts +1 -0
- package/src/scopes/factories.ts +4 -2
- package/src/scopes/function.ts +1 -0
- package/src/scopes/go.ts +4 -2
- package/src/scopes/lexical.ts +1 -0
- package/src/scopes/module.ts +3 -1
- package/src/scopes/named-type.ts +4 -3
- package/src/scopes/package.ts +3 -1
- package/src/scopes/source-file.ts +5 -9
- package/src/symbols/factories.ts +9 -5
- package/src/symbols/function.ts +6 -10
- package/src/symbols/go.ts +4 -5
- package/src/symbols/named-type.ts +4 -3
- package/src/symbols/package.ts +3 -1
- package/src/symbols/reference.ts +5 -3
- package/src/symbols/type-parameter.ts +4 -2
- package/temp/api.json +1 -1
- package/test/utils.tsx +3 -1
- package/tsdoc-metadata.json +1 -1
- package/vitest.config.ts +0 -12
|
@@ -1,19 +1,18 @@
|
|
|
1
|
+
import type { Children, Namekey, Refkey } from "@alloy-js/core";
|
|
1
2
|
import {
|
|
2
3
|
Block,
|
|
3
|
-
Children,
|
|
4
4
|
Declaration,
|
|
5
5
|
DeclarationContext,
|
|
6
6
|
effect,
|
|
7
7
|
For,
|
|
8
8
|
memo,
|
|
9
|
-
Namekey,
|
|
10
|
-
Refkey,
|
|
11
9
|
Scope,
|
|
12
10
|
Show,
|
|
13
11
|
takeSymbols,
|
|
14
12
|
useContext,
|
|
15
13
|
watch,
|
|
16
14
|
} from "@alloy-js/core";
|
|
15
|
+
|
|
17
16
|
import { useGoScope, useNamedTypeScope } from "../../scopes/contexts.js";
|
|
18
17
|
import {
|
|
19
18
|
createFunctionScope,
|
|
@@ -24,15 +23,14 @@ import {
|
|
|
24
23
|
createAnonymousTypeSymbol,
|
|
25
24
|
createInterfaceMemberSymbol,
|
|
26
25
|
} from "../../symbols/factories.js";
|
|
27
|
-
import { GoSymbol } from "../../symbols/go.js";
|
|
28
|
-
import { NamedTypeSymbol } from "../../symbols/named-type.js";
|
|
26
|
+
import type { GoSymbol } from "../../symbols/go.js";
|
|
27
|
+
import type { NamedTypeSymbol } from "../../symbols/named-type.js";
|
|
29
28
|
import { LineComment } from "../doc/comment.js";
|
|
30
29
|
import { Name } from "../Name.js";
|
|
31
|
-
import {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
} from "../
|
|
35
|
-
import { TypeDeclaration, TypeDeclarationProps } from "../type/declaration.jsx";
|
|
30
|
+
import type { FunctionParameterProps } from "../parameters/parameters.js";
|
|
31
|
+
import { FunctionParameters } from "../parameters/parameters.js";
|
|
32
|
+
import type { TypeDeclarationProps } from "../type/declaration.jsx";
|
|
33
|
+
import { TypeDeclaration } from "../type/declaration.jsx";
|
|
36
34
|
|
|
37
35
|
/**
|
|
38
36
|
* Properties for creating an interface declaration.
|
|
@@ -135,9 +133,11 @@ export function InterfaceDeclaration(props: InterfaceDeclarationProps) {
|
|
|
135
133
|
return (
|
|
136
134
|
<>
|
|
137
135
|
interface
|
|
138
|
-
{interfaceScope ?
|
|
136
|
+
{interfaceScope ? (
|
|
139
137
|
<Scope value={interfaceScope}>{content}</Scope>
|
|
140
|
-
:
|
|
138
|
+
) : (
|
|
139
|
+
content
|
|
140
|
+
)}
|
|
141
141
|
</>
|
|
142
142
|
);
|
|
143
143
|
}
|
|
@@ -166,9 +166,7 @@ export function InterfaceFunction(props: InterfaceFunctionProps) {
|
|
|
166
166
|
</Show>
|
|
167
167
|
func <Name />
|
|
168
168
|
<FunctionParameters parameters={props.parameters} />
|
|
169
|
-
{props.returns ?
|
|
170
|
-
<> {props.returns}</>
|
|
171
|
-
: null}
|
|
169
|
+
{props.returns ? <> {props.returns}</> : null}
|
|
172
170
|
</Scope>
|
|
173
171
|
</Declaration>
|
|
174
172
|
);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { List, Output, refkey } from "@alloy-js/core";
|
|
2
2
|
import { describe, expect, it } from "vitest";
|
|
3
|
+
|
|
3
4
|
import { TestPackage } from "../../../test/utils.js";
|
|
4
5
|
import { ModuleDirectory } from "../ModuleDirectory.jsx";
|
|
5
6
|
import { SourceDirectory } from "../SourceDirectory.jsx";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Output } from "@alloy-js/core";
|
|
2
2
|
import { d } from "@alloy-js/core/testing";
|
|
3
3
|
import { expect, it } from "vitest";
|
|
4
|
+
|
|
4
5
|
import { ModuleDirectory } from "./ModuleDirectory.jsx";
|
|
5
6
|
import { SourceDirectory } from "./SourceDirectory.jsx";
|
|
6
7
|
import { SourceFile } from "./SourceFile.jsx";
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Declaration,
|
|
5
|
-
For,
|
|
6
|
-
Indent,
|
|
7
|
-
Namekey,
|
|
8
|
-
Refkey,
|
|
9
|
-
} from "@alloy-js/core";
|
|
1
|
+
import type { Children, Namekey, Refkey } from "@alloy-js/core";
|
|
2
|
+
import { createSymbolSlot, Declaration, For, Indent } from "@alloy-js/core";
|
|
3
|
+
|
|
10
4
|
import { createParameterSymbol } from "../../symbols/factories.js";
|
|
11
5
|
import { Name } from "../Name.jsx";
|
|
12
6
|
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Indent,
|
|
5
|
-
MemberDeclaration,
|
|
6
|
-
MemberName,
|
|
7
|
-
Namekey,
|
|
8
|
-
Refkey,
|
|
9
|
-
} from "@alloy-js/core";
|
|
1
|
+
import type { Children, Namekey, Refkey } from "@alloy-js/core";
|
|
2
|
+
import { For, Indent, MemberDeclaration, MemberName } from "@alloy-js/core";
|
|
3
|
+
|
|
10
4
|
import { createTypeParameterSymbol } from "../../symbols/factories.js";
|
|
11
5
|
|
|
12
6
|
/**
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
+
import type { Children, Namekey, Refkey } from "@alloy-js/core";
|
|
1
2
|
import {
|
|
2
3
|
Block,
|
|
3
|
-
Children,
|
|
4
4
|
computed,
|
|
5
5
|
Declaration,
|
|
6
6
|
DeclarationContext,
|
|
7
7
|
effect,
|
|
8
8
|
memo,
|
|
9
|
-
Namekey,
|
|
10
|
-
Refkey,
|
|
11
9
|
Scope,
|
|
12
10
|
Show,
|
|
13
11
|
takeSymbols,
|
|
@@ -15,6 +13,7 @@ import {
|
|
|
15
13
|
useContext,
|
|
16
14
|
watch,
|
|
17
15
|
} from "@alloy-js/core";
|
|
16
|
+
|
|
18
17
|
import { useGoScope, useNamedTypeScope } from "../../scopes/contexts.js";
|
|
19
18
|
import { createNamedTypeScope } from "../../scopes/factories.js";
|
|
20
19
|
import { GoNamedTypeScope } from "../../scopes/named-type.js";
|
|
@@ -22,11 +21,12 @@ import {
|
|
|
22
21
|
createAnonymousTypeSymbol,
|
|
23
22
|
createStructMemberSymbol,
|
|
24
23
|
} from "../../symbols/factories.js";
|
|
25
|
-
import { GoSymbol } from "../../symbols/go.js";
|
|
26
|
-
import { NamedTypeSymbol } from "../../symbols/named-type.js";
|
|
24
|
+
import type { GoSymbol } from "../../symbols/go.js";
|
|
25
|
+
import type { NamedTypeSymbol } from "../../symbols/named-type.js";
|
|
27
26
|
import { LineComment } from "../doc/comment.js";
|
|
28
27
|
import { Name } from "../Name.js";
|
|
29
|
-
import {
|
|
28
|
+
import type { TypeDeclarationProps } from "../type/declaration.jsx";
|
|
29
|
+
import { TypeDeclaration } from "../type/declaration.jsx";
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* Properties for creating a struct declaration.
|
|
@@ -129,9 +129,7 @@ export function StructDeclaration(props: StructDeclarationProps) {
|
|
|
129
129
|
return (
|
|
130
130
|
<>
|
|
131
131
|
struct
|
|
132
|
-
{structScope ?
|
|
133
|
-
<Scope value={structScope}>{content}</Scope>
|
|
134
|
-
: content}
|
|
132
|
+
{structScope ? <Scope value={structScope}>{content}</Scope> : content}
|
|
135
133
|
</>
|
|
136
134
|
);
|
|
137
135
|
}
|
|
@@ -169,11 +167,11 @@ export function StructMember(props: StructMemberProps) {
|
|
|
169
167
|
<hbr />
|
|
170
168
|
</Show>
|
|
171
169
|
<Name /> {props.type}
|
|
172
|
-
{tagString.value === ""
|
|
173
|
-
""
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
170
|
+
{tagString.value === ""
|
|
171
|
+
? ""
|
|
172
|
+
: tagString.value.includes('"')
|
|
173
|
+
? ` \`${tagString.value}\``
|
|
174
|
+
: ` "${tagString.value}"`}
|
|
177
175
|
</Declaration>
|
|
178
176
|
);
|
|
179
177
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { List, Output, refkey } from "@alloy-js/core";
|
|
2
2
|
import { describe, expect, it } from "vitest";
|
|
3
|
+
|
|
3
4
|
import { TestPackage } from "../../../test/utils.js";
|
|
5
|
+
import { TypeConstraint } from "../interface/declaration.jsx";
|
|
4
6
|
import { ModuleDirectory } from "../ModuleDirectory.js";
|
|
7
|
+
import { Pointer } from "../pointer/pointer.js";
|
|
5
8
|
import { SourceDirectory } from "../SourceDirectory.js";
|
|
6
9
|
import { SourceFile } from "../SourceFile.js";
|
|
7
|
-
import { TypeConstraint } from "../interface/declaration.jsx";
|
|
8
|
-
import { Pointer } from "../pointer/pointer.js";
|
|
9
10
|
import { TypeDeclaration } from "../type/declaration.js";
|
|
10
11
|
import {
|
|
11
12
|
StructDeclaration,
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
Children,
|
|
3
3
|
ComponentContext,
|
|
4
|
+
Namekey,
|
|
5
|
+
Refkey,
|
|
6
|
+
} from "@alloy-js/core";
|
|
7
|
+
import {
|
|
4
8
|
createContext,
|
|
5
9
|
createSymbol,
|
|
6
10
|
Declaration,
|
|
7
11
|
Indent,
|
|
8
12
|
List,
|
|
9
13
|
Name,
|
|
10
|
-
Namekey,
|
|
11
|
-
Refkey,
|
|
12
14
|
Scope,
|
|
13
15
|
Show,
|
|
14
16
|
useContext,
|
|
15
17
|
} from "@alloy-js/core";
|
|
18
|
+
|
|
16
19
|
import { createNamedTypeScope } from "../../scopes/factories.js";
|
|
17
20
|
import { createTypeSymbol } from "../../symbols/factories.js";
|
|
18
|
-
import { NamedTypeSymbol } from "../../symbols/named-type.js";
|
|
21
|
+
import type { NamedTypeSymbol } from "../../symbols/named-type.js";
|
|
19
22
|
import { TypeParameterSymbol } from "../../symbols/type-parameter.js";
|
|
20
23
|
import { LineComment } from "../doc/comment.js";
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
TypeParameters,
|
|
24
|
-
} from "../parameters/typeparameters.jsx";
|
|
24
|
+
import type { TypeParameterProps } from "../parameters/typeparameters.jsx";
|
|
25
|
+
import { TypeParameters } from "../parameters/typeparameters.jsx";
|
|
25
26
|
|
|
26
27
|
export interface TypeDeclarationGroupProps {
|
|
27
28
|
children: Children;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
Children,
|
|
3
3
|
ComponentContext,
|
|
4
|
+
Namekey,
|
|
5
|
+
Refkey,
|
|
6
|
+
} from "@alloy-js/core";
|
|
7
|
+
import {
|
|
4
8
|
computed,
|
|
5
9
|
createContext,
|
|
6
10
|
Declaration,
|
|
@@ -8,11 +12,10 @@ import {
|
|
|
8
12
|
List,
|
|
9
13
|
memo,
|
|
10
14
|
Name,
|
|
11
|
-
Namekey,
|
|
12
|
-
Refkey,
|
|
13
15
|
Show,
|
|
14
16
|
useContext,
|
|
15
17
|
} from "@alloy-js/core";
|
|
18
|
+
|
|
16
19
|
import { useGoScope } from "../../scopes/contexts.js";
|
|
17
20
|
import { GoSourceFileScope } from "../../scopes/source-file.js";
|
|
18
21
|
import { createVariableSymbol } from "../../symbols/factories.js";
|
package/src/context/package.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { ComponentContext
|
|
2
|
-
import {
|
|
1
|
+
import type { ComponentContext } from "@alloy-js/core";
|
|
2
|
+
import { createContext, useContext } from "@alloy-js/core";
|
|
3
|
+
|
|
4
|
+
import type { PackageSymbol } from "../symbols/package.js";
|
|
3
5
|
|
|
4
6
|
interface PackageContext {
|
|
5
7
|
symbol: PackageSymbol;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { TestPackage } from "#test/utils.jsx";
|
|
2
1
|
import { namekey, toRefkey } from "@alloy-js/core";
|
|
3
2
|
import { expect, it } from "vitest";
|
|
3
|
+
|
|
4
|
+
import { TestPackage } from "#test/utils.jsx";
|
|
5
|
+
|
|
4
6
|
import { fmt } from "./builtins/fmt/fmt.js";
|
|
5
7
|
import { VariableDeclaration } from "./components/index.js";
|
|
6
|
-
import {
|
|
8
|
+
import type { StrictDescriptor } from "./create-module.js";
|
|
9
|
+
import { createModule } from "./create-module.js";
|
|
7
10
|
|
|
8
11
|
it("Can reference types which haven't been created yet", () => {
|
|
9
12
|
const std1 = createModule("std1", {
|
package/src/create-module.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import type { Binder, LibrarySymbolReference } from "@alloy-js/core";
|
|
1
2
|
import {
|
|
2
|
-
Binder,
|
|
3
3
|
createSymbol,
|
|
4
|
-
LibrarySymbolReference,
|
|
5
4
|
namekey,
|
|
6
5
|
refkey,
|
|
7
6
|
REFKEYABLE,
|
|
@@ -9,6 +8,7 @@ import {
|
|
|
9
8
|
useBinder,
|
|
10
9
|
} from "@alloy-js/core";
|
|
11
10
|
import { basename } from "pathe";
|
|
11
|
+
|
|
12
12
|
import { FunctionSymbol, GoSymbol, PackageSymbol } from "./index.js";
|
|
13
13
|
import { NamedTypeSymbol } from "./symbols/named-type.js";
|
|
14
14
|
|
|
@@ -92,9 +92,9 @@ export type StrictDescriptor =
|
|
|
92
92
|
| EmbedDescriptor;
|
|
93
93
|
|
|
94
94
|
export type ResolveDescriptor<D> =
|
|
95
|
-
D extends NamedTypeDescriptor<infer M>
|
|
96
|
-
LibrarySymbolReference & { [K in keyof M]: ResolveDescriptor<M[K]> }
|
|
97
|
-
|
|
95
|
+
D extends NamedTypeDescriptor<infer M>
|
|
96
|
+
? LibrarySymbolReference & { [K in keyof M]: ResolveDescriptor<M[K]> }
|
|
97
|
+
: LibrarySymbolReference;
|
|
98
98
|
|
|
99
99
|
export type LibraryFrom<T> = ResolveDescriptor<T> & LibrarySymbolReference;
|
|
100
100
|
|
|
@@ -258,17 +258,18 @@ function createSymbolFromDescriptor(
|
|
|
258
258
|
NamedTypeSymbol,
|
|
259
259
|
namekey(name),
|
|
260
260
|
ownerSymbol.members,
|
|
261
|
-
ownerSymbol.typeKind === "interface"
|
|
262
|
-
"interface-member"
|
|
263
|
-
|
|
261
|
+
ownerSymbol.typeKind === "interface"
|
|
262
|
+
? "interface-member"
|
|
263
|
+
: "struct-member",
|
|
264
264
|
{
|
|
265
265
|
binder,
|
|
266
266
|
refkeys: refkey(),
|
|
267
267
|
type:
|
|
268
|
-
descriptor.type === undefined
|
|
269
|
-
|
|
270
|
-
descriptor.type
|
|
271
|
-
|
|
268
|
+
descriptor.type === undefined
|
|
269
|
+
? undefined
|
|
270
|
+
: typeof descriptor.type === "function"
|
|
271
|
+
? descriptor.type()[TO_SYMBOL]()
|
|
272
|
+
: descriptor.type[TO_SYMBOL](),
|
|
272
273
|
lazyMemberInitializer,
|
|
273
274
|
},
|
|
274
275
|
);
|
|
@@ -282,17 +283,18 @@ function createSymbolFromDescriptor(
|
|
|
282
283
|
NamedTypeSymbol,
|
|
283
284
|
namekey(name),
|
|
284
285
|
ownerSymbol.members,
|
|
285
|
-
ownerSymbol.typeKind === "interface"
|
|
286
|
-
"interface-member"
|
|
287
|
-
|
|
286
|
+
ownerSymbol.typeKind === "interface"
|
|
287
|
+
? "interface-member"
|
|
288
|
+
: "struct-member",
|
|
288
289
|
{
|
|
289
290
|
binder,
|
|
290
291
|
refkeys: refkey(),
|
|
291
292
|
type:
|
|
292
|
-
descriptor.type === undefined
|
|
293
|
-
|
|
294
|
-
descriptor.type
|
|
295
|
-
|
|
293
|
+
descriptor.type === undefined
|
|
294
|
+
? undefined
|
|
295
|
+
: typeof descriptor.type === "function"
|
|
296
|
+
? descriptor.type()[TO_SYMBOL]()
|
|
297
|
+
: descriptor.type[TO_SYMBOL](),
|
|
296
298
|
lazyMemberInitializer,
|
|
297
299
|
},
|
|
298
300
|
);
|
|
@@ -309,10 +311,11 @@ function createSymbolFromDescriptor(
|
|
|
309
311
|
binder,
|
|
310
312
|
refkeys: refkey(),
|
|
311
313
|
type:
|
|
312
|
-
descriptor.type === undefined
|
|
313
|
-
|
|
314
|
-
descriptor.type
|
|
315
|
-
|
|
314
|
+
descriptor.type === undefined
|
|
315
|
+
? undefined
|
|
316
|
+
: typeof descriptor.type === "function"
|
|
317
|
+
? descriptor.type()[TO_SYMBOL]()
|
|
318
|
+
: descriptor.type[TO_SYMBOL](),
|
|
316
319
|
});
|
|
317
320
|
default:
|
|
318
321
|
throw "Unsupported";
|
package/src/name-policy.ts
CHANGED
package/src/scopes/contexts.ts
CHANGED
package/src/scopes/factories.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { OutputScopeOptions
|
|
2
|
-
import {
|
|
1
|
+
import type { OutputScopeOptions } from "@alloy-js/core";
|
|
2
|
+
import { createScope } from "@alloy-js/core";
|
|
3
|
+
|
|
4
|
+
import type { NamedTypeSymbol } from "../symbols/named-type.js";
|
|
3
5
|
import { useGoScope } from "./contexts.js";
|
|
4
6
|
import { GoFunctionScope } from "./function.js";
|
|
5
7
|
import { GoNamedTypeScope } from "./named-type.js";
|
package/src/scopes/function.ts
CHANGED
package/src/scopes/go.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { OutputScopeOptions } from "@alloy-js/core";
|
|
2
|
+
import { OutputScope } from "@alloy-js/core";
|
|
3
|
+
|
|
4
|
+
import type { PackageSymbol } from "../symbols/package.js";
|
|
3
5
|
|
|
4
6
|
export class GoScope extends OutputScope {
|
|
5
7
|
constructor(
|
package/src/scopes/lexical.ts
CHANGED
package/src/scopes/module.ts
CHANGED
package/src/scopes/named-type.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type OutputScopeOptions } from "@alloy-js/core";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import type { NamedTypeSymbol } from "../symbols/named-type.js";
|
|
3
4
|
import { GoScope } from "./go.js";
|
|
4
|
-
import { GoModuleScope } from "./module.js";
|
|
5
|
-
import { GoSourceFileScope } from "./source-file.js";
|
|
5
|
+
import type { GoModuleScope } from "./module.js";
|
|
6
|
+
import type { GoSourceFileScope } from "./source-file.js";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* This scope contains NamedTypeSymbols for types that are declared in
|
package/src/scopes/package.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { OutputScope
|
|
1
|
+
import type { OutputScope } from "@alloy-js/core";
|
|
2
|
+
import { createScope, useScope } from "@alloy-js/core";
|
|
3
|
+
|
|
2
4
|
import type { PackageSymbol } from "../symbols/package.js";
|
|
3
5
|
import { GoModuleScope } from "./module.js";
|
|
4
6
|
import { GoNamedTypeScope } from "./named-type.js";
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
createSymbol,
|
|
5
|
-
shallowReactive,
|
|
6
|
-
useScope,
|
|
7
|
-
} from "@alloy-js/core";
|
|
1
|
+
import type { OutputScope, OutputScopeOptions } from "@alloy-js/core";
|
|
2
|
+
import { createSymbol, shallowReactive, useScope } from "@alloy-js/core";
|
|
3
|
+
|
|
8
4
|
import { GoSymbol } from "../symbols/go.js";
|
|
9
|
-
import { PackageSymbol } from "../symbols/package.js";
|
|
5
|
+
import type { PackageSymbol } from "../symbols/package.js";
|
|
10
6
|
import { GoLexicalScope } from "./lexical.js";
|
|
11
|
-
import { GoPackageScope } from "./package.js";
|
|
7
|
+
import type { GoPackageScope } from "./package.js";
|
|
12
8
|
|
|
13
9
|
export type ImportRecords = Map<PackageSymbol, GoSymbol>;
|
|
14
10
|
|
package/src/symbols/factories.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Namekey, NamePolicyGetter } from "@alloy-js/core";
|
|
2
|
+
import { createSymbol } from "@alloy-js/core";
|
|
2
3
|
import { join } from "pathe";
|
|
3
|
-
|
|
4
|
+
|
|
5
|
+
import type { GoElements } from "../name-policy.js";
|
|
6
|
+
import { useGoNamePolicy } from "../name-policy.js";
|
|
4
7
|
import { useGoScope, useNamedTypeScope } from "../scopes/contexts.js";
|
|
5
8
|
import { GoFunctionScope } from "../scopes/function.js";
|
|
6
9
|
import { GoLexicalScope } from "../scopes/lexical.js";
|
|
@@ -8,12 +11,13 @@ import { useModule } from "../scopes/module.js";
|
|
|
8
11
|
import { GoNamedTypeScope } from "../scopes/named-type.js";
|
|
9
12
|
import { useEnclosingPackageScope } from "../scopes/package.js";
|
|
10
13
|
import { FunctionSymbol } from "./function.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
+
import type { GoSymbolOptions } from "./go.js";
|
|
15
|
+
import { GoSymbol } from "./go.js";
|
|
16
|
+
import type {
|
|
14
17
|
NamedTypeSymbolOptions,
|
|
15
18
|
NamedTypeTypeKind,
|
|
16
19
|
} from "./named-type.js";
|
|
20
|
+
import { NamedTypeSymbol } from "./named-type.js";
|
|
17
21
|
import { PackageSymbol } from "./package.js";
|
|
18
22
|
|
|
19
23
|
/**
|
package/src/symbols/function.ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
TriggerOpTypes,
|
|
8
|
-
} from "@alloy-js/core";
|
|
9
|
-
import { GoSymbol, GoSymbolOptions } from "./go.js";
|
|
10
|
-
import { NamedTypeSymbol } from "./named-type.js";
|
|
1
|
+
import type { Namekey, OutputSpace } from "@alloy-js/core";
|
|
2
|
+
import { track, TrackOpTypes, trigger, TriggerOpTypes } from "@alloy-js/core";
|
|
3
|
+
|
|
4
|
+
import type { GoSymbolOptions } from "./go.js";
|
|
5
|
+
import { GoSymbol } from "./go.js";
|
|
6
|
+
import type { NamedTypeSymbol } from "./named-type.js";
|
|
11
7
|
|
|
12
8
|
/**
|
|
13
9
|
* A symbol for a function in Go, including receivers.
|
package/src/symbols/go.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
+
import type { Namekey, OutputSpace, OutputSymbolOptions } from "@alloy-js/core";
|
|
1
2
|
import {
|
|
2
|
-
Namekey,
|
|
3
3
|
OutputDeclarationSpace,
|
|
4
4
|
OutputMemberSpace,
|
|
5
|
-
OutputSpace,
|
|
6
5
|
OutputSymbol,
|
|
7
|
-
OutputSymbolOptions,
|
|
8
6
|
createSymbol,
|
|
9
7
|
} from "@alloy-js/core";
|
|
10
|
-
|
|
11
|
-
import {
|
|
8
|
+
|
|
9
|
+
import type { GoScope } from "../scopes/go.js";
|
|
10
|
+
import type { PackageSymbol } from "./package.js";
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
13
|
* Options for creating a Go symbol.
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import type { Namekey, OutputSpace } from "@alloy-js/core";
|
|
1
2
|
import {
|
|
2
3
|
createSymbol,
|
|
3
|
-
Namekey,
|
|
4
|
-
OutputSpace,
|
|
5
4
|
track,
|
|
6
5
|
TrackOpTypes,
|
|
7
6
|
trigger,
|
|
8
7
|
TriggerOpTypes,
|
|
9
8
|
} from "@alloy-js/core";
|
|
10
|
-
|
|
9
|
+
|
|
10
|
+
import type { GoSymbolOptions } from "./go.js";
|
|
11
|
+
import { GoSymbol } from "./go.js";
|
|
11
12
|
|
|
12
13
|
// represents a symbol from a .go file. Struct, interface, etc.
|
|
13
14
|
export type NamedTypeTypeKind =
|
package/src/symbols/package.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { OutputSymbolOptions
|
|
1
|
+
import type { OutputSymbolOptions } from "@alloy-js/core";
|
|
2
|
+
import { createSymbol } from "@alloy-js/core";
|
|
2
3
|
import { join } from "pathe";
|
|
4
|
+
|
|
3
5
|
import { NamedTypeSymbol } from "./named-type.js";
|
|
4
6
|
|
|
5
7
|
export interface PackageSymbolOptions extends OutputSymbolOptions {
|
package/src/symbols/reference.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { OutputSymbol, Refkey } from "@alloy-js/core";
|
|
2
|
+
import { memo, resolve } from "@alloy-js/core";
|
|
3
|
+
|
|
4
|
+
import type { GoScope } from "../scopes/go.js";
|
|
3
5
|
import { GoPackageScope } from "../scopes/package.js";
|
|
4
6
|
import { useSourceFileScope } from "../scopes/source-file.js";
|
|
5
|
-
import { GoSymbol } from "./go.js";
|
|
7
|
+
import type { GoSymbol } from "./go.js";
|
|
6
8
|
import { PackageSymbol } from "./package.js";
|
|
7
9
|
|
|
8
10
|
function closestPackageScope(
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { Children, Namekey, OutputSpace } from "@alloy-js/core";
|
|
2
|
-
|
|
1
|
+
import type { Children, Namekey, OutputSpace } from "@alloy-js/core";
|
|
2
|
+
|
|
3
|
+
import type { GoSymbolOptions } from "./go.js";
|
|
4
|
+
import { GoSymbol } from "./go.js";
|
|
3
5
|
|
|
4
6
|
interface TypeParameterSymbolOptions extends GoSymbolOptions {
|
|
5
7
|
constraint?: Children;
|