typia 13.0.0-dev.20260511 → 13.0.0-dev.20260514
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/README.md +36 -17
- package/native/adapter/adapter.go +14 -4
- package/native/adapter/imports.go +12 -1
- package/native/cmd/ttsc-typia/main.go +2 -0
- package/native/cmd/ttsc-typia/main_wasm.go +226 -0
- package/native/core/factories/MetadataFactory.go +480 -462
- package/native/core/factories/internal/metadata/IMetadataIteratorProps.go +42 -35
- package/native/core/factories/internal/metadata/MetadataHelper.go +209 -176
- package/native/core/factories/internal/metadata/iterate_metadata_comment_tags.go +26 -12
- package/native/go.work +22 -0
- package/native/transform/CallExpressionTransformer.go +26 -1
- package/package.json +4 -4
|
@@ -1,56 +1,63 @@
|
|
|
1
1
|
package metadata
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
nativechecker "github.com/microsoft/typescript-go/shim/checker"
|
|
5
|
+
schemametadata "github.com/samchon/typia/packages/typia/native/core/schemas/metadata"
|
|
6
6
|
)
|
|
7
7
|
|
|
8
8
|
type MetadataFactory_IOptions struct {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
Escape bool
|
|
10
|
+
Absorb bool
|
|
11
|
+
Constant bool
|
|
12
|
+
Functional bool
|
|
13
|
+
Validate func(props struct {
|
|
14
|
+
Metadata *schemametadata.MetadataSchema
|
|
15
|
+
Explore MetadataFactory_IExplore
|
|
16
|
+
Top *schemametadata.MetadataSchema
|
|
17
|
+
}) []string
|
|
18
|
+
OnError func(node any, message string)
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
type MetadataFactory_IError struct {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
Name string
|
|
23
|
+
Explore MetadataFactory_IExplore
|
|
24
|
+
Messages []string
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
type MetadataFactory_IExplore struct {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
Top bool
|
|
29
|
+
Object *schemametadata.MetadataObjectType
|
|
30
|
+
Property any
|
|
31
|
+
Parameter any
|
|
32
|
+
Nested any
|
|
33
|
+
Aliased bool
|
|
34
|
+
Escaped bool
|
|
35
|
+
Output bool
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
type MetadataFactory_IExplore_Function func(MetadataFactory_IExplore) MetadataFactory_IExplore
|
|
39
39
|
|
|
40
40
|
type IMetadataIteratorProps struct {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
Options MetadataFactory_IOptions
|
|
42
|
+
Checker *nativechecker.Checker
|
|
43
|
+
Components *schemametadata.MetadataCollection
|
|
44
|
+
Errors *[]MetadataFactory_IError
|
|
45
|
+
Metadata *schemametadata.MetadataSchema
|
|
46
|
+
Type *nativechecker.Type
|
|
47
|
+
Explore MetadataFactory_IExplore
|
|
48
|
+
Intersected bool
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
var MetadataTypeTagAnalyzer func(props struct {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
Errors *[]MetadataFactory_IError
|
|
53
|
+
Type string
|
|
54
|
+
Objects []*schemametadata.MetadataObjectType
|
|
55
|
+
Explore MetadataFactory_IExplore
|
|
56
56
|
}) []schemametadata.IMetadataTypeTag
|
|
57
|
+
|
|
58
|
+
var MetadataCommentTagAnalyzer func(props struct {
|
|
59
|
+
Errors *[]MetadataFactory_IError
|
|
60
|
+
Metadata *schemametadata.MetadataSchema
|
|
61
|
+
Tags []schemametadata.IJsDocTagInfo
|
|
62
|
+
Explore MetadataFactory_IExplore
|
|
63
|
+
})
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
package metadata
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
|
-
|
|
4
|
+
"strings"
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
nativeast "github.com/microsoft/typescript-go/shim/ast"
|
|
7
|
+
nativechecker "github.com/microsoft/typescript-go/shim/checker"
|
|
8
|
+
nativescanner "github.com/microsoft/typescript-go/shim/scanner"
|
|
9
|
+
schemametadata "github.com/samchon/typia/packages/typia/native/core/schemas/metadata"
|
|
9
10
|
)
|
|
10
11
|
|
|
11
12
|
type metadataHelperNamespace struct{}
|
|
@@ -13,213 +14,245 @@ type metadataHelperNamespace struct{}
|
|
|
13
14
|
var MetadataHelper = metadataHelperNamespace{}
|
|
14
15
|
|
|
15
16
|
func (metadataHelperNamespace) Literal_to_metadata(key string) *schemametadata.MetadataSchema {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
metadata := schemametadata.MetadataSchema_initialize()
|
|
18
|
+
metadata.Constants = append(metadata.Constants, schemametadata.MetadataConstant_create(schemametadata.MetadataConstant{
|
|
19
|
+
Type: "string",
|
|
20
|
+
Values: []*schemametadata.MetadataConstantValue{
|
|
21
|
+
schemametadata.MetadataConstantValue_create(schemametadata.MetadataConstantValue{
|
|
22
|
+
Value: key,
|
|
23
|
+
Tags: [][]schemametadata.IMetadataTypeTag{},
|
|
24
|
+
}),
|
|
25
|
+
},
|
|
26
|
+
}))
|
|
27
|
+
return metadata
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
func metadata_array_util_add_bool(array *[]bool, value bool) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
for _, elem := range *array {
|
|
32
|
+
if elem == value {
|
|
33
|
+
return
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
*array = append(*array, value)
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
func metadata_type_full_name(checker *nativechecker.Checker, typ *nativechecker.Type) string {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
40
|
+
if checker == nil || typ == nil {
|
|
41
|
+
return ""
|
|
42
|
+
}
|
|
43
|
+
if typ.IsUnion() || typ.IsIntersection() {
|
|
44
|
+
joiner := " | "
|
|
45
|
+
if typ.IsIntersection() {
|
|
46
|
+
joiner = " & "
|
|
47
|
+
}
|
|
48
|
+
children := typ.Types()
|
|
49
|
+
names := make([]string, 0, len(children))
|
|
50
|
+
for _, child := range children {
|
|
51
|
+
names = append(names, metadata_type_full_name(checker, child))
|
|
52
|
+
}
|
|
53
|
+
return strings.Join(names, joiner)
|
|
54
|
+
}
|
|
55
|
+
return checker.TypeToString(typ)
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
func metadata_get_type_arguments(checker *nativechecker.Checker, typ *nativechecker.Type) (output []*nativechecker.Type) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
59
|
+
if checker == nil || typ == nil {
|
|
60
|
+
return nil
|
|
61
|
+
}
|
|
62
|
+
defer func() {
|
|
63
|
+
if recover() != nil {
|
|
64
|
+
output = nil
|
|
65
|
+
}
|
|
66
|
+
}()
|
|
67
|
+
return checker.GetTypeArguments(typ)
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
func metadata_get_function_node(typ *nativechecker.Type) *nativeast.Node {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
71
|
+
if typ == nil {
|
|
72
|
+
return nil
|
|
73
|
+
}
|
|
74
|
+
symbol := typ.Symbol()
|
|
75
|
+
if symbol == nil || len(symbol.Declarations) == 0 {
|
|
76
|
+
return nil
|
|
77
|
+
}
|
|
78
|
+
node := symbol.Declarations[0]
|
|
79
|
+
if nativeast.IsFunctionLike(node) {
|
|
80
|
+
return node
|
|
81
|
+
}
|
|
82
|
+
if nativeast.IsPropertyAssignment(node) {
|
|
83
|
+
initializer := node.AsPropertyAssignment().Initializer
|
|
84
|
+
if nativeast.IsFunctionLike(initializer) {
|
|
85
|
+
return initializer
|
|
86
|
+
}
|
|
87
|
+
return nil
|
|
88
|
+
}
|
|
89
|
+
if nativeast.IsPropertyDeclaration(node) {
|
|
90
|
+
initializer := node.AsPropertyDeclaration().Initializer
|
|
91
|
+
if nativeast.IsFunctionLike(initializer) {
|
|
92
|
+
return initializer
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return nil
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
func metadata_get_return_type_of_class_method(props struct {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
Checker *nativechecker.Checker
|
|
100
|
+
Class *nativechecker.Type
|
|
101
|
+
Function string
|
|
101
102
|
}) *nativechecker.Type {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
103
|
+
if props.Checker == nil || props.Class == nil {
|
|
104
|
+
return nil
|
|
105
|
+
}
|
|
106
|
+
symbol := props.Checker.GetPropertyOfType(props.Class, props.Function)
|
|
107
|
+
if symbol == nil || symbol.ValueDeclaration == nil {
|
|
108
|
+
return nil
|
|
109
|
+
}
|
|
110
|
+
functor := props.Checker.GetTypeOfSymbolAtLocation(symbol, symbol.ValueDeclaration)
|
|
111
|
+
signatures := props.Checker.GetSignaturesOfType(functor, nativechecker.SignatureKindCall)
|
|
112
|
+
if len(signatures) == 0 {
|
|
113
|
+
return nil
|
|
114
|
+
}
|
|
115
|
+
return props.Checker.GetReturnTypeOfSignature(signatures[0])
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
func metadata_node_js_doc_tags(symbol *nativeast.Symbol) []schemametadata.IJsDocTagInfo {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
119
|
+
output := []schemametadata.IJsDocTagInfo{}
|
|
120
|
+
for _, node := range metadata_node_declarations(symbol) {
|
|
121
|
+
for _, jsdoc := range node.JSDoc(nil) {
|
|
122
|
+
doc := jsdoc.AsJSDoc()
|
|
123
|
+
if doc == nil || doc.Tags == nil {
|
|
124
|
+
continue
|
|
125
|
+
}
|
|
126
|
+
for _, tag := range doc.Tags.Nodes {
|
|
127
|
+
if tag == nil || tag.TagName() == nil {
|
|
128
|
+
continue
|
|
129
|
+
}
|
|
130
|
+
texts := []schemametadata.IJsDocTagInfo_IText{}
|
|
131
|
+
if name := metadata_js_doc_parameter_name(tag); name != "" {
|
|
132
|
+
texts = append(texts, schemametadata.IJsDocTagInfo_IText{
|
|
133
|
+
Kind: "parameterName",
|
|
134
|
+
Text: name,
|
|
135
|
+
})
|
|
136
|
+
}
|
|
137
|
+
if text := metadata_js_doc_type_expression_text(tag); text != "" {
|
|
138
|
+
texts = append(texts, schemametadata.IJsDocTagInfo_IText{
|
|
139
|
+
Kind: "text",
|
|
140
|
+
Text: text,
|
|
141
|
+
})
|
|
142
|
+
}
|
|
143
|
+
if text := metadata_js_doc_comment_text(tag.CommentList()); text != "" {
|
|
144
|
+
texts = append(texts, schemametadata.IJsDocTagInfo_IText{
|
|
145
|
+
Kind: "text",
|
|
146
|
+
Text: text,
|
|
147
|
+
})
|
|
148
|
+
}
|
|
149
|
+
output = append(output, schemametadata.IJsDocTagInfo{
|
|
150
|
+
Name: tag.TagName().Text(),
|
|
151
|
+
Text: texts,
|
|
152
|
+
})
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return output
|
|
150
157
|
}
|
|
151
158
|
|
|
152
159
|
func metadata_node_description(symbol *nativeast.Symbol) *string {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
160
|
+
for _, node := range metadata_node_declarations(symbol) {
|
|
161
|
+
for _, jsdoc := range node.JSDoc(nil) {
|
|
162
|
+
doc := jsdoc.AsJSDoc()
|
|
163
|
+
if doc == nil {
|
|
164
|
+
continue
|
|
165
|
+
}
|
|
166
|
+
if text := metadata_js_doc_comment_text(doc.Comment); text != "" {
|
|
167
|
+
return &text
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return nil
|
|
165
172
|
}
|
|
166
173
|
|
|
167
174
|
func metadata_is_internal(symbol *nativeast.Symbol) bool {
|
|
168
|
-
|
|
175
|
+
return false
|
|
169
176
|
}
|
|
170
177
|
|
|
171
178
|
func metadata_node_declarations(symbol *nativeast.Symbol) []*nativeast.Node {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
179
|
+
if symbol == nil {
|
|
180
|
+
return nil
|
|
181
|
+
}
|
|
182
|
+
output := []*nativeast.Node{}
|
|
183
|
+
visited := map[*nativeast.Node]bool{}
|
|
184
|
+
appendNode := func(node *nativeast.Node) {
|
|
185
|
+
if node != nil && visited[node] == false {
|
|
186
|
+
visited[node] = true
|
|
187
|
+
output = append(output, node)
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
appendNode(symbol.ValueDeclaration)
|
|
191
|
+
for _, node := range symbol.Declarations {
|
|
192
|
+
appendNode(node)
|
|
193
|
+
}
|
|
194
|
+
return output
|
|
188
195
|
}
|
|
189
196
|
|
|
190
197
|
func metadata_js_doc_parameter_name(tag *nativeast.Node) string {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
198
|
+
if tag == nil {
|
|
199
|
+
return ""
|
|
200
|
+
}
|
|
201
|
+
if tag.Kind.String() != "KindJSDocParameterTag" && tag.Kind.String() != "KindJSDocPropertyTag" {
|
|
202
|
+
return ""
|
|
203
|
+
}
|
|
204
|
+
name := tag.AsJSDocParameterOrPropertyTag().Name()
|
|
205
|
+
if name == nil {
|
|
206
|
+
return ""
|
|
207
|
+
}
|
|
208
|
+
return name.Text()
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
func metadata_js_doc_type_expression_text(tag *nativeast.Node) string {
|
|
212
|
+
if tag == nil {
|
|
213
|
+
return ""
|
|
214
|
+
}
|
|
215
|
+
switch tag.Kind {
|
|
216
|
+
case nativeast.KindJSDocTypeTag,
|
|
217
|
+
nativeast.KindJSDocParameterTag,
|
|
218
|
+
nativeast.KindJSDocPropertyTag,
|
|
219
|
+
nativeast.KindJSDocReturnTag,
|
|
220
|
+
nativeast.KindJSDocTypedefTag,
|
|
221
|
+
nativeast.KindJSDocSatisfiesTag,
|
|
222
|
+
nativeast.KindJSDocThrowsTag:
|
|
223
|
+
default:
|
|
224
|
+
return ""
|
|
225
|
+
}
|
|
226
|
+
expr := tag.TypeExpression()
|
|
227
|
+
if expr == nil {
|
|
228
|
+
return ""
|
|
229
|
+
}
|
|
230
|
+
typ := expr.Type()
|
|
231
|
+
if typ == nil {
|
|
232
|
+
return ""
|
|
233
|
+
}
|
|
234
|
+
return metadata_clean_js_doc_text(nativescanner.GetTextOfNode(typ))
|
|
202
235
|
}
|
|
203
236
|
|
|
204
237
|
func metadata_js_doc_comment_text(list *nativeast.NodeList) string {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
238
|
+
if list == nil {
|
|
239
|
+
return ""
|
|
240
|
+
}
|
|
241
|
+
parts := []string{}
|
|
242
|
+
for _, node := range list.Nodes {
|
|
243
|
+
if node != nil {
|
|
244
|
+
parts = append(parts, node.Text())
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return metadata_clean_js_doc_text(strings.Join(parts, ""))
|
|
215
248
|
}
|
|
216
249
|
|
|
217
250
|
func metadata_clean_js_doc_text(text string) string {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
251
|
+
text = strings.ReplaceAll(text, "\r\n", "\n")
|
|
252
|
+
text = strings.ReplaceAll(text, "\r", "\n")
|
|
253
|
+
lines := strings.Split(text, "\n")
|
|
254
|
+
for i, line := range lines {
|
|
255
|
+
lines[i] = strings.TrimRight(line, " \t")
|
|
256
|
+
}
|
|
257
|
+
return strings.TrimSpace(strings.Join(lines, "\n"))
|
|
225
258
|
}
|
|
@@ -3,18 +3,32 @@ package metadata
|
|
|
3
3
|
import schemametadata "github.com/samchon/typia/packages/typia/native/core/schemas/metadata"
|
|
4
4
|
|
|
5
5
|
func Iterate_metadata_comment_tags(props struct {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
Errors *[]MetadataFactory_IError
|
|
7
|
+
Object *schemametadata.MetadataObjectType
|
|
8
8
|
}) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
if props.Object == nil || props.Object.Tagged_ == true || MetadataCommentTagAnalyzer == nil {
|
|
10
|
+
return
|
|
11
|
+
}
|
|
12
|
+
props.Object.Tagged_ = true
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
for _, property := range props.Object.Properties {
|
|
15
|
+
if property == nil || property.Value == nil || len(property.JsDocTags) == 0 {
|
|
16
|
+
continue
|
|
17
|
+
}
|
|
18
|
+
MetadataCommentTagAnalyzer(struct {
|
|
19
|
+
Errors *[]MetadataFactory_IError
|
|
20
|
+
Metadata *schemametadata.MetadataSchema
|
|
21
|
+
Tags []schemametadata.IJsDocTagInfo
|
|
22
|
+
Explore MetadataFactory_IExplore
|
|
23
|
+
}{
|
|
24
|
+
Errors: props.Errors,
|
|
25
|
+
Metadata: property.Value,
|
|
26
|
+
Tags: property.JsDocTags,
|
|
27
|
+
Explore: MetadataFactory_IExplore{
|
|
28
|
+
Top: false,
|
|
29
|
+
Object: props.Object,
|
|
30
|
+
Property: property,
|
|
31
|
+
},
|
|
32
|
+
})
|
|
33
|
+
}
|
|
20
34
|
}
|
package/native/go.work
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
go 1.26
|
|
2
|
+
|
|
3
|
+
use (
|
|
4
|
+
.
|
|
5
|
+
../../../../ttsc/packages/ttsc
|
|
6
|
+
../../../../ttsc/packages/ttsc/shim/ast
|
|
7
|
+
../../../../ttsc/packages/ttsc/shim/bundled
|
|
8
|
+
../../../../ttsc/packages/ttsc/shim/checker
|
|
9
|
+
../../../../ttsc/packages/ttsc/shim/compiler
|
|
10
|
+
../../../../ttsc/packages/ttsc/shim/core
|
|
11
|
+
../../../../ttsc/packages/ttsc/shim/diagnosticwriter
|
|
12
|
+
../../../../ttsc/packages/ttsc/shim/parser
|
|
13
|
+
../../../../ttsc/packages/ttsc/shim/printer
|
|
14
|
+
../../../../ttsc/packages/ttsc/shim/scanner
|
|
15
|
+
../../../../ttsc/packages/ttsc/shim/tsoptions
|
|
16
|
+
../../../../ttsc/packages/ttsc/shim/tspath
|
|
17
|
+
../../../../ttsc/packages/ttsc/shim/vfs
|
|
18
|
+
../../../../ttsc/packages/ttsc/shim/vfs/cachedvfs
|
|
19
|
+
../../../../ttsc/packages/ttsc/shim/vfs/osvfs
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
replace github.com/samchon/ttsc/packages/ttsc v0.0.0 => ../../../../ttsc/packages/ttsc
|
|
@@ -29,10 +29,19 @@ type CallExpressionTransformer_TransformProps struct {
|
|
|
29
29
|
Expression *shimast.CallExpression
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
type CallExpressionTransformer_TransformKnownProps struct {
|
|
33
|
+
Context nativecontext.ITypiaContext
|
|
34
|
+
Expression *shimast.CallExpression
|
|
35
|
+
Module string
|
|
36
|
+
Method string
|
|
37
|
+
}
|
|
38
|
+
|
|
32
39
|
type callExpressionTransformerTask func(props ITransformProps) *shimast.Node
|
|
33
40
|
|
|
34
41
|
type callExpressionTransformerFunctor func() callExpressionTransformerTask
|
|
35
42
|
|
|
43
|
+
var callExpressionTransformer_functors = callExpressionTransformer_createFunctors()
|
|
44
|
+
|
|
36
45
|
func (callExpressionTransformerNamespace) Transform(props CallExpressionTransformer_TransformProps) *shimast.Node {
|
|
37
46
|
if props.Expression == nil {
|
|
38
47
|
return nil
|
|
@@ -59,8 +68,20 @@ func (callExpressionTransformerNamespace) Transform(props CallExpressionTransfor
|
|
|
59
68
|
return props.Expression.AsNode()
|
|
60
69
|
}
|
|
61
70
|
name := typ.Symbol().Name
|
|
71
|
+
return CallExpressionTransformer.TransformKnown(CallExpressionTransformer_TransformKnownProps{
|
|
72
|
+
Context: props.Context,
|
|
73
|
+
Expression: props.Expression,
|
|
74
|
+
Module: module,
|
|
75
|
+
Method: name,
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
func (callExpressionTransformerNamespace) TransformKnown(props CallExpressionTransformer_TransformKnownProps) *shimast.Node {
|
|
80
|
+
if props.Expression == nil {
|
|
81
|
+
return nil
|
|
82
|
+
}
|
|
62
83
|
functors := callExpressionTransformer_FUNCTORS()
|
|
63
|
-
functor, ok := functors[
|
|
84
|
+
functor, ok := functors[props.Module][props.Method]
|
|
64
85
|
if ok == false {
|
|
65
86
|
return props.Expression.AsNode()
|
|
66
87
|
}
|
|
@@ -101,6 +122,10 @@ func callExpressionTransformer_sourceFile(node *shimast.Node) *shimast.SourceFil
|
|
|
101
122
|
}
|
|
102
123
|
|
|
103
124
|
func callExpressionTransformer_FUNCTORS() map[string]map[string]callExpressionTransformerFunctor {
|
|
125
|
+
return callExpressionTransformer_functors
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
func callExpressionTransformer_createFunctors() map[string]map[string]callExpressionTransformerFunctor {
|
|
104
129
|
return map[string]map[string]callExpressionTransformerFunctor{
|
|
105
130
|
"module": {
|
|
106
131
|
"assert": func() callExpressionTransformerTask {
|