typia 15.1.0 → 15.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/TypeGuardError.js.map +1 -1
- package/lib/basic.js.map +1 -1
- package/lib/compare.js.map +1 -1
- package/lib/functional.js.map +1 -1
- package/lib/http.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/internal/_IProtobufWriter.js.map +1 -1
- package/lib/internal/_ProtobufReader.js.map +1 -1
- package/lib/internal/_ProtobufSizer.js.map +1 -1
- package/lib/internal/_ProtobufWriter.js.map +1 -1
- package/lib/internal/_accessExpressionAsString.js.map +1 -1
- package/lib/internal/_assertGuard.js.map +1 -1
- package/lib/internal/_coerceLlmArguments.js.map +1 -1
- package/lib/internal/_createLlmEvaluation.js.map +1 -1
- package/lib/internal/_createStandardSchema.js.map +1 -1
- package/lib/internal/_decimal.js.map +1 -1
- package/lib/internal/_functionalTypeGuardErrorFactory.js.map +1 -1
- package/lib/internal/_httpFormDataReadArray.js.map +1 -1
- package/lib/internal/_httpFormDataReadBigint.js.map +1 -1
- package/lib/internal/_httpFormDataReadBlob.js.map +1 -1
- package/lib/internal/_httpFormDataReadBoolean.js.map +1 -1
- package/lib/internal/_httpFormDataReadFile.js.map +1 -1
- package/lib/internal/_httpFormDataReadNumber.js.map +1 -1
- package/lib/internal/_httpFormDataReadString.js.map +1 -1
- package/lib/internal/_httpHeaderReadBigint.js.map +1 -1
- package/lib/internal/_httpHeaderReadBoolean.js.map +1 -1
- package/lib/internal/_httpHeaderReadNumber.js.map +1 -1
- package/lib/internal/_httpParameterReadBigint.js.map +1 -1
- package/lib/internal/_httpParameterReadBoolean.js.map +1 -1
- package/lib/internal/_httpParameterReadNumber.js.map +1 -1
- package/lib/internal/_httpParameterReadString.js.map +1 -1
- package/lib/internal/_httpQueryParseURLSearchParams.js.map +1 -1
- package/lib/internal/_httpQueryReadArray.js.map +1 -1
- package/lib/internal/_httpQueryReadBigint.js.map +1 -1
- package/lib/internal/_httpQueryReadBoolean.js.map +1 -1
- package/lib/internal/_httpQueryReadNumber.js.map +1 -1
- package/lib/internal/_httpQueryReadString.js.map +1 -1
- package/lib/internal/_isBetween.js.map +1 -1
- package/lib/internal/_isBigintString.js.map +1 -1
- package/lib/internal/_isFormatByte.js.map +1 -1
- package/lib/internal/_isFormatDate.js.map +1 -1
- package/lib/internal/_isFormatDateTime.js.map +1 -1
- package/lib/internal/_isFormatDuration.js.map +1 -1
- package/lib/internal/_isFormatEmail.js.map +1 -1
- package/lib/internal/_isFormatHostname.js.map +1 -1
- package/lib/internal/_isFormatIdnEmail.js.map +1 -1
- package/lib/internal/_isFormatIdnHostname.js.map +1 -1
- package/lib/internal/_isFormatIpv4.js.map +1 -1
- package/lib/internal/_isFormatIpv6.js.map +1 -1
- package/lib/internal/_isFormatIri.js.map +1 -1
- package/lib/internal/_isFormatIriReference.js.map +1 -1
- package/lib/internal/_isFormatJsonPointer.js.map +1 -1
- package/lib/internal/_isFormatPassword.js.map +1 -1
- package/lib/internal/_isFormatRegex.js.map +1 -1
- package/lib/internal/_isFormatRelativeJsonPointer.js.map +1 -1
- package/lib/internal/_isFormatTime.js.map +1 -1
- package/lib/internal/_isFormatUri.js.map +1 -1
- package/lib/internal/_isFormatUriReference.js.map +1 -1
- package/lib/internal/_isFormatUriTemplate.js.map +1 -1
- package/lib/internal/_isFormatUrl.js.map +1 -1
- package/lib/internal/_isFormatUuid.js.map +1 -1
- package/lib/internal/_isMultipleOf.js.map +1 -1
- package/lib/internal/_isTypeFloat.js.map +1 -1
- package/lib/internal/_isTypeInt16.js.map +1 -1
- package/lib/internal/_isTypeInt32.js.map +1 -1
- package/lib/internal/_isTypeInt64.js.map +1 -1
- package/lib/internal/_isTypeInt64Bigint.js.map +1 -1
- package/lib/internal/_isTypeInt8.js.map +1 -1
- package/lib/internal/_isTypeUint16.js.map +1 -1
- package/lib/internal/_isTypeUint32.js.map +1 -1
- package/lib/internal/_isTypeUint64.js.map +1 -1
- package/lib/internal/_isTypeUint64Bigint.js.map +1 -1
- package/lib/internal/_isTypeUint8.js.map +1 -1
- package/lib/internal/_isUniqueItems.js.map +1 -1
- package/lib/internal/_jsonStringifyArray.js.map +1 -1
- package/lib/internal/_jsonStringifyElement.js.map +1 -1
- package/lib/internal/_jsonStringifyNumber.js.map +1 -1
- package/lib/internal/_jsonStringifyProperty.js.map +1 -1
- package/lib/internal/_jsonStringifyRest.js.map +1 -1
- package/lib/internal/_jsonStringifyString.js.map +1 -1
- package/lib/internal/_jsonStringifyTail.js.map +1 -1
- package/lib/internal/_llmApplicationFinalize.js +8 -1
- package/lib/internal/_llmApplicationFinalize.js.map +1 -1
- package/lib/internal/_notationAny.js.map +1 -1
- package/lib/internal/_notationAssign.js.map +1 -1
- package/lib/internal/_notationCamel.js.map +1 -1
- package/lib/internal/_notationKebab.js.map +1 -1
- package/lib/internal/_notationKeyCollision.js.map +1 -1
- package/lib/internal/_notationPascal.js.map +1 -1
- package/lib/internal/_notationSnake.js.map +1 -1
- package/lib/internal/_parseLlmArguments.js.map +1 -1
- package/lib/internal/_plainCloneAny.js.map +1 -1
- package/lib/internal/_randomArray.js.map +1 -1
- package/lib/internal/_randomBigint.js.map +1 -1
- package/lib/internal/_randomBoolean.js.map +1 -1
- package/lib/internal/_randomFormatByte.js.map +1 -1
- package/lib/internal/_randomFormatDate.js.map +1 -1
- package/lib/internal/_randomFormatDatetime.js.map +1 -1
- package/lib/internal/_randomFormatDuration.js.map +1 -1
- package/lib/internal/_randomFormatEmail.js.map +1 -1
- package/lib/internal/_randomFormatHostname.js.map +1 -1
- package/lib/internal/_randomFormatIdnEmail.js.map +1 -1
- package/lib/internal/_randomFormatIdnHostname.js.map +1 -1
- package/lib/internal/_randomFormatIpv4.js.map +1 -1
- package/lib/internal/_randomFormatIpv6.js.map +1 -1
- package/lib/internal/_randomFormatIri.js.map +1 -1
- package/lib/internal/_randomFormatIriReference.js.map +1 -1
- package/lib/internal/_randomFormatJsonPointer.js.map +1 -1
- package/lib/internal/_randomFormatPassword.js.map +1 -1
- package/lib/internal/_randomFormatRegex.js.map +1 -1
- package/lib/internal/_randomFormatRelativeJsonPointer.js.map +1 -1
- package/lib/internal/_randomFormatTime.js.map +1 -1
- package/lib/internal/_randomFormatUri.js.map +1 -1
- package/lib/internal/_randomFormatUriReference.js.map +1 -1
- package/lib/internal/_randomFormatUriTemplate.js.map +1 -1
- package/lib/internal/_randomFormatUrl.js.map +1 -1
- package/lib/internal/_randomFormatUuid.js.map +1 -1
- package/lib/internal/_randomInteger.js.map +1 -1
- package/lib/internal/_randomMultiple.js.map +1 -1
- package/lib/internal/_randomNumber.js.map +1 -1
- package/lib/internal/_randomPattern.js.map +1 -1
- package/lib/internal/_randomPick.js.map +1 -1
- package/lib/internal/_randomString.js.map +1 -1
- package/lib/internal/_randomStringLength.js.map +1 -1
- package/lib/internal/_stringLength.js.map +1 -1
- package/lib/internal/_stringLengthGte.js.map +1 -1
- package/lib/internal/_stringLengthLte.js.map +1 -1
- package/lib/internal/_throwTypeGuardError.js.map +1 -1
- package/lib/internal/_validateReport.js.map +1 -1
- package/lib/internal/private/__notationRename.js.map +1 -1
- package/lib/internal/private/__randomComposition.js.map +1 -1
- package/lib/internal/private/__randomEpoch.js.map +1 -1
- package/lib/json.js.map +1 -1
- package/lib/llm.js.map +1 -1
- package/lib/module.js.map +1 -1
- package/lib/notations.js.map +1 -1
- package/lib/plain.js.map +1 -1
- package/lib/protobuf.js.map +1 -1
- package/lib/re-exports.js.map +1 -1
- package/lib/reflect.js.map +1 -1
- package/lib/transform.d.ts +5 -2
- package/lib/transform.js +6 -2
- package/lib/transform.js.map +1 -1
- package/lib/transform.mjs +7 -3
- package/lib/transform.mjs.map +1 -1
- package/lib/transformers/NoTransformConfigurationError.js.map +1 -1
- package/native/cmd/ttsc-typia/build.go +3 -1
- package/native/cmd/ttsc-typia/content_mapper_transform_ts71_test.go +102 -0
- package/native/cmd/ttsc-typia/diagnostics.go +1 -1
- package/native/cmd/ttsc-typia/distinct_programs_concurrent_emit_test.go +167 -0
- package/native/cmd/ttsc-typia/exact_optional_family_emission_contract_test.go +2 -1
- package/native/cmd/ttsc-typia/project_dependencies_heritage_forms_transform_test.go +84 -0
- package/native/cmd/ttsc-typia/schema_literal_helpers_test.go +2 -1
- package/native/cmd/ttsc-typia/transform.go +7 -6
- package/native/core/context/EmitFactory.go +20 -29
- package/native/core/context/ImportProgrammer.go +5 -7
- package/native/core/context/NodeFactory.go +25 -0
- package/native/core/context/node_factory_ownership_test.go +45 -0
- package/native/core/factories/ExpressionFactory.go +13 -14
- package/native/core/factories/IdentifierFactory.go +3 -5
- package/native/core/factories/LiteralFactory.go +6 -8
- package/native/core/factories/NumericRangeFactory.go +8 -10
- package/native/core/factories/StatementFactory.go +5 -7
- package/native/core/factories/TemplateFactory.go +1 -3
- package/native/core/factories/TypeFactory.go +7 -9
- package/native/core/factories/ValueFactory.go +5 -7
- package/native/core/factories/factory_utility_coverage_test.go +21 -20
- package/native/core/factories/internal/metadata/MetadataHelper.go +13 -13
- package/native/core/factories/internal/metadata/comment_tags_coverage_test.go +7 -16
- package/native/core/factories/internal/metadata/emplace_metadata_object.go +36 -27
- package/native/core/factories/internal/metadata/iterate_metadata_alias.go +2 -2
- package/native/core/factories/internal/metadata/iterate_metadata_constant.go +4 -4
- package/native/core/factories/internal/metadata/iterate_metadata_function.go +2 -2
- package/native/core/factories/internal/metadata/iterate_metadata_intersection.go +11 -11
- package/native/core/factories/internal/metadata/js_doc_link_text_test.go +6 -16
- package/native/core/factories/internal/metadata/js_doc_parameter_name_reads_qualified_name_test.go +2 -1
- package/native/core/factories/internal/metadata/js_doc_source_helpers_test.go +44 -0
- package/native/core/factories/internal/metadata/js_doc_type_tag_blank_separation_test.go +16 -22
- package/native/core/factories/numeric_range_factory_enforces_64bit_bounds_test.go +2 -1
- package/native/core/programmers/AssertProgrammer.go +16 -18
- package/native/core/programmers/IsProgrammer.go +10 -12
- package/native/core/programmers/RandomProgrammer.go +29 -31
- package/native/core/programmers/ValidateProgrammer.go +20 -22
- package/native/core/programmers/compare/CompareEqualProgrammer.go +1 -3
- package/native/core/programmers/compare/CompareLessProgrammer.go +1 -3
- package/native/core/programmers/functional/FunctionalAssertFunctionProgrammer.go +3 -5
- package/native/core/programmers/functional/FunctionalAssertParametersProgrammer.go +2 -2
- package/native/core/programmers/functional/FunctionalAssertReturnProgrammer.go +2 -2
- package/native/core/programmers/functional/FunctionalIsFunctionProgrammer.go +2 -2
- package/native/core/programmers/functional/FunctionalIsParametersProgrammer.go +8 -10
- package/native/core/programmers/functional/FunctionalIsReturnProgrammer.go +2 -2
- package/native/core/programmers/functional/FunctionalValidateFunctionProgrammer.go +4 -6
- package/native/core/programmers/functional/FunctionalValidateParametersProgrammer.go +2 -2
- package/native/core/programmers/functional/FunctionalValidateReturnProgrammer.go +2 -2
- package/native/core/programmers/helpers/ClassifyJoiner.go +1 -3
- package/native/core/programmers/helpers/CloneJoiner.go +8 -14
- package/native/core/programmers/helpers/FunctionProgrammer.go +3 -5
- package/native/core/programmers/helpers/NotationJoiner.go +6 -12
- package/native/core/programmers/helpers/PruneJoiner.go +10 -12
- package/native/core/programmers/helpers/RandomJoiner.go +5 -7
- package/native/core/programmers/helpers/StringifyJoinder.go +15 -17
- package/native/core/programmers/helpers/UnionExplorer.go +24 -26
- package/native/core/programmers/http/HttpAssertFormDataProgrammer.go +2 -4
- package/native/core/programmers/http/HttpAssertHeadersProgrammer.go +1 -1
- package/native/core/programmers/http/HttpAssertQueryProgrammer.go +1 -1
- package/native/core/programmers/http/HttpFormDataProgrammer.go +9 -11
- package/native/core/programmers/http/HttpHeadersProgrammer.go +7 -9
- package/native/core/programmers/http/HttpIsFormDataProgrammer.go +2 -4
- package/native/core/programmers/http/HttpIsHeadersProgrammer.go +1 -1
- package/native/core/programmers/http/HttpIsQueryProgrammer.go +1 -1
- package/native/core/programmers/http/HttpParameterProgrammer.go +2 -4
- package/native/core/programmers/http/HttpQueryProgrammer.go +8 -10
- package/native/core/programmers/http/HttpValidateFormDataProgrammer.go +2 -4
- package/native/core/programmers/http/HttpValidateHeadersProgrammer.go +1 -1
- package/native/core/programmers/http/HttpValidateQueryProgrammer.go +1 -1
- package/native/core/programmers/internal/CheckerProgrammer.go +26 -28
- package/native/core/programmers/internal/FeatureProgrammer.go +32 -34
- package/native/core/programmers/iterate/check_array_length.go +1 -1
- package/native/core/programmers/iterate/check_bigint.go +2 -4
- package/native/core/programmers/iterate/check_dynamic_key.go +5 -7
- package/native/core/programmers/iterate/check_dynamic_properties.go +43 -57
- package/native/core/programmers/iterate/check_everything.go +3 -5
- package/native/core/programmers/iterate/check_exclude.go +2 -4
- package/native/core/programmers/iterate/check_native.go +2 -4
- package/native/core/programmers/iterate/check_number.go +2 -4
- package/native/core/programmers/iterate/check_object.go +3 -5
- package/native/core/programmers/iterate/check_object_type_tags.go +1 -1
- package/native/core/programmers/iterate/check_string.go +2 -4
- package/native/core/programmers/iterate/check_template.go +7 -9
- package/native/core/programmers/iterate/decode_union_object.go +2 -4
- package/native/core/programmers/iterate/feature_object_entries.go +2 -4
- package/native/core/programmers/json/JsonAssertParseProgrammer.go +2 -2
- package/native/core/programmers/json/JsonAssertStringifyProgrammer.go +2 -4
- package/native/core/programmers/json/JsonIsParseProgrammer.go +4 -6
- package/native/core/programmers/json/JsonIsStringifyProgrammer.go +2 -4
- package/native/core/programmers/json/JsonStringifyProgrammer.go +37 -39
- package/native/core/programmers/json/JsonValidateParseProgrammer.go +2 -2
- package/native/core/programmers/json/JsonValidateStringifyProgrammer.go +2 -4
- package/native/core/programmers/llm/LlmApplicationProgrammer.go +1 -3
- package/native/core/programmers/llm/LlmCoerceProgrammer.go +2 -4
- package/native/core/programmers/llm/LlmControllerProgrammer.go +1 -3
- package/native/core/programmers/llm/LlmEvaluationProgrammer.go +1 -3
- package/native/core/programmers/llm/LlmParametersProgrammer.go +1 -3
- package/native/core/programmers/llm/LlmParseProgrammer.go +3 -5
- package/native/core/programmers/llm/LlmSchemaProgrammer.go +5 -7
- package/native/core/programmers/llm/LlmStructuredOutputProgrammer.go +2 -4
- package/native/core/programmers/llm/llm_schema_programmer_coverage_test.go +1 -1
- package/native/core/programmers/notations/NotationAssertGeneralProgrammer.go +1 -3
- package/native/core/programmers/notations/NotationGeneralProgrammer.go +26 -28
- package/native/core/programmers/notations/NotationIsGeneralProgrammer.go +1 -3
- package/native/core/programmers/notations/NotationValidateGeneralProgrammer.go +1 -3
- package/native/core/programmers/plain/PlainAssertClassifyProgrammer.go +2 -4
- package/native/core/programmers/plain/PlainAssertCloneProgrammer.go +2 -4
- package/native/core/programmers/plain/PlainAssertPruneProgrammer.go +2 -4
- package/native/core/programmers/plain/PlainClassifyProgrammer.go +44 -46
- package/native/core/programmers/plain/PlainCloneProgrammer.go +30 -32
- package/native/core/programmers/plain/PlainIsCloneProgrammer.go +2 -4
- package/native/core/programmers/plain/PlainIsPruneProgrammer.go +2 -4
- package/native/core/programmers/plain/PlainPruneProgrammer.go +26 -28
- package/native/core/programmers/plain/PlainValidateClassifyProgrammer.go +2 -4
- package/native/core/programmers/plain/PlainValidateCloneProgrammer.go +2 -4
- package/native/core/programmers/plain/PlainValidatePruneProgrammer.go +2 -4
- package/native/core/programmers/protobuf/ProtobufAssertDecodeProgrammer.go +2 -4
- package/native/core/programmers/protobuf/ProtobufAssertEncodeProgrammer.go +2 -4
- package/native/core/programmers/protobuf/ProtobufDecodeProgrammer.go +24 -25
- package/native/core/programmers/protobuf/ProtobufEncodeProgrammer.go +23 -25
- package/native/core/programmers/protobuf/ProtobufIsDecodeProgrammer.go +2 -4
- package/native/core/programmers/protobuf/ProtobufIsEncodeProgrammer.go +2 -4
- package/native/core/programmers/protobuf/ProtobufMessageProgrammer.go +1 -3
- package/native/core/programmers/protobuf/ProtobufValidateDecodeProgrammer.go +2 -4
- package/native/core/programmers/protobuf/ProtobufValidateEncodeProgrammer.go +3 -5
- package/native/core/programmers/protobuf/protobuf_programmer_helper_coverage_test.go +1 -1
- package/native/core/programmers/reflect/ReflectLiteralsProgrammer.go +1 -3
- package/native/core/schemas/metadata/MetadataCollection.go +2 -2
- package/native/core/schemas/metadata/MetadataDefaultLibrary.go +1 -1
- package/native/core/schemas/metadata/MetadataDependency.go +13 -13
- package/native/core/utils/PromiseTypeFactory.go +3 -3
- package/native/go.mod +3 -4
- package/native/go.work +1 -1
- package/native/transform/CallExpressionTransformer.go +4 -4
- package/native/transform/FileTransformer.go +2 -4
- package/native/transform/features/RandomTransformer.go +1 -3
- package/native/transform/features/compare/CompareEqualTransformer.go +1 -1
- package/native/transform/features/compare/CompareLessTransformer.go +1 -1
- package/native/transform/features/functional/FunctionalGenericTransformer.go +2 -2
- package/native/transform/features/llm/LlmCoerceTransformer.go +1 -1
- package/native/transform/features/llm/LlmEvaluationProbabilityDeclarations.go +1 -1
- package/native/transform/features/llm/LlmEvaluationTransformer.go +1 -1
- package/native/transform/features/llm/LlmParseTransformer.go +1 -1
- package/native/transform/features/llm/LlmSchemaTransformer.go +1 -3
- package/native/transform/features/reflect/ReflectNameTransformer.go +1 -3
- package/native/transform/file_transformer_coverage_test.go +2 -1
- package/native/transform/internal/GenericTransformer.go +1 -3
- package/package.json +6 -6
- package/src/transform.ts +6 -2
|
@@ -14,10 +14,8 @@ type identifierFactoryNamespace struct{}
|
|
|
14
14
|
|
|
15
15
|
var IdentifierFactory = identifierFactoryNamespace{}
|
|
16
16
|
|
|
17
|
-
var identifierFactory_factory = shimast.NewNodeFactory(shimast.NodeFactoryHooks{})
|
|
18
|
-
|
|
19
17
|
func (identifierFactoryNamespace) Identifier(name string, emit ...*shimprinter.EmitContext) *shimast.Node {
|
|
20
|
-
f := nativecontext.
|
|
18
|
+
f := nativecontext.NodeFactoryOf(emit...)
|
|
21
19
|
if identifierFactory_variable(name) {
|
|
22
20
|
return f.NewIdentifier(name)
|
|
23
21
|
}
|
|
@@ -29,7 +27,7 @@ func (identifierFactoryNamespace) Identifier(name string, emit ...*shimprinter.E
|
|
|
29
27
|
// factories use; a required parameter also makes a forgotten context a compile
|
|
30
28
|
// error rather than a silent metadata gap.
|
|
31
29
|
func (identifierFactoryNamespace) Access(ec *shimprinter.EmitContext, input *shimast.Expression, key string, chain ...bool) *shimast.Node {
|
|
32
|
-
f := nativecontext.
|
|
30
|
+
f := nativecontext.NodeFactoryOf(ec)
|
|
33
31
|
postfix := IdentifierFactory.Identifier(key, ec)
|
|
34
32
|
optional := len(chain) != 0 && chain[0]
|
|
35
33
|
var questionDot *shimast.QuestionDotToken
|
|
@@ -217,7 +215,7 @@ func identifierFactory_surrogate(str string) (rune, int) {
|
|
|
217
215
|
}
|
|
218
216
|
|
|
219
217
|
func (identifierFactoryNamespace) Parameter(name any, typeNode *shimast.TypeNode, init *shimast.Node, emit ...*shimprinter.EmitContext) *shimast.Node {
|
|
220
|
-
f := nativecontext.
|
|
218
|
+
f := nativecontext.NodeFactoryOf(emit...)
|
|
221
219
|
var binding *shimast.BindingName
|
|
222
220
|
switch v := name.(type) {
|
|
223
221
|
case string:
|
|
@@ -100,10 +100,8 @@ func (obj LiteralFactory_OrderedObject) MarshalJSON() ([]byte, error) {
|
|
|
100
100
|
return buffer.Bytes(), nil
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
var literalFactory_factory = shimast.NewNodeFactory(shimast.NodeFactoryHooks{})
|
|
104
|
-
|
|
105
103
|
func (literalFactoryNamespace) Write(input any, emit ...*shimprinter.EmitContext) *shimast.Node {
|
|
106
|
-
f := nativecontext.
|
|
104
|
+
f := nativecontext.NodeFactoryOf(emit...)
|
|
107
105
|
if input == nil {
|
|
108
106
|
return f.NewKeywordExpression(shimast.KindNullKeyword)
|
|
109
107
|
}
|
|
@@ -200,7 +198,7 @@ func literalFactory_fieldName(name string) string {
|
|
|
200
198
|
}
|
|
201
199
|
|
|
202
200
|
func literalFactory_writeObject(obj map[string]any, emit ...*shimprinter.EmitContext) *shimast.Node {
|
|
203
|
-
f := nativecontext.
|
|
201
|
+
f := nativecontext.NodeFactoryOf(emit...)
|
|
204
202
|
keys := make([]string, 0, len(obj))
|
|
205
203
|
for key, value := range obj {
|
|
206
204
|
if literalFactory_isNilLike(value) {
|
|
@@ -232,7 +230,7 @@ func literalFactory_writeObject(obj map[string]any, emit ...*shimprinter.EmitCon
|
|
|
232
230
|
}
|
|
233
231
|
|
|
234
232
|
func literalFactory_writeOrderedObject(obj LiteralFactory_OrderedObject, emit ...*shimprinter.EmitContext) *shimast.Node {
|
|
235
|
-
f := nativecontext.
|
|
233
|
+
f := nativecontext.NodeFactoryOf(emit...)
|
|
236
234
|
properties := make([]*shimast.Node, 0, len(obj.Keys))
|
|
237
235
|
for _, key := range obj.Keys {
|
|
238
236
|
value, ok := obj.Values[key]
|
|
@@ -329,7 +327,7 @@ func literalFactory_isNilLike(value any) bool {
|
|
|
329
327
|
}
|
|
330
328
|
|
|
331
329
|
func literalFactory_writeArray(array []any, emit ...*shimprinter.EmitContext) *shimast.Node {
|
|
332
|
-
f := nativecontext.
|
|
330
|
+
f := nativecontext.NodeFactoryOf(emit...)
|
|
333
331
|
elements := make([]*shimast.Node, 0, len(array))
|
|
334
332
|
for _, elem := range array {
|
|
335
333
|
elements = append(elements, LiteralFactory.Write(elem, emit...))
|
|
@@ -341,7 +339,7 @@ func literalFactory_writeArray(array []any, emit ...*shimprinter.EmitContext) *s
|
|
|
341
339
|
}
|
|
342
340
|
|
|
343
341
|
func literalFactory_writeBoolean(value bool, emit ...*shimprinter.EmitContext) *shimast.Node {
|
|
344
|
-
f := nativecontext.
|
|
342
|
+
f := nativecontext.NodeFactoryOf(emit...)
|
|
345
343
|
if value {
|
|
346
344
|
return f.NewKeywordExpression(shimast.KindTrueKeyword)
|
|
347
345
|
}
|
|
@@ -357,5 +355,5 @@ func literalFactory_writeBigint(value any, emit ...*shimprinter.EmitContext) *sh
|
|
|
357
355
|
}
|
|
358
356
|
|
|
359
357
|
func literalFactory_writeString(value string, emit ...*shimprinter.EmitContext) *shimast.Node {
|
|
360
|
-
return nativecontext.
|
|
358
|
+
return nativecontext.NodeFactoryOf(emit...).NewStringLiteral(value, shimast.TokenFlagsNone)
|
|
361
359
|
}
|
|
@@ -10,8 +10,6 @@ type numericRangeFactoryNamespace struct{}
|
|
|
10
10
|
|
|
11
11
|
var NumericRangeFactory = numericRangeFactoryNamespace{}
|
|
12
12
|
|
|
13
|
-
var numericRangeFactory_factory = shimast.NewNodeFactory(shimast.NodeFactoryHooks{})
|
|
14
|
-
|
|
15
13
|
func (numericRangeFactoryNamespace) Number(t string, input *shimast.Expression, emit ...*shimprinter.EmitContext) *shimast.Node {
|
|
16
14
|
switch t {
|
|
17
15
|
case "int32":
|
|
@@ -25,7 +23,7 @@ func (numericRangeFactoryNamespace) Number(t string, input *shimast.Expression,
|
|
|
25
23
|
case "float":
|
|
26
24
|
return numericRangeFactory_between("-3.4028235e38", "3.4028235e38", emit...)(input)
|
|
27
25
|
default:
|
|
28
|
-
return nativecontext.
|
|
26
|
+
return nativecontext.NodeFactoryOf(emit...).NewKeywordExpression(shimast.KindTrueKeyword)
|
|
29
27
|
}
|
|
30
28
|
}
|
|
31
29
|
|
|
@@ -42,7 +40,7 @@ func (numericRangeFactoryNamespace) Bigint(t string, input *shimast.Expression,
|
|
|
42
40
|
case "uint64":
|
|
43
41
|
return numericRangeFactory_bigint_between("0", "18446744073709551615", input, emit...)
|
|
44
42
|
default:
|
|
45
|
-
return nativecontext.
|
|
43
|
+
return nativecontext.NodeFactoryOf(emit...).NewKeywordExpression(shimast.KindTrueKeyword)
|
|
46
44
|
}
|
|
47
45
|
}
|
|
48
46
|
|
|
@@ -83,7 +81,7 @@ func numericRangeFactory_number_uint64(input *shimast.Expression, emit ...*shimp
|
|
|
83
81
|
}
|
|
84
82
|
|
|
85
83
|
func numericRangeFactory_integer(input *shimast.Expression, emit ...*shimprinter.EmitContext) *shimast.Node {
|
|
86
|
-
f := nativecontext.
|
|
84
|
+
f := nativecontext.NodeFactoryOf(emit...)
|
|
87
85
|
return f.NewBinaryExpression(
|
|
88
86
|
nil,
|
|
89
87
|
f.NewCallExpression(
|
|
@@ -100,7 +98,7 @@ func numericRangeFactory_integer(input *shimast.Expression, emit ...*shimprinter
|
|
|
100
98
|
}
|
|
101
99
|
|
|
102
100
|
func numericRangeFactory_between(x string, y string, emit ...*shimprinter.EmitContext) func(input *shimast.Expression) *shimast.Node {
|
|
103
|
-
f := nativecontext.
|
|
101
|
+
f := nativecontext.NodeFactoryOf(emit...)
|
|
104
102
|
return func(input *shimast.Expression) *shimast.Node {
|
|
105
103
|
return numericRangeFactory_logical_and(
|
|
106
104
|
f.NewBinaryExpression(
|
|
@@ -129,7 +127,7 @@ func numericRangeFactory_between(x string, y string, emit ...*shimprinter.EmitCo
|
|
|
129
127
|
// rounding that broke the number path -- while the string form parses the digits
|
|
130
128
|
// exactly.
|
|
131
129
|
func numericRangeFactory_bigint_literal(value string, emit ...*shimprinter.EmitContext) *shimast.Node {
|
|
132
|
-
f := nativecontext.
|
|
130
|
+
f := nativecontext.NodeFactoryOf(emit...)
|
|
133
131
|
return f.NewCallExpression(
|
|
134
132
|
f.NewIdentifier("BigInt"),
|
|
135
133
|
nil,
|
|
@@ -144,7 +142,7 @@ func numericRangeFactory_bigint_literal(value string, emit ...*shimprinter.EmitC
|
|
|
144
142
|
// Both comparisons are inclusive because a bigint represents the true 64-bit
|
|
145
143
|
// bounds exactly, unlike the number path's exclusive approximation.
|
|
146
144
|
func numericRangeFactory_bigint_between(x string, y string, input *shimast.Expression, emit ...*shimprinter.EmitContext) *shimast.Node {
|
|
147
|
-
f := nativecontext.
|
|
145
|
+
f := nativecontext.NodeFactoryOf(emit...)
|
|
148
146
|
return numericRangeFactory_logical_and(
|
|
149
147
|
f.NewBinaryExpression(
|
|
150
148
|
nil,
|
|
@@ -165,11 +163,11 @@ func numericRangeFactory_bigint_between(x string, y string, input *shimast.Expre
|
|
|
165
163
|
}
|
|
166
164
|
|
|
167
165
|
func numericRangeFactory_logical_and(x *shimast.Expression, y *shimast.Expression, emit ...*shimprinter.EmitContext) *shimast.Node {
|
|
168
|
-
return nativecontext.
|
|
166
|
+
return nativecontext.NodeFactoryOf(emit...).NewBinaryExpression(
|
|
169
167
|
nil,
|
|
170
168
|
x,
|
|
171
169
|
nil,
|
|
172
|
-
nativecontext.
|
|
170
|
+
nativecontext.NodeFactoryOf(emit...).NewToken(shimast.KindAmpersandAmpersandToken),
|
|
173
171
|
y,
|
|
174
172
|
)
|
|
175
173
|
}
|
|
@@ -60,10 +60,8 @@ type StatementFactory_EntryProps struct {
|
|
|
60
60
|
Value string
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
var statementFactory_factory = shimast.NewNodeFactory(shimast.NodeFactoryHooks{})
|
|
64
|
-
|
|
65
63
|
func (statementFactoryNamespace) Mut(props StatementFactory_MutProps, emit ...*shimprinter.EmitContext) *shimast.Node {
|
|
66
|
-
f := nativecontext.
|
|
64
|
+
f := nativecontext.NodeFactoryOf(emit...)
|
|
67
65
|
typeNode := props.Type
|
|
68
66
|
if typeNode == nil && props.Initializer == nil {
|
|
69
67
|
typeNode = TypeFactory.Keyword("any", emit...)
|
|
@@ -84,7 +82,7 @@ func (statementFactoryNamespace) Mut(props StatementFactory_MutProps, emit ...*s
|
|
|
84
82
|
}
|
|
85
83
|
|
|
86
84
|
func (statementFactoryNamespace) Constant(props StatementFactory_ConstantProps, emit ...*shimprinter.EmitContext) *shimast.Node {
|
|
87
|
-
f := nativecontext.
|
|
85
|
+
f := nativecontext.NodeFactoryOf(emit...)
|
|
88
86
|
typeNode := props.Type
|
|
89
87
|
if typeNode == nil && props.Value == nil {
|
|
90
88
|
typeNode = TypeFactory.Keyword("any", emit...)
|
|
@@ -105,7 +103,7 @@ func (statementFactoryNamespace) Constant(props StatementFactory_ConstantProps,
|
|
|
105
103
|
}
|
|
106
104
|
|
|
107
105
|
func (statementFactoryNamespace) Entry(props StatementFactory_EntryProps, emit ...*shimprinter.EmitContext) *shimast.Node {
|
|
108
|
-
f := nativecontext.
|
|
106
|
+
f := nativecontext.NodeFactoryOf(emit...)
|
|
109
107
|
key := f.NewBindingElement(
|
|
110
108
|
nil,
|
|
111
109
|
nil,
|
|
@@ -130,14 +128,14 @@ func (statementFactoryNamespace) Entry(props StatementFactory_EntryProps, emit .
|
|
|
130
128
|
}
|
|
131
129
|
|
|
132
130
|
func (statementFactoryNamespace) Transpile(script string, emit ...*shimprinter.EmitContext) *shimast.Node {
|
|
133
|
-
f := nativecontext.
|
|
131
|
+
f := nativecontext.NodeFactoryOf(emit...)
|
|
134
132
|
return f.NewExpressionStatement(
|
|
135
133
|
f.NewIdentifier(script),
|
|
136
134
|
)
|
|
137
135
|
}
|
|
138
136
|
|
|
139
137
|
func (statementFactoryNamespace) Block(expression *shimast.Expression, emit ...*shimprinter.EmitContext) *shimast.Node {
|
|
140
|
-
f := nativecontext.
|
|
138
|
+
f := nativecontext.NodeFactoryOf(emit...)
|
|
141
139
|
return f.NewBlock(
|
|
142
140
|
f.NewNodeList([]*shimast.Node{
|
|
143
141
|
f.NewExpressionStatement(expression),
|
|
@@ -27,10 +27,8 @@ type TemplateFactory_IIterator struct {
|
|
|
27
27
|
Index int
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
var templateFactory_factory = shimast.NewNodeFactory(shimast.NodeFactoryHooks{})
|
|
31
|
-
|
|
32
30
|
func (templateFactoryNamespace) Generate(expressions []*shimast.Expression, emit ...*shimprinter.EmitContext) *shimast.Node {
|
|
33
|
-
f := nativecontext.
|
|
31
|
+
f := nativecontext.NodeFactoryOf(emit...)
|
|
34
32
|
allString := true
|
|
35
33
|
for _, exp := range expressions {
|
|
36
34
|
if !shimast.IsStringLiteral(exp) {
|
|
@@ -54,8 +54,6 @@ type TypeFactory_GetFullNameProps struct {
|
|
|
54
54
|
AliasTypeArguments *bool
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
var typeFactory_factory = shimast.NewNodeFactory(shimast.NodeFactoryHooks{})
|
|
58
|
-
|
|
59
57
|
func (typeFactoryNamespace) IsFunction(t *shimchecker.Type) bool {
|
|
60
58
|
return TypeFactory.GetFunction(t) != nil
|
|
61
59
|
}
|
|
@@ -65,10 +63,10 @@ func (typeFactoryNamespace) GetFunction(t *shimchecker.Type) *shimast.Node {
|
|
|
65
63
|
return nil
|
|
66
64
|
}
|
|
67
65
|
symbol := t.Symbol()
|
|
68
|
-
if symbol == nil || len(symbol
|
|
66
|
+
if symbol == nil || len(shimast.SymbolDeclarationsOf(symbol)) == 0 {
|
|
69
67
|
return nil
|
|
70
68
|
}
|
|
71
|
-
node := symbol
|
|
69
|
+
node := shimast.SymbolDeclarationsOf(symbol)[0]
|
|
72
70
|
if shimast.IsFunctionLike(node) {
|
|
73
71
|
return node
|
|
74
72
|
}
|
|
@@ -93,10 +91,10 @@ func (typeFactoryNamespace) GetReturnTypeOfClassMethod(props TypeFactory_GetRetu
|
|
|
93
91
|
return nil
|
|
94
92
|
}
|
|
95
93
|
symbol := props.Checker.GetPropertyOfType(props.Class, props.Function)
|
|
96
|
-
if symbol == nil || symbol
|
|
94
|
+
if symbol == nil || shimast.SymbolValueDeclarationOf(symbol) == nil {
|
|
97
95
|
return nil
|
|
98
96
|
}
|
|
99
|
-
functor := props.Checker.GetTypeOfSymbolAtLocation(symbol, symbol
|
|
97
|
+
functor := props.Checker.GetTypeOfSymbolAtLocation(symbol, shimast.SymbolValueDeclarationOf(symbol))
|
|
100
98
|
signatures := props.Checker.GetSignaturesOfType(functor, shimchecker.SignatureKindCall)
|
|
101
99
|
if len(signatures) == 0 {
|
|
102
100
|
return nil
|
|
@@ -165,10 +163,10 @@ func typeFactory_explore_name(node *shimast.Node, name string) string {
|
|
|
165
163
|
}
|
|
166
164
|
|
|
167
165
|
func typeFactory_get_name(symbol *shimast.Symbol) string {
|
|
168
|
-
if symbol == nil || len(symbol
|
|
166
|
+
if symbol == nil || len(shimast.SymbolDeclarationsOf(symbol)) == 0 || shimast.SymbolDeclarationsOf(symbol)[0].Parent == nil {
|
|
169
167
|
return "__type"
|
|
170
168
|
}
|
|
171
|
-
return typeFactory_explore_name(symbol
|
|
169
|
+
return typeFactory_explore_name(shimast.SymbolDeclarationsOf(symbol)[0].Parent, shimast.SymbolNameOf(symbol))
|
|
172
170
|
}
|
|
173
171
|
|
|
174
172
|
func typeFactory_get_type_arguments(checker *shimchecker.Checker, t *shimchecker.Type) (output []*shimchecker.Type) {
|
|
@@ -182,7 +180,7 @@ func typeFactory_get_type_arguments(checker *shimchecker.Checker, t *shimchecker
|
|
|
182
180
|
}
|
|
183
181
|
|
|
184
182
|
func (typeFactoryNamespace) Keyword(t string, emit ...*shimprinter.EmitContext) *shimast.Node {
|
|
185
|
-
f := nativecontext.
|
|
183
|
+
f := nativecontext.NodeFactoryOf(emit...)
|
|
186
184
|
var kind shimast.KeywordTypeSyntaxKind
|
|
187
185
|
switch t {
|
|
188
186
|
case "void":
|
|
@@ -10,18 +10,16 @@ type valueFactoryNamespace struct{}
|
|
|
10
10
|
|
|
11
11
|
var ValueFactory = valueFactoryNamespace{}
|
|
12
12
|
|
|
13
|
-
var valueFactory_factory = shimast.NewNodeFactory(shimast.NodeFactoryHooks{})
|
|
14
|
-
|
|
15
13
|
func (valueFactoryNamespace) NULL(emit ...*shimprinter.EmitContext) *shimast.Node {
|
|
16
|
-
return nativecontext.
|
|
14
|
+
return nativecontext.NodeFactoryOf(emit...).NewKeywordExpression(shimast.KindNullKeyword)
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
func (valueFactoryNamespace) UNDEFINED(emit ...*shimprinter.EmitContext) *shimast.Node {
|
|
20
|
-
return nativecontext.
|
|
18
|
+
return nativecontext.NodeFactoryOf(emit...).NewIdentifier("undefined")
|
|
21
19
|
}
|
|
22
20
|
|
|
23
21
|
func (valueFactoryNamespace) BOOLEAN(value bool, emit ...*shimprinter.EmitContext) *shimast.Node {
|
|
24
|
-
f := nativecontext.
|
|
22
|
+
f := nativecontext.NodeFactoryOf(emit...)
|
|
25
23
|
if value {
|
|
26
24
|
return f.NewKeywordExpression(shimast.KindTrueKeyword)
|
|
27
25
|
}
|
|
@@ -35,9 +33,9 @@ func (valueFactoryNamespace) INPUT(ec *shimprinter.EmitContext, str ...string) *
|
|
|
35
33
|
if len(str) != 0 {
|
|
36
34
|
name = str[0]
|
|
37
35
|
}
|
|
38
|
-
return nativecontext.
|
|
36
|
+
return nativecontext.NodeFactoryOf(ec).NewIdentifier(name)
|
|
39
37
|
}
|
|
40
38
|
|
|
41
39
|
func (valueFactoryNamespace) TYPEOF(input *shimast.Expression, emit ...*shimprinter.EmitContext) *shimast.Node {
|
|
42
|
-
return nativecontext.
|
|
40
|
+
return nativecontext.NodeFactoryOf(emit...).NewTypeOfExpression(input)
|
|
43
41
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
package factories
|
|
5
5
|
|
|
6
6
|
import (
|
|
7
|
+
nativecontext "github.com/samchon/typia/packages/typia/native/core/context"
|
|
7
8
|
"math/big"
|
|
8
9
|
"os"
|
|
9
10
|
"path/filepath"
|
|
@@ -37,7 +38,7 @@ import (
|
|
|
37
38
|
// @evidence contracts/testing.md#execution-ownership The typia_native_internal Go command (go -C packages/typia/test test -tags typia_native_internal ../native/...) runs this same-package unit Test in process. AST helpers use the node factory; checker-backed cases write a temporary TypeScript fixture, load it through driver.LoadProgram, and close the program. No compiler or JavaScript subprocess is launched.
|
|
38
39
|
func TestFactoryUtilityCoverage(t *testing.T) {
|
|
39
40
|
emit := shimprinter.NewEmitContext()
|
|
40
|
-
input :=
|
|
41
|
+
input := nativecontext.NodeFactoryOf().NewIdentifier("input")
|
|
41
42
|
for _, name := range []string{"int32", "uint32", "int64", "uint64", "float", "double", "unknown"} {
|
|
42
43
|
if NumericRangeFactory.Number(name, input) == nil {
|
|
43
44
|
t.Fatalf("number range %s returned nil", name)
|
|
@@ -63,26 +64,26 @@ func TestFactoryUtilityCoverage(t *testing.T) {
|
|
|
63
64
|
if ExpressionFactory.IsArray(input) == nil ||
|
|
64
65
|
ExpressionFactory.IsObject(ExpressionFactory_IsObjectProps{Input: input, CheckNull: true, CheckArray: true}) == nil ||
|
|
65
66
|
ExpressionFactory.IsInstanceOf("Date", input) == nil ||
|
|
66
|
-
ExpressionFactory.Coalesce(input,
|
|
67
|
+
ExpressionFactory.Coalesce(input, nativecontext.NodeFactoryOf().NewIdentifier("fallback")) == nil {
|
|
67
68
|
t.Fatal("basic expression factory branch returned nil")
|
|
68
69
|
}
|
|
69
70
|
if ExpressionFactory.Currying(ExpressionFactory_CurryingProps{
|
|
70
|
-
Function:
|
|
71
|
+
Function: nativecontext.NodeFactoryOf().NewIdentifier("fn"),
|
|
71
72
|
Arguments: nil,
|
|
72
73
|
}) == nil {
|
|
73
74
|
t.Fatal("zero-argument currying returned nil")
|
|
74
75
|
}
|
|
75
76
|
if ExpressionFactory.Currying(ExpressionFactory_CurryingProps{
|
|
76
|
-
Function:
|
|
77
|
+
Function: nativecontext.NodeFactoryOf().NewIdentifier("fn"),
|
|
77
78
|
Arguments: []*shimast.Expression{
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
nativecontext.NodeFactoryOf().NewIdentifier("a"),
|
|
80
|
+
nativecontext.NodeFactoryOf().NewIdentifier("b"),
|
|
80
81
|
},
|
|
81
82
|
}) == nil {
|
|
82
83
|
t.Fatal("multi-argument currying returned nil")
|
|
83
84
|
}
|
|
84
|
-
call :=
|
|
85
|
-
|
|
85
|
+
call := nativecontext.NodeFactoryOf().NewCallExpression(
|
|
86
|
+
nativecontext.NodeFactoryOf().NewIdentifier("already"),
|
|
86
87
|
nil,
|
|
87
88
|
nil,
|
|
88
89
|
nil,
|
|
@@ -101,7 +102,7 @@ func TestFactoryUtilityCoverage(t *testing.T) {
|
|
|
101
102
|
t.Fatal("identifier escaped text mismatch")
|
|
102
103
|
}
|
|
103
104
|
if ExpressionFactory.GetEscapedText(ExpressionFactory_GetEscapedTextProps{
|
|
104
|
-
Input:
|
|
105
|
+
Input: nativecontext.NodeFactoryOf().NewStringLiteral("text", shimast.TokenFlagsNone),
|
|
105
106
|
}) != "text" {
|
|
106
107
|
t.Fatal("string escaped text mismatch")
|
|
107
108
|
}
|
|
@@ -202,7 +203,7 @@ export let inner!: Outer.Inner;
|
|
|
202
203
|
if assignedSymbol == nil {
|
|
203
204
|
t.Fatal("holder.assigned symbol was not found")
|
|
204
205
|
}
|
|
205
|
-
assignedType := prog.Checker.GetTypeOfSymbolAtLocation(assignedSymbol, assignedSymbol
|
|
206
|
+
assignedType := prog.Checker.GetTypeOfSymbolAtLocation(assignedSymbol, shimast.SymbolValueDeclarationOf(assignedSymbol))
|
|
206
207
|
assignedDeclaredType := shimchecker.Checker_getTypeOfSymbol(prog.Checker, assignedSymbol)
|
|
207
208
|
if TypeFactory.GetFunction(assignedDeclaredType) == nil && TypeFactory.GetFunction(assignedType) == nil {
|
|
208
209
|
t.Fatal("property assignment initializer should be recognized as function-like")
|
|
@@ -212,7 +213,7 @@ export let inner!: Outer.Inner;
|
|
|
212
213
|
if fieldSymbol == nil {
|
|
213
214
|
t.Fatal("example.field symbol was not found")
|
|
214
215
|
}
|
|
215
|
-
fieldType := prog.Checker.GetTypeOfSymbolAtLocation(fieldSymbol, fieldSymbol
|
|
216
|
+
fieldType := prog.Checker.GetTypeOfSymbolAtLocation(fieldSymbol, shimast.SymbolValueDeclarationOf(fieldSymbol))
|
|
216
217
|
fieldDeclaredType := shimchecker.Checker_getTypeOfSymbol(prog.Checker, fieldSymbol)
|
|
217
218
|
if TypeFactory.GetFunction(fieldDeclaredType) == nil && TypeFactory.GetFunction(fieldType) == nil {
|
|
218
219
|
t.Fatal("property declaration initializer should be recognized as function-like")
|
|
@@ -259,7 +260,7 @@ export let inner!: Outer.Inner;
|
|
|
259
260
|
}
|
|
260
261
|
if IdentifierFactory.Parameter("value", nil, nil) == nil ||
|
|
261
262
|
IdentifierFactory.Parameter(input, TypeFactory.Keyword("string"), nil) == nil ||
|
|
262
|
-
IdentifierFactory.Parameter(123, nil,
|
|
263
|
+
IdentifierFactory.Parameter(123, nil, nativecontext.NodeFactoryOf().NewToken(shimast.KindQuestionToken)) == nil {
|
|
263
264
|
t.Fatal("identifier parameter branch returned nil")
|
|
264
265
|
}
|
|
265
266
|
|
|
@@ -309,12 +310,12 @@ export let inner!: Outer.Inner;
|
|
|
309
310
|
t.Fatal("literal factory branch returned nil")
|
|
310
311
|
}
|
|
311
312
|
if TemplateFactory.Generate([]*shimast.Expression{
|
|
312
|
-
|
|
313
|
-
|
|
313
|
+
nativecontext.NodeFactoryOf().NewStringLiteral("a", shimast.TokenFlagsNone),
|
|
314
|
+
nativecontext.NodeFactoryOf().NewStringLiteral("b", shimast.TokenFlagsNone),
|
|
314
315
|
}) == nil || TemplateFactory.Generate([]*shimast.Expression{
|
|
315
|
-
|
|
316
|
+
nativecontext.NodeFactoryOf().NewStringLiteral("a", shimast.TokenFlagsNone),
|
|
316
317
|
input,
|
|
317
|
-
|
|
318
|
+
nativecontext.NodeFactoryOf().NewStringLiteral("b", shimast.TokenFlagsNone),
|
|
318
319
|
}) == nil {
|
|
319
320
|
t.Fatal("template factory branch returned nil")
|
|
320
321
|
}
|
|
@@ -872,7 +873,7 @@ export let inner!: Outer.Inner;
|
|
|
872
873
|
type factoryUtilityImporter struct{}
|
|
873
874
|
|
|
874
875
|
func (factoryUtilityImporter) Internal(name string) *shimast.Node {
|
|
875
|
-
return
|
|
876
|
+
return nativecontext.NodeFactoryOf().NewIdentifier(name)
|
|
876
877
|
}
|
|
877
878
|
|
|
878
879
|
func factoryUtilitySequenceTag(value int) schemametadata.IMetadataTypeTag {
|
|
@@ -893,15 +894,15 @@ func factoryUtilityMustPanic(t *testing.T, run func()) {
|
|
|
893
894
|
}
|
|
894
895
|
|
|
895
896
|
func (factoryUtilityImporter) Instance(props ExpressionFactory_IInstance) *shimast.Node {
|
|
896
|
-
return
|
|
897
|
+
return nativecontext.NodeFactoryOf().NewIdentifier(props.Name)
|
|
897
898
|
}
|
|
898
899
|
|
|
899
900
|
func (factoryUtilityImporter) Namespace(props ExpressionFactory_INamespace) *shimast.Node {
|
|
900
|
-
return
|
|
901
|
+
return nativecontext.NodeFactoryOf().NewIdentifier(props.Name)
|
|
901
902
|
}
|
|
902
903
|
|
|
903
904
|
func (factoryUtilityImporter) Default(props ExpressionFactory_IDefault) *shimast.Node {
|
|
904
|
-
return
|
|
905
|
+
return nativecontext.NodeFactoryOf().NewIdentifier(props.Name)
|
|
905
906
|
}
|
|
906
907
|
|
|
907
908
|
func factoryUtilityLiteralMetadata(value string) *schemametadata.MetadataSchema {
|
|
@@ -88,10 +88,10 @@ func metadata_type_symbol_base_name(typ *nativechecker.Type) string {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
func metadata_symbol_name(symbol *nativeast.Symbol) string {
|
|
91
|
-
if symbol == nil || len(symbol
|
|
91
|
+
if symbol == nil || len(nativeast.SymbolDeclarationsOf(symbol)) == 0 || nativeast.SymbolDeclarationsOf(symbol)[0].Parent == nil {
|
|
92
92
|
return "__type"
|
|
93
93
|
}
|
|
94
|
-
return metadata_explore_symbol_name(symbol
|
|
94
|
+
return metadata_explore_symbol_name(nativeast.SymbolDeclarationsOf(symbol)[0].Parent, nativeast.SymbolNameOf(symbol))
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
func metadata_explore_symbol_name(node *nativeast.Node, name string) string {
|
|
@@ -122,10 +122,10 @@ func metadata_get_function_node(checker *nativechecker.Checker, typ *nativecheck
|
|
|
122
122
|
return nil
|
|
123
123
|
}
|
|
124
124
|
symbol := typ.Symbol()
|
|
125
|
-
if symbol == nil || len(symbol
|
|
125
|
+
if symbol == nil || len(nativeast.SymbolDeclarationsOf(symbol)) == 0 {
|
|
126
126
|
return nil
|
|
127
127
|
}
|
|
128
|
-
node := symbol
|
|
128
|
+
node := nativeast.SymbolDeclarationsOf(symbol)[0]
|
|
129
129
|
if nativeast.IsFunctionLike(node) {
|
|
130
130
|
return node
|
|
131
131
|
}
|
|
@@ -172,10 +172,10 @@ func metadata_get_return_type_of_class_method(props struct {
|
|
|
172
172
|
return nil
|
|
173
173
|
}
|
|
174
174
|
symbol := props.Checker.GetPropertyOfType(props.Class, props.Function)
|
|
175
|
-
if symbol == nil || symbol
|
|
175
|
+
if symbol == nil || nativeast.SymbolValueDeclarationOf(symbol) == nil {
|
|
176
176
|
return nil
|
|
177
177
|
}
|
|
178
|
-
functor := props.Checker.GetTypeOfSymbolAtLocation(symbol, symbol
|
|
178
|
+
functor := props.Checker.GetTypeOfSymbolAtLocation(symbol, nativeast.SymbolValueDeclarationOf(symbol))
|
|
179
179
|
signatures := props.Checker.GetSignaturesOfType(functor, nativechecker.SignatureKindCall)
|
|
180
180
|
if len(signatures) == 0 {
|
|
181
181
|
return nil
|
|
@@ -271,7 +271,7 @@ func metadata_node_type_js_doc_tags(symbol *nativeast.Symbol) []schemametadata.I
|
|
|
271
271
|
// other callable object type. See metadata_get_function_node for why the lib
|
|
272
272
|
// `Function` must be treated as a function type (#2178).
|
|
273
273
|
func metadata_is_global_function_interface(symbol *nativeast.Symbol, node *nativeast.Node) bool {
|
|
274
|
-
if symbol == nil || symbol
|
|
274
|
+
if symbol == nil || nativeast.SymbolNameOf(symbol) != "Function" {
|
|
275
275
|
return false
|
|
276
276
|
}
|
|
277
277
|
if node == nil || node.Kind != nativeast.KindInterfaceDeclaration {
|
|
@@ -341,7 +341,7 @@ func metadata_symbol_from_default_lib(symbol *nativeast.Symbol) bool {
|
|
|
341
341
|
if src == nil {
|
|
342
342
|
continue
|
|
343
343
|
}
|
|
344
|
-
return schemametadata.MetadataDefaultLibrary_isFileNamed(src.FileName())
|
|
344
|
+
return schemametadata.MetadataDefaultLibrary_isFileNamed(string(src.FileName()))
|
|
345
345
|
}
|
|
346
346
|
return false
|
|
347
347
|
}
|
|
@@ -415,7 +415,7 @@ func metadata_symbol_has_runtime_provider(checker *nativechecker.Checker, symbol
|
|
|
415
415
|
return true
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
|
-
if checker == nil || symbol
|
|
418
|
+
if checker == nil || nativeast.SymbolFlagsOf(symbol)&nativeast.SymbolFlagsValue == 0 {
|
|
419
419
|
return false
|
|
420
420
|
}
|
|
421
421
|
constructor := checker.GetTypeOfSymbol(symbol)
|
|
@@ -464,10 +464,10 @@ func metadata_node_in_node_buffer_module(node *nativeast.Node) bool {
|
|
|
464
464
|
}
|
|
465
465
|
|
|
466
466
|
func metadata_symbol_is_node_buffer_native_export(symbol *nativeast.Symbol, name string) bool {
|
|
467
|
-
if symbol == nil || symbol
|
|
467
|
+
if symbol == nil || nativeast.SymbolValueDeclarationOf(symbol) == nil || (name != "Blob" && name != "File") {
|
|
468
468
|
return false
|
|
469
469
|
}
|
|
470
|
-
declaration := symbol
|
|
470
|
+
declaration := nativeast.SymbolValueDeclarationOf(symbol)
|
|
471
471
|
if declaration.Kind != nativeast.KindClassDeclaration && declaration.Kind != nativeast.KindVariableDeclaration {
|
|
472
472
|
return false
|
|
473
473
|
}
|
|
@@ -500,8 +500,8 @@ func metadata_node_declarations(symbol *nativeast.Symbol) []*nativeast.Node {
|
|
|
500
500
|
output = append(output, node)
|
|
501
501
|
}
|
|
502
502
|
}
|
|
503
|
-
appendNode(symbol
|
|
504
|
-
for _, node := range symbol
|
|
503
|
+
appendNode(nativeast.SymbolValueDeclarationOf(symbol))
|
|
504
|
+
for _, node := range nativeast.SymbolDeclarationsOf(symbol) {
|
|
505
505
|
appendNode(node)
|
|
506
506
|
}
|
|
507
507
|
return output
|
|
@@ -4,17 +4,13 @@
|
|
|
4
4
|
package metadata
|
|
5
5
|
|
|
6
6
|
import (
|
|
7
|
-
"path/filepath"
|
|
8
7
|
"reflect"
|
|
9
8
|
"testing"
|
|
10
9
|
|
|
11
|
-
nativeast "github.com/microsoft/typescript-go/shim/ast"
|
|
12
|
-
nativecore "github.com/microsoft/typescript-go/shim/core"
|
|
13
|
-
nativeparser "github.com/microsoft/typescript-go/shim/parser"
|
|
14
10
|
schemametadata "github.com/samchon/typia/packages/typia/native/core/schemas/metadata"
|
|
15
11
|
)
|
|
16
12
|
|
|
17
|
-
// TestCommentTagsCoverage
|
|
13
|
+
// TestCommentTagsCoverage verifies metadata comment tag application.
|
|
18
14
|
//
|
|
19
15
|
// Comment tags are collected from checker symbols before metadata sorting, so
|
|
20
16
|
// synthetic TypeScript fixtures rarely hit every tag kind deterministically.
|
|
@@ -29,7 +25,7 @@ import (
|
|
|
29
25
|
// @evidence contracts/testing.md#behavioral-verification The comment-tag dispatcher calls a test analyzer on constructed property metadata. Exactly one callback, its property/location inputs, each exact test tag and one propagated error are asserted, and a repeated call must leave the callback count unchanged. Parsed JSDoc presence and nil-helper fallbacks are also checked; the real analyzer's parsing semantics are not exercised here.
|
|
30
26
|
// @evidence contracts/testing.md#independent-expectations Authored callback inputs and marker tags establish the dispatch and once-only contract independently of the dispatcher. The test analyzer deliberately supplies tag/error outputs, so those outputs do not establish real comment-tag parsing; that belongs to factory tests.
|
|
31
27
|
// @evidence contracts/testing.md#distinguishing-cases Every tag bucket, repeated application and parsing are exercised once; this test has few negatives.
|
|
32
|
-
// @evidence contracts/testing.md#execution-ownership The typia_native_internal Go command
|
|
28
|
+
// @evidence contracts/testing.md#execution-ownership The typia_native_internal Go command runs this same-package Test in process. Dispatcher cases use constructed metadata and an installed analyzer; the JSDoc case loads one test-owned source through the compiler binder to obtain its real property symbol. Cleanup closes that Program and removes its fixture without launching a compiler or native host subprocess.
|
|
33
29
|
func TestCommentTagsCoverage(t *testing.T) {
|
|
34
30
|
oldAnalyzer := MetadataCommentTagAnalyzer
|
|
35
31
|
calls := 0
|
|
@@ -146,9 +142,7 @@ func TestCommentTagsCoverage(t *testing.T) {
|
|
|
146
142
|
Name: "NoAnalyzer",
|
|
147
143
|
Properties: []*schemametadata.MetadataProperty{property},
|
|
148
144
|
})})
|
|
149
|
-
file :=
|
|
150
|
-
nativeast.SourceFileParseOptions{FileName: filepath.ToSlash(filepath.Join(t.TempDir(), "comment.ts"))},
|
|
151
|
-
`interface Box {
|
|
145
|
+
program, file := jsDocTestSource(t, `interface Box {
|
|
152
146
|
/**
|
|
153
147
|
* box description
|
|
154
148
|
* @type {string}
|
|
@@ -156,14 +150,11 @@ func TestCommentTagsCoverage(t *testing.T) {
|
|
|
156
150
|
*/
|
|
157
151
|
field: string;
|
|
158
152
|
}
|
|
159
|
-
|
|
160
|
-
nativecore.ScriptKindTS,
|
|
161
|
-
)
|
|
153
|
+
`)
|
|
162
154
|
member := file.Statements.Nodes[0].AsInterfaceDeclaration().Members.Nodes[0]
|
|
163
|
-
symbol :=
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
Declarations: []*nativeast.Node{member},
|
|
155
|
+
symbol := program.Checker.GetSymbolAtLocation(member.Name())
|
|
156
|
+
if symbol == nil {
|
|
157
|
+
t.Fatal("comment property symbol was not bound")
|
|
167
158
|
}
|
|
168
159
|
if len(metadata_node_js_doc_tags(symbol)) == 0 || metadata_node_description(symbol) == nil {
|
|
169
160
|
t.Fatal("parsed JSDoc tags and description should be discovered")
|