@seamapi/nextlove-sdk-generator 1.4.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/LICENSE.txt +20 -0
- package/README.md +16 -0
- package/index.d.ts +6 -0
- package/index.js +7 -0
- package/index.js.map +1 -0
- package/lib/cli.d.ts +2 -0
- package/lib/cli.js +53 -0
- package/lib/cli.js.map +1 -0
- package/lib/fs-util/index.d.ts +2 -0
- package/lib/fs-util/index.js +3 -0
- package/lib/fs-util/index.js.map +1 -0
- package/lib/fs-util/populate-fs.d.ts +1 -0
- package/lib/fs-util/populate-fs.js +11 -0
- package/lib/fs-util/populate-fs.js.map +1 -0
- package/lib/fs-util/write-fs.d.ts +1 -0
- package/lib/fs-util/write-fs.js +10 -0
- package/lib/fs-util/write-fs.js.map +1 -0
- package/lib/generate-csharp-sdk/codegen.d.ts +235 -0
- package/lib/generate-csharp-sdk/codegen.js +432 -0
- package/lib/generate-csharp-sdk/codegen.js.map +1 -0
- package/lib/generate-csharp-sdk/constants.d.ts +1 -0
- package/lib/generate-csharp-sdk/constants.js +2 -0
- package/lib/generate-csharp-sdk/constants.js.map +1 -0
- package/lib/generate-csharp-sdk/generate-csharp-sdk.d.ts +1 -0
- package/lib/generate-csharp-sdk/generate-csharp-sdk.js +81 -0
- package/lib/generate-csharp-sdk/generate-csharp-sdk.js.map +1 -0
- package/lib/generate-csharp-sdk/generate-csproj.d.ts +1 -0
- package/lib/generate-csharp-sdk/generate-csproj.js +45 -0
- package/lib/generate-csharp-sdk/generate-csproj.js.map +1 -0
- package/lib/generate-csharp-sdk/templates/dataclass.d.ts +24 -0
- package/lib/generate-csharp-sdk/templates/dataclass.js +468 -0
- package/lib/generate-csharp-sdk/templates/dataclass.js.map +1 -0
- package/lib/generate-csharp-sdk/templates/fs/csharp-testing.sln +34 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/ApiResponse.cs +159 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/ClientUtils.cs +280 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/ExceptionFactory.cs +12 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/GlobalSeamRequestConfiguration.cs +60 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/HttpMethod.cs +29 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/IAsynchronousSeam.cs +142 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/IReadableSeamRequestConfiguration.cs +68 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/ISynchronousSeam.cs +103 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/Multimap.cs +286 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/RequestOptions.cs +74 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/RetryConfiguration.cs +21 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/Seam.cs +1070 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/SeamException.cs +64 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/SeamRequestConfiguration.cs +662 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Model/AsbtractModelSchema.cs +62 -0
- package/lib/generate-php-sdk/generate-php-sdk.d.ts +1 -0
- package/lib/generate-php-sdk/generate-php-sdk.js +127 -0
- package/lib/generate-php-sdk/generate-php-sdk.js.map +1 -0
- package/lib/generate-php-sdk/index.d.ts +1 -0
- package/lib/generate-php-sdk/index.js +2 -0
- package/lib/generate-php-sdk/index.js.map +1 -0
- package/lib/generate-php-sdk/templates/composer.json.template.d.ts +2 -0
- package/lib/generate-php-sdk/templates/composer.json.template.js +25 -0
- package/lib/generate-php-sdk/templates/composer.json.template.js.map +1 -0
- package/lib/generate-php-sdk/templates/env.example.template.d.ts +2 -0
- package/lib/generate-php-sdk/templates/env.example.template.js +4 -0
- package/lib/generate-php-sdk/templates/env.example.template.js.map +1 -0
- package/lib/generate-php-sdk/templates/gitignore.template.d.ts +2 -0
- package/lib/generate-php-sdk/templates/gitignore.template.js +6 -0
- package/lib/generate-php-sdk/templates/gitignore.template.js.map +1 -0
- package/lib/generate-php-sdk/templates/package.json.template.d.ts +2 -0
- package/lib/generate-php-sdk/templates/package.json.template.js +12 -0
- package/lib/generate-php-sdk/templates/package.json.template.js.map +1 -0
- package/lib/generate-php-sdk/templates/readme.md.template.d.ts +2 -0
- package/lib/generate-php-sdk/templates/readme.md.template.js +86 -0
- package/lib/generate-php-sdk/templates/readme.md.template.js.map +1 -0
- package/lib/generate-php-sdk/templates/smoke-test.template.d.ts +2 -0
- package/lib/generate-php-sdk/templates/smoke-test.template.js +30 -0
- package/lib/generate-php-sdk/templates/smoke-test.template.js.map +1 -0
- package/lib/generate-php-sdk/templates/test-fixture.template.d.ts +2 -0
- package/lib/generate-php-sdk/templates/test-fixture.template.js +21 -0
- package/lib/generate-php-sdk/templates/test-fixture.template.js.map +1 -0
- package/lib/generate-php-sdk/utils/deep-extract-resource-object-schemas.d.ts +16 -0
- package/lib/generate-php-sdk/utils/deep-extract-resource-object-schemas.js +97 -0
- package/lib/generate-php-sdk/utils/deep-extract-resource-object-schemas.js.map +1 -0
- package/lib/generate-php-sdk/utils/deep-flatten-one-of-and-all-of-schema.d.ts +2 -0
- package/lib/generate-php-sdk/utils/deep-flatten-one-of-and-all-of-schema.js +95 -0
- package/lib/generate-php-sdk/utils/deep-flatten-one-of-and-all-of-schema.js.map +1 -0
- package/lib/generate-php-sdk/utils/generate-resource-object-class.d.ts +8 -0
- package/lib/generate-php-sdk/utils/generate-resource-object-class.js +73 -0
- package/lib/generate-php-sdk/utils/generate-resource-object-class.js.map +1 -0
- package/lib/generate-php-sdk/utils/generate-seam-client.d.ts +7 -0
- package/lib/generate-php-sdk/utils/generate-seam-client.js +103 -0
- package/lib/generate-php-sdk/utils/generate-seam-client.js.map +1 -0
- package/lib/generate-php-sdk/utils/get-php-type.d.ts +1 -0
- package/lib/generate-php-sdk/utils/get-php-type.js +17 -0
- package/lib/generate-php-sdk/utils/get-php-type.js.map +1 -0
- package/lib/generate-php-sdk/utils/php-client.d.ts +31 -0
- package/lib/generate-php-sdk/utils/php-client.js +130 -0
- package/lib/generate-php-sdk/utils/php-client.js.map +1 -0
- package/lib/generate-python-sdk/class-file.d.ts +20 -0
- package/lib/generate-python-sdk/class-file.js +75 -0
- package/lib/generate-python-sdk/class-file.js.map +1 -0
- package/lib/generate-python-sdk/generate-python-sdk.d.ts +1 -0
- package/lib/generate-python-sdk/generate-python-sdk.js +117 -0
- package/lib/generate-python-sdk/generate-python-sdk.js.map +1 -0
- package/lib/generate-python-sdk/index.d.ts +1 -0
- package/lib/generate-python-sdk/index.js +2 -0
- package/lib/generate-python-sdk/index.js.map +1 -0
- package/lib/generate-python-sdk/map-python-type.d.ts +2 -0
- package/lib/generate-python-sdk/map-python-type.js +26 -0
- package/lib/generate-python-sdk/map-python-type.js.map +1 -0
- package/lib/generate-python-sdk/templates/conftest.py.template.d.ts +2 -0
- package/lib/generate-python-sdk/templates/conftest.py.template.js +12 -0
- package/lib/generate-python-sdk/templates/conftest.py.template.js.map +1 -0
- package/lib/generate-python-sdk/templates/pyproject.toml.template.d.ts +2 -0
- package/lib/generate-python-sdk/templates/pyproject.toml.template.js +21 -0
- package/lib/generate-python-sdk/templates/pyproject.toml.template.js.map +1 -0
- package/lib/generate-python-sdk/templates/readme.md.template.d.ts +2 -0
- package/lib/generate-python-sdk/templates/readme.md.template.js +48 -0
- package/lib/generate-python-sdk/templates/readme.md.template.js.map +1 -0
- package/lib/generate-python-sdk/templates/routes.py.template.d.ts +2 -0
- package/lib/generate-python-sdk/templates/routes.py.template.js +13 -0
- package/lib/generate-python-sdk/templates/routes.py.template.js.map +1 -0
- package/lib/generate-python-sdk/templates/seam.py.template.d.ts +2 -0
- package/lib/generate-python-sdk/templates/seam.py.template.js +74 -0
- package/lib/generate-python-sdk/templates/seam.py.template.js.map +1 -0
- package/lib/generate-python-sdk/templates/snippets/abstract-routes.template.d.ts +2 -0
- package/lib/generate-python-sdk/templates/snippets/abstract-routes.template.js +9 -0
- package/lib/generate-python-sdk/templates/snippets/abstract-routes.template.js.map +1 -0
- package/lib/generate-python-sdk/templates/snippets/abstract-seam.template.d.ts +2 -0
- package/lib/generate-python-sdk/templates/snippets/abstract-seam.template.js +9 -0
- package/lib/generate-python-sdk/templates/snippets/abstract-seam.template.js.map +1 -0
- package/lib/generate-python-sdk/templates/snippets/resource-dataclass.template.d.ts +5 -0
- package/lib/generate-python-sdk/templates/snippets/resource-dataclass.template.js +10 -0
- package/lib/generate-python-sdk/templates/snippets/resource-dataclass.template.js.map +1 -0
- package/lib/generate-python-sdk/templates/test_smoke.py.template.d.ts +2 -0
- package/lib/generate-python-sdk/templates/test_smoke.py.template.js +13 -0
- package/lib/generate-python-sdk/templates/test_smoke.py.template.js.map +1 -0
- package/lib/generate-python-sdk/templates/utils/deep_attr_dict.py.template.d.ts +2 -0
- package/lib/generate-python-sdk/templates/utils/deep_attr_dict.py.template.js +28 -0
- package/lib/generate-python-sdk/templates/utils/deep_attr_dict.py.template.js.map +1 -0
- package/lib/generate-ruby-sdk/generate-ruby-sdk.d.ts +1 -0
- package/lib/generate-ruby-sdk/generate-ruby-sdk.js +132 -0
- package/lib/generate-ruby-sdk/generate-ruby-sdk.js.map +1 -0
- package/lib/generate-ruby-sdk/index.d.ts +1 -0
- package/lib/generate-ruby-sdk/index.js +2 -0
- package/lib/generate-ruby-sdk/index.js.map +1 -0
- package/lib/generate-ruby-sdk/request.rb.template.d.ts +1 -0
- package/lib/generate-ruby-sdk/request.rb.template.js +2 -0
- package/lib/generate-ruby-sdk/request.rb.template.js.map +1 -0
- package/lib/generate-ruby-sdk/ruby-client.d.ts +35 -0
- package/lib/generate-ruby-sdk/ruby-client.js +59 -0
- package/lib/generate-ruby-sdk/ruby-client.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/base_client.rb.template.d.ts +2 -0
- package/lib/generate-ruby-sdk/templates/base_client.rb.template.js +22 -0
- package/lib/generate-ruby-sdk/templates/base_client.rb.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/base_resource.rb.template.d.ts +2 -0
- package/lib/generate-ruby-sdk/templates/base_resource.rb.template.js +59 -0
- package/lib/generate-ruby-sdk/templates/base_resource.rb.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/client.rb.template.d.ts +2 -0
- package/lib/generate-ruby-sdk/templates/client.rb.template.js +74 -0
- package/lib/generate-ruby-sdk/templates/client.rb.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/gemfile.template.d.ts +2 -0
- package/lib/generate-ruby-sdk/templates/gemfile.template.js +7 -0
- package/lib/generate-ruby-sdk/templates/gemfile.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/logger.rb.template.d.ts +2 -0
- package/lib/generate-ruby-sdk/templates/logger.rb.template.js +13 -0
- package/lib/generate-ruby-sdk/templates/logger.rb.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/rakefile.template.d.ts +2 -0
- package/lib/generate-ruby-sdk/templates/rakefile.template.js +23 -0
- package/lib/generate-ruby-sdk/templates/rakefile.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/readme.md.template.d.ts +2 -0
- package/lib/generate-ruby-sdk/templates/readme.md.template.js +184 -0
- package/lib/generate-ruby-sdk/templates/readme.md.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/request.rb.template.d.ts +2 -0
- package/lib/generate-ruby-sdk/templates/request.rb.template.js +71 -0
- package/lib/generate-ruby-sdk/templates/request.rb.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/resource_error.rb.template.d.ts +2 -0
- package/lib/generate-ruby-sdk/templates/resource_error.rb.template.js +8 -0
- package/lib/generate-ruby-sdk/templates/resource_error.rb.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/resource_errors_support.rb.template.d.ts +2 -0
- package/lib/generate-ruby-sdk/templates/resource_errors_support.rb.template.js +10 -0
- package/lib/generate-ruby-sdk/templates/resource_errors_support.rb.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/resource_warning.rb.template.d.ts +2 -0
- package/lib/generate-ruby-sdk/templates/resource_warning.rb.template.js +8 -0
- package/lib/generate-ruby-sdk/templates/resource_warning.rb.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/resource_warnings_support.rb.template.d.ts +2 -0
- package/lib/generate-ruby-sdk/templates/resource_warnings_support.rb.template.js +10 -0
- package/lib/generate-ruby-sdk/templates/resource_warnings_support.rb.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/seamapi.gemspec.template.d.ts +2 -0
- package/lib/generate-ruby-sdk/templates/seamapi.gemspec.template.js +41 -0
- package/lib/generate-ruby-sdk/templates/seamapi.gemspec.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/snippets/resource.rb.template.d.ts +6 -0
- package/lib/generate-ruby-sdk/templates/snippets/resource.rb.template.js +15 -0
- package/lib/generate-ruby-sdk/templates/snippets/resource.rb.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/version.rb.template.d.ts +2 -0
- package/lib/generate-ruby-sdk/templates/version.rb.template.js +6 -0
- package/lib/generate-ruby-sdk/templates/version.rb.template.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -0
- package/lib/openapi/flatten-obj-schema.d.ts +5 -0
- package/lib/openapi/flatten-obj-schema.js +86 -0
- package/lib/openapi/flatten-obj-schema.js.map +1 -0
- package/lib/openapi/get-parameter-and-response-schema.d.ts +20 -0
- package/lib/openapi/get-parameter-and-response-schema.js +42 -0
- package/lib/openapi/get-parameter-and-response-schema.js.map +1 -0
- package/lib/openapi/index.d.ts +2 -0
- package/lib/openapi/index.js +3 -0
- package/lib/openapi/index.js.map +1 -0
- package/lib/types.d.ts +91 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/package.json +95 -0
- package/src/index.ts +6 -0
- package/src/lib/cli.ts +71 -0
- package/src/lib/fs-util/index.ts +2 -0
- package/src/lib/fs-util/populate-fs.ts +14 -0
- package/src/lib/fs-util/write-fs.ts +10 -0
- package/src/lib/generate-csharp-sdk/codegen.ts +648 -0
- package/src/lib/generate-csharp-sdk/constants.ts +1 -0
- package/src/lib/generate-csharp-sdk/generate-csharp-sdk.ts +126 -0
- package/src/lib/generate-csharp-sdk/generate-csproj.ts +45 -0
- package/src/lib/generate-csharp-sdk/templates/dataclass.ts +973 -0
- package/src/lib/generate-csharp-sdk/templates/fs/csharp-testing.sln +34 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/ApiResponse.cs +159 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/ClientUtils.cs +280 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/ExceptionFactory.cs +12 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/GlobalSeamRequestConfiguration.cs +60 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/HttpMethod.cs +29 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/IAsynchronousSeam.cs +142 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/IReadableSeamRequestConfiguration.cs +68 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/ISynchronousSeam.cs +103 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/Multimap.cs +286 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/RequestOptions.cs +74 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/RetryConfiguration.cs +21 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/Seam.cs +1070 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/SeamException.cs +64 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/SeamRequestConfiguration.cs +662 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Model/AsbtractModelSchema.cs +62 -0
- package/src/lib/generate-php-sdk/generate-php-sdk.ts +176 -0
- package/src/lib/generate-php-sdk/index.ts +1 -0
- package/src/lib/generate-php-sdk/templates/composer.json.template.ts +24 -0
- package/src/lib/generate-php-sdk/templates/env.example.template.ts +3 -0
- package/src/lib/generate-php-sdk/templates/gitignore.template.ts +5 -0
- package/src/lib/generate-php-sdk/templates/package.json.template.ts +11 -0
- package/src/lib/generate-php-sdk/templates/readme.md.template.ts +85 -0
- package/src/lib/generate-php-sdk/templates/smoke-test.template.ts +29 -0
- package/src/lib/generate-php-sdk/templates/test-fixture.template.ts +20 -0
- package/src/lib/generate-php-sdk/utils/deep-extract-resource-object-schemas.ts +160 -0
- package/src/lib/generate-php-sdk/utils/deep-flatten-one-of-and-all-of-schema.ts +128 -0
- package/src/lib/generate-php-sdk/utils/generate-resource-object-class.ts +105 -0
- package/src/lib/generate-php-sdk/utils/generate-seam-client.ts +115 -0
- package/src/lib/generate-php-sdk/utils/get-php-type.ts +21 -0
- package/src/lib/generate-php-sdk/utils/php-client.ts +189 -0
- package/src/lib/generate-python-sdk/class-file.ts +114 -0
- package/src/lib/generate-python-sdk/generate-python-sdk.ts +147 -0
- package/src/lib/generate-python-sdk/index.ts +1 -0
- package/src/lib/generate-python-sdk/map-python-type.ts +29 -0
- package/src/lib/generate-python-sdk/templates/conftest.py.template.ts +11 -0
- package/src/lib/generate-python-sdk/templates/pyproject.toml.template.ts +20 -0
- package/src/lib/generate-python-sdk/templates/readme.md.template.ts +47 -0
- package/src/lib/generate-python-sdk/templates/routes.py.template.ts +13 -0
- package/src/lib/generate-python-sdk/templates/seam.py.template.ts +73 -0
- package/src/lib/generate-python-sdk/templates/snippets/abstract-routes.template.ts +9 -0
- package/src/lib/generate-python-sdk/templates/snippets/abstract-seam.template.ts +8 -0
- package/src/lib/generate-python-sdk/templates/snippets/resource-dataclass.template.ts +15 -0
- package/src/lib/generate-python-sdk/templates/test_smoke.py.template.ts +12 -0
- package/src/lib/generate-python-sdk/templates/utils/deep_attr_dict.py.template.ts +27 -0
- package/src/lib/generate-ruby-sdk/generate-ruby-sdk.ts +153 -0
- package/src/lib/generate-ruby-sdk/index.ts +1 -0
- package/src/lib/generate-ruby-sdk/request.rb.template.ts +0 -0
- package/src/lib/generate-ruby-sdk/ruby-client.ts +81 -0
- package/src/lib/generate-ruby-sdk/templates/base_client.rb.template.ts +21 -0
- package/src/lib/generate-ruby-sdk/templates/base_resource.rb.template.ts +58 -0
- package/src/lib/generate-ruby-sdk/templates/client.rb.template.ts +73 -0
- package/src/lib/generate-ruby-sdk/templates/gemfile.template.ts +6 -0
- package/src/lib/generate-ruby-sdk/templates/logger.rb.template.ts +12 -0
- package/src/lib/generate-ruby-sdk/templates/rakefile.template.ts +22 -0
- package/src/lib/generate-ruby-sdk/templates/readme.md.template.ts +183 -0
- package/src/lib/generate-ruby-sdk/templates/request.rb.template.ts +70 -0
- package/src/lib/generate-ruby-sdk/templates/resource_error.rb.template.ts +7 -0
- package/src/lib/generate-ruby-sdk/templates/resource_errors_support.rb.template.ts +9 -0
- package/src/lib/generate-ruby-sdk/templates/resource_warning.rb.template.ts +7 -0
- package/src/lib/generate-ruby-sdk/templates/resource_warnings_support.rb.template.ts +9 -0
- package/src/lib/generate-ruby-sdk/templates/seamapi.gemspec.template.ts +40 -0
- package/src/lib/generate-ruby-sdk/templates/snippets/resource.rb.template.ts +24 -0
- package/src/lib/generate-ruby-sdk/templates/version.rb.template.ts +5 -0
- package/src/lib/index.ts +2 -0
- package/src/lib/openapi/flatten-obj-schema.ts +124 -0
- package/src/lib/openapi/get-parameter-and-response-schema.ts +59 -0
- package/src/lib/openapi/index.ts +2 -0
- package/src/lib/types.ts +96 -0
|
@@ -0,0 +1,648 @@
|
|
|
1
|
+
import os from "os"
|
|
2
|
+
|
|
3
|
+
export type CSharpNamespace = string[]
|
|
4
|
+
|
|
5
|
+
class CompilerCtx {
|
|
6
|
+
public tabSize = 4
|
|
7
|
+
public eol = os.EOL
|
|
8
|
+
|
|
9
|
+
indent() {
|
|
10
|
+
return " ".repeat(this.tabSize)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
withIndent(serialized: string) {
|
|
14
|
+
return serialized
|
|
15
|
+
.split(this.eol)
|
|
16
|
+
.map((l) => (l.trim() ? this.indent() + l : ""))
|
|
17
|
+
.join(this.eol)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
combineWords(...words: (string | undefined)[]) {
|
|
21
|
+
return words.filter((x) => Boolean(x)).join(" ")
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
combineStatements(...statements: (string | undefined)[]) {
|
|
25
|
+
return statements.filter((x) => Boolean(x)).join(this.eol)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
combineNodes(...nodes: (CSharpNode | undefined)[]) {
|
|
29
|
+
return this.combineWords(...nodes.map((n) => n?.serialize(this)))
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
combineAdjacent(...nodes: (CSharpNode | undefined)[]) {
|
|
33
|
+
return nodes
|
|
34
|
+
.filter((x) => Boolean(x))
|
|
35
|
+
.map((n) => n?.serialize(this))
|
|
36
|
+
.join("")
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
serializeNamespace(namespace: CSharpNamespace) {
|
|
40
|
+
return namespace.join(".")
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
abstract class CSharpNode {
|
|
45
|
+
abstract serialize(ctx: CompilerCtx): string
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
abstract class Statement extends CSharpNode {
|
|
49
|
+
constructor(private includeSemicolon: boolean) {
|
|
50
|
+
super()
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
serialize(ctx: CompilerCtx): string {
|
|
54
|
+
return this.serializeStatement(ctx) + (this.includeSemicolon ? ";" : "")
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
abstract serializeStatement(ctx: CompilerCtx): string
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
class StatementBlock extends Statement {
|
|
61
|
+
constructor(public statements: Statement[]) {
|
|
62
|
+
super(false)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
serializeStatement(ctx: CompilerCtx): string {
|
|
66
|
+
return this.statements.map((s) => s.serialize(ctx)).join(ctx.eol)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
class CSharpFile extends Statement {
|
|
71
|
+
constructor(public statements: StatementBlock[]) {
|
|
72
|
+
super(false)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
serializeStatement(ctx: CompilerCtx): string {
|
|
76
|
+
return this.statements.map((n) => n.serialize(ctx)).join(ctx.eol.repeat(2))
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
class CurlyBlock extends Statement {
|
|
81
|
+
constructor(
|
|
82
|
+
public statements: StatementBlock[],
|
|
83
|
+
public separator?: string
|
|
84
|
+
) {
|
|
85
|
+
super(false)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
serializeStatement(ctx: CompilerCtx): string {
|
|
89
|
+
const { eol } = ctx
|
|
90
|
+
|
|
91
|
+
return `{${eol}${ctx.withIndent(
|
|
92
|
+
this.statements
|
|
93
|
+
.map((s) => s.serialize(ctx))
|
|
94
|
+
.join((this.separator ?? "") + eol.repeat(2))
|
|
95
|
+
)}${eol}}`
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
class CurlyBlockWithNode<T extends CSharpNode> extends CurlyBlock {
|
|
100
|
+
constructor(
|
|
101
|
+
public declaration: T,
|
|
102
|
+
statements: StatementBlock[],
|
|
103
|
+
separator?: string
|
|
104
|
+
) {
|
|
105
|
+
super(statements, separator)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
override serialize(ctx: CompilerCtx): string {
|
|
109
|
+
return [this.declaration.serialize(ctx), super.serialize(ctx)].join(ctx.eol)
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
class UsingStatement extends Statement {
|
|
114
|
+
constructor(public namespace: CSharpNamespace) {
|
|
115
|
+
super(true)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
serializeStatement(ctx: CompilerCtx): string {
|
|
119
|
+
return ctx.combineWords("using", ctx.serializeNamespace(this.namespace))
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
class NamespaceNode extends CSharpNode {
|
|
124
|
+
constructor(public namespace: CSharpNamespace) {
|
|
125
|
+
super()
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
serialize(ctx: CompilerCtx): string {
|
|
129
|
+
return ctx.combineNodes(
|
|
130
|
+
new SyntaxNode("namespace"),
|
|
131
|
+
new AccessChain(this.namespace.map((n) => new TokenNode(n)))
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
class VisibilityModifiers extends CSharpNode {
|
|
137
|
+
constructor(
|
|
138
|
+
public visibility: (
|
|
139
|
+
| "public"
|
|
140
|
+
| "private"
|
|
141
|
+
| "protected"
|
|
142
|
+
| "internal"
|
|
143
|
+
| "async"
|
|
144
|
+
| "partial"
|
|
145
|
+
| "virtual"
|
|
146
|
+
| "override"
|
|
147
|
+
| "abstract"
|
|
148
|
+
)[]
|
|
149
|
+
) {
|
|
150
|
+
super()
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
serialize(_ctx: CompilerCtx): string {
|
|
154
|
+
return this.visibility.join(" ")
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
class ClassDeclarationSpecifier extends CSharpNode {
|
|
159
|
+
constructor(
|
|
160
|
+
public name: TokenNode,
|
|
161
|
+
public base?: string,
|
|
162
|
+
public modifiers?: VisibilityModifiers,
|
|
163
|
+
public classToken: TokenNode = new TokenNode("class")
|
|
164
|
+
) {
|
|
165
|
+
super()
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
serialize(ctx: CompilerCtx): string {
|
|
169
|
+
const base = this.base ? ` : ${this.base}` : ""
|
|
170
|
+
|
|
171
|
+
return ctx.combineWords(
|
|
172
|
+
this.modifiers?.serialize(ctx),
|
|
173
|
+
`${this.classToken.serialize(ctx)} ${this.name.serialize(ctx)}${base}`
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
class EnumDeclarationSpecifier extends CSharpNode {
|
|
179
|
+
constructor(
|
|
180
|
+
public name: TokenNode,
|
|
181
|
+
public modifiers?: VisibilityModifiers
|
|
182
|
+
) {
|
|
183
|
+
super()
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
serialize(ctx: CompilerCtx): string {
|
|
187
|
+
return ctx.combineNodes(this.modifiers, new TokenNode("enum"), this.name)
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
class Class extends CurlyBlockWithNode<ClassDeclarationSpecifier> {}
|
|
192
|
+
|
|
193
|
+
class Enum extends CurlyBlockWithNode<EnumDeclarationSpecifier> {
|
|
194
|
+
constructor(
|
|
195
|
+
public override declaration: EnumDeclarationSpecifier,
|
|
196
|
+
statements: StatementBlock[]
|
|
197
|
+
) {
|
|
198
|
+
super(declaration, statements, ",")
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
class RawNode extends CSharpNode {
|
|
203
|
+
constructor(public raw: string) {
|
|
204
|
+
super()
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
serialize(): string {
|
|
208
|
+
return this.raw
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
class CompositeNode extends CSharpNode {
|
|
213
|
+
constructor(public nodes: CSharpNode[]) {
|
|
214
|
+
super()
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
serialize(ctx: CompilerCtx): string {
|
|
218
|
+
return ctx.combineNodes(...this.nodes)
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
class NodeStatement extends Statement {
|
|
223
|
+
constructor(
|
|
224
|
+
public node: CSharpNode,
|
|
225
|
+
includeSemicolon = true
|
|
226
|
+
) {
|
|
227
|
+
super(includeSemicolon)
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
serializeStatement(ctx: CompilerCtx): string {
|
|
231
|
+
return this.node.serialize(ctx)
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
class RawStatement extends Statement {
|
|
236
|
+
constructor(
|
|
237
|
+
public raw: string,
|
|
238
|
+
includeSemicolon = true
|
|
239
|
+
) {
|
|
240
|
+
super(includeSemicolon)
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
serializeStatement(): string {
|
|
244
|
+
return this.raw
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
class AnnotatedStatement<T extends Statement> extends Statement {
|
|
249
|
+
static getPropertyList(properties: Record<string, CSharpNode | undefined>) {
|
|
250
|
+
return Object.entries(properties).map(([property_name, value]) =>
|
|
251
|
+
value
|
|
252
|
+
? new AssignNode(new TokenNode(property_name), value)
|
|
253
|
+
: new TokenNode(property_name)
|
|
254
|
+
)
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
constructor(
|
|
258
|
+
public annotation: string,
|
|
259
|
+
public annotated: T,
|
|
260
|
+
public properties?: CSharpNode[]
|
|
261
|
+
) {
|
|
262
|
+
super(false)
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
serializeStatement(ctx: CompilerCtx): string {
|
|
266
|
+
const props = this.properties
|
|
267
|
+
? `(${this.properties.map((p) => p.serialize(ctx)).join(", ")})`
|
|
268
|
+
: ""
|
|
269
|
+
|
|
270
|
+
return [`[${this.annotation}${props}]`, this.annotated.serialize(ctx)].join(
|
|
271
|
+
ctx.eol
|
|
272
|
+
)
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
class Literal extends CSharpNode {
|
|
277
|
+
constructor(public value: any) {
|
|
278
|
+
super()
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
serialize(): string {
|
|
282
|
+
switch (typeof this.value) {
|
|
283
|
+
case "string":
|
|
284
|
+
return `"${this.value}"`
|
|
285
|
+
case "number":
|
|
286
|
+
return this.value.toString()
|
|
287
|
+
case "boolean":
|
|
288
|
+
return this.value ? "true" : "false"
|
|
289
|
+
default:
|
|
290
|
+
if (typeof this.value === "object" && this.value === null) return "null"
|
|
291
|
+
|
|
292
|
+
throw new Error(`Unknown literal type: ${typeof this.value}`)
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const RESERVED_TOKENS = ["event"]
|
|
298
|
+
|
|
299
|
+
class TokenNode extends CSharpNode {
|
|
300
|
+
static readonly TYPE_STRING = new TokenNode("string")
|
|
301
|
+
static readonly TYPE_INT = new TokenNode("int")
|
|
302
|
+
static readonly TYPE_FLOAT = new TokenNode("float")
|
|
303
|
+
static readonly TYPE_BOOLEAN = new TokenNode("bool")
|
|
304
|
+
static readonly TYPE_OBJECT = new TokenNode("object")
|
|
305
|
+
static readonly TYPE_OBJECT_CLASS = new TokenNode("Object")
|
|
306
|
+
static readonly TYPE_JOBJECT = new TokenNode("JObject")
|
|
307
|
+
|
|
308
|
+
constructor(
|
|
309
|
+
public token: string,
|
|
310
|
+
isReserved = false
|
|
311
|
+
) {
|
|
312
|
+
if (!isReserved && RESERVED_TOKENS.includes(token)) {
|
|
313
|
+
token += "_"
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
super()
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
serialize(_: CompilerCtx): string {
|
|
320
|
+
return this.token
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
class TokenNodeGeneric extends TokenNode {
|
|
325
|
+
constructor(
|
|
326
|
+
public override token: string,
|
|
327
|
+
public generics: TypeNode[]
|
|
328
|
+
) {
|
|
329
|
+
super(token)
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
override serialize(ctx: CompilerCtx): string {
|
|
333
|
+
return `${super.serialize(ctx)}<${this.generics
|
|
334
|
+
.map((g) => g.serialize(ctx))
|
|
335
|
+
.join(", ")}>`
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
class TypeArgumentsNode extends CSharpNode {
|
|
340
|
+
constructor(public generics: TypeNode[]) {
|
|
341
|
+
super()
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
serialize(ctx: CompilerCtx): string {
|
|
345
|
+
return `<${this.generics.map((g) => g.serialize(ctx)).join(", ")}>`
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
class FunctionArgumentsNode extends CSharpNode {
|
|
350
|
+
constructor(public args: CSharpNode[]) {
|
|
351
|
+
super()
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
serialize(ctx: CompilerCtx): string {
|
|
355
|
+
return `(${this.args.map((a) => a.serialize(ctx)).join(", ")})`
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
class TokenNodeApplyFunction extends CSharpNode {
|
|
360
|
+
constructor(
|
|
361
|
+
public token: CSharpNode,
|
|
362
|
+
public args: CSharpNode[],
|
|
363
|
+
public typeArguments?: TypeArgumentsNode
|
|
364
|
+
) {
|
|
365
|
+
super()
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
serialize(ctx: CompilerCtx): string {
|
|
369
|
+
return ctx.combineAdjacent(
|
|
370
|
+
this.token,
|
|
371
|
+
this.typeArguments,
|
|
372
|
+
new FunctionArgumentsNode(this.args)
|
|
373
|
+
)
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
class ApplyConstructorNode extends TokenNodeApplyFunction {
|
|
378
|
+
constructor(
|
|
379
|
+
public override token: TokenNode,
|
|
380
|
+
public override args: CSharpNode[],
|
|
381
|
+
public override typeArguments?: TypeArgumentsNode
|
|
382
|
+
) {
|
|
383
|
+
super(token, args, typeArguments)
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
override serialize(ctx: CompilerCtx): string {
|
|
387
|
+
return `new ${super.serialize(ctx)}`
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
class ReturnStatement extends Statement {
|
|
392
|
+
constructor(public value: CSharpNode) {
|
|
393
|
+
super(true)
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
serializeStatement(ctx: CompilerCtx): string {
|
|
397
|
+
return ctx.combineWords("return", this.value.serialize(ctx))
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
class SyntaxNode extends CSharpNode {
|
|
402
|
+
constructor(public syntax: string) {
|
|
403
|
+
super()
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
serialize(_: CompilerCtx): string {
|
|
407
|
+
return this.syntax
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
class TypeNode extends CSharpNode {
|
|
412
|
+
constructor(
|
|
413
|
+
public type: CSharpNode,
|
|
414
|
+
public nullable = false,
|
|
415
|
+
public generics?: TypeArgumentsNode
|
|
416
|
+
) {
|
|
417
|
+
super()
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
serialize(ctx: CompilerCtx): string {
|
|
421
|
+
return ctx.combineAdjacent(
|
|
422
|
+
this.type,
|
|
423
|
+
this.nullable ? new SyntaxNode("?") : undefined,
|
|
424
|
+
this.generics
|
|
425
|
+
)
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
class AccessChain extends CSharpNode {
|
|
430
|
+
constructor(public nodes: CSharpNode[]) {
|
|
431
|
+
super()
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
serialize(ctx: CompilerCtx): string {
|
|
435
|
+
return this.nodes.map((n) => n.serialize(ctx)).join(".")
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
abstract class AbstractFieldDeclaration<
|
|
440
|
+
Token extends CSharpNode,
|
|
441
|
+
Body extends Statement | undefined,
|
|
442
|
+
Rhs extends CSharpNode = CSharpNode,
|
|
443
|
+
> extends Statement {
|
|
444
|
+
constructor(
|
|
445
|
+
public type: TypeNode | undefined,
|
|
446
|
+
public token: Token,
|
|
447
|
+
public body: Body,
|
|
448
|
+
public visibility?: VisibilityModifiers,
|
|
449
|
+
public rhs?: Rhs
|
|
450
|
+
) {
|
|
451
|
+
super(!body || !!rhs)
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
serializeStatement(ctx: CompilerCtx): string {
|
|
455
|
+
return ctx.combineWords(
|
|
456
|
+
this.visibility?.serialize(ctx),
|
|
457
|
+
this.type?.serialize(ctx),
|
|
458
|
+
this.token.serialize(ctx),
|
|
459
|
+
this.body?.serialize(ctx),
|
|
460
|
+
...(this.rhs ? ["=", this.rhs.serialize(ctx)] : [])
|
|
461
|
+
)
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
class FieldDeclaration extends AbstractFieldDeclaration<TokenNode, undefined> {}
|
|
466
|
+
|
|
467
|
+
class ParameterNode extends CSharpNode {
|
|
468
|
+
constructor(
|
|
469
|
+
public type: TypeNode,
|
|
470
|
+
public name: TokenNode,
|
|
471
|
+
public defaultValue?: CSharpNode
|
|
472
|
+
) {
|
|
473
|
+
if (!type) {
|
|
474
|
+
throw new Error("wut?")
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
super()
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
serialize(ctx: CompilerCtx): string {
|
|
481
|
+
return ctx.combineWords(
|
|
482
|
+
this.type.serialize(ctx),
|
|
483
|
+
this.name.serialize(ctx),
|
|
484
|
+
...(this.defaultValue ? ["=", this.defaultValue.serialize(ctx)] : [])
|
|
485
|
+
)
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
class MethodNode extends CSharpNode {
|
|
490
|
+
// TODO: generics
|
|
491
|
+
constructor(
|
|
492
|
+
public name: TokenNode,
|
|
493
|
+
public parameters?: ParameterNode[]
|
|
494
|
+
) {
|
|
495
|
+
super()
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
serialize(ctx: CompilerCtx): string {
|
|
499
|
+
const parametersSerialized = this.parameters
|
|
500
|
+
? `(${this.parameters.map((p) => p.serialize(ctx)).join(", ")})`
|
|
501
|
+
: ""
|
|
502
|
+
return `${this.name.serialize(ctx)}${parametersSerialized}`
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
class MethodDeclaration extends AbstractFieldDeclaration<
|
|
507
|
+
MethodNode,
|
|
508
|
+
CurlyBlock | undefined
|
|
509
|
+
> {}
|
|
510
|
+
|
|
511
|
+
class PropertyMethods extends Statement {
|
|
512
|
+
constructor(
|
|
513
|
+
public get?: {
|
|
514
|
+
statements?: StatementBlock[]
|
|
515
|
+
visibility?: VisibilityModifiers
|
|
516
|
+
},
|
|
517
|
+
public set?: {
|
|
518
|
+
statements?: StatementBlock[]
|
|
519
|
+
visibility?: VisibilityModifiers
|
|
520
|
+
}
|
|
521
|
+
) {
|
|
522
|
+
super(false)
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
serializeStatement(ctx: CompilerCtx): string {
|
|
526
|
+
const statements: Statement[] = []
|
|
527
|
+
|
|
528
|
+
if (this.get) {
|
|
529
|
+
const getMethod = new MethodDeclaration(
|
|
530
|
+
undefined,
|
|
531
|
+
new MethodNode(new TokenNode("get")),
|
|
532
|
+
this.get.statements ? new CurlyBlock(this.get.statements) : undefined,
|
|
533
|
+
this.get.visibility
|
|
534
|
+
)
|
|
535
|
+
|
|
536
|
+
statements.push(getMethod)
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
if (this.set) {
|
|
540
|
+
const setMethod = new MethodDeclaration(
|
|
541
|
+
undefined,
|
|
542
|
+
new MethodNode(new TokenNode("set")),
|
|
543
|
+
this.set.statements ? new CurlyBlock(this.set.statements) : undefined,
|
|
544
|
+
this.set.visibility
|
|
545
|
+
)
|
|
546
|
+
|
|
547
|
+
statements.push(setMethod)
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
return new CurlyBlock([new StatementBlock(statements)]).serialize(ctx)
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
class PropertyDeclaration extends AbstractFieldDeclaration<
|
|
555
|
+
TokenNode,
|
|
556
|
+
PropertyMethods
|
|
557
|
+
> {}
|
|
558
|
+
|
|
559
|
+
class AssignNode<
|
|
560
|
+
LHS extends CSharpNode,
|
|
561
|
+
RHS extends CSharpNode,
|
|
562
|
+
> extends CSharpNode {
|
|
563
|
+
constructor(
|
|
564
|
+
public lhs: LHS,
|
|
565
|
+
public rhs: RHS,
|
|
566
|
+
public operation: "=" = "="
|
|
567
|
+
) {
|
|
568
|
+
super()
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
serialize(ctx: CompilerCtx): string {
|
|
572
|
+
return ctx.combineNodes(this.lhs, new SyntaxNode(this.operation), this.rhs)
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
class AssignStatement<
|
|
577
|
+
LHS extends CSharpNode,
|
|
578
|
+
RHS extends CSharpNode,
|
|
579
|
+
> extends Statement {
|
|
580
|
+
constructor(
|
|
581
|
+
public lhs: LHS,
|
|
582
|
+
public rhs: RHS,
|
|
583
|
+
includeSemicolon = true,
|
|
584
|
+
public operation: "=" = "="
|
|
585
|
+
) {
|
|
586
|
+
super(includeSemicolon)
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
serializeStatement(ctx: CompilerCtx): string {
|
|
590
|
+
return new AssignNode(this.lhs, this.rhs, this.operation).serialize(ctx)
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
class AwaitNode extends CompositeNode {
|
|
595
|
+
constructor(public node: CSharpNode) {
|
|
596
|
+
super([new TokenNode("await"), node])
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
class ParanthesisNode extends CompositeNode {
|
|
601
|
+
constructor(public node: CSharpNode) {
|
|
602
|
+
super([new TokenNode("("), node, new TokenNode(")")])
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
class NamespaceBlock extends CurlyBlockWithNode<NamespaceNode> {}
|
|
607
|
+
|
|
608
|
+
export {
|
|
609
|
+
RawNode,
|
|
610
|
+
RawStatement,
|
|
611
|
+
CSharpFile,
|
|
612
|
+
CurlyBlock,
|
|
613
|
+
CurlyBlockWithNode,
|
|
614
|
+
UsingStatement,
|
|
615
|
+
ClassDeclarationSpecifier,
|
|
616
|
+
Class,
|
|
617
|
+
StatementBlock,
|
|
618
|
+
AnnotatedStatement,
|
|
619
|
+
Literal,
|
|
620
|
+
VisibilityModifiers,
|
|
621
|
+
CompilerCtx,
|
|
622
|
+
FieldDeclaration,
|
|
623
|
+
TokenNode,
|
|
624
|
+
PropertyDeclaration,
|
|
625
|
+
MethodDeclaration,
|
|
626
|
+
MethodNode,
|
|
627
|
+
TypeNode,
|
|
628
|
+
PropertyMethods,
|
|
629
|
+
TokenNodeGeneric,
|
|
630
|
+
ParameterNode,
|
|
631
|
+
AssignStatement,
|
|
632
|
+
Statement,
|
|
633
|
+
EnumDeclarationSpecifier,
|
|
634
|
+
AssignNode,
|
|
635
|
+
Enum,
|
|
636
|
+
TokenNodeApplyFunction,
|
|
637
|
+
TypeArgumentsNode,
|
|
638
|
+
ReturnStatement,
|
|
639
|
+
ApplyConstructorNode,
|
|
640
|
+
AccessChain,
|
|
641
|
+
CompositeNode,
|
|
642
|
+
NamespaceBlock,
|
|
643
|
+
NamespaceNode,
|
|
644
|
+
AwaitNode,
|
|
645
|
+
ParanthesisNode,
|
|
646
|
+
CSharpNode,
|
|
647
|
+
NodeStatement,
|
|
648
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const GLOBAL_NAMESPACE = ["Seam"]
|