@idlizer/arktscgen 2.1.5 → 2.1.9-arktscgen-4
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/generator/options.json5 +34 -0
- package/build/libarkts-copy/native/meson.build +128 -62
- package/build/libarkts-copy/native/meson_options.txt +19 -0
- package/build/libarkts-copy/native/src/bridges.cc +278 -15
- package/build/libarkts-copy/native/src/common.cc +212 -43
- package/build/libarkts-copy/native/src/common.h +95 -2
- package/build/libarkts-copy/native/src/generated/bridges.cc +2801 -466
- package/build/libarkts-copy/package.json +82 -62
- package/build/libarkts-copy/src/Es2pandaNativeModule.ts +97 -3
- package/build/libarkts-copy/src/InteropNativeModule.ts +3 -1
- package/build/libarkts-copy/src/arkts-api/AbstractVisitor.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/ChainExpressionFilter.ts +78 -0
- package/build/libarkts-copy/src/arkts-api/CheckedBackFilter.ts +131 -0
- package/build/libarkts-copy/src/arkts-api/CompileWithCache.ts +193 -0
- package/build/libarkts-copy/src/arkts-api/ImportStorage.ts +78 -0
- package/build/libarkts-copy/src/arkts-api/InferVoidReturnType.ts +89 -0
- package/build/libarkts-copy/src/arkts-api/ProgramProvider.ts +50 -0
- package/build/libarkts-copy/src/arkts-api/SetBaseOverloads.ts +44 -0
- package/build/libarkts-copy/src/arkts-api/class-by-peer.ts +2 -3
- package/build/libarkts-copy/src/arkts-api/factory/nodeFactory.ts +93 -10
- package/build/libarkts-copy/src/arkts-api/index.ts +13 -1
- package/build/libarkts-copy/src/arkts-api/node-cache.ts +8 -4
- package/build/libarkts-copy/src/arkts-api/node-utilities/AnnotationDeclaration.ts +32 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/AnnotationUsage.ts +37 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ArkTsConfig.ts +26 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ArrayExpression.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/BinaryExpression.ts +37 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/BlockExpression.ts +27 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/BlockStatement.ts +29 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/CallExpression.ts +2 -2
- package/build/libarkts-copy/src/arkts-api/node-utilities/ChainExpression.ts +27 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ClassDeclaration.ts +54 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ClassDefinition.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/ClassProperty.ts +27 -4
- package/build/libarkts-copy/src/arkts-api/node-utilities/ConditionalExpression.ts +36 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSFunctionType.ts +2 -2
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSImportDeclaration.ts +3 -27
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSNewClassInstanceExpression.ts +34 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSParameterExpression.ts +3 -9
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSPrimitiveType.ts +28 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSStructDeclaration.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSTuple.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSTypeReference.ts +27 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSTypeReferencePart.ts +36 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSUndefinedType.ts +24 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSUnionType.ts +27 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/Identifier.ts +27 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ImportSpecifier.ts +31 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/MemberExpression.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/MethodDefinition.ts +2 -2
- package/build/libarkts-copy/src/arkts-api/node-utilities/NullLiteral.ts +24 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/NumberLiteral.ts +2 -2
- package/build/libarkts-copy/src/arkts-api/node-utilities/ObjectExpression.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/Program.ts +40 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ReturnStatement.ts +27 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/StringLiteral.ts +27 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/SuperExpression.ts +24 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSAsExpression.ts +36 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSClassImplements.ts +31 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSInterfaceBody.ts +28 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSInterfaceDeclaration.ts +30 -10
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSNonNullExpression.ts +27 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeAliasDeclaration.ts +10 -2
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeParameter.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeParameterDeclaration.ts +31 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeParameterInstantiation.ts +30 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeReferencePart.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/TemplateLiteral.ts +35 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ThisExpression.ts +24 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/UndefinedLiteral.ts +24 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/VariableDeclaration.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/VariableDeclarator.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/peers/ArktsObject.ts +3 -1
- package/build/libarkts-copy/src/arkts-api/peers/AstNode.ts +78 -15
- package/build/libarkts-copy/src/arkts-api/peers/Config.ts +8 -1
- package/build/libarkts-copy/src/arkts-api/peers/Context.ts +72 -6
- package/build/libarkts-copy/src/arkts-api/peers/{Program.ts → ExternalSource.ts} +3 -21
- package/build/libarkts-copy/src/arkts-api/peers/Options.ts +34 -0
- package/build/libarkts-copy/src/arkts-api/plugins.ts +62 -0
- package/build/libarkts-copy/src/arkts-api/static/global.ts +9 -5
- package/build/libarkts-copy/src/arkts-api/static/profiler.ts +195 -23
- package/build/libarkts-copy/src/arkts-api/utilities/private.ts +36 -10
- package/build/libarkts-copy/src/arkts-api/utilities/public.ts +68 -20
- package/build/libarkts-copy/src/arkts-api/visitor.ts +162 -18
- package/build/libarkts-copy/src/arkts-api/wrapper-compat.ts +32 -0
- package/build/libarkts-copy/src/checkSdk.ts +25 -0
- package/build/libarkts-copy/src/generated/Es2pandaEnums.ts +448 -436
- package/build/libarkts-copy/src/generated/Es2pandaNativeModule.ts +775 -60
- package/build/libarkts-copy/src/generated/factory.ts +12 -15
- package/build/libarkts-copy/src/generated/index.ts +10 -3
- package/build/libarkts-copy/src/generated/peers/AnnotatedAstNode.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/AnnotatedExpression.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/AnnotatedStatement.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/AnnotationDeclaration.ts +58 -6
- package/build/libarkts-copy/src/generated/peers/AnnotationUsage.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ArkTsConfig.ts +75 -0
- package/build/libarkts-copy/src/generated/peers/ArrayExpression.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/ArrowFunctionExpression.ts +40 -6
- package/build/libarkts-copy/src/generated/peers/AssertStatement.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/AssignmentExpression.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/AstDumper.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/AstVerifier.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/AstVisitor.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/AwaitExpression.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/BigIntLiteral.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/BinaryExpression.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/BindingProps.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/BlockExpression.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/BlockStatement.ts +26 -7
- package/build/libarkts-copy/src/generated/peers/BooleanLiteral.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/BreakStatement.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/CallExpression.ts +20 -3
- package/build/libarkts-copy/src/generated/peers/CatchClause.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ChainExpression.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/CharLiteral.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/ClassDeclaration.ts +33 -4
- package/build/libarkts-copy/src/generated/peers/ClassDefinition.ts +128 -42
- package/build/libarkts-copy/src/generated/peers/ClassElement.ts +28 -4
- package/build/libarkts-copy/src/generated/peers/ClassExpression.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/ClassProperty.ts +39 -5
- package/build/libarkts-copy/src/generated/peers/ClassStaticBlock.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/CodeGen.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/ConditionalExpression.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/ContinueStatement.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/DebuggerStatement.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/Declaration.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/Decorator.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/{OverloadInfo.ts → DiagnosticInfo.ts} +8 -2
- package/build/libarkts-copy/src/generated/peers/DirectEvalExpression.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/DoWhileStatement.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/DynamicImportData.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/ETSClassLiteral.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ETSFunctionType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ETSImportDeclaration.ts +16 -5
- package/build/libarkts-copy/src/generated/peers/ETSKeyofType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ETSModule.ts +59 -4
- package/build/libarkts-copy/src/generated/peers/ETSNewArrayInstanceExpression.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ETSNewClassInstanceExpression.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/ETSNewMultiDimArrayInstanceExpression.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/ETSNullType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ETSPackageDeclaration.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ETSParameterExpression.ts +46 -12
- package/build/libarkts-copy/src/generated/peers/ETSPrimitiveType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ETSReExportDeclaration.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/ETSStringLiteralType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ETSStructDeclaration.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ETSTuple.ts +14 -8
- package/build/libarkts-copy/src/generated/peers/ETSTypeReference.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ETSTypeReferencePart.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/ETSUndefinedType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ETSUnionType.ts +15 -4
- package/build/libarkts-copy/src/generated/peers/ETSWildcardType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/EmptyStatement.ts +16 -4
- package/build/libarkts-copy/src/generated/peers/ErrorLogger.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/ExportAllDeclaration.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/ExportDefaultDeclaration.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/ExportNamedDeclaration.ts +18 -7
- package/build/libarkts-copy/src/generated/peers/ExportSpecifier.ts +26 -3
- package/build/libarkts-copy/src/generated/peers/Expression.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/ExpressionStatement.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/ForInStatement.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/ForOfStatement.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/ForUpdateStatement.ts +8 -2
- package/build/libarkts-copy/src/generated/peers/FunctionDecl.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/FunctionDeclaration.ts +44 -6
- package/build/libarkts-copy/src/generated/peers/FunctionExpression.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/FunctionSignature.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/IRNode.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/Identifier.ts +16 -5
- package/build/libarkts-copy/src/generated/peers/IfStatement.ts +14 -3
- package/build/libarkts-copy/src/generated/peers/ImportDeclaration.ts +28 -4
- package/build/libarkts-copy/src/generated/peers/ImportDefaultSpecifier.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/ImportExpression.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/ImportNamespaceSpecifier.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/ImportSource.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/ImportSpecifier.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/IndexInfo.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/InterfaceDecl.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/LabelPair.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/LabelledStatement.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/Literal.ts +15 -1
- package/build/libarkts-copy/src/generated/peers/LoopStatement.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/MaybeOptionalExpression.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/MemberExpression.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/MetaProperty.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/MethodDefinition.ts +26 -10
- package/build/libarkts-copy/src/generated/peers/NamedType.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/NewExpression.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/NullLiteral.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/NumberLiteral.ts +12 -6
- package/build/libarkts-copy/src/generated/peers/ObjectDescriptor.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/ObjectExpression.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/OmittedExpression.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/OpaqueTypeNode.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/PrefixAssertionExpression.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/Program.ts +194 -0
- package/build/libarkts-copy/src/generated/peers/Property.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/RegExpLiteral.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/ReturnStatement.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ScopeFindResult.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/ScriptFunction.ts +77 -10
- package/build/libarkts-copy/src/generated/peers/ScriptFunctionData.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/SequenceExpression.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/SignatureInfo.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/SourcePosition.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/SourceRange.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/SpreadElement.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/SrcDumper.ts +46 -9
- package/build/libarkts-copy/src/generated/peers/Statement.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/StringLiteral.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/{ETSDynamicFunctionType.ts → SuggestionInfo.ts} +7 -5
- package/build/libarkts-copy/src/generated/peers/SuperExpression.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/SwitchCaseStatement.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/SwitchStatement.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSAnyKeyword.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSArrayType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSAsExpression.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSBigintKeyword.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSBooleanKeyword.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSClassImplements.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/TSConditionalType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSConstructorType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSEnumDeclaration.ts +48 -6
- package/build/libarkts-copy/src/generated/peers/TSEnumMember.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/TSExternalModuleReference.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSFunctionType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSImportEqualsDeclaration.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSImportType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSIndexSignature.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSIndexedAccessType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSInferType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSInterfaceBody.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSInterfaceDeclaration.ts +78 -8
- package/build/libarkts-copy/src/generated/peers/TSInterfaceHeritage.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSIntersectionType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSLiteralType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSMappedType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSMethodSignature.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSModuleBlock.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSModuleDeclaration.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSNamedTupleMember.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSNeverKeyword.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSNonNullExpression.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSNullKeyword.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSNumberKeyword.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSObjectKeyword.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSParameterProperty.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSParenthesizedType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSPropertySignature.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSQualifiedName.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSSignatureDeclaration.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSStringKeyword.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSThisType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSTupleType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSTypeAliasDeclaration.ts +53 -6
- package/build/libarkts-copy/src/generated/peers/TSTypeAssertion.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSTypeLiteral.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSTypeOperator.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSTypeParameter.ts +41 -7
- package/build/libarkts-copy/src/generated/peers/TSTypeParameterDeclaration.ts +15 -4
- package/build/libarkts-copy/src/generated/peers/TSTypeParameterInstantiation.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSTypePredicate.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSTypeQuery.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSTypeReference.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSUndefinedKeyword.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSUnionType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSUnknownKeyword.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSVoidKeyword.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TaggedTemplateExpression.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TemplateElement.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/TemplateLiteral.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ThisExpression.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ThrowStatement.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TryStatement.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/TypeNode.ts +37 -3
- package/build/libarkts-copy/src/generated/peers/TypedAstNode.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/TypedStatement.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/TypeofExpression.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/UnaryExpression.ts +15 -4
- package/build/libarkts-copy/src/generated/peers/UndefinedLiteral.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/UpdateExpression.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/VReg.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/ValidationInfo.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/VariableDeclaration.ts +48 -8
- package/build/libarkts-copy/src/generated/peers/VariableDeclarator.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/VerificationContext.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/VerifierMessage.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/WhileStatement.ts +15 -4
- package/build/libarkts-copy/src/generated/peers/YieldExpression.ts +10 -4
- package/build/libarkts-copy/src/index.ts +31 -1
- package/build/libarkts-copy/src/plugin-utils.ts +117 -0
- package/build/libarkts-copy/src/ts-api/factory/nodeFactory.ts +15 -0
- package/build/libarkts-copy/src/ts-api/factory/nodeTests.ts +15 -0
- package/build/libarkts-copy/src/ts-api/types.ts +15 -0
- package/build/libarkts-copy/src/utils.ts +24 -41
- package/build/libarkts-copy/src/wrapper-compat/README.md +16 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/class-by-peer.ts +46 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/factory/nodeFactory.ts +454 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/factory/nodeTests.ts +99 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/index.ts +88 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ArrayExpression.ts +38 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ArrowFunctionExpression.ts +35 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/AssignmentExpression.ts +38 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/BlockStatement.ts +27 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/CallExpression.ts +45 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ClassDeclaration.ts +27 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ClassDefinition.ts +73 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ClassProperty.ts +51 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ETSFunctionType.ts +42 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ETSImportDeclaration.ts +39 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ETSParameterExpression.ts +43 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ExpressionStatement.ts +28 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/FunctionDeclaration.ts +37 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/FunctionExpression.ts +28 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/IfStatement.ts +37 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/MemberExpression.ts +42 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/MethodDefinition.ts +46 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/NumberLiteral.ts +30 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ObjectExpression.ts +37 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/Property.ts +27 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ScriptFunction.ts +46 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/StructDeclaration.ts +28 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TSInterfaceDeclaration.ts +47 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TSTypeAliasDeclaration.ts +40 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TSTypeParameter.ts +36 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TryStatement.ts +41 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/VariableDeclaration.ts +42 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/VariableDeclarator.ts +39 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/ArktsObject.ts +45 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/AstNode.ts +26 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Config.ts +53 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Context.ts +60 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Diagnostic.ts +39 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/DiagnosticInfo.ts +33 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/DiagnosticKind.ts +33 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/ImportPathManager.ts +34 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Program.ts +105 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/SourcePosition.ts +38 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/SourceRange.ts +38 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/SuggestionInfo.ts +33 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/static/global.ts +16 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/static/globalUtils.ts +27 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/to-be-generated/MemberExpression.ts +108 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/types.ts +907 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/nativePtrDecoder.ts +69 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/performance.ts +190 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/private.ts +198 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/public.ts +325 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/visitor.ts +421 -0
- package/build/libarkts-copy/src/wrapper-compat/index.ts +20 -0
- package/build/libarkts-copy/tsconfig.json +2 -1
- package/lib/index.js +1704 -273
- package/package.json +2 -2
- package/templates/Es2pandaEnums.ts +4 -0
- package/templates/Es2pandaNativeModule.ts +5 -1
- package/templates/factory.ts +5 -1
- package/templates/index.ts +5 -1
- package/templates/node-map.ts +5 -1
- package/templates/peer.ts +5 -1
- package/build/libarkts-copy/README.md +0 -36
|
@@ -1,63 +1,83 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
2
|
+
"name": "@koalaui/libarkts",
|
|
3
|
+
"version": "1.7.5+devel",
|
|
4
|
+
"bin": "./lib/es2panda",
|
|
5
|
+
"typesVersions": {
|
|
6
|
+
"*": {
|
|
7
|
+
"./compat/*": [
|
|
8
|
+
"./build/wrapper-compat/index.d.ts"
|
|
9
|
+
],
|
|
10
|
+
"*": [
|
|
11
|
+
"./build/index.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"exports": {
|
|
16
|
+
".": "./lib/libarkts.js",
|
|
17
|
+
"./compat": "./lib/libarkts-compat.js",
|
|
18
|
+
"./plugins/*": "./lib/plugins/*.js"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"./lib/**/*",
|
|
22
|
+
"./build/**/*",
|
|
23
|
+
"./plugins/build/src/**/*"
|
|
24
|
+
],
|
|
25
|
+
"config": {
|
|
26
|
+
"gen_version": "2.1.9-arktscgen-3",
|
|
27
|
+
"panda_sdk_path": "../../incremental/tools/panda/node_modules/@panda/sdk",
|
|
28
|
+
"ohos_panda_sdk_path": "../build/sdk",
|
|
29
|
+
"panda_sdk_version": "next"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@koalaui/ets-tsc": "4.9.5-r5",
|
|
33
|
+
"@koalaui/build-common": "1.7.5+devel",
|
|
34
|
+
"@koalaui/compat": "1.7.5+devel",
|
|
35
|
+
"@koalaui/common": "1.7.5+devel",
|
|
36
|
+
"@koalaui/interop": "1.7.5+devel",
|
|
37
|
+
"node-addon-api": "8.0.0",
|
|
38
|
+
"node-api-headers": "0.0.5",
|
|
39
|
+
"commander": "10.0.1"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"rollup": "^4.13.0",
|
|
43
|
+
"@rollup/plugin-commonjs": "^26.0.1",
|
|
44
|
+
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
45
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
46
|
+
"@rollup/plugin-typescript": "^11.1.6"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"clean": "rimraf build native/build* ./.rollup.cache tsconfig.tsbuildinfo lib",
|
|
50
|
+
"clean:plugins": "rimraf plugins/build",
|
|
51
|
+
"compile:koala:interop": "npm run --prefix ../../interop compile",
|
|
52
|
+
"compile:meson": "cd native && meson setup build && meson compile -C build",
|
|
53
|
+
"crosscompile:meson": "cd native && CXX=clang++ meson setup -D cross_compile=true build && CXX=clang++ meson compile -C build",
|
|
54
|
+
"copy:.node": "mkdir -p ./build/native/build && cp ./native/build/es2panda_*.node ./build/native/build",
|
|
55
|
+
"compile:native": "npm run compile:koala:interop && npm run compile:meson && npm run copy:.node",
|
|
56
|
+
"crosscompile:native": "npm run compile:koala:interop && npm run crosscompile:meson && npm run copy:.node",
|
|
57
|
+
"compile:src": "npx ets-tsc -p ./tsconfig.json",
|
|
58
|
+
"compile": "npm run compile:native && npm run compile:js",
|
|
59
|
+
"compile:release": "npm run crosscompile:native && npm run compile:js",
|
|
60
|
+
"compile:js": "npm run compile:src && rollup -c rollup.lib.mjs && rollup -c rollup.es2panda.mjs",
|
|
61
|
+
"compile:gn": "npm run compile:koala:interop && npm run compile:js",
|
|
62
|
+
"compile:plugins": "npx rollup -c ./rollup.printer-plugin.mjs && npx rollup -c ./rollup.no-visitor-plugin.mjs ",
|
|
63
|
+
"restart": "node ../fast-arktsc --config arktsconfig.json --compiler ../../incremental/tools/panda/arkts/ui2abc --link-name ./build/abc/main.abc --restart-stages && ninja -f build/abc/build.ninja",
|
|
64
|
+
"direct": "node ../fast-arktsc --config arktsconfig.json --compiler ../../incremental/tools/panda/arkts/ui2abc --link-name ./build/abc/main.abc && ninja -f build/abc/build.ninja",
|
|
65
|
+
"run": "npm run compile && npm run compile:plugins && npm run direct",
|
|
66
|
+
"run:memo": "npm run compile && npm run compile:plugins && npm run compile --prefix ../memo-plugin && npm run memo",
|
|
67
|
+
"run:abc": "$npm_package_config_panda_sdk_path/linux_host_tools/bin/ark --load-runtimes=ets --boot-panda-files=$npm_package_config_panda_sdk_path/ets/etsstdlib.abc ./main.abc main.ETSGLOBAL::main",
|
|
68
|
+
"mocha": "PANDA_SDK_PATH=${PANDA_SDK_PATH:=$npm_package_config_panda_sdk_path} TS_NODE_PROJECT=./test/tsconfig.json mocha -r tsconfig-paths/register --reporter-option maxDiffSize=0",
|
|
69
|
+
"mocha:ohos": "PANDA_SDK_PATH=${PANDA_SDK_PATH:=$npm_package_config_ohos_panda_sdk_path} TS_NODE_PROJECT=./test/tsconfig.json mocha -r tsconfig-paths/register --reporter-option maxDiffSize=0",
|
|
70
|
+
"test:light": "npm run mocha",
|
|
71
|
+
"test": "npm run compile:native && npm run test:light",
|
|
72
|
+
"test:golden": "npm run compile:native && TEST_GOLDEN=1 npm run test:light",
|
|
73
|
+
"compile:playground": "cd playground && meson setup build && meson compile -C build",
|
|
74
|
+
"run:playground": "npm run compile:playground && ./playground/build/playground.out",
|
|
75
|
+
"panda:sdk:clean": "cd ../../incremental/tools/panda && rimraf node_modules",
|
|
76
|
+
"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:reinstall": "npm run panda:sdk:clean && npm run panda:sdk:install",
|
|
78
|
+
"regenerate:current": "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",
|
|
79
|
+
"regenerate": "npx --yes @idlizer/arktscgen@$npm_package_config_gen_version --panda-sdk-path $npm_package_config_panda_sdk_path --output-dir ../ --options-file ./generator/options.json5 --no-initialize",
|
|
80
|
+
"regenerate:ohos": "npx --yes @idlizer/arktscgen@$npm_package_config_gen_version --panda-sdk-path ${PANDA_SDK_PATH:=$npm_package_config_ohos_panda_sdk_path} --output-dir ../ --options-file ./generator/options.json5 --no-initialize",
|
|
81
|
+
"reinstall:regenerate": "npm run panda:sdk:reinstall && npm run regenerate"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -22,10 +22,12 @@ import {
|
|
|
22
22
|
loadNativeModuleLibrary,
|
|
23
23
|
KDouble,
|
|
24
24
|
KUInt,
|
|
25
|
+
KStringArrayPtr,
|
|
25
26
|
} from "@koalaui/interop"
|
|
26
27
|
import { Es2pandaNativeModule as GeneratedEs2pandaNativeModule, KNativePointerArray } from "./generated/Es2pandaNativeModule"
|
|
27
28
|
import * as path from "path"
|
|
28
29
|
import * as fs from "fs"
|
|
30
|
+
import { Es2pandaPluginDiagnosticType } from "./generated/Es2pandaEnums"
|
|
29
31
|
|
|
30
32
|
// TODO: this type should be in interop
|
|
31
33
|
export type KPtrArray = BigUint64Array
|
|
@@ -61,6 +63,24 @@ export class Es2pandaNativeModule {
|
|
|
61
63
|
_CreateContextFromString(config: KPtr, source: String, filename: String): KPtr {
|
|
62
64
|
throw new Error("Not implemented")
|
|
63
65
|
}
|
|
66
|
+
_CreateContextFromFile(config: KPtr, filename: String): KPtr {
|
|
67
|
+
throw new Error("Not implemented")
|
|
68
|
+
}
|
|
69
|
+
_CreateCacheContextFromFile(config: KNativePointer, sourceFileName: String, globalContext: KNativePointer, isExternal: KBoolean): KNativePointer {
|
|
70
|
+
throw new Error("Not implemented");
|
|
71
|
+
}
|
|
72
|
+
_InsertGlobalStructInfo(context: KNativePointer, str: String): void {
|
|
73
|
+
throw new Error("Not implemented");
|
|
74
|
+
}
|
|
75
|
+
_HasGlobalStructInfo(context: KNativePointer, str: String): KBoolean {
|
|
76
|
+
throw new Error("Not implemented");
|
|
77
|
+
}
|
|
78
|
+
_CreateGlobalContext(config: KNativePointer, externalFileList: KStringArrayPtr, fileNum: KUInt, lspUsage: KBoolean): KNativePointer {
|
|
79
|
+
throw new Error("Not implemented");
|
|
80
|
+
}
|
|
81
|
+
_DestroyGlobalContext(context: KNativePointer): void {
|
|
82
|
+
throw new Error("Not implemented");
|
|
83
|
+
}
|
|
64
84
|
_DestroyContext(context: KPtr): void {
|
|
65
85
|
throw new Error("Not implemented")
|
|
66
86
|
}
|
|
@@ -97,9 +117,15 @@ export class Es2pandaNativeModule {
|
|
|
97
117
|
_DeclarationFromIdentifier(context: KPtr, identifier: KPtr): KPtr {
|
|
98
118
|
throw new Error("Not implemented")
|
|
99
119
|
}
|
|
120
|
+
_ProgramSourceFilePath(context: KNativePointer, instance: KNativePointer): KNativePointer {
|
|
121
|
+
throw new Error("Not implemented");
|
|
122
|
+
}
|
|
100
123
|
_ProgramExternalSources(context: KNativePointer, instance: KNativePointer): KNativePointer {
|
|
101
124
|
throw new Error("Not implemented");
|
|
102
125
|
}
|
|
126
|
+
_ProgramDirectExternalSources(context: KNativePointer, instance: KNativePointer): KNativePointer {
|
|
127
|
+
throw new Error("Not implemented")
|
|
128
|
+
}
|
|
103
129
|
_ExternalSourceName(instance: KNativePointer): KNativePointer {
|
|
104
130
|
throw new Error("Not implemented");
|
|
105
131
|
}
|
|
@@ -127,12 +153,79 @@ export class Es2pandaNativeModule {
|
|
|
127
153
|
_SourcePositionLine(context: KNativePointer, instance: KNativePointer): KInt {
|
|
128
154
|
throw new Error("Not implemented");
|
|
129
155
|
}
|
|
156
|
+
_ConfigGetOptions(config: KNativePointer): KNativePointer {
|
|
157
|
+
throw new Error("Not implemented");
|
|
158
|
+
}
|
|
159
|
+
_OptionsArkTsConfig(context: KNativePointer, options: KNativePointer): KNativePointer {
|
|
160
|
+
throw new Error("Not implemented");
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// From koala-wrapper
|
|
164
|
+
_ClassVariableDeclaration(context: KNativePointer, classInstance: KNativePointer): KNativePointer {
|
|
165
|
+
throw new Error("Not implemented")
|
|
166
|
+
}
|
|
167
|
+
_IsMethodDefinition(node: KPtr): KBoolean {
|
|
168
|
+
throw new Error("Not implemented")
|
|
169
|
+
}
|
|
170
|
+
_SourceRangeStart(context: KNativePointer, range: KNativePointer): KNativePointer {
|
|
171
|
+
throw new Error("Not implemented")
|
|
172
|
+
}
|
|
173
|
+
_SourceRangeEnd(context: KNativePointer, range: KNativePointer): KNativePointer {
|
|
174
|
+
throw new Error("Not implemented")
|
|
175
|
+
}
|
|
176
|
+
_CreateSourceRange(context: KNativePointer, start: KNativePointer, end: KNativePointer): KNativePointer {
|
|
177
|
+
throw new Error("Not implemented")
|
|
178
|
+
}
|
|
179
|
+
_IsArrayExpression(node: KPtr): KBoolean {
|
|
180
|
+
throw new Error("Not implemented")
|
|
181
|
+
}
|
|
182
|
+
_ETSParserGetGlobalProgramAbsName(context: KNativePointer): KNativePointer {
|
|
183
|
+
throw new Error("Not implemented")
|
|
184
|
+
}
|
|
185
|
+
_CreateDiagnosticKind(context: KNativePointer, message: string, type: Es2pandaPluginDiagnosticType): KNativePointer {
|
|
186
|
+
throw new Error("Not implemented")
|
|
187
|
+
}
|
|
188
|
+
_CreateDiagnosticInfo(context: KNativePointer, kind: KNativePointer, args: string[], argc: number): KNativePointer {
|
|
189
|
+
throw new Error("Not implemented")
|
|
190
|
+
}
|
|
191
|
+
_CreateSuggestionInfo(context: KNativePointer, kind: KNativePointer, args: string[],
|
|
192
|
+
argc: number, substitutionCode: string): KNativePointer {
|
|
193
|
+
throw new Error("Not implemented")
|
|
194
|
+
}
|
|
195
|
+
_LogDiagnostic(context: KNativePointer, kind: KNativePointer, argv: string[], argc: number, pos: KNativePointer): void {
|
|
196
|
+
throw new Error("Not implemented")
|
|
197
|
+
}
|
|
198
|
+
_LogDiagnosticWithSuggestion(context: KNativePointer, diagnosticInfo: KNativePointer,
|
|
199
|
+
suggestionInfo?: KNativePointer, range?: KNativePointer): void {
|
|
200
|
+
throw new Error("Not implemented")
|
|
201
|
+
}
|
|
202
|
+
_SetUpSoPath(soPath: string): void {
|
|
203
|
+
throw new Error("Not implemented")
|
|
204
|
+
}
|
|
205
|
+
_MemInitialize(): void {
|
|
206
|
+
throw new Error("Not implemented")
|
|
207
|
+
}
|
|
208
|
+
_MemFinalize(): void {
|
|
209
|
+
throw new Error("Not implemented")
|
|
210
|
+
}
|
|
211
|
+
_ProgramCanSkipPhases(context: KNativePointer, program: KNativePointer): boolean {
|
|
212
|
+
throw new Error("Not implemented")
|
|
213
|
+
}
|
|
214
|
+
_GenerateTsDeclarationsFromContext(config: KPtr, outputDeclEts: String, outputEts: String, exportAll: KBoolean, isolated: KBoolean): KPtr {
|
|
215
|
+
throw new Error("Not implemented")
|
|
216
|
+
}
|
|
217
|
+
_GenerateStaticDeclarationsFromContext(config: KPtr, outputPath: String): KPtr {
|
|
218
|
+
throw new Error("Not implemented")
|
|
219
|
+
}
|
|
220
|
+
_AstNodeProgram(context: KNativePointer, instance: KNativePointer): KNativePointer {
|
|
221
|
+
throw new Error("Not implemented")
|
|
222
|
+
}
|
|
130
223
|
}
|
|
131
224
|
|
|
132
225
|
export function findNativeModule(): string {
|
|
133
226
|
const candidates = [
|
|
134
|
-
path.resolve(__dirname, "../native/build
|
|
135
|
-
path.resolve(__dirname, "../build/native/build
|
|
227
|
+
path.resolve(__dirname, "../native/build"),
|
|
228
|
+
path.resolve(__dirname, "../build/native/build"),
|
|
136
229
|
]
|
|
137
230
|
let result = undefined
|
|
138
231
|
candidates.forEach(path => {
|
|
@@ -141,7 +234,8 @@ export function findNativeModule(): string {
|
|
|
141
234
|
return
|
|
142
235
|
}
|
|
143
236
|
})
|
|
144
|
-
if (result)
|
|
237
|
+
if (result)
|
|
238
|
+
return path.join(result, "es2panda")
|
|
145
239
|
throw new Error("Cannot find native module")
|
|
146
240
|
}
|
|
147
241
|
|
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
registerNativeModuleLibraryName,
|
|
20
20
|
loadNativeModuleLibrary
|
|
21
21
|
} from "@koalaui/interop"
|
|
22
|
-
import * as path from "path"
|
|
23
22
|
import { findNativeModule } from "./Es2pandaNativeModule"
|
|
24
23
|
|
|
25
24
|
export class InteropNativeModule {
|
|
@@ -32,6 +31,9 @@ export class InteropNativeModule {
|
|
|
32
31
|
_GetStringFinalizer(): KPtr {
|
|
33
32
|
throw new Error("Not implemented")
|
|
34
33
|
}
|
|
34
|
+
_RawUtf8ToString(ptr: KPtr): string {
|
|
35
|
+
throw new Error("Not implemented")
|
|
36
|
+
}
|
|
35
37
|
_InvokeFinalizer(ptr: KPtr, finalizer: KPtr): void {
|
|
36
38
|
throw new Error("Not implemented")
|
|
37
39
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2022-2025 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 { ChainExpression, Expression, isChainExpression, isMemberExpression, MemberExpression } from "src/generated";
|
|
17
|
+
import { AbstractVisitor } from "./AbstractVisitor";
|
|
18
|
+
import { AstNode } from "./peers/AstNode"
|
|
19
|
+
import { factory } from "./factory/nodeFactory";
|
|
20
|
+
import { Es2pandaTokenType, Es2pandaVariableDeclarationKind, Es2pandaVariableDeclaratorFlag } from "src/generated/Es2pandaEnums";
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
export class ChainExpressionFilter extends AbstractVisitor {
|
|
24
|
+
static counter = 0
|
|
25
|
+
transformChainExpression(node: ChainExpression): Expression {
|
|
26
|
+
const expression = node.expression
|
|
27
|
+
if (expression == undefined) return node
|
|
28
|
+
if (!isMemberExpression(expression)) return node
|
|
29
|
+
return this.transformMemberExpression(expression)
|
|
30
|
+
}
|
|
31
|
+
transformMemberExpression(expression: MemberExpression): Expression {
|
|
32
|
+
const temporaryVarName = `chaintmp%%_${ChainExpressionFilter.counter++}`
|
|
33
|
+
return factory.createBlockExpression(
|
|
34
|
+
[
|
|
35
|
+
factory.createVariableDeclaration(
|
|
36
|
+
Es2pandaVariableDeclarationKind.VARIABLE_DECLARATION_KIND_LET,
|
|
37
|
+
[
|
|
38
|
+
factory.createVariableDeclarator(
|
|
39
|
+
Es2pandaVariableDeclaratorFlag.VARIABLE_DECLARATOR_FLAG_LET,
|
|
40
|
+
factory.createIdentifier(temporaryVarName),
|
|
41
|
+
expression.object
|
|
42
|
+
)
|
|
43
|
+
],
|
|
44
|
+
undefined
|
|
45
|
+
),
|
|
46
|
+
factory.createExpressionStatement(
|
|
47
|
+
factory.createConditionalExpression(
|
|
48
|
+
factory.createBinaryExpression(
|
|
49
|
+
factory.createIdentifier(temporaryVarName, undefined),
|
|
50
|
+
factory.createUndefinedLiteral(),
|
|
51
|
+
Es2pandaTokenType.TOKEN_TYPE_PUNCTUATOR_STRICT_EQUAL
|
|
52
|
+
),
|
|
53
|
+
factory.createUndefinedLiteral(),
|
|
54
|
+
factory.createMemberExpression(
|
|
55
|
+
factory.createIdentifier(temporaryVarName, undefined),
|
|
56
|
+
expression.property,
|
|
57
|
+
expression.kind,
|
|
58
|
+
expression.isComputed,
|
|
59
|
+
false
|
|
60
|
+
)
|
|
61
|
+
)
|
|
62
|
+
)
|
|
63
|
+
]
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
visitor(beforeChildren: AstNode): AstNode {
|
|
69
|
+
const node = this.visitEachChild(beforeChildren)
|
|
70
|
+
if (isChainExpression(node)) {
|
|
71
|
+
return this.transformChainExpression(node)
|
|
72
|
+
}
|
|
73
|
+
if (isMemberExpression(node) && node.isOptional) {
|
|
74
|
+
return this.transformMemberExpression(node)
|
|
75
|
+
}
|
|
76
|
+
return node
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2022-2025 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 { AnnotationUsage, ClassDefinition, ClassElement, Expression, isArrowFunctionExpression, isClassDefinition, isClassProperty, isETSFunctionType, isETSModule, isETSNewClassInstanceExpression, isScriptFunction, isTSEnumDeclaration, TSEnumDeclaration, TSEnumMember } from "src/generated";
|
|
17
|
+
import { AbstractVisitor } from "./AbstractVisitor";
|
|
18
|
+
import { AstNode } from "./peers/AstNode"
|
|
19
|
+
import { Es2pandaModifierFlags } from "src/generated/Es2pandaEnums";
|
|
20
|
+
import { factory } from "src/generated/factory";
|
|
21
|
+
import { arkts } from "src";
|
|
22
|
+
import { TypeAliasDeclaration } from "@koalaui/ets-tsc";
|
|
23
|
+
|
|
24
|
+
function filterAnnotations(annotations: AnnotationUsage[]): AnnotationUsage[] {
|
|
25
|
+
return annotations.filter(it => it.baseName?.name != "OptionalParametersAnnotation")
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export abstract class ContextAwareVisitor extends AbstractVisitor {
|
|
29
|
+
private contextStack: ('global' | 'namespace')[] = ['global']
|
|
30
|
+
protected get context() {
|
|
31
|
+
return this.contextStack.at(-1)!
|
|
32
|
+
}
|
|
33
|
+
private enter(node:AstNode): () => void {
|
|
34
|
+
if (isETSModule(node) && node.ident?.name !== 'ETSGLOBAL') {
|
|
35
|
+
this.contextStack.push('namespace')
|
|
36
|
+
return () => this.contextStack.pop()
|
|
37
|
+
}
|
|
38
|
+
if (isClassDefinition(node) && node.isNamespaceTransformed && node.ident?.name !== 'ETSGLOBAL') {
|
|
39
|
+
this.contextStack.push('namespace')
|
|
40
|
+
return () => this.contextStack.pop()
|
|
41
|
+
}
|
|
42
|
+
return () => {}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
visitEachChild(node: AstNode, options?: object): AstNode {
|
|
46
|
+
const leave = this.enter(node)
|
|
47
|
+
const r = super.visitEachChild(node, options)
|
|
48
|
+
leave()
|
|
49
|
+
return r
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export class CheckedBackFilter extends ContextAwareVisitor {
|
|
54
|
+
transformInitializer(node: Expression|undefined): Expression|undefined {
|
|
55
|
+
if (node == undefined) return undefined
|
|
56
|
+
if (!isETSNewClassInstanceExpression(node)) return node
|
|
57
|
+
return node.arguments[1]
|
|
58
|
+
}
|
|
59
|
+
transformEnum(node: ClassDefinition): AstNode {
|
|
60
|
+
return TSEnumDeclaration.createTSEnumDeclaration(
|
|
61
|
+
node.ident,
|
|
62
|
+
node.body.map(it => {
|
|
63
|
+
const member: ClassElement = it as ClassElement
|
|
64
|
+
if (!isClassProperty(member)) return undefined
|
|
65
|
+
if (isClassProperty(member) && member.id?.name.startsWith("#")) return undefined
|
|
66
|
+
return factory.createTSEnumMember(
|
|
67
|
+
member.key,
|
|
68
|
+
this.transformInitializer(member.value),
|
|
69
|
+
false
|
|
70
|
+
)
|
|
71
|
+
}).filter(it => it != undefined) as TSEnumMember[],
|
|
72
|
+
false,
|
|
73
|
+
false,
|
|
74
|
+
!!(node.modifierFlags & Es2pandaModifierFlags.MODIFIER_FLAGS_DECLARE) && this.context !== 'namespace'
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
transformScopedClass(node:ClassDefinition): ClassDefinition {
|
|
78
|
+
return ClassDefinition.createClassDefinition(
|
|
79
|
+
node.ident,
|
|
80
|
+
node.typeParams,
|
|
81
|
+
node.superTypeParams,
|
|
82
|
+
node.implements,
|
|
83
|
+
node.ctor,
|
|
84
|
+
node.super,
|
|
85
|
+
node.body,
|
|
86
|
+
node.modifiers,
|
|
87
|
+
this.context === 'namespace'
|
|
88
|
+
? node.modifierFlags & (~Es2pandaModifierFlags.MODIFIER_FLAGS_DECLARE)
|
|
89
|
+
: node.modifierFlags
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
transformScopedEnum(node:TSEnumDeclaration): TSEnumDeclaration {
|
|
93
|
+
return TSEnumDeclaration.createTSEnumDeclaration(
|
|
94
|
+
node.key,
|
|
95
|
+
node.members,
|
|
96
|
+
node.isConst,
|
|
97
|
+
false,
|
|
98
|
+
!!(node.modifierFlags & Es2pandaModifierFlags.MODIFIER_FLAGS_DECLARE) && this.context !== 'namespace'
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
visitor(beforeChildren: AstNode): AstNode {
|
|
102
|
+
const node = this.visitEachChild(beforeChildren)
|
|
103
|
+
if (isTSEnumDeclaration(node)) {
|
|
104
|
+
return this.transformScopedEnum(node)
|
|
105
|
+
}
|
|
106
|
+
if (isClassDefinition(node)) {
|
|
107
|
+
if (node.isEnumTransformed) {
|
|
108
|
+
return this.transformEnum(node)
|
|
109
|
+
} else {
|
|
110
|
+
const transformed = this.context === 'namespace'
|
|
111
|
+
? this.transformScopedClass(node)
|
|
112
|
+
: node
|
|
113
|
+
return transformed.setAnnotations(filterAnnotations([...node.annotations]))
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (isClassProperty(node)) {
|
|
117
|
+
return node.setAnnotations(filterAnnotations([...node.annotations]))
|
|
118
|
+
}
|
|
119
|
+
if (isArrowFunctionExpression(node)) {
|
|
120
|
+
return node.setAnnotations(filterAnnotations([...node.annotations]))
|
|
121
|
+
}
|
|
122
|
+
if (isETSFunctionType(node)) {
|
|
123
|
+
return node.setAnnotations(filterAnnotations([...node.annotations]))
|
|
124
|
+
}
|
|
125
|
+
if (isScriptFunction(node)) {
|
|
126
|
+
return node.setAnnotations(filterAnnotations([...node.annotations]))
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return node
|
|
130
|
+
}
|
|
131
|
+
}
|