@idlizer/arktscgen 2.1.7 → 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 -75
- package/build/libarkts-copy/native/meson_options.txt +6 -0
- package/build/libarkts-copy/native/src/bridges.cc +271 -8
- package/build/libarkts-copy/native/src/common.cc +166 -45
- package/build/libarkts-copy/native/src/common.h +53 -8
- package/build/libarkts-copy/native/src/generated/bridges.cc +2654 -319
- package/build/libarkts-copy/package.json +31 -17
- package/build/libarkts-copy/src/Es2pandaNativeModule.ts +97 -3
- 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 +86 -8
- 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 +10 -17
- package/build/libarkts-copy/src/arkts-api/class-by-peer.ts +2 -3
- package/build/libarkts-copy/src/arkts-api/factory/nodeFactory.ts +89 -6
- package/build/libarkts-copy/src/arkts-api/index.ts +10 -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 +3 -3
- 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 -33
- 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 +2 -2
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSNonNullExpression.ts +27 -0
- 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 +75 -12
- package/build/libarkts-copy/src/arkts-api/peers/Config.ts +8 -1
- package/build/libarkts-copy/src/arkts-api/peers/Context.ts +71 -4
- package/build/libarkts-copy/src/arkts-api/peers/{Program.ts → ExternalSource.ts} +2 -22
- package/build/libarkts-copy/src/arkts-api/peers/Options.ts +34 -0
- package/build/libarkts-copy/src/arkts-api/plugins.ts +26 -12
- package/build/libarkts-copy/src/arkts-api/static/global.ts +7 -4
- package/build/libarkts-copy/src/arkts-api/static/profiler.ts +180 -23
- package/build/libarkts-copy/src/arkts-api/utilities/private.ts +32 -8
- package/build/libarkts-copy/src/arkts-api/utilities/public.ts +54 -12
- package/build/libarkts-copy/src/arkts-api/visitor.ts +32 -37
- 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 +778 -63
- 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 +15 -9
- 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 +13 -1
- package/build/libarkts-copy/src/plugin-utils.ts +117 -0
- package/build/libarkts-copy/src/utils.ts +17 -28
- 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/lib/index.js +323 -148
- 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
|
@@ -0,0 +1,907 @@
|
|
|
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
|
+
import { global } from '../../arkts-api/static/global';
|
|
16
|
+
import { KInt, KNativePointer, KNativePointer as KPtr, nullptr } from '@koalaui/interop';
|
|
17
|
+
import {
|
|
18
|
+
Es2pandaAstNodeType,
|
|
19
|
+
Es2pandaContextState,
|
|
20
|
+
Es2pandaMethodDefinitionKind,
|
|
21
|
+
Es2pandaTokenType,
|
|
22
|
+
Es2pandaVariableDeclarationKind,
|
|
23
|
+
Es2pandaVariableDeclaratorFlag,
|
|
24
|
+
} from '../../generated/Es2pandaEnums';
|
|
25
|
+
import {
|
|
26
|
+
allFlags,
|
|
27
|
+
arrayOfNullptr,
|
|
28
|
+
assertValidPeer,
|
|
29
|
+
passNode,
|
|
30
|
+
passNodeArray,
|
|
31
|
+
passString,
|
|
32
|
+
unpackNode,
|
|
33
|
+
unpackNodeArray,
|
|
34
|
+
unpackNonNullableNode,
|
|
35
|
+
updatePeerByNode,
|
|
36
|
+
} from './utilities/private';
|
|
37
|
+
import { proceedToState } from './utilities/public';
|
|
38
|
+
import { AstNode } from './peers/AstNode';
|
|
39
|
+
import { Config } from './peers/Config';
|
|
40
|
+
import { Context } from './peers/Context';
|
|
41
|
+
import { nodeByType } from './class-by-peer';
|
|
42
|
+
import { MemberExpression } from './to-be-generated/MemberExpression';
|
|
43
|
+
import {
|
|
44
|
+
AnnotationUsage,
|
|
45
|
+
ArrayExpression,
|
|
46
|
+
BlockStatement,
|
|
47
|
+
ClassDefinition,
|
|
48
|
+
ETSTypeReference,
|
|
49
|
+
ETSTypeReferencePart,
|
|
50
|
+
Expression,
|
|
51
|
+
Identifier,
|
|
52
|
+
Literal,
|
|
53
|
+
ObjectExpression,
|
|
54
|
+
ScriptFunction,
|
|
55
|
+
TSTypeParameterDeclaration,
|
|
56
|
+
TSTypeParameterInstantiation,
|
|
57
|
+
TypeNode,
|
|
58
|
+
} from '../../generated';
|
|
59
|
+
import { createCallExpression, updateCallExpression } from 'src/arkts-api/node-utilities/CallExpression';
|
|
60
|
+
|
|
61
|
+
export class EtsScript extends AstNode {
|
|
62
|
+
constructor(peer: KPtr) {
|
|
63
|
+
assertValidPeer(peer, Es2pandaAstNodeType.AST_NODE_TYPE_ETS_MODULE);
|
|
64
|
+
super(peer);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
static fromContext(): EtsScript {
|
|
68
|
+
console.log('[TS WRAPPER] GET AST FROM CONTEXT');
|
|
69
|
+
return new EtsScript(
|
|
70
|
+
global.es2panda._ProgramAst(global.context, global.es2panda._ContextProgram(global.context))
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @deprecated
|
|
76
|
+
*/
|
|
77
|
+
static createFromSource(
|
|
78
|
+
source: string,
|
|
79
|
+
state: Es2pandaContextState = Es2pandaContextState.ES2PANDA_STATE_PARSED
|
|
80
|
+
): EtsScript {
|
|
81
|
+
if (!global.configIsInitialized()) {
|
|
82
|
+
global.config = Config.createDefault().peer;
|
|
83
|
+
}
|
|
84
|
+
global.compilerContext = Context.createFromString(source) as any; // TODO commonize context
|
|
85
|
+
proceedToState(state, global.context);
|
|
86
|
+
return new EtsScript(
|
|
87
|
+
global.es2panda._ProgramAst(global.context, global.es2panda._ContextProgram(global.context))
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @deprecated
|
|
93
|
+
*/
|
|
94
|
+
static updateByStatements(node: EtsScript, statements: readonly AstNode[]): EtsScript {
|
|
95
|
+
global.generatedEs2panda._BlockStatementSetStatements(
|
|
96
|
+
global.context,
|
|
97
|
+
node.peer,
|
|
98
|
+
passNodeArray(statements),
|
|
99
|
+
statements.length
|
|
100
|
+
);
|
|
101
|
+
return node;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
get statements(): readonly AstNode[] {
|
|
105
|
+
return unpackNodeArray(global.generatedEs2panda._BlockStatementStatements(global.context, this.peer));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
set statements(nodes: readonly AstNode[]) {
|
|
109
|
+
global.generatedEs2panda._BlockStatementSetStatements(
|
|
110
|
+
global.context,
|
|
111
|
+
this.peer,
|
|
112
|
+
passNodeArray(nodes),
|
|
113
|
+
nodes.length
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export class ExpressionStatement extends AstNode {
|
|
119
|
+
constructor(peer: KPtr) {
|
|
120
|
+
assertValidPeer(peer, Es2pandaAstNodeType.AST_NODE_TYPE_EXPRESSION_STATEMENT);
|
|
121
|
+
super(peer);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
static create(expression: AstNode): ExpressionStatement {
|
|
125
|
+
return new ExpressionStatement(
|
|
126
|
+
global.generatedEs2panda._CreateExpressionStatement(global.context, expression.peer)
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
static update(node: ExpressionStatement, expression: AstNode): ExpressionStatement {
|
|
131
|
+
return new ExpressionStatement(
|
|
132
|
+
global.generatedEs2panda._UpdateExpressionStatement(global.context, node.peer, expression.peer)
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
get expression(): AstNode {
|
|
137
|
+
return unpackNonNullableNode(
|
|
138
|
+
global.generatedEs2panda._ExpressionStatementGetExpressionConst(global.context, this.peer)
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
/** @deprecated */
|
|
142
|
+
setExpression(expr?: Expression): this {
|
|
143
|
+
global.generatedEs2panda._ExpressionStatementSetExpression(global.context, this.peer, passNode(expr));
|
|
144
|
+
return this;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// TODO:
|
|
149
|
+
// the CallExpression idl Create signature doesn't include the trailing block at all.
|
|
150
|
+
// Need to clarify with the compiler people if they will provide create signature with a trailing block argument.
|
|
151
|
+
export class CallExpression extends Expression {
|
|
152
|
+
constructor(peer: KPtr) {
|
|
153
|
+
assertValidPeer(peer, Es2pandaAstNodeType.AST_NODE_TYPE_CALL_EXPRESSION);
|
|
154
|
+
super(peer);
|
|
155
|
+
this.expression = unpackNonNullableNode(
|
|
156
|
+
global.generatedEs2panda._CallExpressionCallee(global.context, this.peer)
|
|
157
|
+
);
|
|
158
|
+
this.typeParams = unpackNode(global.generatedEs2panda._CallExpressionTypeParams(global.context, this.peer));
|
|
159
|
+
this.typeArguments = this.typeParams
|
|
160
|
+
? unpackNodeArray(
|
|
161
|
+
global.generatedEs2panda._TSTypeParameterInstantiationParamsConst(
|
|
162
|
+
global.context,
|
|
163
|
+
this.typeParams.peer
|
|
164
|
+
)
|
|
165
|
+
)
|
|
166
|
+
: undefined;
|
|
167
|
+
this.arguments = unpackNodeArray(global.generatedEs2panda._CallExpressionArguments(global.context, this.peer));
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
static create(
|
|
171
|
+
expression: AstNode,
|
|
172
|
+
typeArguments: readonly TypeNode[] | undefined,
|
|
173
|
+
args: readonly AstNode[] | undefined,
|
|
174
|
+
isOptional: boolean = false,
|
|
175
|
+
trailingComma: boolean = false
|
|
176
|
+
): CallExpression {
|
|
177
|
+
const peer = global.generatedEs2panda._CreateCallExpression(
|
|
178
|
+
global.context,
|
|
179
|
+
passNode(expression),
|
|
180
|
+
passNodeArray(args),
|
|
181
|
+
args?.length ?? 0,
|
|
182
|
+
typeArguments
|
|
183
|
+
? passNode(TSTypeParameterInstantiation.createTSTypeParameterInstantiation(typeArguments))
|
|
184
|
+
: nullptr,
|
|
185
|
+
isOptional,
|
|
186
|
+
trailingComma
|
|
187
|
+
);
|
|
188
|
+
return new CallExpression(peer);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
static update(
|
|
192
|
+
node: CallExpression,
|
|
193
|
+
expression: AstNode,
|
|
194
|
+
typeArguments: readonly TypeNode[] | undefined,
|
|
195
|
+
args: readonly AstNode[] | undefined,
|
|
196
|
+
isOptional: boolean = false,
|
|
197
|
+
trailingComma: boolean = false
|
|
198
|
+
): CallExpression {
|
|
199
|
+
const other = CallExpression.create(expression, typeArguments, args, isOptional, trailingComma)
|
|
200
|
+
const peer = global.generatedEs2panda._UpdateCallExpression1(
|
|
201
|
+
global.context,
|
|
202
|
+
node.peer,
|
|
203
|
+
other.peer,
|
|
204
|
+
);
|
|
205
|
+
return new CallExpression(peer);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
get trailingBlock(): BlockStatement | undefined {
|
|
209
|
+
return unpackNode(global.generatedEs2panda._CallExpressionTrailingBlockConst(global.context, this.peer));
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
setTralingBlock(trailingBlock: BlockStatement | undefined): this {
|
|
213
|
+
if (!trailingBlock) return this;
|
|
214
|
+
global.generatedEs2panda._CallExpressionSetTrailingBlock(global.context, this.peer, trailingBlock.peer);
|
|
215
|
+
return this;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/** @deprecated */
|
|
219
|
+
setCallee(callee?: Expression): this {
|
|
220
|
+
global.generatedEs2panda._CallExpressionSetCallee(global.context, this.peer, passNode(callee));
|
|
221
|
+
return this;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/** @deprecated */
|
|
225
|
+
setTypeParams(typeParams?: TSTypeParameterInstantiation): this {
|
|
226
|
+
global.generatedEs2panda._CallExpressionSetTypeParams(global.context, this.peer, passNode(typeParams));
|
|
227
|
+
return this;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
readonly expression: AstNode; // Expression
|
|
231
|
+
readonly typeArguments: readonly TypeNode[] | undefined;
|
|
232
|
+
readonly arguments: readonly Expression[];
|
|
233
|
+
readonly typeParams: TSTypeParameterInstantiation | undefined;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export class AssignmentExpression extends AstNode {
|
|
237
|
+
constructor(peer: KPtr) {
|
|
238
|
+
assertValidPeer(peer, Es2pandaAstNodeType.AST_NODE_TYPE_ASSIGNMENT_EXPRESSION);
|
|
239
|
+
super(peer);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
static create(left: AstNode, assignmentOperator: Es2pandaTokenType, right: AstNode): AssignmentExpression {
|
|
243
|
+
return new AssignmentExpression(
|
|
244
|
+
global.generatedEs2panda._CreateAssignmentExpression(
|
|
245
|
+
global.context,
|
|
246
|
+
passNode(left),
|
|
247
|
+
passNode(right),
|
|
248
|
+
assignmentOperator
|
|
249
|
+
)
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
static update(
|
|
254
|
+
node: AssignmentExpression,
|
|
255
|
+
left: AstNode,
|
|
256
|
+
assignmentOperator: Es2pandaTokenType,
|
|
257
|
+
right: AstNode
|
|
258
|
+
): AssignmentExpression {
|
|
259
|
+
return new AssignmentExpression(
|
|
260
|
+
global.generatedEs2panda._UpdateAssignmentExpression(
|
|
261
|
+
global.context,
|
|
262
|
+
node.peer,
|
|
263
|
+
passNode(left),
|
|
264
|
+
passNode(right),
|
|
265
|
+
assignmentOperator
|
|
266
|
+
)
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
get left(): Expression | undefined {
|
|
271
|
+
return unpackNode(global.generatedEs2panda._AssignmentExpressionLeftConst(global.context, this.peer));
|
|
272
|
+
}
|
|
273
|
+
get right(): Expression | undefined {
|
|
274
|
+
return unpackNode(global.generatedEs2panda._AssignmentExpressionRightConst(global.context, this.peer));
|
|
275
|
+
}
|
|
276
|
+
get operatorType(): Es2pandaTokenType {
|
|
277
|
+
return global.generatedEs2panda._AssignmentExpressionOperatorTypeConst(global.context, this.peer);
|
|
278
|
+
}
|
|
279
|
+
/** @deprecated */
|
|
280
|
+
setRight(expr?: Expression): this {
|
|
281
|
+
global.generatedEs2panda._AssignmentExpressionSetRight(global.context, this.peer, passNode(expr));
|
|
282
|
+
return this;
|
|
283
|
+
}
|
|
284
|
+
/** @deprecated */
|
|
285
|
+
setLeft(expr?: Expression): this {
|
|
286
|
+
global.generatedEs2panda._AssignmentExpressionSetLeft(global.context, this.peer, passNode(expr));
|
|
287
|
+
return this;
|
|
288
|
+
}
|
|
289
|
+
setOperatorType(operatorType: Es2pandaTokenType): this {
|
|
290
|
+
global.generatedEs2panda._AssignmentExpressionSetOperatorType(global.context, this.peer, operatorType);
|
|
291
|
+
return this;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export class TSUnionType extends AstNode {
|
|
296
|
+
constructor(peer: KPtr) {
|
|
297
|
+
assertValidPeer(peer, Es2pandaAstNodeType.AST_NODE_TYPE_TS_UNION_TYPE);
|
|
298
|
+
super(peer);
|
|
299
|
+
this.types = unpackNodeArray(global.generatedEs2panda._TSUnionTypeTypesConst(global.context, this.peer));
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
static create(node: undefined | TSUnionType, types: AstNode[]): TSUnionType {
|
|
303
|
+
return new TSUnionType(
|
|
304
|
+
updatePeerByNode(
|
|
305
|
+
global.generatedEs2panda._CreateTSUnionType(global.context, passNodeArray(types), types.length),
|
|
306
|
+
node
|
|
307
|
+
)
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
readonly types: readonly AstNode[];
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export class NumberLiteral extends Literal {
|
|
315
|
+
constructor(peer: KPtr) {
|
|
316
|
+
assertValidPeer(peer, Es2pandaAstNodeType.AST_NODE_TYPE_NUMBER_LITERAL);
|
|
317
|
+
super(peer);
|
|
318
|
+
this.value = 0.0;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
static create(value: number): NumberLiteral {
|
|
322
|
+
return new NumberLiteral(global.es2panda._CreateNumberLiteral(global.context, value));
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
protected override dumpMessage(): string {
|
|
326
|
+
return ` <value: ${this.value}>`;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
readonly value: number = 0.0;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
export class ArrowFunctionExpression extends Expression {
|
|
333
|
+
constructor(peer: KPtr) {
|
|
334
|
+
assertValidPeer(peer, Es2pandaAstNodeType.AST_NODE_TYPE_ARROW_FUNCTION_EXPRESSION);
|
|
335
|
+
super(peer);
|
|
336
|
+
this.scriptFunction = unpackNonNullableNode(
|
|
337
|
+
global.generatedEs2panda._ArrowFunctionExpressionFunction(global.context, this.peer)
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
static create(func: ScriptFunction): ArrowFunctionExpression {
|
|
342
|
+
return new ArrowFunctionExpression(
|
|
343
|
+
global.generatedEs2panda._CreateArrowFunctionExpression(global.context, passNode(func))
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
static update(node: ArrowFunctionExpression, func: ScriptFunction): ArrowFunctionExpression {
|
|
348
|
+
return new ArrowFunctionExpression(
|
|
349
|
+
global.generatedEs2panda._UpdateArrowFunctionExpression(global.context, node.peer, passNode(func))
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
get annotations(): AnnotationUsage[] {
|
|
354
|
+
return unpackNodeArray(global.generatedEs2panda._ArrowFunctionExpressionAnnotations(global.context, this.peer));
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
setAnnotations(annotations: AnnotationUsage[]): this {
|
|
358
|
+
global.generatedEs2panda._ArrowFunctionExpressionSetAnnotations(
|
|
359
|
+
global.context,
|
|
360
|
+
this.peer,
|
|
361
|
+
passNodeArray(annotations),
|
|
362
|
+
annotations.length
|
|
363
|
+
);
|
|
364
|
+
|
|
365
|
+
return this;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
readonly scriptFunction: ScriptFunction;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
export class FunctionDeclaration extends AstNode {
|
|
372
|
+
constructor(peer: KPtr) {
|
|
373
|
+
assertValidPeer(peer, Es2pandaAstNodeType.AST_NODE_TYPE_FUNCTION_DECLARATION);
|
|
374
|
+
super(peer);
|
|
375
|
+
this.scriptFunction = unpackNonNullableNode(
|
|
376
|
+
global.generatedEs2panda._FunctionDeclarationFunction(global.context, this.peer)
|
|
377
|
+
);
|
|
378
|
+
this.parameters = unpackNodeArray(
|
|
379
|
+
global.generatedEs2panda._ScriptFunctionParams(global.context, this.scriptFunction.peer)
|
|
380
|
+
);
|
|
381
|
+
this.name = unpackNode(global.generatedEs2panda._ScriptFunctionId(global.context, this.scriptFunction.peer));
|
|
382
|
+
this.body = unpackNode(global.generatedEs2panda._ScriptFunctionBody(global.context, this.scriptFunction.peer));
|
|
383
|
+
this.typeParamsDecl = unpackNode(
|
|
384
|
+
global.generatedEs2panda._ScriptFunctionTypeParams(global.context, this.scriptFunction.peer)
|
|
385
|
+
);
|
|
386
|
+
this.returnType = unpackNode(
|
|
387
|
+
global.generatedEs2panda._ScriptFunctionReturnTypeAnnotation(global.context, this.scriptFunction.peer)
|
|
388
|
+
);
|
|
389
|
+
this.isAnon = global.generatedEs2panda._FunctionDeclarationIsAnonymousConst(global.context, this.peer);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
static create(
|
|
393
|
+
scriptFunction: ScriptFunction,
|
|
394
|
+
isAnon: boolean,
|
|
395
|
+
annotations?: AnnotationUsage[]
|
|
396
|
+
): FunctionDeclaration {
|
|
397
|
+
const res = new FunctionDeclaration(
|
|
398
|
+
global.generatedEs2panda._CreateFunctionDeclaration(
|
|
399
|
+
global.context,
|
|
400
|
+
scriptFunction.peer,
|
|
401
|
+
// TODO: support annotations
|
|
402
|
+
arrayOfNullptr,
|
|
403
|
+
0,
|
|
404
|
+
isAnon
|
|
405
|
+
)
|
|
406
|
+
);
|
|
407
|
+
// TODO: maybe wrong
|
|
408
|
+
res.modifiers = scriptFunction.modifiers;
|
|
409
|
+
if (annotations) {
|
|
410
|
+
res.annotations = annotations;
|
|
411
|
+
}
|
|
412
|
+
return res;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
static update(
|
|
416
|
+
node: FunctionDeclaration,
|
|
417
|
+
scriptFunction: ScriptFunction,
|
|
418
|
+
isAnon: boolean,
|
|
419
|
+
annotations?: AnnotationUsage[]
|
|
420
|
+
): FunctionDeclaration {
|
|
421
|
+
const res = new FunctionDeclaration(
|
|
422
|
+
global.generatedEs2panda._UpdateFunctionDeclaration(
|
|
423
|
+
global.context,
|
|
424
|
+
node.peer,
|
|
425
|
+
scriptFunction.peer,
|
|
426
|
+
// TODO: support annotations
|
|
427
|
+
passNodeArray(annotations),
|
|
428
|
+
0,
|
|
429
|
+
isAnon
|
|
430
|
+
)
|
|
431
|
+
);
|
|
432
|
+
if (annotations) {
|
|
433
|
+
res.annotations = annotations;
|
|
434
|
+
}
|
|
435
|
+
return res;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
get annotations(): AnnotationUsage[] {
|
|
439
|
+
return unpackNodeArray(
|
|
440
|
+
global.generatedEs2panda._FunctionDeclarationAnnotationsConst(global.context, this.peer)
|
|
441
|
+
);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
set annotations(newAnnotations: AnnotationUsage[]) {
|
|
445
|
+
global.generatedEs2panda._FunctionDeclarationSetAnnotations(
|
|
446
|
+
global.context,
|
|
447
|
+
this.peer,
|
|
448
|
+
passNodeArray(newAnnotations),
|
|
449
|
+
newAnnotations.length
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
readonly scriptFunction: ScriptFunction;
|
|
454
|
+
readonly parameters: readonly AstNode[];
|
|
455
|
+
readonly name?: Identifier;
|
|
456
|
+
readonly body?: BlockStatement;
|
|
457
|
+
readonly typeParamsDecl?: TSTypeParameterDeclaration;
|
|
458
|
+
readonly returnType?: AstNode;
|
|
459
|
+
readonly isAnon: boolean;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
export class FunctionExpression extends AstNode {
|
|
463
|
+
constructor(peer: KPtr) {
|
|
464
|
+
assertValidPeer(peer, Es2pandaAstNodeType.AST_NODE_TYPE_FUNCTION_EXPRESSION);
|
|
465
|
+
super(peer);
|
|
466
|
+
this.scriptFunction = unpackNonNullableNode(
|
|
467
|
+
global.generatedEs2panda._FunctionExpressionFunction(global.context, this.peer)
|
|
468
|
+
);
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
static create(expression: ScriptFunction): FunctionExpression {
|
|
472
|
+
return new FunctionExpression(
|
|
473
|
+
global.generatedEs2panda._CreateFunctionExpression(global.context, passNode(expression))
|
|
474
|
+
);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
static update(node: FunctionExpression, expression: ScriptFunction): FunctionExpression {
|
|
478
|
+
return new FunctionExpression(
|
|
479
|
+
global.generatedEs2panda._UpdateFunctionExpression(global.context, node.peer, passNode(expression))
|
|
480
|
+
);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
readonly scriptFunction: ScriptFunction;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
export class ETSParameterExpression extends Expression {
|
|
487
|
+
constructor(peer: KPtr) {
|
|
488
|
+
assertValidPeer(peer, Es2pandaAstNodeType.AST_NODE_TYPE_ETS_PARAMETER_EXPRESSION);
|
|
489
|
+
super(peer);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
static create(identifier: Identifier, initializer: AstNode | undefined): ETSParameterExpression {
|
|
493
|
+
if (initializer !== undefined) {
|
|
494
|
+
return new ETSParameterExpression(
|
|
495
|
+
global.generatedEs2panda._CreateETSParameterExpression1(
|
|
496
|
+
global.context,
|
|
497
|
+
passNode(identifier),
|
|
498
|
+
passNode(initializer)
|
|
499
|
+
)
|
|
500
|
+
);
|
|
501
|
+
}
|
|
502
|
+
return new ETSParameterExpression(
|
|
503
|
+
global.generatedEs2panda._CreateETSParameterExpression(global.context, passNode(identifier), false)
|
|
504
|
+
);
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
static update(
|
|
508
|
+
node: ETSParameterExpression,
|
|
509
|
+
identifier: Identifier,
|
|
510
|
+
initializer: AstNode | undefined
|
|
511
|
+
): ETSParameterExpression {
|
|
512
|
+
if (initializer !== undefined) {
|
|
513
|
+
return new ETSParameterExpression(
|
|
514
|
+
global.generatedEs2panda._UpdateETSParameterExpression1(
|
|
515
|
+
global.context,
|
|
516
|
+
node.peer,
|
|
517
|
+
passNode(identifier),
|
|
518
|
+
passNode(initializer)
|
|
519
|
+
)
|
|
520
|
+
);
|
|
521
|
+
}
|
|
522
|
+
return new ETSParameterExpression(
|
|
523
|
+
global.generatedEs2panda._UpdateETSParameterExpression(
|
|
524
|
+
global.context,
|
|
525
|
+
node.peer,
|
|
526
|
+
passNode(identifier),
|
|
527
|
+
false
|
|
528
|
+
)
|
|
529
|
+
);
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
get annotations(): AnnotationUsage[] {
|
|
533
|
+
return unpackNodeArray(global.generatedEs2panda._ETSParameterExpressionAnnotations(global.context, this.peer/*, nullptr*/));
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
set annotations(newAnnotations: AnnotationUsage[]) {
|
|
537
|
+
global.generatedEs2panda._ETSParameterExpressionSetAnnotations(
|
|
538
|
+
global.context,
|
|
539
|
+
this.peer,
|
|
540
|
+
passNodeArray(newAnnotations),
|
|
541
|
+
newAnnotations.length
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
get type(): AstNode | undefined {
|
|
546
|
+
return unpackNode(global.generatedEs2panda._ETSParameterExpressionTypeAnnotation(global.context, this.peer));
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
set type(t: AstNode | undefined) {
|
|
550
|
+
if (t === undefined) return;
|
|
551
|
+
global.generatedEs2panda._ETSParameterExpressionSetTypeAnnotation(global.context, this.peer, t.peer);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
get optional(): Boolean {
|
|
555
|
+
return global.generatedEs2panda._ETSParameterExpressionIsOptionalConst(global.context, this.peer);
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
get initializer(): Expression | undefined {
|
|
559
|
+
return unpackNode(global.generatedEs2panda._ETSParameterExpressionInitializerConst(global.context, this.peer));
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
/** @deprecated */
|
|
563
|
+
setInitializer(initExpr?: Expression): this {
|
|
564
|
+
global.generatedEs2panda._ETSParameterExpressionSetInitializer(global.context, this.peer, passNode(initExpr));
|
|
565
|
+
return this;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
setOptional(value: boolean): this {
|
|
569
|
+
global.generatedEs2panda._ETSParameterExpressionSetOptional(global.context, this.peer, value);
|
|
570
|
+
return this;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
get identifier(): Identifier {
|
|
574
|
+
return unpackNonNullableNode(
|
|
575
|
+
global.generatedEs2panda._ETSParameterExpressionIdentConst(global.context, this.peer)
|
|
576
|
+
);
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
/** @deprecated */
|
|
580
|
+
setIdent(ident?: Identifier): this {
|
|
581
|
+
global.generatedEs2panda._ETSParameterExpressionSetIdent(global.context, this.peer, passNode(ident));
|
|
582
|
+
return this;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
export class IfStatement extends AstNode {
|
|
587
|
+
constructor(peer: KPtr) {
|
|
588
|
+
assertValidPeer(peer, Es2pandaAstNodeType.AST_NODE_TYPE_IF_STATEMENT);
|
|
589
|
+
super(peer);
|
|
590
|
+
this.test = unpackNonNullableNode(global.generatedEs2panda._IfStatementTest(global.context, this.peer));
|
|
591
|
+
this.consequent = unpackNonNullableNode(
|
|
592
|
+
global.generatedEs2panda._IfStatementConsequent(global.context, this.peer)
|
|
593
|
+
);
|
|
594
|
+
this.alternate = unpackNode(global.generatedEs2panda._IfStatementAlternate(global.context, this.peer));
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
static create(test: AstNode, consequent: AstNode, alternate?: AstNode): IfStatement {
|
|
598
|
+
return new IfStatement(
|
|
599
|
+
global.generatedEs2panda._CreateIfStatement(
|
|
600
|
+
global.context,
|
|
601
|
+
passNode(test),
|
|
602
|
+
passNode(consequent),
|
|
603
|
+
passNode(alternate)
|
|
604
|
+
)
|
|
605
|
+
);
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
static update(node: IfStatement, test: AstNode, consequent: AstNode, alternate?: AstNode): IfStatement {
|
|
609
|
+
return new IfStatement(
|
|
610
|
+
global.generatedEs2panda._UpdateIfStatement(
|
|
611
|
+
global.context,
|
|
612
|
+
node.peer,
|
|
613
|
+
passNode(test),
|
|
614
|
+
passNode(consequent),
|
|
615
|
+
passNode(alternate)
|
|
616
|
+
)
|
|
617
|
+
);
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
test: AstNode;
|
|
621
|
+
consequent: AstNode;
|
|
622
|
+
alternate: AstNode | undefined;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
export class StructDeclaration extends AstNode {
|
|
626
|
+
constructor(peer: KPtr) {
|
|
627
|
+
assertValidPeer(peer, Es2pandaAstNodeType.AST_NODE_TYPE_STRUCT_DECLARATION);
|
|
628
|
+
super(peer);
|
|
629
|
+
// TODO: is struct definition the same as struct definition?
|
|
630
|
+
this.definition = unpackNonNullableNode(
|
|
631
|
+
global.generatedEs2panda._ClassDeclarationDefinition(global.context, this.peer)
|
|
632
|
+
);
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
static create(definition: ClassDefinition): StructDeclaration {
|
|
636
|
+
return new StructDeclaration(
|
|
637
|
+
global.generatedEs2panda._CreateETSStructDeclaration(global.context, passNode(definition))
|
|
638
|
+
);
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
static update(node: StructDeclaration, definition: ClassDefinition): StructDeclaration {
|
|
642
|
+
return new StructDeclaration(
|
|
643
|
+
global.generatedEs2panda._UpdateETSStructDeclaration(global.context, node.peer, passNode(definition))
|
|
644
|
+
);
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
readonly definition: ClassDefinition;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
export class MethodDefinition extends AstNode {
|
|
651
|
+
constructor(peer: KPtr, key?: KPtr) {
|
|
652
|
+
assertValidPeer(peer, Es2pandaAstNodeType.AST_NODE_TYPE_METHOD_DEFINITION);
|
|
653
|
+
super(peer);
|
|
654
|
+
this.kind = global.generatedEs2panda._MethodDefinitionKindConst(global.context, this.peer);
|
|
655
|
+
this.funcExpr = unpackNonNullableNode(global.generatedEs2panda._ClassElementValue(global.context, this.peer));
|
|
656
|
+
this.scriptFunction = this.funcExpr.scriptFunction;
|
|
657
|
+
assertValidPeer(this.scriptFunction.peer, Es2pandaAstNodeType.AST_NODE_TYPE_SCRIPT_FUNCTION);
|
|
658
|
+
|
|
659
|
+
// Somehow the scriptFunction cannot attach method's key to its ident after checker
|
|
660
|
+
if (key) {
|
|
661
|
+
assertValidPeer(key, Es2pandaAstNodeType.AST_NODE_TYPE_IDENTIFIER);
|
|
662
|
+
const _name = unpackNonNullableNode(key);
|
|
663
|
+
this.scriptFunction = this.scriptFunction.setIdent(_name as Identifier);
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
this.name = unpackNonNullableNode(
|
|
667
|
+
global.generatedEs2panda._ScriptFunctionId(global.context, this.scriptFunction.peer)
|
|
668
|
+
);
|
|
669
|
+
this.kind = global.generatedEs2panda._MethodDefinitionKindConst(global.context, this.peer);
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
static create(
|
|
673
|
+
kind: Es2pandaMethodDefinitionKind,
|
|
674
|
+
key: AstNode,
|
|
675
|
+
value: ScriptFunction,
|
|
676
|
+
modifiers: KInt,
|
|
677
|
+
isComputed: boolean
|
|
678
|
+
): MethodDefinition {
|
|
679
|
+
return new MethodDefinition(
|
|
680
|
+
global.generatedEs2panda._CreateMethodDefinition(
|
|
681
|
+
global.context,
|
|
682
|
+
kind,
|
|
683
|
+
passNode(key),
|
|
684
|
+
passNode(FunctionExpression.create(value)),
|
|
685
|
+
modifiers,
|
|
686
|
+
isComputed
|
|
687
|
+
),
|
|
688
|
+
key.peer
|
|
689
|
+
);
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
static update(
|
|
693
|
+
node: MethodDefinition,
|
|
694
|
+
kind: Es2pandaMethodDefinitionKind,
|
|
695
|
+
key: AstNode,
|
|
696
|
+
value: ScriptFunction,
|
|
697
|
+
modifiers: KInt,
|
|
698
|
+
isComputed: boolean
|
|
699
|
+
): MethodDefinition {
|
|
700
|
+
return new MethodDefinition(
|
|
701
|
+
global.generatedEs2panda._UpdateMethodDefinition(
|
|
702
|
+
global.context,
|
|
703
|
+
node.peer,
|
|
704
|
+
kind,
|
|
705
|
+
passNode(key),
|
|
706
|
+
passNode(FunctionExpression.update(node.funcExpr, value)),
|
|
707
|
+
modifiers,
|
|
708
|
+
isComputed
|
|
709
|
+
),
|
|
710
|
+
key.peer
|
|
711
|
+
);
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
// TODO: does not work
|
|
715
|
+
isConstructor(): boolean {
|
|
716
|
+
return global.generatedEs2panda._MethodDefinitionIsConstructorConst(global.context, this.peer);
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
get overloads(): readonly MethodDefinition[] {
|
|
720
|
+
return unpackNodeArray(global.generatedEs2panda._MethodDefinitionOverloadsConst(global.context, this.peer));
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
setOverloads(overloads: readonly MethodDefinition[]): this {
|
|
724
|
+
global.generatedEs2panda._MethodDefinitionSetOverloads(
|
|
725
|
+
global.context,
|
|
726
|
+
this.peer,
|
|
727
|
+
passNodeArray(overloads),
|
|
728
|
+
overloads.length
|
|
729
|
+
);
|
|
730
|
+
return this;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
readonly kind: Es2pandaMethodDefinitionKind;
|
|
734
|
+
readonly scriptFunction: ScriptFunction;
|
|
735
|
+
readonly name: Identifier;
|
|
736
|
+
readonly funcExpr: FunctionExpression;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
export class VariableDeclaration extends AstNode {
|
|
740
|
+
constructor(peer: KPtr) {
|
|
741
|
+
assertValidPeer(peer, Es2pandaAstNodeType.AST_NODE_TYPE_VARIABLE_DECLARATION);
|
|
742
|
+
super(peer);
|
|
743
|
+
this.declarationKind = global.generatedEs2panda._VariableDeclarationKindConst(global.context, this.peer);
|
|
744
|
+
this.declarators = unpackNodeArray(
|
|
745
|
+
global.generatedEs2panda._VariableDeclarationDeclaratorsConst(global.context, this.peer)
|
|
746
|
+
);
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
static create(
|
|
750
|
+
modifiers: KInt,
|
|
751
|
+
kind: Es2pandaVariableDeclarationKind,
|
|
752
|
+
declarators: readonly VariableDeclarator[]
|
|
753
|
+
): VariableDeclaration {
|
|
754
|
+
const peer = global.generatedEs2panda._CreateVariableDeclaration(
|
|
755
|
+
global.context,
|
|
756
|
+
kind,
|
|
757
|
+
passNodeArray(declarators),
|
|
758
|
+
declarators.length
|
|
759
|
+
);
|
|
760
|
+
global.generatedEs2panda._AstNodeClearModifier(global.context, peer, allFlags);
|
|
761
|
+
global.generatedEs2panda._AstNodeAddModifier(global.context, peer, modifiers);
|
|
762
|
+
return new VariableDeclaration(peer);
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
static update(
|
|
766
|
+
node: VariableDeclaration,
|
|
767
|
+
modifiers: KInt,
|
|
768
|
+
kind: Es2pandaVariableDeclarationKind,
|
|
769
|
+
declarators: readonly VariableDeclarator[]
|
|
770
|
+
): VariableDeclaration {
|
|
771
|
+
const peer = global.generatedEs2panda._UpdateVariableDeclaration(
|
|
772
|
+
global.context,
|
|
773
|
+
node.peer,
|
|
774
|
+
kind,
|
|
775
|
+
passNodeArray(declarators),
|
|
776
|
+
declarators.length
|
|
777
|
+
);
|
|
778
|
+
global.generatedEs2panda._AstNodeClearModifier(global.context, peer, allFlags);
|
|
779
|
+
global.generatedEs2panda._AstNodeAddModifier(global.context, peer, modifiers);
|
|
780
|
+
return new VariableDeclaration(peer);
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
get annotations(): readonly AnnotationUsage[] {
|
|
784
|
+
return unpackNodeArray(
|
|
785
|
+
global.generatedEs2panda._VariableDeclarationAnnotationsConst(global.context, this.peer)
|
|
786
|
+
);
|
|
787
|
+
}
|
|
788
|
+
/** @deprecated */
|
|
789
|
+
setAnnotations(annotations: readonly AnnotationUsage[]): this {
|
|
790
|
+
global.generatedEs2panda._VariableDeclarationSetAnnotations(
|
|
791
|
+
global.context,
|
|
792
|
+
this.peer,
|
|
793
|
+
passNodeArray(annotations),
|
|
794
|
+
annotations.length
|
|
795
|
+
);
|
|
796
|
+
return this;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
readonly declarationKind: Es2pandaVariableDeclarationKind;
|
|
800
|
+
readonly declarators: readonly VariableDeclarator[];
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
export class VariableDeclarator extends AstNode {
|
|
804
|
+
constructor(peer: KPtr) {
|
|
805
|
+
assertValidPeer(peer, Es2pandaAstNodeType.AST_NODE_TYPE_VARIABLE_DECLARATOR);
|
|
806
|
+
super(peer);
|
|
807
|
+
this.name = unpackNonNullableNode(global.generatedEs2panda._VariableDeclaratorId(global.context, this.peer));
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
static create(
|
|
811
|
+
flag: Es2pandaVariableDeclaratorFlag,
|
|
812
|
+
name: Identifier,
|
|
813
|
+
initializer: AstNode | undefined
|
|
814
|
+
): VariableDeclarator {
|
|
815
|
+
const peer = global.generatedEs2panda._CreateVariableDeclarator(global.context, flag, passNode(name));
|
|
816
|
+
if (initializer !== undefined) {
|
|
817
|
+
global.generatedEs2panda._VariableDeclaratorSetInit(global.context, peer, initializer.peer);
|
|
818
|
+
}
|
|
819
|
+
return new VariableDeclarator(peer);
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
static update(
|
|
823
|
+
node: VariableDeclarator,
|
|
824
|
+
flag: Es2pandaVariableDeclaratorFlag,
|
|
825
|
+
name: Identifier,
|
|
826
|
+
initializer: AstNode | undefined
|
|
827
|
+
): VariableDeclarator {
|
|
828
|
+
const peer = global.generatedEs2panda._UpdateVariableDeclarator(
|
|
829
|
+
global.context,
|
|
830
|
+
node.peer,
|
|
831
|
+
flag,
|
|
832
|
+
passNode(name)
|
|
833
|
+
);
|
|
834
|
+
if (initializer !== undefined) {
|
|
835
|
+
global.generatedEs2panda._VariableDeclaratorSetInit(global.context, peer, initializer.peer);
|
|
836
|
+
}
|
|
837
|
+
return new VariableDeclarator(peer);
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
get initializer(): AstNode | undefined {
|
|
841
|
+
return unpackNode(global.generatedEs2panda._VariableDeclaratorInit(global.context, this.peer));
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
/** @deprecated */
|
|
845
|
+
setInit(init?: Expression): this {
|
|
846
|
+
global.generatedEs2panda._VariableDeclaratorSetInit(global.context, this.peer, passNode(init));
|
|
847
|
+
return this;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
get flag(): Es2pandaVariableDeclaratorFlag {
|
|
851
|
+
return global.generatedEs2panda._VariableDeclaratorFlag(global.context, this.peer);
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
readonly name: Identifier;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
export class SuperExpression extends AstNode {
|
|
858
|
+
constructor(peer: KPtr) {
|
|
859
|
+
assertValidPeer(peer, Es2pandaAstNodeType.AST_NODE_TYPE_SUPER_EXPRESSION);
|
|
860
|
+
super(peer);
|
|
861
|
+
this.id = unpackNode(global.generatedEs2panda._TSInterfaceDeclarationId(global.context, this.peer));
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
static create(): SuperExpression {
|
|
865
|
+
return new SuperExpression(global.generatedEs2panda._CreateSuperExpression(global.context));
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
readonly id?: Identifier;
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
export class ETSStringLiteralType extends TypeNode {
|
|
872
|
+
constructor(peer: KPtr) {
|
|
873
|
+
assertValidPeer(peer, Es2pandaAstNodeType.AST_NODE_TYPE_ETS_STRING_LITERAL_TYPE);
|
|
874
|
+
super(peer);
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
static create(str: string): ETSStringLiteralType {
|
|
878
|
+
return new ETSStringLiteralType(global.generatedEs2panda._CreateETSStringLiteralType(global.context, passString(str)));
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
const pairs: [Es2pandaAstNodeType, { new (peer: KNativePointer): AstNode }][] = [
|
|
883
|
+
[Es2pandaAstNodeType.AST_NODE_TYPE_ETS_MODULE, EtsScript],
|
|
884
|
+
[Es2pandaAstNodeType.AST_NODE_TYPE_IDENTIFIER, Identifier],
|
|
885
|
+
[Es2pandaAstNodeType.AST_NODE_TYPE_NUMBER_LITERAL, NumberLiteral],
|
|
886
|
+
[Es2pandaAstNodeType.AST_NODE_TYPE_EXPRESSION_STATEMENT, ExpressionStatement],
|
|
887
|
+
[Es2pandaAstNodeType.AST_NODE_TYPE_FUNCTION_DECLARATION, FunctionDeclaration],
|
|
888
|
+
[Es2pandaAstNodeType.AST_NODE_TYPE_SCRIPT_FUNCTION, ScriptFunction],
|
|
889
|
+
[Es2pandaAstNodeType.AST_NODE_TYPE_BLOCK_STATEMENT, BlockStatement],
|
|
890
|
+
[Es2pandaAstNodeType.AST_NODE_TYPE_ETS_PARAMETER_EXPRESSION, ETSParameterExpression],
|
|
891
|
+
[Es2pandaAstNodeType.AST_NODE_TYPE_TS_TYPE_PARAMETER_DECLARATION, TSTypeParameterDeclaration],
|
|
892
|
+
[Es2pandaAstNodeType.AST_NODE_TYPE_CALL_EXPRESSION, CallExpression],
|
|
893
|
+
[Es2pandaAstNodeType.AST_NODE_TYPE_MEMBER_EXPRESSION, MemberExpression],
|
|
894
|
+
[Es2pandaAstNodeType.AST_NODE_TYPE_IF_STATEMENT, IfStatement],
|
|
895
|
+
[Es2pandaAstNodeType.AST_NODE_TYPE_ARROW_FUNCTION_EXPRESSION, ArrowFunctionExpression],
|
|
896
|
+
[Es2pandaAstNodeType.AST_NODE_TYPE_STRUCT_DECLARATION, StructDeclaration],
|
|
897
|
+
[Es2pandaAstNodeType.AST_NODE_TYPE_METHOD_DEFINITION, MethodDefinition],
|
|
898
|
+
[Es2pandaAstNodeType.AST_NODE_TYPE_ASSIGNMENT_EXPRESSION, AssignmentExpression],
|
|
899
|
+
[Es2pandaAstNodeType.AST_NODE_TYPE_VARIABLE_DECLARATION, VariableDeclaration],
|
|
900
|
+
[Es2pandaAstNodeType.AST_NODE_TYPE_VARIABLE_DECLARATOR, VariableDeclarator],
|
|
901
|
+
[Es2pandaAstNodeType.AST_NODE_TYPE_FUNCTION_EXPRESSION, FunctionExpression],
|
|
902
|
+
[Es2pandaAstNodeType.AST_NODE_TYPE_ETS_TYPE_REFERENCE, ETSTypeReference],
|
|
903
|
+
[Es2pandaAstNodeType.AST_NODE_TYPE_ETS_TYPE_REFERENCE_PART, ETSTypeReferencePart],
|
|
904
|
+
[Es2pandaAstNodeType.AST_NODE_TYPE_OBJECT_EXPRESSION, ObjectExpression],
|
|
905
|
+
[Es2pandaAstNodeType.AST_NODE_TYPE_ARRAY_EXPRESSION, ArrayExpression],
|
|
906
|
+
];
|
|
907
|
+
pairs.forEach(([nodeType, astNode]) => nodeByType.set(nodeType, astNode));
|