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.
Files changed (364) hide show
  1. package/lib/executable/TypiaGenerateWizard.js +55 -8
  2. package/lib/executable/TypiaGenerateWizard.js.map +1 -1
  3. package/lib/executable/TypiaGenerateWizard2.mjs +55 -8
  4. package/lib/executable/TypiaGenerateWizard2.mjs.map +1 -1
  5. package/lib/executable/generate/ttsc.js.map +1 -1
  6. package/lib/executable/setup/PluginConfigurator.js.map +1 -1
  7. package/lib/internal/_randomInteger.js.map +1 -1
  8. package/lib/internal/_validateReport.js.map +1 -1
  9. package/lib/transform.d.ts +2 -13
  10. package/lib/transform.js +4 -11
  11. package/lib/transform.js.map +1 -1
  12. package/lib/transform2.mjs +6 -14
  13. package/lib/transform2.mjs.map +1 -1
  14. package/native/adapter/adapter.go +128 -128
  15. package/native/adapter/cleanup.go +155 -172
  16. package/native/adapter/imports.go +80 -80
  17. package/native/adapter/visit.go +142 -142
  18. package/native/cmd/ttsc-typia/build.go +223 -223
  19. package/native/cmd/ttsc-typia/main.go +57 -57
  20. package/native/cmd/ttsc-typia/transform.go +421 -254
  21. package/native/cmd/ttsc-typia/transform_test.go +40 -0
  22. package/native/core/context/IProgrammerProps.go +7 -7
  23. package/native/core/context/ITransformOptions.go +5 -5
  24. package/native/core/context/ITypiaContext.go +13 -13
  25. package/native/core/context/TransformerError.go +81 -81
  26. package/native/core/factories/CommentFactory.go +9 -9
  27. package/native/core/factories/ExpressionFactory.go +254 -254
  28. package/native/core/factories/FormatCheatSheet.go +23 -23
  29. package/native/core/factories/IdentifierFactory.go +130 -130
  30. package/native/core/factories/JsonMetadataFactory.go +129 -129
  31. package/native/core/factories/LiteralFactory.go +195 -182
  32. package/native/core/factories/MetadataCommentTagFactory.go +379 -379
  33. package/native/core/factories/MetadataFactory.go +462 -462
  34. package/native/core/factories/MetadataTypeTagFactory.go +498 -498
  35. package/native/core/factories/MetadataTypeTagSchemaFactory.go +102 -102
  36. package/native/core/factories/NumericRangeFactory.go +84 -84
  37. package/native/core/factories/ProtobufFactory.go +933 -933
  38. package/native/core/factories/StatementFactory.go +72 -72
  39. package/native/core/factories/TemplateFactory.go +57 -57
  40. package/native/core/factories/TypeFactory.go +125 -125
  41. package/native/core/factories/ValueFactory.go +12 -12
  42. package/native/core/factories/internal/metadata/IMetadataIteratorProps.go +35 -35
  43. package/native/core/factories/internal/metadata/MetadataHelper.go +176 -176
  44. package/native/core/factories/internal/metadata/emend_metadata_atomics.go +69 -69
  45. package/native/core/factories/internal/metadata/emplace_metadata_alias.go +27 -27
  46. package/native/core/factories/internal/metadata/emplace_metadata_array_type.go +33 -33
  47. package/native/core/factories/internal/metadata/emplace_metadata_object.go +209 -209
  48. package/native/core/factories/internal/metadata/emplace_metadata_tuple.go +50 -50
  49. package/native/core/factories/internal/metadata/explore_metadata.go +29 -29
  50. package/native/core/factories/internal/metadata/iterate_metadata.go +46 -46
  51. package/native/core/factories/internal/metadata/iterate_metadata_alias.go +25 -25
  52. package/native/core/factories/internal/metadata/iterate_metadata_array.go +65 -65
  53. package/native/core/factories/internal/metadata/iterate_metadata_atomic.go +49 -49
  54. package/native/core/factories/internal/metadata/iterate_metadata_coalesce.go +22 -22
  55. package/native/core/factories/internal/metadata/iterate_metadata_collection.go +228 -228
  56. package/native/core/factories/internal/metadata/iterate_metadata_comment_tags.go +12 -12
  57. package/native/core/factories/internal/metadata/iterate_metadata_constant.go +71 -71
  58. package/native/core/factories/internal/metadata/iterate_metadata_escape.go +48 -48
  59. package/native/core/factories/internal/metadata/iterate_metadata_function.go +82 -82
  60. package/native/core/factories/internal/metadata/iterate_metadata_intersection.go +319 -319
  61. package/native/core/factories/internal/metadata/iterate_metadata_map.go +51 -51
  62. package/native/core/factories/internal/metadata/iterate_metadata_native.go +85 -85
  63. package/native/core/factories/internal/metadata/iterate_metadata_object.go +27 -27
  64. package/native/core/factories/internal/metadata/iterate_metadata_set.go +37 -37
  65. package/native/core/factories/internal/metadata/iterate_metadata_sort.go +137 -137
  66. package/native/core/factories/internal/metadata/iterate_metadata_template.go +33 -33
  67. package/native/core/factories/internal/metadata/iterate_metadata_tuple.go +16 -16
  68. package/native/core/factories/internal/metadata/iterate_metadata_union.go +18 -18
  69. package/native/core/programmers/AssertProgrammer.go +389 -389
  70. package/native/core/programmers/ImportProgrammer.go +196 -196
  71. package/native/core/programmers/IsProgrammer.go +293 -293
  72. package/native/core/programmers/RandomProgrammer.go +1094 -1094
  73. package/native/core/programmers/ValidateProgrammer.go +369 -369
  74. package/native/core/programmers/functional/FunctionalAssertFunctionProgrammer.go +133 -133
  75. package/native/core/programmers/functional/FunctionalAssertParametersProgrammer.go +104 -104
  76. package/native/core/programmers/functional/FunctionalAssertReturnProgrammer.go +100 -100
  77. package/native/core/programmers/functional/FunctionalIsFunctionProgrammer.go +79 -79
  78. package/native/core/programmers/functional/FunctionalIsParametersProgrammer.go +159 -159
  79. package/native/core/programmers/functional/FunctionalIsReturnProgrammer.go +99 -99
  80. package/native/core/programmers/functional/FunctionalValidateFunctionProgrammer.go +138 -138
  81. package/native/core/programmers/functional/FunctionalValidateParametersProgrammer.go +222 -222
  82. package/native/core/programmers/functional/FunctionalValidateReturnProgrammer.go +116 -116
  83. package/native/core/programmers/functional/internal/FunctionalGeneralProgrammer.go +36 -36
  84. package/native/core/programmers/helpers/AtomicPredicator.go +35 -35
  85. package/native/core/programmers/helpers/CloneJoiner.go +217 -217
  86. package/native/core/programmers/helpers/FunctionProgrammer.go +79 -79
  87. package/native/core/programmers/helpers/HttpMetadataUtil.go +17 -17
  88. package/native/core/programmers/helpers/ICheckEntry.go +5 -5
  89. package/native/core/programmers/helpers/IExpressionEntry.go +6 -6
  90. package/native/core/programmers/helpers/NotationJoiner.go +159 -159
  91. package/native/core/programmers/helpers/OptionPredicator.go +4 -4
  92. package/native/core/programmers/helpers/ProtobufUtil.go +231 -231
  93. package/native/core/programmers/helpers/ProtobufWire.go +6 -6
  94. package/native/core/programmers/helpers/PruneJoiner.go +227 -227
  95. package/native/core/programmers/helpers/RandomJoiner.go +155 -155
  96. package/native/core/programmers/helpers/StringifyJoinder.go +331 -331
  97. package/native/core/programmers/helpers/StringifyPredicator.go +10 -10
  98. package/native/core/programmers/helpers/UnionExplorer.go +835 -835
  99. package/native/core/programmers/helpers/UnionPredicator.go +78 -78
  100. package/native/core/programmers/helpers/disable_function_programmer_declare.go +6 -6
  101. package/native/core/programmers/http/HttpAssertFormDataProgrammer.go +93 -93
  102. package/native/core/programmers/http/HttpAssertHeadersProgrammer.go +42 -42
  103. package/native/core/programmers/http/HttpAssertQueryProgrammer.go +51 -51
  104. package/native/core/programmers/http/HttpFormDataProgrammer.go +351 -351
  105. package/native/core/programmers/http/HttpHeadersProgrammer.go +370 -370
  106. package/native/core/programmers/http/HttpIsFormDataProgrammer.go +109 -109
  107. package/native/core/programmers/http/HttpIsHeadersProgrammer.go +36 -36
  108. package/native/core/programmers/http/HttpIsQueryProgrammer.go +45 -45
  109. package/native/core/programmers/http/HttpParameterProgrammer.go +158 -158
  110. package/native/core/programmers/http/HttpQueryProgrammer.go +422 -422
  111. package/native/core/programmers/http/HttpValidateFormDataProgrammer.go +87 -87
  112. package/native/core/programmers/http/HttpValidateHeadersProgrammer.go +39 -39
  113. package/native/core/programmers/http/HttpValidateQueryProgrammer.go +48 -48
  114. package/native/core/programmers/internal/CheckerProgrammer.go +1490 -1490
  115. package/native/core/programmers/internal/FeatureProgrammer.go +589 -589
  116. package/native/core/programmers/iterate/check_array_length.go +46 -46
  117. package/native/core/programmers/iterate/check_bigint.go +52 -52
  118. package/native/core/programmers/iterate/check_dynamic_key.go +220 -220
  119. package/native/core/programmers/iterate/check_dynamic_properties.go +245 -245
  120. package/native/core/programmers/iterate/check_everything.go +21 -21
  121. package/native/core/programmers/iterate/check_native.go +25 -25
  122. package/native/core/programmers/iterate/check_number.go +135 -135
  123. package/native/core/programmers/iterate/check_object.go +66 -66
  124. package/native/core/programmers/iterate/check_string.go +52 -52
  125. package/native/core/programmers/iterate/check_template.go +57 -57
  126. package/native/core/programmers/iterate/check_union_array_like.go +372 -372
  127. package/native/core/programmers/iterate/decode_union_object.go +118 -118
  128. package/native/core/programmers/iterate/feature_object_entries.go +134 -134
  129. package/native/core/programmers/iterate/json_schema_alias.go +52 -52
  130. package/native/core/programmers/iterate/json_schema_array.go +52 -52
  131. package/native/core/programmers/iterate/json_schema_bigint.go +8 -8
  132. package/native/core/programmers/iterate/json_schema_boolean.go +8 -8
  133. package/native/core/programmers/iterate/json_schema_constant.go +38 -38
  134. package/native/core/programmers/iterate/json_schema_description.go +12 -12
  135. package/native/core/programmers/iterate/json_schema_discriminator.go +47 -47
  136. package/native/core/programmers/iterate/json_schema_escaped.go +58 -58
  137. package/native/core/programmers/iterate/json_schema_jsDocTags.go +34 -34
  138. package/native/core/programmers/iterate/json_schema_native.go +43 -43
  139. package/native/core/programmers/iterate/json_schema_number.go +8 -8
  140. package/native/core/programmers/iterate/json_schema_object.go +149 -149
  141. package/native/core/programmers/iterate/json_schema_plugin.go +35 -35
  142. package/native/core/programmers/iterate/json_schema_station.go +211 -211
  143. package/native/core/programmers/iterate/json_schema_string.go +8 -8
  144. package/native/core/programmers/iterate/json_schema_template.go +53 -53
  145. package/native/core/programmers/iterate/json_schema_title.go +16 -16
  146. package/native/core/programmers/iterate/json_schema_tuple.go +34 -34
  147. package/native/core/programmers/iterate/metadata_to_pattern.go +53 -53
  148. package/native/core/programmers/iterate/postfix_of_tuple.go +5 -5
  149. package/native/core/programmers/iterate/prune_object_properties.go +85 -85
  150. package/native/core/programmers/iterate/stringify_dynamic_properties.go +193 -193
  151. package/native/core/programmers/iterate/stringify_native.go +1 -1
  152. package/native/core/programmers/iterate/stringify_regular_properties.go +84 -84
  153. package/native/core/programmers/iterate/template_to_pattern.go +20 -20
  154. package/native/core/programmers/iterate/wrap_metadata_rest_tuple.go +13 -13
  155. package/native/core/programmers/json/JsonApplicationProgrammer.go +323 -323
  156. package/native/core/programmers/json/JsonAssertParseProgrammer.go +100 -100
  157. package/native/core/programmers/json/JsonAssertStringifyProgrammer.go +88 -88
  158. package/native/core/programmers/json/JsonIsParseProgrammer.go +130 -130
  159. package/native/core/programmers/json/JsonIsStringifyProgrammer.go +92 -92
  160. package/native/core/programmers/json/JsonSchemaProgrammer.go +65 -65
  161. package/native/core/programmers/json/JsonSchemasProgrammer.go +116 -116
  162. package/native/core/programmers/json/JsonStringifyProgrammer.go +1245 -1245
  163. package/native/core/programmers/json/JsonValidateParseProgrammer.go +89 -89
  164. package/native/core/programmers/json/JsonValidateStringifyProgrammer.go +106 -106
  165. package/native/core/programmers/llm/LlmApplicationProgrammer.go +449 -437
  166. package/native/core/programmers/llm/LlmCoerceProgrammer.go +79 -79
  167. package/native/core/programmers/llm/LlmControllerProgrammer.go +35 -35
  168. package/native/core/programmers/llm/LlmMetadataFactory.go +74 -74
  169. package/native/core/programmers/llm/LlmParametersProgrammer.go +105 -132
  170. package/native/core/programmers/llm/LlmParseProgrammer.go +88 -88
  171. package/native/core/programmers/llm/LlmSchemaProgrammer.go +780 -423
  172. package/native/core/programmers/llm/LlmStructuredOutputProgrammer.go +123 -123
  173. package/native/core/programmers/misc/MiscAssertCloneProgrammer.go +82 -82
  174. package/native/core/programmers/misc/MiscAssertPruneProgrammer.go +97 -97
  175. package/native/core/programmers/misc/MiscCloneProgrammer.go +1056 -1056
  176. package/native/core/programmers/misc/MiscIsCloneProgrammer.go +94 -94
  177. package/native/core/programmers/misc/MiscIsPruneProgrammer.go +86 -86
  178. package/native/core/programmers/misc/MiscLiteralsProgrammer.go +99 -99
  179. package/native/core/programmers/misc/MiscPruneProgrammer.go +700 -700
  180. package/native/core/programmers/misc/MiscValidateCloneProgrammer.go +103 -103
  181. package/native/core/programmers/misc/MiscValidatePruneProgrammer.go +94 -94
  182. package/native/core/programmers/notations/NotationAssertGeneralProgrammer.go +85 -85
  183. package/native/core/programmers/notations/NotationGeneralProgrammer.go +1188 -1188
  184. package/native/core/programmers/notations/NotationIsGeneralProgrammer.go +90 -90
  185. package/native/core/programmers/notations/NotationValidateGeneralProgrammer.go +109 -109
  186. package/native/core/programmers/protobuf/ProtobufAssertDecodeProgrammer.go +99 -99
  187. package/native/core/programmers/protobuf/ProtobufAssertEncodeProgrammer.go +114 -114
  188. package/native/core/programmers/protobuf/ProtobufDecodeProgrammer.go +697 -697
  189. package/native/core/programmers/protobuf/ProtobufEncodeProgrammer.go +1039 -1039
  190. package/native/core/programmers/protobuf/ProtobufIsDecodeProgrammer.go +99 -99
  191. package/native/core/programmers/protobuf/ProtobufIsEncodeProgrammer.go +93 -93
  192. package/native/core/programmers/protobuf/ProtobufMessageProgrammer.go +228 -228
  193. package/native/core/programmers/protobuf/ProtobufValidateDecodeProgrammer.go +88 -88
  194. package/native/core/programmers/protobuf/ProtobufValidateEncodeProgrammer.go +120 -120
  195. package/native/core/schemas/metadata/IMetadataDictionary.go +4 -4
  196. package/native/core/schemas/metadata/MetadataAlias.go +15 -15
  197. package/native/core/schemas/metadata/MetadataAliasType.go +36 -36
  198. package/native/core/schemas/metadata/MetadataApplication.go +25 -25
  199. package/native/core/schemas/metadata/MetadataArray.go +15 -15
  200. package/native/core/schemas/metadata/MetadataArrayType.go +31 -31
  201. package/native/core/schemas/metadata/MetadataAtomic.go +45 -45
  202. package/native/core/schemas/metadata/MetadataCollection.go +380 -380
  203. package/native/core/schemas/metadata/MetadataComponents.go +95 -95
  204. package/native/core/schemas/metadata/MetadataConstant.go +31 -31
  205. package/native/core/schemas/metadata/MetadataConstantValue.go +63 -63
  206. package/native/core/schemas/metadata/MetadataEscaped.go +17 -17
  207. package/native/core/schemas/metadata/MetadataFunction.go +30 -30
  208. package/native/core/schemas/metadata/MetadataMap.go +21 -21
  209. package/native/core/schemas/metadata/MetadataNative.go +48 -48
  210. package/native/core/schemas/metadata/MetadataObject.go +15 -15
  211. package/native/core/schemas/metadata/MetadataObjectType.go +116 -116
  212. package/native/core/schemas/metadata/MetadataParameter.go +28 -28
  213. package/native/core/schemas/metadata/MetadataProperty.go +32 -32
  214. package/native/core/schemas/metadata/MetadataSchema.go +766 -766
  215. package/native/core/schemas/metadata/MetadataSet.go +17 -17
  216. package/native/core/schemas/metadata/MetadataTemplate.go +43 -43
  217. package/native/core/schemas/metadata/MetadataTuple.go +10 -10
  218. package/native/core/schemas/metadata/MetadataTupleType.go +38 -38
  219. package/native/core/schemas/protobuf/IProtobufProperty.go +2 -2
  220. package/native/core/schemas/protobuf/IProtobufPropertyType.go +18 -18
  221. package/native/core/schemas/protobuf/IProtobufSchema.go +17 -17
  222. package/native/core/typings/Writable.go +1 -1
  223. package/native/core/utils/PatternUtil.go +38 -38
  224. package/native/core/utils/ProtobufNameEncoder.go +28 -28
  225. package/native/shim/printer/shim.go +213 -213
  226. package/native/third_party/ttsc/driver/host.go +7 -7
  227. package/native/third_party/ttsc/driver/program.go +275 -275
  228. package/native/third_party/ttsc/driver/rewrite.go +219 -219
  229. package/native/third_party/ttsc/shim/ast/lint.go +171 -171
  230. package/native/third_party/ttsc/shim/ast/shim.go +83 -83
  231. package/native/third_party/ttsc/shim/bundled/shim.go +5 -1
  232. package/native/third_party/ttsc/shim/checker/shim.go +79 -79
  233. package/native/third_party/ttsc/shim/compiler/shim.go +16 -1
  234. package/native/third_party/ttsc/shim/core/shim.go +10 -10
  235. package/native/third_party/ttsc/shim/diagnosticwriter/lint.go +79 -79
  236. package/native/third_party/ttsc/shim/diagnosticwriter/shim.go +19 -19
  237. package/native/third_party/ttsc/shim/parser/shim.go +7 -1
  238. package/native/third_party/ttsc/shim/scanner/shim.go +39 -1
  239. package/native/third_party/ttsc/shim/tsoptions/shim.go +51 -1
  240. package/native/third_party/ttsc/shim/tspath/shim.go +72 -1
  241. package/native/third_party/ttsc/shim/vfs/cachedvfs/shim.go +1 -1
  242. package/native/third_party/ttsc/shim/vfs/osvfs/shim.go +1 -1
  243. package/native/third_party/ttsc/shim/vfs/shim.go +4 -1
  244. package/native/transform/CallExpressionTransformer.go +556 -556
  245. package/native/transform/FileTransformer.go +123 -123
  246. package/native/transform/ImportTransformer.go +224 -224
  247. package/native/transform/NodeTransformer.go +11 -11
  248. package/native/transform/TypiaGenerator.go +136 -136
  249. package/native/transform/features/AssertTransformer.go +28 -28
  250. package/native/transform/features/CreateAssertTransformer.go +28 -28
  251. package/native/transform/features/CreateIsTransformer.go +24 -24
  252. package/native/transform/features/CreateRandomTransformer.go +35 -35
  253. package/native/transform/features/CreateValidateTransformer.go +24 -24
  254. package/native/transform/features/IsTransformer.go +24 -24
  255. package/native/transform/features/RandomTransformer.go +37 -37
  256. package/native/transform/features/ValidateTransformer.go +24 -24
  257. package/native/transform/features/functional/FunctionalGenericTransformer.go +48 -48
  258. package/native/transform/features/http/CreateHttpAssertFormDataTransformer.go +11 -11
  259. package/native/transform/features/http/CreateHttpAssertHeadersTransformer.go +11 -11
  260. package/native/transform/features/http/CreateHttpAssertQueryTransformer.go +17 -17
  261. package/native/transform/features/http/CreateHttpFormDataTransformer.go +11 -11
  262. package/native/transform/features/http/CreateHttpHeadersTransformer.go +11 -11
  263. package/native/transform/features/http/CreateHttpIsFormDataTransformer.go +11 -11
  264. package/native/transform/features/http/CreateHttpIsHeadersTransformer.go +11 -11
  265. package/native/transform/features/http/CreateHttpIsQueryTransformer.go +17 -17
  266. package/native/transform/features/http/CreateHttpParameterTransformer.go +11 -11
  267. package/native/transform/features/http/CreateHttpQueryTransformer.go +17 -17
  268. package/native/transform/features/http/CreateHttpValidateFormDataTransformer.go +11 -11
  269. package/native/transform/features/http/CreateHttpValidateHeadersTransformer.go +11 -11
  270. package/native/transform/features/http/CreateHttpValidateQueryTransformer.go +17 -17
  271. package/native/transform/features/http/HttpAssertFormDataTransformer.go +11 -11
  272. package/native/transform/features/http/HttpAssertHeadersTransformer.go +11 -11
  273. package/native/transform/features/http/HttpAssertQueryTransformer.go +17 -17
  274. package/native/transform/features/http/HttpFormDataTransformer.go +11 -11
  275. package/native/transform/features/http/HttpHeadersTransformer.go +11 -11
  276. package/native/transform/features/http/HttpIsFormDataTransformer.go +11 -11
  277. package/native/transform/features/http/HttpIsHeadersTransformer.go +11 -11
  278. package/native/transform/features/http/HttpIsQueryTransformer.go +17 -17
  279. package/native/transform/features/http/HttpParameterTransformer.go +11 -11
  280. package/native/transform/features/http/HttpQueryTransformer.go +17 -17
  281. package/native/transform/features/http/HttpValidateFormDataTransformer.go +11 -11
  282. package/native/transform/features/http/HttpValidateHeadersTransformer.go +11 -11
  283. package/native/transform/features/http/HttpValidateQueryTransformer.go +17 -17
  284. package/native/transform/features/json/JsonApplicationTransformer.go +61 -61
  285. package/native/transform/features/json/JsonAssertParseTransformer.go +11 -11
  286. package/native/transform/features/json/JsonAssertStringifyTransformer.go +11 -11
  287. package/native/transform/features/json/JsonCreateAssertParseTransformer.go +11 -11
  288. package/native/transform/features/json/JsonCreateAssertStringifyTransformer.go +11 -11
  289. package/native/transform/features/json/JsonCreateIsParseTransformer.go +11 -11
  290. package/native/transform/features/json/JsonCreateIsStringifyTransformer.go +11 -11
  291. package/native/transform/features/json/JsonCreateStringifyTransformer.go +11 -11
  292. package/native/transform/features/json/JsonCreateValidateParseTransformer.go +11 -11
  293. package/native/transform/features/json/JsonCreateValidateStringifyProgrammer.go +11 -11
  294. package/native/transform/features/json/JsonIsParseTransformer.go +11 -11
  295. package/native/transform/features/json/JsonIsStringifyTransformer.go +11 -11
  296. package/native/transform/features/json/JsonSchemaTransformer.go +148 -148
  297. package/native/transform/features/json/JsonSchemasTransformer.go +94 -94
  298. package/native/transform/features/json/JsonStringifyTransformer.go +11 -11
  299. package/native/transform/features/json/JsonValidateParseTransformer.go +11 -11
  300. package/native/transform/features/json/JsonValidateStringifyTransformer.go +11 -11
  301. package/native/transform/features/llm/LlmApplicationTransformer.go +43 -43
  302. package/native/transform/features/llm/LlmCoerceTransformer.go +50 -50
  303. package/native/transform/features/llm/LlmControllerTransformer.go +48 -48
  304. package/native/transform/features/llm/LlmCreateCoerceTransformer.go +43 -43
  305. package/native/transform/features/llm/LlmCreateParseTransformer.go +43 -43
  306. package/native/transform/features/llm/LlmParametersTransformer.go +38 -38
  307. package/native/transform/features/llm/LlmParseTransformer.go +50 -50
  308. package/native/transform/features/llm/LlmSchemaTransformer.go +129 -129
  309. package/native/transform/features/llm/LlmStructuredOutputTransformer.go +44 -44
  310. package/native/transform/features/misc/MiscAssertCloneTransformer.go +11 -11
  311. package/native/transform/features/misc/MiscAssertPruneTransformer.go +11 -11
  312. package/native/transform/features/misc/MiscCloneTransformer.go +11 -11
  313. package/native/transform/features/misc/MiscCreateAssertCloneTransformer.go +11 -11
  314. package/native/transform/features/misc/MiscCreateAssertPruneTransformer.go +11 -11
  315. package/native/transform/features/misc/MiscCreateCloneTransformer.go +11 -11
  316. package/native/transform/features/misc/MiscCreateIsCloneTransformer.go +11 -11
  317. package/native/transform/features/misc/MiscCreateIsPruneTransformer.go +11 -11
  318. package/native/transform/features/misc/MiscCreatePruneTransformer.go +11 -11
  319. package/native/transform/features/misc/MiscCreateValidateCloneTransformer.go +11 -11
  320. package/native/transform/features/misc/MiscCreateValidatePruneTransformer.go +11 -11
  321. package/native/transform/features/misc/MiscIsCloneTransformer.go +11 -11
  322. package/native/transform/features/misc/MiscIsPruneTransformer.go +11 -11
  323. package/native/transform/features/misc/MiscLiteralsTransformer.go +21 -21
  324. package/native/transform/features/misc/MiscPruneTransformer.go +11 -11
  325. package/native/transform/features/misc/MiscValidateCloneTransformer.go +11 -11
  326. package/native/transform/features/misc/MiscValidatePruneTransformer.go +11 -11
  327. package/native/transform/features/notations/NotationAssertGeneralTransformer.go +16 -16
  328. package/native/transform/features/notations/NotationCreateAssertGeneralTransformer.go +16 -16
  329. package/native/transform/features/notations/NotationCreateGeneralTransformer.go +16 -16
  330. package/native/transform/features/notations/NotationCreateIsGeneralTransformer.go +16 -16
  331. package/native/transform/features/notations/NotationCreateValidateGeneralTransformer.go +16 -16
  332. package/native/transform/features/notations/NotationGeneralTransformer.go +21 -21
  333. package/native/transform/features/notations/NotationIsGeneralTransformer.go +16 -16
  334. package/native/transform/features/notations/NotationValidateGeneralTransformer.go +16 -16
  335. package/native/transform/features/protobuf/ProtobufAssertDecodeTransformer.go +11 -11
  336. package/native/transform/features/protobuf/ProtobufAssertEncodeTransformer.go +11 -11
  337. package/native/transform/features/protobuf/ProtobufCreateAssertDecodeTransformer.go +11 -11
  338. package/native/transform/features/protobuf/ProtobufCreateAssertEncodeTransformer.go +11 -11
  339. package/native/transform/features/protobuf/ProtobufCreateDecodeTransformer.go +11 -11
  340. package/native/transform/features/protobuf/ProtobufCreateEncodeTransformer.go +11 -11
  341. package/native/transform/features/protobuf/ProtobufCreateIsDecodeTransformer.go +11 -11
  342. package/native/transform/features/protobuf/ProtobufCreateIsEncodeTransformer.go +11 -11
  343. package/native/transform/features/protobuf/ProtobufCreateValidateDecodeTransformer.go +11 -11
  344. package/native/transform/features/protobuf/ProtobufCreateValidateEncodeTransformer.go +11 -11
  345. package/native/transform/features/protobuf/ProtobufDecodeTransformer.go +11 -11
  346. package/native/transform/features/protobuf/ProtobufEncodeTransformer.go +11 -11
  347. package/native/transform/features/protobuf/ProtobufIsDecodeTransformer.go +11 -11
  348. package/native/transform/features/protobuf/ProtobufIsEncodeTransformer.go +11 -11
  349. package/native/transform/features/protobuf/ProtobufMessageTransformer.go +20 -20
  350. package/native/transform/features/protobuf/ProtobufValidateDecodeTransformer.go +11 -11
  351. package/native/transform/features/protobuf/ProtobufValidateEncodeTransformer.go +11 -11
  352. package/native/transform/features/reflect/ReflectMetadataTransformer.go +59 -59
  353. package/native/transform/features/reflect/ReflectNameTransformer.go +78 -78
  354. package/native/transform/features/reflect/ReflectSchemaTransformer.go +121 -121
  355. package/native/transform/features/reflect/ReflectSchemasTransformer.go +55 -55
  356. package/native/transform/internal/GenericTransformer.go +173 -173
  357. package/native/transform/transform.go +32 -32
  358. package/package.json +4 -4
  359. package/src/executable/TypiaGenerateWizard.ts +78 -9
  360. package/src/executable/generate/ttsc.ts +2 -3
  361. package/src/executable/setup/PluginConfigurator.ts +2 -3
  362. package/src/internal/_randomInteger.ts +5 -5
  363. package/src/internal/_validateReport.ts +1 -2
  364. package/src/transform.ts +6 -11
@@ -1,11 +1,11 @@
1
1
  package helpers
2
2
 
3
3
  import (
4
- "strings"
4
+ "strings"
5
5
 
6
- shimast "github.com/microsoft/typescript-go/shim/ast"
7
- nativefactories "github.com/samchon/typia/packages/typia/native/core/factories"
8
- nativemetadata "github.com/samchon/typia/packages/typia/native/core/schemas/metadata"
6
+ shimast "github.com/microsoft/typescript-go/shim/ast"
7
+ nativefactories "github.com/samchon/typia/packages/typia/native/core/factories"
8
+ nativemetadata "github.com/samchon/typia/packages/typia/native/core/schemas/metadata"
9
9
  )
10
10
 
11
11
  type unionExplorerNamespace struct{}
@@ -13,927 +13,927 @@ type unionExplorerNamespace struct{}
13
13
  var UnionExplorer = unionExplorerNamespace{}
14
14
 
15
15
  type UnionExplorer_IExplore struct {
16
- Tracable bool
17
- Source string
18
- From string
19
- Postfix string
20
- Start *int
16
+ Tracable bool
17
+ Source string
18
+ From string
19
+ Postfix string
20
+ Start *int
21
21
  }
22
22
 
23
23
  type UnionExplorer_ObjectConfig struct {
24
- Objector UnionExplorer_IObjector
24
+ Objector UnionExplorer_IObjector
25
25
  }
26
26
 
27
27
  type UnionExplorer_IObjector struct {
28
- Checker func(props UnionExplorer_ObjectorCheckerProps) *shimast.Node
29
- Decoder func(props UnionExplorer_ObjectorDecoderProps) *shimast.Node
30
- Joiner any
31
- Unionizer func(props UnionExplorer_ObjectorUnionizerProps) *shimast.Node
32
- Failure func(props UnionExplorer_ObjectorFailureProps) *shimast.Node
33
- Is func(exp *shimast.Expression) *shimast.Node
34
- Required func(exp *shimast.Expression) *shimast.Node
35
- Full func(props UnionExplorer_ObjectorFullProps) *shimast.Node
36
- Type *shimast.TypeNode
28
+ Checker func(props UnionExplorer_ObjectorCheckerProps) *shimast.Node
29
+ Decoder func(props UnionExplorer_ObjectorDecoderProps) *shimast.Node
30
+ Joiner any
31
+ Unionizer func(props UnionExplorer_ObjectorUnionizerProps) *shimast.Node
32
+ Failure func(props UnionExplorer_ObjectorFailureProps) *shimast.Node
33
+ Is func(exp *shimast.Expression) *shimast.Node
34
+ Required func(exp *shimast.Expression) *shimast.Node
35
+ Full func(props UnionExplorer_ObjectorFullProps) *shimast.Node
36
+ Type *shimast.TypeNode
37
37
  }
38
38
 
39
39
  type UnionExplorer_ObjectorCheckerProps struct {
40
- Metadata *nativemetadata.MetadataSchema
41
- Input *shimast.Expression
42
- Explore any
40
+ Metadata *nativemetadata.MetadataSchema
41
+ Input *shimast.Expression
42
+ Explore any
43
43
  }
44
44
 
45
45
  type UnionExplorer_ObjectorDecoderProps struct {
46
- Input *shimast.Expression
47
- Object *nativemetadata.MetadataObjectType
48
- Explore any
46
+ Input *shimast.Expression
47
+ Object *nativemetadata.MetadataObjectType
48
+ Explore any
49
49
  }
50
50
 
51
51
  type UnionExplorer_ObjectorUnionizerProps struct {
52
- Objects []*nativemetadata.MetadataObjectType
53
- Input *shimast.Expression
54
- Explore any
52
+ Objects []*nativemetadata.MetadataObjectType
53
+ Input *shimast.Expression
54
+ Explore any
55
55
  }
56
56
 
57
57
  type UnionExplorer_ObjectorFailureProps struct {
58
- Input *shimast.Expression
59
- Expected string
60
- Explore any
58
+ Input *shimast.Expression
59
+ Expected string
60
+ Explore any
61
61
  }
62
62
 
63
63
  type UnionExplorer_ObjectorFullProps struct {
64
- Condition *shimast.Expression
65
- Input *shimast.Expression
66
- Expected string
67
- Explore any
64
+ Condition *shimast.Expression
65
+ Input *shimast.Expression
66
+ Expected string
67
+ Explore any
68
68
  }
69
69
 
70
70
  type UnionExplorer_ObjectProps struct {
71
- Config UnionExplorer_ObjectConfig
72
- Level int
73
- Objects []*nativemetadata.MetadataObjectType
74
- Input *shimast.Expression
75
- Explore any
71
+ Config UnionExplorer_ObjectConfig
72
+ Level int
73
+ Objects []*nativemetadata.MetadataObjectType
74
+ Input *shimast.Expression
75
+ Explore any
76
76
  }
77
77
 
78
78
  type UnionExplorer_ArrayLikeConfig struct {
79
- Checker func(props UnionExplorer_ArrayLikeCheckerProps) *shimast.Node
80
- Decoder func(props UnionExplorer_ArrayLikeDecoderProps) *shimast.Node
81
- Empty *shimast.Node
82
- Success *shimast.Expression
83
- Failure func(props UnionExplorer_ArrayLikeFailureProps) *shimast.Node
79
+ Checker func(props UnionExplorer_ArrayLikeCheckerProps) *shimast.Node
80
+ Decoder func(props UnionExplorer_ArrayLikeDecoderProps) *shimast.Node
81
+ Empty *shimast.Node
82
+ Success *shimast.Expression
83
+ Failure func(props UnionExplorer_ArrayLikeFailureProps) *shimast.Node
84
84
  }
85
85
 
86
86
  type UnionExplorer_ArrayLikeCheckerProps struct {
87
- Input *shimast.Expression
88
- Definition any
89
- Explore any
90
- Container *shimast.Expression
87
+ Input *shimast.Expression
88
+ Definition any
89
+ Explore any
90
+ Container *shimast.Expression
91
91
  }
92
92
 
93
93
  type UnionExplorer_ArrayLikeDecoderProps struct {
94
- Input *shimast.Expression
95
- Definition any
96
- Explore any
94
+ Input *shimast.Expression
95
+ Definition any
96
+ Explore any
97
97
  }
98
98
 
99
99
  type UnionExplorer_ArrayLikeFailureProps struct {
100
- Input *shimast.Expression
101
- Expected string
102
- Explore any
100
+ Input *shimast.Expression
101
+ Expected string
102
+ Explore any
103
103
  }
104
104
 
105
105
  type UnionExplorer_TupleProps struct {
106
- Config UnionExplorer_ArrayLikeConfig
107
- Parameters []*shimast.Node
108
- Input *shimast.Expression
109
- Tuples []*nativemetadata.MetadataTuple
110
- Explore any
106
+ Config UnionExplorer_ArrayLikeConfig
107
+ Parameters []*shimast.Node
108
+ Input *shimast.Expression
109
+ Tuples []*nativemetadata.MetadataTuple
110
+ Explore any
111
111
  }
112
112
 
113
113
  type UnionExplorer_ArrayProps struct {
114
- Config UnionExplorer_ArrayLikeConfig
115
- Parameters []*shimast.Node
116
- Input *shimast.Expression
117
- Arrays []*nativemetadata.MetadataArray
118
- Explore any
114
+ Config UnionExplorer_ArrayLikeConfig
115
+ Parameters []*shimast.Node
116
+ Input *shimast.Expression
117
+ Arrays []*nativemetadata.MetadataArray
118
+ Explore any
119
119
  }
120
120
 
121
121
  type UnionExplorer_ArrayOrTupleProps struct {
122
- Config UnionExplorer_ArrayLikeConfig
123
- Parameters []*shimast.Node
124
- Input *shimast.Expression
125
- Definitions []any
126
- Explore any
122
+ Config UnionExplorer_ArrayLikeConfig
123
+ Parameters []*shimast.Node
124
+ Input *shimast.Expression
125
+ Definitions []any
126
+ Explore any
127
127
  }
128
128
 
129
129
  type UnionExplorer_SetProps struct {
130
- Config UnionExplorer_ArrayLikeConfig
131
- Parameters []*shimast.Node
132
- Input *shimast.Expression
133
- Sets []*nativemetadata.MetadataSet
134
- Explore any
130
+ Config UnionExplorer_ArrayLikeConfig
131
+ Parameters []*shimast.Node
132
+ Input *shimast.Expression
133
+ Sets []*nativemetadata.MetadataSet
134
+ Explore any
135
135
  }
136
136
 
137
137
  type UnionExplorer_MapProps struct {
138
- Config UnionExplorer_ArrayLikeConfig
139
- Parameters []*shimast.Node
140
- Input *shimast.Expression
141
- Maps []*nativemetadata.MetadataMap
142
- Explore any
138
+ Config UnionExplorer_ArrayLikeConfig
139
+ Parameters []*shimast.Node
140
+ Input *shimast.Expression
141
+ Maps []*nativemetadata.MetadataMap
142
+ Explore any
143
143
  }
144
144
 
145
145
  func (unionExplorerNamespace) Object(props UnionExplorer_ObjectProps) *shimast.Node {
146
- if len(props.Objects) == 1 {
147
- return props.Config.Objector.Decoder(UnionExplorer_ObjectorDecoderProps{
148
- Input: props.Input,
149
- Object: props.Objects[0],
150
- Explore: props.Explore,
151
- })
152
- }
153
-
154
- names := make([]string, 0, len(props.Objects))
155
- for _, obj := range props.Objects {
156
- names = append(names, obj.Name)
157
- }
158
- expected := "(" + strings.Join(names, " | ") + ")"
159
-
160
- specList := UnionPredicator.Object(props.Objects)
161
- if len(specList) == 0 {
162
- condition := props.Config.Objector.Unionizer(UnionExplorer_ObjectorUnionizerProps{
163
- Objects: props.Objects,
164
- Input: props.Input,
165
- Explore: unionExplorer_with_tracable(props.Explore, false),
166
- })
167
- if props.Config.Objector.Full != nil {
168
- return props.Config.Objector.Full(UnionExplorer_ObjectorFullProps{
169
- Condition: condition,
170
- Expected: expected,
171
- Explore: props.Explore,
172
- Input: props.Input,
173
- })
174
- }
175
- return condition
176
- }
177
-
178
- remained := []*nativemetadata.MetadataObjectType{}
179
- for _, obj := range props.Objects {
180
- found := false
181
- for _, spec := range specList {
182
- if spec.Object == obj {
183
- found = true
184
- break
185
- }
186
- }
187
- if found == false {
188
- remained = append(remained, obj)
189
- }
190
- }
191
-
192
- filtered := []UnionPredicator_ISpecialized{}
193
- for _, spec := range specList {
194
- if spec.Property.Key.GetSoleLiteral() != nil {
195
- filtered = append(filtered, spec)
196
- }
197
- }
198
- if len(filtered) == 0 {
199
- condition := props.Config.Objector.Unionizer(UnionExplorer_ObjectorUnionizerProps{
200
- Objects: props.Objects,
201
- Input: props.Input,
202
- Explore: unionExplorer_with_tracable(props.Explore, false),
203
- })
204
- if props.Config.Objector.Full != nil {
205
- return props.Config.Objector.Full(UnionExplorer_ObjectorFullProps{
206
- Condition: condition,
207
- Expected: expected,
208
- Explore: props.Explore,
209
- Input: props.Input,
210
- })
211
- }
212
- return condition
213
- }
214
-
215
- var condition *shimast.Node
216
- for i := len(filtered) - 1; i >= 0; i-- {
217
- spec := filtered[i]
218
- key := *spec.Property.Key.GetSoleLiteral()
219
- accessor := nativefactories.IdentifierFactory.Access(props.Input, key)
220
-
221
- var pred *shimast.Node
222
- if spec.Neighbor {
223
- pred = props.Config.Objector.Checker(UnionExplorer_ObjectorCheckerProps{
224
- Input: accessor,
225
- Metadata: spec.Property.Value,
226
- Explore: unionExplorer_with_postfix(props.Explore, false, nativefactories.IdentifierFactory.Postfix(key)),
227
- })
228
- } else {
229
- pred = nativefactories.ExpressionFactory.IsRequired(accessor)
230
- if props.Config.Objector.Required != nil {
231
- pred = props.Config.Objector.Required(pred)
232
- }
233
- }
234
- if props.Config.Objector.Is != nil {
235
- pred = props.Config.Objector.Is(pred)
236
- }
237
-
238
- var elseStatement *shimast.Node
239
- if i == len(filtered)-1 {
240
- if len(remained) != 0 {
241
- elseStatement = unionExplorer_factory.NewReturnStatement(UnionExplorer.Object(UnionExplorer_ObjectProps{
242
- Config: props.Config,
243
- Level: props.Level + 1,
244
- Input: props.Input,
245
- Objects: remained,
246
- Explore: props.Explore,
247
- }))
248
- } else {
249
- elseStatement = props.Config.Objector.Failure(UnionExplorer_ObjectorFailureProps{
250
- Input: props.Input,
251
- Explore: props.Explore,
252
- Expected: expected,
253
- })
254
- }
255
- } else {
256
- elseStatement = condition
257
- }
258
-
259
- condition = unionExplorer_factory.NewIfStatement(
260
- pred,
261
- unionExplorer_factory.NewReturnStatement(
262
- props.Config.Objector.Decoder(UnionExplorer_ObjectorDecoderProps{
263
- Object: spec.Object,
264
- Input: props.Input,
265
- Explore: props.Explore,
266
- }),
267
- ),
268
- elseStatement,
269
- )
270
- }
271
-
272
- return unionExplorer_factory.NewCallExpression(
273
- unionExplorer_factory.NewArrowFunction(
274
- nil,
275
- nil,
276
- unionExplorer_factory.NewNodeList(nil),
277
- nil,
278
- nil,
279
- unionExplorer_factory.NewToken(shimast.KindEqualsGreaterThanToken),
280
- unionExplorer_factory.NewBlock(unionExplorer_factory.NewNodeList([]*shimast.Node{condition}), true),
281
- ),
282
- nil,
283
- nil,
284
- nil,
285
- shimast.NodeFlagsNone,
286
- )
146
+ if len(props.Objects) == 1 {
147
+ return props.Config.Objector.Decoder(UnionExplorer_ObjectorDecoderProps{
148
+ Input: props.Input,
149
+ Object: props.Objects[0],
150
+ Explore: props.Explore,
151
+ })
152
+ }
153
+
154
+ names := make([]string, 0, len(props.Objects))
155
+ for _, obj := range props.Objects {
156
+ names = append(names, obj.Name)
157
+ }
158
+ expected := "(" + strings.Join(names, " | ") + ")"
159
+
160
+ specList := UnionPredicator.Object(props.Objects)
161
+ if len(specList) == 0 {
162
+ condition := props.Config.Objector.Unionizer(UnionExplorer_ObjectorUnionizerProps{
163
+ Objects: props.Objects,
164
+ Input: props.Input,
165
+ Explore: unionExplorer_with_tracable(props.Explore, false),
166
+ })
167
+ if props.Config.Objector.Full != nil {
168
+ return props.Config.Objector.Full(UnionExplorer_ObjectorFullProps{
169
+ Condition: condition,
170
+ Expected: expected,
171
+ Explore: props.Explore,
172
+ Input: props.Input,
173
+ })
174
+ }
175
+ return condition
176
+ }
177
+
178
+ remained := []*nativemetadata.MetadataObjectType{}
179
+ for _, obj := range props.Objects {
180
+ found := false
181
+ for _, spec := range specList {
182
+ if spec.Object == obj {
183
+ found = true
184
+ break
185
+ }
186
+ }
187
+ if found == false {
188
+ remained = append(remained, obj)
189
+ }
190
+ }
191
+
192
+ filtered := []UnionPredicator_ISpecialized{}
193
+ for _, spec := range specList {
194
+ if spec.Property.Key.GetSoleLiteral() != nil {
195
+ filtered = append(filtered, spec)
196
+ }
197
+ }
198
+ if len(filtered) == 0 {
199
+ condition := props.Config.Objector.Unionizer(UnionExplorer_ObjectorUnionizerProps{
200
+ Objects: props.Objects,
201
+ Input: props.Input,
202
+ Explore: unionExplorer_with_tracable(props.Explore, false),
203
+ })
204
+ if props.Config.Objector.Full != nil {
205
+ return props.Config.Objector.Full(UnionExplorer_ObjectorFullProps{
206
+ Condition: condition,
207
+ Expected: expected,
208
+ Explore: props.Explore,
209
+ Input: props.Input,
210
+ })
211
+ }
212
+ return condition
213
+ }
214
+
215
+ var condition *shimast.Node
216
+ for i := len(filtered) - 1; i >= 0; i-- {
217
+ spec := filtered[i]
218
+ key := *spec.Property.Key.GetSoleLiteral()
219
+ accessor := nativefactories.IdentifierFactory.Access(props.Input, key)
220
+
221
+ var pred *shimast.Node
222
+ if spec.Neighbor {
223
+ pred = props.Config.Objector.Checker(UnionExplorer_ObjectorCheckerProps{
224
+ Input: accessor,
225
+ Metadata: spec.Property.Value,
226
+ Explore: unionExplorer_with_postfix(props.Explore, false, nativefactories.IdentifierFactory.Postfix(key)),
227
+ })
228
+ } else {
229
+ pred = nativefactories.ExpressionFactory.IsRequired(accessor)
230
+ if props.Config.Objector.Required != nil {
231
+ pred = props.Config.Objector.Required(pred)
232
+ }
233
+ }
234
+ if props.Config.Objector.Is != nil {
235
+ pred = props.Config.Objector.Is(pred)
236
+ }
237
+
238
+ var elseStatement *shimast.Node
239
+ if i == len(filtered)-1 {
240
+ if len(remained) != 0 {
241
+ elseStatement = unionExplorer_factory.NewReturnStatement(UnionExplorer.Object(UnionExplorer_ObjectProps{
242
+ Config: props.Config,
243
+ Level: props.Level + 1,
244
+ Input: props.Input,
245
+ Objects: remained,
246
+ Explore: props.Explore,
247
+ }))
248
+ } else {
249
+ elseStatement = props.Config.Objector.Failure(UnionExplorer_ObjectorFailureProps{
250
+ Input: props.Input,
251
+ Explore: props.Explore,
252
+ Expected: expected,
253
+ })
254
+ }
255
+ } else {
256
+ elseStatement = condition
257
+ }
258
+
259
+ condition = unionExplorer_factory.NewIfStatement(
260
+ pred,
261
+ unionExplorer_factory.NewReturnStatement(
262
+ props.Config.Objector.Decoder(UnionExplorer_ObjectorDecoderProps{
263
+ Object: spec.Object,
264
+ Input: props.Input,
265
+ Explore: props.Explore,
266
+ }),
267
+ ),
268
+ elseStatement,
269
+ )
270
+ }
271
+
272
+ return unionExplorer_factory.NewCallExpression(
273
+ unionExplorer_factory.NewArrowFunction(
274
+ nil,
275
+ nil,
276
+ unionExplorer_factory.NewNodeList(nil),
277
+ nil,
278
+ nil,
279
+ unionExplorer_factory.NewToken(shimast.KindEqualsGreaterThanToken),
280
+ unionExplorer_factory.NewBlock(unionExplorer_factory.NewNodeList([]*shimast.Node{condition}), true),
281
+ ),
282
+ nil,
283
+ nil,
284
+ nil,
285
+ shimast.NodeFlagsNone,
286
+ )
287
287
  }
288
288
 
289
289
  func (unionExplorerNamespace) Tuple(props UnionExplorer_TupleProps) *shimast.Node {
290
- definitions := make([]any, 0, len(props.Tuples))
291
- for _, tuple := range props.Tuples {
292
- definitions = append(definitions, tuple)
293
- }
294
- return unionExplorer_check_union_array_like(unionExplorer_check_union_array_likeProps{
295
- Config: props.Config,
296
- Accessor: unionExplorer_check_union_array_likeAccessor{
297
- Transform: func(x any) any { return x },
298
- Element: func(x any) any { return x },
299
- Size: func(input *shimast.Expression) *shimast.Node { return nil },
300
- Front: func(input *shimast.Expression) *shimast.Node { return input },
301
- Array: func(input *shimast.Expression) *shimast.Node { return input },
302
- Name: func(t any, elem any) string {
303
- return t.(*nativemetadata.MetadataTuple).Type.Name
304
- },
305
- },
306
- Parameters: props.Parameters,
307
- Input: props.Input,
308
- Definitions: definitions,
309
- Explore: props.Explore,
310
- })
290
+ definitions := make([]any, 0, len(props.Tuples))
291
+ for _, tuple := range props.Tuples {
292
+ definitions = append(definitions, tuple)
293
+ }
294
+ return unionExplorer_check_union_array_like(unionExplorer_check_union_array_likeProps{
295
+ Config: props.Config,
296
+ Accessor: unionExplorer_check_union_array_likeAccessor{
297
+ Transform: func(x any) any { return x },
298
+ Element: func(x any) any { return x },
299
+ Size: func(input *shimast.Expression) *shimast.Node { return nil },
300
+ Front: func(input *shimast.Expression) *shimast.Node { return input },
301
+ Array: func(input *shimast.Expression) *shimast.Node { return input },
302
+ Name: func(t any, elem any) string {
303
+ return t.(*nativemetadata.MetadataTuple).Type.Name
304
+ },
305
+ },
306
+ Parameters: props.Parameters,
307
+ Input: props.Input,
308
+ Definitions: definitions,
309
+ Explore: props.Explore,
310
+ })
311
311
  }
312
312
 
313
313
  func (unionExplorerNamespace) Array(props UnionExplorer_ArrayProps) *shimast.Node {
314
- definitions := make([]any, 0, len(props.Arrays))
315
- for _, array := range props.Arrays {
316
- definitions = append(definitions, array)
317
- }
318
- return unionExplorer_check_union_array_like(unionExplorer_check_union_array_likeProps{
319
- Config: props.Config,
320
- Accessor: unionExplorer_check_union_array_likeAccessor{
321
- Transform: func(x any) any { return x },
322
- Element: func(x any) any {
323
- return x.(*nativemetadata.MetadataArray).Type.Value
324
- },
325
- Size: func(input *shimast.Expression) *shimast.Node {
326
- return nativefactories.IdentifierFactory.Access(input, "length")
327
- },
328
- Front: func(input *shimast.Expression) *shimast.Node {
329
- return unionExplorer_factory.NewElementAccessExpression(input, nil, nativefactories.ExpressionFactory.Number(0), shimast.NodeFlagsNone)
330
- },
331
- Array: func(input *shimast.Expression) *shimast.Node { return input },
332
- Name: func(t any, elem any) string {
333
- return t.(*nativemetadata.MetadataArray).Type.Name
334
- },
335
- },
336
- Parameters: props.Parameters,
337
- Input: props.Input,
338
- Definitions: definitions,
339
- Explore: props.Explore,
340
- })
314
+ definitions := make([]any, 0, len(props.Arrays))
315
+ for _, array := range props.Arrays {
316
+ definitions = append(definitions, array)
317
+ }
318
+ return unionExplorer_check_union_array_like(unionExplorer_check_union_array_likeProps{
319
+ Config: props.Config,
320
+ Accessor: unionExplorer_check_union_array_likeAccessor{
321
+ Transform: func(x any) any { return x },
322
+ Element: func(x any) any {
323
+ return x.(*nativemetadata.MetadataArray).Type.Value
324
+ },
325
+ Size: func(input *shimast.Expression) *shimast.Node {
326
+ return nativefactories.IdentifierFactory.Access(input, "length")
327
+ },
328
+ Front: func(input *shimast.Expression) *shimast.Node {
329
+ return unionExplorer_factory.NewElementAccessExpression(input, nil, nativefactories.ExpressionFactory.Number(0), shimast.NodeFlagsNone)
330
+ },
331
+ Array: func(input *shimast.Expression) *shimast.Node { return input },
332
+ Name: func(t any, elem any) string {
333
+ return t.(*nativemetadata.MetadataArray).Type.Name
334
+ },
335
+ },
336
+ Parameters: props.Parameters,
337
+ Input: props.Input,
338
+ Definitions: definitions,
339
+ Explore: props.Explore,
340
+ })
341
341
  }
342
342
 
343
343
  func (unionExplorerNamespace) Array_or_tuple(props UnionExplorer_ArrayOrTupleProps) *shimast.Node {
344
- return unionExplorer_check_union_array_like(unionExplorer_check_union_array_likeProps{
345
- Config: props.Config,
346
- Accessor: unionExplorer_check_union_array_likeAccessor{
347
- Transform: func(x any) any { return x },
348
- Element: func(x any) any {
349
- if array, ok := x.(*nativemetadata.MetadataArray); ok {
350
- return array.Type.Value
351
- }
352
- return x
353
- },
354
- Size: func(input *shimast.Expression) *shimast.Node {
355
- return nativefactories.IdentifierFactory.Access(input, "length")
356
- },
357
- Front: func(input *shimast.Expression) *shimast.Node {
358
- return unionExplorer_factory.NewElementAccessExpression(input, nil, nativefactories.ExpressionFactory.Number(0), shimast.NodeFlagsNone)
359
- },
360
- Array: func(input *shimast.Expression) *shimast.Node { return input },
361
- Name: func(m any, elem any) string {
362
- switch v := m.(type) {
363
- case *nativemetadata.MetadataArray:
364
- return v.Type.Name
365
- case *nativemetadata.MetadataTuple:
366
- return v.Type.Name
367
- default:
368
- return "unknown"
369
- }
370
- },
371
- },
372
- Parameters: props.Parameters,
373
- Input: props.Input,
374
- Definitions: props.Definitions,
375
- Explore: props.Explore,
376
- })
344
+ return unionExplorer_check_union_array_like(unionExplorer_check_union_array_likeProps{
345
+ Config: props.Config,
346
+ Accessor: unionExplorer_check_union_array_likeAccessor{
347
+ Transform: func(x any) any { return x },
348
+ Element: func(x any) any {
349
+ if array, ok := x.(*nativemetadata.MetadataArray); ok {
350
+ return array.Type.Value
351
+ }
352
+ return x
353
+ },
354
+ Size: func(input *shimast.Expression) *shimast.Node {
355
+ return nativefactories.IdentifierFactory.Access(input, "length")
356
+ },
357
+ Front: func(input *shimast.Expression) *shimast.Node {
358
+ return unionExplorer_factory.NewElementAccessExpression(input, nil, nativefactories.ExpressionFactory.Number(0), shimast.NodeFlagsNone)
359
+ },
360
+ Array: func(input *shimast.Expression) *shimast.Node { return input },
361
+ Name: func(m any, elem any) string {
362
+ switch v := m.(type) {
363
+ case *nativemetadata.MetadataArray:
364
+ return v.Type.Name
365
+ case *nativemetadata.MetadataTuple:
366
+ return v.Type.Name
367
+ default:
368
+ return "unknown"
369
+ }
370
+ },
371
+ },
372
+ Parameters: props.Parameters,
373
+ Input: props.Input,
374
+ Definitions: props.Definitions,
375
+ Explore: props.Explore,
376
+ })
377
377
  }
378
378
 
379
379
  func (unionExplorerNamespace) Set(props UnionExplorer_SetProps) *shimast.Node {
380
- definitions := make([]any, 0, len(props.Sets))
381
- for _, set := range props.Sets {
382
- definitions = append(definitions, set.Value)
383
- }
384
- return unionExplorer_check_union_array_like(unionExplorer_check_union_array_likeProps{
385
- Config: props.Config,
386
- Accessor: unionExplorer_check_union_array_likeAccessor{
387
- Transform: func(value any) any {
388
- meta := value.(*nativemetadata.MetadataSchema)
389
- return nativemetadata.MetadataArray_create(nativemetadata.MetadataArray{
390
- Tags: [][]nativemetadata.IMetadataTypeTag{},
391
- Type: nativemetadata.MetadataArrayType_create(nativemetadata.MetadataArrayType{
392
- Name: "Set<" + meta.GetName() + ">",
393
- Index: nil,
394
- Recursive: false,
395
- Nullables: []bool{},
396
- Value: meta,
397
- }),
398
- })
399
- },
400
- Element: func(array any) any {
401
- return array.(*nativemetadata.MetadataArray).Type.Value
402
- },
403
- Size: func(input *shimast.Expression) *shimast.Node {
404
- return nativefactories.IdentifierFactory.Access(input, "size")
405
- },
406
- Front: func(input *shimast.Expression) *shimast.Node {
407
- values := unionExplorer_factory.NewCallExpression(
408
- nativefactories.IdentifierFactory.Access(input, "values"),
409
- nil,
410
- nil,
411
- nil,
412
- shimast.NodeFlagsNone,
413
- )
414
- next := unionExplorer_factory.NewCallExpression(
415
- nativefactories.IdentifierFactory.Access(values, "next"),
416
- nil,
417
- nil,
418
- nil,
419
- shimast.NodeFlagsNone,
420
- )
421
- return nativefactories.IdentifierFactory.Access(next, "value")
422
- },
423
- Array: func(input *shimast.Expression) *shimast.Node {
424
- return unionExplorer_factory.NewArrayLiteralExpression(
425
- unionExplorer_factory.NewNodeList([]*shimast.Node{
426
- unionExplorer_factory.NewSpreadElement(input),
427
- }),
428
- false,
429
- )
430
- },
431
- Name: func(_m any, elem any) string {
432
- return "Set<" + elem.(*nativemetadata.MetadataSchema).GetName() + ">"
433
- },
434
- },
435
- Parameters: props.Parameters,
436
- Input: props.Input,
437
- Definitions: definitions,
438
- Explore: props.Explore,
439
- })
380
+ definitions := make([]any, 0, len(props.Sets))
381
+ for _, set := range props.Sets {
382
+ definitions = append(definitions, set.Value)
383
+ }
384
+ return unionExplorer_check_union_array_like(unionExplorer_check_union_array_likeProps{
385
+ Config: props.Config,
386
+ Accessor: unionExplorer_check_union_array_likeAccessor{
387
+ Transform: func(value any) any {
388
+ meta := value.(*nativemetadata.MetadataSchema)
389
+ return nativemetadata.MetadataArray_create(nativemetadata.MetadataArray{
390
+ Tags: [][]nativemetadata.IMetadataTypeTag{},
391
+ Type: nativemetadata.MetadataArrayType_create(nativemetadata.MetadataArrayType{
392
+ Name: "Set<" + meta.GetName() + ">",
393
+ Index: nil,
394
+ Recursive: false,
395
+ Nullables: []bool{},
396
+ Value: meta,
397
+ }),
398
+ })
399
+ },
400
+ Element: func(array any) any {
401
+ return array.(*nativemetadata.MetadataArray).Type.Value
402
+ },
403
+ Size: func(input *shimast.Expression) *shimast.Node {
404
+ return nativefactories.IdentifierFactory.Access(input, "size")
405
+ },
406
+ Front: func(input *shimast.Expression) *shimast.Node {
407
+ values := unionExplorer_factory.NewCallExpression(
408
+ nativefactories.IdentifierFactory.Access(input, "values"),
409
+ nil,
410
+ nil,
411
+ nil,
412
+ shimast.NodeFlagsNone,
413
+ )
414
+ next := unionExplorer_factory.NewCallExpression(
415
+ nativefactories.IdentifierFactory.Access(values, "next"),
416
+ nil,
417
+ nil,
418
+ nil,
419
+ shimast.NodeFlagsNone,
420
+ )
421
+ return nativefactories.IdentifierFactory.Access(next, "value")
422
+ },
423
+ Array: func(input *shimast.Expression) *shimast.Node {
424
+ return unionExplorer_factory.NewArrayLiteralExpression(
425
+ unionExplorer_factory.NewNodeList([]*shimast.Node{
426
+ unionExplorer_factory.NewSpreadElement(input),
427
+ }),
428
+ false,
429
+ )
430
+ },
431
+ Name: func(_m any, elem any) string {
432
+ return "Set<" + elem.(*nativemetadata.MetadataSchema).GetName() + ">"
433
+ },
434
+ },
435
+ Parameters: props.Parameters,
436
+ Input: props.Input,
437
+ Definitions: definitions,
438
+ Explore: props.Explore,
439
+ })
440
440
  }
441
441
 
442
442
  func (unionExplorerNamespace) Map(props UnionExplorer_MapProps) *shimast.Node {
443
- definitions := make([]any, 0, len(props.Maps))
444
- for _, m := range props.Maps {
445
- definitions = append(definitions, m)
446
- }
447
- return unionExplorer_check_union_array_like(unionExplorer_check_union_array_likeProps{
448
- Config: props.Config,
449
- Accessor: unionExplorer_check_union_array_likeAccessor{
450
- Element: func(array any) any {
451
- elements := array.(*nativemetadata.MetadataArray).Type.Value.Tuples[0].Type.Elements
452
- return []*nativemetadata.MetadataSchema{elements[0], elements[1]}
453
- },
454
- Size: func(input *shimast.Expression) *shimast.Node {
455
- return nativefactories.IdentifierFactory.Access(input, "size")
456
- },
457
- Front: func(input *shimast.Expression) *shimast.Node {
458
- entries := unionExplorer_factory.NewCallExpression(
459
- nativefactories.IdentifierFactory.Access(input, "entries"),
460
- nil,
461
- nil,
462
- nil,
463
- shimast.NodeFlagsNone,
464
- )
465
- next := unionExplorer_factory.NewCallExpression(
466
- nativefactories.IdentifierFactory.Access(entries, "next"),
467
- nil,
468
- nil,
469
- nil,
470
- shimast.NodeFlagsNone,
471
- )
472
- return nativefactories.IdentifierFactory.Access(next, "value")
473
- },
474
- Array: func(input *shimast.Expression) *shimast.Node {
475
- return unionExplorer_factory.NewArrayLiteralExpression(
476
- unionExplorer_factory.NewNodeList([]*shimast.Node{
477
- unionExplorer_factory.NewSpreadElement(input),
478
- }),
479
- false,
480
- )
481
- },
482
- Name: func(_m any, elem any) string {
483
- pair := elem.([]*nativemetadata.MetadataSchema)
484
- return "Map<" + pair[0].GetName() + ", " + pair[1].GetName() + ">"
485
- },
486
- Transform: func(origin any) any {
487
- m := origin.(*nativemetadata.MetadataMap)
488
- ofMap := true
489
- tuple := nativemetadata.MetadataTuple_create(nativemetadata.MetadataTuple{
490
- Tags: [][]nativemetadata.IMetadataTypeTag{},
491
- Type: nativemetadata.MetadataTupleType_create(nativemetadata.MetadataTupleType{
492
- Name: "[" + m.Key.GetName() + ", " + m.Value.GetName() + "]",
493
- Index: nil,
494
- Recursive: false,
495
- Nullables: []bool{},
496
- Elements: []*nativemetadata.MetadataSchema{m.Key, m.Value},
497
- }),
498
- })
499
- tuple.Type.Of_map = &ofMap
500
- return nativemetadata.MetadataArray_create(nativemetadata.MetadataArray{
501
- Tags: [][]nativemetadata.IMetadataTypeTag{},
502
- Type: nativemetadata.MetadataArrayType_create(nativemetadata.MetadataArrayType{
503
- Name: "Map<" + m.Key.GetName() + ", " + m.Value.GetName() + ">",
504
- Index: nil,
505
- Recursive: false,
506
- Nullables: []bool{},
507
- Value: nativemetadata.MetadataSchema_create(nativemetadata.MetadataSchema{
508
- Any: false,
509
- Required: true,
510
- Optional: false,
511
- Nullable: false,
512
- Escaped: nil,
513
- Constants: []*nativemetadata.MetadataConstant{},
514
- Atomics: []*nativemetadata.MetadataAtomic{},
515
- Templates: []*nativemetadata.MetadataTemplate{},
516
- Arrays: []*nativemetadata.MetadataArray{},
517
- Tuples: []*nativemetadata.MetadataTuple{tuple},
518
- Objects: []*nativemetadata.MetadataObject{},
519
- Aliases: []*nativemetadata.MetadataAlias{},
520
- Functions: []*nativemetadata.MetadataFunction{},
521
- Rest: nil,
522
- Natives: []*nativemetadata.MetadataNative{},
523
- Sets: []*nativemetadata.MetadataSet{},
524
- Maps: []*nativemetadata.MetadataMap{},
525
- }),
526
- }),
527
- })
528
- },
529
- },
530
- Parameters: props.Parameters,
531
- Input: props.Input,
532
- Definitions: definitions,
533
- Explore: props.Explore,
534
- })
443
+ definitions := make([]any, 0, len(props.Maps))
444
+ for _, m := range props.Maps {
445
+ definitions = append(definitions, m)
446
+ }
447
+ return unionExplorer_check_union_array_like(unionExplorer_check_union_array_likeProps{
448
+ Config: props.Config,
449
+ Accessor: unionExplorer_check_union_array_likeAccessor{
450
+ Element: func(array any) any {
451
+ elements := array.(*nativemetadata.MetadataArray).Type.Value.Tuples[0].Type.Elements
452
+ return []*nativemetadata.MetadataSchema{elements[0], elements[1]}
453
+ },
454
+ Size: func(input *shimast.Expression) *shimast.Node {
455
+ return nativefactories.IdentifierFactory.Access(input, "size")
456
+ },
457
+ Front: func(input *shimast.Expression) *shimast.Node {
458
+ entries := unionExplorer_factory.NewCallExpression(
459
+ nativefactories.IdentifierFactory.Access(input, "entries"),
460
+ nil,
461
+ nil,
462
+ nil,
463
+ shimast.NodeFlagsNone,
464
+ )
465
+ next := unionExplorer_factory.NewCallExpression(
466
+ nativefactories.IdentifierFactory.Access(entries, "next"),
467
+ nil,
468
+ nil,
469
+ nil,
470
+ shimast.NodeFlagsNone,
471
+ )
472
+ return nativefactories.IdentifierFactory.Access(next, "value")
473
+ },
474
+ Array: func(input *shimast.Expression) *shimast.Node {
475
+ return unionExplorer_factory.NewArrayLiteralExpression(
476
+ unionExplorer_factory.NewNodeList([]*shimast.Node{
477
+ unionExplorer_factory.NewSpreadElement(input),
478
+ }),
479
+ false,
480
+ )
481
+ },
482
+ Name: func(_m any, elem any) string {
483
+ pair := elem.([]*nativemetadata.MetadataSchema)
484
+ return "Map<" + pair[0].GetName() + ", " + pair[1].GetName() + ">"
485
+ },
486
+ Transform: func(origin any) any {
487
+ m := origin.(*nativemetadata.MetadataMap)
488
+ ofMap := true
489
+ tuple := nativemetadata.MetadataTuple_create(nativemetadata.MetadataTuple{
490
+ Tags: [][]nativemetadata.IMetadataTypeTag{},
491
+ Type: nativemetadata.MetadataTupleType_create(nativemetadata.MetadataTupleType{
492
+ Name: "[" + m.Key.GetName() + ", " + m.Value.GetName() + "]",
493
+ Index: nil,
494
+ Recursive: false,
495
+ Nullables: []bool{},
496
+ Elements: []*nativemetadata.MetadataSchema{m.Key, m.Value},
497
+ }),
498
+ })
499
+ tuple.Type.Of_map = &ofMap
500
+ return nativemetadata.MetadataArray_create(nativemetadata.MetadataArray{
501
+ Tags: [][]nativemetadata.IMetadataTypeTag{},
502
+ Type: nativemetadata.MetadataArrayType_create(nativemetadata.MetadataArrayType{
503
+ Name: "Map<" + m.Key.GetName() + ", " + m.Value.GetName() + ">",
504
+ Index: nil,
505
+ Recursive: false,
506
+ Nullables: []bool{},
507
+ Value: nativemetadata.MetadataSchema_create(nativemetadata.MetadataSchema{
508
+ Any: false,
509
+ Required: true,
510
+ Optional: false,
511
+ Nullable: false,
512
+ Escaped: nil,
513
+ Constants: []*nativemetadata.MetadataConstant{},
514
+ Atomics: []*nativemetadata.MetadataAtomic{},
515
+ Templates: []*nativemetadata.MetadataTemplate{},
516
+ Arrays: []*nativemetadata.MetadataArray{},
517
+ Tuples: []*nativemetadata.MetadataTuple{tuple},
518
+ Objects: []*nativemetadata.MetadataObject{},
519
+ Aliases: []*nativemetadata.MetadataAlias{},
520
+ Functions: []*nativemetadata.MetadataFunction{},
521
+ Rest: nil,
522
+ Natives: []*nativemetadata.MetadataNative{},
523
+ Sets: []*nativemetadata.MetadataSet{},
524
+ Maps: []*nativemetadata.MetadataMap{},
525
+ }),
526
+ }),
527
+ })
528
+ },
529
+ },
530
+ Parameters: props.Parameters,
531
+ Input: props.Input,
532
+ Definitions: definitions,
533
+ Explore: props.Explore,
534
+ })
535
535
  }
536
536
 
537
537
  type unionExplorer_check_union_array_likeProps struct {
538
- Config UnionExplorer_ArrayLikeConfig
539
- Accessor unionExplorer_check_union_array_likeAccessor
540
- Parameters []*shimast.Node
541
- Input *shimast.Expression
542
- Definitions []any
543
- Explore any
538
+ Config UnionExplorer_ArrayLikeConfig
539
+ Accessor unionExplorer_check_union_array_likeAccessor
540
+ Parameters []*shimast.Node
541
+ Input *shimast.Expression
542
+ Definitions []any
543
+ Explore any
544
544
  }
545
545
 
546
546
  type unionExplorer_check_union_array_likeAccessor struct {
547
- Transform func(origin any) any
548
- Element func(meta any) any
549
- Name func(meta any, elem any) string
550
- Front func(input *shimast.Expression) *shimast.Node
551
- Array func(input *shimast.Expression) *shimast.Node
552
- Size func(input *shimast.Expression) *shimast.Node
547
+ Transform func(origin any) any
548
+ Element func(meta any) any
549
+ Name func(meta any, elem any) string
550
+ Front func(input *shimast.Expression) *shimast.Node
551
+ Array func(input *shimast.Expression) *shimast.Node
552
+ Size func(input *shimast.Expression) *shimast.Node
553
553
  }
554
554
 
555
555
  func unionExplorer_check_union_array_like(props unionExplorer_check_union_array_likeProps) *shimast.Node {
556
- transform := props.Accessor.Transform
557
- if transform == nil {
558
- transform = func(origin any) any { return origin }
559
- }
560
- targets := make([]any, 0, len(props.Definitions))
561
- for _, definition := range props.Definitions {
562
- targets = append(targets, transform(definition))
563
- }
564
- if len(targets) == 1 {
565
- return unionExplorer_factory.NewArrowFunction(
566
- nil,
567
- nil,
568
- unionExplorer_factory.NewNodeList(props.Parameters),
569
- nil,
570
- nil,
571
- unionExplorer_factory.NewToken(shimast.KindEqualsGreaterThanToken),
572
- props.Config.Decoder(UnionExplorer_ArrayLikeDecoderProps{
573
- Input: props.Accessor.Array(props.Input),
574
- Definition: targets[0],
575
- Explore: props.Explore,
576
- }),
577
- )
578
- }
579
-
580
- array := unionExplorer_factory.NewIdentifier("array")
581
- top := unionExplorer_factory.NewIdentifier("top")
582
- statements := []*shimast.Node{}
583
- tupleList := []*nativemetadata.MetadataTuple{}
584
- arrayList := []*nativemetadata.MetadataArray{}
585
- for _, target := range targets {
586
- switch v := target.(type) {
587
- case *nativemetadata.MetadataTuple:
588
- tupleList = append(tupleList, v)
589
- case *nativemetadata.MetadataArray:
590
- arrayList = append(arrayList, v)
591
- }
592
- }
593
-
594
- predicate := func(meta any) *shimast.Node {
595
- inputType := unionExplorer_factory.NewTypeReferenceNode(unionExplorer_factory.NewIdentifier("any[]"), nil)
596
- postfix := ""
597
- if _, ok := meta.(*nativemetadata.MetadataArrayType); ok {
598
- inputType = nativefactories.TypeFactory.Keyword("any")
599
- postfix = "\"[0]\""
600
- }
601
- return unionExplorer_factory.NewAsExpression(
602
- unionExplorer_factory.NewArrayLiteralExpression(
603
- unionExplorer_factory.NewNodeList([]*shimast.Node{
604
- unionExplorer_factory.NewArrowFunction(
605
- nil,
606
- nil,
607
- unionExplorer_factory.NewNodeList([]*shimast.Node{
608
- nativefactories.IdentifierFactory.Parameter("top", inputType, nil),
609
- }),
610
- nativefactories.TypeFactory.Keyword("any"),
611
- nil,
612
- unionExplorer_factory.NewToken(shimast.KindEqualsGreaterThanToken),
613
- props.Config.Checker(UnionExplorer_ArrayLikeCheckerProps{
614
- Input: unionExplorer_factory.NewIdentifier("top"),
615
- Definition: props.Accessor.Element(meta),
616
- Explore: unionExplorer_with_postfix(props.Explore, false, postfix),
617
- Container: array,
618
- }),
619
- ),
620
- unionExplorer_factory.NewArrowFunction(
621
- nil,
622
- nil,
623
- unionExplorer_factory.NewNodeList([]*shimast.Node{
624
- nativefactories.IdentifierFactory.Parameter(
625
- "entire",
626
- unionExplorer_factory.NewTypeReferenceNode(unionExplorer_factory.NewIdentifier("any[]"), nil),
627
- nil,
628
- ),
629
- }),
630
- nativefactories.TypeFactory.Keyword("any"),
631
- nil,
632
- unionExplorer_factory.NewToken(shimast.KindEqualsGreaterThanToken),
633
- props.Config.Decoder(UnionExplorer_ArrayLikeDecoderProps{
634
- Input: unionExplorer_factory.NewIdentifier("entire"),
635
- Definition: meta,
636
- Explore: unionExplorer_with_tracable(props.Explore, true),
637
- }),
638
- ),
639
- }),
640
- true,
641
- ),
642
- unionExplorer_factory.NewTypeReferenceNode(unionExplorer_factory.NewIdentifier("const"), nil),
643
- )
644
- }
645
-
646
- iterate := func(init string, from *shimast.Expression, ifStatement *shimast.Node) *shimast.Node {
647
- return unionExplorer_factory.NewForInOrOfStatement(
648
- shimast.KindForOfStatement,
649
- nil,
650
- unionExplorer_factory.NewVariableDeclarationList(
651
- unionExplorer_factory.NewNodeList([]*shimast.Node{
652
- unionExplorer_factory.NewVariableDeclaration(
653
- unionExplorer_factory.NewIdentifier(init),
654
- nil,
655
- nil,
656
- nil,
657
- ),
658
- }),
659
- shimast.NodeFlagsConst,
660
- ),
661
- from,
662
- ifStatement,
663
- )
664
- }
665
-
666
- if len(tupleList) != 0 {
667
- tuplePredicates := make([]*shimast.Node, 0, len(tupleList))
668
- for _, x := range tupleList {
669
- tuplePredicates = append(tuplePredicates, predicate(x))
670
- }
671
- statements = append(statements,
672
- nativefactories.StatementFactory.Constant(nativefactories.StatementFactory_ConstantProps{
673
- Name: "array",
674
- Value: props.Accessor.Array(props.Input),
675
- }),
676
- nativefactories.StatementFactory.Constant(nativefactories.StatementFactory_ConstantProps{
677
- Name: "tuplePredicators",
678
- Value: unionExplorer_factory.NewArrayLiteralExpression(
679
- unionExplorer_factory.NewNodeList(tuplePredicates),
680
- true,
681
- ),
682
- }),
683
- iterate(
684
- "pred",
685
- unionExplorer_factory.NewIdentifier("tuplePredicators"),
686
- unionExplorer_factory.NewIfStatement(
687
- unionExplorer_factory.NewCallExpression(
688
- unionExplorer_factory.NewIdentifier("pred[0]"),
689
- nil,
690
- nil,
691
- unionExplorer_factory.NewNodeList([]*shimast.Node{array}),
692
- shimast.NodeFlagsNone,
693
- ),
694
- unionExplorer_factory.NewReturnStatement(
695
- unionExplorer_factory.NewCallExpression(
696
- unionExplorer_factory.NewIdentifier("pred[1]"),
697
- nil,
698
- nil,
699
- unionExplorer_factory.NewNodeList([]*shimast.Node{array}),
700
- shimast.NodeFlagsNone,
701
- ),
702
- ),
703
- nil,
704
- ),
705
- ),
706
- )
707
- }
708
- if len(arrayList) != 0 {
709
- if len(tupleList) == 0 {
710
- statements = append(statements, nativefactories.StatementFactory.Constant(nativefactories.StatementFactory_ConstantProps{
711
- Name: "array",
712
- Value: props.Accessor.Array(props.Input),
713
- }))
714
- }
715
- arrayPredicates := make([]*shimast.Node, 0, len(arrayList))
716
- for _, x := range arrayList {
717
- arrayPredicates = append(arrayPredicates, predicate(x))
718
- }
719
- statements = append(statements,
720
- nativefactories.StatementFactory.Constant(nativefactories.StatementFactory_ConstantProps{
721
- Name: "top",
722
- Value: props.Accessor.Front(props.Input),
723
- }),
724
- unionExplorer_factory.NewIfStatement(
725
- unionExplorer_factory.NewBinaryExpression(
726
- nil,
727
- nativefactories.ExpressionFactory.Number(0),
728
- nil,
729
- unionExplorer_factory.NewToken(shimast.KindEqualsEqualsEqualsToken),
730
- props.Accessor.Size(props.Input),
731
- ),
732
- unionExplorer_return_or_statement(props.Config.Empty),
733
- nil,
734
- ),
735
- nativefactories.StatementFactory.Constant(nativefactories.StatementFactory_ConstantProps{
736
- Name: "arrayPredicators",
737
- Value: unionExplorer_factory.NewArrayLiteralExpression(
738
- unionExplorer_factory.NewNodeList(arrayPredicates),
739
- true,
740
- ),
741
- }),
742
- nativefactories.StatementFactory.Constant(nativefactories.StatementFactory_ConstantProps{
743
- Name: "passed",
744
- Value: unionExplorer_factory.NewCallExpression(
745
- nativefactories.IdentifierFactory.Access(unionExplorer_factory.NewIdentifier("arrayPredicators"), "filter"),
746
- nil,
747
- nil,
748
- unionExplorer_factory.NewNodeList([]*shimast.Node{
749
- unionExplorer_factory.NewArrowFunction(
750
- nil,
751
- nil,
752
- unionExplorer_factory.NewNodeList([]*shimast.Node{
753
- nativefactories.IdentifierFactory.Parameter("pred", nil, nil),
754
- }),
755
- nil,
756
- nil,
757
- unionExplorer_factory.NewToken(shimast.KindEqualsGreaterThanToken),
758
- unionExplorer_factory.NewCallExpression(
759
- unionExplorer_factory.NewIdentifier("pred[0]"),
760
- nil,
761
- nil,
762
- unionExplorer_factory.NewNodeList([]*shimast.Node{top}),
763
- shimast.NodeFlagsNone,
764
- ),
765
- ),
766
- }),
767
- shimast.NodeFlagsNone,
768
- ),
769
- }),
770
- unionExplorer_array_if(iterate, array, top, props.Config.Success),
771
- )
772
- }
773
- names := make([]string, 0, len(targets))
774
- for _, target := range targets {
775
- elem := props.Accessor.Element(target)
776
- names = append(names, props.Accessor.Name(target, elem))
777
- }
778
- statements = append(statements, props.Config.Failure(UnionExplorer_ArrayLikeFailureProps{
779
- Input: props.Input,
780
- Expected: "(" + strings.Join(names, " | ") + ")",
781
- Explore: props.Explore,
782
- }))
783
- return unionExplorer_factory.NewArrowFunction(
784
- nil,
785
- nil,
786
- unionExplorer_factory.NewNodeList(props.Parameters),
787
- nil,
788
- nil,
789
- unionExplorer_factory.NewToken(shimast.KindEqualsGreaterThanToken),
790
- unionExplorer_factory.NewBlock(
791
- unionExplorer_factory.NewNodeList(statements),
792
- true,
793
- ),
794
- )
556
+ transform := props.Accessor.Transform
557
+ if transform == nil {
558
+ transform = func(origin any) any { return origin }
559
+ }
560
+ targets := make([]any, 0, len(props.Definitions))
561
+ for _, definition := range props.Definitions {
562
+ targets = append(targets, transform(definition))
563
+ }
564
+ if len(targets) == 1 {
565
+ return unionExplorer_factory.NewArrowFunction(
566
+ nil,
567
+ nil,
568
+ unionExplorer_factory.NewNodeList(props.Parameters),
569
+ nil,
570
+ nil,
571
+ unionExplorer_factory.NewToken(shimast.KindEqualsGreaterThanToken),
572
+ props.Config.Decoder(UnionExplorer_ArrayLikeDecoderProps{
573
+ Input: props.Accessor.Array(props.Input),
574
+ Definition: targets[0],
575
+ Explore: props.Explore,
576
+ }),
577
+ )
578
+ }
579
+
580
+ array := unionExplorer_factory.NewIdentifier("array")
581
+ top := unionExplorer_factory.NewIdentifier("top")
582
+ statements := []*shimast.Node{}
583
+ tupleList := []*nativemetadata.MetadataTuple{}
584
+ arrayList := []*nativemetadata.MetadataArray{}
585
+ for _, target := range targets {
586
+ switch v := target.(type) {
587
+ case *nativemetadata.MetadataTuple:
588
+ tupleList = append(tupleList, v)
589
+ case *nativemetadata.MetadataArray:
590
+ arrayList = append(arrayList, v)
591
+ }
592
+ }
593
+
594
+ predicate := func(meta any) *shimast.Node {
595
+ inputType := unionExplorer_factory.NewTypeReferenceNode(unionExplorer_factory.NewIdentifier("any[]"), nil)
596
+ postfix := ""
597
+ if _, ok := meta.(*nativemetadata.MetadataArrayType); ok {
598
+ inputType = nativefactories.TypeFactory.Keyword("any")
599
+ postfix = "\"[0]\""
600
+ }
601
+ return unionExplorer_factory.NewAsExpression(
602
+ unionExplorer_factory.NewArrayLiteralExpression(
603
+ unionExplorer_factory.NewNodeList([]*shimast.Node{
604
+ unionExplorer_factory.NewArrowFunction(
605
+ nil,
606
+ nil,
607
+ unionExplorer_factory.NewNodeList([]*shimast.Node{
608
+ nativefactories.IdentifierFactory.Parameter("top", inputType, nil),
609
+ }),
610
+ nativefactories.TypeFactory.Keyword("any"),
611
+ nil,
612
+ unionExplorer_factory.NewToken(shimast.KindEqualsGreaterThanToken),
613
+ props.Config.Checker(UnionExplorer_ArrayLikeCheckerProps{
614
+ Input: unionExplorer_factory.NewIdentifier("top"),
615
+ Definition: props.Accessor.Element(meta),
616
+ Explore: unionExplorer_with_postfix(props.Explore, false, postfix),
617
+ Container: array,
618
+ }),
619
+ ),
620
+ unionExplorer_factory.NewArrowFunction(
621
+ nil,
622
+ nil,
623
+ unionExplorer_factory.NewNodeList([]*shimast.Node{
624
+ nativefactories.IdentifierFactory.Parameter(
625
+ "entire",
626
+ unionExplorer_factory.NewTypeReferenceNode(unionExplorer_factory.NewIdentifier("any[]"), nil),
627
+ nil,
628
+ ),
629
+ }),
630
+ nativefactories.TypeFactory.Keyword("any"),
631
+ nil,
632
+ unionExplorer_factory.NewToken(shimast.KindEqualsGreaterThanToken),
633
+ props.Config.Decoder(UnionExplorer_ArrayLikeDecoderProps{
634
+ Input: unionExplorer_factory.NewIdentifier("entire"),
635
+ Definition: meta,
636
+ Explore: unionExplorer_with_tracable(props.Explore, true),
637
+ }),
638
+ ),
639
+ }),
640
+ true,
641
+ ),
642
+ unionExplorer_factory.NewTypeReferenceNode(unionExplorer_factory.NewIdentifier("const"), nil),
643
+ )
644
+ }
645
+
646
+ iterate := func(init string, from *shimast.Expression, ifStatement *shimast.Node) *shimast.Node {
647
+ return unionExplorer_factory.NewForInOrOfStatement(
648
+ shimast.KindForOfStatement,
649
+ nil,
650
+ unionExplorer_factory.NewVariableDeclarationList(
651
+ unionExplorer_factory.NewNodeList([]*shimast.Node{
652
+ unionExplorer_factory.NewVariableDeclaration(
653
+ unionExplorer_factory.NewIdentifier(init),
654
+ nil,
655
+ nil,
656
+ nil,
657
+ ),
658
+ }),
659
+ shimast.NodeFlagsConst,
660
+ ),
661
+ from,
662
+ ifStatement,
663
+ )
664
+ }
665
+
666
+ if len(tupleList) != 0 {
667
+ tuplePredicates := make([]*shimast.Node, 0, len(tupleList))
668
+ for _, x := range tupleList {
669
+ tuplePredicates = append(tuplePredicates, predicate(x))
670
+ }
671
+ statements = append(statements,
672
+ nativefactories.StatementFactory.Constant(nativefactories.StatementFactory_ConstantProps{
673
+ Name: "array",
674
+ Value: props.Accessor.Array(props.Input),
675
+ }),
676
+ nativefactories.StatementFactory.Constant(nativefactories.StatementFactory_ConstantProps{
677
+ Name: "tuplePredicators",
678
+ Value: unionExplorer_factory.NewArrayLiteralExpression(
679
+ unionExplorer_factory.NewNodeList(tuplePredicates),
680
+ true,
681
+ ),
682
+ }),
683
+ iterate(
684
+ "pred",
685
+ unionExplorer_factory.NewIdentifier("tuplePredicators"),
686
+ unionExplorer_factory.NewIfStatement(
687
+ unionExplorer_factory.NewCallExpression(
688
+ unionExplorer_factory.NewIdentifier("pred[0]"),
689
+ nil,
690
+ nil,
691
+ unionExplorer_factory.NewNodeList([]*shimast.Node{array}),
692
+ shimast.NodeFlagsNone,
693
+ ),
694
+ unionExplorer_factory.NewReturnStatement(
695
+ unionExplorer_factory.NewCallExpression(
696
+ unionExplorer_factory.NewIdentifier("pred[1]"),
697
+ nil,
698
+ nil,
699
+ unionExplorer_factory.NewNodeList([]*shimast.Node{array}),
700
+ shimast.NodeFlagsNone,
701
+ ),
702
+ ),
703
+ nil,
704
+ ),
705
+ ),
706
+ )
707
+ }
708
+ if len(arrayList) != 0 {
709
+ if len(tupleList) == 0 {
710
+ statements = append(statements, nativefactories.StatementFactory.Constant(nativefactories.StatementFactory_ConstantProps{
711
+ Name: "array",
712
+ Value: props.Accessor.Array(props.Input),
713
+ }))
714
+ }
715
+ arrayPredicates := make([]*shimast.Node, 0, len(arrayList))
716
+ for _, x := range arrayList {
717
+ arrayPredicates = append(arrayPredicates, predicate(x))
718
+ }
719
+ statements = append(statements,
720
+ nativefactories.StatementFactory.Constant(nativefactories.StatementFactory_ConstantProps{
721
+ Name: "top",
722
+ Value: props.Accessor.Front(props.Input),
723
+ }),
724
+ unionExplorer_factory.NewIfStatement(
725
+ unionExplorer_factory.NewBinaryExpression(
726
+ nil,
727
+ nativefactories.ExpressionFactory.Number(0),
728
+ nil,
729
+ unionExplorer_factory.NewToken(shimast.KindEqualsEqualsEqualsToken),
730
+ props.Accessor.Size(props.Input),
731
+ ),
732
+ unionExplorer_return_or_statement(props.Config.Empty),
733
+ nil,
734
+ ),
735
+ nativefactories.StatementFactory.Constant(nativefactories.StatementFactory_ConstantProps{
736
+ Name: "arrayPredicators",
737
+ Value: unionExplorer_factory.NewArrayLiteralExpression(
738
+ unionExplorer_factory.NewNodeList(arrayPredicates),
739
+ true,
740
+ ),
741
+ }),
742
+ nativefactories.StatementFactory.Constant(nativefactories.StatementFactory_ConstantProps{
743
+ Name: "passed",
744
+ Value: unionExplorer_factory.NewCallExpression(
745
+ nativefactories.IdentifierFactory.Access(unionExplorer_factory.NewIdentifier("arrayPredicators"), "filter"),
746
+ nil,
747
+ nil,
748
+ unionExplorer_factory.NewNodeList([]*shimast.Node{
749
+ unionExplorer_factory.NewArrowFunction(
750
+ nil,
751
+ nil,
752
+ unionExplorer_factory.NewNodeList([]*shimast.Node{
753
+ nativefactories.IdentifierFactory.Parameter("pred", nil, nil),
754
+ }),
755
+ nil,
756
+ nil,
757
+ unionExplorer_factory.NewToken(shimast.KindEqualsGreaterThanToken),
758
+ unionExplorer_factory.NewCallExpression(
759
+ unionExplorer_factory.NewIdentifier("pred[0]"),
760
+ nil,
761
+ nil,
762
+ unionExplorer_factory.NewNodeList([]*shimast.Node{top}),
763
+ shimast.NodeFlagsNone,
764
+ ),
765
+ ),
766
+ }),
767
+ shimast.NodeFlagsNone,
768
+ ),
769
+ }),
770
+ unionExplorer_array_if(iterate, array, top, props.Config.Success),
771
+ )
772
+ }
773
+ names := make([]string, 0, len(targets))
774
+ for _, target := range targets {
775
+ elem := props.Accessor.Element(target)
776
+ names = append(names, props.Accessor.Name(target, elem))
777
+ }
778
+ statements = append(statements, props.Config.Failure(UnionExplorer_ArrayLikeFailureProps{
779
+ Input: props.Input,
780
+ Expected: "(" + strings.Join(names, " | ") + ")",
781
+ Explore: props.Explore,
782
+ }))
783
+ return unionExplorer_factory.NewArrowFunction(
784
+ nil,
785
+ nil,
786
+ unionExplorer_factory.NewNodeList(props.Parameters),
787
+ nil,
788
+ nil,
789
+ unionExplorer_factory.NewToken(shimast.KindEqualsGreaterThanToken),
790
+ unionExplorer_factory.NewBlock(
791
+ unionExplorer_factory.NewNodeList(statements),
792
+ true,
793
+ ),
794
+ )
795
795
  }
796
796
 
797
797
  func unionExplorer_array_if(iterate func(init string, from *shimast.Expression, ifStatement *shimast.Node) *shimast.Node, array *shimast.Node, top *shimast.Node, success *shimast.Expression) *shimast.Node {
798
- return unionExplorer_factory.NewIfStatement(
799
- unionExplorer_factory.NewBinaryExpression(
800
- nil,
801
- nativefactories.ExpressionFactory.Number(1),
802
- nil,
803
- unionExplorer_factory.NewToken(shimast.KindEqualsEqualsEqualsToken),
804
- unionExplorer_factory.NewIdentifier("passed.length"),
805
- ),
806
- unionExplorer_factory.NewReturnStatement(
807
- unionExplorer_factory.NewCallExpression(
808
- unionExplorer_factory.NewElementAccessExpression(
809
- unionExplorer_factory.NewNonNullExpression(
810
- unionExplorer_factory.NewIdentifier("passed[0]"),
811
- shimast.NodeFlagsNone,
812
- ),
813
- nil,
814
- nativefactories.ExpressionFactory.Number(1),
815
- shimast.NodeFlagsNone,
816
- ),
817
- nil,
818
- nil,
819
- unionExplorer_factory.NewNodeList([]*shimast.Node{array}),
820
- shimast.NodeFlagsNone,
821
- ),
822
- ),
823
- unionExplorer_factory.NewIfStatement(
824
- unionExplorer_factory.NewBinaryExpression(
825
- nil,
826
- nativefactories.ExpressionFactory.Number(1),
827
- nil,
828
- unionExplorer_factory.NewToken(shimast.KindLessThanToken),
829
- unionExplorer_factory.NewIdentifier("passed.length"),
830
- ),
831
- iterate(
832
- "pred",
833
- unionExplorer_factory.NewIdentifier("passed"),
834
- unionExplorer_factory.NewIfStatement(
835
- unionExplorer_factory.NewCallExpression(
836
- nativefactories.IdentifierFactory.Access(array, "every"),
837
- nil,
838
- nil,
839
- unionExplorer_factory.NewNodeList([]*shimast.Node{
840
- unionExplorer_factory.NewArrowFunction(
841
- nil,
842
- nil,
843
- unionExplorer_factory.NewNodeList([]*shimast.Node{
844
- nativefactories.IdentifierFactory.Parameter("value", nativefactories.TypeFactory.Keyword("any"), nil),
845
- }),
846
- nil,
847
- nil,
848
- unionExplorer_factory.NewToken(shimast.KindEqualsGreaterThanToken),
849
- unionExplorer_factory.NewBinaryExpression(
850
- nil,
851
- success,
852
- nil,
853
- unionExplorer_factory.NewToken(shimast.KindEqualsEqualsEqualsToken),
854
- unionExplorer_factory.NewCallExpression(
855
- unionExplorer_factory.NewIdentifier("pred[0]"),
856
- nil,
857
- nil,
858
- unionExplorer_factory.NewNodeList([]*shimast.Node{
859
- unionExplorer_factory.NewIdentifier("value"),
860
- }),
861
- shimast.NodeFlagsNone,
862
- ),
863
- ),
864
- ),
865
- }),
866
- shimast.NodeFlagsNone,
867
- ),
868
- unionExplorer_factory.NewReturnStatement(
869
- unionExplorer_factory.NewCallExpression(
870
- unionExplorer_factory.NewIdentifier("pred[1]"),
871
- nil,
872
- nil,
873
- unionExplorer_factory.NewNodeList([]*shimast.Node{
874
- unionExplorer_factory.NewIdentifier("array"),
875
- }),
876
- shimast.NodeFlagsNone,
877
- ),
878
- ),
879
- nil,
880
- ),
881
- ),
882
- nil,
883
- ),
884
- )
798
+ return unionExplorer_factory.NewIfStatement(
799
+ unionExplorer_factory.NewBinaryExpression(
800
+ nil,
801
+ nativefactories.ExpressionFactory.Number(1),
802
+ nil,
803
+ unionExplorer_factory.NewToken(shimast.KindEqualsEqualsEqualsToken),
804
+ unionExplorer_factory.NewIdentifier("passed.length"),
805
+ ),
806
+ unionExplorer_factory.NewReturnStatement(
807
+ unionExplorer_factory.NewCallExpression(
808
+ unionExplorer_factory.NewElementAccessExpression(
809
+ unionExplorer_factory.NewNonNullExpression(
810
+ unionExplorer_factory.NewIdentifier("passed[0]"),
811
+ shimast.NodeFlagsNone,
812
+ ),
813
+ nil,
814
+ nativefactories.ExpressionFactory.Number(1),
815
+ shimast.NodeFlagsNone,
816
+ ),
817
+ nil,
818
+ nil,
819
+ unionExplorer_factory.NewNodeList([]*shimast.Node{array}),
820
+ shimast.NodeFlagsNone,
821
+ ),
822
+ ),
823
+ unionExplorer_factory.NewIfStatement(
824
+ unionExplorer_factory.NewBinaryExpression(
825
+ nil,
826
+ nativefactories.ExpressionFactory.Number(1),
827
+ nil,
828
+ unionExplorer_factory.NewToken(shimast.KindLessThanToken),
829
+ unionExplorer_factory.NewIdentifier("passed.length"),
830
+ ),
831
+ iterate(
832
+ "pred",
833
+ unionExplorer_factory.NewIdentifier("passed"),
834
+ unionExplorer_factory.NewIfStatement(
835
+ unionExplorer_factory.NewCallExpression(
836
+ nativefactories.IdentifierFactory.Access(array, "every"),
837
+ nil,
838
+ nil,
839
+ unionExplorer_factory.NewNodeList([]*shimast.Node{
840
+ unionExplorer_factory.NewArrowFunction(
841
+ nil,
842
+ nil,
843
+ unionExplorer_factory.NewNodeList([]*shimast.Node{
844
+ nativefactories.IdentifierFactory.Parameter("value", nativefactories.TypeFactory.Keyword("any"), nil),
845
+ }),
846
+ nil,
847
+ nil,
848
+ unionExplorer_factory.NewToken(shimast.KindEqualsGreaterThanToken),
849
+ unionExplorer_factory.NewBinaryExpression(
850
+ nil,
851
+ success,
852
+ nil,
853
+ unionExplorer_factory.NewToken(shimast.KindEqualsEqualsEqualsToken),
854
+ unionExplorer_factory.NewCallExpression(
855
+ unionExplorer_factory.NewIdentifier("pred[0]"),
856
+ nil,
857
+ nil,
858
+ unionExplorer_factory.NewNodeList([]*shimast.Node{
859
+ unionExplorer_factory.NewIdentifier("value"),
860
+ }),
861
+ shimast.NodeFlagsNone,
862
+ ),
863
+ ),
864
+ ),
865
+ }),
866
+ shimast.NodeFlagsNone,
867
+ ),
868
+ unionExplorer_factory.NewReturnStatement(
869
+ unionExplorer_factory.NewCallExpression(
870
+ unionExplorer_factory.NewIdentifier("pred[1]"),
871
+ nil,
872
+ nil,
873
+ unionExplorer_factory.NewNodeList([]*shimast.Node{
874
+ unionExplorer_factory.NewIdentifier("array"),
875
+ }),
876
+ shimast.NodeFlagsNone,
877
+ ),
878
+ ),
879
+ nil,
880
+ ),
881
+ ),
882
+ nil,
883
+ ),
884
+ )
885
885
  }
886
886
 
887
887
  func unionExplorer_return_or_statement(node *shimast.Node) *shimast.Node {
888
- if node == nil || node.Kind == shimast.KindReturnStatement {
889
- return node
890
- }
891
- return unionExplorer_factory.NewReturnStatement(node)
888
+ if node == nil || node.Kind == shimast.KindReturnStatement {
889
+ return node
890
+ }
891
+ return unionExplorer_factory.NewReturnStatement(node)
892
892
  }
893
893
 
894
894
  func unionExplorer_with_tracable(base any, tracable bool) any {
895
- switch value := base.(type) {
896
- case UnionExplorer_IExplore:
897
- value.Tracable = tracable
898
- return value
899
- case *UnionExplorer_IExplore:
900
- next := *value
901
- next.Tracable = tracable
902
- return next
903
- case map[string]any:
904
- next := map[string]any{}
905
- for k, v := range value {
906
- next[k] = v
907
- }
908
- next["tracable"] = tracable
909
- return next
910
- default:
911
- return base
912
- }
895
+ switch value := base.(type) {
896
+ case UnionExplorer_IExplore:
897
+ value.Tracable = tracable
898
+ return value
899
+ case *UnionExplorer_IExplore:
900
+ next := *value
901
+ next.Tracable = tracable
902
+ return next
903
+ case map[string]any:
904
+ next := map[string]any{}
905
+ for k, v := range value {
906
+ next[k] = v
907
+ }
908
+ next["tracable"] = tracable
909
+ return next
910
+ default:
911
+ return base
912
+ }
913
913
  }
914
914
 
915
915
  func unionExplorer_with_postfix(base any, tracable bool, postfix string) any {
916
- switch value := base.(type) {
917
- case UnionExplorer_IExplore:
918
- value.Tracable = tracable
919
- value.Postfix = postfix
920
- return value
921
- case *UnionExplorer_IExplore:
922
- next := *value
923
- next.Tracable = tracable
924
- next.Postfix = postfix
925
- return next
926
- case map[string]any:
927
- next := map[string]any{}
928
- for k, v := range value {
929
- next[k] = v
930
- }
931
- next["tracable"] = tracable
932
- next["postfix"] = postfix
933
- return next
934
- default:
935
- return base
936
- }
916
+ switch value := base.(type) {
917
+ case UnionExplorer_IExplore:
918
+ value.Tracable = tracable
919
+ value.Postfix = postfix
920
+ return value
921
+ case *UnionExplorer_IExplore:
922
+ next := *value
923
+ next.Tracable = tracable
924
+ next.Postfix = postfix
925
+ return next
926
+ case map[string]any:
927
+ next := map[string]any{}
928
+ for k, v := range value {
929
+ next[k] = v
930
+ }
931
+ next["tracable"] = tracable
932
+ next["postfix"] = postfix
933
+ return next
934
+ default:
935
+ return base
936
+ }
937
937
  }
938
938
 
939
939
  var unionExplorer_factory = shimast.NewNodeFactory(shimast.NodeFactoryHooks{})