@idlizer/arktscgen 2.1.10-arktscgen-4 → 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 +21 -17
- 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 +38 -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 +26 -24
- 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 +52 -53
- 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 +172 -77
- package/package.json +51 -52
- package/templates/Es2pandaNativeModule.ts +1 -0
- package/templates/peer.ts +1 -0
- package/build/libarkts-copy/native/src/generated/bridges.cc +0 -16375
- package/build/libarkts-copy/src/generated/Es2pandaEnums.ts +0 -1344
- package/build/libarkts-copy/src/generated/Es2pandaNativeModule.ts +0 -5192
- package/build/libarkts-copy/src/generated/factory.ts +0 -1285
- 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 -69
- 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
|
@@ -14,12 +14,17 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
#include <common.h>
|
|
17
|
+
#include <iterator>
|
|
18
|
+
#include <regex.h>
|
|
19
|
+
#include <sstream>
|
|
17
20
|
#include <utility>
|
|
21
|
+
#include <vector>
|
|
22
|
+
|
|
18
23
|
#include "interop-types.h"
|
|
19
24
|
|
|
20
25
|
using std::string, std::cout, std::endl, std::vector;
|
|
21
26
|
|
|
22
|
-
es2panda_Impl
|
|
27
|
+
es2panda_Impl* es2pandaImplementation = nullptr;
|
|
23
28
|
static thread_local StageArena currentArena;
|
|
24
29
|
|
|
25
30
|
StageArena* StageArena::instance()
|
|
@@ -75,28 +80,28 @@ void* StageArena::alloc(size_t size)
|
|
|
75
80
|
}
|
|
76
81
|
|
|
77
82
|
#ifdef KOALA_WINDOWS
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
83
|
+
#include <windows.h>
|
|
84
|
+
#define PLUGIN_DIR "windows_host_tools"
|
|
85
|
+
#define LIB_PREFIX "lib"
|
|
86
|
+
#define LIB_SUFFIX ".dll"
|
|
82
87
|
#endif
|
|
83
88
|
|
|
84
89
|
#if defined(KOALA_LINUX) || defined(KOALA_MACOS)
|
|
85
|
-
|
|
90
|
+
#include <dlfcn.h>
|
|
86
91
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
+
#ifdef __x86_64__
|
|
93
|
+
#define PLUGIN_DIR "linux_host_tools"
|
|
94
|
+
#else
|
|
95
|
+
#define PLUGIN_DIR "linux_arm64_host_tools"
|
|
96
|
+
#endif
|
|
92
97
|
|
|
93
|
-
|
|
94
|
-
|
|
98
|
+
#define LIB_PREFIX "lib"
|
|
99
|
+
#define LIB_SUFFIX ".so"
|
|
95
100
|
#endif
|
|
96
101
|
|
|
97
|
-
const char* DEFAULT_SDK_PATH = "../../../incremental/tools/panda/node_modules/@panda/sdk"
|
|
98
|
-
const char* NAME = LIB_PREFIX "es2panda-public" LIB_SUFFIX;
|
|
102
|
+
const char* DEFAULT_SDK_PATH = "../../../incremental/tools/panda/node_modules/@panda/sdk";
|
|
99
103
|
|
|
104
|
+
const char* LIB_ES2PANDA_PUBLIC_ALT = LIB_PREFIX "es2panda-public" LIB_SUFFIX;
|
|
100
105
|
const char* LIB_ES2PANDA_PUBLIC = LIB_PREFIX "es2panda_public" LIB_SUFFIX;
|
|
101
106
|
const char* IS_UI_FLAG = "IS_UI_FLAG";
|
|
102
107
|
const char* NOT_UI_FLAG = "NOT_UI_FLAG";
|
|
@@ -104,15 +109,15 @@ const string MODULE_SUFFIX = ".d.ets";
|
|
|
104
109
|
const string ARKUI = "arkui";
|
|
105
110
|
|
|
106
111
|
#ifdef KOALA_WINDOWS
|
|
107
|
-
|
|
112
|
+
const char* SEPARATOR = "\\";
|
|
108
113
|
#else
|
|
109
|
-
|
|
114
|
+
const char* SEPARATOR = "/";
|
|
110
115
|
#endif
|
|
111
|
-
const char
|
|
116
|
+
const char* LIB_DIR = "lib";
|
|
112
117
|
|
|
113
118
|
static std::string ES2PANDA_LIB_PATH = "";
|
|
114
119
|
|
|
115
|
-
std::string joinPath(vector<string
|
|
120
|
+
std::string joinPath(vector<string>& paths)
|
|
116
121
|
{
|
|
117
122
|
std::string res;
|
|
118
123
|
for (std::size_t i = 0; i < paths.size(); ++i) {
|
|
@@ -125,20 +130,20 @@ std::string joinPath(vector<string> &paths)
|
|
|
125
130
|
return res;
|
|
126
131
|
}
|
|
127
132
|
|
|
128
|
-
void impl_SetUpSoPath(KStringPtr
|
|
133
|
+
void impl_SetUpSoPath(KStringPtr& soPath)
|
|
129
134
|
{
|
|
130
135
|
ES2PANDA_LIB_PATH = std::string(soPath.c_str());
|
|
131
136
|
}
|
|
132
137
|
KOALA_INTEROP_V1(SetUpSoPath, KStringPtr);
|
|
133
138
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
void
|
|
139
|
+
void* TryLibrary(const char* name)
|
|
140
|
+
{
|
|
141
|
+
void* res = nullptr;
|
|
137
142
|
std::vector<std::string> pathArray;
|
|
138
143
|
|
|
139
144
|
// find by SetUpSoPath
|
|
140
145
|
if (!ES2PANDA_LIB_PATH.empty()) {
|
|
141
|
-
pathArray = {ES2PANDA_LIB_PATH, LIB_DIR,
|
|
146
|
+
pathArray = {ES2PANDA_LIB_PATH, LIB_DIR, name};
|
|
142
147
|
res = loadLibrary(joinPath(pathArray));
|
|
143
148
|
if (res) {
|
|
144
149
|
return res;
|
|
@@ -148,7 +153,7 @@ void* FindLibrary() {
|
|
|
148
153
|
// find by set PANDA_SDK_PATH
|
|
149
154
|
char* envValue = getenv("PANDA_SDK_PATH");
|
|
150
155
|
if (envValue) {
|
|
151
|
-
pathArray = {envValue, PLUGIN_DIR, LIB_DIR,
|
|
156
|
+
pathArray = {envValue, PLUGIN_DIR, LIB_DIR, name};
|
|
152
157
|
res = loadLibrary(joinPath(pathArray));
|
|
153
158
|
if (res) {
|
|
154
159
|
return res;
|
|
@@ -156,14 +161,14 @@ void* FindLibrary() {
|
|
|
156
161
|
}
|
|
157
162
|
|
|
158
163
|
// find by set LD_LIBRARY_PATH
|
|
159
|
-
pathArray = {
|
|
164
|
+
pathArray = {name};
|
|
160
165
|
res = loadLibrary(joinPath(pathArray));
|
|
161
166
|
if (res) {
|
|
162
167
|
return res;
|
|
163
168
|
}
|
|
164
169
|
|
|
165
170
|
// find by DEFAULT_SDK_PATH
|
|
166
|
-
pathArray = {DEFAULT_SDK_PATH, PLUGIN_DIR, LIB_DIR,
|
|
171
|
+
pathArray = {DEFAULT_SDK_PATH, PLUGIN_DIR, LIB_DIR, name};
|
|
167
172
|
res = loadLibrary(joinPath(pathArray));
|
|
168
173
|
if (res) {
|
|
169
174
|
return res;
|
|
@@ -172,7 +177,24 @@ void* FindLibrary() {
|
|
|
172
177
|
return nullptr;
|
|
173
178
|
}
|
|
174
179
|
|
|
175
|
-
|
|
180
|
+
// TODO: @panda/sdk will be changed to match ohos-sdk
|
|
181
|
+
void* FindLibrary() {
|
|
182
|
+
void *res = nullptr;
|
|
183
|
+
|
|
184
|
+
res = TryLibrary(LIB_ES2PANDA_PUBLIC);
|
|
185
|
+
if (res) {
|
|
186
|
+
return res;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
res = TryLibrary(LIB_ES2PANDA_PUBLIC_ALT);
|
|
190
|
+
if (res) {
|
|
191
|
+
return res;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return nullptr;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
es2panda_Impl* GetImplSlow()
|
|
176
198
|
{
|
|
177
199
|
if (es2pandaImplementation) {
|
|
178
200
|
return es2pandaImplementation;
|
|
@@ -187,7 +209,7 @@ es2panda_Impl *GetImplSlow()
|
|
|
187
209
|
printf("no entry point");
|
|
188
210
|
abort();
|
|
189
211
|
}
|
|
190
|
-
es2pandaImplementation = reinterpret_cast<es2panda_Impl
|
|
212
|
+
es2pandaImplementation = reinterpret_cast<es2panda_Impl* (*)(int)>(symbol)(ES2PANDA_LIB_VERSION);
|
|
191
213
|
return es2pandaImplementation;
|
|
192
214
|
}
|
|
193
215
|
|
|
@@ -196,51 +218,42 @@ string getString(KStringPtr ptr)
|
|
|
196
218
|
return ptr.data();
|
|
197
219
|
}
|
|
198
220
|
|
|
221
|
+
const char** getStringArray(KStringArray& ptr)
|
|
222
|
+
{
|
|
223
|
+
return const_cast<const char**>(ptr.get()); // release()?
|
|
224
|
+
}
|
|
225
|
+
|
|
199
226
|
char* getStringCopy(KStringPtr& ptr)
|
|
200
227
|
{
|
|
201
228
|
return StageArena::strdup(ptr.c_str() ? ptr.c_str() : "");
|
|
202
229
|
}
|
|
203
230
|
|
|
204
|
-
KNativePointer impl_CreateConfig(KInt argc, KStringArray argvPtr)
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
const char** argv = StageArena::allocArray<const char*>(argc);
|
|
208
|
-
std::size_t position = headerLen;
|
|
209
|
-
std::size_t strLen;
|
|
210
|
-
for (std::size_t i = 0; i < static_cast<std::size_t>(argc); ++i) {
|
|
211
|
-
strLen = unpackUInt(argvPtr + position);
|
|
212
|
-
position += headerLen;
|
|
213
|
-
argv[i] = StageArena::strdup(std::string(reinterpret_cast<const char*>(argvPtr + position), strLen).c_str());
|
|
214
|
-
position += strLen;
|
|
215
|
-
}
|
|
216
|
-
return GetImpl()->CreateConfig(argc, argv);
|
|
231
|
+
KNativePointer impl_CreateConfig(KInt argc, KStringArray& argvPtr)
|
|
232
|
+
{
|
|
233
|
+
return GetImpl()->CreateConfig(argc, getStringArray(argvPtr));
|
|
217
234
|
}
|
|
218
235
|
KOALA_INTEROP_2(CreateConfig, KNativePointer, KInt, KStringArray)
|
|
219
236
|
|
|
220
|
-
KNativePointer impl_DestroyConfig(KNativePointer configPtr)
|
|
237
|
+
KNativePointer impl_DestroyConfig(KNativePointer configPtr)
|
|
238
|
+
{
|
|
221
239
|
auto config = reinterpret_cast<es2panda_Config*>(configPtr);
|
|
222
240
|
GetImpl()->DestroyConfig(config);
|
|
223
241
|
return nullptr;
|
|
224
242
|
}
|
|
225
243
|
KOALA_INTEROP_1(DestroyConfig, KNativePointer, KNativePointer)
|
|
226
244
|
|
|
227
|
-
void impl_DestroyContext(KNativePointer contextPtr)
|
|
245
|
+
void impl_DestroyContext(KNativePointer contextPtr)
|
|
246
|
+
{
|
|
228
247
|
auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
|
|
229
248
|
GetImpl()->DestroyContext(context);
|
|
230
249
|
StageArena::instance()->cleanup();
|
|
231
250
|
}
|
|
232
251
|
KOALA_INTEROP_V1(DestroyContext, KNativePointer)
|
|
233
252
|
|
|
234
|
-
KNativePointer impl_UpdateCallExpression(
|
|
235
|
-
KNativePointer
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
KNativePointerArray argumentsPtr,
|
|
239
|
-
KInt argumentsLen,
|
|
240
|
-
KNativePointer typeParamsPtr,
|
|
241
|
-
KBoolean optionalT,
|
|
242
|
-
KBoolean trailingCommaT
|
|
243
|
-
) {
|
|
253
|
+
KNativePointer impl_UpdateCallExpression(KNativePointer contextPtr, KNativePointer nodePtr, KNativePointer calleePtr,
|
|
254
|
+
KNativePointerArray argumentsPtr, KInt argumentsLen, KNativePointer typeParamsPtr, KBoolean optionalT,
|
|
255
|
+
KBoolean trailingCommaT)
|
|
256
|
+
{
|
|
244
257
|
auto node = reinterpret_cast<es2panda_AstNode*>(nodePtr);
|
|
245
258
|
auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
|
|
246
259
|
auto callee = reinterpret_cast<es2panda_AstNode*>(calleePtr);
|
|
@@ -249,26 +262,28 @@ KNativePointer impl_UpdateCallExpression(
|
|
|
249
262
|
auto optional = static_cast<bool>(optionalT);
|
|
250
263
|
auto trailingComma = static_cast<bool>(trailingCommaT);
|
|
251
264
|
|
|
252
|
-
auto nn =
|
|
253
|
-
context, callee, arguments, argumentsLen, typeParams, optional, trailingComma
|
|
254
|
-
);
|
|
265
|
+
auto nn =
|
|
266
|
+
GetImpl()->CreateCallExpression(context, callee, arguments, argumentsLen, typeParams, optional, trailingComma);
|
|
255
267
|
GetImpl()->AstNodeSetOriginalNode(context, nn, node);
|
|
256
268
|
return nn;
|
|
257
269
|
}
|
|
258
|
-
KOALA_INTEROP_8(UpdateCallExpression, KNativePointer, KNativePointer, KNativePointer, KNativePointer,
|
|
270
|
+
KOALA_INTEROP_8(UpdateCallExpression, KNativePointer, KNativePointer, KNativePointer, KNativePointer,
|
|
271
|
+
KNativePointerArray, KInt, KNativePointer, KBoolean, KBoolean)
|
|
259
272
|
|
|
260
|
-
KInt impl_IdentifierIdentifierFlags(KNativePointer contextPtr, KNativePointer nodePtr)
|
|
273
|
+
KInt impl_IdentifierIdentifierFlags(KNativePointer contextPtr, KNativePointer nodePtr)
|
|
274
|
+
{
|
|
261
275
|
auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
|
|
262
276
|
auto node = reinterpret_cast<es2panda_AstNode*>(nodePtr);
|
|
263
277
|
|
|
264
|
-
return
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
(GetImpl()->IdentifierIsTdzConst(context, node) ? (1 << 2) : 0);
|
|
278
|
+
return (GetImpl()->IdentifierIsOptionalConst(context, node) ? (1 << 0) : 0) |
|
|
279
|
+
(GetImpl()->IdentifierIsReferenceConst(context, node) ? (1 << 1) : 0) |
|
|
280
|
+
(GetImpl()->IdentifierIsTdzConst(context, node) ? (1 << 2) : 0);
|
|
268
281
|
}
|
|
269
282
|
KOALA_INTEROP_2(IdentifierIdentifierFlags, KInt, KNativePointer, KNativePointer)
|
|
270
283
|
|
|
271
|
-
void impl_ClassDefinitionSetBody(
|
|
284
|
+
void impl_ClassDefinitionSetBody(
|
|
285
|
+
KNativePointer context, KNativePointer receiver, KNativePointerArray body, KUInt bodyLength)
|
|
286
|
+
{
|
|
272
287
|
const auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
273
288
|
const auto _receiver = reinterpret_cast<es2panda_AstNode*>(receiver);
|
|
274
289
|
const auto _body = reinterpret_cast<es2panda_AstNode**>(body);
|
|
@@ -285,24 +300,25 @@ Improve: NOT FROM API (shouldn't be there)
|
|
|
285
300
|
-----------------------------------------------------------------------------------------------------------------------------
|
|
286
301
|
*/
|
|
287
302
|
|
|
288
|
-
es2panda_AstNode
|
|
289
|
-
es2panda_Context
|
|
303
|
+
es2panda_AstNode* cachedParentNode;
|
|
304
|
+
es2panda_Context* cachedContext;
|
|
290
305
|
|
|
291
|
-
static void changeParent(es2panda_AstNode
|
|
306
|
+
static void changeParent(es2panda_AstNode* child)
|
|
292
307
|
{
|
|
293
308
|
GetImpl()->AstNodeSetParent(cachedContext, child, cachedParentNode);
|
|
294
309
|
}
|
|
295
310
|
|
|
296
|
-
static void SetRightParent(es2panda_AstNode
|
|
311
|
+
static void SetRightParent(es2panda_AstNode* node, void* arg)
|
|
297
312
|
{
|
|
298
|
-
es2panda_Context
|
|
313
|
+
es2panda_Context* ctx = static_cast<es2panda_Context*>(arg);
|
|
299
314
|
cachedContext = ctx;
|
|
300
315
|
cachedParentNode = node;
|
|
301
316
|
|
|
302
317
|
GetImpl()->AstNodeIterateConst(ctx, node, changeParent);
|
|
303
318
|
}
|
|
304
319
|
|
|
305
|
-
KNativePointer impl_AstNodeUpdateAll(KNativePointer contextPtr, KNativePointer programPtr)
|
|
320
|
+
KNativePointer impl_AstNodeUpdateAll(KNativePointer contextPtr, KNativePointer programPtr)
|
|
321
|
+
{
|
|
306
322
|
auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
|
|
307
323
|
auto program = reinterpret_cast<es2panda_AstNode*>(programPtr);
|
|
308
324
|
|
|
@@ -311,7 +327,8 @@ KNativePointer impl_AstNodeUpdateAll(KNativePointer contextPtr, KNativePointer p
|
|
|
311
327
|
}
|
|
312
328
|
KOALA_INTEROP_2(AstNodeUpdateAll, KNativePointer, KNativePointer, KNativePointer)
|
|
313
329
|
|
|
314
|
-
void impl_AstNodeSetChildrenParentPtr(KNativePointer contextPtr, KNativePointer nodePtr)
|
|
330
|
+
void impl_AstNodeSetChildrenParentPtr(KNativePointer contextPtr, KNativePointer nodePtr)
|
|
331
|
+
{
|
|
315
332
|
auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
|
|
316
333
|
auto node = reinterpret_cast<es2panda_AstNode*>(nodePtr);
|
|
317
334
|
cachedParentNode = node;
|
|
@@ -320,7 +337,8 @@ void impl_AstNodeSetChildrenParentPtr(KNativePointer contextPtr, KNativePointer
|
|
|
320
337
|
}
|
|
321
338
|
KOALA_INTEROP_V2(AstNodeSetChildrenParentPtr, KNativePointer, KNativePointer)
|
|
322
339
|
|
|
323
|
-
void impl_AstNodeOnUpdate(KNativePointer context, KNativePointer newNode, KNativePointer replacedNode)
|
|
340
|
+
void impl_AstNodeOnUpdate(KNativePointer context, KNativePointer newNode, KNativePointer replacedNode)
|
|
341
|
+
{
|
|
324
342
|
auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
325
343
|
auto _newNode = reinterpret_cast<es2panda_AstNode*>(newNode);
|
|
326
344
|
auto _replacedNode = reinterpret_cast<es2panda_AstNode*>(replacedNode);
|
|
@@ -343,17 +361,15 @@ void impl_AstNodeOnUpdate(KNativePointer context, KNativePointer newNode, KNativ
|
|
|
343
361
|
}
|
|
344
362
|
KOALA_INTEROP_V3(AstNodeOnUpdate, KNativePointer, KNativePointer, KNativePointer)
|
|
345
363
|
|
|
346
|
-
std::vector<
|
|
364
|
+
static thread_local std::vector<es2panda_AstNode*> cachedChildren;
|
|
347
365
|
|
|
348
|
-
static void visitChild(es2panda_AstNode
|
|
366
|
+
static void visitChild(es2panda_AstNode* node)
|
|
349
367
|
{
|
|
350
368
|
cachedChildren.emplace_back(node);
|
|
351
369
|
}
|
|
352
370
|
|
|
353
|
-
KNativePointer impl_AstNodeChildren(
|
|
354
|
-
|
|
355
|
-
KNativePointer nodePtr
|
|
356
|
-
) {
|
|
371
|
+
KNativePointer impl_AstNodeChildren(KNativePointer contextPtr, KNativePointer nodePtr)
|
|
372
|
+
{
|
|
357
373
|
auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
|
|
358
374
|
auto node = reinterpret_cast<es2panda_AstNode*>(nodePtr);
|
|
359
375
|
cachedContext = context;
|
|
@@ -362,7 +378,132 @@ KNativePointer impl_AstNodeChildren(
|
|
|
362
378
|
GetImpl()->AstNodeIterateConst(context, node, visitChild);
|
|
363
379
|
return StageArena::clone(cachedChildren);
|
|
364
380
|
}
|
|
365
|
-
KOALA_INTEROP_2(AstNodeChildren, KNativePointer, KNativePointer, KNativePointer)
|
|
381
|
+
KOALA_INTEROP_2(AstNodeChildren, KNativePointer, KNativePointer, KNativePointer);
|
|
382
|
+
|
|
383
|
+
struct Pattern {
|
|
384
|
+
es2panda_Context* context;
|
|
385
|
+
std::string key;
|
|
386
|
+
std::string value;
|
|
387
|
+
es2panda_Impl* impl;
|
|
388
|
+
|
|
389
|
+
Pattern(es2panda_Context* context, const std::string& part) : context(context), impl(GetImpl())
|
|
390
|
+
{
|
|
391
|
+
std::istringstream stream(part);
|
|
392
|
+
std::getline(stream, key, '=');
|
|
393
|
+
std::getline(stream, value, '=');
|
|
394
|
+
}
|
|
395
|
+
bool match(es2panda_AstNode* node)
|
|
396
|
+
{
|
|
397
|
+
if (key == "type") {
|
|
398
|
+
auto type = impl->AstNodeTypeConst(context, node);
|
|
399
|
+
switch (type) {
|
|
400
|
+
case Es2pandaAstNodeType::AST_NODE_TYPE_METHOD_DEFINITION:
|
|
401
|
+
case Es2pandaAstNodeType::AST_NODE_TYPE_SCRIPT_FUNCTION:
|
|
402
|
+
|
|
403
|
+
return value == "method";
|
|
404
|
+
case Es2pandaAstNodeType::AST_NODE_TYPE_STRUCT_DECLARATION:
|
|
405
|
+
return value == "struct";
|
|
406
|
+
default:
|
|
407
|
+
return false;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
if (key == "annotation") {
|
|
411
|
+
std::size_t length = 0;
|
|
412
|
+
Es2pandaAstNodeType type = impl->AstNodeTypeConst(context, node);
|
|
413
|
+
es2panda_AstNode** result = nullptr;
|
|
414
|
+
switch (type) {
|
|
415
|
+
case Es2pandaAstNodeType::AST_NODE_TYPE_METHOD_DEFINITION: {
|
|
416
|
+
auto function = impl->MethodDefinitionFunction(context, node);
|
|
417
|
+
result = impl->FunctionDeclarationAnnotations(context, function, &length);
|
|
418
|
+
break;
|
|
419
|
+
}
|
|
420
|
+
case Es2pandaAstNodeType::AST_NODE_TYPE_FUNCTION_DECLARATION:
|
|
421
|
+
result = impl->FunctionDeclarationAnnotations(context, node, &length);
|
|
422
|
+
break;
|
|
423
|
+
case AST_NODE_TYPE_ARROW_FUNCTION_EXPRESSION: {
|
|
424
|
+
auto function = impl->ArrowFunctionExpressionFunction(context, node);
|
|
425
|
+
result = impl->FunctionDeclarationAnnotations(context, function, &length);
|
|
426
|
+
break;
|
|
427
|
+
}
|
|
428
|
+
case Es2pandaAstNodeType::AST_NODE_TYPE_CLASS_PROPERTY:
|
|
429
|
+
result = impl->ClassPropertyAnnotations(context, node, &length);
|
|
430
|
+
break;
|
|
431
|
+
default:
|
|
432
|
+
return false;
|
|
433
|
+
}
|
|
434
|
+
bool found = false;
|
|
435
|
+
for (std::size_t i = 0; i < length && result; i++) {
|
|
436
|
+
es2panda_AstNode* ident = impl->AnnotationUsageIrGetBaseNameConst(context, result[i]);
|
|
437
|
+
const char* name = impl->IdentifierNameConst(context, ident);
|
|
438
|
+
found |= matchWildcard(value, name);
|
|
439
|
+
}
|
|
440
|
+
return found;
|
|
441
|
+
}
|
|
442
|
+
return false;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
bool matchWildcard(const std::string& pattern, const char* value)
|
|
446
|
+
{
|
|
447
|
+
if (pattern.find('*') == std::string::npos) {
|
|
448
|
+
return pattern == value;
|
|
449
|
+
}
|
|
450
|
+
regex_t regex;
|
|
451
|
+
regmatch_t match[1];
|
|
452
|
+
regcomp(®ex, pattern.c_str(), REG_NEWLINE);
|
|
453
|
+
return regexec(®ex, value, 1, match, 0) != REG_NOMATCH;
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
struct Matcher {
|
|
458
|
+
es2panda_Context* context;
|
|
459
|
+
const char* query;
|
|
460
|
+
std::vector<Pattern> patterns;
|
|
461
|
+
es2panda_Impl* impl;
|
|
462
|
+
Matcher(es2panda_Context* context, const char* query) : context(context), query(query), impl(GetImpl())
|
|
463
|
+
{
|
|
464
|
+
std::istringstream stream(query);
|
|
465
|
+
std::string item;
|
|
466
|
+
while (std::getline(stream, item, ';')) {
|
|
467
|
+
patterns.emplace_back(Pattern(context, item));
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
bool match(es2panda_AstNode* node)
|
|
471
|
+
{
|
|
472
|
+
bool result = true;
|
|
473
|
+
for (auto pattern : patterns) {
|
|
474
|
+
result &= pattern.match(node);
|
|
475
|
+
}
|
|
476
|
+
return result;
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
KNativePointer impl_FilterNodes(KNativePointer context, KNativePointer node, const KStringPtr& filters)
|
|
481
|
+
{
|
|
482
|
+
auto _node = reinterpret_cast<es2panda_AstNode*>(node);
|
|
483
|
+
auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
484
|
+
const char* _filters = filters.c_str();
|
|
485
|
+
std::vector<es2panda_AstNode*> result;
|
|
486
|
+
es2panda_Impl* impl = GetImpl();
|
|
487
|
+
Matcher matcher(_context, _filters);
|
|
488
|
+
std::vector<es2panda_AstNode*> queue;
|
|
489
|
+
queue.push_back(_node);
|
|
490
|
+
while (queue.size() > 0) {
|
|
491
|
+
auto* current = queue.back();
|
|
492
|
+
queue.pop_back();
|
|
493
|
+
if (matcher.match(current)) {
|
|
494
|
+
result.push_back(current);
|
|
495
|
+
} else {
|
|
496
|
+
impl->AstNodeIterateConst(_context, current, visitChild);
|
|
497
|
+
// We want to retain match order, so add children in reverse order.
|
|
498
|
+
for (auto it = cachedChildren.rbegin(); it != cachedChildren.rend(); ++it) {
|
|
499
|
+
queue.push_back(*it);
|
|
500
|
+
}
|
|
501
|
+
cachedChildren.clear();
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
return StageArena::cloneVector(result.data(), result.size());
|
|
505
|
+
}
|
|
506
|
+
KOALA_INTEROP_3(FilterNodes, KNativePointer, KNativePointer, KNativePointer, KStringPtr)
|
|
366
507
|
|
|
367
508
|
/*
|
|
368
509
|
-----------------------------------------------------------------------------------------------------------------------------
|
|
@@ -390,9 +531,9 @@ static bool isUIHeaderFile(es2panda_Context* context, es2panda_Program* program)
|
|
|
390
531
|
result = GetImpl()->ProgramModuleNameConst(context, program);
|
|
391
532
|
string moduleName(result);
|
|
392
533
|
|
|
393
|
-
return fileNameWithExtension.length() >= MODULE_SUFFIX.length()
|
|
394
|
-
|
|
395
|
-
|
|
534
|
+
return fileNameWithExtension.length() >= MODULE_SUFFIX.length() &&
|
|
535
|
+
fileNameWithExtension.substr(fileNameWithExtension.length() - MODULE_SUFFIX.length()) == MODULE_SUFFIX &&
|
|
536
|
+
moduleName.find(ARKUI) != std::string::npos;
|
|
396
537
|
}
|
|
397
538
|
|
|
398
539
|
KBoolean impl_ProgramCanSkipPhases(KNativePointer context, KNativePointer program)
|
|
@@ -405,8 +546,8 @@ KBoolean impl_ProgramCanSkipPhases(KNativePointer context, KNativePointer progra
|
|
|
405
546
|
return false;
|
|
406
547
|
}
|
|
407
548
|
std::size_t sourceLen;
|
|
408
|
-
const auto externalSources =
|
|
409
|
-
(GetImpl()->ProgramExternalSources(_context, _program, &sourceLen));
|
|
549
|
+
const auto externalSources =
|
|
550
|
+
reinterpret_cast<es2panda_ExternalSource**>(GetImpl()->ProgramExternalSources(_context, _program, &sourceLen));
|
|
410
551
|
for (std::size_t i = 0; i < sourceLen; ++i) {
|
|
411
552
|
std::size_t programLen;
|
|
412
553
|
auto programs = GetImpl()->ExternalSourcePrograms(externalSources[i], &programLen);
|
|
@@ -31,21 +31,23 @@
|
|
|
31
31
|
* limitations under the License.
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
|
+
#include <iostream>
|
|
35
|
+
#include <string>
|
|
36
|
+
#include <vector>
|
|
37
|
+
|
|
38
|
+
#include "common-interop.h"
|
|
34
39
|
#include "dynamic-loader.h"
|
|
35
40
|
#include "es2panda_lib.h"
|
|
36
|
-
#include "common-interop.h"
|
|
37
|
-
#include "stdexcept"
|
|
38
41
|
#include "interop-utils.h"
|
|
39
|
-
#include
|
|
40
|
-
#include <iostream>
|
|
41
|
-
#include <vector>
|
|
42
|
+
#include "stdexcept"
|
|
42
43
|
|
|
43
44
|
using std::string, std::cout, std::endl, std::vector;
|
|
44
45
|
|
|
45
|
-
extern es2panda_Impl
|
|
46
|
+
extern es2panda_Impl* es2pandaImplementation;
|
|
46
47
|
|
|
47
|
-
es2panda_Impl
|
|
48
|
-
inline es2panda_Impl
|
|
48
|
+
es2panda_Impl* GetImplSlow();
|
|
49
|
+
inline es2panda_Impl* GetImpl()
|
|
50
|
+
{
|
|
49
51
|
if (es2pandaImplementation) {
|
|
50
52
|
return es2pandaImplementation;
|
|
51
53
|
}
|
|
@@ -53,6 +55,7 @@ inline es2panda_Impl *GetImpl() {
|
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
string getString(KStringPtr ptr);
|
|
58
|
+
const char** getStringArray(KStringArray& ptr);
|
|
56
59
|
|
|
57
60
|
char* getStringCopy(KStringPtr& ptr);
|
|
58
61
|
|
|
@@ -66,12 +69,8 @@ inline KUInt unpackUInt(const KByte* bytes)
|
|
|
66
69
|
const KUInt BYTE_1_SHIFT = 8;
|
|
67
70
|
const KUInt BYTE_2_SHIFT = 16;
|
|
68
71
|
const KUInt BYTE_3_SHIFT = 24;
|
|
69
|
-
return (
|
|
70
|
-
|
|
71
|
-
| (bytes[BYTE_1] << BYTE_1_SHIFT)
|
|
72
|
-
| (bytes[BYTE_2] << BYTE_2_SHIFT)
|
|
73
|
-
| (bytes[BYTE_3] << BYTE_3_SHIFT)
|
|
74
|
-
);
|
|
72
|
+
return (bytes[BYTE_0] | (bytes[BYTE_1] << BYTE_1_SHIFT) | (bytes[BYTE_2] << BYTE_2_SHIFT) |
|
|
73
|
+
(bytes[BYTE_3] << BYTE_3_SHIFT));
|
|
75
74
|
}
|
|
76
75
|
|
|
77
76
|
es2panda_ContextState intToState(KInt state);
|
|
@@ -79,32 +78,33 @@ es2panda_ContextState intToState(KInt state);
|
|
|
79
78
|
class StageArena {
|
|
80
79
|
std::vector<void*> allocated;
|
|
81
80
|
size_t totalSize;
|
|
82
|
-
|
|
81
|
+
|
|
82
|
+
public:
|
|
83
83
|
StageArena();
|
|
84
84
|
~StageArena();
|
|
85
85
|
static StageArena* instance();
|
|
86
|
-
template
|
|
86
|
+
template<typename T>
|
|
87
87
|
static T* alloc()
|
|
88
88
|
{
|
|
89
89
|
auto* arena = StageArena::instance();
|
|
90
90
|
void* memory = arena->alloc(sizeof(T));
|
|
91
91
|
return new (memory) T();
|
|
92
92
|
}
|
|
93
|
-
template
|
|
93
|
+
template<class T, class T1>
|
|
94
94
|
static T* alloc(T1 arg1)
|
|
95
95
|
{
|
|
96
96
|
auto* arena = StageArena::instance();
|
|
97
97
|
void* memory = arena->alloc(sizeof(T));
|
|
98
98
|
return new (memory) T(std::forward(arg1));
|
|
99
99
|
}
|
|
100
|
-
template
|
|
100
|
+
template<class T, class T1, class T2>
|
|
101
101
|
static T* alloc(T1 arg1, T2 arg2)
|
|
102
102
|
{
|
|
103
103
|
auto* arena = StageArena::instance();
|
|
104
104
|
void* memory = arena->alloc(sizeof(T));
|
|
105
105
|
return new (memory) T(arg1, arg2);
|
|
106
106
|
}
|
|
107
|
-
template
|
|
107
|
+
template<typename T>
|
|
108
108
|
static T* allocArray(size_t count)
|
|
109
109
|
{
|
|
110
110
|
auto* arena = StageArena::instance();
|
|
@@ -112,14 +112,14 @@ class StageArena {
|
|
|
112
112
|
void* memory = arena->alloc(sizeof(T) * count);
|
|
113
113
|
return new (memory) T();
|
|
114
114
|
}
|
|
115
|
-
template
|
|
115
|
+
template<class T>
|
|
116
116
|
static T* clone(const T& arg)
|
|
117
117
|
{
|
|
118
118
|
auto* arena = StageArena::instance();
|
|
119
119
|
void* memory = arena->alloc(sizeof(T));
|
|
120
120
|
return new (memory) T(arg);
|
|
121
121
|
}
|
|
122
|
-
template
|
|
122
|
+
template<class T>
|
|
123
123
|
static std::vector<const void*>* cloneVector(const T* arg, size_t count)
|
|
124
124
|
{
|
|
125
125
|
return alloc<std::vector<const void*>, const T*, const T*>(arg, arg + count);
|
|
@@ -130,4 +130,4 @@ class StageArena {
|
|
|
130
130
|
void cleanup();
|
|
131
131
|
};
|
|
132
132
|
|
|
133
|
-
#endif // COMMON_H
|
|
133
|
+
#endif // COMMON_H
|