typia 13.0.0-dev.20260430 → 13.0.0-dev.20260502-2
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/lib/executable/TypiaGenerateWizard.js +55 -8
- package/lib/executable/TypiaGenerateWizard.js.map +1 -1
- package/lib/executable/TypiaGenerateWizard2.mjs +55 -8
- package/lib/executable/TypiaGenerateWizard2.mjs.map +1 -1
- package/lib/executable/generate/ttsc.js.map +1 -1
- package/lib/executable/setup/PluginConfigurator.js.map +1 -1
- package/lib/internal/_randomInteger.js.map +1 -1
- package/lib/internal/_validateReport.js.map +1 -1
- package/lib/transform.d.ts +2 -13
- package/lib/transform.js +4 -11
- package/lib/transform.js.map +1 -1
- package/lib/transform2.mjs +6 -14
- package/lib/transform2.mjs.map +1 -1
- package/native/adapter/adapter.go +128 -128
- package/native/adapter/cleanup.go +155 -172
- package/native/adapter/imports.go +80 -80
- package/native/adapter/visit.go +142 -142
- package/native/cmd/ttsc-typia/build.go +223 -223
- package/native/cmd/ttsc-typia/main.go +57 -57
- package/native/cmd/ttsc-typia/transform.go +421 -254
- package/native/cmd/ttsc-typia/transform_test.go +40 -0
- package/native/core/context/IProgrammerProps.go +7 -7
- package/native/core/context/ITransformOptions.go +5 -5
- package/native/core/context/ITypiaContext.go +13 -13
- package/native/core/context/TransformerError.go +81 -81
- package/native/core/factories/CommentFactory.go +9 -9
- package/native/core/factories/ExpressionFactory.go +254 -254
- package/native/core/factories/FormatCheatSheet.go +23 -23
- package/native/core/factories/IdentifierFactory.go +130 -130
- package/native/core/factories/JsonMetadataFactory.go +129 -129
- package/native/core/factories/LiteralFactory.go +195 -182
- package/native/core/factories/MetadataCommentTagFactory.go +379 -379
- package/native/core/factories/MetadataFactory.go +462 -462
- package/native/core/factories/MetadataTypeTagFactory.go +498 -498
- package/native/core/factories/MetadataTypeTagSchemaFactory.go +102 -102
- package/native/core/factories/NumericRangeFactory.go +84 -84
- package/native/core/factories/ProtobufFactory.go +933 -933
- package/native/core/factories/StatementFactory.go +72 -72
- package/native/core/factories/TemplateFactory.go +57 -57
- package/native/core/factories/TypeFactory.go +125 -125
- package/native/core/factories/ValueFactory.go +12 -12
- package/native/core/factories/internal/metadata/IMetadataIteratorProps.go +35 -35
- package/native/core/factories/internal/metadata/MetadataHelper.go +176 -176
- package/native/core/factories/internal/metadata/emend_metadata_atomics.go +69 -69
- package/native/core/factories/internal/metadata/emplace_metadata_alias.go +27 -27
- package/native/core/factories/internal/metadata/emplace_metadata_array_type.go +33 -33
- package/native/core/factories/internal/metadata/emplace_metadata_object.go +209 -209
- package/native/core/factories/internal/metadata/emplace_metadata_tuple.go +50 -50
- package/native/core/factories/internal/metadata/explore_metadata.go +29 -29
- package/native/core/factories/internal/metadata/iterate_metadata.go +46 -46
- package/native/core/factories/internal/metadata/iterate_metadata_alias.go +25 -25
- package/native/core/factories/internal/metadata/iterate_metadata_array.go +65 -65
- package/native/core/factories/internal/metadata/iterate_metadata_atomic.go +49 -49
- package/native/core/factories/internal/metadata/iterate_metadata_coalesce.go +22 -22
- package/native/core/factories/internal/metadata/iterate_metadata_collection.go +228 -228
- package/native/core/factories/internal/metadata/iterate_metadata_comment_tags.go +12 -12
- package/native/core/factories/internal/metadata/iterate_metadata_constant.go +71 -71
- package/native/core/factories/internal/metadata/iterate_metadata_escape.go +48 -48
- package/native/core/factories/internal/metadata/iterate_metadata_function.go +82 -82
- package/native/core/factories/internal/metadata/iterate_metadata_intersection.go +319 -319
- package/native/core/factories/internal/metadata/iterate_metadata_map.go +51 -51
- package/native/core/factories/internal/metadata/iterate_metadata_native.go +85 -85
- package/native/core/factories/internal/metadata/iterate_metadata_object.go +27 -27
- package/native/core/factories/internal/metadata/iterate_metadata_set.go +37 -37
- package/native/core/factories/internal/metadata/iterate_metadata_sort.go +137 -137
- package/native/core/factories/internal/metadata/iterate_metadata_template.go +33 -33
- package/native/core/factories/internal/metadata/iterate_metadata_tuple.go +16 -16
- package/native/core/factories/internal/metadata/iterate_metadata_union.go +18 -18
- package/native/core/programmers/AssertProgrammer.go +389 -389
- package/native/core/programmers/ImportProgrammer.go +196 -196
- package/native/core/programmers/IsProgrammer.go +293 -293
- package/native/core/programmers/RandomProgrammer.go +1094 -1094
- package/native/core/programmers/ValidateProgrammer.go +369 -369
- package/native/core/programmers/functional/FunctionalAssertFunctionProgrammer.go +133 -133
- package/native/core/programmers/functional/FunctionalAssertParametersProgrammer.go +104 -104
- package/native/core/programmers/functional/FunctionalAssertReturnProgrammer.go +100 -100
- package/native/core/programmers/functional/FunctionalIsFunctionProgrammer.go +79 -79
- package/native/core/programmers/functional/FunctionalIsParametersProgrammer.go +159 -159
- package/native/core/programmers/functional/FunctionalIsReturnProgrammer.go +99 -99
- package/native/core/programmers/functional/FunctionalValidateFunctionProgrammer.go +138 -138
- package/native/core/programmers/functional/FunctionalValidateParametersProgrammer.go +222 -222
- package/native/core/programmers/functional/FunctionalValidateReturnProgrammer.go +116 -116
- package/native/core/programmers/functional/internal/FunctionalGeneralProgrammer.go +36 -36
- package/native/core/programmers/helpers/AtomicPredicator.go +35 -35
- package/native/core/programmers/helpers/CloneJoiner.go +217 -217
- package/native/core/programmers/helpers/FunctionProgrammer.go +79 -79
- package/native/core/programmers/helpers/HttpMetadataUtil.go +17 -17
- package/native/core/programmers/helpers/ICheckEntry.go +5 -5
- package/native/core/programmers/helpers/IExpressionEntry.go +6 -6
- package/native/core/programmers/helpers/NotationJoiner.go +159 -159
- package/native/core/programmers/helpers/OptionPredicator.go +4 -4
- package/native/core/programmers/helpers/ProtobufUtil.go +231 -231
- package/native/core/programmers/helpers/ProtobufWire.go +6 -6
- package/native/core/programmers/helpers/PruneJoiner.go +227 -227
- package/native/core/programmers/helpers/RandomJoiner.go +155 -155
- package/native/core/programmers/helpers/StringifyJoinder.go +331 -331
- package/native/core/programmers/helpers/StringifyPredicator.go +10 -10
- package/native/core/programmers/helpers/UnionExplorer.go +835 -835
- package/native/core/programmers/helpers/UnionPredicator.go +78 -78
- package/native/core/programmers/helpers/disable_function_programmer_declare.go +6 -6
- package/native/core/programmers/http/HttpAssertFormDataProgrammer.go +93 -93
- package/native/core/programmers/http/HttpAssertHeadersProgrammer.go +42 -42
- package/native/core/programmers/http/HttpAssertQueryProgrammer.go +51 -51
- package/native/core/programmers/http/HttpFormDataProgrammer.go +351 -351
- package/native/core/programmers/http/HttpHeadersProgrammer.go +370 -370
- package/native/core/programmers/http/HttpIsFormDataProgrammer.go +109 -109
- package/native/core/programmers/http/HttpIsHeadersProgrammer.go +36 -36
- package/native/core/programmers/http/HttpIsQueryProgrammer.go +45 -45
- package/native/core/programmers/http/HttpParameterProgrammer.go +158 -158
- package/native/core/programmers/http/HttpQueryProgrammer.go +422 -422
- package/native/core/programmers/http/HttpValidateFormDataProgrammer.go +87 -87
- package/native/core/programmers/http/HttpValidateHeadersProgrammer.go +39 -39
- package/native/core/programmers/http/HttpValidateQueryProgrammer.go +48 -48
- package/native/core/programmers/internal/CheckerProgrammer.go +1490 -1490
- package/native/core/programmers/internal/FeatureProgrammer.go +589 -589
- package/native/core/programmers/iterate/check_array_length.go +46 -46
- package/native/core/programmers/iterate/check_bigint.go +52 -52
- package/native/core/programmers/iterate/check_dynamic_key.go +220 -220
- package/native/core/programmers/iterate/check_dynamic_properties.go +245 -245
- package/native/core/programmers/iterate/check_everything.go +21 -21
- package/native/core/programmers/iterate/check_native.go +25 -25
- package/native/core/programmers/iterate/check_number.go +135 -135
- package/native/core/programmers/iterate/check_object.go +66 -66
- package/native/core/programmers/iterate/check_string.go +52 -52
- package/native/core/programmers/iterate/check_template.go +57 -57
- package/native/core/programmers/iterate/check_union_array_like.go +372 -372
- package/native/core/programmers/iterate/decode_union_object.go +118 -118
- package/native/core/programmers/iterate/feature_object_entries.go +134 -134
- package/native/core/programmers/iterate/json_schema_alias.go +52 -52
- package/native/core/programmers/iterate/json_schema_array.go +52 -52
- package/native/core/programmers/iterate/json_schema_bigint.go +8 -8
- package/native/core/programmers/iterate/json_schema_boolean.go +8 -8
- package/native/core/programmers/iterate/json_schema_constant.go +38 -38
- package/native/core/programmers/iterate/json_schema_description.go +12 -12
- package/native/core/programmers/iterate/json_schema_discriminator.go +47 -47
- package/native/core/programmers/iterate/json_schema_escaped.go +58 -58
- package/native/core/programmers/iterate/json_schema_jsDocTags.go +34 -34
- package/native/core/programmers/iterate/json_schema_native.go +43 -43
- package/native/core/programmers/iterate/json_schema_number.go +8 -8
- package/native/core/programmers/iterate/json_schema_object.go +149 -149
- package/native/core/programmers/iterate/json_schema_plugin.go +35 -35
- package/native/core/programmers/iterate/json_schema_station.go +211 -211
- package/native/core/programmers/iterate/json_schema_string.go +8 -8
- package/native/core/programmers/iterate/json_schema_template.go +53 -53
- package/native/core/programmers/iterate/json_schema_title.go +16 -16
- package/native/core/programmers/iterate/json_schema_tuple.go +34 -34
- package/native/core/programmers/iterate/metadata_to_pattern.go +53 -53
- package/native/core/programmers/iterate/postfix_of_tuple.go +5 -5
- package/native/core/programmers/iterate/prune_object_properties.go +85 -85
- package/native/core/programmers/iterate/stringify_dynamic_properties.go +193 -193
- package/native/core/programmers/iterate/stringify_native.go +1 -1
- package/native/core/programmers/iterate/stringify_regular_properties.go +84 -84
- package/native/core/programmers/iterate/template_to_pattern.go +20 -20
- package/native/core/programmers/iterate/wrap_metadata_rest_tuple.go +13 -13
- package/native/core/programmers/json/JsonApplicationProgrammer.go +323 -323
- package/native/core/programmers/json/JsonAssertParseProgrammer.go +100 -100
- package/native/core/programmers/json/JsonAssertStringifyProgrammer.go +88 -88
- package/native/core/programmers/json/JsonIsParseProgrammer.go +130 -130
- package/native/core/programmers/json/JsonIsStringifyProgrammer.go +92 -92
- package/native/core/programmers/json/JsonSchemaProgrammer.go +65 -65
- package/native/core/programmers/json/JsonSchemasProgrammer.go +116 -116
- package/native/core/programmers/json/JsonStringifyProgrammer.go +1245 -1245
- package/native/core/programmers/json/JsonValidateParseProgrammer.go +89 -89
- package/native/core/programmers/json/JsonValidateStringifyProgrammer.go +106 -106
- package/native/core/programmers/llm/LlmApplicationProgrammer.go +449 -437
- package/native/core/programmers/llm/LlmCoerceProgrammer.go +79 -79
- package/native/core/programmers/llm/LlmControllerProgrammer.go +35 -35
- package/native/core/programmers/llm/LlmMetadataFactory.go +74 -74
- package/native/core/programmers/llm/LlmParametersProgrammer.go +105 -132
- package/native/core/programmers/llm/LlmParseProgrammer.go +88 -88
- package/native/core/programmers/llm/LlmSchemaProgrammer.go +780 -423
- package/native/core/programmers/llm/LlmStructuredOutputProgrammer.go +123 -123
- package/native/core/programmers/misc/MiscAssertCloneProgrammer.go +82 -82
- package/native/core/programmers/misc/MiscAssertPruneProgrammer.go +97 -97
- package/native/core/programmers/misc/MiscCloneProgrammer.go +1056 -1056
- package/native/core/programmers/misc/MiscIsCloneProgrammer.go +94 -94
- package/native/core/programmers/misc/MiscIsPruneProgrammer.go +86 -86
- package/native/core/programmers/misc/MiscLiteralsProgrammer.go +99 -99
- package/native/core/programmers/misc/MiscPruneProgrammer.go +700 -700
- package/native/core/programmers/misc/MiscValidateCloneProgrammer.go +103 -103
- package/native/core/programmers/misc/MiscValidatePruneProgrammer.go +94 -94
- package/native/core/programmers/notations/NotationAssertGeneralProgrammer.go +85 -85
- package/native/core/programmers/notations/NotationGeneralProgrammer.go +1188 -1188
- package/native/core/programmers/notations/NotationIsGeneralProgrammer.go +90 -90
- package/native/core/programmers/notations/NotationValidateGeneralProgrammer.go +109 -109
- package/native/core/programmers/protobuf/ProtobufAssertDecodeProgrammer.go +99 -99
- package/native/core/programmers/protobuf/ProtobufAssertEncodeProgrammer.go +114 -114
- package/native/core/programmers/protobuf/ProtobufDecodeProgrammer.go +697 -697
- package/native/core/programmers/protobuf/ProtobufEncodeProgrammer.go +1039 -1039
- package/native/core/programmers/protobuf/ProtobufIsDecodeProgrammer.go +99 -99
- package/native/core/programmers/protobuf/ProtobufIsEncodeProgrammer.go +93 -93
- package/native/core/programmers/protobuf/ProtobufMessageProgrammer.go +228 -228
- package/native/core/programmers/protobuf/ProtobufValidateDecodeProgrammer.go +88 -88
- package/native/core/programmers/protobuf/ProtobufValidateEncodeProgrammer.go +120 -120
- package/native/core/schemas/metadata/IMetadataDictionary.go +4 -4
- package/native/core/schemas/metadata/MetadataAlias.go +15 -15
- package/native/core/schemas/metadata/MetadataAliasType.go +36 -36
- package/native/core/schemas/metadata/MetadataApplication.go +25 -25
- package/native/core/schemas/metadata/MetadataArray.go +15 -15
- package/native/core/schemas/metadata/MetadataArrayType.go +31 -31
- package/native/core/schemas/metadata/MetadataAtomic.go +45 -45
- package/native/core/schemas/metadata/MetadataCollection.go +380 -380
- package/native/core/schemas/metadata/MetadataComponents.go +95 -95
- package/native/core/schemas/metadata/MetadataConstant.go +31 -31
- package/native/core/schemas/metadata/MetadataConstantValue.go +63 -63
- package/native/core/schemas/metadata/MetadataEscaped.go +17 -17
- package/native/core/schemas/metadata/MetadataFunction.go +30 -30
- package/native/core/schemas/metadata/MetadataMap.go +21 -21
- package/native/core/schemas/metadata/MetadataNative.go +48 -48
- package/native/core/schemas/metadata/MetadataObject.go +15 -15
- package/native/core/schemas/metadata/MetadataObjectType.go +116 -116
- package/native/core/schemas/metadata/MetadataParameter.go +28 -28
- package/native/core/schemas/metadata/MetadataProperty.go +32 -32
- package/native/core/schemas/metadata/MetadataSchema.go +766 -766
- package/native/core/schemas/metadata/MetadataSet.go +17 -17
- package/native/core/schemas/metadata/MetadataTemplate.go +43 -43
- package/native/core/schemas/metadata/MetadataTuple.go +10 -10
- package/native/core/schemas/metadata/MetadataTupleType.go +38 -38
- package/native/core/schemas/protobuf/IProtobufProperty.go +2 -2
- package/native/core/schemas/protobuf/IProtobufPropertyType.go +18 -18
- package/native/core/schemas/protobuf/IProtobufSchema.go +17 -17
- package/native/core/typings/Writable.go +1 -1
- package/native/core/utils/PatternUtil.go +38 -38
- package/native/core/utils/ProtobufNameEncoder.go +28 -28
- package/native/shim/printer/shim.go +213 -213
- package/native/third_party/ttsc/driver/host.go +7 -7
- package/native/third_party/ttsc/driver/program.go +275 -275
- package/native/third_party/ttsc/driver/rewrite.go +219 -219
- package/native/third_party/ttsc/shim/ast/lint.go +171 -171
- package/native/third_party/ttsc/shim/ast/shim.go +83 -83
- package/native/third_party/ttsc/shim/bundled/shim.go +5 -1
- package/native/third_party/ttsc/shim/checker/shim.go +79 -79
- package/native/third_party/ttsc/shim/compiler/shim.go +16 -1
- package/native/third_party/ttsc/shim/core/shim.go +10 -10
- package/native/third_party/ttsc/shim/diagnosticwriter/lint.go +79 -79
- package/native/third_party/ttsc/shim/diagnosticwriter/shim.go +19 -19
- package/native/third_party/ttsc/shim/parser/shim.go +7 -1
- package/native/third_party/ttsc/shim/scanner/shim.go +39 -1
- package/native/third_party/ttsc/shim/tsoptions/shim.go +51 -1
- package/native/third_party/ttsc/shim/tspath/shim.go +72 -1
- package/native/third_party/ttsc/shim/vfs/cachedvfs/shim.go +1 -1
- package/native/third_party/ttsc/shim/vfs/osvfs/shim.go +1 -1
- package/native/third_party/ttsc/shim/vfs/shim.go +4 -1
- package/native/transform/CallExpressionTransformer.go +556 -556
- package/native/transform/FileTransformer.go +123 -123
- package/native/transform/ImportTransformer.go +224 -224
- package/native/transform/NodeTransformer.go +11 -11
- package/native/transform/TypiaGenerator.go +136 -136
- package/native/transform/features/AssertTransformer.go +28 -28
- package/native/transform/features/CreateAssertTransformer.go +28 -28
- package/native/transform/features/CreateIsTransformer.go +24 -24
- package/native/transform/features/CreateRandomTransformer.go +35 -35
- package/native/transform/features/CreateValidateTransformer.go +24 -24
- package/native/transform/features/IsTransformer.go +24 -24
- package/native/transform/features/RandomTransformer.go +37 -37
- package/native/transform/features/ValidateTransformer.go +24 -24
- package/native/transform/features/functional/FunctionalGenericTransformer.go +48 -48
- package/native/transform/features/http/CreateHttpAssertFormDataTransformer.go +11 -11
- package/native/transform/features/http/CreateHttpAssertHeadersTransformer.go +11 -11
- package/native/transform/features/http/CreateHttpAssertQueryTransformer.go +17 -17
- package/native/transform/features/http/CreateHttpFormDataTransformer.go +11 -11
- package/native/transform/features/http/CreateHttpHeadersTransformer.go +11 -11
- package/native/transform/features/http/CreateHttpIsFormDataTransformer.go +11 -11
- package/native/transform/features/http/CreateHttpIsHeadersTransformer.go +11 -11
- package/native/transform/features/http/CreateHttpIsQueryTransformer.go +17 -17
- package/native/transform/features/http/CreateHttpParameterTransformer.go +11 -11
- package/native/transform/features/http/CreateHttpQueryTransformer.go +17 -17
- package/native/transform/features/http/CreateHttpValidateFormDataTransformer.go +11 -11
- package/native/transform/features/http/CreateHttpValidateHeadersTransformer.go +11 -11
- package/native/transform/features/http/CreateHttpValidateQueryTransformer.go +17 -17
- package/native/transform/features/http/HttpAssertFormDataTransformer.go +11 -11
- package/native/transform/features/http/HttpAssertHeadersTransformer.go +11 -11
- package/native/transform/features/http/HttpAssertQueryTransformer.go +17 -17
- package/native/transform/features/http/HttpFormDataTransformer.go +11 -11
- package/native/transform/features/http/HttpHeadersTransformer.go +11 -11
- package/native/transform/features/http/HttpIsFormDataTransformer.go +11 -11
- package/native/transform/features/http/HttpIsHeadersTransformer.go +11 -11
- package/native/transform/features/http/HttpIsQueryTransformer.go +17 -17
- package/native/transform/features/http/HttpParameterTransformer.go +11 -11
- package/native/transform/features/http/HttpQueryTransformer.go +17 -17
- package/native/transform/features/http/HttpValidateFormDataTransformer.go +11 -11
- package/native/transform/features/http/HttpValidateHeadersTransformer.go +11 -11
- package/native/transform/features/http/HttpValidateQueryTransformer.go +17 -17
- package/native/transform/features/json/JsonApplicationTransformer.go +61 -61
- package/native/transform/features/json/JsonAssertParseTransformer.go +11 -11
- package/native/transform/features/json/JsonAssertStringifyTransformer.go +11 -11
- package/native/transform/features/json/JsonCreateAssertParseTransformer.go +11 -11
- package/native/transform/features/json/JsonCreateAssertStringifyTransformer.go +11 -11
- package/native/transform/features/json/JsonCreateIsParseTransformer.go +11 -11
- package/native/transform/features/json/JsonCreateIsStringifyTransformer.go +11 -11
- package/native/transform/features/json/JsonCreateStringifyTransformer.go +11 -11
- package/native/transform/features/json/JsonCreateValidateParseTransformer.go +11 -11
- package/native/transform/features/json/JsonCreateValidateStringifyProgrammer.go +11 -11
- package/native/transform/features/json/JsonIsParseTransformer.go +11 -11
- package/native/transform/features/json/JsonIsStringifyTransformer.go +11 -11
- package/native/transform/features/json/JsonSchemaTransformer.go +148 -148
- package/native/transform/features/json/JsonSchemasTransformer.go +94 -94
- package/native/transform/features/json/JsonStringifyTransformer.go +11 -11
- package/native/transform/features/json/JsonValidateParseTransformer.go +11 -11
- package/native/transform/features/json/JsonValidateStringifyTransformer.go +11 -11
- package/native/transform/features/llm/LlmApplicationTransformer.go +43 -43
- package/native/transform/features/llm/LlmCoerceTransformer.go +50 -50
- package/native/transform/features/llm/LlmControllerTransformer.go +48 -48
- package/native/transform/features/llm/LlmCreateCoerceTransformer.go +43 -43
- package/native/transform/features/llm/LlmCreateParseTransformer.go +43 -43
- package/native/transform/features/llm/LlmParametersTransformer.go +38 -38
- package/native/transform/features/llm/LlmParseTransformer.go +50 -50
- package/native/transform/features/llm/LlmSchemaTransformer.go +129 -129
- package/native/transform/features/llm/LlmStructuredOutputTransformer.go +44 -44
- package/native/transform/features/misc/MiscAssertCloneTransformer.go +11 -11
- package/native/transform/features/misc/MiscAssertPruneTransformer.go +11 -11
- package/native/transform/features/misc/MiscCloneTransformer.go +11 -11
- package/native/transform/features/misc/MiscCreateAssertCloneTransformer.go +11 -11
- package/native/transform/features/misc/MiscCreateAssertPruneTransformer.go +11 -11
- package/native/transform/features/misc/MiscCreateCloneTransformer.go +11 -11
- package/native/transform/features/misc/MiscCreateIsCloneTransformer.go +11 -11
- package/native/transform/features/misc/MiscCreateIsPruneTransformer.go +11 -11
- package/native/transform/features/misc/MiscCreatePruneTransformer.go +11 -11
- package/native/transform/features/misc/MiscCreateValidateCloneTransformer.go +11 -11
- package/native/transform/features/misc/MiscCreateValidatePruneTransformer.go +11 -11
- package/native/transform/features/misc/MiscIsCloneTransformer.go +11 -11
- package/native/transform/features/misc/MiscIsPruneTransformer.go +11 -11
- package/native/transform/features/misc/MiscLiteralsTransformer.go +21 -21
- package/native/transform/features/misc/MiscPruneTransformer.go +11 -11
- package/native/transform/features/misc/MiscValidateCloneTransformer.go +11 -11
- package/native/transform/features/misc/MiscValidatePruneTransformer.go +11 -11
- package/native/transform/features/notations/NotationAssertGeneralTransformer.go +16 -16
- package/native/transform/features/notations/NotationCreateAssertGeneralTransformer.go +16 -16
- package/native/transform/features/notations/NotationCreateGeneralTransformer.go +16 -16
- package/native/transform/features/notations/NotationCreateIsGeneralTransformer.go +16 -16
- package/native/transform/features/notations/NotationCreateValidateGeneralTransformer.go +16 -16
- package/native/transform/features/notations/NotationGeneralTransformer.go +21 -21
- package/native/transform/features/notations/NotationIsGeneralTransformer.go +16 -16
- package/native/transform/features/notations/NotationValidateGeneralTransformer.go +16 -16
- package/native/transform/features/protobuf/ProtobufAssertDecodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufAssertEncodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufCreateAssertDecodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufCreateAssertEncodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufCreateDecodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufCreateEncodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufCreateIsDecodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufCreateIsEncodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufCreateValidateDecodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufCreateValidateEncodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufDecodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufEncodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufIsDecodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufIsEncodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufMessageTransformer.go +20 -20
- package/native/transform/features/protobuf/ProtobufValidateDecodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufValidateEncodeTransformer.go +11 -11
- package/native/transform/features/reflect/ReflectMetadataTransformer.go +59 -59
- package/native/transform/features/reflect/ReflectNameTransformer.go +78 -78
- package/native/transform/features/reflect/ReflectSchemaTransformer.go +121 -121
- package/native/transform/features/reflect/ReflectSchemasTransformer.go +55 -55
- package/native/transform/internal/GenericTransformer.go +173 -173
- package/native/transform/transform.go +32 -32
- package/package.json +4 -4
- package/src/executable/TypiaGenerateWizard.ts +78 -9
- package/src/executable/generate/ttsc.ts +2 -3
- package/src/executable/setup/PluginConfigurator.ts +2 -3
- package/src/internal/_randomInteger.ts +5 -5
- package/src/internal/_validateReport.ts +1 -2
- package/src/transform.ts +6 -11
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
package protobuf
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
|
-
|
|
4
|
+
"fmt"
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
shimast "github.com/microsoft/typescript-go/shim/ast"
|
|
7
|
+
shimchecker "github.com/microsoft/typescript-go/shim/checker"
|
|
8
|
+
nativecontext "github.com/samchon/typia/packages/typia/native/core/context"
|
|
9
|
+
nativefactories "github.com/samchon/typia/packages/typia/native/core/factories"
|
|
10
|
+
nativeprogrammers "github.com/samchon/typia/packages/typia/native/core/programmers"
|
|
11
|
+
nativehelpers "github.com/samchon/typia/packages/typia/native/core/programmers/helpers"
|
|
12
|
+
nativeinternal "github.com/samchon/typia/packages/typia/native/core/programmers/internal"
|
|
13
|
+
nativeiterate "github.com/samchon/typia/packages/typia/native/core/programmers/iterate"
|
|
14
|
+
schemametadata "github.com/samchon/typia/packages/typia/native/core/schemas/metadata"
|
|
15
|
+
schemaprotobuf "github.com/samchon/typia/packages/typia/native/core/schemas/protobuf"
|
|
16
16
|
)
|
|
17
17
|
|
|
18
18
|
type protobufEncodeProgrammerNamespace struct{}
|
|
@@ -20,24 +20,24 @@ type protobufEncodeProgrammerNamespace struct{}
|
|
|
20
20
|
var ProtobufEncodeProgrammer = protobufEncodeProgrammerNamespace{}
|
|
21
21
|
|
|
22
22
|
type ProtobufEncodeProgrammer_IProps struct {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
Context nativecontext.ITypiaContext
|
|
24
|
+
Modulo *shimast.Node
|
|
25
|
+
Type *shimchecker.Type
|
|
26
|
+
Name *string
|
|
27
|
+
Init *shimast.Node
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
type ProtobufEncodeProgrammer_DecomposeProps struct {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
Context nativecontext.ITypiaContext
|
|
32
|
+
Modulo *shimast.Node
|
|
33
|
+
Functor *nativehelpers.FunctionProgrammer
|
|
34
|
+
Type *shimchecker.Type
|
|
35
|
+
Name *string
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
type protobufEncodeProgrammer_IUnion struct {
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
Is func() *shimast.Node
|
|
40
|
+
Value func() *shimast.Node
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
const protobufEncodeProgrammer_PREFIX = "_pe"
|
|
@@ -45,1163 +45,1163 @@ const protobufEncodeProgrammer_PREFIX = "_pe"
|
|
|
45
45
|
var protobufEncodeProgrammer_factory = shimast.NewNodeFactory(shimast.NodeFactoryHooks{})
|
|
46
46
|
|
|
47
47
|
func (protobufEncodeProgrammerNamespace) Decompose(props ProtobufEncodeProgrammer_DecomposeProps) nativeinternal.FeatureProgrammer_IDecomposed {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
48
|
+
collection := schemametadata.NewMetadataCollection()
|
|
49
|
+
metadata := nativefactories.ProtobufFactory.Metadata(nativefactories.ProtobufFactory_IProps{
|
|
50
|
+
Method: protobufEncodeProgrammer_method_text(props.Modulo),
|
|
51
|
+
Checker: props.Context.Checker,
|
|
52
|
+
Transformer: props.Context.Transformer,
|
|
53
|
+
Components: collection,
|
|
54
|
+
Type: props.Type,
|
|
55
|
+
})
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
57
|
+
callEncoder := func(writer string, factory *shimast.Node) *shimast.Node {
|
|
58
|
+
return nativefactories.StatementFactory.Constant(nativefactories.StatementFactory_ConstantProps{
|
|
59
|
+
Name: writer,
|
|
60
|
+
Value: protobufEncodeProgrammer_factory.NewCallExpression(
|
|
61
|
+
protobufEncodeProgrammer_factory.NewIdentifier("encoder"),
|
|
62
|
+
nil,
|
|
63
|
+
nil,
|
|
64
|
+
protobufEncodeProgrammer_factory.NewNodeList([]*shimast.Node{
|
|
65
|
+
factory,
|
|
66
|
+
protobufEncodeProgrammer_factory.NewIdentifier("input"),
|
|
67
|
+
}),
|
|
68
|
+
shimast.NodeFlagsNone,
|
|
69
|
+
),
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
typeName := ""
|
|
73
|
+
if props.Name != nil {
|
|
74
|
+
typeName = *props.Name
|
|
75
|
+
} else {
|
|
76
|
+
typeName = nativefactories.TypeFactory.GetFullName(nativefactories.TypeFactory_GetFullNameProps{
|
|
77
|
+
Checker: props.Context.Checker,
|
|
78
|
+
Type: props.Type,
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
return nativeinternal.FeatureProgrammer_IDecomposed{
|
|
82
|
+
Functions: map[string]*shimast.Node{
|
|
83
|
+
"encoder": nativefactories.StatementFactory.Constant(nativefactories.StatementFactory_ConstantProps{
|
|
84
|
+
Name: props.Functor.UseLocal("encoder"),
|
|
85
|
+
Value: protobufEncodeProgrammer_write_encoder(protobufEncodeProgrammer_writeEncoderProps{
|
|
86
|
+
Context: props.Context,
|
|
87
|
+
Functor: props.Functor,
|
|
88
|
+
Collection: collection,
|
|
89
|
+
Metadata: metadata,
|
|
90
|
+
}),
|
|
91
|
+
}),
|
|
92
|
+
},
|
|
93
|
+
Statements: []*shimast.Node{},
|
|
94
|
+
Arrow: protobufEncodeProgrammer_factory.NewArrowFunction(
|
|
95
|
+
nil,
|
|
96
|
+
nil,
|
|
97
|
+
protobufEncodeProgrammer_factory.NewNodeList([]*shimast.Node{
|
|
98
|
+
nativefactories.IdentifierFactory.Parameter("input", protobufEncodeProgrammer_factory.NewTypeReferenceNode(protobufEncodeProgrammer_factory.NewIdentifier(typeName), nil), nil),
|
|
99
|
+
}),
|
|
100
|
+
protobufEncodeProgrammer_factory.NewTypeReferenceNode(protobufEncodeProgrammer_factory.NewIdentifier("Uint8Array"), nil),
|
|
101
|
+
nil,
|
|
102
|
+
protobufEncodeProgrammer_factory.NewToken(shimast.KindEqualsGreaterThanToken),
|
|
103
|
+
protobufEncodeProgrammer_factory.NewBlock(protobufEncodeProgrammer_factory.NewNodeList([]*shimast.Node{
|
|
104
|
+
callEncoder("sizer", protobufEncodeProgrammer_factory.NewNewExpression(protobufEncodeProgrammer_internal(props.Context, "ProtobufSizer"), nil, protobufEncodeProgrammer_factory.NewNodeList(nil))),
|
|
105
|
+
callEncoder("writer", protobufEncodeProgrammer_factory.NewNewExpression(
|
|
106
|
+
protobufEncodeProgrammer_internal(props.Context, "ProtobufWriter"),
|
|
107
|
+
nil,
|
|
108
|
+
protobufEncodeProgrammer_factory.NewNodeList([]*shimast.Node{
|
|
109
|
+
protobufEncodeProgrammer_factory.NewIdentifier("sizer"),
|
|
110
|
+
}),
|
|
111
|
+
)),
|
|
112
|
+
protobufEncodeProgrammer_factory.NewReturnStatement(protobufEncodeProgrammer_callWriter("buffer", nil)),
|
|
113
|
+
}), true),
|
|
114
|
+
),
|
|
115
|
+
}
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
func (protobufEncodeProgrammerNamespace) Write(props ProtobufEncodeProgrammer_IProps) *shimast.Node {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
119
|
+
functor := nativehelpers.NewFunctionProgrammer(protobufEncodeProgrammer_method_text(props.Modulo))
|
|
120
|
+
result := ProtobufEncodeProgrammer.Decompose(ProtobufEncodeProgrammer_DecomposeProps{
|
|
121
|
+
Context: props.Context,
|
|
122
|
+
Modulo: props.Modulo,
|
|
123
|
+
Functor: functor,
|
|
124
|
+
Type: props.Type,
|
|
125
|
+
Name: props.Name,
|
|
126
|
+
})
|
|
127
|
+
return nativeinternal.FeatureProgrammer.WriteDecomposed(nativeinternal.FeatureProgrammer_WriteDecomposedProps{
|
|
128
|
+
Modulo: props.Modulo,
|
|
129
|
+
Functor: functor,
|
|
130
|
+
Result: result,
|
|
131
|
+
})
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
type protobufEncodeProgrammer_writeEncoderProps struct {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
135
|
+
Context nativecontext.ITypiaContext
|
|
136
|
+
Functor *nativehelpers.FunctionProgrammer
|
|
137
|
+
Collection *schemametadata.MetadataCollection
|
|
138
|
+
Metadata *schemametadata.MetadataSchema
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
func protobufEncodeProgrammer_write_encoder(props protobufEncodeProgrammer_writeEncoderProps) *shimast.Node {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
142
|
+
functors := []*shimast.Node{}
|
|
143
|
+
for _, object := range props.Collection.Objects() {
|
|
144
|
+
if nativehelpers.ProtobufUtil.IsStaticObject(object) == false {
|
|
145
|
+
continue
|
|
146
|
+
}
|
|
147
|
+
functors = append(functors, nativefactories.StatementFactory.Constant(nativefactories.StatementFactory_ConstantProps{
|
|
148
|
+
Name: fmt.Sprintf("%so%d", protobufEncodeProgrammer_PREFIX, object.Index),
|
|
149
|
+
Value: protobufEncodeProgrammer_write_object_function(protobufEncodeProgrammer_writeObjectFunctionProps{
|
|
150
|
+
Context: props.Context,
|
|
151
|
+
Functor: props.Functor,
|
|
152
|
+
Input: protobufEncodeProgrammer_factory.NewIdentifier("input"),
|
|
153
|
+
Object: object,
|
|
154
|
+
Explore: nativeinternal.FeatureProgrammer_IExplore{
|
|
155
|
+
Source: "function",
|
|
156
|
+
From: "object",
|
|
157
|
+
Tracable: false,
|
|
158
|
+
Postfix: "",
|
|
159
|
+
},
|
|
160
|
+
}),
|
|
161
|
+
}))
|
|
162
|
+
}
|
|
163
|
+
statements := []*shimast.Node{}
|
|
164
|
+
statements = append(statements, props.Functor.DeclareUnions()...)
|
|
165
|
+
statements = append(statements, functors...)
|
|
166
|
+
statements = append(statements, nativeprogrammers.IsProgrammer.Write_function_statements(nativeprogrammers.IsProgrammer_WriteFunctionStatementsProps{
|
|
167
|
+
Context: props.Context,
|
|
168
|
+
Functor: props.Functor,
|
|
169
|
+
Collection: props.Collection,
|
|
170
|
+
})...)
|
|
171
|
+
index := 0
|
|
172
|
+
if len(props.Metadata.Objects) != 0 {
|
|
173
|
+
index = props.Metadata.Objects[0].Type.Index
|
|
174
|
+
}
|
|
175
|
+
statements = append(statements,
|
|
176
|
+
protobufEncodeProgrammer_factory.NewExpressionStatement(
|
|
177
|
+
protobufEncodeProgrammer_factory.NewCallExpression(
|
|
178
|
+
protobufEncodeProgrammer_factory.NewIdentifier(props.Functor.UseLocal(fmt.Sprintf("%so%d", protobufEncodeProgrammer_PREFIX, index))),
|
|
179
|
+
nil,
|
|
180
|
+
nil,
|
|
181
|
+
protobufEncodeProgrammer_factory.NewNodeList([]*shimast.Node{
|
|
182
|
+
protobufEncodeProgrammer_factory.NewIdentifier("input"),
|
|
183
|
+
}),
|
|
184
|
+
shimast.NodeFlagsNone,
|
|
185
|
+
),
|
|
186
|
+
),
|
|
187
|
+
protobufEncodeProgrammer_factory.NewReturnStatement(protobufEncodeProgrammer_factory.NewIdentifier("writer")),
|
|
188
|
+
)
|
|
189
|
+
return protobufEncodeProgrammer_factory.NewArrowFunction(
|
|
190
|
+
nil,
|
|
191
|
+
protobufEncodeProgrammer_factory.NewNodeList([]*shimast.Node{
|
|
192
|
+
protobufEncodeProgrammer_factory.NewTypeParameterDeclaration(
|
|
193
|
+
nil,
|
|
194
|
+
protobufEncodeProgrammer_factory.NewIdentifier("Writer"),
|
|
195
|
+
protobufEncodeProgrammer_import_type(props.Context, nativeprogrammers.ImportProgrammer_TypeProps{
|
|
196
|
+
File: "typia/lib/internal/_IProtobufWriter",
|
|
197
|
+
Name: "_IProtobufWriter",
|
|
198
|
+
}),
|
|
199
|
+
nil,
|
|
200
|
+
nil,
|
|
201
|
+
),
|
|
202
|
+
}),
|
|
203
|
+
protobufEncodeProgrammer_factory.NewNodeList([]*shimast.Node{
|
|
204
|
+
nativefactories.IdentifierFactory.Parameter("writer", protobufEncodeProgrammer_factory.NewTypeReferenceNode(protobufEncodeProgrammer_factory.NewIdentifier("Writer"), nil), nil),
|
|
205
|
+
nativefactories.IdentifierFactory.Parameter("input", nil, nil),
|
|
206
|
+
}),
|
|
207
|
+
protobufEncodeProgrammer_factory.NewTypeReferenceNode(protobufEncodeProgrammer_factory.NewIdentifier("Writer"), nil),
|
|
208
|
+
nil,
|
|
209
|
+
protobufEncodeProgrammer_factory.NewToken(shimast.KindEqualsGreaterThanToken),
|
|
210
|
+
protobufEncodeProgrammer_factory.NewBlock(protobufEncodeProgrammer_factory.NewNodeList(statements), true),
|
|
211
|
+
)
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
type protobufEncodeProgrammer_writeObjectFunctionProps struct {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
215
|
+
Context nativecontext.ITypiaContext
|
|
216
|
+
Functor *nativehelpers.FunctionProgrammer
|
|
217
|
+
Input *shimast.Node
|
|
218
|
+
Object *schemametadata.MetadataObjectType
|
|
219
|
+
Explore nativeinternal.FeatureProgrammer_IExplore
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
func protobufEncodeProgrammer_write_object_function(props protobufEncodeProgrammer_writeObjectFunctionProps) *shimast.Node {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
223
|
+
body := []*shimast.Node{}
|
|
224
|
+
for _, property := range props.Object.Properties {
|
|
225
|
+
if property.Of_protobuf_ == nil {
|
|
226
|
+
nativefactories.ProtobufFactory.EmplaceObject(props.Object)
|
|
227
|
+
}
|
|
228
|
+
literal := property.Key.GetSoleLiteral()
|
|
229
|
+
key := ""
|
|
230
|
+
if literal != nil {
|
|
231
|
+
key = *literal
|
|
232
|
+
}
|
|
233
|
+
block := protobufEncodeProgrammer_decode_property(protobufEncodeProgrammer_decodePropertyProps{
|
|
234
|
+
Context: props.Context,
|
|
235
|
+
Functor: props.Functor,
|
|
236
|
+
Explore: props.Explore,
|
|
237
|
+
Metadata: property.Value,
|
|
238
|
+
Protobuf: property.Of_protobuf_,
|
|
239
|
+
Input: nativefactories.IdentifierFactory.Access(props.Input, key),
|
|
240
|
+
})
|
|
241
|
+
body = append(body, protobufEncodeProgrammer_factory.NewExpressionStatement(
|
|
242
|
+
protobufEncodeProgrammer_factory.NewIdentifier("// property "+fmt.Sprintf("%q", key)+": "+property.Value.GetName()),
|
|
243
|
+
))
|
|
244
|
+
body = append(body, block.Statements()...)
|
|
245
|
+
}
|
|
246
|
+
return protobufEncodeProgrammer_factory.NewArrowFunction(
|
|
247
|
+
nil,
|
|
248
|
+
nil,
|
|
249
|
+
protobufEncodeProgrammer_factory.NewNodeList([]*shimast.Node{
|
|
250
|
+
nativefactories.IdentifierFactory.Parameter("input", nil, nil),
|
|
251
|
+
}),
|
|
252
|
+
nativefactories.TypeFactory.Keyword("any"),
|
|
253
|
+
nil,
|
|
254
|
+
protobufEncodeProgrammer_factory.NewToken(shimast.KindEqualsGreaterThanToken),
|
|
255
|
+
protobufEncodeProgrammer_factory.NewBlock(protobufEncodeProgrammer_factory.NewNodeList(body), true),
|
|
256
|
+
)
|
|
257
257
|
}
|
|
258
258
|
|
|
259
259
|
type protobufEncodeProgrammer_decodePropertyProps struct {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
260
|
+
Context nativecontext.ITypiaContext
|
|
261
|
+
Functor *nativehelpers.FunctionProgrammer
|
|
262
|
+
Metadata *schemametadata.MetadataSchema
|
|
263
|
+
Protobuf *schemaprotobuf.IProtobufProperty
|
|
264
|
+
Input *shimast.Node
|
|
265
|
+
Explore nativeinternal.FeatureProgrammer_IExplore
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
func protobufEncodeProgrammer_decode_property(props protobufEncodeProgrammer_decodePropertyProps) *shimast.Node {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
269
|
+
union := []protobufEncodeProgrammer_IUnion{}
|
|
270
|
+
for _, schema := range props.Protobuf.Union {
|
|
271
|
+
switch typed := schema.(type) {
|
|
272
|
+
case *schemaprotobuf.IProtobufPropertyType_IBoolean:
|
|
273
|
+
index := typed.Index
|
|
274
|
+
union = append(union, protobufEncodeProgrammer_IUnion{
|
|
275
|
+
Is: func() *shimast.Node {
|
|
276
|
+
return protobufEncodeProgrammer_strict_equal(
|
|
277
|
+
protobufEncodeProgrammer_factory.NewStringLiteral("boolean", shimast.TokenFlagsNone),
|
|
278
|
+
protobufEncodeProgrammer_factory.NewTypeOfExpression(props.Input),
|
|
279
|
+
)
|
|
280
|
+
},
|
|
281
|
+
Value: func() *shimast.Node {
|
|
282
|
+
return protobufEncodeProgrammer_decode_bool(struct {
|
|
283
|
+
Input *shimast.Node
|
|
284
|
+
Index *int
|
|
285
|
+
}{Input: props.Input, Index: index})
|
|
286
|
+
},
|
|
287
|
+
})
|
|
288
|
+
case *schemaprotobuf.IProtobufPropertyType_IBigint:
|
|
289
|
+
union = append(union, protobufEncodeProgrammer_decode_bigint(struct {
|
|
290
|
+
Candidates []string
|
|
291
|
+
Type string
|
|
292
|
+
Input *shimast.Node
|
|
293
|
+
Index *int
|
|
294
|
+
}{
|
|
295
|
+
Input: props.Input,
|
|
296
|
+
Type: typed.Name,
|
|
297
|
+
Candidates: protobufEncodeProgrammer_bigintCandidates(props.Protobuf.Union),
|
|
298
|
+
Index: typed.Index,
|
|
299
|
+
}))
|
|
300
|
+
case *schemaprotobuf.IProtobufPropertyType_INumber:
|
|
301
|
+
union = append(union, protobufEncodeProgrammer_decode_number(struct {
|
|
302
|
+
Candidates []string
|
|
303
|
+
Type string
|
|
304
|
+
Input *shimast.Node
|
|
305
|
+
Index *int
|
|
306
|
+
}{
|
|
307
|
+
Input: props.Input,
|
|
308
|
+
Type: typed.Name,
|
|
309
|
+
Candidates: protobufEncodeProgrammer_numberCandidates(props.Protobuf.Union),
|
|
310
|
+
Index: typed.Index,
|
|
311
|
+
}))
|
|
312
|
+
case *schemaprotobuf.IProtobufPropertyType_IString:
|
|
313
|
+
index := typed.Index
|
|
314
|
+
union = append(union, protobufEncodeProgrammer_IUnion{
|
|
315
|
+
Is: func() *shimast.Node {
|
|
316
|
+
return protobufEncodeProgrammer_strict_equal(
|
|
317
|
+
protobufEncodeProgrammer_factory.NewStringLiteral("string", shimast.TokenFlagsNone),
|
|
318
|
+
protobufEncodeProgrammer_factory.NewTypeOfExpression(props.Input),
|
|
319
|
+
)
|
|
320
|
+
},
|
|
321
|
+
Value: func() *shimast.Node {
|
|
322
|
+
return protobufEncodeProgrammer_decode_bytes(struct {
|
|
323
|
+
Method string
|
|
324
|
+
Index int
|
|
325
|
+
Input *shimast.Node
|
|
326
|
+
}{Method: "string", Index: protobufEncodeProgrammer_indexValue(index), Input: props.Input})
|
|
327
|
+
},
|
|
328
|
+
})
|
|
329
|
+
case *schemaprotobuf.IProtobufPropertyType_IByte:
|
|
330
|
+
index := typed.Index
|
|
331
|
+
union = append(union, protobufEncodeProgrammer_IUnion{
|
|
332
|
+
Is: func() *shimast.Node {
|
|
333
|
+
return nativefactories.ExpressionFactory.IsInstanceOf("Uint8Array", props.Input)
|
|
334
|
+
},
|
|
335
|
+
Value: func() *shimast.Node {
|
|
336
|
+
return protobufEncodeProgrammer_decode_bytes(struct {
|
|
337
|
+
Method string
|
|
338
|
+
Index int
|
|
339
|
+
Input *shimast.Node
|
|
340
|
+
}{Method: "bytes", Index: protobufEncodeProgrammer_indexValue(index), Input: props.Input})
|
|
341
|
+
},
|
|
342
|
+
})
|
|
343
|
+
case *schemaprotobuf.IProtobufPropertyType_IArray:
|
|
344
|
+
array := typed
|
|
345
|
+
union = append(union, protobufEncodeProgrammer_IUnion{
|
|
346
|
+
Is: func() *shimast.Node {
|
|
347
|
+
return nativefactories.ExpressionFactory.IsArray(props.Input)
|
|
348
|
+
},
|
|
349
|
+
Value: func() *shimast.Node {
|
|
350
|
+
return protobufEncodeProgrammer_decode_array(protobufEncodeProgrammer_decodeArrayProps{
|
|
351
|
+
Context: props.Context,
|
|
352
|
+
Functor: props.Functor,
|
|
353
|
+
Input: props.Input,
|
|
354
|
+
Schema: array,
|
|
355
|
+
})
|
|
356
|
+
},
|
|
357
|
+
})
|
|
358
|
+
case *schemaprotobuf.IProtobufPropertyType_IMap:
|
|
359
|
+
if _, ok := typed.Map.(*schemametadata.MetadataMap); ok {
|
|
360
|
+
mapSchema := typed
|
|
361
|
+
union = append(union, protobufEncodeProgrammer_IUnion{
|
|
362
|
+
Is: func() *shimast.Node {
|
|
363
|
+
return nativefactories.ExpressionFactory.IsInstanceOf("Map", props.Input)
|
|
364
|
+
},
|
|
365
|
+
Value: func() *shimast.Node {
|
|
366
|
+
return protobufEncodeProgrammer_decode_map(protobufEncodeProgrammer_decodeMapProps{
|
|
367
|
+
Context: props.Context,
|
|
368
|
+
Functor: props.Functor,
|
|
369
|
+
Schema: mapSchema,
|
|
370
|
+
Input: props.Input,
|
|
371
|
+
})
|
|
372
|
+
},
|
|
373
|
+
})
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
objectSchemas := protobufEncodeProgrammer_objectSchemas(props.Protobuf.Union)
|
|
377
|
+
if len(objectSchemas) != 0 {
|
|
378
|
+
schemas := objectSchemas
|
|
379
|
+
union = append(union, protobufEncodeProgrammer_IUnion{
|
|
380
|
+
Is: func() *shimast.Node {
|
|
381
|
+
return nativefactories.ExpressionFactory.IsObject(nativefactories.ExpressionFactory_IsObjectProps{
|
|
382
|
+
CheckNull: true,
|
|
383
|
+
CheckArray: false,
|
|
384
|
+
Input: props.Input,
|
|
385
|
+
})
|
|
386
|
+
},
|
|
387
|
+
Value: func() *shimast.Node {
|
|
388
|
+
explore := props.Explore
|
|
389
|
+
explore.From = "object"
|
|
390
|
+
return protobufEncodeProgrammer_explore_objects(protobufEncodeProgrammer_exploreObjectsProps{
|
|
391
|
+
Context: props.Context,
|
|
392
|
+
Functor: props.Functor,
|
|
393
|
+
Level: 0,
|
|
394
|
+
Schemas: schemas,
|
|
395
|
+
Explore: explore,
|
|
396
|
+
Input: props.Input,
|
|
397
|
+
})
|
|
398
|
+
},
|
|
399
|
+
})
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
402
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
403
|
+
wrapper := func(block *shimast.Node) *shimast.Node { return block }
|
|
404
|
+
required := props.Metadata.IsRequired()
|
|
405
|
+
if required && props.Metadata.Nullable == false {
|
|
406
|
+
wrapper = func(block *shimast.Node) *shimast.Node { return block }
|
|
407
|
+
} else if required == false && props.Metadata.Nullable {
|
|
408
|
+
wrapper = func(block *shimast.Node) *shimast.Node {
|
|
409
|
+
return protobufEncodeProgrammer_factory.NewBlock(protobufEncodeProgrammer_factory.NewNodeList([]*shimast.Node{
|
|
410
|
+
protobufEncodeProgrammer_factory.NewIfStatement(
|
|
411
|
+
protobufEncodeProgrammer_logical_and(
|
|
412
|
+
protobufEncodeProgrammer_strict_not_equal(protobufEncodeProgrammer_factory.NewIdentifier("undefined"), props.Input),
|
|
413
|
+
protobufEncodeProgrammer_strict_not_equal(protobufEncodeProgrammer_factory.NewKeywordExpression(shimast.KindNullKeyword), props.Input),
|
|
414
|
+
),
|
|
415
|
+
block,
|
|
416
|
+
nil,
|
|
417
|
+
),
|
|
418
|
+
}), true)
|
|
419
|
+
}
|
|
420
|
+
} else if required == false {
|
|
421
|
+
wrapper = func(block *shimast.Node) *shimast.Node {
|
|
422
|
+
return protobufEncodeProgrammer_factory.NewBlock(protobufEncodeProgrammer_factory.NewNodeList([]*shimast.Node{
|
|
423
|
+
protobufEncodeProgrammer_factory.NewIfStatement(
|
|
424
|
+
protobufEncodeProgrammer_strict_not_equal(protobufEncodeProgrammer_factory.NewIdentifier("undefined"), props.Input),
|
|
425
|
+
block,
|
|
426
|
+
nil,
|
|
427
|
+
),
|
|
428
|
+
}), true)
|
|
429
|
+
}
|
|
430
|
+
} else {
|
|
431
|
+
wrapper = func(block *shimast.Node) *shimast.Node {
|
|
432
|
+
return protobufEncodeProgrammer_factory.NewBlock(protobufEncodeProgrammer_factory.NewNodeList([]*shimast.Node{
|
|
433
|
+
protobufEncodeProgrammer_factory.NewIfStatement(
|
|
434
|
+
protobufEncodeProgrammer_strict_not_equal(protobufEncodeProgrammer_factory.NewKeywordExpression(shimast.KindNullKeyword), props.Input),
|
|
435
|
+
block,
|
|
436
|
+
nil,
|
|
437
|
+
),
|
|
438
|
+
}), true)
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
if len(union) == 0 {
|
|
442
|
+
return wrapper(protobufEncodeProgrammer_factory.NewBlock(protobufEncodeProgrammer_factory.NewNodeList(nil), true))
|
|
443
|
+
}
|
|
444
|
+
if len(union) == 1 {
|
|
445
|
+
return wrapper(union[0].Value())
|
|
446
|
+
}
|
|
447
|
+
condition := protobufEncodeProgrammer_chainUnion(union, props.Context, props.Functor, props.Input, props.Metadata.GetName())
|
|
448
|
+
return wrapper(protobufEncodeProgrammer_factory.NewBlock(protobufEncodeProgrammer_factory.NewNodeList([]*shimast.Node{condition}), true))
|
|
449
449
|
}
|
|
450
450
|
|
|
451
451
|
func protobufEncodeProgrammer_decode_bool(props struct {
|
|
452
|
-
|
|
453
|
-
|
|
452
|
+
Input *shimast.Node
|
|
453
|
+
Index *int
|
|
454
454
|
}) *shimast.Node {
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
455
|
+
expressions := []*shimast.Node{}
|
|
456
|
+
if props.Index != nil {
|
|
457
|
+
expressions = append(expressions, protobufEncodeProgrammer_decode_tag(struct {
|
|
458
|
+
Wire nativehelpers.ProtobufWire
|
|
459
|
+
Index int
|
|
460
|
+
}{Wire: nativehelpers.VARIANT, Index: *props.Index}))
|
|
461
|
+
}
|
|
462
|
+
expressions = append(expressions, protobufEncodeProgrammer_callWriter("bool", []*shimast.Node{props.Input}))
|
|
463
|
+
return protobufEncodeProgrammer_expressionBlock(expressions)
|
|
464
464
|
}
|
|
465
465
|
|
|
466
466
|
func protobufEncodeProgrammer_decode_bigint(props struct {
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
467
|
+
Candidates []string
|
|
468
|
+
Type string
|
|
469
|
+
Input *shimast.Node
|
|
470
|
+
Index *int
|
|
471
471
|
}) protobufEncodeProgrammer_IUnion {
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
472
|
+
return protobufEncodeProgrammer_IUnion{
|
|
473
|
+
Is: func() *shimast.Node {
|
|
474
|
+
typeof := protobufEncodeProgrammer_strict_equal(
|
|
475
|
+
protobufEncodeProgrammer_factory.NewStringLiteral("bigint", shimast.TokenFlagsNone),
|
|
476
|
+
protobufEncodeProgrammer_factory.NewTypeOfExpression(props.Input),
|
|
477
|
+
)
|
|
478
|
+
if len(props.Candidates) == 1 {
|
|
479
|
+
return typeof
|
|
480
|
+
}
|
|
481
|
+
return protobufEncodeProgrammer_logical_and(typeof, nativefactories.NumericRangeFactory.Bigint(props.Type, props.Input))
|
|
482
|
+
},
|
|
483
|
+
Value: func() *shimast.Node {
|
|
484
|
+
expressions := []*shimast.Node{}
|
|
485
|
+
if props.Index != nil {
|
|
486
|
+
expressions = append(expressions, protobufEncodeProgrammer_decode_tag(struct {
|
|
487
|
+
Wire nativehelpers.ProtobufWire
|
|
488
|
+
Index int
|
|
489
|
+
}{Wire: nativehelpers.VARIANT, Index: *props.Index}))
|
|
490
|
+
}
|
|
491
|
+
expressions = append(expressions, protobufEncodeProgrammer_callWriter(props.Type, []*shimast.Node{props.Input}))
|
|
492
|
+
return protobufEncodeProgrammer_expressionBlock(expressions)
|
|
493
|
+
},
|
|
494
|
+
}
|
|
495
495
|
}
|
|
496
496
|
|
|
497
497
|
func protobufEncodeProgrammer_decode_number(props struct {
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
498
|
+
Candidates []string
|
|
499
|
+
Type string
|
|
500
|
+
Input *shimast.Node
|
|
501
|
+
Index *int
|
|
502
502
|
}) protobufEncodeProgrammer_IUnion {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
503
|
+
return protobufEncodeProgrammer_IUnion{
|
|
504
|
+
Is: func() *shimast.Node {
|
|
505
|
+
typeof := protobufEncodeProgrammer_strict_equal(
|
|
506
|
+
protobufEncodeProgrammer_factory.NewStringLiteral("number", shimast.TokenFlagsNone),
|
|
507
|
+
protobufEncodeProgrammer_factory.NewTypeOfExpression(props.Input),
|
|
508
|
+
)
|
|
509
|
+
if len(props.Candidates) == 1 {
|
|
510
|
+
return typeof
|
|
511
|
+
}
|
|
512
|
+
return protobufEncodeProgrammer_logical_and(typeof, nativefactories.NumericRangeFactory.Number(props.Type, props.Input))
|
|
513
|
+
},
|
|
514
|
+
Value: func() *shimast.Node {
|
|
515
|
+
expressions := []*shimast.Node{}
|
|
516
|
+
if props.Index != nil {
|
|
517
|
+
expressions = append(expressions, protobufEncodeProgrammer_decode_tag(struct {
|
|
518
|
+
Wire nativehelpers.ProtobufWire
|
|
519
|
+
Index int
|
|
520
|
+
}{Wire: protobufEncodeProgrammer_get_numeric_wire(props.Type), Index: *props.Index}))
|
|
521
|
+
}
|
|
522
|
+
expressions = append(expressions, protobufEncodeProgrammer_callWriter(props.Type, []*shimast.Node{props.Input}))
|
|
523
|
+
return protobufEncodeProgrammer_expressionBlock(expressions)
|
|
524
|
+
},
|
|
525
|
+
}
|
|
526
526
|
}
|
|
527
527
|
|
|
528
528
|
func protobufEncodeProgrammer_decode_container_value(props struct {
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
529
|
+
Context nativecontext.ITypiaContext
|
|
530
|
+
Functor *nativehelpers.FunctionProgrammer
|
|
531
|
+
Schema schemaprotobuf.IProtobufSchema
|
|
532
|
+
Index int
|
|
533
|
+
Kind string
|
|
534
|
+
Input *shimast.Node
|
|
535
535
|
}) *shimast.Node {
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
536
|
+
switch schema := props.Schema.(type) {
|
|
537
|
+
case *schemaprotobuf.IProtobufPropertyType_IBoolean:
|
|
538
|
+
return protobufEncodeProgrammer_decode_bool(struct {
|
|
539
|
+
Input *shimast.Node
|
|
540
|
+
Index *int
|
|
541
|
+
}{Input: props.Input, Index: protobufEncodeProgrammer_containerIndex(props.Kind, props.Index)})
|
|
542
|
+
case schemaprotobuf.IProtobufSchema_IBoolean:
|
|
543
|
+
return protobufEncodeProgrammer_decode_bool(struct {
|
|
544
|
+
Input *shimast.Node
|
|
545
|
+
Index *int
|
|
546
|
+
}{Input: props.Input, Index: protobufEncodeProgrammer_containerIndex(props.Kind, props.Index)})
|
|
547
|
+
case *schemaprotobuf.IProtobufPropertyType_IBigint:
|
|
548
|
+
return protobufEncodeProgrammer_decode_bigint(struct {
|
|
549
|
+
Candidates []string
|
|
550
|
+
Type string
|
|
551
|
+
Input *shimast.Node
|
|
552
|
+
Index *int
|
|
553
|
+
}{Input: props.Input, Type: schema.Name, Candidates: []string{schema.Name}, Index: protobufEncodeProgrammer_containerIndex(props.Kind, props.Index)}).Value()
|
|
554
|
+
case schemaprotobuf.IProtobufSchema_IBigint:
|
|
555
|
+
return protobufEncodeProgrammer_decode_bigint(struct {
|
|
556
|
+
Candidates []string
|
|
557
|
+
Type string
|
|
558
|
+
Input *shimast.Node
|
|
559
|
+
Index *int
|
|
560
|
+
}{Input: props.Input, Type: schema.Name, Candidates: []string{schema.Name}, Index: protobufEncodeProgrammer_containerIndex(props.Kind, props.Index)}).Value()
|
|
561
|
+
case *schemaprotobuf.IProtobufPropertyType_INumber:
|
|
562
|
+
return protobufEncodeProgrammer_decode_number(struct {
|
|
563
|
+
Candidates []string
|
|
564
|
+
Type string
|
|
565
|
+
Input *shimast.Node
|
|
566
|
+
Index *int
|
|
567
|
+
}{Input: props.Input, Type: schema.Name, Candidates: []string{schema.Name}, Index: protobufEncodeProgrammer_containerIndex(props.Kind, props.Index)}).Value()
|
|
568
|
+
case schemaprotobuf.IProtobufSchema_INumber:
|
|
569
|
+
return protobufEncodeProgrammer_decode_number(struct {
|
|
570
|
+
Candidates []string
|
|
571
|
+
Type string
|
|
572
|
+
Input *shimast.Node
|
|
573
|
+
Index *int
|
|
574
|
+
}{Input: props.Input, Type: schema.Name, Candidates: []string{schema.Name}, Index: protobufEncodeProgrammer_containerIndex(props.Kind, props.Index)}).Value()
|
|
575
|
+
}
|
|
576
|
+
if protobufEncodeProgrammer_schemaType(props.Schema) == "string" || protobufEncodeProgrammer_schemaType(props.Schema) == "bytes" {
|
|
577
|
+
return protobufEncodeProgrammer_decode_bytes(struct {
|
|
578
|
+
Method string
|
|
579
|
+
Index int
|
|
580
|
+
Input *shimast.Node
|
|
581
|
+
}{Method: protobufEncodeProgrammer_schemaType(props.Schema), Input: props.Input, Index: props.Index})
|
|
582
|
+
}
|
|
583
|
+
return protobufEncodeProgrammer_decode_object(protobufEncodeProgrammer_decodeObjectProps{
|
|
584
|
+
Context: props.Context,
|
|
585
|
+
Functor: props.Functor,
|
|
586
|
+
Schema: props.Schema,
|
|
587
|
+
Input: props.Input,
|
|
588
|
+
Index: props.Index,
|
|
589
|
+
})
|
|
590
590
|
}
|
|
591
591
|
|
|
592
592
|
func protobufEncodeProgrammer_decode_bytes(props struct {
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
593
|
+
Method string
|
|
594
|
+
Index int
|
|
595
|
+
Input *shimast.Node
|
|
596
596
|
}) *shimast.Node {
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
597
|
+
return protobufEncodeProgrammer_expressionBlock([]*shimast.Node{
|
|
598
|
+
protobufEncodeProgrammer_decode_tag(struct {
|
|
599
|
+
Wire nativehelpers.ProtobufWire
|
|
600
|
+
Index int
|
|
601
|
+
}{Wire: nativehelpers.LEN, Index: props.Index}),
|
|
602
|
+
protobufEncodeProgrammer_callWriter(props.Method, []*shimast.Node{props.Input}),
|
|
603
|
+
})
|
|
604
604
|
}
|
|
605
605
|
|
|
606
606
|
type protobufEncodeProgrammer_decodeArrayProps struct {
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
607
|
+
Context nativecontext.ITypiaContext
|
|
608
|
+
Functor *nativehelpers.FunctionProgrammer
|
|
609
|
+
Schema *schemaprotobuf.IProtobufPropertyType_IArray
|
|
610
|
+
Input *shimast.Node
|
|
611
611
|
}
|
|
612
612
|
|
|
613
613
|
func protobufEncodeProgrammer_decode_array(props protobufEncodeProgrammer_decodeArrayProps) *shimast.Node {
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
614
|
+
value := props.Schema.Value
|
|
615
|
+
wire := nativehelpers.VARIANT
|
|
616
|
+
if protobufEncodeProgrammer_schemaType(value) == "object" || protobufEncodeProgrammer_schemaType(value) == "bytes" || protobufEncodeProgrammer_schemaType(value) == "string" {
|
|
617
|
+
wire = nativehelpers.LEN
|
|
618
|
+
} else if number, ok := protobufEncodeProgrammer_numberSchema(value); ok && number == "float" {
|
|
619
|
+
wire = nativehelpers.I32
|
|
620
|
+
}
|
|
621
|
+
forLoop := func() *shimast.Node {
|
|
622
|
+
return protobufEncodeProgrammer_factory.NewForInOrOfStatement(
|
|
623
|
+
shimast.KindForOfStatement,
|
|
624
|
+
nil,
|
|
625
|
+
protobufEncodeProgrammer_factory.NewVariableDeclarationList(
|
|
626
|
+
protobufEncodeProgrammer_factory.NewNodeList([]*shimast.Node{
|
|
627
|
+
protobufEncodeProgrammer_factory.NewVariableDeclaration(protobufEncodeProgrammer_factory.NewIdentifier("elem"), nil, nil, nil),
|
|
628
|
+
}),
|
|
629
|
+
shimast.NodeFlagsConst,
|
|
630
|
+
),
|
|
631
|
+
props.Input,
|
|
632
|
+
protobufEncodeProgrammer_decode_container_value(struct {
|
|
633
|
+
Context nativecontext.ITypiaContext
|
|
634
|
+
Functor *nativehelpers.FunctionProgrammer
|
|
635
|
+
Schema schemaprotobuf.IProtobufSchema
|
|
636
|
+
Index int
|
|
637
|
+
Kind string
|
|
638
|
+
Input *shimast.Node
|
|
639
|
+
}{
|
|
640
|
+
Kind: "array",
|
|
641
|
+
Context: props.Context,
|
|
642
|
+
Functor: props.Functor,
|
|
643
|
+
Input: protobufEncodeProgrammer_factory.NewIdentifier("elem"),
|
|
644
|
+
Index: protobufEncodeProgrammer_indexValue(props.Schema.Index),
|
|
645
|
+
Schema: props.Schema.Value,
|
|
646
|
+
}),
|
|
647
|
+
)
|
|
648
|
+
}
|
|
649
|
+
length := func(block *shimast.Node) *shimast.Node {
|
|
650
|
+
return protobufEncodeProgrammer_factory.NewBlock(protobufEncodeProgrammer_factory.NewNodeList([]*shimast.Node{
|
|
651
|
+
protobufEncodeProgrammer_factory.NewIfStatement(
|
|
652
|
+
protobufEncodeProgrammer_strict_not_equal(
|
|
653
|
+
nativefactories.ExpressionFactory.Number(0),
|
|
654
|
+
nativefactories.IdentifierFactory.Access(props.Input, "length"),
|
|
655
|
+
),
|
|
656
|
+
block,
|
|
657
|
+
nil,
|
|
658
|
+
),
|
|
659
|
+
}), true)
|
|
660
|
+
}
|
|
661
|
+
if wire == nativehelpers.LEN {
|
|
662
|
+
return length(protobufEncodeProgrammer_factory.NewBlock(protobufEncodeProgrammer_factory.NewNodeList([]*shimast.Node{forLoop()}), true))
|
|
663
|
+
}
|
|
664
|
+
return length(protobufEncodeProgrammer_factory.NewBlock(protobufEncodeProgrammer_factory.NewNodeList([]*shimast.Node{
|
|
665
|
+
protobufEncodeProgrammer_factory.NewExpressionStatement(protobufEncodeProgrammer_decode_tag(struct {
|
|
666
|
+
Wire nativehelpers.ProtobufWire
|
|
667
|
+
Index int
|
|
668
|
+
}{Wire: nativehelpers.LEN, Index: protobufEncodeProgrammer_indexValue(props.Schema.Index)})),
|
|
669
|
+
protobufEncodeProgrammer_factory.NewExpressionStatement(protobufEncodeProgrammer_callWriter("fork", nil)),
|
|
670
|
+
forLoop(),
|
|
671
|
+
protobufEncodeProgrammer_factory.NewExpressionStatement(protobufEncodeProgrammer_callWriter("ldelim", nil)),
|
|
672
|
+
}), true))
|
|
673
673
|
}
|
|
674
674
|
|
|
675
675
|
type protobufEncodeProgrammer_decodeObjectProps struct {
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
676
|
+
Context nativecontext.ITypiaContext
|
|
677
|
+
Functor *nativehelpers.FunctionProgrammer
|
|
678
|
+
Schema schemaprotobuf.IProtobufSchema
|
|
679
|
+
Index int
|
|
680
|
+
Input *shimast.Node
|
|
681
681
|
}
|
|
682
682
|
|
|
683
683
|
func protobufEncodeProgrammer_decode_object(props protobufEncodeProgrammer_decodeObjectProps) *shimast.Node {
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
684
|
+
object := protobufEncodeProgrammer_objectSchema(props.Schema)
|
|
685
|
+
objectIndex := 0
|
|
686
|
+
if object != nil {
|
|
687
|
+
objectIndex = object.Index
|
|
688
|
+
}
|
|
689
|
+
return protobufEncodeProgrammer_expressionBlock([]*shimast.Node{
|
|
690
|
+
protobufEncodeProgrammer_decode_tag(struct {
|
|
691
|
+
Wire nativehelpers.ProtobufWire
|
|
692
|
+
Index int
|
|
693
|
+
}{Wire: nativehelpers.LEN, Index: props.Index}),
|
|
694
|
+
protobufEncodeProgrammer_callWriter("fork", nil),
|
|
695
|
+
protobufEncodeProgrammer_factory.NewCallExpression(
|
|
696
|
+
protobufEncodeProgrammer_factory.NewIdentifier(props.Functor.UseLocal(fmt.Sprintf("%so%d", protobufEncodeProgrammer_PREFIX, objectIndex))),
|
|
697
|
+
nil,
|
|
698
|
+
nil,
|
|
699
|
+
protobufEncodeProgrammer_factory.NewNodeList([]*shimast.Node{props.Input}),
|
|
700
|
+
shimast.NodeFlagsNone,
|
|
701
|
+
),
|
|
702
|
+
protobufEncodeProgrammer_callWriter("ldelim", nil),
|
|
703
|
+
})
|
|
704
704
|
}
|
|
705
705
|
|
|
706
706
|
type protobufEncodeProgrammer_decodeMapProps struct {
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
707
|
+
Context nativecontext.ITypiaContext
|
|
708
|
+
Functor *nativehelpers.FunctionProgrammer
|
|
709
|
+
Schema *schemaprotobuf.IProtobufPropertyType_IMap
|
|
710
|
+
Input *shimast.Node
|
|
711
711
|
}
|
|
712
712
|
|
|
713
713
|
func protobufEncodeProgrammer_decode_map(props protobufEncodeProgrammer_decodeMapProps) *shimast.Node {
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
714
|
+
each := []*shimast.Node{
|
|
715
|
+
protobufEncodeProgrammer_factory.NewExpressionStatement(protobufEncodeProgrammer_decode_tag(struct {
|
|
716
|
+
Wire nativehelpers.ProtobufWire
|
|
717
|
+
Index int
|
|
718
|
+
}{Wire: nativehelpers.LEN, Index: protobufEncodeProgrammer_indexValue(props.Schema.Index)})),
|
|
719
|
+
protobufEncodeProgrammer_factory.NewExpressionStatement(protobufEncodeProgrammer_callWriter("fork", nil)),
|
|
720
|
+
}
|
|
721
|
+
keyBlock := protobufEncodeProgrammer_decode_container_value(struct {
|
|
722
|
+
Context nativecontext.ITypiaContext
|
|
723
|
+
Functor *nativehelpers.FunctionProgrammer
|
|
724
|
+
Schema schemaprotobuf.IProtobufSchema
|
|
725
|
+
Index int
|
|
726
|
+
Kind string
|
|
727
|
+
Input *shimast.Node
|
|
728
|
+
}{Kind: "map", Context: props.Context, Functor: props.Functor, Index: 1, Input: protobufEncodeProgrammer_factory.NewIdentifier("key"), Schema: props.Schema.Key})
|
|
729
|
+
valueBlock := protobufEncodeProgrammer_decode_container_value(struct {
|
|
730
|
+
Context nativecontext.ITypiaContext
|
|
731
|
+
Functor *nativehelpers.FunctionProgrammer
|
|
732
|
+
Schema schemaprotobuf.IProtobufSchema
|
|
733
|
+
Index int
|
|
734
|
+
Kind string
|
|
735
|
+
Input *shimast.Node
|
|
736
|
+
}{Kind: "map", Context: props.Context, Functor: props.Functor, Index: 2, Input: protobufEncodeProgrammer_factory.NewIdentifier("value"), Schema: props.Schema.Value})
|
|
737
|
+
each = append(each, keyBlock.Statements()...)
|
|
738
|
+
each = append(each, valueBlock.Statements()...)
|
|
739
|
+
each = append(each, protobufEncodeProgrammer_factory.NewExpressionStatement(protobufEncodeProgrammer_callWriter("ldelim", nil)))
|
|
740
|
+
return protobufEncodeProgrammer_factory.NewBlock(protobufEncodeProgrammer_factory.NewNodeList([]*shimast.Node{
|
|
741
|
+
protobufEncodeProgrammer_factory.NewForInOrOfStatement(
|
|
742
|
+
shimast.KindForOfStatement,
|
|
743
|
+
nil,
|
|
744
|
+
nativefactories.StatementFactory.Entry(nativefactories.StatementFactory_EntryProps{Key: "key", Value: "value"}),
|
|
745
|
+
props.Input,
|
|
746
|
+
protobufEncodeProgrammer_factory.NewBlock(protobufEncodeProgrammer_factory.NewNodeList(each), true),
|
|
747
|
+
),
|
|
748
|
+
}), true)
|
|
749
749
|
}
|
|
750
750
|
|
|
751
751
|
type protobufEncodeProgrammer_exploreObjectsProps struct {
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
752
|
+
Context nativecontext.ITypiaContext
|
|
753
|
+
Functor *nativehelpers.FunctionProgrammer
|
|
754
|
+
Level int
|
|
755
|
+
Input *shimast.Node
|
|
756
|
+
Schemas []schemaprotobuf.IProtobufPropertyType
|
|
757
|
+
Explore nativeinternal.FeatureProgrammer_IExplore
|
|
758
758
|
}
|
|
759
759
|
|
|
760
760
|
func protobufEncodeProgrammer_explore_objects(props protobufEncodeProgrammer_exploreObjectsProps) *shimast.Node {
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
761
|
+
out := func(schema schemaprotobuf.IProtobufPropertyType) *shimast.Node {
|
|
762
|
+
if protobufEncodeProgrammer_schemaType(schema) == "object" {
|
|
763
|
+
return protobufEncodeProgrammer_decode_object(protobufEncodeProgrammer_decodeObjectProps{
|
|
764
|
+
Context: props.Context,
|
|
765
|
+
Functor: props.Functor,
|
|
766
|
+
Schema: schema,
|
|
767
|
+
Index: protobufEncodeProgrammer_indexValue(protobufEncodeProgrammer_propertyIndex(schema)),
|
|
768
|
+
Input: props.Input,
|
|
769
|
+
})
|
|
770
|
+
}
|
|
771
|
+
mapSchema, _ := schema.(*schemaprotobuf.IProtobufPropertyType_IMap)
|
|
772
|
+
return protobufEncodeProgrammer_decode_map(protobufEncodeProgrammer_decodeMapProps{
|
|
773
|
+
Context: props.Context,
|
|
774
|
+
Functor: props.Functor,
|
|
775
|
+
Schema: mapSchema,
|
|
776
|
+
Input: protobufEncodeProgrammer_factory.NewCallExpression(
|
|
777
|
+
nativefactories.IdentifierFactory.Access(protobufEncodeProgrammer_factory.NewIdentifier("Object"), "entries"),
|
|
778
|
+
nil,
|
|
779
|
+
nil,
|
|
780
|
+
protobufEncodeProgrammer_factory.NewNodeList([]*shimast.Node{props.Input}),
|
|
781
|
+
shimast.NodeFlagsNone,
|
|
782
|
+
),
|
|
783
|
+
})
|
|
784
|
+
}
|
|
785
|
+
if len(props.Schemas) == 1 {
|
|
786
|
+
return out(props.Schemas[0])
|
|
787
|
+
}
|
|
788
788
|
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
789
|
+
objects := []*schemametadata.MetadataObjectType{}
|
|
790
|
+
indexes := map[*schemametadata.MetadataObjectType]schemaprotobuf.IProtobufPropertyType{}
|
|
791
|
+
for _, schema := range props.Schemas {
|
|
792
|
+
object := protobufEncodeProgrammer_objectSchema(schema)
|
|
793
|
+
if object == nil {
|
|
794
|
+
continue
|
|
795
|
+
}
|
|
796
|
+
objects = append(objects, object)
|
|
797
|
+
indexes[object] = schema
|
|
798
|
+
}
|
|
799
|
+
specifications := nativehelpers.UnionPredicator.Object(objects)
|
|
800
|
+
if len(specifications) == 0 {
|
|
801
|
+
condition := nativeiterate.Decode_union_object(nativeiterate.Decode_union_objectProps{
|
|
802
|
+
Checker: func(v nativeiterate.Decode_union_object_next) *shimast.Node {
|
|
803
|
+
return nativeprogrammers.IsProgrammer.Decode_object(nativeprogrammers.IsProgrammer_DecodeObjectProps{
|
|
804
|
+
Context: props.Context,
|
|
805
|
+
Functor: props.Functor,
|
|
806
|
+
Object: v.Object,
|
|
807
|
+
Input: v.Input,
|
|
808
|
+
Explore: protobufEncodeProgrammer_feature_explore(v.Explore),
|
|
809
|
+
})
|
|
810
|
+
},
|
|
811
|
+
Decoder: func(v nativeiterate.Decode_union_object_next) *shimast.Node {
|
|
812
|
+
return nativefactories.ExpressionFactory.SelfCall(out(indexes[v.Object]))
|
|
813
|
+
},
|
|
814
|
+
Success: func(expr *shimast.Expression) *shimast.Node {
|
|
815
|
+
return expr
|
|
816
|
+
},
|
|
817
|
+
Escaper: func(v nativeiterate.Decode_union_object_escape) *shimast.Node {
|
|
818
|
+
return protobufEncodeProgrammer_create_throw_error(protobufEncodeProgrammer_throwProps{
|
|
819
|
+
Context: props.Context,
|
|
820
|
+
Functor: props.Functor,
|
|
821
|
+
Expected: v.Expected,
|
|
822
|
+
Input: v.Input,
|
|
823
|
+
})
|
|
824
|
+
},
|
|
825
|
+
Input: props.Input,
|
|
826
|
+
Explore: props.Explore,
|
|
827
|
+
Objects: objects,
|
|
828
|
+
})
|
|
829
|
+
return nativefactories.StatementFactory.Block(condition)
|
|
830
|
+
}
|
|
831
831
|
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
832
|
+
remained := []*schemametadata.MetadataObjectType{}
|
|
833
|
+
for _, object := range objects {
|
|
834
|
+
found := false
|
|
835
|
+
for _, spec := range specifications {
|
|
836
|
+
if spec.Object == object {
|
|
837
|
+
found = true
|
|
838
|
+
break
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
if found == false {
|
|
842
|
+
remained = append(remained, object)
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
expected := "("
|
|
846
|
+
for i, object := range objects {
|
|
847
|
+
if i != 0 {
|
|
848
|
+
expected += " | "
|
|
849
|
+
}
|
|
850
|
+
expected += object.Name
|
|
851
|
+
}
|
|
852
|
+
expected += ")"
|
|
853
853
|
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
854
|
+
statements := []*shimast.Node{}
|
|
855
|
+
for i := len(specifications) - 1; i >= 0; i-- {
|
|
856
|
+
spec := specifications[i]
|
|
857
|
+
key := spec.Property.Key.GetSoleLiteral()
|
|
858
|
+
if key == nil {
|
|
859
|
+
continue
|
|
860
|
+
}
|
|
861
|
+
accessor := nativefactories.IdentifierFactory.Access(props.Input, *key)
|
|
862
|
+
var pred *shimast.Node
|
|
863
|
+
if spec.Neighbor {
|
|
864
|
+
explore := props.Explore
|
|
865
|
+
explore.Tracable = false
|
|
866
|
+
explore.Postfix = explore.Postfix + nativefactories.IdentifierFactory.Postfix(*key)
|
|
867
|
+
pred = nativeprogrammers.IsProgrammer.Decode(nativeprogrammers.IsProgrammer_DecodeProps{
|
|
868
|
+
Context: props.Context,
|
|
869
|
+
Functor: props.Functor,
|
|
870
|
+
Input: accessor,
|
|
871
|
+
Metadata: spec.Property.Value,
|
|
872
|
+
Explore: protobufEncodeProgrammer_checker_explore(explore),
|
|
873
|
+
})
|
|
874
|
+
} else {
|
|
875
|
+
pred = nativefactories.ExpressionFactory.IsRequired(accessor)
|
|
876
|
+
}
|
|
877
|
+
var elseStatement *shimast.Node
|
|
878
|
+
if i == len(specifications)-1 {
|
|
879
|
+
if len(remained) != 0 {
|
|
880
|
+
nextSchemas := []schemaprotobuf.IProtobufPropertyType{}
|
|
881
|
+
for _, object := range remained {
|
|
882
|
+
nextSchemas = append(nextSchemas, indexes[object])
|
|
883
|
+
}
|
|
884
|
+
elseStatement = protobufEncodeProgrammer_factory.NewExpressionStatement(
|
|
885
|
+
nativefactories.ExpressionFactory.SelfCall(protobufEncodeProgrammer_explore_objects(protobufEncodeProgrammer_exploreObjectsProps{
|
|
886
|
+
Context: props.Context,
|
|
887
|
+
Functor: props.Functor,
|
|
888
|
+
Level: props.Level + 1,
|
|
889
|
+
Input: props.Input,
|
|
890
|
+
Schemas: nextSchemas,
|
|
891
|
+
Explore: props.Explore,
|
|
892
|
+
})),
|
|
893
|
+
)
|
|
894
|
+
} else {
|
|
895
|
+
elseStatement = protobufEncodeProgrammer_create_throw_error(protobufEncodeProgrammer_throwProps{
|
|
896
|
+
Context: props.Context,
|
|
897
|
+
Functor: props.Functor,
|
|
898
|
+
Input: props.Input,
|
|
899
|
+
Expected: expected,
|
|
900
|
+
})
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
statement := protobufEncodeProgrammer_factory.NewIfStatement(
|
|
904
|
+
pred,
|
|
905
|
+
protobufEncodeProgrammer_factory.NewExpressionStatement(nativefactories.ExpressionFactory.SelfCall(out(indexes[spec.Object]))),
|
|
906
|
+
elseStatement,
|
|
907
|
+
)
|
|
908
|
+
if len(statements) == 0 {
|
|
909
|
+
statements = append(statements, statement)
|
|
910
|
+
} else {
|
|
911
|
+
statements[0] = protobufEncodeProgrammer_factory.NewIfStatement(pred, protobufEncodeProgrammer_factory.NewExpressionStatement(nativefactories.ExpressionFactory.SelfCall(out(indexes[spec.Object]))), statements[0])
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
return protobufEncodeProgrammer_factory.NewBlock(protobufEncodeProgrammer_factory.NewNodeList(statements), true)
|
|
915
915
|
}
|
|
916
916
|
|
|
917
917
|
func protobufEncodeProgrammer_decode_tag(props struct {
|
|
918
|
-
|
|
919
|
-
|
|
918
|
+
Wire nativehelpers.ProtobufWire
|
|
919
|
+
Index int
|
|
920
920
|
}) *shimast.Node {
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
921
|
+
return protobufEncodeProgrammer_callWriter("uint32", []*shimast.Node{
|
|
922
|
+
nativefactories.ExpressionFactory.Number((props.Index << 3) | int(props.Wire)),
|
|
923
|
+
})
|
|
924
924
|
}
|
|
925
925
|
|
|
926
926
|
func protobufEncodeProgrammer_get_numeric_wire(typ string) nativehelpers.ProtobufWire {
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
927
|
+
if typ == "double" {
|
|
928
|
+
return nativehelpers.I64
|
|
929
|
+
}
|
|
930
|
+
if typ == "float" {
|
|
931
|
+
return nativehelpers.I32
|
|
932
|
+
}
|
|
933
|
+
return nativehelpers.VARIANT
|
|
934
934
|
}
|
|
935
935
|
|
|
936
936
|
type protobufEncodeProgrammer_throwProps struct {
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
937
|
+
Context nativecontext.ITypiaContext
|
|
938
|
+
Functor *nativehelpers.FunctionProgrammer
|
|
939
|
+
Expected string
|
|
940
|
+
Input *shimast.Node
|
|
941
941
|
}
|
|
942
942
|
|
|
943
943
|
func protobufEncodeProgrammer_create_throw_error(props protobufEncodeProgrammer_throwProps) *shimast.Node {
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
944
|
+
return protobufEncodeProgrammer_factory.NewExpressionStatement(
|
|
945
|
+
protobufEncodeProgrammer_factory.NewCallExpression(
|
|
946
|
+
protobufEncodeProgrammer_internal(props.Context, "throwTypeGuardError"),
|
|
947
|
+
nil,
|
|
948
|
+
nil,
|
|
949
|
+
protobufEncodeProgrammer_factory.NewNodeList([]*shimast.Node{
|
|
950
|
+
protobufEncodeProgrammer_factory.NewObjectLiteralExpression(protobufEncodeProgrammer_factory.NewNodeList([]*shimast.Node{
|
|
951
|
+
protobufEncodeProgrammer_factory.NewPropertyAssignment(nil, nativefactories.IdentifierFactory.Identifier("method"), nil, nil, protobufEncodeProgrammer_factory.NewStringLiteral(props.Functor.Method, shimast.TokenFlagsNone)),
|
|
952
|
+
protobufEncodeProgrammer_factory.NewPropertyAssignment(nil, nativefactories.IdentifierFactory.Identifier("expected"), nil, nil, protobufEncodeProgrammer_factory.NewStringLiteral(props.Expected, shimast.TokenFlagsNone)),
|
|
953
|
+
protobufEncodeProgrammer_factory.NewPropertyAssignment(nil, nativefactories.IdentifierFactory.Identifier("value"), nil, nil, props.Input),
|
|
954
|
+
}), true),
|
|
955
|
+
}),
|
|
956
|
+
shimast.NodeFlagsNone,
|
|
957
|
+
),
|
|
958
|
+
)
|
|
959
959
|
}
|
|
960
960
|
|
|
961
961
|
func protobufEncodeProgrammer_callWriter(method string, args []*shimast.Node) *shimast.Node {
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
962
|
+
return protobufEncodeProgrammer_factory.NewCallExpression(
|
|
963
|
+
nativefactories.IdentifierFactory.Access(protobufEncodeProgrammer_factory.NewIdentifier("writer"), method),
|
|
964
|
+
nil,
|
|
965
|
+
nil,
|
|
966
|
+
protobufEncodeProgrammer_factory.NewNodeList(args),
|
|
967
|
+
shimast.NodeFlagsNone,
|
|
968
|
+
)
|
|
969
969
|
}
|
|
970
970
|
|
|
971
971
|
func protobufEncodeProgrammer_expressionBlock(expressions []*shimast.Node) *shimast.Node {
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
972
|
+
statements := make([]*shimast.Node, 0, len(expressions))
|
|
973
|
+
for _, expr := range expressions {
|
|
974
|
+
statements = append(statements, protobufEncodeProgrammer_factory.NewExpressionStatement(expr))
|
|
975
|
+
}
|
|
976
|
+
return protobufEncodeProgrammer_factory.NewBlock(protobufEncodeProgrammer_factory.NewNodeList(statements), true)
|
|
977
977
|
}
|
|
978
978
|
|
|
979
979
|
func protobufEncodeProgrammer_chainUnion(union []protobufEncodeProgrammer_IUnion, context nativecontext.ITypiaContext, functor *nativehelpers.FunctionProgrammer, input *shimast.Node, expected string) *shimast.Node {
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
980
|
+
var next *shimast.Node
|
|
981
|
+
for i := len(union) - 1; i >= 0; i-- {
|
|
982
|
+
var elseStatement *shimast.Node
|
|
983
|
+
if next != nil {
|
|
984
|
+
elseStatement = next
|
|
985
|
+
} else if i == len(union)-1 {
|
|
986
|
+
elseStatement = protobufEncodeProgrammer_create_throw_error(protobufEncodeProgrammer_throwProps{
|
|
987
|
+
Context: context,
|
|
988
|
+
Functor: functor,
|
|
989
|
+
Input: input,
|
|
990
|
+
Expected: expected,
|
|
991
|
+
})
|
|
992
|
+
}
|
|
993
|
+
next = protobufEncodeProgrammer_factory.NewIfStatement(
|
|
994
|
+
union[i].Is(),
|
|
995
|
+
union[i].Value(),
|
|
996
|
+
elseStatement,
|
|
997
|
+
)
|
|
998
|
+
}
|
|
999
|
+
return next
|
|
1000
1000
|
}
|
|
1001
1001
|
|
|
1002
1002
|
func protobufEncodeProgrammer_strict_equal(left *shimast.Node, right *shimast.Node) *shimast.Node {
|
|
1003
|
-
|
|
1003
|
+
return protobufEncodeProgrammer_factory.NewBinaryExpression(nil, left, nil, protobufEncodeProgrammer_factory.NewToken(shimast.KindEqualsEqualsEqualsToken), right)
|
|
1004
1004
|
}
|
|
1005
1005
|
|
|
1006
1006
|
func protobufEncodeProgrammer_strict_not_equal(left *shimast.Node, right *shimast.Node) *shimast.Node {
|
|
1007
|
-
|
|
1007
|
+
return protobufEncodeProgrammer_factory.NewBinaryExpression(nil, left, nil, protobufEncodeProgrammer_factory.NewToken(shimast.KindExclamationEqualsEqualsToken), right)
|
|
1008
1008
|
}
|
|
1009
1009
|
|
|
1010
1010
|
func protobufEncodeProgrammer_logical_and(left *shimast.Node, right *shimast.Node) *shimast.Node {
|
|
1011
|
-
|
|
1011
|
+
return protobufEncodeProgrammer_factory.NewBinaryExpression(nil, left, nil, protobufEncodeProgrammer_factory.NewToken(shimast.KindAmpersandAmpersandToken), right)
|
|
1012
1012
|
}
|
|
1013
1013
|
|
|
1014
1014
|
func protobufEncodeProgrammer_containerIndex(kind string, index int) *int {
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1015
|
+
if kind == "array" {
|
|
1016
|
+
return nil
|
|
1017
|
+
}
|
|
1018
|
+
return &index
|
|
1019
1019
|
}
|
|
1020
1020
|
|
|
1021
1021
|
func protobufEncodeProgrammer_indexValue(index *int) int {
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1022
|
+
if index == nil {
|
|
1023
|
+
return 0
|
|
1024
|
+
}
|
|
1025
|
+
return *index
|
|
1026
1026
|
}
|
|
1027
1027
|
|
|
1028
1028
|
func protobufEncodeProgrammer_propertyIndex(schema schemaprotobuf.IProtobufPropertyType) *int {
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1029
|
+
switch typed := schema.(type) {
|
|
1030
|
+
case *schemaprotobuf.IProtobufPropertyType_IByte:
|
|
1031
|
+
return typed.Index
|
|
1032
|
+
case *schemaprotobuf.IProtobufPropertyType_IBoolean:
|
|
1033
|
+
return typed.Index
|
|
1034
|
+
case *schemaprotobuf.IProtobufPropertyType_IBigint:
|
|
1035
|
+
return typed.Index
|
|
1036
|
+
case *schemaprotobuf.IProtobufPropertyType_INumber:
|
|
1037
|
+
return typed.Index
|
|
1038
|
+
case *schemaprotobuf.IProtobufPropertyType_IString:
|
|
1039
|
+
return typed.Index
|
|
1040
|
+
case *schemaprotobuf.IProtobufPropertyType_IArray:
|
|
1041
|
+
return typed.Index
|
|
1042
|
+
case *schemaprotobuf.IProtobufPropertyType_IObject:
|
|
1043
|
+
return typed.Index
|
|
1044
|
+
case *schemaprotobuf.IProtobufPropertyType_IMap:
|
|
1045
|
+
return typed.Index
|
|
1046
|
+
default:
|
|
1047
|
+
return nil
|
|
1048
|
+
}
|
|
1049
1049
|
}
|
|
1050
1050
|
|
|
1051
1051
|
func protobufEncodeProgrammer_schemaType(schema schemaprotobuf.IProtobufSchema) string {
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1052
|
+
switch typed := schema.(type) {
|
|
1053
|
+
case *schemaprotobuf.IProtobufPropertyType_IByte:
|
|
1054
|
+
return typed.Type
|
|
1055
|
+
case *schemaprotobuf.IProtobufPropertyType_IBoolean:
|
|
1056
|
+
return typed.Type
|
|
1057
|
+
case *schemaprotobuf.IProtobufPropertyType_IBigint:
|
|
1058
|
+
return typed.Type
|
|
1059
|
+
case *schemaprotobuf.IProtobufPropertyType_INumber:
|
|
1060
|
+
return typed.Type
|
|
1061
|
+
case *schemaprotobuf.IProtobufPropertyType_IString:
|
|
1062
|
+
return typed.Type
|
|
1063
|
+
case *schemaprotobuf.IProtobufPropertyType_IArray:
|
|
1064
|
+
return typed.Type
|
|
1065
|
+
case *schemaprotobuf.IProtobufPropertyType_IObject:
|
|
1066
|
+
return typed.Type
|
|
1067
|
+
case *schemaprotobuf.IProtobufPropertyType_IMap:
|
|
1068
|
+
return typed.Type
|
|
1069
|
+
case schemaprotobuf.IProtobufSchema_IByte:
|
|
1070
|
+
return typed.Type
|
|
1071
|
+
case schemaprotobuf.IProtobufSchema_IBoolean:
|
|
1072
|
+
return typed.Type
|
|
1073
|
+
case schemaprotobuf.IProtobufSchema_IBigint:
|
|
1074
|
+
return typed.Type
|
|
1075
|
+
case schemaprotobuf.IProtobufSchema_INumber:
|
|
1076
|
+
return typed.Type
|
|
1077
|
+
case schemaprotobuf.IProtobufSchema_IString:
|
|
1078
|
+
return typed.Type
|
|
1079
|
+
case schemaprotobuf.IProtobufSchema_IArray:
|
|
1080
|
+
return typed.Type
|
|
1081
|
+
case schemaprotobuf.IProtobufSchema_IObject:
|
|
1082
|
+
return typed.Type
|
|
1083
|
+
case schemaprotobuf.IProtobufSchema_IMap:
|
|
1084
|
+
return typed.Type
|
|
1085
|
+
default:
|
|
1086
|
+
return ""
|
|
1087
|
+
}
|
|
1088
1088
|
}
|
|
1089
1089
|
|
|
1090
1090
|
func protobufEncodeProgrammer_numberSchema(schema schemaprotobuf.IProtobufSchema) (string, bool) {
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1091
|
+
switch typed := schema.(type) {
|
|
1092
|
+
case *schemaprotobuf.IProtobufPropertyType_INumber:
|
|
1093
|
+
return typed.Name, true
|
|
1094
|
+
case schemaprotobuf.IProtobufSchema_INumber:
|
|
1095
|
+
return typed.Name, true
|
|
1096
|
+
default:
|
|
1097
|
+
return "", false
|
|
1098
|
+
}
|
|
1099
1099
|
}
|
|
1100
1100
|
|
|
1101
1101
|
func protobufEncodeProgrammer_objectSchema(schema schemaprotobuf.IProtobufSchema) *schemametadata.MetadataObjectType {
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1102
|
+
switch typed := schema.(type) {
|
|
1103
|
+
case *schemaprotobuf.IProtobufPropertyType_IObject:
|
|
1104
|
+
if obj, ok := typed.Object.(*schemametadata.MetadataObjectType); ok {
|
|
1105
|
+
return obj
|
|
1106
|
+
}
|
|
1107
|
+
case schemaprotobuf.IProtobufSchema_IObject:
|
|
1108
|
+
if obj, ok := typed.Object.(*schemametadata.MetadataObjectType); ok {
|
|
1109
|
+
return obj
|
|
1110
|
+
}
|
|
1111
|
+
case *schemaprotobuf.IProtobufPropertyType_IMap:
|
|
1112
|
+
if obj, ok := typed.Map.(*schemametadata.MetadataObjectType); ok {
|
|
1113
|
+
return obj
|
|
1114
|
+
}
|
|
1115
|
+
case schemaprotobuf.IProtobufSchema_IMap:
|
|
1116
|
+
if obj, ok := typed.Map.(*schemametadata.MetadataObjectType); ok {
|
|
1117
|
+
return obj
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
return nil
|
|
1121
1121
|
}
|
|
1122
1122
|
|
|
1123
1123
|
func protobufEncodeProgrammer_objectSchemas(union []schemaprotobuf.IProtobufPropertyType) []schemaprotobuf.IProtobufPropertyType {
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1124
|
+
output := []schemaprotobuf.IProtobufPropertyType{}
|
|
1125
|
+
for _, schema := range union {
|
|
1126
|
+
if protobufEncodeProgrammer_schemaType(schema) == "object" {
|
|
1127
|
+
output = append(output, schema)
|
|
1128
|
+
continue
|
|
1129
|
+
}
|
|
1130
|
+
if mapSchema, ok := schema.(*schemaprotobuf.IProtobufPropertyType_IMap); ok {
|
|
1131
|
+
if _, ok := mapSchema.Map.(*schemametadata.MetadataObjectType); ok {
|
|
1132
|
+
output = append(output, schema)
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
return output
|
|
1137
1137
|
}
|
|
1138
1138
|
|
|
1139
1139
|
func protobufEncodeProgrammer_bigintCandidates(union []schemaprotobuf.IProtobufPropertyType) []string {
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1140
|
+
output := []string{}
|
|
1141
|
+
for _, schema := range union {
|
|
1142
|
+
if typed, ok := schema.(*schemaprotobuf.IProtobufPropertyType_IBigint); ok {
|
|
1143
|
+
output = append(output, typed.Name)
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
return output
|
|
1147
1147
|
}
|
|
1148
1148
|
|
|
1149
1149
|
func protobufEncodeProgrammer_numberCandidates(union []schemaprotobuf.IProtobufPropertyType) []string {
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1150
|
+
output := []string{}
|
|
1151
|
+
for _, schema := range union {
|
|
1152
|
+
if typed, ok := schema.(*schemaprotobuf.IProtobufPropertyType_INumber); ok {
|
|
1153
|
+
output = append(output, typed.Name)
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
return output
|
|
1157
1157
|
}
|
|
1158
1158
|
|
|
1159
1159
|
func protobufEncodeProgrammer_feature_explore(input any) nativeinternal.FeatureProgrammer_IExplore {
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1160
|
+
switch typed := input.(type) {
|
|
1161
|
+
case nativeinternal.FeatureProgrammer_IExplore:
|
|
1162
|
+
return typed
|
|
1163
|
+
case *nativeinternal.FeatureProgrammer_IExplore:
|
|
1164
|
+
return *typed
|
|
1165
|
+
default:
|
|
1166
|
+
return nativeinternal.FeatureProgrammer_IExplore{}
|
|
1167
|
+
}
|
|
1168
1168
|
}
|
|
1169
1169
|
|
|
1170
1170
|
func protobufEncodeProgrammer_checker_explore(input any) nativeinternal.CheckerProgrammer_IExplore {
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1171
|
+
value := protobufEncodeProgrammer_feature_explore(input)
|
|
1172
|
+
return nativeinternal.CheckerProgrammer_IExplore{
|
|
1173
|
+
Tracable: value.Tracable,
|
|
1174
|
+
Source: value.Source,
|
|
1175
|
+
From: value.From,
|
|
1176
|
+
Postfix: value.Postfix,
|
|
1177
|
+
Start: value.Start,
|
|
1178
|
+
}
|
|
1179
1179
|
}
|
|
1180
1180
|
|
|
1181
1181
|
func protobufEncodeProgrammer_import_type(context nativecontext.ITypiaContext, props nativeprogrammers.ImportProgrammer_TypeProps) *shimast.Node {
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1182
|
+
if importer, ok := context.Importer.(interface {
|
|
1183
|
+
Type(nativeprogrammers.ImportProgrammer_TypeProps) *shimast.Node
|
|
1184
|
+
}); ok {
|
|
1185
|
+
return importer.Type(props)
|
|
1186
|
+
}
|
|
1187
|
+
if str, ok := props.Name.(string); ok {
|
|
1188
|
+
return protobufEncodeProgrammer_factory.NewTypeReferenceNode(protobufEncodeProgrammer_factory.NewIdentifier(str), protobufEncodeProgrammer_factory.NewNodeList(props.Arguments))
|
|
1189
|
+
}
|
|
1190
|
+
return props.Name.(*shimast.Node)
|
|
1191
1191
|
}
|
|
1192
1192
|
|
|
1193
1193
|
func protobufEncodeProgrammer_internal(context nativecontext.ITypiaContext, name string) *shimast.Node {
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1194
|
+
if importer, ok := context.Importer.(interface {
|
|
1195
|
+
Internal(string) *shimast.Node
|
|
1196
|
+
}); ok {
|
|
1197
|
+
return importer.Internal(name)
|
|
1198
|
+
}
|
|
1199
|
+
return protobufEncodeProgrammer_factory.NewIdentifier(name)
|
|
1200
1200
|
}
|
|
1201
1201
|
|
|
1202
1202
|
func protobufEncodeProgrammer_method_text(modulo *shimast.Node) string {
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1203
|
+
if modulo == nil {
|
|
1204
|
+
return ""
|
|
1205
|
+
}
|
|
1206
|
+
return modulo.Text()
|
|
1207
1207
|
}
|