@idlizer/arktscgen 2.1.10-arktscgen-7 → 2.1.10-arktscgen-10

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 (28) hide show
  1. package/build/libarkts-copy/generator/options.json5 +107 -99
  2. package/build/libarkts-copy/native/meson.build +22 -14
  3. package/build/libarkts-copy/native/mingw.cross +1 -1
  4. package/build/libarkts-copy/native/src/bridges.cpp +1 -298
  5. package/build/libarkts-copy/native/src/common.cpp +286 -76
  6. package/build/libarkts-copy/native/src/common.h +0 -15
  7. package/build/libarkts-copy/package.json +12 -16
  8. package/build/libarkts-copy/src/Es2pandaNativeModule.ts +28 -61
  9. package/build/libarkts-copy/src/arkts-api/index.ts +0 -1
  10. package/build/libarkts-copy/src/arkts-api/node-utilities/OpaqueTypeNode.ts +1 -1
  11. package/build/libarkts-copy/src/arkts-api/peers/AstNode.ts +14 -0
  12. package/build/libarkts-copy/src/arkts-api/peers/Context.ts +25 -58
  13. package/build/libarkts-copy/src/arkts-api/peers/ExternalSource.ts +8 -13
  14. package/build/libarkts-copy/src/arkts-api/plugins.ts +3 -2
  15. package/build/libarkts-copy/src/arkts-api/static/global.ts +8 -1
  16. package/build/libarkts-copy/src/arkts-api/utilities/extensions.ts +9 -12
  17. package/build/libarkts-copy/src/arkts-api/utilities/performance.ts +99 -9
  18. package/build/libarkts-copy/src/arkts-api/utilities/private.ts +3 -0
  19. package/build/libarkts-copy/src/arkts-api/utilities/public.ts +68 -148
  20. package/build/libarkts-copy/src/arkts-api/visitor.ts +17 -3
  21. package/build/libarkts-copy/src/index.ts +0 -1
  22. package/build/libarkts-copy/src/plugin-utils.ts +2 -1
  23. package/build/libarkts-copy/src/reexport-for-generated.ts +2 -1
  24. package/build/libarkts-copy/src/utils.ts +4 -0
  25. package/lib/index.js +4599 -4366
  26. package/package.json +3 -4
  27. package/templates/Es2pandaNativeModule.ts +1 -0
  28. package/templates/peer.ts +1 -0
@@ -26,9 +26,9 @@
26
26
  "es2panda_Config",
27
27
  "es2panda_Context",
28
28
  "es2panda_GlobalContext",
29
+ "es2panda_ExternalSource",
29
30
  ],
30
31
  "full": [
31
- "es2panda_ExternalSource",
32
32
  "es2panda_OverloadInfo",
33
33
 
34
34
  'NodeTransformer',
@@ -41,8 +41,14 @@
41
41
  'PropertyProcessor',
42
42
  'PropertyTraverser',
43
43
 
44
- 'checker.*',
45
- 'varbinder.*',
44
+ 'checker.ETSFunctionType', // conflict with ir
45
+ 'checker.ETSUnionType',
46
+ 'checker.ETSNullType',
47
+ 'checker.ETSUndefinedType',
48
+ 'checker.TypeParameter', // invalid args for a bridge
49
+
50
+ // ETSParser has no classInstance(receiver) argument,
51
+ // may be fixed in generator.
46
52
  'parser.*',
47
53
  'util.*',
48
54
  'gen.*',
@@ -51,21 +57,47 @@
51
57
 
52
58
  'parser.Program!',
53
59
  'es2panda.ArkTsConfig!',
54
- // Do not support node type
55
- //'varbinder.FunctionDecl!',
56
- //'varbinder.InterfaceDecl!',
57
- // MemberExpression has checker.ETSFunctionType ExtensionAccessorTypeConst(es2panda_Context context);
58
- //'checker.ETSFunctionType!',
59
- //'ir.ETSFunctionType',
60
60
 
61
- 'ir.Annotated',
62
- 'ir.AnnotationAllowed',
61
+ "varbinder.EnumVariable", // use typedef to union
62
+ "varbinder.ETSBinder", // char**
63
+ "varbinder.AnnotationUsage", // duplicate bridge
64
+ // These classes are descendants of AstNode
65
+ // and has a astTypeNode hint parameter in ctor
66
+ // because they are in another namespace (classes
67
+ // that have descendants do not have this parameter).
68
+ // Changing this behaviour in generator may cause regression.
69
+ "varbinder.InterfaceDecl",
70
+ "varbinder.FunctionDecl",
71
+ "varbinder.RecordTable",
72
+
73
+ // C api needs AstNode descendant but it isn't.
74
+ // TypedAstNode is.
63
75
  'ir.Typed',
76
+ // These are empty.
77
+ 'ir.Annotated',
64
78
  'ir.VectorIterationGuard',
65
79
 
66
80
  'VoidPtr',
67
81
  ],
68
82
  "partial": [
83
+ {
84
+ interface: "TypeNode",
85
+ methods: [
86
+ "GetType", // overlap base
87
+ ]
88
+ },
89
+ {
90
+ interface: "Scope",
91
+ methods: [
92
+ "MergeBindings", // char**
93
+ ]
94
+ },
95
+ {
96
+ interface: "ModuleScope",
97
+ methods: [
98
+ "LocalExportsConst" // char**
99
+ ]
100
+ },
69
101
  {
70
102
  interface: "es2panda_Impl",
71
103
  methods: [
@@ -74,34 +106,23 @@
74
106
 
75
107
  // Handwritten bridges
76
108
  "ConfigGetOptions", // handwritten class
77
- "ExternalSourceName", // handwritten class and used in panda API
78
109
  "SourcePositionCol", // not in idl
79
- "ExternalSourcePrograms", // Wrong args
80
- "LogDiagnostic", // not in idl
81
- "CreateDiagnosticKind",
110
+ "CreateDiagnosticKind", // no const suffix in idl
82
111
  "GetSemanticErrors",
83
112
  "GetSyntaxErrors",
84
113
  "GetPluginErrors",
85
114
  "GetWarnings",
86
115
  "NumberLiteralStrConst",
87
- "MemInitialize",
88
- "MemFinalize",
89
116
  ],
90
117
  },
91
118
  {
92
119
  interface: "MethodDefinition",
93
120
  methods: [
94
- "GetOverloadInfo", // return type is wrong
121
+ "GetOverloadInfo", // returns es2panda_OverloadInfo which is data class
95
122
  ]
96
123
  },
97
124
  {
98
- interface: "Decl", // handwritten bridge
99
- methods: [
100
- "Node"
101
- ]
102
- },
103
- {
104
- interface: "ETSParser", // handwritten bridge
125
+ interface: "ETSParser", // handwritten bridge, fully ignored above.
105
126
  methods: [
106
127
  "BuildImportDeclaration",
107
128
  "CreateExpression",
@@ -109,37 +130,6 @@
109
130
  "GetImportPathManager",
110
131
  ]
111
132
  },
112
- {
113
- interface: "Program", // handwritten bridge
114
- methods: [
115
- "DirectExternalSources",
116
- "ExternalSources",
117
- ]
118
- },
119
- {
120
- interface: "Scope", // handwritten bridge
121
- methods: [
122
- "SetParent",
123
- ]
124
- },
125
- {
126
- interface: "Signature", // handwritten bridge
127
- methods: [
128
- "Function",
129
- ]
130
- },
131
- {
132
- interface: "TSInterfaceBody", // handwritten bridge
133
- methods: [
134
- "BodyPtr",
135
- ]
136
- },
137
- {
138
- interface: "AnnotationDeclaration",
139
- methods: [
140
- "PropertiesPtrConst" // interfaces create-to-param matching
141
- ]
142
- },
143
133
  {
144
134
  interface: "NumberLiteral",
145
135
  methods: [
@@ -149,33 +139,16 @@
149
139
  "SetFloat"
150
140
  ]
151
141
  },
152
- {
153
- interface: "AnnotationUsage",
154
- methods: [
155
- "PropertiesPtrConst" // interfaces create-to-param matching
156
- ]
157
- },
158
- {
159
- interface: "TSInterfaceBody",
160
- methods: [
161
- "BodyPtr" // interfaces create-to-param matching
162
- ]
163
- },
164
- {
165
- interface: "Signature",
166
- methods: [
167
- "ProtectionFlagConst" // u8
168
- ]
169
- },
170
142
  {
171
143
  interface: "ETSReExportDeclaration",
172
144
  methods: [
173
- "Create", // sequence<String>
174
- "Update", // sequence<String>
175
- "GetUserPathsConst" // sequence<String>
145
+ "Create", // char**
146
+ "Update", // char**
147
+ "GetUserPathsConst" // returns sequence<String>
176
148
  ]
177
149
  },
178
150
  {
151
+ // Unclear why it's ignored
179
152
  interface: "CharLiteral",
180
153
  methods: [
181
154
  "Create1", // KShort,
@@ -183,47 +156,79 @@
183
156
  "CharConst", // KShort
184
157
  ]
185
158
  },
186
- {
187
- interface: "ForUpdateStatement",
188
- methods: [
189
- "Update" // forbidden naming
190
- ]
191
- },
192
- {
193
- interface: "CallExpression",
194
- methods: [
195
- "Update" // differs from handwritten
196
- ]
197
- },
198
159
  {
199
160
  interface: "TryStatement",
200
161
  methods: [
201
- "AddFinalizerInsertion" // idl missing const
202
- ]
203
- },
204
- {
205
- interface: "MemberExpression",
206
- methods: [
207
- "SetExtensionAccessorType" // ETSFunction type ambiguity
162
+ "AddFinalizerInsertion" // non-const to const return conversion
208
163
  ]
209
164
  },
210
165
  {
211
166
  interface: "ArkTsConfig",
212
167
  methods: [
213
- "EntriesConst",
214
168
  "FilesConst",
215
- "Parse",
216
169
  ]
217
170
  },
218
171
  {
219
172
  interface: "ClassDefinition",
220
173
  methods: [
221
- "SetBody", // handwritten
174
+ "SetBody", // TODO: implement in compiler some time
222
175
  ]
223
176
  },
224
177
  ]
225
178
  },
179
+ globalAliases: {
180
+ classes: [
181
+ "parser.Program",
182
+ "es2panda.ArkTsConfig",
183
+ ],
184
+ functions: [
185
+ "compiler.*",
186
+ "compiler.ProceedToState!",
187
+ "compiler.Is*!",
188
+ ]
189
+ },
226
190
  nonNullable: [
191
+ {
192
+ name: "es2panda_Impl",
193
+ methods: [
194
+ {
195
+ name: "CreateContextFromString",
196
+ types: ["returnType"],
197
+ },
198
+ {
199
+ name: "CreateContextFromFile",
200
+ types: ["returnType"],
201
+ },
202
+ {
203
+ name: "CreateCacheContextFromFile",
204
+ types: ["returnType"],
205
+ },
206
+ {
207
+ name: "CreateContextGenerateAbcForExternalSourceFiles",
208
+ types: ["returnType"],
209
+ },
210
+ {
211
+ name: "CreateContextFromStringWithHistory",
212
+ types: ["returnType"],
213
+ },
214
+ {
215
+ name: "ContextProgram",
216
+ types: ["returnType"],
217
+ },
218
+ {
219
+ name: "CreateGlobalContext",
220
+ types: ["returnType"],
221
+ },
222
+ {
223
+ name: "CreateDiagnosticInfo",
224
+ types: ["returnType"],
225
+ },
226
+ {
227
+ name: "CreateSuggestionInfo",
228
+ types: ["returnType"],
229
+ },
230
+ ],
231
+ },
227
232
  {
228
233
  name: "ArrowFunctionExpression",
229
234
  methods: [
@@ -601,6 +606,9 @@
601
606
  {
602
607
  name: "annotations",
603
608
  },
609
+ {
610
+ name: "modifierFlags",
611
+ },
604
612
  ],
605
613
  },
606
614
  ],
@@ -28,7 +28,6 @@ sources = [
28
28
  './src/bridges.cpp',
29
29
  '../generated/native/bridges.cpp',
30
30
  get_option('interop_src_dir') / 'common-interop.cpp',
31
- get_option('interop_src_dir') / 'callback-resource.cpp',
32
31
  get_option('interop_src_dir') / 'interop-logging.cpp',
33
32
  get_option('interop_src_dir') / 'napi' / 'convertors-napi.cpp',
34
33
  ]
@@ -40,19 +39,11 @@ cflags = [
40
39
  '-DKOALA_NAPI',
41
40
  ]
42
41
 
43
- if (host_machine.system() == 'windows')
44
- cflags += ['-DKOALA_WINDOWS']
45
- # apply node.exe symbol loading hook
46
- sources += [
47
- get_option('interop_src_dir') / 'napi/win-dynamic-node.cpp'
48
- ]
49
- else
50
- cflags += ['-DKOALA_LINUX']
51
- endif
42
+ ldflags = []
52
43
 
53
44
  arch = target_machine.cpu()
54
45
 
55
- oses = { 'darwin': 'macos' } # rename meson default names to convenient ones
46
+ oses = { 'darwin': 'macos', 'windows': 'win32' } # rename meson default names to convenient ones
56
47
  archs = { 'x86_64': 'x64', 'aarch64': 'arm64', 'armv7-a': 'arm32', 'wasm32': 'wasm' }
57
48
 
58
49
  os = target_machine.system()
@@ -60,8 +51,24 @@ os = oses.get(os, os)
60
51
  arch = target_machine.cpu()
61
52
  arch = archs.get(arch, arch)
62
53
 
54
+ if os == 'win32'
55
+ cflags += ['-DKOALA_WINDOWS']
56
+ # apply node.exe symbol loading hook
57
+ sources += [
58
+ get_option('interop_src_dir') / 'napi/win-dynamic-node.cpp'
59
+ ]
60
+ ldflags += ['-static']
61
+ endif
62
+
63
+ if os == 'linux'
64
+ cflags += ['-DKOALA_LINUX']
65
+ endif
66
+
67
+ if os == 'macos'
68
+ cflags += ['-DKOALA_MACOS']
69
+ endif
70
+
63
71
  cflags_cross = []
64
- cflags_host = []
65
72
  suffix_host = '_' + os + '_' + arch
66
73
  suffix_cross = ''
67
74
 
@@ -99,6 +106,7 @@ shared_library(
99
106
  'b_lundef=false',
100
107
  ],
101
108
  install: true,
109
+ install_dir: meson.current_source_dir() + '/../build/native/build',
102
110
  name_prefix: '',
103
111
  name_suffix: 'node',
104
112
  include_directories: [
@@ -111,8 +119,8 @@ shared_library(
111
119
  node_api_headers_dir / 'node-api-headers/include',
112
120
  node_addon_api_dir / 'node-addon-api',
113
121
  ],
114
- cpp_args: cflags + cflags_host,
115
- link_args: [cflags_host],
122
+ cpp_args: cflags,
123
+ link_args: ldflags,
116
124
  dependencies: []
117
125
  )
118
126
 
@@ -25,5 +25,5 @@ cpu_family = 'x86_64'
25
25
  cpu = 'x86_64'
26
26
  endian = 'little'
27
27
 
28
- [properties]
28
+ [built-in options]
29
29
  cpp_link_args = ['-lpsapi']