@idlizer/arktscgen 2.1.9-arktscgen-6 → 2.1.9-arktscgen-9
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 +165 -3
- package/build/libarkts-copy/native/meson.build +11 -12
- package/build/libarkts-copy/native/meson_options.txt +1 -1
- package/build/libarkts-copy/native/mingw.cross +14 -0
- package/build/libarkts-copy/native/src/bridges.cc +105 -15
- package/build/libarkts-copy/native/src/common.cc +11 -7
- package/build/libarkts-copy/native/src/common.h +1 -0
- package/build/libarkts-copy/native/src/generated/bridges.cc +318 -35
- package/build/libarkts-copy/package.json +24 -21
- package/build/libarkts-copy/src/Es2pandaNativeModule.ts +33 -6
- package/build/libarkts-copy/src/arkts-api/ChainExpressionFilter.ts +2 -1
- package/build/libarkts-copy/src/arkts-api/ImportStorage.ts +18 -12
- package/build/libarkts-copy/src/arkts-api/ProgramProvider.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/factory/nodeFactory.ts +15 -26
- package/build/libarkts-copy/src/arkts-api/index.ts +2 -4
- package/build/libarkts-copy/src/arkts-api/node-utilities/BlockStatement.ts +0 -4
- package/build/libarkts-copy/src/arkts-api/node-utilities/CallExpression.ts +1 -22
- package/build/libarkts-copy/src/arkts-api/node-utilities/ClassDefinition.ts +7 -8
- package/build/libarkts-copy/src/arkts-api/node-utilities/ClassProperty.ts +1 -22
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSFunctionType.ts +2 -5
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSImportDeclaration.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSModule.ts +44 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSParameterExpression.ts +1 -4
- package/build/libarkts-copy/src/arkts-api/node-utilities/MethodDefinition.ts +3 -12
- package/build/libarkts-copy/src/arkts-api/node-utilities/ObjectExpression.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/Program.ts +10 -11
- package/build/libarkts-copy/src/arkts-api/node-utilities/ScriptFunction.ts +17 -6
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSInterfaceDeclaration.ts +3 -6
- package/build/libarkts-copy/src/arkts-api/peers/AstNode.ts +3 -3
- package/build/libarkts-copy/src/arkts-api/peers/Config.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/peers/Context.ts +26 -5
- package/build/libarkts-copy/src/arkts-api/peers/ExternalSource.ts +4 -0
- package/build/libarkts-copy/src/arkts-api/plugins.ts +15 -7
- package/build/libarkts-copy/src/arkts-api/static/global.ts +3 -2
- package/build/libarkts-copy/src/{wrapper-compat/arkts-api → arkts-api}/static/globalUtils.ts +4 -4
- package/build/libarkts-copy/src/arkts-api/static/profiler.ts +0 -8
- package/build/libarkts-copy/src/arkts-api/utilities/extensions.ts +80 -0
- package/build/libarkts-copy/src/arkts-api/utilities/nativePtrDecoder.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/utilities/private.ts +5 -5
- package/build/libarkts-copy/src/arkts-api/utilities/public.ts +217 -29
- package/build/libarkts-copy/src/arkts-api/visitor.ts +17 -10
- package/build/libarkts-copy/src/checkSdk.ts +15 -0
- package/build/libarkts-copy/src/generated/Es2pandaEnums.ts +343 -321
- package/build/libarkts-copy/src/generated/Es2pandaNativeModule.ts +97 -14
- package/build/libarkts-copy/src/generated/factory.ts +40 -27
- package/build/libarkts-copy/src/generated/index.ts +4 -2
- package/build/libarkts-copy/src/generated/peers/AnnotatedAstNode.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/AnnotatedExpression.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/AnnotatedStatement.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/AnnotationDeclaration.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/AnnotationUsage.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/ArkTsConfig.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/ArrayExpression.ts +12 -6
- package/build/libarkts-copy/src/generated/peers/ArrowFunctionExpression.ts +26 -8
- package/build/libarkts-copy/src/generated/peers/AssertStatement.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/AssignmentExpression.ts +12 -6
- package/build/libarkts-copy/src/generated/peers/AstDumper.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/AstVerifier.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/AstVisitor.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/AwaitExpression.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/BigIntLiteral.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/BinaryExpression.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/BindingProps.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/BlockExpression.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/BlockStatement.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/BooleanLiteral.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/BreakStatement.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/CallExpression.ts +19 -7
- package/build/libarkts-copy/src/generated/peers/CatchClause.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/ChainExpression.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/CharLiteral.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/ClassDeclaration.ts +21 -8
- package/build/libarkts-copy/src/generated/peers/ClassDefinition.ts +37 -13
- package/build/libarkts-copy/src/generated/peers/ClassElement.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/ClassExpression.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/ClassProperty.ts +19 -7
- package/build/libarkts-copy/src/generated/peers/ClassStaticBlock.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/CodeGen.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/ConditionalExpression.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/ContinueStatement.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/DebuggerStatement.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/Declaration.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/Decorator.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/DiagnosticInfo.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/DirectEvalExpression.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/DoWhileStatement.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/DynamicImportData.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/ETSClassLiteral.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/ETSFunctionType.ts +20 -13
- package/build/libarkts-copy/src/generated/peers/ETSImportDeclaration.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/ETSIntrinsicNode.ts +77 -0
- package/build/libarkts-copy/src/generated/peers/ETSKeyofType.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/ETSModule.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/ETSNewArrayInstanceExpression.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/ETSNewClassInstanceExpression.ts +12 -6
- package/build/libarkts-copy/src/generated/peers/ETSNewMultiDimArrayInstanceExpression.ts +12 -6
- package/build/libarkts-copy/src/generated/peers/ETSNullType.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/ETSPackageDeclaration.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/ETSParameterExpression.ts +46 -14
- package/build/libarkts-copy/src/generated/peers/ETSPrimitiveType.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/ETSReExportDeclaration.ts +3 -3
- package/build/libarkts-copy/src/generated/peers/ETSStringLiteralType.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/ETSStructDeclaration.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/ETSTuple.ts +21 -9
- package/build/libarkts-copy/src/generated/peers/ETSTypeReference.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/ETSTypeReferencePart.ts +12 -6
- package/build/libarkts-copy/src/generated/peers/ETSUndefinedType.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/ETSUnionType.ts +20 -7
- package/build/libarkts-copy/src/generated/peers/ETSWildcardType.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/EmptyStatement.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/ErrorLogger.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/ExportAllDeclaration.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/ExportDefaultDeclaration.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/ExportNamedDeclaration.ts +20 -8
- package/build/libarkts-copy/src/generated/peers/ExportSpecifier.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/Expression.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/ExpressionStatement.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/ForInStatement.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/ForOfStatement.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/ForUpdateStatement.ts +5 -3
- package/build/libarkts-copy/src/generated/peers/FunctionDecl.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/FunctionDeclaration.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/FunctionExpression.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/FunctionSignature.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/IRNode.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/Identifier.ts +14 -6
- package/build/libarkts-copy/src/generated/peers/IfStatement.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/ImportDeclaration.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/ImportDefaultSpecifier.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/ImportExpression.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/ImportNamespaceSpecifier.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/ImportSource.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/ImportSpecifier.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/IndexInfo.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/InterfaceDecl.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/LabelPair.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/LabelledStatement.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/Literal.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/LoopStatement.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/MaybeOptionalExpression.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/MemberExpression.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/MetaProperty.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/MethodDefinition.ts +23 -7
- package/build/libarkts-copy/src/generated/peers/NamedType.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/NewExpression.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/NullLiteral.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/NumberLiteral.ts +17 -7
- package/build/libarkts-copy/src/generated/peers/ObjectDescriptor.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/ObjectExpression.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/OmittedExpression.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/OpaqueTypeNode.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/OverloadDeclaration.ts +103 -0
- package/build/libarkts-copy/src/generated/peers/PrefixAssertionExpression.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/Program.ts +4 -2
- package/build/libarkts-copy/src/generated/peers/Property.ts +12 -6
- package/build/libarkts-copy/src/generated/peers/RegExpLiteral.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/ReturnStatement.ts +12 -6
- package/build/libarkts-copy/src/generated/peers/ScopeFindResult.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/ScriptFunction.ts +47 -14
- package/build/libarkts-copy/src/generated/peers/ScriptFunctionData.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/SequenceExpression.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/SignatureInfo.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/SourcePosition.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/SourceRange.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/SpreadElement.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/SrcDumper.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/Statement.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/StringLiteral.ts +12 -6
- package/build/libarkts-copy/src/generated/peers/SuggestionInfo.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/SuperExpression.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/SwitchCaseStatement.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/SwitchStatement.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSAnyKeyword.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSArrayType.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSAsExpression.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSBigintKeyword.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSBooleanKeyword.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSClassImplements.ts +12 -6
- package/build/libarkts-copy/src/generated/peers/TSConditionalType.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSConstructorType.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSEnumDeclaration.ts +19 -6
- package/build/libarkts-copy/src/generated/peers/TSEnumMember.ts +12 -6
- package/build/libarkts-copy/src/generated/peers/TSExternalModuleReference.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSFunctionType.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSImportEqualsDeclaration.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSImportType.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSIndexSignature.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSIndexedAccessType.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSInferType.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSInterfaceBody.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSInterfaceDeclaration.ts +21 -8
- package/build/libarkts-copy/src/generated/peers/TSInterfaceHeritage.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSIntersectionType.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSLiteralType.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSMappedType.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSMethodSignature.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSModuleBlock.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSModuleDeclaration.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSNamedTupleMember.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSNeverKeyword.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSNonNullExpression.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSNullKeyword.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSNumberKeyword.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSObjectKeyword.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSParameterProperty.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSParenthesizedType.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSPropertySignature.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSQualifiedName.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSSignatureDeclaration.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSStringKeyword.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSThisType.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSTupleType.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSTypeAliasDeclaration.ts +42 -11
- package/build/libarkts-copy/src/generated/peers/TSTypeAssertion.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSTypeLiteral.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSTypeOperator.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSTypeParameter.ts +12 -6
- package/build/libarkts-copy/src/generated/peers/TSTypeParameterDeclaration.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSTypeParameterInstantiation.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSTypePredicate.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSTypeQuery.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSTypeReference.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSUndefinedKeyword.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSUnionType.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSUnknownKeyword.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TSVoidKeyword.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TaggedTemplateExpression.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TemplateElement.ts +12 -6
- package/build/libarkts-copy/src/generated/peers/TemplateLiteral.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/ThisExpression.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/ThrowStatement.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/TryStatement.ts +12 -6
- package/build/libarkts-copy/src/generated/peers/TypeNode.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/TypedAstNode.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/TypedStatement.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/TypeofExpression.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/UnaryExpression.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/UndefinedLiteral.ts +8 -4
- package/build/libarkts-copy/src/generated/peers/UpdateExpression.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/VReg.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/ValidationInfo.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/VariableDeclaration.ts +20 -8
- package/build/libarkts-copy/src/generated/peers/VariableDeclarator.ts +12 -6
- package/build/libarkts-copy/src/generated/peers/VerificationContext.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/VerifierMessage.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/WhileStatement.ts +9 -5
- package/build/libarkts-copy/src/generated/peers/YieldExpression.ts +9 -5
- package/build/libarkts-copy/src/index.ts +1 -4
- package/build/libarkts-copy/src/plugin-utils.ts +45 -32
- package/build/libarkts-copy/src/reexport-for-generated.ts +10 -1
- package/build/libarkts-copy/src/ts-api/factory/nodeFactory.ts +14 -14
- package/build/libarkts-copy/src/ts-api/index.ts +1 -1
- package/build/libarkts-copy/src/ts-api/types.ts +56 -56
- package/build/libarkts-copy/src/ts-api/utilities/private.ts +6 -6
- package/build/libarkts-copy/src/ts-api/utilities/public.ts +3 -3
- package/build/libarkts-copy/src/ts-api/visitor/visitor.ts +4 -4
- package/build/libarkts-copy/src/utils.ts +13 -159
- package/build/libarkts-copy/src/wrapper-compat/README.md +4 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/index.ts +5 -5
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ArrayExpression.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ArrowFunctionExpression.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/AssignmentExpression.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/BlockStatement.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/CallExpression.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ClassDeclaration.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ClassDefinition.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ClassProperty.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ETSFunctionType.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ETSImportDeclaration.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ETSParameterExpression.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ExpressionStatement.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/FunctionDeclaration.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/FunctionExpression.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/IfStatement.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/MemberExpression.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/MethodDefinition.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/NumberLiteral.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ObjectExpression.ts +3 -3
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/Property.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ScriptFunction.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/StructDeclaration.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TSInterfaceDeclaration.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TSTypeAliasDeclaration.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TSTypeParameter.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TryStatement.ts +3 -3
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/VariableDeclaration.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/VariableDeclarator.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Diagnostic.ts +4 -5
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/DiagnosticInfo.ts +4 -3
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/DiagnosticKind.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/ImportPathManager.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Program.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/SourcePosition.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/SourceRange.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/SuggestionInfo.ts +4 -3
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/to-be-generated/MemberExpression.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/types.ts +12 -30
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/nativePtrDecoder.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/private.ts +4 -4
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/public.ts +10 -8
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/visitor.ts +10 -10
- package/lib/index.js +2799 -2665
- package/package.json +2 -2
- package/templates/Es2pandaEnums.ts +1 -2
- package/templates/Es2pandaNativeModule.ts +2 -3
- package/templates/factory.ts +1 -2
- package/templates/index.ts +1 -2
- package/templates/node-map.ts +1 -2
- package/templates/peer.ts +1 -2
- package/build/libarkts-copy/src/arkts-api/CheckedBackFilter.ts +0 -131
- package/build/libarkts-copy/src/arkts-api/CompileWithCache.ts +0 -193
- package/build/libarkts-copy/src/arkts-api/InferVoidReturnType.ts +0 -89
- package/build/libarkts-copy/src/arkts-api/SetBaseOverloads.ts +0 -44
- package/build/libarkts-copy/src/arkts-api/node-utilities/AnnotationUsage.ts +0 -29
- package/build/libarkts-copy/src/arkts-api/node-utilities/ArrowFunctionExpression.ts +0 -49
- package/build/libarkts-copy/src/arkts-api/node-utilities/ClassDeclaration.ts +0 -54
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeAliasDeclaration.ts +0 -68
- package/build/libarkts-copy/src/arkts-api/node-utilities/VariableDeclaration.ts +0 -54
- package/build/libarkts-copy/src/arkts-api/utilities/method-definition.ts +0 -38
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/ArktsObject.ts +0 -45
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Config.ts +0 -53
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Context.ts +0 -60
|
@@ -15,22 +15,22 @@
|
|
|
15
15
|
|
|
16
16
|
import { KNativePointer } from "@koalaui/interop"
|
|
17
17
|
import { ETSModule, ImportDeclaration, isETSImportDeclaration, Program, Statement } from "../generated"
|
|
18
|
-
import { updateETSModuleByStatements } from "./utilities/public"
|
|
19
18
|
import { passNode, passNodeArray, unpackNonNullableNode } from "./utilities/private"
|
|
20
19
|
import { global } from "./static/global"
|
|
21
20
|
import { Es2pandaImportFlags, Es2pandaImportKinds } from "../generated/Es2pandaEnums"
|
|
21
|
+
import { factory } from "./factory/nodeFactory"
|
|
22
22
|
|
|
23
23
|
export class ImportStorage {
|
|
24
|
-
//
|
|
24
|
+
// Improve: migrate to wrappers instead of pointers
|
|
25
25
|
private imports: Set<KNativePointer> = new Set<KNativePointer>()
|
|
26
26
|
private importSources: Set<string | undefined> = new Set<string | undefined>()
|
|
27
27
|
|
|
28
|
-
constructor(private program: Program, private
|
|
28
|
+
constructor(private program: Program, private isParserState: boolean) {
|
|
29
29
|
for (const statement of program.ast.statements) {
|
|
30
30
|
if (isETSImportDeclaration(statement)) {
|
|
31
31
|
this.imports.add(statement.peer)
|
|
32
|
-
if (!
|
|
33
|
-
//
|
|
32
|
+
if (!isParserState) {
|
|
33
|
+
// Improve: is source non nullable?
|
|
34
34
|
this.importSources.add(statement.source?.str)
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -45,8 +45,8 @@ export class ImportStorage {
|
|
|
45
45
|
const newStatements: Statement[] = []
|
|
46
46
|
for (const statement of statements) {
|
|
47
47
|
if (isETSImportDeclaration(statement) && !this.imports.has(statement.peer)) {
|
|
48
|
-
if (!this.
|
|
49
|
-
console.warn("Attempt to insert import from new source after parsed
|
|
48
|
+
if (!this.isParserState && !this.importSources.has(statement.source?.str)) {
|
|
49
|
+
console.warn("Attempt to insert import from new source after parsed state:")
|
|
50
50
|
console.warn(statement.dumpSrc())
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -54,12 +54,12 @@ export class ImportStorage {
|
|
|
54
54
|
// Note: this call is important, we cannot just pass "statement" to "InsertETSImportDeclarationAndParse"
|
|
55
55
|
global.es2panda._ETSParserBuildImportDeclaration(
|
|
56
56
|
global.context,
|
|
57
|
-
Es2pandaImportKinds.IMPORT_KINDS_ALL, //
|
|
57
|
+
Es2pandaImportKinds.IMPORT_KINDS_ALL, // Improve: do we use IMPORT_KINDS_TYPES?
|
|
58
58
|
passNodeArray(statement.specifiers),
|
|
59
59
|
statement.specifiers.length,
|
|
60
60
|
passNode(statement.source),
|
|
61
61
|
this.program.peer,
|
|
62
|
-
Es2pandaImportFlags.IMPORT_FLAGS_NONE, //
|
|
62
|
+
Es2pandaImportFlags.IMPORT_FLAGS_NONE, // Improve: where to get it?
|
|
63
63
|
)
|
|
64
64
|
)
|
|
65
65
|
global.es2panda._InsertETSImportDeclarationAndParse(global.context, this.program.peer, importDeclaration.peer)
|
|
@@ -70,9 +70,15 @@ export class ImportStorage {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
// Drop import statements generated by compiler in the beginning of the ETSModule
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
const module = this.program.ast as ETSModule
|
|
74
|
+
this.program.setAst(
|
|
75
|
+
factory.updateETSModule(
|
|
76
|
+
module,
|
|
77
|
+
newStatements,
|
|
78
|
+
module.ident,
|
|
79
|
+
module.getNamespaceFlag(),
|
|
80
|
+
module.program,
|
|
81
|
+
)
|
|
76
82
|
)
|
|
77
83
|
}
|
|
78
84
|
}
|
|
@@ -18,7 +18,7 @@ import { defaultFilter, listPrograms } from "./plugins"
|
|
|
18
18
|
import { Program } from "../generated"
|
|
19
19
|
|
|
20
20
|
export class ProgramProvider {
|
|
21
|
-
//
|
|
21
|
+
// Improve: migrate to wrappers instead of pointers
|
|
22
22
|
seenPrograms: Set<KNativePointer> = new Set<KNativePointer>()
|
|
23
23
|
queue: Program[] = []
|
|
24
24
|
|
|
@@ -14,8 +14,12 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import {
|
|
17
|
+
BlockStatement,
|
|
18
|
+
CallExpression,
|
|
17
19
|
ClassDefinition,
|
|
20
|
+
ClassProperty,
|
|
18
21
|
ETSImportDeclaration,
|
|
22
|
+
ETSModule,
|
|
19
23
|
ETSStructDeclaration,
|
|
20
24
|
ETSTuple,
|
|
21
25
|
ETSTypeReferencePart,
|
|
@@ -27,7 +31,7 @@ import {
|
|
|
27
31
|
} from "../../generated"
|
|
28
32
|
import { factory as generatedFactory } from "../../generated/factory"
|
|
29
33
|
import { createScriptFunction, updateScriptFunction } from "../node-utilities/ScriptFunction"
|
|
30
|
-
import {
|
|
34
|
+
import { updateCallExpression } from "../node-utilities/CallExpression"
|
|
31
35
|
import { createNumberLiteral, updateNumberLiteral } from "../node-utilities/NumberLiteral"
|
|
32
36
|
import { updateMemberExpression } from "../node-utilities/MemberExpression"
|
|
33
37
|
import { createETSParameterExpression, updateETSParameterExpression } from "../node-utilities/ETSParameterExpression"
|
|
@@ -37,26 +41,25 @@ import { updateETSImportDeclaration } from "../node-utilities/ETSImportDeclarati
|
|
|
37
41
|
import { updateVariableDeclarator } from "../node-utilities/VariableDeclarator"
|
|
38
42
|
import { updateClassDefinition } from "../node-utilities/ClassDefinition"
|
|
39
43
|
import { updateETSStructDeclaration } from "../node-utilities/ETSStructDeclaration"
|
|
40
|
-
import {
|
|
44
|
+
import { updateClassProperty } from "../node-utilities/ClassProperty"
|
|
41
45
|
import { createETSFunctionType, updateETSFunctionType } from "../node-utilities/ETSFunctionType"
|
|
42
46
|
import { createMethodDefinition, updateMethodDefinition } from "../node-utilities/MethodDefinition"
|
|
43
47
|
import { createTSInterfaceDeclaration, updateTSInterfaceDeclaration } from "../node-utilities/TSInterfaceDeclaration"
|
|
44
|
-
import { createArrowFunctionExpression, updateArrowFunctionExpression } from "../node-utilities/ArrowFunctionExpression"
|
|
45
48
|
import { updateTryStatement } from "../node-utilities/TryStatement"
|
|
46
|
-
import { createVariableDeclaration, updateVariableDeclaration } from "../node-utilities/VariableDeclaration"
|
|
47
49
|
import { createAssignmentExpression, updateAssignmentExpression } from "../node-utilities/AssignmentExpression"
|
|
48
50
|
import { updateObjectExpression } from "../node-utilities/ObjectExpression"
|
|
49
51
|
import { updateETSTuple } from "../node-utilities/ETSTuple"
|
|
50
52
|
import { createArrayExpression, updateArrayExpression } from "../node-utilities/ArrayExpression"
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import { createBlockStatement, updateBlockStatement } from "../node-utilities/BlockStatement"
|
|
54
|
-
import { updateAnnotationUsage } from "../node-utilities/AnnotationUsage"
|
|
53
|
+
import { updateBlockStatement } from "../node-utilities/BlockStatement"
|
|
54
|
+
import { updateETSModule } from "../node-utilities/ETSModule"
|
|
55
55
|
|
|
56
56
|
export const factory = {
|
|
57
57
|
...generatedFactory,
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
createETSModule: ETSModule.createETSModule,
|
|
60
|
+
updateETSModule,
|
|
61
|
+
|
|
62
|
+
createCallExpression: CallExpression.createCallExpression,
|
|
60
63
|
updateCallExpression,
|
|
61
64
|
|
|
62
65
|
createMemberExpression: MemberExpression.createMemberExpression,
|
|
@@ -83,19 +86,13 @@ export const factory = {
|
|
|
83
86
|
createVariableDeclarator: VariableDeclarator.create1VariableDeclarator,
|
|
84
87
|
updateVariableDeclarator,
|
|
85
88
|
|
|
86
|
-
createVariableDeclaration,
|
|
87
|
-
updateVariableDeclaration,
|
|
88
|
-
|
|
89
89
|
createETSStructDeclaration: ETSStructDeclaration.createETSStructDeclaration,
|
|
90
90
|
updateETSStructDeclaration,
|
|
91
91
|
|
|
92
92
|
createClassDefinition: ClassDefinition.createClassDefinition,
|
|
93
93
|
updateClassDefinition,
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
updateClassDeclaration,
|
|
97
|
-
|
|
98
|
-
createClassProperty,
|
|
95
|
+
createClassProperty: ClassProperty.createClassProperty,
|
|
99
96
|
updateClassProperty,
|
|
100
97
|
|
|
101
98
|
createETSFunctionType,
|
|
@@ -107,9 +104,6 @@ export const factory = {
|
|
|
107
104
|
createInterfaceDeclaration: createTSInterfaceDeclaration,
|
|
108
105
|
updateInterfaceDeclaration: updateTSInterfaceDeclaration,
|
|
109
106
|
|
|
110
|
-
createArrowFunctionExpression,
|
|
111
|
-
updateArrowFunctionExpression,
|
|
112
|
-
|
|
113
107
|
createTryStatement: TryStatement.createTryStatement,
|
|
114
108
|
updateTryStatement,
|
|
115
109
|
|
|
@@ -125,13 +119,8 @@ export const factory = {
|
|
|
125
119
|
createArrayExpression,
|
|
126
120
|
updateArrayExpression,
|
|
127
121
|
|
|
128
|
-
|
|
129
|
-
updateTSTypeAliasDeclaration,
|
|
130
|
-
|
|
131
|
-
createBlockStatement,
|
|
122
|
+
createBlockStatement: BlockStatement.createBlockStatement,
|
|
132
123
|
updateBlockStatement,
|
|
133
124
|
|
|
134
|
-
|
|
135
|
-
update1AnnotationUsage: generatedFactory.updateAnnotationUsage,
|
|
136
|
-
updateInterfaceBody : generatedFactory.updateTSInterfaceBody
|
|
125
|
+
updateInterfaceBody : generatedFactory.updateTSInterfaceBody,
|
|
137
126
|
}
|
|
@@ -22,21 +22,19 @@ export * from "./factory/nodeFactory"
|
|
|
22
22
|
export * from "./visitor"
|
|
23
23
|
export * from "./AbstractVisitor"
|
|
24
24
|
export * from "./ChainExpressionFilter"
|
|
25
|
-
export * from "./CheckedBackFilter"
|
|
26
|
-
export * from "./SetBaseOverloads"
|
|
27
25
|
export * from "./plugins"
|
|
28
26
|
export * from "./ImportStorage"
|
|
29
|
-
export * from "./InferVoidReturnType"
|
|
30
27
|
export * from "./ProgramProvider"
|
|
31
|
-
export * from "./CompileWithCache"
|
|
32
28
|
|
|
33
29
|
export * from "./peers/AstNode"
|
|
34
30
|
export * from "./peers/Config"
|
|
35
31
|
export * from "./peers/Context"
|
|
32
|
+
export { GlobalContext } from "./peers/Context"
|
|
36
33
|
export * from "./peers/ExternalSource"
|
|
37
34
|
export * from "./peers/Options"
|
|
38
35
|
export * from "./node-utilities/ArkTsConfig"
|
|
39
36
|
export * from "./node-utilities/Program"
|
|
40
37
|
export * from "./peers/ImportPathManager"
|
|
38
|
+
export * from "./static/globalUtils"
|
|
41
39
|
export { global as arktsGlobal } from "./static/global"
|
|
42
40
|
export * from "./wrapper-compat"
|
|
@@ -17,10 +17,6 @@ import { BlockStatement, Statement } from "../../generated"
|
|
|
17
17
|
import { isSameNativeObject } from "../peers/ArktsObject"
|
|
18
18
|
import { updateNodeByNode } from "../utilities/private"
|
|
19
19
|
|
|
20
|
-
export function createBlockStatement(statements: readonly Statement[]): BlockStatement {
|
|
21
|
-
return BlockStatement.createBlockStatement(statements)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
20
|
export function updateBlockStatement(original: BlockStatement, statements: readonly Statement[]): BlockStatement {
|
|
25
21
|
if (isSameNativeObject(statements, original.statements)) {
|
|
26
22
|
return original
|
|
@@ -17,27 +17,6 @@ import { BlockStatement, CallExpression, Expression, TSTypeParameterInstantiatio
|
|
|
17
17
|
import { isSameNativeObject } from "../peers/ArktsObject"
|
|
18
18
|
import { updateNodeByNode } from "../utilities/private"
|
|
19
19
|
|
|
20
|
-
export function createCallExpression(
|
|
21
|
-
callee: Expression | undefined,
|
|
22
|
-
_arguments: readonly Expression[],
|
|
23
|
-
typeParams: TSTypeParameterInstantiation | undefined,
|
|
24
|
-
optional_arg: boolean = false,
|
|
25
|
-
trailingComma: boolean = false,
|
|
26
|
-
trailingBlock: BlockStatement | undefined = undefined,
|
|
27
|
-
): CallExpression {
|
|
28
|
-
const res = CallExpression.createCallExpression(
|
|
29
|
-
callee,
|
|
30
|
-
_arguments,
|
|
31
|
-
typeParams,
|
|
32
|
-
optional_arg,
|
|
33
|
-
trailingComma,
|
|
34
|
-
)
|
|
35
|
-
if (trailingBlock) {
|
|
36
|
-
res.setTrailingBlock(trailingBlock)
|
|
37
|
-
}
|
|
38
|
-
return res
|
|
39
|
-
}
|
|
40
|
-
|
|
41
20
|
export function updateCallExpression(
|
|
42
21
|
original: CallExpression,
|
|
43
22
|
callee: Expression | undefined,
|
|
@@ -57,7 +36,7 @@ export function updateCallExpression(
|
|
|
57
36
|
return original
|
|
58
37
|
}
|
|
59
38
|
return updateNodeByNode(
|
|
60
|
-
createCallExpression(callee, _arguments, typeParams, optional_arg, trailingComma, trailingBlock),
|
|
39
|
+
CallExpression.createCallExpression(callee, _arguments, typeParams, optional_arg, trailingComma, trailingBlock),
|
|
61
40
|
original
|
|
62
41
|
)
|
|
63
42
|
}
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import {
|
|
17
|
+
AnnotationUsage,
|
|
17
18
|
ClassDefinition,
|
|
18
19
|
Expression,
|
|
19
20
|
Identifier,
|
|
20
|
-
isMethodDefinition,
|
|
21
21
|
MethodDefinition,
|
|
22
22
|
TSClassImplements,
|
|
23
23
|
TSTypeParameterDeclaration,
|
|
@@ -27,7 +27,6 @@ import { isSameNativeObject } from "../peers/ArktsObject"
|
|
|
27
27
|
import { updateNodeByNode } from "../utilities/private"
|
|
28
28
|
import { AstNode } from "../peers/AstNode"
|
|
29
29
|
import { Es2pandaClassDefinitionModifiers, Es2pandaModifierFlags } from "../../generated/Es2pandaEnums"
|
|
30
|
-
import { throwError } from "../../utils"
|
|
31
30
|
|
|
32
31
|
export function updateClassDefinition(
|
|
33
32
|
original: ClassDefinition,
|
|
@@ -39,11 +38,9 @@ export function updateClassDefinition(
|
|
|
39
38
|
superClass: Expression | undefined,
|
|
40
39
|
body: readonly AstNode[],
|
|
41
40
|
modifiers: Es2pandaClassDefinitionModifiers,
|
|
42
|
-
flags: Es2pandaModifierFlags
|
|
41
|
+
flags: Es2pandaModifierFlags,
|
|
42
|
+
annotations?: readonly AnnotationUsage[]
|
|
43
43
|
): ClassDefinition {
|
|
44
|
-
if (original.ctor !== undefined && !isMethodDefinition(original.ctor)) {
|
|
45
|
-
throwError(`class definition constructor is not method definition: ${ctor?.dump()}`)
|
|
46
|
-
}
|
|
47
44
|
if (isSameNativeObject(ident, original.ident)
|
|
48
45
|
&& (isSameNativeObject(typeParams, original.typeParams))
|
|
49
46
|
&& (isSameNativeObject(superTypeParams, original.superTypeParams))
|
|
@@ -53,6 +50,7 @@ export function updateClassDefinition(
|
|
|
53
50
|
&& (isSameNativeObject(body, original.body))
|
|
54
51
|
&& (isSameNativeObject(modifiers, original.modifiers))
|
|
55
52
|
&& (isSameNativeObject(flags, original.modifierFlags))
|
|
53
|
+
&& (isSameNativeObject(annotations, original.annotations))
|
|
56
54
|
) {
|
|
57
55
|
return original
|
|
58
56
|
}
|
|
@@ -66,8 +64,9 @@ export function updateClassDefinition(
|
|
|
66
64
|
superClass,
|
|
67
65
|
body,
|
|
68
66
|
modifiers,
|
|
69
|
-
flags
|
|
70
|
-
|
|
67
|
+
flags,
|
|
68
|
+
annotations,
|
|
69
|
+
),
|
|
71
70
|
original
|
|
72
71
|
)
|
|
73
72
|
}
|
|
@@ -18,27 +18,6 @@ import { Es2pandaModifierFlags } from "../../generated/Es2pandaEnums"
|
|
|
18
18
|
import { isSameNativeObject } from "../peers/ArktsObject"
|
|
19
19
|
import { updateNodeByNode } from "../utilities/private"
|
|
20
20
|
|
|
21
|
-
export function createClassProperty(
|
|
22
|
-
key: Expression | undefined,
|
|
23
|
-
value: Expression | undefined,
|
|
24
|
-
typeAnnotation: TypeNode | undefined,
|
|
25
|
-
modifiers: Es2pandaModifierFlags,
|
|
26
|
-
isComputed: boolean,
|
|
27
|
-
annotations?: readonly AnnotationUsage[],
|
|
28
|
-
): ClassProperty {
|
|
29
|
-
const res = ClassProperty.createClassProperty(
|
|
30
|
-
key,
|
|
31
|
-
value,
|
|
32
|
-
typeAnnotation,
|
|
33
|
-
modifiers,
|
|
34
|
-
isComputed,
|
|
35
|
-
)
|
|
36
|
-
if (annotations) {
|
|
37
|
-
res.setAnnotations(annotations)
|
|
38
|
-
}
|
|
39
|
-
return res
|
|
40
|
-
}
|
|
41
|
-
|
|
42
21
|
export function updateClassProperty(
|
|
43
22
|
original: ClassProperty,
|
|
44
23
|
key: Expression | undefined,
|
|
@@ -58,7 +37,7 @@ export function updateClassProperty(
|
|
|
58
37
|
return original
|
|
59
38
|
}
|
|
60
39
|
return updateNodeByNode(
|
|
61
|
-
createClassProperty(key, value, typeAnnotation, modifiers, isComputed, annotations),
|
|
40
|
+
ClassProperty.createClassProperty(key, value, typeAnnotation, modifiers, isComputed, annotations),
|
|
62
41
|
original
|
|
63
42
|
)
|
|
64
43
|
}
|
|
@@ -26,7 +26,7 @@ export function createETSFunctionType(
|
|
|
26
26
|
funcFlags: Es2pandaScriptFunctionFlags,
|
|
27
27
|
annotations?: readonly AnnotationUsage[],
|
|
28
28
|
): ETSFunctionType {
|
|
29
|
-
|
|
29
|
+
return ETSFunctionType.createETSFunctionType(
|
|
30
30
|
FunctionSignature.createFunctionSignature(
|
|
31
31
|
typeParams,
|
|
32
32
|
params,
|
|
@@ -34,11 +34,8 @@ export function createETSFunctionType(
|
|
|
34
34
|
hasReceiver,
|
|
35
35
|
),
|
|
36
36
|
funcFlags,
|
|
37
|
+
annotations,
|
|
37
38
|
)
|
|
38
|
-
if (annotations) {
|
|
39
|
-
res.setAnnotations(annotations)
|
|
40
|
-
}
|
|
41
|
-
return res
|
|
42
39
|
}
|
|
43
40
|
|
|
44
41
|
export function updateETSFunctionType(
|
|
@@ -29,7 +29,7 @@ export function updateETSImportDeclaration(
|
|
|
29
29
|
&& isSameNativeObject(specifiers, original.specifiers)
|
|
30
30
|
/* no getter for importKind */
|
|
31
31
|
) {
|
|
32
|
-
/*
|
|
32
|
+
/* Improve: probably should set importMetadata, but no getter provided yet */
|
|
33
33
|
return original
|
|
34
34
|
}
|
|
35
35
|
return updateNodeByNode(
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 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 { ETSModule, Identifier, Program, Statement } from "../../generated"
|
|
17
|
+
import { isSameNativeObject } from "../peers/ArktsObject"
|
|
18
|
+
import { updateNodeByNode } from "../utilities/private"
|
|
19
|
+
import { Es2pandaModuleFlag } from "../../generated/Es2pandaEnums"
|
|
20
|
+
|
|
21
|
+
export function updateETSModule(
|
|
22
|
+
original: ETSModule,
|
|
23
|
+
statementList: readonly Statement[],
|
|
24
|
+
ident: Identifier | undefined,
|
|
25
|
+
flag: Es2pandaModuleFlag,
|
|
26
|
+
program?: Program,
|
|
27
|
+
) {
|
|
28
|
+
if (isSameNativeObject(statementList, original.statements)
|
|
29
|
+
&& isSameNativeObject(ident, original.ident)
|
|
30
|
+
&& isSameNativeObject(flag, original.getNamespaceFlag())
|
|
31
|
+
&& isSameNativeObject(program, original.program)
|
|
32
|
+
) {
|
|
33
|
+
return original
|
|
34
|
+
}
|
|
35
|
+
return updateNodeByNode(
|
|
36
|
+
ETSModule.createETSModule(
|
|
37
|
+
statementList,
|
|
38
|
+
ident,
|
|
39
|
+
flag,
|
|
40
|
+
program,
|
|
41
|
+
),
|
|
42
|
+
original,
|
|
43
|
+
)
|
|
44
|
+
}
|
|
@@ -23,13 +23,10 @@ export function createETSParameterExpression(
|
|
|
23
23
|
initExpr?: Expression,
|
|
24
24
|
annotations?: readonly AnnotationUsage[]
|
|
25
25
|
): ETSParameterExpression {
|
|
26
|
-
const res = ETSParameterExpression.createETSParameterExpression(identOrSpread, isOptional)
|
|
26
|
+
const res = ETSParameterExpression.createETSParameterExpression(identOrSpread, isOptional, annotations)
|
|
27
27
|
if (initExpr) {
|
|
28
28
|
res.setInitializer(initExpr)
|
|
29
29
|
}
|
|
30
|
-
if (annotations) {
|
|
31
|
-
res.setAnnotations(annotations)
|
|
32
|
-
}
|
|
33
30
|
return res
|
|
34
31
|
}
|
|
35
32
|
|
|
@@ -13,11 +13,10 @@
|
|
|
13
13
|
* limitations under the License.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import {
|
|
16
|
+
import { Expression, MethodDefinition } from "../../generated"
|
|
17
17
|
import {
|
|
18
18
|
Es2pandaMethodDefinitionKind,
|
|
19
19
|
Es2pandaModifierFlags,
|
|
20
|
-
Es2pandaScriptFunctionFlags
|
|
21
20
|
} from "../../generated/Es2pandaEnums"
|
|
22
21
|
import { isSameNativeObject } from "../peers/ArktsObject"
|
|
23
22
|
import { updateNodeByNode } from "../utilities/private"
|
|
@@ -30,22 +29,14 @@ export function createMethodDefinition(
|
|
|
30
29
|
isComputed: boolean,
|
|
31
30
|
overloads?: readonly MethodDefinition[]
|
|
32
31
|
): MethodDefinition {
|
|
33
|
-
|
|
32
|
+
return MethodDefinition.createMethodDefinition(
|
|
34
33
|
kind,
|
|
35
34
|
key,
|
|
36
35
|
value,
|
|
37
36
|
modifiers,
|
|
38
37
|
isComputed,
|
|
38
|
+
overloads,
|
|
39
39
|
)
|
|
40
|
-
if (overloads) {
|
|
41
|
-
res.setOverloads(overloads)
|
|
42
|
-
// TODO: once node utilities are generated, this would be made in methodDefinitionUpdateChildren
|
|
43
|
-
overloads.forEach(it => {
|
|
44
|
-
it.setBaseOverloadMethod(res)
|
|
45
|
-
it.parent = res
|
|
46
|
-
})
|
|
47
|
-
}
|
|
48
|
-
return res
|
|
49
40
|
}
|
|
50
41
|
|
|
51
42
|
export function updateMethodDefinition(
|
|
@@ -28,7 +28,7 @@ export function updateObjectExpression(
|
|
|
28
28
|
ObjectExpression.createObjectExpression(
|
|
29
29
|
nodeType(original),
|
|
30
30
|
properties,
|
|
31
|
-
false), //
|
|
31
|
+
false), // Improve: provide trailingComma value from native module through ObjectExpression?
|
|
32
32
|
original
|
|
33
33
|
)
|
|
34
34
|
}
|
|
@@ -13,19 +13,8 @@
|
|
|
13
13
|
* limitations under the License.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import { ExternalSource } from "../peers/ExternalSource"
|
|
17
|
-
import { acceptNativeObjectArrayResult } from "../utilities/private"
|
|
18
|
-
import { KNativePointer } from "@koalaui/interop"
|
|
19
|
-
import { global } from "../static/global"
|
|
20
16
|
import { Program } from "../../generated"
|
|
21
17
|
|
|
22
|
-
export function programGetExternalSources(program: Program, context: KNativePointer = global.context): ExternalSource[] {
|
|
23
|
-
return acceptNativeObjectArrayResult<ExternalSource>(
|
|
24
|
-
global.es2panda._ProgramExternalSources(context, program.peer),
|
|
25
|
-
(instance: KNativePointer) => new ExternalSource(instance)
|
|
26
|
-
)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
18
|
export function dumpProgramInfo(program: Program) {
|
|
30
19
|
console.log(`Program info:`)
|
|
31
20
|
console.log(`\tAbsoluteName: ${program.absoluteName}`)
|
|
@@ -38,3 +27,13 @@ export function dumpProgramInfo(program: Program) {
|
|
|
38
27
|
console.log(`\tSourceFileFolder: ${program.sourceFileFolder}`)
|
|
39
28
|
console.log(`\tSourceFilePath: ${program.sourceFilePath}`)
|
|
40
29
|
}
|
|
30
|
+
|
|
31
|
+
export function dumpProgramSrcFormatted(program: Program, recursive: boolean, withLines: boolean = true) {
|
|
32
|
+
const lines = program.ast.dumpSrc()
|
|
33
|
+
console.log(`// file: ${program.absoluteName}`)
|
|
34
|
+
if (withLines) {
|
|
35
|
+
console.log(lines.split('\n').map((it, index) => `${`${index + 1}`.padStart(4)} |${it}`).join('\n'))
|
|
36
|
+
} else {
|
|
37
|
+
console.log(lines)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -26,6 +26,7 @@ import { AstNode } from "../peers/AstNode"
|
|
|
26
26
|
import { Es2pandaModifierFlags, Es2pandaScriptFunctionFlags } from "../../generated/Es2pandaEnums"
|
|
27
27
|
import { isSameNativeObject } from "../peers/ArktsObject"
|
|
28
28
|
import { updateNodeByNode } from "../utilities/private"
|
|
29
|
+
import { KNativePointer } from "@koalaui/interop"
|
|
29
30
|
|
|
30
31
|
export function createScriptFunction(
|
|
31
32
|
databody: AstNode | undefined,
|
|
@@ -37,6 +38,8 @@ export function createScriptFunction(
|
|
|
37
38
|
dataflags: Es2pandaModifierFlags,
|
|
38
39
|
ident: Identifier | undefined,
|
|
39
40
|
annotations: readonly AnnotationUsage[] | undefined,
|
|
41
|
+
signaturePointer?: KNativePointer,
|
|
42
|
+
preferredReturnTypePointer?: KNativePointer,
|
|
40
43
|
) {
|
|
41
44
|
const res = ScriptFunction.createScriptFunction(
|
|
42
45
|
databody,
|
|
@@ -47,13 +50,15 @@ export function createScriptFunction(
|
|
|
47
50
|
hasReceiver,
|
|
48
51
|
),
|
|
49
52
|
datafuncFlags,
|
|
50
|
-
dataflags
|
|
53
|
+
dataflags,
|
|
54
|
+
ident,
|
|
55
|
+
annotations,
|
|
51
56
|
)
|
|
52
|
-
if (
|
|
53
|
-
res.
|
|
57
|
+
if (signaturePointer) {
|
|
58
|
+
res.setSignaturePointer(signaturePointer)
|
|
54
59
|
}
|
|
55
|
-
if (
|
|
56
|
-
res.
|
|
60
|
+
if (preferredReturnTypePointer) {
|
|
61
|
+
res.setPreferredReturnTypePointer(preferredReturnTypePointer)
|
|
57
62
|
}
|
|
58
63
|
return res
|
|
59
64
|
}
|
|
@@ -69,6 +74,8 @@ export function updateScriptFunction(
|
|
|
69
74
|
dataflags: Es2pandaModifierFlags,
|
|
70
75
|
ident: Identifier | undefined,
|
|
71
76
|
annotations: readonly AnnotationUsage[] | undefined,
|
|
77
|
+
signaturePointer?: KNativePointer,
|
|
78
|
+
preferredReturnTypePointer?: KNativePointer,
|
|
72
79
|
) {
|
|
73
80
|
if (isSameNativeObject(databody, original.body)
|
|
74
81
|
&& isSameNativeObject(typeParams, original.typeParams)
|
|
@@ -79,6 +86,8 @@ export function updateScriptFunction(
|
|
|
79
86
|
&& isSameNativeObject(dataflags, original.modifierFlags)
|
|
80
87
|
&& isSameNativeObject(ident, original.id)
|
|
81
88
|
&& isSameNativeObject(annotations, original.annotations)
|
|
89
|
+
&& signaturePointer == original.getSignaturePointer()
|
|
90
|
+
&& preferredReturnTypePointer == original.getPreferredReturnTypePointer()
|
|
82
91
|
) {
|
|
83
92
|
return original
|
|
84
93
|
}
|
|
@@ -92,7 +101,9 @@ export function updateScriptFunction(
|
|
|
92
101
|
datafuncFlags,
|
|
93
102
|
dataflags,
|
|
94
103
|
ident,
|
|
95
|
-
annotations
|
|
104
|
+
annotations,
|
|
105
|
+
signaturePointer,
|
|
106
|
+
preferredReturnTypePointer,
|
|
96
107
|
),
|
|
97
108
|
original
|
|
98
109
|
)
|
|
@@ -32,18 +32,15 @@ export function createTSInterfaceDeclaration(
|
|
|
32
32
|
isExternal: boolean,
|
|
33
33
|
modifierFlags?: Es2pandaModifierFlags,
|
|
34
34
|
): TSInterfaceDeclaration {
|
|
35
|
-
|
|
35
|
+
return TSInterfaceDeclaration.createTSInterfaceDeclaration(
|
|
36
36
|
_extends,
|
|
37
37
|
id,
|
|
38
38
|
typeParams,
|
|
39
39
|
body,
|
|
40
40
|
isStatic,
|
|
41
|
-
isExternal
|
|
41
|
+
isExternal,
|
|
42
|
+
modifierFlags,
|
|
42
43
|
)
|
|
43
|
-
if (modifierFlags) {
|
|
44
|
-
res.modifierFlags = modifierFlags
|
|
45
|
-
}
|
|
46
|
-
return res
|
|
47
44
|
}
|
|
48
45
|
|
|
49
46
|
export function updateTSInterfaceDeclaration(
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
import { isNullPtr, KInt, KNativePointer, nullptr } from "@koalaui/interop"
|
|
17
17
|
import { global } from "../static/global"
|
|
18
|
-
import { allFlags, unpackNodeArray, unpackNonNullableNode, unpackString } from "../utilities/private"
|
|
18
|
+
import { allFlags, unpackNode, unpackNodeArray, unpackNonNullableNode, unpackString } from "../utilities/private"
|
|
19
19
|
import { throwError } from "../../utils"
|
|
20
20
|
import { Es2pandaModifierFlags } from "../../generated/Es2pandaEnums"
|
|
21
21
|
import { ArktsObject } from "./ArktsObject"
|
|
@@ -117,7 +117,7 @@ export abstract class AstNode extends ArktsObject {
|
|
|
117
117
|
|
|
118
118
|
public get parent(): AstNode | undefined {
|
|
119
119
|
const parent = global.generatedEs2panda._AstNodeParent(global.context, this.peer);
|
|
120
|
-
return
|
|
120
|
+
return unpackNode(parent);
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
public set parent(node: AstNode | undefined) {
|
|
@@ -151,7 +151,7 @@ export abstract class AstNode extends ArktsObject {
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
public override onUpdate(original: AstNode): void {
|
|
154
|
-
//
|
|
154
|
+
// Improve: Update modifiers only for specific AST nodes in the generated factory code
|
|
155
155
|
this.modifierFlags = original.modifierFlags
|
|
156
156
|
global.generatedEs2panda._AstNodeSetOriginalNode(global.context, this.peer, original.originalPeer)
|
|
157
157
|
global.generatedEs2panda._AstNodeSetParent(global.context, this.peer, global.generatedEs2panda._AstNodeParent(global.context, original.peer))
|
|
@@ -21,7 +21,7 @@ import { KNativePointer, nullptr } from "@koalaui/interop"
|
|
|
21
21
|
export class Config extends ArktsObject {
|
|
22
22
|
constructor(peer: KNativePointer) {
|
|
23
23
|
super(peer)
|
|
24
|
-
//
|
|
24
|
+
// Improve: wait for getter from api
|
|
25
25
|
this.path = ``
|
|
26
26
|
}
|
|
27
27
|
|