@idlizer/arktscgen 2.1.10-arktscgen-3a → 2.1.10-arktscgen-5
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/build/libarkts-copy/native/meson.build +1 -1
- package/build/libarkts-copy/native/src/bridges.cc +72 -115
- package/build/libarkts-copy/native/src/common.cc +225 -84
- package/build/libarkts-copy/native/src/common.h +22 -22
- package/build/libarkts-copy/native/src/memoryTracker.cc +30 -37
- package/build/libarkts-copy/native/src/memoryTracker.h +5 -5
- package/build/libarkts-copy/package.json +23 -19
- package/build/libarkts-copy/src/Es2pandaNativeModule.ts +176 -100
- package/build/libarkts-copy/src/InteropNativeModule.ts +18 -15
- package/build/libarkts-copy/src/arkts-api/AbstractVisitor.ts +17 -18
- package/build/libarkts-copy/src/arkts-api/ImportStorage.ts +31 -30
- package/build/libarkts-copy/src/arkts-api/ProgramProvider.ts +20 -17
- package/build/libarkts-copy/src/arkts-api/class-by-peer.ts +12 -12
- package/build/libarkts-copy/src/arkts-api/factory/nodeFactory.ts +44 -29
- package/build/libarkts-copy/src/arkts-api/index.ts +24 -24
- package/build/libarkts-copy/src/arkts-api/node-cache.ts +12 -12
- package/build/libarkts-copy/src/arkts-api/node-utilities/ArkTsConfig.ts +8 -8
- package/build/libarkts-copy/src/arkts-api/node-utilities/ArrayExpression.ts +9 -21
- package/build/libarkts-copy/src/arkts-api/node-utilities/AssignmentExpression.ts +12 -14
- package/build/libarkts-copy/src/arkts-api/node-utilities/BlockStatement.ts +5 -5
- package/build/libarkts-copy/src/arkts-api/node-utilities/CallExpression.ts +47 -13
- package/build/libarkts-copy/src/arkts-api/node-utilities/ClassDefinition.ts +62 -32
- package/build/libarkts-copy/src/arkts-api/node-utilities/ClassProperty.ts +14 -13
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSFunctionType.ts +24 -21
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSImportDeclaration.ts +10 -12
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSModule.ts +14 -18
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSParameterExpression.ts +15 -16
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSStructDeclaration.ts +5 -8
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSTuple.ts +6 -12
- package/build/libarkts-copy/src/arkts-api/node-utilities/MemberExpression.ts +12 -11
- package/build/libarkts-copy/src/arkts-api/node-utilities/MethodDefinition.ts +14 -33
- package/build/libarkts-copy/src/arkts-api/node-utilities/NumberLiteral.ts +12 -23
- package/build/libarkts-copy/src/arkts-api/node-utilities/ObjectExpression.ts +17 -21
- package/build/libarkts-copy/src/arkts-api/node-utilities/OpaqueTypeNode.ts +9 -8
- package/build/libarkts-copy/src/arkts-api/node-utilities/Program.ts +21 -16
- package/build/libarkts-copy/src/arkts-api/node-utilities/ScriptFunction.ts +80 -35
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSInterfaceDeclaration.ts +22 -32
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeParameter.ts +12 -14
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeReferencePart.ts +10 -12
- package/build/libarkts-copy/src/arkts-api/node-utilities/TryStatement.ts +10 -9
- package/build/libarkts-copy/src/arkts-api/node-utilities/VariableDeclarator.ts +10 -12
- package/build/libarkts-copy/src/arkts-api/peers/ArktsObject.ts +8 -8
- package/build/libarkts-copy/src/arkts-api/peers/AstNode.ts +53 -49
- package/build/libarkts-copy/src/arkts-api/peers/Config.ts +17 -24
- package/build/libarkts-copy/src/arkts-api/peers/Context.ts +29 -37
- package/build/libarkts-copy/src/arkts-api/peers/DiagnosticKind.ts +5 -6
- package/build/libarkts-copy/src/arkts-api/peers/ExternalSource.ts +9 -9
- package/build/libarkts-copy/src/arkts-api/peers/ImportPathManager.ts +6 -8
- package/build/libarkts-copy/src/arkts-api/peers/Options.ts +8 -8
- package/build/libarkts-copy/src/arkts-api/plugins.ts +98 -30
- package/build/libarkts-copy/src/arkts-api/static/global.ts +35 -36
- package/build/libarkts-copy/src/arkts-api/static/globalUtils.ts +5 -5
- package/build/libarkts-copy/src/arkts-api/static/profiler.ts +107 -91
- package/build/libarkts-copy/src/arkts-api/utilities/extensions.ts +54 -37
- package/build/libarkts-copy/src/arkts-api/utilities/nativePtrDecoder.ts +86 -69
- package/build/libarkts-copy/src/arkts-api/utilities/performance.ts +39 -23
- package/build/libarkts-copy/src/arkts-api/utilities/private.ts +73 -61
- package/build/libarkts-copy/src/arkts-api/utilities/public.ts +220 -173
- package/build/libarkts-copy/src/arkts-api/visitor.ts +606 -742
- package/build/libarkts-copy/src/arkts-api/wrapper-compat.ts +8 -8
- package/build/libarkts-copy/src/checkSdk.ts +15 -18
- package/build/libarkts-copy/src/index.ts +29 -29
- package/build/libarkts-copy/src/plugin-utils.ts +52 -40
- package/build/libarkts-copy/src/reexport-for-generated.ts +11 -10
- package/build/libarkts-copy/src/tracer.ts +75 -69
- package/build/libarkts-copy/src/ts-api/factory/nodeFactory.ts +134 -274
- package/build/libarkts-copy/src/ts-api/factory/nodeTests.ts +23 -23
- package/build/libarkts-copy/src/ts-api/index.ts +27 -35
- package/build/libarkts-copy/src/ts-api/static/enums.ts +3 -3
- package/build/libarkts-copy/src/ts-api/types.ts +535 -395
- package/build/libarkts-copy/src/ts-api/utilities/private.ts +115 -112
- package/build/libarkts-copy/src/ts-api/utilities/public.ts +18 -18
- package/build/libarkts-copy/src/ts-api/visitor/visitor.ts +33 -49
- package/build/libarkts-copy/src/utils.ts +97 -70
- package/build/libarkts-copy/tsconfig.json +3 -2
- package/lib/index.js +428 -159
- package/package.json +51 -53
- package/templates/Es2pandaNativeModule.ts +1 -0
- package/templates/factory.ts +1 -1
- package/templates/peer.ts +2 -1
- package/build/libarkts-copy/native/src/generated/bridges.cc +0 -16382
- package/build/libarkts-copy/src/generated/Es2pandaEnums.ts +0 -1350
- package/build/libarkts-copy/src/generated/Es2pandaNativeModule.ts +0 -5195
- package/build/libarkts-copy/src/generated/factory.ts +0 -1286
- package/build/libarkts-copy/src/generated/index.ts +0 -222
- package/build/libarkts-copy/src/generated/peers/AnnotatedAstNode.ts +0 -44
- package/build/libarkts-copy/src/generated/peers/AnnotatedExpression.ts +0 -54
- package/build/libarkts-copy/src/generated/peers/AnnotatedStatement.ts +0 -45
- package/build/libarkts-copy/src/generated/peers/AnnotationDeclaration.ts +0 -165
- package/build/libarkts-copy/src/generated/peers/AnnotationUsage.ts +0 -84
- package/build/libarkts-copy/src/generated/peers/ArkTsConfig.ts +0 -73
- package/build/libarkts-copy/src/generated/peers/ArrayExpression.ts +0 -109
- package/build/libarkts-copy/src/generated/peers/ArrowFunctionExpression.ts +0 -119
- package/build/libarkts-copy/src/generated/peers/AssertStatement.ts +0 -65
- package/build/libarkts-copy/src/generated/peers/AssignmentExpression.ts +0 -111
- package/build/libarkts-copy/src/generated/peers/AstDumper.ts +0 -49
- package/build/libarkts-copy/src/generated/peers/AstVerifier.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/AstVisitor.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/AwaitExpression.ts +0 -61
- package/build/libarkts-copy/src/generated/peers/BigIntLiteral.ts +0 -61
- package/build/libarkts-copy/src/generated/peers/BinaryExpression.ts +0 -110
- package/build/libarkts-copy/src/generated/peers/BindingProps.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/BlockExpression.ts +0 -72
- package/build/libarkts-copy/src/generated/peers/BlockStatement.ts +0 -94
- package/build/libarkts-copy/src/generated/peers/BooleanLiteral.ts +0 -61
- package/build/libarkts-copy/src/generated/peers/BreakStatement.ts +0 -78
- package/build/libarkts-copy/src/generated/peers/CallExpression.ts +0 -129
- package/build/libarkts-copy/src/generated/peers/CatchClause.ts +0 -74
- package/build/libarkts-copy/src/generated/peers/ChainExpression.ts +0 -68
- package/build/libarkts-copy/src/generated/peers/CharLiteral.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/ClassDeclaration.ts +0 -76
- package/build/libarkts-copy/src/generated/peers/ClassDefinition.ts +0 -365
- package/build/libarkts-copy/src/generated/peers/ClassElement.ts +0 -76
- package/build/libarkts-copy/src/generated/peers/ClassExpression.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/ClassProperty.ts +0 -137
- package/build/libarkts-copy/src/generated/peers/ClassStaticBlock.ts +0 -66
- package/build/libarkts-copy/src/generated/peers/CodeGen.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/ConditionalExpression.ts +0 -82
- package/build/libarkts-copy/src/generated/peers/ContinueStatement.ts +0 -78
- package/build/libarkts-copy/src/generated/peers/DebuggerStatement.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/Declaration.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/Decorator.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/DiagnosticInfo.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/DirectEvalExpression.ts +0 -60
- package/build/libarkts-copy/src/generated/peers/DoWhileStatement.ts +0 -66
- package/build/libarkts-copy/src/generated/peers/DynamicImportData.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/ETSClassLiteral.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/ETSFunctionType.ts +0 -102
- package/build/libarkts-copy/src/generated/peers/ETSImportDeclaration.ts +0 -90
- package/build/libarkts-copy/src/generated/peers/ETSIntrinsicNode.ts +0 -75
- package/build/libarkts-copy/src/generated/peers/ETSKeyofType.ts +0 -61
- package/build/libarkts-copy/src/generated/peers/ETSModule.ts +0 -129
- package/build/libarkts-copy/src/generated/peers/ETSNewArrayInstanceExpression.ts +0 -75
- package/build/libarkts-copy/src/generated/peers/ETSNewClassInstanceExpression.ts +0 -79
- package/build/libarkts-copy/src/generated/peers/ETSNewMultiDimArrayInstanceExpression.ts +0 -75
- package/build/libarkts-copy/src/generated/peers/ETSNullType.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/ETSPackageDeclaration.ts +0 -59
- package/build/libarkts-copy/src/generated/peers/ETSParameterExpression.ts +0 -189
- package/build/libarkts-copy/src/generated/peers/ETSPrimitiveType.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/ETSReExportDeclaration.ts +0 -55
- package/build/libarkts-copy/src/generated/peers/ETSStringLiteralType.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/ETSStructDeclaration.ts +0 -59
- package/build/libarkts-copy/src/generated/peers/ETSTuple.ts +0 -89
- package/build/libarkts-copy/src/generated/peers/ETSTypeReference.ts +0 -66
- package/build/libarkts-copy/src/generated/peers/ETSTypeReferencePart.ts +0 -78
- package/build/libarkts-copy/src/generated/peers/ETSUndefinedType.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/ETSUnionType.ts +0 -75
- package/build/libarkts-copy/src/generated/peers/ETSWildcardType.ts +0 -63
- package/build/libarkts-copy/src/generated/peers/EmptyStatement.ts +0 -66
- package/build/libarkts-copy/src/generated/peers/ErrorLogger.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/ExportAllDeclaration.ts +0 -66
- package/build/libarkts-copy/src/generated/peers/ExportDefaultDeclaration.ts +0 -64
- package/build/libarkts-copy/src/generated/peers/ExportNamedDeclaration.ts +0 -94
- package/build/libarkts-copy/src/generated/peers/ExportSpecifier.ts +0 -82
- package/build/libarkts-copy/src/generated/peers/Expression.ts +0 -84
- package/build/libarkts-copy/src/generated/peers/ExpressionStatement.ts +0 -67
- package/build/libarkts-copy/src/generated/peers/ForInStatement.ts +0 -69
- package/build/libarkts-copy/src/generated/peers/ForOfStatement.ts +0 -72
- package/build/libarkts-copy/src/generated/peers/ForUpdateStatement.ts +0 -67
- package/build/libarkts-copy/src/generated/peers/FunctionDeclaration.ts +0 -106
- package/build/libarkts-copy/src/generated/peers/FunctionExpression.ts +0 -74
- package/build/libarkts-copy/src/generated/peers/FunctionSignature.ts +0 -70
- package/build/libarkts-copy/src/generated/peers/IRNode.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/Identifier.ts +0 -162
- package/build/libarkts-copy/src/generated/peers/IfStatement.ts +0 -78
- package/build/libarkts-copy/src/generated/peers/ImportDeclaration.ts +0 -87
- package/build/libarkts-copy/src/generated/peers/ImportDefaultSpecifier.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/ImportExpression.ts +0 -61
- package/build/libarkts-copy/src/generated/peers/ImportNamespaceSpecifier.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/ImportSource.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/ImportSpecifier.ts +0 -73
- package/build/libarkts-copy/src/generated/peers/IndexInfo.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/LabelPair.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/LabelledStatement.ts +0 -68
- package/build/libarkts-copy/src/generated/peers/Literal.ts +0 -53
- package/build/libarkts-copy/src/generated/peers/LoopStatement.ts +0 -45
- package/build/libarkts-copy/src/generated/peers/MaybeOptionalExpression.ts +0 -53
- package/build/libarkts-copy/src/generated/peers/MemberExpression.ts +0 -115
- package/build/libarkts-copy/src/generated/peers/MetaProperty.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/MethodDefinition.ts +0 -152
- package/build/libarkts-copy/src/generated/peers/NamedType.ts +0 -84
- package/build/libarkts-copy/src/generated/peers/NewExpression.ts +0 -64
- package/build/libarkts-copy/src/generated/peers/NullLiteral.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/NumberLiteral.ts +0 -78
- package/build/libarkts-copy/src/generated/peers/ObjectDescriptor.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/ObjectExpression.ts +0 -94
- package/build/libarkts-copy/src/generated/peers/OmittedExpression.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/OpaqueTypeNode.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/OverloadDeclaration.ts +0 -101
- package/build/libarkts-copy/src/generated/peers/PrefixAssertionExpression.ts +0 -65
- package/build/libarkts-copy/src/generated/peers/Program.ts +0 -206
- package/build/libarkts-copy/src/generated/peers/Property.ts +0 -92
- package/build/libarkts-copy/src/generated/peers/RegExpLiteral.ts +0 -65
- package/build/libarkts-copy/src/generated/peers/ReturnStatement.ts +0 -75
- package/build/libarkts-copy/src/generated/peers/ScopeFindResult.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/ScriptFunction.ts +0 -310
- package/build/libarkts-copy/src/generated/peers/ScriptFunctionData.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/SequenceExpression.ts +0 -61
- package/build/libarkts-copy/src/generated/peers/SignatureInfo.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/SourcePosition.ts +0 -48
- package/build/libarkts-copy/src/generated/peers/SourceRange.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/SpreadElement.ts +0 -83
- package/build/libarkts-copy/src/generated/peers/SrcDumper.ts +0 -120
- package/build/libarkts-copy/src/generated/peers/Statement.ts +0 -44
- package/build/libarkts-copy/src/generated/peers/StringLiteral.ts +0 -66
- package/build/libarkts-copy/src/generated/peers/SuggestionInfo.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/SuperExpression.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/SwitchCaseStatement.ts +0 -70
- package/build/libarkts-copy/src/generated/peers/SwitchStatement.ts +0 -71
- package/build/libarkts-copy/src/generated/peers/TSAnyKeyword.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/TSArrayType.ts +0 -61
- package/build/libarkts-copy/src/generated/peers/TSAsExpression.ts +0 -84
- package/build/libarkts-copy/src/generated/peers/TSBigintKeyword.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/TSBooleanKeyword.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/TSClassImplements.ts +0 -70
- package/build/libarkts-copy/src/generated/peers/TSConditionalType.ts +0 -71
- package/build/libarkts-copy/src/generated/peers/TSConstructorType.ts +0 -73
- package/build/libarkts-copy/src/generated/peers/TSEnumDeclaration.ts +0 -112
- package/build/libarkts-copy/src/generated/peers/TSEnumMember.ts +0 -76
- package/build/libarkts-copy/src/generated/peers/TSExternalModuleReference.ts +0 -61
- package/build/libarkts-copy/src/generated/peers/TSFunctionType.ts +0 -75
- package/build/libarkts-copy/src/generated/peers/TSImportEqualsDeclaration.ts +0 -69
- package/build/libarkts-copy/src/generated/peers/TSImportType.ts +0 -72
- package/build/libarkts-copy/src/generated/peers/TSIndexSignature.ts +0 -73
- package/build/libarkts-copy/src/generated/peers/TSIndexedAccessType.ts +0 -64
- package/build/libarkts-copy/src/generated/peers/TSInferType.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/TSInterfaceBody.ts +0 -61
- package/build/libarkts-copy/src/generated/peers/TSInterfaceDeclaration.ts +0 -160
- package/build/libarkts-copy/src/generated/peers/TSInterfaceHeritage.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/TSIntersectionType.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/TSLiteralType.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/TSMappedType.ts +0 -72
- package/build/libarkts-copy/src/generated/peers/TSMethodSignature.ts +0 -79
- package/build/libarkts-copy/src/generated/peers/TSModuleBlock.ts +0 -61
- package/build/libarkts-copy/src/generated/peers/TSModuleDeclaration.ts +0 -71
- package/build/libarkts-copy/src/generated/peers/TSNamedTupleMember.ts +0 -68
- package/build/libarkts-copy/src/generated/peers/TSNeverKeyword.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/TSNonNullExpression.ts +0 -66
- package/build/libarkts-copy/src/generated/peers/TSNullKeyword.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/TSNumberKeyword.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/TSObjectKeyword.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/TSParameterProperty.ts +0 -74
- package/build/libarkts-copy/src/generated/peers/TSParenthesizedType.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/TSPropertySignature.ts +0 -80
- package/build/libarkts-copy/src/generated/peers/TSQualifiedName.ts +0 -71
- package/build/libarkts-copy/src/generated/peers/TSSignatureDeclaration.ts +0 -75
- package/build/libarkts-copy/src/generated/peers/TSStringKeyword.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/TSThisType.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/TSTupleType.ts +0 -61
- package/build/libarkts-copy/src/generated/peers/TSTypeAliasDeclaration.ts +0 -151
- package/build/libarkts-copy/src/generated/peers/TSTypeAssertion.ts +0 -71
- package/build/libarkts-copy/src/generated/peers/TSTypeLiteral.ts +0 -61
- package/build/libarkts-copy/src/generated/peers/TSTypeOperator.ts +0 -71
- package/build/libarkts-copy/src/generated/peers/TSTypeParameter.ts +0 -121
- package/build/libarkts-copy/src/generated/peers/TSTypeParameterDeclaration.ts +0 -75
- package/build/libarkts-copy/src/generated/peers/TSTypeParameterInstantiation.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/TSTypePredicate.ts +0 -68
- package/build/libarkts-copy/src/generated/peers/TSTypeQuery.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/TSTypeReference.ts +0 -70
- package/build/libarkts-copy/src/generated/peers/TSUndefinedKeyword.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/TSUnionType.ts +0 -61
- package/build/libarkts-copy/src/generated/peers/TSUnknownKeyword.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/TSVoidKeyword.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/TaggedTemplateExpression.ts +0 -69
- package/build/libarkts-copy/src/generated/peers/TemplateElement.ts +0 -69
- package/build/libarkts-copy/src/generated/peers/TemplateLiteral.ts +0 -68
- package/build/libarkts-copy/src/generated/peers/ThisExpression.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/ThrowStatement.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/TryStatement.ts +0 -89
- package/build/libarkts-copy/src/generated/peers/TypeNode.ts +0 -81
- package/build/libarkts-copy/src/generated/peers/TypedAstNode.ts +0 -44
- package/build/libarkts-copy/src/generated/peers/TypedStatement.ts +0 -45
- package/build/libarkts-copy/src/generated/peers/TypeofExpression.ts +0 -61
- package/build/libarkts-copy/src/generated/peers/UnaryExpression.ts +0 -70
- package/build/libarkts-copy/src/generated/peers/UndefinedLiteral.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/UpdateExpression.ts +0 -68
- package/build/libarkts-copy/src/generated/peers/VReg.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/ValidationInfo.ts +0 -50
- package/build/libarkts-copy/src/generated/peers/VariableDeclaration.ts +0 -113
- package/build/libarkts-copy/src/generated/peers/VariableDeclarator.ts +0 -79
- package/build/libarkts-copy/src/generated/peers/VerificationContext.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/VerifierMessage.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/WhileStatement.ts +0 -71
- package/build/libarkts-copy/src/generated/peers/YieldExpression.ts +0 -64
|
@@ -1,69 +1,86 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
|
3
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License.
|
|
5
|
-
* You may obtain a copy of the License at
|
|
6
|
-
*
|
|
7
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
*
|
|
9
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
* See the License for the specific language governing permissions and
|
|
13
|
-
* limitations under the License.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import { int32 } from
|
|
17
|
-
import {
|
|
18
|
-
Access,
|
|
19
|
-
ArrayDecoder,
|
|
20
|
-
CallbackRegistry,
|
|
21
|
-
NativeStringBase,
|
|
22
|
-
nullptr,
|
|
23
|
-
pointer,
|
|
24
|
-
providePlatformDefinedData,
|
|
25
|
-
withByteArray
|
|
26
|
-
} from
|
|
27
|
-
import { global } from
|
|
28
|
-
|
|
29
|
-
class NativeString extends NativeStringBase {
|
|
30
|
-
constructor(ptr: pointer) {
|
|
31
|
-
super(ptr)
|
|
32
|
-
}
|
|
33
|
-
protected bytesLength(): int32 {
|
|
34
|
-
return global.interop._StringLength(this.ptr)
|
|
35
|
-
}
|
|
36
|
-
protected getData(data: Uint8Array): void {
|
|
37
|
-
withByteArray(data, Access.WRITE, (dataPtr: pointer) => {
|
|
38
|
-
global.interop._StringData(this.ptr, dataPtr, data.length)
|
|
39
|
-
})
|
|
40
|
-
}
|
|
41
|
-
close(): void {
|
|
42
|
-
global.interop._InvokeFinalizer(this.ptr, global.interop._GetStringFinalizer())
|
|
43
|
-
this.ptr = nullptr
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
providePlatformDefinedData({
|
|
48
|
-
nativeString(ptr: pointer): NativeStringBase {
|
|
49
|
-
return new NativeString(ptr)
|
|
50
|
-
},
|
|
51
|
-
nativeStringArrayDecoder(): ArrayDecoder<NativeStringBase> {
|
|
52
|
-
throw new Error(
|
|
53
|
-
},
|
|
54
|
-
callbackRegistry(): CallbackRegistry | undefined {
|
|
55
|
-
return undefined
|
|
56
|
-
}
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
export class NativePtrDecoder extends ArrayDecoder<pointer> {
|
|
60
|
-
getArraySize(blob: pointer) {
|
|
61
|
-
return global.interop._GetPtrVectorSize(blob)
|
|
62
|
-
}
|
|
63
|
-
disposeArray(blob: pointer): void {
|
|
64
|
-
// Improve:
|
|
65
|
-
}
|
|
66
|
-
getArrayElement(blob: pointer, index: int32): pointer {
|
|
67
|
-
return global.interop._GetPtrVectorElement(blob, index)
|
|
68
|
-
}
|
|
69
|
-
}
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { int32 } from '@koalaui/common';
|
|
17
|
+
import {
|
|
18
|
+
Access,
|
|
19
|
+
ArrayDecoder,
|
|
20
|
+
CallbackRegistry,
|
|
21
|
+
NativeStringBase,
|
|
22
|
+
nullptr,
|
|
23
|
+
pointer,
|
|
24
|
+
providePlatformDefinedData,
|
|
25
|
+
withByteArray,
|
|
26
|
+
} from '@koalaui/interop';
|
|
27
|
+
import { global } from '../static/global';
|
|
28
|
+
|
|
29
|
+
class NativeString extends NativeStringBase {
|
|
30
|
+
constructor(ptr: pointer) {
|
|
31
|
+
super(ptr);
|
|
32
|
+
}
|
|
33
|
+
protected bytesLength(): int32 {
|
|
34
|
+
return global.interop._StringLength(this.ptr);
|
|
35
|
+
}
|
|
36
|
+
protected getData(data: Uint8Array): void {
|
|
37
|
+
withByteArray(data, Access.WRITE, (dataPtr: pointer) => {
|
|
38
|
+
global.interop._StringData(this.ptr, dataPtr, data.length);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
close(): void {
|
|
42
|
+
global.interop._InvokeFinalizer(this.ptr, global.interop._GetStringFinalizer());
|
|
43
|
+
this.ptr = nullptr;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
providePlatformDefinedData({
|
|
48
|
+
nativeString(ptr: pointer): NativeStringBase {
|
|
49
|
+
return new NativeString(ptr);
|
|
50
|
+
},
|
|
51
|
+
nativeStringArrayDecoder(): ArrayDecoder<NativeStringBase> {
|
|
52
|
+
throw new Error('Not yet implemented');
|
|
53
|
+
},
|
|
54
|
+
callbackRegistry(): CallbackRegistry | undefined {
|
|
55
|
+
return undefined;
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export class NativePtrDecoder extends ArrayDecoder<pointer> {
|
|
60
|
+
getArraySize(blob: pointer) {
|
|
61
|
+
return global.interop._GetPtrVectorSize(blob);
|
|
62
|
+
}
|
|
63
|
+
disposeArray(blob: pointer): void {
|
|
64
|
+
// Improve:
|
|
65
|
+
}
|
|
66
|
+
getArrayElement(blob: pointer, index: int32): pointer {
|
|
67
|
+
return global.interop._GetPtrVectorElement(blob, index);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// This decoder uses a napi's external buffer and
|
|
72
|
+
// it is not efficient for small arraya(guessing, less than 10)
|
|
73
|
+
export class OptimizedNativePtrDecoder {
|
|
74
|
+
disposeArray(blob: pointer): void {
|
|
75
|
+
// Improve:
|
|
76
|
+
}
|
|
77
|
+
decode(blob: pointer): BigUint64Array {
|
|
78
|
+
return global.interop._GetPtrVector(blob);
|
|
79
|
+
}
|
|
80
|
+
decodeAndCopy(blob: pointer): Array<pointer> {
|
|
81
|
+
const data = global.interop._GetPtrVector(blob);
|
|
82
|
+
const result = Array.from(data);
|
|
83
|
+
this.disposeArray(blob);
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import * as process from 'process';
|
|
17
|
-
import { global as localGlobal} from '../static/global';
|
|
17
|
+
import { global as localGlobal } from '../static/global';
|
|
18
18
|
|
|
19
19
|
const BYTES_PER_KIBIBYTE = 1024;
|
|
20
20
|
|
|
@@ -30,11 +30,11 @@ interface MemoryContext {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
interface Event {
|
|
33
|
-
name: string
|
|
34
|
-
startTime: number
|
|
35
|
-
endTime?: number
|
|
36
|
-
parentEvent?: string
|
|
37
|
-
duration?: number
|
|
33
|
+
name: string;
|
|
34
|
+
startTime: number;
|
|
35
|
+
endTime?: number;
|
|
36
|
+
parentEvent?: string;
|
|
37
|
+
duration?: number;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
function formatTime(ms: number): string {
|
|
@@ -42,7 +42,7 @@ function formatTime(ms: number): string {
|
|
|
42
42
|
const seconds = Math.floor((ms / 1000) % 60);
|
|
43
43
|
const minutes = Math.floor((ms / (1000 * 60)) % 60);
|
|
44
44
|
const hours = Math.floor(ms / (1000 * 60 * 60));
|
|
45
|
-
|
|
45
|
+
|
|
46
46
|
return `${pad(hours, 2)}:${pad(minutes, 2)}:${pad(seconds, 2)}:${pad(milliseconds, 3)}`;
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -136,7 +136,7 @@ export class Performance {
|
|
|
136
136
|
return { name: '', startTime: 0 };
|
|
137
137
|
}
|
|
138
138
|
if (this.scopes.length === 0) {
|
|
139
|
-
throw new Error(
|
|
139
|
+
throw new Error('No last event');
|
|
140
140
|
}
|
|
141
141
|
const name: string = this.scopes.pop()!;
|
|
142
142
|
if (!this.events.has(name)) {
|
|
@@ -167,7 +167,7 @@ export class Performance {
|
|
|
167
167
|
if (this.shouldSkip) {
|
|
168
168
|
return;
|
|
169
169
|
}
|
|
170
|
-
for (let i = 0; i < this.scopes.length; i
|
|
170
|
+
for (let i = 0; i < this.scopes.length; i++) {
|
|
171
171
|
this.stopLastEvent(shouldLog);
|
|
172
172
|
}
|
|
173
173
|
this.events = new Map();
|
|
@@ -189,8 +189,8 @@ export class Performance {
|
|
|
189
189
|
function buildVisualization(parentKey: string | null, indentLevel: number): [string, number] {
|
|
190
190
|
const children = that.historyEvents.get(parentKey) || [];
|
|
191
191
|
let result = '';
|
|
192
|
-
|
|
193
|
-
children.forEach(child => {
|
|
192
|
+
|
|
193
|
+
children.forEach((child) => {
|
|
194
194
|
const indent = ' '.repeat(indentLevel);
|
|
195
195
|
const duration = child.duration ?? 0;
|
|
196
196
|
const [_result, count] = buildVisualization(child.name, indentLevel + 1);
|
|
@@ -203,10 +203,10 @@ export class Performance {
|
|
|
203
203
|
|
|
204
204
|
const [finalResult, _] = buildVisualization(null, 0);
|
|
205
205
|
if (shouldLog) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
206
|
+
console.log(`[PERFORMANCE] ===== FINAL RESULT ====`);
|
|
207
|
+
console.log(`TOTAL: ${formatTime(this.totalDuration)}(${round(this.totalDuration)})`);
|
|
208
|
+
console.log(finalResult.trimEnd());
|
|
209
|
+
console.log(`[PERFORMANCE] ===== FINAL RESULT ====`);
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
|
|
@@ -226,8 +226,8 @@ export class Performance {
|
|
|
226
226
|
heapTotal: startMemory.heapTotal / (BYTES_PER_KIBIBYTE * BYTES_PER_KIBIBYTE),
|
|
227
227
|
heapUsed: startMemory.heapUsed / (BYTES_PER_KIBIBYTE * BYTES_PER_KIBIBYTE),
|
|
228
228
|
external: startMemory.external / (BYTES_PER_KIBIBYTE * BYTES_PER_KIBIBYTE),
|
|
229
|
-
arrayBuffers: (startMemory.arrayBuffers || 0) / (BYTES_PER_KIBIBYTE * BYTES_PER_KIBIBYTE)
|
|
230
|
-
}
|
|
229
|
+
arrayBuffers: (startMemory.arrayBuffers || 0) / (BYTES_PER_KIBIBYTE * BYTES_PER_KIBIBYTE),
|
|
230
|
+
},
|
|
231
231
|
});
|
|
232
232
|
|
|
233
233
|
return;
|
|
@@ -259,7 +259,9 @@ export class Performance {
|
|
|
259
259
|
heapTotal: endMemory.heapTotal / (BYTES_PER_KIBIBYTE * BYTES_PER_KIBIBYTE) - context.startMemory.heapTotal,
|
|
260
260
|
heapUsed: endMemory.heapUsed / (BYTES_PER_KIBIBYTE * BYTES_PER_KIBIBYTE) - context.startMemory.heapUsed,
|
|
261
261
|
external: endMemory.external / (BYTES_PER_KIBIBYTE * BYTES_PER_KIBIBYTE) - context.startMemory.external,
|
|
262
|
-
arrayBuffers:
|
|
262
|
+
arrayBuffers:
|
|
263
|
+
(endMemory.arrayBuffers || 0) / (BYTES_PER_KIBIBYTE * BYTES_PER_KIBIBYTE) -
|
|
264
|
+
context.startMemory.arrayBuffers,
|
|
263
265
|
};
|
|
264
266
|
const duration = endTime - context.startTime;
|
|
265
267
|
|
|
@@ -268,12 +270,26 @@ export class Performance {
|
|
|
268
270
|
console.log('---------------------------------------------------------------');
|
|
269
271
|
console.log('[PERFORMANCE]', `内存类型 | 开始值(MB) | 结束值(MB) | 增量(MB)`);
|
|
270
272
|
console.log('---------------------------------------------------------------');
|
|
271
|
-
console.log(
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
273
|
+
console.log(
|
|
274
|
+
'[PERFORMANCE]',
|
|
275
|
+
`RSS | ${context.startMemory.rss.toFixed(2)} | ${(endMemory.rss / (BYTES_PER_KIBIBYTE * BYTES_PER_KIBIBYTE)).toFixed(2)} | ${memoryDiff.rss.toFixed(2)}`
|
|
276
|
+
);
|
|
277
|
+
console.log(
|
|
278
|
+
'[PERFORMANCE]',
|
|
279
|
+
`Heap Total | ${context.startMemory.heapTotal.toFixed(2)} | ${(endMemory.heapTotal / (BYTES_PER_KIBIBYTE * BYTES_PER_KIBIBYTE)).toFixed(2)} | ${memoryDiff.heapTotal.toFixed(2)}`
|
|
280
|
+
);
|
|
281
|
+
console.log(
|
|
282
|
+
'[PERFORMANCE]',
|
|
283
|
+
`Heap Used | ${context.startMemory.heapUsed.toFixed(2)} | ${(endMemory.heapUsed / (BYTES_PER_KIBIBYTE * BYTES_PER_KIBIBYTE)).toFixed(2)} | ${memoryDiff.heapUsed.toFixed(2)}`
|
|
284
|
+
);
|
|
285
|
+
console.log(
|
|
286
|
+
'[PERFORMANCE]',
|
|
287
|
+
`External | ${context.startMemory.external.toFixed(2)} | ${(endMemory.external / (BYTES_PER_KIBIBYTE * BYTES_PER_KIBIBYTE)).toFixed(2)} | ${memoryDiff.external.toFixed(2)}`
|
|
288
|
+
);
|
|
275
289
|
if (endMemory.arrayBuffers !== undefined) {
|
|
276
|
-
console.log(
|
|
290
|
+
console.log(
|
|
291
|
+
`Array Buffers | ${context.startMemory.arrayBuffers.toFixed(2)} | ${((endMemory.arrayBuffers || 0) / (BYTES_PER_KIBIBYTE * BYTES_PER_KIBIBYTE)).toFixed(2)} | ${memoryDiff.arrayBuffers.toFixed(2)}`
|
|
292
|
+
);
|
|
277
293
|
}
|
|
278
294
|
console.log('---------------------------------------------------------------');
|
|
279
295
|
this.memoryContexts.delete(label);
|
|
@@ -13,130 +13,142 @@
|
|
|
13
13
|
* limitations under the License.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import { global } from
|
|
17
|
-
import { isNumber, throwError } from
|
|
16
|
+
import { global } from '../static/global';
|
|
17
|
+
import { isNumber, throwError } from '../../utils';
|
|
18
|
+
import { KInt, KNativePointer as KPtr, KNativePointer, nullptr, withString, withStringArray } from '@koalaui/interop';
|
|
19
|
+
import { NativePtrDecoder } from './nativePtrDecoder';
|
|
20
|
+
//import { OptimizedNativePtrDecoder as NativePtrDecoder } from "./nativePtrDecoder"
|
|
18
21
|
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
} from
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export const arrayOfNullptr = new BigUint64Array([nullptr])
|
|
33
|
-
|
|
34
|
-
export const allFlags =
|
|
35
|
-
Object.values(Es2pandaModifierFlags)
|
|
36
|
-
.filter(isNumber)
|
|
37
|
-
.reduce(
|
|
38
|
-
(prev, next) => prev | next,
|
|
39
|
-
0
|
|
40
|
-
)
|
|
22
|
+
Es2pandaAstNodeType,
|
|
23
|
+
Es2pandaModifierFlags,
|
|
24
|
+
Es2pandaScriptFunctionFlags,
|
|
25
|
+
} from '../../../generated/Es2pandaEnums';
|
|
26
|
+
import { nodeFrom } from '../class-by-peer';
|
|
27
|
+
import { AstNode } from '../peers/AstNode';
|
|
28
|
+
import { ArktsObject } from '../peers/ArktsObject';
|
|
29
|
+
|
|
30
|
+
export const arrayOfNullptr = new BigUint64Array([nullptr]);
|
|
31
|
+
|
|
32
|
+
export const allFlags = Object.values(Es2pandaModifierFlags)
|
|
33
|
+
.filter(isNumber)
|
|
34
|
+
.reduce((prev, next) => prev | next, 0);
|
|
41
35
|
|
|
42
36
|
export function assertValidPeer(peer: KPtr, expectedKind: Es2pandaAstNodeType): void {
|
|
43
37
|
if (peer === nullptr) {
|
|
44
|
-
throwError(`invalid peer`)
|
|
38
|
+
throwError(`invalid peer`);
|
|
45
39
|
}
|
|
46
40
|
|
|
47
41
|
if (global.validatePeerTypes) {
|
|
48
|
-
const peerType = global.generatedEs2panda._AstNodeTypeConst(global.context, peer)
|
|
49
|
-
if (
|
|
42
|
+
const peerType = global.generatedEs2panda._AstNodeTypeConst(global.context, peer);
|
|
43
|
+
if (
|
|
44
|
+
peerType === Es2pandaAstNodeType.AST_NODE_TYPE_STRUCT_DECLARATION &&
|
|
45
|
+
expectedKind === Es2pandaAstNodeType.AST_NODE_TYPE_CLASS_DECLARATION
|
|
46
|
+
) {
|
|
50
47
|
// Improve: Struct is a child class of Class
|
|
51
|
-
return
|
|
48
|
+
return;
|
|
52
49
|
}
|
|
53
|
-
if (
|
|
50
|
+
if (
|
|
51
|
+
peerType === Es2pandaAstNodeType.AST_NODE_TYPE_ETS_IMPORT_DECLARATION &&
|
|
52
|
+
expectedKind === Es2pandaAstNodeType.AST_NODE_TYPE_IMPORT_DECLARATION
|
|
53
|
+
) {
|
|
54
54
|
// Improve: ETSImportDeclaration is a child of a ImportDeclaration
|
|
55
|
-
return
|
|
55
|
+
return;
|
|
56
56
|
}
|
|
57
|
-
if (
|
|
57
|
+
if (
|
|
58
|
+
peerType === Es2pandaAstNodeType.AST_NODE_TYPE_ETS_MODULE &&
|
|
59
|
+
expectedKind === Es2pandaAstNodeType.AST_NODE_TYPE_BLOCK_STATEMENT
|
|
60
|
+
) {
|
|
58
61
|
// Improve: ETSModule is a child of a BlockStatement
|
|
59
|
-
return
|
|
62
|
+
return;
|
|
60
63
|
}
|
|
61
64
|
if (peerType !== expectedKind) {
|
|
62
|
-
throwError(`expected: ${Es2pandaAstNodeType[expectedKind]}, got: ${Es2pandaAstNodeType[peerType]}`)
|
|
65
|
+
throwError(`expected: ${Es2pandaAstNodeType[expectedKind]}, got: ${Es2pandaAstNodeType[peerType]}`);
|
|
63
66
|
}
|
|
64
67
|
}
|
|
65
68
|
}
|
|
66
69
|
|
|
67
|
-
export function acceptNativeObjectArrayResult<T extends ArktsObject>(
|
|
70
|
+
export function acceptNativeObjectArrayResult<T extends ArktsObject>(
|
|
71
|
+
arrayObject: KNativePointer,
|
|
72
|
+
factory: (instance: KNativePointer) => T
|
|
73
|
+
): T[] {
|
|
74
|
+
// For OptimizedNativePtrDecoder
|
|
75
|
+
//const decoded = new NativePtrDecoder().decode(arrayObject)
|
|
76
|
+
//return decoded.reduce((prev, curr) => {
|
|
77
|
+
// prev.push(factory(curr))
|
|
78
|
+
// return prev
|
|
79
|
+
//}, [] as T[])
|
|
68
80
|
return new NativePtrDecoder().decode(arrayObject).map(factory);
|
|
69
81
|
}
|
|
70
82
|
|
|
71
83
|
export function unpackNonNullableNode<T extends AstNode>(peer: KNativePointer, typeHint?: Es2pandaAstNodeType): T {
|
|
72
84
|
if (peer === nullptr) {
|
|
73
|
-
throwError('peer is NULLPTR (maybe you should use unpackNode)')
|
|
85
|
+
throwError('peer is NULLPTR (maybe you should use unpackNode)');
|
|
74
86
|
}
|
|
75
|
-
return nodeFrom(peer, typeHint)
|
|
87
|
+
return nodeFrom(peer, typeHint);
|
|
76
88
|
}
|
|
77
89
|
|
|
78
90
|
export function unpackNode<T extends AstNode>(peer: KNativePointer, typeHint?: Es2pandaAstNodeType): T | undefined {
|
|
79
91
|
if (peer === nullptr) {
|
|
80
|
-
return undefined
|
|
92
|
+
return undefined;
|
|
81
93
|
}
|
|
82
|
-
return nodeFrom<T>(peer, typeHint)
|
|
94
|
+
return nodeFrom<T>(peer, typeHint);
|
|
83
95
|
}
|
|
84
96
|
|
|
85
97
|
export function passNode(node: ArktsObject | undefined): KNativePointer {
|
|
86
|
-
return node?.peer ?? nullptr
|
|
98
|
+
return node?.peer ?? nullptr;
|
|
87
99
|
}
|
|
88
100
|
|
|
89
101
|
export function unpackNodeArray<T extends AstNode>(nodesPtr: KNativePointer, typeHint?: Es2pandaAstNodeType): T[] {
|
|
90
102
|
if (nodesPtr === nullptr) {
|
|
91
|
-
return []
|
|
103
|
+
return [];
|
|
92
104
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
105
|
+
// For OptimizedNativePtrDecoder
|
|
106
|
+
//const decoded = new NativePtrDecoder().decode(nodesPtr)
|
|
107
|
+
//return decoded.reduce((prev, curr) => {
|
|
108
|
+
// prev.push(unpackNonNullableNode(curr, typeHint))
|
|
109
|
+
// return prev
|
|
110
|
+
//}, [] as T[])
|
|
111
|
+
return new NativePtrDecoder().decode(nodesPtr).map((peer: KNativePointer) => unpackNonNullableNode(peer, typeHint));
|
|
96
112
|
}
|
|
97
113
|
|
|
98
114
|
export function passNodeArray(nodes: readonly ArktsObject[] | undefined): BigUint64Array {
|
|
99
|
-
return new BigUint64Array(
|
|
100
|
-
nodes
|
|
101
|
-
?.filter(it => it.peer != undefined)
|
|
102
|
-
?.map(node => BigInt(node.peer))
|
|
103
|
-
?? []
|
|
104
|
-
)
|
|
115
|
+
return new BigUint64Array(nodes?.filter((it) => it.peer != undefined)?.map((node) => BigInt(node.peer)) ?? []);
|
|
105
116
|
}
|
|
106
117
|
|
|
107
118
|
export function unpackString(peer: KNativePointer): string {
|
|
108
|
-
return global.interop._RawUtf8ToString(peer)
|
|
119
|
+
return global.interop._RawUtf8ToString(peer);
|
|
109
120
|
}
|
|
110
121
|
|
|
111
122
|
// Improve: use direct string arguments instead.
|
|
112
123
|
export function passString(str: string | undefined): string {
|
|
113
|
-
return str ??
|
|
124
|
+
return str ?? '';
|
|
114
125
|
}
|
|
115
126
|
|
|
116
127
|
// Improve: use direct string arguments instead.
|
|
117
128
|
export function passStringArray(strings: readonly string[]): string[] {
|
|
118
|
-
return withStringArray(strings, (it: string[]) => it)
|
|
129
|
+
return withStringArray(strings, (it: string[]) => it);
|
|
119
130
|
}
|
|
120
131
|
|
|
121
132
|
export function passNodeWithNewModifiers<T extends AstNode>(node: T, modifiers: KInt): T {
|
|
122
|
-
return unpackNonNullableNode<T>(node.peer).updateModifiers(modifiers)
|
|
133
|
+
return unpackNonNullableNode<T>(node.peer).updateModifiers(modifiers);
|
|
123
134
|
}
|
|
124
135
|
|
|
125
136
|
export function scriptFunctionHasBody(peer: KNativePointer): boolean {
|
|
126
|
-
const flags = global.generatedEs2panda._ScriptFunctionFlagsConst(global.context, peer)
|
|
127
|
-
return (
|
|
128
|
-
|
|
137
|
+
const flags = global.generatedEs2panda._ScriptFunctionFlagsConst(global.context, peer);
|
|
138
|
+
return (
|
|
139
|
+
(flags & Es2pandaScriptFunctionFlags.SCRIPT_FUNCTION_FLAGS_EXTERNAL) === 0 &&
|
|
140
|
+
(flags & Es2pandaScriptFunctionFlags.SCRIPT_FUNCTION_FLAGS_EXTERNAL_OVERLOAD) === 0
|
|
141
|
+
);
|
|
129
142
|
}
|
|
130
143
|
|
|
131
144
|
export function updateNodeByNode<T extends ArktsObject>(node: T, original: T): T {
|
|
132
145
|
if (original.peer === nullptr) {
|
|
133
|
-
throwError('update called on NULLPTR')
|
|
146
|
+
throwError('update called on NULLPTR');
|
|
134
147
|
}
|
|
135
|
-
node.onUpdate(original)
|
|
136
|
-
return node
|
|
148
|
+
node.onUpdate(original);
|
|
149
|
+
return node;
|
|
137
150
|
}
|
|
138
151
|
|
|
139
152
|
export function nodeType(node: AstNode): Es2pandaAstNodeType {
|
|
140
|
-
return global.generatedEs2panda._AstNodeTypeConst(global.context, passNode(node))
|
|
153
|
+
return global.generatedEs2panda._AstNodeTypeConst(global.context, passNode(node));
|
|
141
154
|
}
|
|
142
|
-
|