@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
@@ -22,16 +22,18 @@
22
22
  #include <bitset>
23
23
 
24
24
  #include "interop-types.h"
25
+ #include "memoryTracker.h"
25
26
 
26
27
  using std::string, std::cout, std::endl, std::vector;
27
28
  constexpr int AST_NODE_TYPE_LIMIT = 256;
29
+ constexpr int MAX_ALLOC_SIZE = 1 << 25;
28
30
 
29
31
  es2panda_Impl* es2pandaImplementation = nullptr;
30
- static thread_local StageArena currentArena;
32
+ static thread_local StageArena g_currentArena;
31
33
 
32
34
  StageArena* StageArena::Instance()
33
35
  {
34
- return &currentArena;
36
+ return &g_currentArena;
35
37
  }
36
38
 
37
39
  void StageArena::Add(void* pointer)
@@ -72,6 +74,9 @@ char* StageArena::Strdup(const char* string)
72
74
 
73
75
  void* StageArena::Alloc(size_t size)
74
76
  {
77
+ if (size > MAX_ALLOC_SIZE) {
78
+ INTEROP_FATAL("Cannot allocate memory");
79
+ }
75
80
  void* result = malloc(size);
76
81
  if (!result) {
77
82
  INTEROP_FATAL("Cannot allocate memory");
@@ -98,8 +103,12 @@ void* StageArena::Alloc(size_t size)
98
103
  #endif
99
104
 
100
105
  #define LIB_PREFIX "lib"
106
+ #ifdef KOALA_MACOS
107
+ #define LIB_SUFFIX ".dylib"
108
+ #else
101
109
  #define LIB_SUFFIX ".so"
102
110
  #endif
111
+ #endif
103
112
 
104
113
  const char* DEFAULT_SDK_PATH = "../../../incremental/tools/panda/node_modules/@panda/sdk";
105
114
 
@@ -203,13 +212,11 @@ es2panda_Impl* GetImplSlow()
203
212
  }
204
213
  auto library = FindLibrary();
205
214
  if (!library) {
206
- printf("No library (es2panda_lib.cc)");
207
- abort();
215
+ INTEROP_FATAL("No library (common.cpp): %s and %s", LIB_ES2PANDA_PUBLIC, LIB_ES2PANDA_PUBLIC_ALT);
208
216
  }
209
217
  auto symbol = findSymbol(library, "es2panda_GetImpl");
210
218
  if (!symbol) {
211
- printf("no entry point");
212
- abort();
219
+ INTEROP_FATAL("no entry point: es2panda_GetImpl");
213
220
  }
214
221
  es2pandaImplementation = reinterpret_cast<es2panda_Impl* (*)(int)>(symbol)(ES2PANDA_LIB_VERSION);
215
222
  return es2pandaImplementation;
@@ -241,61 +248,6 @@ void impl_DestroyConfig(KNativePointer config)
241
248
  }
242
249
  KOALA_INTEROP_V1(DestroyConfig, KNativePointer)
243
250
 
244
- // ─── Helpers to lower function size/complexity ────────────────────────────────
245
- namespace {
246
- template <class T, class U>
247
- inline T As(U v) { return reinterpret_cast<T>(v); }
248
-
249
- struct CallExprArgs {
250
- es2panda_Context* context;
251
- es2panda_AstNode* node;
252
- es2panda_AstNode* callee;
253
- es2panda_AstNode** arguments;
254
- KInt argumentsLen;
255
- es2panda_AstNode* typeParams;
256
- bool optional;
257
- bool trailingComma;
258
- };
259
-
260
- inline KNativePointer DoUpdateCallExpression(const CallExprArgs& a)
261
- {
262
- auto nn = GetImpl()->CreateCallExpression(
263
- a.context, a.callee, a.arguments, a.argumentsLen, a.typeParams, a.optional, a.trailingComma);
264
- GetImpl()->AstNodeSetOriginalNode(a.context, nn, a.node);
265
- return nn;
266
- }
267
- } // namespace
268
-
269
- KNativePointer impl_UpdateCallExpression(KNativePointer contextPtr, KNativePointer nodePtr, KNativePointer calleePtr,
270
- KNativePointerArray argumentsPtr, KInt argumentsLen, KNativePointer typeParamsPtr, KBoolean optionalT,
271
- KBoolean trailingCommaT)
272
- {
273
- const CallExprArgs a{
274
- As<es2panda_Context*>(contextPtr),
275
- As<es2panda_AstNode*>(nodePtr),
276
- As<es2panda_AstNode*>(calleePtr),
277
- As<es2panda_AstNode**>(argumentsPtr),
278
- argumentsLen,
279
- As<es2panda_AstNode*>(typeParamsPtr),
280
- static_cast<bool>(optionalT),
281
- static_cast<bool>(trailingCommaT),
282
- };
283
- return DoUpdateCallExpression(a);
284
- }
285
- KOALA_INTEROP_8(UpdateCallExpression, KNativePointer, KNativePointer, KNativePointer, KNativePointer,
286
- KNativePointerArray, KInt, KNativePointer, KBoolean, KBoolean)
287
-
288
- KInt impl_IdentifierIdentifierFlags(KNativePointer contextPtr, KNativePointer nodePtr)
289
- {
290
- auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
291
- auto node = reinterpret_cast<es2panda_AstNode*>(nodePtr);
292
-
293
- return (GetImpl()->IdentifierIsOptionalConst(context, node) ? (1 << 0) : 0) |
294
- (GetImpl()->IdentifierIsReferenceConst(context, node) ? (1 << 1) : 0) |
295
- (GetImpl()->IdentifierIsTdzConst(context, node) ? (1 << 2) : 0);
296
- }
297
- KOALA_INTEROP_2(IdentifierIdentifierFlags, KInt, KNativePointer, KNativePointer)
298
-
299
251
  void impl_ClassDefinitionSetBody(
300
252
  KNativePointer context, KNativePointer receiver, KNativePointerArray body, KUInt bodyLength)
301
253
  {
@@ -312,7 +264,7 @@ KOALA_INTEROP_V4(ClassDefinitionSetBody, KNativePointer, KNativePointer, KNative
312
264
 
313
265
  /*
314
266
  Improve: NOT FROM API (shouldn't be there)
315
- -----------------------------------------------------------------------------------------------------------------------------
267
+ ------------------------------------------------------------------------------------------------------------------------
316
268
  */
317
269
 
318
270
  es2panda_AstNode* cachedParentNode;
@@ -376,6 +328,23 @@ void impl_AstNodeOnUpdate(KNativePointer context, KNativePointer newNode, KNativ
376
328
  }
377
329
  KOALA_INTEROP_V3(AstNodeOnUpdate, KNativePointer, KNativePointer, KNativePointer)
378
330
 
331
+ KNativePointer impl_JumpFromETSTypeReferenceToTSTypeAliasDeclarationTypeAnnotation(
332
+ KNativePointer context, KNativePointer etsTypeReference
333
+ ) {
334
+ auto _context = reinterpret_cast<es2panda_Context*>(context);
335
+ auto _node = reinterpret_cast<es2panda_AstNode*>(etsTypeReference);
336
+ auto _name = GetImpl()->ETSTypeReferencePartName(_context,
337
+ GetImpl()->ETSTypeReferencePart(_context, _node)
338
+ );
339
+ auto _decl = GetImpl()->DeclarationFromIdentifier(_context, _name);
340
+ if (_decl && GetImpl()->IsTSTypeAliasDeclaration(_decl)) {
341
+ return GetImpl()->TSTypeAliasDeclarationTypeAnnotationConst(_context, _decl);
342
+ }
343
+ return nullptr;
344
+ }
345
+ KOALA_INTEROP_2(JumpFromETSTypeReferenceToTSTypeAliasDeclarationTypeAnnotation,
346
+ KNativePointer, KNativePointer, KNativePointer)
347
+
379
348
  static thread_local std::vector<es2panda_AstNode*> cachedChildren;
380
349
 
381
350
  static void visitChild(es2panda_AstNode* node)
@@ -464,6 +433,8 @@ struct Pattern {
464
433
  return value == "struct";
465
434
  case Es2pandaAstNodeType::AST_NODE_TYPE_CALL_EXPRESSION:
466
435
  return value == "call";
436
+ case Es2pandaAstNodeType::AST_NODE_TYPE_ETS_IMPORT_DECLARATION:
437
+ return value == "import";
467
438
  case Es2pandaAstNodeType::AST_NODE_TYPE_ASSIGNMENT_EXPRESSION:
468
439
  return value == "assignment";
469
440
  default:
@@ -639,24 +610,12 @@ KNativePointer impl_FilterNodes3(KNativePointer context, KNativePointer node, KI
639
610
  KOALA_INTEROP_4(FilterNodes3, KNativePointer, KNativePointer, KNativePointer, KInt*, KInt)
640
611
 
641
612
  /*
642
- -----------------------------------------------------------------------------------------------------------------------------
613
+ ------------------------------------------------------------------------------------------------------------------------
643
614
  */
644
615
 
645
616
  // From koala-wrapper
646
617
  // Improve: check if some code should be generated
647
618
 
648
- void impl_MemInitialize()
649
- {
650
- GetImpl()->MemInitialize();
651
- }
652
- KOALA_INTEROP_V0(MemInitialize)
653
-
654
- void impl_MemFinalize()
655
- {
656
- GetImpl()->MemFinalize();
657
- }
658
- KOALA_INTEROP_V0(MemFinalize)
659
-
660
619
  static bool isUIHeaderFile(es2panda_Context* context, es2panda_Program* program)
661
620
  {
662
621
  auto result = GetImpl()->ProgramFileNameWithExtensionConst(context, program);
@@ -702,6 +661,257 @@ KNativePointer impl_AstNodeProgram(KNativePointer contextPtr, KNativePointer ins
702
661
  if (GetImpl()->AstNodeIsProgramConst(_context, _receiver)) {
703
662
  return GetImpl()->ETSModuleProgram(_context, _receiver);
704
663
  }
705
- return impl_AstNodeProgram(_context, GetImpl()->AstNodeParent(_context, _receiver));
664
+ auto parent = GetImpl()->AstNodeParent(_context, _receiver);
665
+ if (parent == nullptr) {
666
+ return nullptr;
667
+ }
668
+ return impl_AstNodeProgram(_context, parent);
706
669
  }
707
670
  KOALA_INTEROP_2(AstNodeProgram, KNativePointer, KNativePointer, KNativePointer)
671
+
672
+ // This api could be generated (as combination of 2 briges) after namespace util is generated
673
+ KInt impl_GetCompilationMode(KNativePointer configPtr)
674
+ {
675
+ auto _config = reinterpret_cast<es2panda_Config*>(configPtr);
676
+ auto _options = const_cast<es2panda_Options*>(GetImpl()->ConfigGetOptions(_config));
677
+ return GetImpl()->OptionsUtilGetCompilationModeConst(nullptr, _options);
678
+ }
679
+ KOALA_INTEROP_1(GetCompilationMode, KInt, KNativePointer)
680
+
681
+ KNativePointer impl_CreateTypeNodeFromTsType(KNativePointer context, KNativePointer nodePtr)
682
+ {
683
+ const auto _context = reinterpret_cast<es2panda_Context*>(context);
684
+ const auto _nodePtr = reinterpret_cast<es2panda_AstNode*>(nodePtr);
685
+ auto _tsType = GetImpl()->TypedTsType(_context, _nodePtr);
686
+ if (_tsType == nullptr) {
687
+ _tsType = GetImpl()->ExpressionTsType(_context, _nodePtr);
688
+ }
689
+ if (_tsType == nullptr) {
690
+ return nullptr;
691
+ }
692
+ const auto _nodeTsType = reinterpret_cast<es2panda_Type*>(_tsType);
693
+ auto _typeAnnotation = GetImpl()->CreateOpaqueTypeNode(_context, _nodeTsType);
694
+ return _typeAnnotation;
695
+ }
696
+ KOALA_INTEROP_2(CreateTypeNodeFromTsType, KNativePointer, KNativePointer, KNativePointer)
697
+
698
+ MemoryTracker tracker;
699
+ void impl_MemoryTrackerReset(KNativePointer context)
700
+ {
701
+ tracker.Reset();
702
+ }
703
+ KOALA_INTEROP_V1(MemoryTrackerReset, KNativePointer);
704
+
705
+ void impl_MemoryTrackerGetDelta(KNativePointer context)
706
+ {
707
+ tracker.Report(tracker.GetDelta());
708
+ }
709
+ KOALA_INTEROP_V1(MemoryTrackerGetDelta, KNativePointer);
710
+
711
+ void impl_MemoryTrackerPrintCurrent(KNativePointer context)
712
+ {
713
+ tracker.Report(GetMemoryStats());
714
+ }
715
+ KOALA_INTEROP_V1(MemoryTrackerPrintCurrent, KNativePointer);
716
+
717
+ static KNativePointer findPropertyInClassDefinition(KNativePointer context, KNativePointer classInstance, char *keyName)
718
+ {
719
+ const auto _context = reinterpret_cast<es2panda_Context*>(context);
720
+ const auto _instance = reinterpret_cast<es2panda_AstNode*>(classInstance);
721
+ std::size_t bodySize = 0;
722
+ const auto _body = GetImpl()->ClassDefinitionBody(_context, _instance, &bodySize);
723
+ if (_body == nullptr) {
724
+ return nullptr;
725
+ }
726
+ const auto _bodyInstance = reinterpret_cast<es2panda_AstNode**>(_body);
727
+ for (std::size_t i = 0; i < bodySize; i++) {
728
+ const auto _member = reinterpret_cast<es2panda_AstNode*>(_bodyInstance[i]);
729
+ const auto _key = reinterpret_cast<es2panda_AstNode*>(GetImpl()->ClassElementKey(_context, _member));
730
+ if (strcmp(GetImpl()->IdentifierName(_context, _key), keyName) == 0) {
731
+ return _member;
732
+ }
733
+ }
734
+ return nullptr;
735
+ }
736
+
737
+ static KNativePointer findPropertyInTSInterfaceDeclaration(
738
+ KNativePointer context, KNativePointer classInstance, char *keyName)
739
+ {
740
+ const auto _context = reinterpret_cast<es2panda_Context*>(context);
741
+ const auto _instance = reinterpret_cast<es2panda_AstNode*>(classInstance);
742
+ const auto _body = GetImpl()->TSInterfaceDeclarationBody(_context, _instance);
743
+ if (_body == nullptr) {
744
+ return nullptr;
745
+ }
746
+ const auto _bodyInstance = reinterpret_cast<es2panda_AstNode*>(_body);
747
+ std::size_t bodySize = 0;
748
+ const auto _bodyBody = GetImpl()->TSInterfaceBodyBodyConst(_context, _bodyInstance, &bodySize);
749
+ if (_bodyBody == nullptr) {
750
+ return nullptr;
751
+ }
752
+ const auto _bodyBodyInstance = reinterpret_cast<es2panda_AstNode**>(_bodyBody);
753
+ for (std::size_t i = 0; i < bodySize; i++) {
754
+ const auto _member = reinterpret_cast<es2panda_AstNode*>(_bodyBodyInstance[i]);
755
+ const auto _key = reinterpret_cast<es2panda_AstNode*>(GetImpl()->ClassElementKey(_context, _member));
756
+ if (strcmp(GetImpl()->IdentifierName(_context, _key), keyName) == 0) {
757
+ return _member;
758
+ }
759
+ }
760
+ return nullptr;
761
+ }
762
+
763
+ KNativePointer impl_ClassVariableDeclaration(KNativePointer context, KNativePointer classInstance);
764
+
765
+ KNativePointer impl_DeclarationFromProperty(KNativePointer context, KNativePointer property)
766
+ {
767
+ const auto _context = reinterpret_cast<es2panda_Context*>(context);
768
+ const auto _property = reinterpret_cast<es2panda_AstNode*>(property);
769
+ auto _key = GetImpl()->PropertyKey(_context, _property);
770
+ if (_key == nullptr) {
771
+ return nullptr;
772
+ }
773
+ auto _parent = GetImpl()->AstNodeParent(_context, _property);
774
+ if (_parent == nullptr) {
775
+ return nullptr;
776
+ }
777
+ const auto _parentInstance = reinterpret_cast<es2panda_AstNode*>(_parent);
778
+ auto _decl = impl_ClassVariableDeclaration(_context, _parentInstance);
779
+ if (_decl == nullptr) {
780
+ return nullptr;
781
+ }
782
+ const auto _declInstance = reinterpret_cast<es2panda_AstNode*>(_decl);
783
+ const auto _keyInstance = reinterpret_cast<es2panda_AstNode*>(_key);
784
+ auto _keyName = GetImpl()->IdentifierName(_context, _keyInstance);
785
+ if (GetImpl()->IsClassDefinition(_declInstance)) {
786
+ return findPropertyInClassDefinition(_context, _declInstance, _keyName);
787
+ }
788
+ if (GetImpl()->IsTSInterfaceDeclaration(_declInstance)) {
789
+ return findPropertyInTSInterfaceDeclaration(_context, _declInstance, _keyName);
790
+ }
791
+ return nullptr;
792
+ }
793
+ KOALA_INTEROP_2(DeclarationFromProperty, KNativePointer, KNativePointer, KNativePointer);
794
+
795
+ KNativePointer impl_DeclarationFromMemberExpression(KNativePointer context, KNativePointer nodePtr)
796
+ {
797
+ const auto _context = reinterpret_cast<es2panda_Context*>(context);
798
+ const auto _node = reinterpret_cast<es2panda_AstNode*>(nodePtr);
799
+ auto _object = GetImpl()->MemberExpressionObject(_context, _node);
800
+ auto _property = GetImpl()->MemberExpressionProperty(_context, _node);
801
+ if (_property == nullptr) {
802
+ return nullptr;
803
+ }
804
+ const auto _propertyInstance = reinterpret_cast<es2panda_AstNode*>(_property);
805
+ if (GetImpl()->IsNumberLiteral(_propertyInstance) && _object != nullptr) {
806
+ const auto _objectInstance = reinterpret_cast<es2panda_AstNode*>(_object);
807
+ if (GetImpl()->IsMemberExpression(_objectInstance)) {
808
+ return impl_DeclarationFromMemberExpression(_context, _objectInstance);
809
+ }
810
+ return GetImpl()->DeclarationFromIdentifier(_context, _objectInstance);
811
+ }
812
+ if (GetImpl()->IsMemberExpression(_propertyInstance)) {
813
+ return impl_DeclarationFromMemberExpression(_context, _propertyInstance);
814
+ }
815
+ return GetImpl()->DeclarationFromIdentifier(_context, _propertyInstance);
816
+ }
817
+ KOALA_INTEROP_2(DeclarationFromMemberExpression, KNativePointer, KNativePointer, KNativePointer);
818
+
819
+ KNativePointer impl_DeclarationFromAstNode(KNativePointer context, KNativePointer nodePtr)
820
+ {
821
+ const auto _context = reinterpret_cast<es2panda_Context*>(context);
822
+ const auto _node = reinterpret_cast<es2panda_AstNode*>(nodePtr);
823
+ if (GetImpl()->IsMemberExpression(_node)) {
824
+ return impl_DeclarationFromMemberExpression(_context, _node);
825
+ }
826
+ if (GetImpl()->IsObjectExpression(_node)) {
827
+ return impl_ClassVariableDeclaration(_context, _node);
828
+ }
829
+ if (GetImpl()->IsProperty(_node)) {
830
+ return impl_DeclarationFromProperty(_context, _node);
831
+ }
832
+ return GetImpl()->DeclarationFromIdentifier(_context, _node);
833
+ }
834
+ KOALA_INTEROP_2(DeclarationFromAstNode, KNativePointer, KNativePointer, KNativePointer);
835
+
836
+ KNativePointer impl_ClassVariableDeclaration(KNativePointer context, KNativePointer classInstance)
837
+ {
838
+ const auto _context = reinterpret_cast<es2panda_Context*>(context);
839
+ const auto _classInstance = reinterpret_cast<es2panda_AstNode*>(classInstance);
840
+ auto _typedTsType = GetImpl()->TypedTsType(_context, _classInstance);
841
+ if (_typedTsType == nullptr) {
842
+ return nullptr;
843
+ }
844
+ const auto _instanceType = reinterpret_cast<es2panda_Type*>(_typedTsType);
845
+ auto _typeVar = GetImpl()->TypeVariable(_context, _instanceType);
846
+ if (_typeVar == nullptr) {
847
+ return nullptr;
848
+ }
849
+ const auto result = reinterpret_cast<es2panda_Declaration*>(GetImpl()->VariableDeclaration(_context, _typeVar));
850
+ const auto declNode = GetImpl()->DeclNode(_context, result);
851
+ return declNode;
852
+ }
853
+ KOALA_INTEROP_2(ClassVariableDeclaration, KNativePointer, KNativePointer, KNativePointer)
854
+
855
+ thread_local KBoolean targetChildFound = false;
856
+ thread_local es2panda_AstNode *targetInnerChild = nullptr;
857
+ thread_local KInt targetAstNodeType = -1;
858
+
859
+ static void findNodeInnerChild(es2panda_AstNode *node)
860
+ {
861
+ if (targetInnerChild == node) {
862
+ targetChildFound = true;
863
+ }
864
+ }
865
+
866
+ KBoolean impl_AstNodeFindNodeInInnerChild(
867
+ KNativePointer contextPtr, KNativePointer instancePtr, KNativePointer tartgetPtr)
868
+ {
869
+ if (tartgetPtr == nullptr) {
870
+ return false;
871
+ }
872
+ auto _context = reinterpret_cast<es2panda_Context*>(contextPtr);
873
+ auto _receiver = reinterpret_cast<es2panda_AstNode*>(instancePtr);
874
+ auto _target = reinterpret_cast<es2panda_AstNode*>(tartgetPtr);
875
+ targetChildFound = false;
876
+ targetInnerChild = _target;
877
+ GetImpl()->AstNodeIterateConst(_context, _receiver, findNodeInnerChild);
878
+ return targetChildFound;
879
+ }
880
+ KOALA_INTEROP_3(AstNodeFindNodeInInnerChild, KBoolean, KNativePointer, KNativePointer, KNativePointer);
881
+
882
+ static void findInnerChild(es2panda_AstNode *node, void *arg)
883
+ {
884
+ auto *context = static_cast<es2panda_Context *>(arg);
885
+ if (targetAstNodeType == GetImpl()->AstNodeTypeConst(context, node)) {
886
+ targetInnerChild = node;
887
+ }
888
+ }
889
+
890
+ KNativePointer impl_AstNodeFindInnerChild(KNativePointer contextPtr, KNativePointer instancePtr, KInt AstNodeType)
891
+ {
892
+ auto _context = reinterpret_cast<es2panda_Context*>(contextPtr);
893
+ auto _receiver = reinterpret_cast<es2panda_AstNode*>(instancePtr);
894
+ targetAstNodeType = AstNodeType;
895
+
896
+ GetImpl()->AstNodeForEach(_receiver, findInnerChild, _context);
897
+ return targetInnerChild;
898
+ }
899
+ KOALA_INTEROP_3(AstNodeFindInnerChild, KNativePointer, KNativePointer, KNativePointer, KInt);
900
+
901
+ KNativePointer impl_AstNodeFindOuterParent(KNativePointer contextPtr, KNativePointer instancePtr, KInt AstNodeType)
902
+ {
903
+ auto _context = reinterpret_cast<es2panda_Context*>(contextPtr);
904
+ auto _receiver = reinterpret_cast<es2panda_AstNode*>(instancePtr);
905
+ if (GetImpl()->AstNodeIsProgramConst(_context, _receiver)) {
906
+ return nullptr;
907
+ }
908
+ if (AstNodeType == GetImpl()->AstNodeTypeConst(_context, _receiver)) {
909
+ return _receiver;
910
+ }
911
+ auto parent = GetImpl()->AstNodeParent(_context, _receiver);
912
+ if (parent == nullptr) {
913
+ return nullptr;
914
+ }
915
+ return impl_AstNodeFindOuterParent(_context, parent, AstNodeType);
916
+ }
917
+ KOALA_INTEROP_3(AstNodeFindOuterParent, KNativePointer, KNativePointer, KNativePointer, KInt);
@@ -16,21 +16,6 @@
16
16
  #ifndef COMMON_H
17
17
  #define COMMON_H
18
18
 
19
- /*
20
- * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
21
- * Licensed under the Apache License, Version 2.0 (the "License");
22
- * you may not use this file except in compliance with the License.
23
- * You may obtain a copy of the License at
24
- *
25
- * http://www.apache.org/licenses/LICENSE-2.0
26
- *
27
- * Unless required by applicable law or agreed to in writing, software
28
- * distributed under the License is distributed on an "AS IS" BASIS,
29
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30
- * See the License for the specific language governing permissions and
31
- * limitations under the License.
32
- */
33
-
34
19
  #include <iostream>
35
20
  #include <string>
36
21
  #include <vector>
@@ -1,12 +1,9 @@
1
1
  {
2
2
  "name": "@koalaui/libarkts",
3
- "version": "1.7.10+devel",
3
+ "version": "1.7.13+devel",
4
4
  "main": "./lib/libarkts.js",
5
5
  "typesVersions": {
6
6
  "*": {
7
- "./compat/*": [
8
- "./lib/types/wrapper-compat/index.d.ts"
9
- ],
10
7
  "*": [
11
8
  "./lib/types/src/index.d.ts"
12
9
  ]
@@ -14,7 +11,6 @@
14
11
  },
15
12
  "exports": {
16
13
  ".": "./lib/libarkts.js",
17
- "./compat": "./lib/libarkts-compat.js",
18
14
  "./plugins/*": "./lib/plugins/*.js"
19
15
  },
20
16
  "files": [
@@ -27,9 +23,9 @@
27
23
  "panda_sdk_version": "next"
28
24
  },
29
25
  "dependencies": {
30
- "@koalaui/compat": "1.7.10+devel",
31
- "@koalaui/common": "1.7.10+devel",
32
- "@koalaui/interop": "1.7.10+devel",
26
+ "@koalaui/compat": "1.7.13+devel",
27
+ "@koalaui/common": "1.7.13+devel",
28
+ "@koalaui/interop": "1.7.13+devel",
33
29
  "commander": "10.0.1"
34
30
  },
35
31
  "devDependencies": {
@@ -41,21 +37,21 @@
41
37
  "@rollup/plugin-typescript": "^11.1.6",
42
38
  "tsconfig-paths": "^4.2.0",
43
39
  "rimraf": "^6.0.1",
44
- "@koalaui/fast-arktsc": "1.7.10+devel",
45
- "@idlizer/arktscgen": "2.1.10-arktscgen-6",
40
+ "@koalaui/fast-arktsc": "1.7.13+devel",
41
+ "@idlizer/arktscgen": "2.1.10-arktscgen-9",
46
42
  "mocha": "^9.2.2",
47
- "@koalaui/harness": "1.7.10+devel",
43
+ "@koalaui/harness": "1.7.13+devel",
48
44
  "@koalaui/ets-tsc": "4.9.5-r6",
49
- "@koalaui/build-common": "1.7.10+devel",
45
+ "@koalaui/build-common": "1.7.13+devel",
50
46
  "node-addon-api": "8.0.0",
51
47
  "node-api-headers": "0.0.5"
52
48
  },
53
49
  "scripts": {
54
- "clean": "rimraf generated build native/build* ./.rollup.cache tsconfig.tsbuildinfo lib",
50
+ "clean": "rimraf generated build native/mingw_build native/build* ./.rollup.cache tsconfig.tsbuildinfo lib",
55
51
  "clean:plugins": "rimraf plugins/build",
56
52
  "compile:koala:interop": "npm run --prefix ../interop compile",
57
53
  "compile:meson": "cd native && meson setup build && meson compile -C build",
58
- "compile:meson:mingw": "cd native && meson setup --cross-file ./mingw.cross mingw_build && meson compile -C mingw_build",
54
+ "compile:meson:mingw": "cd native && meson setup --strip --cross-file ./mingw.cross mingw_build && meson install -C mingw_build",
59
55
  "crosscompile:meson": "cd native && CXX=clang++ meson setup -D cross_compile=true build && CXX=clang++ meson compile -C build",
60
56
  "copy:.node": "mkdir -p ./build/native/build && cp ./native/build/es2panda_*.node ./build/native/build",
61
57
  "compile:native": "npm run compile:koala:interop && npm run compile:meson && npm run copy:.node",
@@ -78,7 +74,7 @@
78
74
  "compile:playground": "cd playground && meson setup build && meson compile -C build",
79
75
  "run:playground": "npm run compile:playground && mkdir -p build && ./playground/build/playground _ --extension ets --stdlib ../incremental/tools/panda/node_modules/@panda/sdk/ets/stdlib --output build/playground.abc ./playground/src/main.ets",
80
76
  "panda:sdk:clean": "cd ../incremental/tools/panda && rimraf node_modules",
81
- "panda:sdk:install": "cd ../incremental/tools/panda && echo \"Installing panda sdk $npm_package_config_panda_sdk_version\" && PANDA_SDK_VERSION=$npm_package_config_panda_sdk_version npm run panda:sdk:install",
77
+ "panda:sdk:install": "cd ../incremental/tools/panda && echo \"Installing panda sdk $npm_package_config_panda_sdk_version\" && PANDA_SDK_VERSION=${PANDA_SDK_VERSION:-$npm_package_config_panda_sdk_version} npm run panda:sdk:install",
82
78
  "panda:sdk:reinstall": "npm run panda:sdk:clean && npm run panda:sdk:install",
83
79
  "regenerate:current": "rimraf -rf ./generated && npm run compile -C ../../arktscgen && node ../../arktscgen --panda-sdk-path $npm_package_config_panda_sdk_path --output-dir ../ --options-file ./generator/options.json5 --no-initialize --debug",
84
80
  "regenerate": "rimraf -rf ./generated && arktscgen --panda-sdk-path ${PANDA_SDK_PATH:=$npm_package_config_panda_sdk_path} --output-dir ../ --options-file ./generator/options.json5 --no-initialize",
@@ -87,4 +83,4 @@
87
83
  "format:generated:ts": "npx prettier --config .prettierrc --write \"./generated/**/*.ts\"",
88
84
  "format:ts": "npm run format:src:ts && npm run format:generated:ts"
89
85
  }
90
- }
86
+ }