@idlizer/arktscgen 2.1.10-arktscgen-3a → 2.1.10-arktscgen-5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/libarkts-copy/native/meson.build +1 -1
- package/build/libarkts-copy/native/src/bridges.cc +72 -115
- package/build/libarkts-copy/native/src/common.cc +225 -84
- package/build/libarkts-copy/native/src/common.h +22 -22
- package/build/libarkts-copy/native/src/memoryTracker.cc +30 -37
- package/build/libarkts-copy/native/src/memoryTracker.h +5 -5
- package/build/libarkts-copy/package.json +23 -19
- package/build/libarkts-copy/src/Es2pandaNativeModule.ts +176 -100
- package/build/libarkts-copy/src/InteropNativeModule.ts +18 -15
- package/build/libarkts-copy/src/arkts-api/AbstractVisitor.ts +17 -18
- package/build/libarkts-copy/src/arkts-api/ImportStorage.ts +31 -30
- package/build/libarkts-copy/src/arkts-api/ProgramProvider.ts +20 -17
- package/build/libarkts-copy/src/arkts-api/class-by-peer.ts +12 -12
- package/build/libarkts-copy/src/arkts-api/factory/nodeFactory.ts +44 -29
- package/build/libarkts-copy/src/arkts-api/index.ts +24 -24
- package/build/libarkts-copy/src/arkts-api/node-cache.ts +12 -12
- package/build/libarkts-copy/src/arkts-api/node-utilities/ArkTsConfig.ts +8 -8
- package/build/libarkts-copy/src/arkts-api/node-utilities/ArrayExpression.ts +9 -21
- package/build/libarkts-copy/src/arkts-api/node-utilities/AssignmentExpression.ts +12 -14
- package/build/libarkts-copy/src/arkts-api/node-utilities/BlockStatement.ts +5 -5
- package/build/libarkts-copy/src/arkts-api/node-utilities/CallExpression.ts +47 -13
- package/build/libarkts-copy/src/arkts-api/node-utilities/ClassDefinition.ts +62 -32
- package/build/libarkts-copy/src/arkts-api/node-utilities/ClassProperty.ts +14 -13
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSFunctionType.ts +24 -21
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSImportDeclaration.ts +10 -12
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSModule.ts +14 -18
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSParameterExpression.ts +15 -16
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSStructDeclaration.ts +5 -8
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSTuple.ts +6 -12
- package/build/libarkts-copy/src/arkts-api/node-utilities/MemberExpression.ts +12 -11
- package/build/libarkts-copy/src/arkts-api/node-utilities/MethodDefinition.ts +14 -33
- package/build/libarkts-copy/src/arkts-api/node-utilities/NumberLiteral.ts +12 -23
- package/build/libarkts-copy/src/arkts-api/node-utilities/ObjectExpression.ts +17 -21
- package/build/libarkts-copy/src/arkts-api/node-utilities/OpaqueTypeNode.ts +9 -8
- package/build/libarkts-copy/src/arkts-api/node-utilities/Program.ts +21 -16
- package/build/libarkts-copy/src/arkts-api/node-utilities/ScriptFunction.ts +80 -35
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSInterfaceDeclaration.ts +22 -32
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeParameter.ts +12 -14
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeReferencePart.ts +10 -12
- package/build/libarkts-copy/src/arkts-api/node-utilities/TryStatement.ts +10 -9
- package/build/libarkts-copy/src/arkts-api/node-utilities/VariableDeclarator.ts +10 -12
- package/build/libarkts-copy/src/arkts-api/peers/ArktsObject.ts +8 -8
- package/build/libarkts-copy/src/arkts-api/peers/AstNode.ts +53 -49
- package/build/libarkts-copy/src/arkts-api/peers/Config.ts +17 -24
- package/build/libarkts-copy/src/arkts-api/peers/Context.ts +29 -37
- package/build/libarkts-copy/src/arkts-api/peers/DiagnosticKind.ts +5 -6
- package/build/libarkts-copy/src/arkts-api/peers/ExternalSource.ts +9 -9
- package/build/libarkts-copy/src/arkts-api/peers/ImportPathManager.ts +6 -8
- package/build/libarkts-copy/src/arkts-api/peers/Options.ts +8 -8
- package/build/libarkts-copy/src/arkts-api/plugins.ts +98 -30
- package/build/libarkts-copy/src/arkts-api/static/global.ts +35 -36
- package/build/libarkts-copy/src/arkts-api/static/globalUtils.ts +5 -5
- package/build/libarkts-copy/src/arkts-api/static/profiler.ts +107 -91
- package/build/libarkts-copy/src/arkts-api/utilities/extensions.ts +54 -37
- package/build/libarkts-copy/src/arkts-api/utilities/nativePtrDecoder.ts +86 -69
- package/build/libarkts-copy/src/arkts-api/utilities/performance.ts +39 -23
- package/build/libarkts-copy/src/arkts-api/utilities/private.ts +73 -61
- package/build/libarkts-copy/src/arkts-api/utilities/public.ts +220 -173
- package/build/libarkts-copy/src/arkts-api/visitor.ts +606 -742
- package/build/libarkts-copy/src/arkts-api/wrapper-compat.ts +8 -8
- package/build/libarkts-copy/src/checkSdk.ts +15 -18
- package/build/libarkts-copy/src/index.ts +29 -29
- package/build/libarkts-copy/src/plugin-utils.ts +52 -40
- package/build/libarkts-copy/src/reexport-for-generated.ts +11 -10
- package/build/libarkts-copy/src/tracer.ts +75 -69
- package/build/libarkts-copy/src/ts-api/factory/nodeFactory.ts +134 -274
- package/build/libarkts-copy/src/ts-api/factory/nodeTests.ts +23 -23
- package/build/libarkts-copy/src/ts-api/index.ts +27 -35
- package/build/libarkts-copy/src/ts-api/static/enums.ts +3 -3
- package/build/libarkts-copy/src/ts-api/types.ts +535 -395
- package/build/libarkts-copy/src/ts-api/utilities/private.ts +115 -112
- package/build/libarkts-copy/src/ts-api/utilities/public.ts +18 -18
- package/build/libarkts-copy/src/ts-api/visitor/visitor.ts +33 -49
- package/build/libarkts-copy/src/utils.ts +97 -70
- package/build/libarkts-copy/tsconfig.json +3 -2
- package/lib/index.js +428 -159
- package/package.json +51 -53
- package/templates/Es2pandaNativeModule.ts +1 -0
- package/templates/factory.ts +1 -1
- package/templates/peer.ts +2 -1
- package/build/libarkts-copy/native/src/generated/bridges.cc +0 -16382
- package/build/libarkts-copy/src/generated/Es2pandaEnums.ts +0 -1350
- package/build/libarkts-copy/src/generated/Es2pandaNativeModule.ts +0 -5195
- package/build/libarkts-copy/src/generated/factory.ts +0 -1286
- package/build/libarkts-copy/src/generated/index.ts +0 -222
- package/build/libarkts-copy/src/generated/peers/AnnotatedAstNode.ts +0 -44
- package/build/libarkts-copy/src/generated/peers/AnnotatedExpression.ts +0 -54
- package/build/libarkts-copy/src/generated/peers/AnnotatedStatement.ts +0 -45
- package/build/libarkts-copy/src/generated/peers/AnnotationDeclaration.ts +0 -165
- package/build/libarkts-copy/src/generated/peers/AnnotationUsage.ts +0 -84
- package/build/libarkts-copy/src/generated/peers/ArkTsConfig.ts +0 -73
- package/build/libarkts-copy/src/generated/peers/ArrayExpression.ts +0 -109
- package/build/libarkts-copy/src/generated/peers/ArrowFunctionExpression.ts +0 -119
- package/build/libarkts-copy/src/generated/peers/AssertStatement.ts +0 -65
- package/build/libarkts-copy/src/generated/peers/AssignmentExpression.ts +0 -111
- package/build/libarkts-copy/src/generated/peers/AstDumper.ts +0 -49
- package/build/libarkts-copy/src/generated/peers/AstVerifier.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/AstVisitor.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/AwaitExpression.ts +0 -61
- package/build/libarkts-copy/src/generated/peers/BigIntLiteral.ts +0 -61
- package/build/libarkts-copy/src/generated/peers/BinaryExpression.ts +0 -110
- package/build/libarkts-copy/src/generated/peers/BindingProps.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/BlockExpression.ts +0 -72
- package/build/libarkts-copy/src/generated/peers/BlockStatement.ts +0 -94
- package/build/libarkts-copy/src/generated/peers/BooleanLiteral.ts +0 -61
- package/build/libarkts-copy/src/generated/peers/BreakStatement.ts +0 -78
- package/build/libarkts-copy/src/generated/peers/CallExpression.ts +0 -129
- package/build/libarkts-copy/src/generated/peers/CatchClause.ts +0 -74
- package/build/libarkts-copy/src/generated/peers/ChainExpression.ts +0 -68
- package/build/libarkts-copy/src/generated/peers/CharLiteral.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/ClassDeclaration.ts +0 -76
- package/build/libarkts-copy/src/generated/peers/ClassDefinition.ts +0 -365
- package/build/libarkts-copy/src/generated/peers/ClassElement.ts +0 -76
- package/build/libarkts-copy/src/generated/peers/ClassExpression.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/ClassProperty.ts +0 -137
- package/build/libarkts-copy/src/generated/peers/ClassStaticBlock.ts +0 -66
- package/build/libarkts-copy/src/generated/peers/CodeGen.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/ConditionalExpression.ts +0 -82
- package/build/libarkts-copy/src/generated/peers/ContinueStatement.ts +0 -78
- package/build/libarkts-copy/src/generated/peers/DebuggerStatement.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/Declaration.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/Decorator.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/DiagnosticInfo.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/DirectEvalExpression.ts +0 -60
- package/build/libarkts-copy/src/generated/peers/DoWhileStatement.ts +0 -66
- package/build/libarkts-copy/src/generated/peers/DynamicImportData.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/ETSClassLiteral.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/ETSFunctionType.ts +0 -102
- package/build/libarkts-copy/src/generated/peers/ETSImportDeclaration.ts +0 -90
- package/build/libarkts-copy/src/generated/peers/ETSIntrinsicNode.ts +0 -75
- package/build/libarkts-copy/src/generated/peers/ETSKeyofType.ts +0 -61
- package/build/libarkts-copy/src/generated/peers/ETSModule.ts +0 -129
- package/build/libarkts-copy/src/generated/peers/ETSNewArrayInstanceExpression.ts +0 -75
- package/build/libarkts-copy/src/generated/peers/ETSNewClassInstanceExpression.ts +0 -79
- package/build/libarkts-copy/src/generated/peers/ETSNewMultiDimArrayInstanceExpression.ts +0 -75
- package/build/libarkts-copy/src/generated/peers/ETSNullType.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/ETSPackageDeclaration.ts +0 -59
- package/build/libarkts-copy/src/generated/peers/ETSParameterExpression.ts +0 -189
- package/build/libarkts-copy/src/generated/peers/ETSPrimitiveType.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/ETSReExportDeclaration.ts +0 -55
- package/build/libarkts-copy/src/generated/peers/ETSStringLiteralType.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/ETSStructDeclaration.ts +0 -59
- package/build/libarkts-copy/src/generated/peers/ETSTuple.ts +0 -89
- package/build/libarkts-copy/src/generated/peers/ETSTypeReference.ts +0 -66
- package/build/libarkts-copy/src/generated/peers/ETSTypeReferencePart.ts +0 -78
- package/build/libarkts-copy/src/generated/peers/ETSUndefinedType.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/ETSUnionType.ts +0 -75
- package/build/libarkts-copy/src/generated/peers/ETSWildcardType.ts +0 -63
- package/build/libarkts-copy/src/generated/peers/EmptyStatement.ts +0 -66
- package/build/libarkts-copy/src/generated/peers/ErrorLogger.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/ExportAllDeclaration.ts +0 -66
- package/build/libarkts-copy/src/generated/peers/ExportDefaultDeclaration.ts +0 -64
- package/build/libarkts-copy/src/generated/peers/ExportNamedDeclaration.ts +0 -94
- package/build/libarkts-copy/src/generated/peers/ExportSpecifier.ts +0 -82
- package/build/libarkts-copy/src/generated/peers/Expression.ts +0 -84
- package/build/libarkts-copy/src/generated/peers/ExpressionStatement.ts +0 -67
- package/build/libarkts-copy/src/generated/peers/ForInStatement.ts +0 -69
- package/build/libarkts-copy/src/generated/peers/ForOfStatement.ts +0 -72
- package/build/libarkts-copy/src/generated/peers/ForUpdateStatement.ts +0 -67
- package/build/libarkts-copy/src/generated/peers/FunctionDeclaration.ts +0 -106
- package/build/libarkts-copy/src/generated/peers/FunctionExpression.ts +0 -74
- package/build/libarkts-copy/src/generated/peers/FunctionSignature.ts +0 -70
- package/build/libarkts-copy/src/generated/peers/IRNode.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/Identifier.ts +0 -162
- package/build/libarkts-copy/src/generated/peers/IfStatement.ts +0 -78
- package/build/libarkts-copy/src/generated/peers/ImportDeclaration.ts +0 -87
- package/build/libarkts-copy/src/generated/peers/ImportDefaultSpecifier.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/ImportExpression.ts +0 -61
- package/build/libarkts-copy/src/generated/peers/ImportNamespaceSpecifier.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/ImportSource.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/ImportSpecifier.ts +0 -73
- package/build/libarkts-copy/src/generated/peers/IndexInfo.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/LabelPair.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/LabelledStatement.ts +0 -68
- package/build/libarkts-copy/src/generated/peers/Literal.ts +0 -53
- package/build/libarkts-copy/src/generated/peers/LoopStatement.ts +0 -45
- package/build/libarkts-copy/src/generated/peers/MaybeOptionalExpression.ts +0 -53
- package/build/libarkts-copy/src/generated/peers/MemberExpression.ts +0 -115
- package/build/libarkts-copy/src/generated/peers/MetaProperty.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/MethodDefinition.ts +0 -152
- package/build/libarkts-copy/src/generated/peers/NamedType.ts +0 -84
- package/build/libarkts-copy/src/generated/peers/NewExpression.ts +0 -64
- package/build/libarkts-copy/src/generated/peers/NullLiteral.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/NumberLiteral.ts +0 -78
- package/build/libarkts-copy/src/generated/peers/ObjectDescriptor.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/ObjectExpression.ts +0 -94
- package/build/libarkts-copy/src/generated/peers/OmittedExpression.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/OpaqueTypeNode.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/OverloadDeclaration.ts +0 -101
- package/build/libarkts-copy/src/generated/peers/PrefixAssertionExpression.ts +0 -65
- package/build/libarkts-copy/src/generated/peers/Program.ts +0 -206
- package/build/libarkts-copy/src/generated/peers/Property.ts +0 -92
- package/build/libarkts-copy/src/generated/peers/RegExpLiteral.ts +0 -65
- package/build/libarkts-copy/src/generated/peers/ReturnStatement.ts +0 -75
- package/build/libarkts-copy/src/generated/peers/ScopeFindResult.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/ScriptFunction.ts +0 -310
- package/build/libarkts-copy/src/generated/peers/ScriptFunctionData.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/SequenceExpression.ts +0 -61
- package/build/libarkts-copy/src/generated/peers/SignatureInfo.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/SourcePosition.ts +0 -48
- package/build/libarkts-copy/src/generated/peers/SourceRange.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/SpreadElement.ts +0 -83
- package/build/libarkts-copy/src/generated/peers/SrcDumper.ts +0 -120
- package/build/libarkts-copy/src/generated/peers/Statement.ts +0 -44
- package/build/libarkts-copy/src/generated/peers/StringLiteral.ts +0 -66
- package/build/libarkts-copy/src/generated/peers/SuggestionInfo.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/SuperExpression.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/SwitchCaseStatement.ts +0 -70
- package/build/libarkts-copy/src/generated/peers/SwitchStatement.ts +0 -71
- package/build/libarkts-copy/src/generated/peers/TSAnyKeyword.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/TSArrayType.ts +0 -61
- package/build/libarkts-copy/src/generated/peers/TSAsExpression.ts +0 -84
- package/build/libarkts-copy/src/generated/peers/TSBigintKeyword.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/TSBooleanKeyword.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/TSClassImplements.ts +0 -70
- package/build/libarkts-copy/src/generated/peers/TSConditionalType.ts +0 -71
- package/build/libarkts-copy/src/generated/peers/TSConstructorType.ts +0 -73
- package/build/libarkts-copy/src/generated/peers/TSEnumDeclaration.ts +0 -112
- package/build/libarkts-copy/src/generated/peers/TSEnumMember.ts +0 -76
- package/build/libarkts-copy/src/generated/peers/TSExternalModuleReference.ts +0 -61
- package/build/libarkts-copy/src/generated/peers/TSFunctionType.ts +0 -75
- package/build/libarkts-copy/src/generated/peers/TSImportEqualsDeclaration.ts +0 -69
- package/build/libarkts-copy/src/generated/peers/TSImportType.ts +0 -72
- package/build/libarkts-copy/src/generated/peers/TSIndexSignature.ts +0 -73
- package/build/libarkts-copy/src/generated/peers/TSIndexedAccessType.ts +0 -64
- package/build/libarkts-copy/src/generated/peers/TSInferType.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/TSInterfaceBody.ts +0 -61
- package/build/libarkts-copy/src/generated/peers/TSInterfaceDeclaration.ts +0 -160
- package/build/libarkts-copy/src/generated/peers/TSInterfaceHeritage.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/TSIntersectionType.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/TSLiteralType.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/TSMappedType.ts +0 -72
- package/build/libarkts-copy/src/generated/peers/TSMethodSignature.ts +0 -79
- package/build/libarkts-copy/src/generated/peers/TSModuleBlock.ts +0 -61
- package/build/libarkts-copy/src/generated/peers/TSModuleDeclaration.ts +0 -71
- package/build/libarkts-copy/src/generated/peers/TSNamedTupleMember.ts +0 -68
- package/build/libarkts-copy/src/generated/peers/TSNeverKeyword.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/TSNonNullExpression.ts +0 -66
- package/build/libarkts-copy/src/generated/peers/TSNullKeyword.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/TSNumberKeyword.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/TSObjectKeyword.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/TSParameterProperty.ts +0 -74
- package/build/libarkts-copy/src/generated/peers/TSParenthesizedType.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/TSPropertySignature.ts +0 -80
- package/build/libarkts-copy/src/generated/peers/TSQualifiedName.ts +0 -71
- package/build/libarkts-copy/src/generated/peers/TSSignatureDeclaration.ts +0 -75
- package/build/libarkts-copy/src/generated/peers/TSStringKeyword.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/TSThisType.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/TSTupleType.ts +0 -61
- package/build/libarkts-copy/src/generated/peers/TSTypeAliasDeclaration.ts +0 -151
- package/build/libarkts-copy/src/generated/peers/TSTypeAssertion.ts +0 -71
- package/build/libarkts-copy/src/generated/peers/TSTypeLiteral.ts +0 -61
- package/build/libarkts-copy/src/generated/peers/TSTypeOperator.ts +0 -71
- package/build/libarkts-copy/src/generated/peers/TSTypeParameter.ts +0 -121
- package/build/libarkts-copy/src/generated/peers/TSTypeParameterDeclaration.ts +0 -75
- package/build/libarkts-copy/src/generated/peers/TSTypeParameterInstantiation.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/TSTypePredicate.ts +0 -68
- package/build/libarkts-copy/src/generated/peers/TSTypeQuery.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/TSTypeReference.ts +0 -70
- package/build/libarkts-copy/src/generated/peers/TSUndefinedKeyword.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/TSUnionType.ts +0 -61
- package/build/libarkts-copy/src/generated/peers/TSUnknownKeyword.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/TSVoidKeyword.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/TaggedTemplateExpression.ts +0 -69
- package/build/libarkts-copy/src/generated/peers/TemplateElement.ts +0 -69
- package/build/libarkts-copy/src/generated/peers/TemplateLiteral.ts +0 -68
- package/build/libarkts-copy/src/generated/peers/ThisExpression.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/ThrowStatement.ts +0 -62
- package/build/libarkts-copy/src/generated/peers/TryStatement.ts +0 -89
- package/build/libarkts-copy/src/generated/peers/TypeNode.ts +0 -81
- package/build/libarkts-copy/src/generated/peers/TypedAstNode.ts +0 -44
- package/build/libarkts-copy/src/generated/peers/TypedStatement.ts +0 -45
- package/build/libarkts-copy/src/generated/peers/TypeofExpression.ts +0 -61
- package/build/libarkts-copy/src/generated/peers/UnaryExpression.ts +0 -70
- package/build/libarkts-copy/src/generated/peers/UndefinedLiteral.ts +0 -58
- package/build/libarkts-copy/src/generated/peers/UpdateExpression.ts +0 -68
- package/build/libarkts-copy/src/generated/peers/VReg.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/ValidationInfo.ts +0 -50
- package/build/libarkts-copy/src/generated/peers/VariableDeclaration.ts +0 -113
- package/build/libarkts-copy/src/generated/peers/VariableDeclarator.ts +0 -79
- package/build/libarkts-copy/src/generated/peers/VerificationContext.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/VerifierMessage.ts +0 -40
- package/build/libarkts-copy/src/generated/peers/WhileStatement.ts +0 -71
- package/build/libarkts-copy/src/generated/peers/YieldExpression.ts +0 -64
|
@@ -13,13 +13,35 @@
|
|
|
13
13
|
* limitations under the License.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import { global } from
|
|
17
|
-
import { isNumber, throwError, withWarning } from
|
|
18
|
-
import { KNativePointer, nullptr, KInt, KUInt} from
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
import { global } from '../static/global';
|
|
17
|
+
import { isNumber, throwError, withWarning } from '../../utils';
|
|
18
|
+
import { KNativePointer, nullptr, KInt, KUInt } from '@koalaui/interop';
|
|
19
|
+
import {
|
|
20
|
+
passNode,
|
|
21
|
+
unpackNodeArray,
|
|
22
|
+
unpackNonNullableNode,
|
|
23
|
+
passString,
|
|
24
|
+
unpackString,
|
|
25
|
+
passStringArray,
|
|
26
|
+
unpackNode,
|
|
27
|
+
} from './private';
|
|
28
|
+
import {
|
|
29
|
+
Es2pandaContextState,
|
|
30
|
+
Es2pandaModifierFlags,
|
|
31
|
+
Es2pandaMethodDefinitionKind,
|
|
32
|
+
Es2pandaAstNodeType,
|
|
33
|
+
Es2pandaPluginDiagnosticType,
|
|
34
|
+
} from '../../../generated/Es2pandaEnums';
|
|
35
|
+
import type { AstNode } from '../peers/AstNode';
|
|
36
|
+
import {
|
|
37
|
+
DiagnosticInfo,
|
|
38
|
+
Identifier,
|
|
39
|
+
isConditionalExpression,
|
|
40
|
+
SourcePosition,
|
|
41
|
+
SourceRange,
|
|
42
|
+
SuggestionInfo,
|
|
43
|
+
VariableDeclarator,
|
|
44
|
+
} from '../../../generated';
|
|
23
45
|
import {
|
|
24
46
|
type AnnotationUsage,
|
|
25
47
|
ClassDefinition,
|
|
@@ -41,168 +63,160 @@ import {
|
|
|
41
63
|
MemberExpression,
|
|
42
64
|
isMethodDefinition,
|
|
43
65
|
TypeNode,
|
|
44
|
-
} from
|
|
45
|
-
import { Config } from
|
|
46
|
-
import { Context } from
|
|
47
|
-
import { NodeCache } from
|
|
48
|
-
import { factory } from
|
|
49
|
-
import { traceGlobal } from
|
|
50
|
-
import { DiagnosticKind } from
|
|
66
|
+
} from '../../../generated';
|
|
67
|
+
import { Config } from '../peers/Config';
|
|
68
|
+
import { Context } from '../peers/Context';
|
|
69
|
+
import { NodeCache } from '../node-cache';
|
|
70
|
+
import { factory } from '../factory/nodeFactory';
|
|
71
|
+
import { traceGlobal } from '../../tracer';
|
|
72
|
+
import { DiagnosticKind } from '../peers/DiagnosticKind';
|
|
51
73
|
|
|
52
74
|
/**
|
|
53
75
|
* Improve: Replace or remove with better naming
|
|
54
|
-
*
|
|
76
|
+
*
|
|
55
77
|
* @deprecated
|
|
56
78
|
*/
|
|
57
79
|
export function createETSModuleFromContext(): ETSModule {
|
|
58
|
-
let program = global.generatedEs2panda._ContextProgram(global.context)
|
|
80
|
+
let program = global.generatedEs2panda._ContextProgram(global.context);
|
|
59
81
|
if (program == nullptr) {
|
|
60
|
-
throw new Error(`Program is null for context ${global.context.toString(16)}`)
|
|
82
|
+
throw new Error(`Program is null for context ${global.context.toString(16)}`);
|
|
61
83
|
}
|
|
62
|
-
const ast = global.generatedEs2panda._ProgramAst(global.context, program)
|
|
84
|
+
const ast = global.generatedEs2panda._ProgramAst(global.context, program);
|
|
63
85
|
if (ast == nullptr) {
|
|
64
|
-
throw new Error(`AST is null for program ${program.toString(16)}`)
|
|
65
|
-
|
|
86
|
+
throw new Error(`AST is null for program ${program.toString(16)}`);
|
|
66
87
|
}
|
|
67
|
-
return new ETSModule(ast, Es2pandaAstNodeType.AST_NODE_TYPE_ETS_MODULE)
|
|
88
|
+
return new ETSModule(ast, Es2pandaAstNodeType.AST_NODE_TYPE_ETS_MODULE);
|
|
68
89
|
}
|
|
69
90
|
|
|
70
91
|
/**
|
|
71
92
|
* Now used only in tests
|
|
72
93
|
* Improve: Remove or replace with better method
|
|
73
|
-
*
|
|
94
|
+
*
|
|
74
95
|
* @deprecated
|
|
75
96
|
*/
|
|
76
97
|
export function createETSModuleFromSource(
|
|
77
98
|
source: string,
|
|
78
|
-
state: Es2pandaContextState = Es2pandaContextState.ES2PANDA_STATE_PARSED
|
|
99
|
+
state: Es2pandaContextState = Es2pandaContextState.ES2PANDA_STATE_PARSED
|
|
79
100
|
): ETSModule {
|
|
80
101
|
if (!global.configIsInitialized()) {
|
|
81
|
-
global.config = Config.createDefault().peer
|
|
102
|
+
global.config = Config.createDefault().peer;
|
|
82
103
|
}
|
|
83
|
-
global.compilerContext = Context.createFromString(source)
|
|
84
|
-
proceedToState(state)
|
|
85
|
-
let program = global.generatedEs2panda._ContextProgram(global.compilerContext.peer)
|
|
86
|
-
if (program
|
|
87
|
-
throw new Error(`Program is null for ${source} 0x${global.compilerContext.peer.toString(16)}`)
|
|
88
|
-
return new ETSModule(
|
|
104
|
+
global.compilerContext = Context.createFromString(source);
|
|
105
|
+
proceedToState(state);
|
|
106
|
+
let program = global.generatedEs2panda._ContextProgram(global.compilerContext.peer);
|
|
107
|
+
if (program === nullptr)
|
|
108
|
+
throw new Error(`Program is null for ${source} 0x${global.compilerContext.peer.toString(16)}`);
|
|
109
|
+
return new ETSModule(
|
|
110
|
+
global.generatedEs2panda._ProgramAst(global.context, program),
|
|
111
|
+
Es2pandaAstNodeType.AST_NODE_TYPE_ETS_MODULE
|
|
112
|
+
);
|
|
89
113
|
}
|
|
90
114
|
|
|
91
115
|
export function metaDatabase(fileName: string): string {
|
|
92
|
-
if (fileName.endsWith(
|
|
93
|
-
return `${fileName}.meta.json
|
|
116
|
+
if (fileName.endsWith('.meta.json')) throw new Error(`Must pass source, not database: ${fileName}`);
|
|
117
|
+
return `${fileName}.meta.json`;
|
|
94
118
|
}
|
|
95
119
|
|
|
96
120
|
export function checkErrors() {
|
|
97
121
|
if (global.es2panda._ContextState(global.context) === Es2pandaContextState.ES2PANDA_STATE_ERROR) {
|
|
98
|
-
traceGlobal(() => `Terminated due to compilation errors occured`)
|
|
99
|
-
console.log(unpackString(global.generatedEs2panda._GetAllErrorMessages(global.context)))
|
|
122
|
+
traceGlobal(() => `Terminated due to compilation errors occured`);
|
|
123
|
+
console.log(unpackString(global.generatedEs2panda._GetAllErrorMessages(global.context)));
|
|
100
124
|
// global.es2panda._DestroyConfig(global.config)
|
|
101
|
-
process.exit(1)
|
|
125
|
+
process.exit(1);
|
|
102
126
|
}
|
|
103
127
|
}
|
|
104
128
|
|
|
105
129
|
export function proceedToState(state: Es2pandaContextState): void {
|
|
106
130
|
if (state <= global.es2panda._ContextState(global.context)) {
|
|
107
|
-
return
|
|
131
|
+
return;
|
|
108
132
|
}
|
|
109
|
-
NodeCache.clear()
|
|
110
|
-
const before = Date.now()
|
|
111
|
-
traceGlobal(() => `Proceeding to state ${Es2pandaContextState[state]}: start`)
|
|
112
|
-
global.es2panda._ProceedToState(global.context, state)
|
|
113
|
-
traceGlobal(() => `Proceeding to state ${Es2pandaContextState[state]}: done`)
|
|
114
|
-
const after = Date.now()
|
|
115
|
-
global.profiler.proceededToState(after-before)
|
|
116
|
-
checkErrors()
|
|
133
|
+
NodeCache.clear();
|
|
134
|
+
const before = Date.now();
|
|
135
|
+
traceGlobal(() => `Proceeding to state ${Es2pandaContextState[state]}: start`);
|
|
136
|
+
global.es2panda._ProceedToState(global.context, state);
|
|
137
|
+
traceGlobal(() => `Proceeding to state ${Es2pandaContextState[state]}: done`);
|
|
138
|
+
const after = Date.now();
|
|
139
|
+
global.profiler.proceededToState(after - before);
|
|
140
|
+
checkErrors();
|
|
117
141
|
}
|
|
118
142
|
|
|
119
143
|
/** @deprecated Use {@link rebindContext} instead */
|
|
120
144
|
export function rebindSubtree(node: AstNode): void {
|
|
121
|
-
NodeCache.clear()
|
|
122
|
-
traceGlobal(() => `Rebind: start`)
|
|
123
|
-
global.es2panda._AstNodeRebind(global.context, node.peer)
|
|
124
|
-
traceGlobal(() => `Rebind: done`)
|
|
125
|
-
checkErrors()
|
|
145
|
+
NodeCache.clear();
|
|
146
|
+
traceGlobal(() => `Rebind: start`);
|
|
147
|
+
global.es2panda._AstNodeRebind(global.context, node.peer);
|
|
148
|
+
traceGlobal(() => `Rebind: done`);
|
|
149
|
+
checkErrors();
|
|
126
150
|
}
|
|
127
151
|
|
|
128
152
|
/** @deprecated Use {@link recheckSubtree} instead */
|
|
129
153
|
export function recheckSubtree(node: AstNode): void {
|
|
130
|
-
NodeCache.clear()
|
|
131
|
-
traceGlobal(() => `Recheck: start`)
|
|
132
|
-
global.generatedEs2panda._AstNodeRecheck(global.context, node.peer)
|
|
133
|
-
traceGlobal(() => `Recheck: done`)
|
|
134
|
-
checkErrors()
|
|
154
|
+
NodeCache.clear();
|
|
155
|
+
traceGlobal(() => `Recheck: start`);
|
|
156
|
+
global.generatedEs2panda._AstNodeRecheck(global.context, node.peer);
|
|
157
|
+
traceGlobal(() => `Recheck: done`);
|
|
158
|
+
checkErrors();
|
|
135
159
|
}
|
|
136
160
|
|
|
137
161
|
export function rebindContext(context: KNativePointer = global.context): void {
|
|
138
|
-
NodeCache.clear()
|
|
139
|
-
traceGlobal(() => `Rebind: start`)
|
|
162
|
+
NodeCache.clear();
|
|
163
|
+
traceGlobal(() => `Rebind: start`);
|
|
140
164
|
global.es2panda._AstNodeRebind(
|
|
141
165
|
context,
|
|
142
|
-
global.generatedEs2panda._ProgramAst(
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
)
|
|
147
|
-
)
|
|
148
|
-
)
|
|
149
|
-
traceGlobal(() => `Rebind: done`)
|
|
150
|
-
checkErrors()
|
|
166
|
+
global.generatedEs2panda._ProgramAst(context, global.generatedEs2panda._ContextProgram(context))
|
|
167
|
+
);
|
|
168
|
+
traceGlobal(() => `Rebind: done`);
|
|
169
|
+
checkErrors();
|
|
151
170
|
}
|
|
152
171
|
|
|
153
172
|
export function recheckContext(context: KNativePointer = global.context): void {
|
|
154
|
-
NodeCache.clear()
|
|
155
|
-
traceGlobal(() => `Recheck: start`)
|
|
173
|
+
NodeCache.clear();
|
|
174
|
+
traceGlobal(() => `Recheck: start`);
|
|
156
175
|
global.generatedEs2panda._AstNodeRecheck(
|
|
157
176
|
context,
|
|
158
|
-
global.generatedEs2panda._ProgramAst(
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
)
|
|
163
|
-
)
|
|
164
|
-
)
|
|
165
|
-
traceGlobal(() => `Recheck: done`)
|
|
166
|
-
checkErrors()
|
|
177
|
+
global.generatedEs2panda._ProgramAst(context, global.generatedEs2panda._ContextProgram(context))
|
|
178
|
+
);
|
|
179
|
+
traceGlobal(() => `Recheck: done`);
|
|
180
|
+
checkErrors();
|
|
167
181
|
}
|
|
168
182
|
|
|
169
183
|
export function getDecl(node: AstNode): AstNode | undefined {
|
|
170
184
|
if (isMemberExpression(node)) {
|
|
171
|
-
return getDeclFromArrayOrObjectMember(node)
|
|
185
|
+
return getDeclFromArrayOrObjectMember(node);
|
|
172
186
|
}
|
|
173
187
|
if (isObjectExpression(node)) {
|
|
174
|
-
return getPeerObjectDecl(passNode(node))
|
|
188
|
+
return getPeerObjectDecl(passNode(node));
|
|
175
189
|
}
|
|
176
|
-
const decl = getPeerDecl(passNode(node))
|
|
190
|
+
const decl = getPeerDecl(passNode(node));
|
|
177
191
|
if (!!decl) {
|
|
178
|
-
return decl
|
|
192
|
+
return decl;
|
|
179
193
|
}
|
|
180
194
|
if (!!node.parent && isProperty(node.parent)) {
|
|
181
|
-
return getDeclFromProperty(node.parent)
|
|
195
|
+
return getDeclFromProperty(node.parent);
|
|
182
196
|
}
|
|
183
|
-
return undefined
|
|
197
|
+
return undefined;
|
|
184
198
|
}
|
|
185
199
|
|
|
186
200
|
function getDeclFromProperty(node: Property): AstNode | undefined {
|
|
187
201
|
if (!node.key) {
|
|
188
|
-
return undefined
|
|
202
|
+
return undefined;
|
|
189
203
|
}
|
|
190
204
|
if (!!node.parent && !isObjectExpression(node.parent)) {
|
|
191
|
-
return getPeerDecl(passNode(node.key))
|
|
205
|
+
return getPeerDecl(passNode(node.key));
|
|
192
206
|
}
|
|
193
|
-
return getDeclFromObjectExpressionProperty(node)
|
|
207
|
+
return getDeclFromObjectExpressionProperty(node);
|
|
194
208
|
}
|
|
195
209
|
|
|
196
210
|
function getDeclFromObjectExpressionProperty(node: Property): AstNode | undefined {
|
|
197
|
-
const declNode = getPeerObjectDecl(passNode(node.parent))
|
|
211
|
+
const declNode = getPeerObjectDecl(passNode(node.parent));
|
|
198
212
|
if (!declNode || !node.key || !isIdentifier(node.key)) {
|
|
199
|
-
return undefined
|
|
213
|
+
return undefined;
|
|
200
214
|
}
|
|
201
|
-
let body: readonly AstNode[] = []
|
|
215
|
+
let body: readonly AstNode[] = [];
|
|
202
216
|
if (isClassDefinition(declNode)) {
|
|
203
|
-
body = declNode.body
|
|
217
|
+
body = declNode.body;
|
|
204
218
|
} else if (isTSInterfaceDeclaration(declNode)) {
|
|
205
|
-
body = declNode.body?.body ?? []
|
|
219
|
+
body = declNode.body?.body ?? [];
|
|
206
220
|
}
|
|
207
221
|
return body.find(
|
|
208
222
|
(statement) =>
|
|
@@ -212,42 +226,46 @@ function getDeclFromObjectExpressionProperty(node: Property): AstNode | undefine
|
|
|
212
226
|
!!node.key &&
|
|
213
227
|
isIdentifier(node.key) &&
|
|
214
228
|
statement.id.name === node.key.name
|
|
215
|
-
)
|
|
229
|
+
);
|
|
216
230
|
}
|
|
217
231
|
|
|
218
232
|
function getDeclFromArrayOrObjectMember(node: MemberExpression): AstNode | undefined {
|
|
219
233
|
if (isNumberLiteral(node.property)) {
|
|
220
|
-
return node.object ? getDecl(node.object) : undefined
|
|
234
|
+
return node.object ? getDecl(node.object) : undefined;
|
|
221
235
|
}
|
|
222
|
-
return node.property ? getDecl(node.property) : undefined
|
|
236
|
+
return node.property ? getDecl(node.property) : undefined;
|
|
223
237
|
}
|
|
224
238
|
|
|
225
239
|
export function getPeerDecl(peer: KNativePointer): AstNode | undefined {
|
|
226
|
-
const decl = global.generatedEs2panda._DeclarationFromIdentifier(global.context, peer)
|
|
240
|
+
const decl = global.generatedEs2panda._DeclarationFromIdentifier(global.context, peer);
|
|
227
241
|
if (decl === nullptr) {
|
|
228
|
-
return undefined
|
|
242
|
+
return undefined;
|
|
229
243
|
}
|
|
230
|
-
return unpackNonNullableNode(decl)
|
|
244
|
+
return unpackNonNullableNode(decl);
|
|
231
245
|
}
|
|
232
246
|
|
|
233
247
|
export function declarationFromIdentifier(node: Identifier): AstNode | undefined {
|
|
234
|
-
return unpackNode(global.generatedEs2panda._DeclarationFromIdentifier(global.context, node.peer))
|
|
248
|
+
return unpackNode(global.generatedEs2panda._DeclarationFromIdentifier(global.context, node.peer));
|
|
235
249
|
}
|
|
236
250
|
|
|
237
251
|
export function resolveGensymVariableDeclaratorForDefaultParam(node: VariableDeclarator): Identifier | undefined {
|
|
238
|
-
const init = node.init
|
|
239
|
-
if (
|
|
240
|
-
|
|
252
|
+
const init = node.init;
|
|
253
|
+
if (
|
|
254
|
+
isConditionalExpression(init) &&
|
|
255
|
+
isIdentifier(init.consequent) &&
|
|
256
|
+
init.consequent.name.startsWith('gensym%%_')
|
|
257
|
+
) {
|
|
258
|
+
return init.consequent;
|
|
241
259
|
}
|
|
242
|
-
return undefined
|
|
260
|
+
return undefined;
|
|
243
261
|
}
|
|
244
262
|
|
|
245
263
|
export function resolveGensymVariableDeclaratorForOptionalCall(node: VariableDeclarator): Identifier | undefined {
|
|
246
|
-
const init = node.init
|
|
247
|
-
if (isIdentifier(node.id) && node.id.name.startsWith(
|
|
248
|
-
return init
|
|
264
|
+
const init = node.init;
|
|
265
|
+
if (isIdentifier(node.id) && node.id.name.startsWith('gensym%%_') && isIdentifier(init)) {
|
|
266
|
+
return init;
|
|
249
267
|
}
|
|
250
|
-
return undefined
|
|
268
|
+
return undefined;
|
|
251
269
|
}
|
|
252
270
|
|
|
253
271
|
export function getPeerObjectDecl(peer: KNativePointer): AstNode | undefined {
|
|
@@ -255,43 +273,42 @@ export function getPeerObjectDecl(peer: KNativePointer): AstNode | undefined {
|
|
|
255
273
|
if (decl === nullptr) {
|
|
256
274
|
return undefined;
|
|
257
275
|
}
|
|
258
|
-
return unpackNonNullableNode(decl)
|
|
276
|
+
return unpackNonNullableNode(decl);
|
|
259
277
|
}
|
|
260
278
|
|
|
261
279
|
export function getAnnotations(node: AstNode): readonly AnnotationUsage[] {
|
|
262
280
|
if (!isFunctionDeclaration(node) && !isScriptFunction(node) && !isClassDefinition(node)) {
|
|
263
|
-
throwError('for now annotations allowed only for: functionDeclaration, scriptFunction, classDefinition')
|
|
281
|
+
throwError('for now annotations allowed only for: functionDeclaration, scriptFunction, classDefinition');
|
|
264
282
|
}
|
|
265
|
-
return unpackNodeArray(global.es2panda._AnnotationAllowedAnnotations(global.context, node.peer, nullptr))
|
|
283
|
+
return unpackNodeArray(global.es2panda._AnnotationAllowedAnnotations(global.context, node.peer, nullptr));
|
|
266
284
|
}
|
|
267
285
|
|
|
268
286
|
export function getOriginalNode(node: AstNode): AstNode {
|
|
269
287
|
if (node === undefined) {
|
|
270
288
|
// Improve: fix this
|
|
271
|
-
throwError('there is no arkts pair of ts node (unable to getOriginalNode)')
|
|
289
|
+
throwError('there is no arkts pair of ts node (unable to getOriginalNode)');
|
|
272
290
|
}
|
|
273
291
|
if (node.originalPeer === nullptr) {
|
|
274
|
-
return node
|
|
292
|
+
return node;
|
|
275
293
|
}
|
|
276
|
-
return unpackNonNullableNode(node.originalPeer)
|
|
294
|
+
return unpackNonNullableNode(node.originalPeer);
|
|
277
295
|
}
|
|
278
296
|
|
|
279
297
|
export function getFileName(): string {
|
|
280
|
-
return global.filePath
|
|
298
|
+
return global.filePath;
|
|
281
299
|
}
|
|
282
300
|
|
|
283
301
|
export function getJsDoc(node: AstNode): string | undefined {
|
|
284
|
-
const result = unpackString(global.generatedEs2panda._JsdocStringFromDeclaration(global.context, node.peer))
|
|
285
|
-
return result === 'Empty Jsdoc' ? undefined : result
|
|
302
|
+
const result = unpackString(global.generatedEs2panda._JsdocStringFromDeclaration(global.context, node.peer));
|
|
303
|
+
return result === 'Empty Jsdoc' ? undefined : result;
|
|
286
304
|
}
|
|
287
305
|
|
|
288
|
-
|
|
289
306
|
// Improve: It seems like Definition overrides AstNode modifiers
|
|
290
307
|
// with it's own modifiers which is completely unrelated set of flags.
|
|
291
308
|
// Use this function if you need
|
|
292
309
|
// the language level modifiers: public, declare, export, etc.
|
|
293
310
|
export function classDefinitionFlags(node: ClassDefinition): Es2pandaModifierFlags {
|
|
294
|
-
return global.generatedEs2panda._AstNodeModifiers(global.context, node.peer)
|
|
311
|
+
return global.generatedEs2panda._AstNodeModifiers(global.context, node.peer);
|
|
295
312
|
}
|
|
296
313
|
|
|
297
314
|
// Improve: ClassProperty's optional flag is set by AstNode's modifiers flags.
|
|
@@ -311,58 +328,59 @@ export function hasModifierFlag(node: AstNode, flag: Es2pandaModifierFlags): boo
|
|
|
311
328
|
if (isClassDefinition(node)) {
|
|
312
329
|
modifiers = classDefinitionFlags(node);
|
|
313
330
|
} else {
|
|
314
|
-
modifiers = node.modifierFlags
|
|
331
|
+
modifiers = node.modifierFlags;
|
|
315
332
|
}
|
|
316
333
|
return (modifiers & flag) === flag;
|
|
317
334
|
}
|
|
318
335
|
|
|
319
336
|
export function modifiersToString(modifiers: Es2pandaModifierFlags): string {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
337
|
+
return Object.values(Es2pandaModifierFlags)
|
|
338
|
+
.filter(isNumber)
|
|
339
|
+
.map((it) => {
|
|
340
|
+
console.log(it.valueOf(), Es2pandaModifierFlags[it], modifiers.valueOf() & it);
|
|
341
|
+
return (modifiers.valueOf() & it) === it ? Es2pandaModifierFlags[it] : '';
|
|
342
|
+
})
|
|
343
|
+
.join(' ');
|
|
326
344
|
}
|
|
327
345
|
|
|
328
346
|
export function nameIfIdentifier(node: AstNode): string {
|
|
329
|
-
return isIdentifier(node) ? `'${node.name}'` :
|
|
347
|
+
return isIdentifier(node) ? `'${node.name}'` : '';
|
|
330
348
|
}
|
|
331
349
|
|
|
332
350
|
export function nameIfETSModule(node: AstNode): string {
|
|
333
|
-
return isETSModule(node) ? `'${node.ident?.name}'` :
|
|
351
|
+
return isETSModule(node) ? `'${node.ident?.name}'` : '';
|
|
334
352
|
}
|
|
335
353
|
|
|
336
|
-
export function asString(node: AstNode|undefined): string {
|
|
337
|
-
return `${node?.constructor.name} ${node ? nameIfIdentifier(node) : undefined}
|
|
354
|
+
export function asString(node: AstNode | undefined): string {
|
|
355
|
+
return `${node?.constructor.name} ${node ? nameIfIdentifier(node) : undefined}`;
|
|
338
356
|
}
|
|
339
357
|
|
|
340
|
-
const defaultPandaSdk =
|
|
341
|
-
|
|
358
|
+
const defaultPandaSdk = '../../../incremental/tools/panda/node_modules/@panda/sdk';
|
|
342
359
|
|
|
343
360
|
export function findStdlib(): string {
|
|
344
|
-
const sdk =
|
|
345
|
-
|
|
346
|
-
`PANDA_SDK_PATH not set, assuming ${defaultPandaSdk}`
|
|
347
|
-
|
|
348
|
-
return `${sdk}/ets/stdlib`
|
|
361
|
+
const sdk =
|
|
362
|
+
process.env.PANDA_SDK_PATH ??
|
|
363
|
+
withWarning(defaultPandaSdk, `PANDA_SDK_PATH not set, assuming ${defaultPandaSdk}`);
|
|
364
|
+
return `${sdk}/ets/stdlib`;
|
|
349
365
|
}
|
|
350
366
|
|
|
351
367
|
export function generateTsDeclarationsFromContext(
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
368
|
+
outputDeclEts: string,
|
|
369
|
+
outputEts: string,
|
|
370
|
+
exportAll: boolean,
|
|
371
|
+
isolated: boolean,
|
|
372
|
+
recordFile: string,
|
|
373
|
+
genAnnotations: boolean
|
|
357
374
|
): KInt {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
375
|
+
return global.es2panda._GenerateTsDeclarationsFromContext(
|
|
376
|
+
global.context,
|
|
377
|
+
passString(outputDeclEts),
|
|
378
|
+
passString(outputEts),
|
|
379
|
+
exportAll,
|
|
380
|
+
isolated,
|
|
381
|
+
recordFile,
|
|
382
|
+
genAnnotations
|
|
383
|
+
);
|
|
366
384
|
}
|
|
367
385
|
|
|
368
386
|
export function setAllParents(ast: AstNode): void {
|
|
@@ -370,48 +388,45 @@ export function setAllParents(ast: AstNode): void {
|
|
|
370
388
|
}
|
|
371
389
|
|
|
372
390
|
export function getProgramFromAstNode(node: AstNode): Program {
|
|
373
|
-
return new Program(global.es2panda._AstNodeProgram(global.context, node.peer))
|
|
391
|
+
return new Program(global.es2panda._AstNodeProgram(global.context, node.peer));
|
|
374
392
|
}
|
|
375
393
|
|
|
376
394
|
export function importDeclarationInsert(node: ETSImportDeclaration, program: Program): void {
|
|
377
|
-
global.generatedEs2panda._InsertETSImportDeclarationAndParse(global.context, program.peer, node.peer)
|
|
395
|
+
global.generatedEs2panda._InsertETSImportDeclarationAndParse(global.context, program.peer, node.peer);
|
|
378
396
|
}
|
|
379
397
|
|
|
380
398
|
export function signatureReturnType(signature: KNativePointer): KNativePointer {
|
|
381
399
|
if (!signature) {
|
|
382
|
-
return nullptr
|
|
400
|
+
return nullptr;
|
|
383
401
|
}
|
|
384
|
-
return global.es2panda._Checker_SignatureReturnType(global.context, signature)
|
|
402
|
+
return global.es2panda._Checker_SignatureReturnType(global.context, signature);
|
|
385
403
|
}
|
|
386
404
|
|
|
387
405
|
export function convertCheckerTypeToTypeNode(typePeer: KNativePointer | undefined): TypeNode | undefined {
|
|
388
406
|
if (!typePeer) {
|
|
389
|
-
return undefined
|
|
407
|
+
return undefined;
|
|
390
408
|
}
|
|
391
|
-
return factory.createOpaqueTypeNode(
|
|
392
|
-
global.es2panda._Checker_TypeClone(global.context, typePeer)
|
|
393
|
-
)
|
|
409
|
+
return factory.createOpaqueTypeNode(global.es2panda._Checker_TypeClone(global.context, typePeer));
|
|
394
410
|
}
|
|
395
411
|
|
|
396
412
|
export function originalSourcePositionString(node: AstNode | undefined) {
|
|
397
413
|
if (!node) {
|
|
398
|
-
return `[undefined]
|
|
414
|
+
return `[undefined]`;
|
|
399
415
|
}
|
|
400
|
-
const originalPeer = node.originalPeer
|
|
401
|
-
const sourcePosition = new SourcePosition(
|
|
402
|
-
|
|
416
|
+
const originalPeer = node.originalPeer;
|
|
417
|
+
const sourcePosition = new SourcePosition(
|
|
418
|
+
global.generatedEs2panda._AstNodeStartConst(global.context, originalPeer)
|
|
419
|
+
);
|
|
420
|
+
const program = new Program(global.es2panda._AstNodeProgram(global.context, originalPeer));
|
|
403
421
|
if (!program.peer) {
|
|
404
422
|
// This can happen if we are calling this method on node that is in update now and parent chain does not lead to program
|
|
405
|
-
return `[${global.filePath}${sourcePosition.toString()}]
|
|
423
|
+
return `[${global.filePath}${sourcePosition.toString()}]`;
|
|
406
424
|
}
|
|
407
|
-
return `[${program.absoluteName}${sourcePosition.toString()}]
|
|
425
|
+
return `[${program.absoluteName}${sourcePosition.toString()}]`;
|
|
408
426
|
}
|
|
409
427
|
|
|
410
428
|
export function generateStaticDeclarationsFromContext(outputPath: string): KInt {
|
|
411
|
-
return global.generatedEs2panda._GenerateStaticDeclarationsFromContext(
|
|
412
|
-
global.context,
|
|
413
|
-
passString(outputPath)
|
|
414
|
-
);
|
|
429
|
+
return global.generatedEs2panda._GenerateStaticDeclarationsFromContext(global.context, passString(outputPath));
|
|
415
430
|
}
|
|
416
431
|
|
|
417
432
|
export function createTypeNodeFromTsType(node: AstNode): AstNode | undefined {
|
|
@@ -423,19 +438,47 @@ export function createTypeNodeFromTsType(node: AstNode): AstNode | undefined {
|
|
|
423
438
|
}
|
|
424
439
|
|
|
425
440
|
export function createSourcePosition(index: KUInt, line: KUInt): SourcePosition {
|
|
426
|
-
return new SourcePosition(global.generatedEs2panda._CreateSourcePosition(global.context, index, line))
|
|
441
|
+
return new SourcePosition(global.generatedEs2panda._CreateSourcePosition(global.context, index, line));
|
|
427
442
|
}
|
|
428
443
|
|
|
429
444
|
export function createSourceRange(start: SourcePosition, end: SourcePosition): SourceRange {
|
|
430
|
-
return new SourceRange(global.generatedEs2panda._CreateSourceRange(global.context, start.peer, end.peer))
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
export function createDiagnosticInfo(
|
|
434
|
-
|
|
445
|
+
return new SourceRange(global.generatedEs2panda._CreateSourceRange(global.context, start.peer, end.peer));
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
export function createDiagnosticInfo(
|
|
449
|
+
kind: DiagnosticKind,
|
|
450
|
+
position: SourcePosition,
|
|
451
|
+
...args: string[]
|
|
452
|
+
): DiagnosticInfo {
|
|
453
|
+
return new DiagnosticInfo(
|
|
454
|
+
global.es2panda._CreateDiagnosticInfo(
|
|
455
|
+
global.context,
|
|
456
|
+
kind.peer,
|
|
457
|
+
passStringArray(args),
|
|
458
|
+
args.length,
|
|
459
|
+
position.peer
|
|
460
|
+
)
|
|
461
|
+
);
|
|
435
462
|
}
|
|
436
463
|
|
|
437
|
-
export function createSuggestionInfo(
|
|
438
|
-
|
|
464
|
+
export function createSuggestionInfo(
|
|
465
|
+
kind: DiagnosticKind,
|
|
466
|
+
substitutionCode: string,
|
|
467
|
+
title: string,
|
|
468
|
+
range: SourceRange,
|
|
469
|
+
...args: string[]
|
|
470
|
+
): SuggestionInfo {
|
|
471
|
+
return new SuggestionInfo(
|
|
472
|
+
global.es2panda._CreateSuggestionInfo(
|
|
473
|
+
global.context,
|
|
474
|
+
kind.peer,
|
|
475
|
+
passStringArray(args),
|
|
476
|
+
args.length,
|
|
477
|
+
substitutionCode,
|
|
478
|
+
title,
|
|
479
|
+
range.peer
|
|
480
|
+
)
|
|
481
|
+
);
|
|
439
482
|
}
|
|
440
483
|
|
|
441
484
|
export function createDiagnosticKind(message: string, type: Es2pandaPluginDiagnosticType): DiagnosticKind {
|
|
@@ -449,3 +492,7 @@ export function logDiagnostic(kind: DiagnosticKind, pos: SourcePosition, ...args
|
|
|
449
492
|
export function logDiagnosticWithSuggestion(diagnosticInfo: DiagnosticInfo, suggestionInfo: SuggestionInfo): void {
|
|
450
493
|
global.generatedEs2panda._LogDiagnosticWithSuggestion(global.context, diagnosticInfo.peer, suggestionInfo.peer);
|
|
451
494
|
}
|
|
495
|
+
|
|
496
|
+
export function filterNodes(node: AstNode, filter: string): AstNode[] {
|
|
497
|
+
return unpackNodeArray(global.es2panda._FilterNodes(global.context, passNode(node), filter));
|
|
498
|
+
}
|