@idlizer/arktscgen 2.1.9-arktscgen-5 → 2.1.9-arktscgen-8
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 +151 -0
- package/build/libarkts-copy/native/meson.build +11 -12
- package/build/libarkts-copy/native/meson_options.txt +1 -1
- package/build/libarkts-copy/native/mingw.cross +14 -0
- package/build/libarkts-copy/native/src/bridges.cc +77 -1
- package/build/libarkts-copy/native/src/common.cc +5 -5
- package/build/libarkts-copy/native/src/generated/bridges.cc +312 -33
- package/build/libarkts-copy/package.json +24 -20
- package/build/libarkts-copy/src/Es2pandaNativeModule.ts +19 -1
- package/build/libarkts-copy/src/arkts-api/ChainExpressionFilter.ts +2 -1
- package/build/libarkts-copy/src/arkts-api/ImportStorage.ts +18 -12
- package/build/libarkts-copy/src/arkts-api/ProgramProvider.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/factory/nodeFactory.ts +15 -26
- package/build/libarkts-copy/src/arkts-api/index.ts +2 -4
- package/build/libarkts-copy/src/arkts-api/node-utilities/BlockStatement.ts +0 -4
- package/build/libarkts-copy/src/arkts-api/node-utilities/CallExpression.ts +1 -22
- package/build/libarkts-copy/src/arkts-api/node-utilities/ClassDefinition.ts +7 -8
- package/build/libarkts-copy/src/arkts-api/node-utilities/ClassProperty.ts +1 -22
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSFunctionType.ts +2 -5
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSImportDeclaration.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSModule.ts +44 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSParameterExpression.ts +1 -4
- package/build/libarkts-copy/src/arkts-api/node-utilities/MethodDefinition.ts +3 -7
- package/build/libarkts-copy/src/arkts-api/node-utilities/ObjectExpression.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/Program.ts +10 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ScriptFunction.ts +11 -7
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSInterfaceDeclaration.ts +3 -6
- package/build/libarkts-copy/src/arkts-api/peers/AstNode.ts +13 -12
- package/build/libarkts-copy/src/arkts-api/peers/Config.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/peers/Context.ts +35 -4
- package/build/libarkts-copy/src/arkts-api/plugins.ts +12 -3
- package/build/libarkts-copy/src/arkts-api/static/global.ts +2 -2
- package/build/libarkts-copy/src/{wrapper-compat/arkts-api → arkts-api}/static/globalUtils.ts +4 -4
- package/build/libarkts-copy/src/arkts-api/static/profiler.ts +0 -8
- package/build/libarkts-copy/src/arkts-api/utilities/extensions.ts +57 -0
- package/build/libarkts-copy/src/arkts-api/utilities/nativePtrDecoder.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/utilities/private.ts +6 -8
- package/build/libarkts-copy/src/arkts-api/utilities/public.ts +153 -29
- package/build/libarkts-copy/src/arkts-api/visitor.ts +16 -10
- package/build/libarkts-copy/src/checkSdk.ts +15 -0
- package/build/libarkts-copy/src/generated/Es2pandaEnums.ts +343 -321
- package/build/libarkts-copy/src/generated/Es2pandaNativeModule.ts +93 -12
- package/build/libarkts-copy/src/generated/factory.ts +38 -25
- package/build/libarkts-copy/src/generated/index.ts +2 -0
- package/build/libarkts-copy/src/generated/peers/ArrayExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ArrowFunctionExpression.ts +15 -3
- package/build/libarkts-copy/src/generated/peers/AssignmentExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/BlockExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/CallExpression.ts +10 -2
- package/build/libarkts-copy/src/generated/peers/ClassDeclaration.ts +11 -2
- package/build/libarkts-copy/src/generated/peers/ClassDefinition.ts +20 -4
- package/build/libarkts-copy/src/generated/peers/ClassProperty.ts +10 -2
- package/build/libarkts-copy/src/generated/peers/ETSClassLiteral.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSFunctionType.ts +12 -9
- package/build/libarkts-copy/src/generated/peers/ETSImportDeclaration.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSIntrinsicNode.ts +77 -0
- package/build/libarkts-copy/src/generated/peers/ETSKeyofType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSModule.ts +3 -1
- package/build/libarkts-copy/src/generated/peers/ETSNewArrayInstanceExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSNewClassInstanceExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSNewMultiDimArrayInstanceExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSNullType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSPackageDeclaration.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSParameterExpression.ts +29 -5
- package/build/libarkts-copy/src/generated/peers/ETSPrimitiveType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSReExportDeclaration.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSStringLiteralType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSStructDeclaration.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSTuple.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSTypeReference.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSTypeReferencePart.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSUndefinedType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSUnionType.ts +12 -3
- package/build/libarkts-copy/src/generated/peers/ETSWildcardType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/MethodDefinition.ts +14 -2
- package/build/libarkts-copy/src/generated/peers/ObjectExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/OpaqueTypeNode.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/OverloadDeclaration.ts +103 -0
- package/build/libarkts-copy/src/generated/peers/PrefixAssertionExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/Program.ts +8 -0
- package/build/libarkts-copy/src/generated/peers/Property.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/RegExpLiteral.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ReturnStatement.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ScriptFunction.ts +26 -9
- package/build/libarkts-copy/src/generated/peers/SequenceExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/SpreadElement.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/StringLiteral.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/SuperExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/SwitchCaseStatement.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/SwitchStatement.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSAnyKeyword.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSArrayType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSAsExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSBigintKeyword.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSBooleanKeyword.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSClassImplements.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSConditionalType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSConstructorType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSEnumDeclaration.ts +12 -3
- package/build/libarkts-copy/src/generated/peers/TSEnumMember.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSExternalModuleReference.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSFunctionType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSImportEqualsDeclaration.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSImportType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSIndexSignature.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSIndexedAccessType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSInferType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSInterfaceBody.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSInterfaceDeclaration.ts +12 -3
- package/build/libarkts-copy/src/generated/peers/TSInterfaceHeritage.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSIntersectionType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSLiteralType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSMappedType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSMethodSignature.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSModuleBlock.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSModuleDeclaration.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSNamedTupleMember.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSNeverKeyword.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSNonNullExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSNullKeyword.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSNumberKeyword.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSObjectKeyword.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSParameterProperty.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSParenthesizedType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSPropertySignature.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSQualifiedName.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSSignatureDeclaration.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSStringKeyword.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSThisType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSTupleType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSTypeAliasDeclaration.ts +29 -4
- package/build/libarkts-copy/src/generated/peers/TSTypeAssertion.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSTypeLiteral.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSTypeOperator.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSTypeParameter.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSTypeParameterDeclaration.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSTypeParameterInstantiation.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSTypePredicate.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSTypeQuery.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSTypeReference.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSUndefinedKeyword.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSUnionType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSUnknownKeyword.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSVoidKeyword.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TaggedTemplateExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TemplateElement.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TemplateLiteral.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ThisExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ThrowStatement.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TryStatement.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TypeofExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/UnaryExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/UpdateExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/VariableDeclaration.ts +11 -3
- package/build/libarkts-copy/src/generated/peers/VariableDeclarator.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/WhileStatement.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/YieldExpression.ts +1 -1
- package/build/libarkts-copy/src/index.ts +1 -4
- package/build/libarkts-copy/src/plugin-utils.ts +37 -37
- package/build/libarkts-copy/src/reexport-for-generated.ts +7 -0
- package/build/libarkts-copy/src/ts-api/factory/nodeFactory.ts +14 -14
- package/build/libarkts-copy/src/ts-api/index.ts +1 -1
- package/build/libarkts-copy/src/ts-api/types.ts +56 -56
- package/build/libarkts-copy/src/ts-api/utilities/private.ts +6 -6
- package/build/libarkts-copy/src/ts-api/utilities/public.ts +3 -3
- package/build/libarkts-copy/src/ts-api/visitor/visitor.ts +4 -4
- package/build/libarkts-copy/src/utils.ts +13 -159
- package/build/libarkts-copy/src/wrapper-compat/README.md +4 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/index.ts +3 -4
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ArrayExpression.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ArrowFunctionExpression.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/AssignmentExpression.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/BlockStatement.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/CallExpression.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ClassDeclaration.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ClassDefinition.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ClassProperty.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ETSFunctionType.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ETSImportDeclaration.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ETSParameterExpression.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ExpressionStatement.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/FunctionDeclaration.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/FunctionExpression.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/IfStatement.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/MemberExpression.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/MethodDefinition.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/NumberLiteral.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ObjectExpression.ts +3 -3
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/Property.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ScriptFunction.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/StructDeclaration.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TSInterfaceDeclaration.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TSTypeAliasDeclaration.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TSTypeParameter.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TryStatement.ts +3 -3
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/VariableDeclaration.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/VariableDeclarator.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Diagnostic.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/DiagnosticInfo.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/DiagnosticKind.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/ImportPathManager.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Program.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/SourceRange.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/SuggestionInfo.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/to-be-generated/MemberExpression.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/types.ts +10 -11
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/nativePtrDecoder.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/private.ts +4 -4
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/public.ts +6 -6
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/visitor.ts +10 -10
- package/lib/index.js +7194 -7097
- package/package.json +2 -2
- package/templates/Es2pandaNativeModule.ts +1 -1
- package/templates/bridges.cc +5 -0
- package/build/libarkts-copy/src/arkts-api/CheckedBackFilter.ts +0 -131
- package/build/libarkts-copy/src/arkts-api/CompileWithCache.ts +0 -193
- package/build/libarkts-copy/src/arkts-api/InferVoidReturnType.ts +0 -89
- package/build/libarkts-copy/src/arkts-api/SetBaseOverloads.ts +0 -44
- package/build/libarkts-copy/src/arkts-api/node-utilities/AnnotationUsage.ts +0 -29
- package/build/libarkts-copy/src/arkts-api/node-utilities/ArrowFunctionExpression.ts +0 -49
- package/build/libarkts-copy/src/arkts-api/node-utilities/ClassDeclaration.ts +0 -54
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeAliasDeclaration.ts +0 -68
- package/build/libarkts-copy/src/arkts-api/node-utilities/VariableDeclaration.ts +0 -54
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/ArktsObject.ts +0 -45
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Config.ts +0 -53
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Context.ts +0 -60
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/SourcePosition.ts +0 -38
|
@@ -18,7 +18,7 @@ import { defaultFilter, listPrograms } from "./plugins"
|
|
|
18
18
|
import { Program } from "../generated"
|
|
19
19
|
|
|
20
20
|
export class ProgramProvider {
|
|
21
|
-
//
|
|
21
|
+
// Improve: migrate to wrappers instead of pointers
|
|
22
22
|
seenPrograms: Set<KNativePointer> = new Set<KNativePointer>()
|
|
23
23
|
queue: Program[] = []
|
|
24
24
|
|
|
@@ -14,8 +14,12 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import {
|
|
17
|
+
BlockStatement,
|
|
18
|
+
CallExpression,
|
|
17
19
|
ClassDefinition,
|
|
20
|
+
ClassProperty,
|
|
18
21
|
ETSImportDeclaration,
|
|
22
|
+
ETSModule,
|
|
19
23
|
ETSStructDeclaration,
|
|
20
24
|
ETSTuple,
|
|
21
25
|
ETSTypeReferencePart,
|
|
@@ -27,7 +31,7 @@ import {
|
|
|
27
31
|
} from "../../generated"
|
|
28
32
|
import { factory as generatedFactory } from "../../generated/factory"
|
|
29
33
|
import { createScriptFunction, updateScriptFunction } from "../node-utilities/ScriptFunction"
|
|
30
|
-
import {
|
|
34
|
+
import { updateCallExpression } from "../node-utilities/CallExpression"
|
|
31
35
|
import { createNumberLiteral, updateNumberLiteral } from "../node-utilities/NumberLiteral"
|
|
32
36
|
import { updateMemberExpression } from "../node-utilities/MemberExpression"
|
|
33
37
|
import { createETSParameterExpression, updateETSParameterExpression } from "../node-utilities/ETSParameterExpression"
|
|
@@ -37,26 +41,25 @@ import { updateETSImportDeclaration } from "../node-utilities/ETSImportDeclarati
|
|
|
37
41
|
import { updateVariableDeclarator } from "../node-utilities/VariableDeclarator"
|
|
38
42
|
import { updateClassDefinition } from "../node-utilities/ClassDefinition"
|
|
39
43
|
import { updateETSStructDeclaration } from "../node-utilities/ETSStructDeclaration"
|
|
40
|
-
import {
|
|
44
|
+
import { updateClassProperty } from "../node-utilities/ClassProperty"
|
|
41
45
|
import { createETSFunctionType, updateETSFunctionType } from "../node-utilities/ETSFunctionType"
|
|
42
46
|
import { createMethodDefinition, updateMethodDefinition } from "../node-utilities/MethodDefinition"
|
|
43
47
|
import { createTSInterfaceDeclaration, updateTSInterfaceDeclaration } from "../node-utilities/TSInterfaceDeclaration"
|
|
44
|
-
import { createArrowFunctionExpression, updateArrowFunctionExpression } from "../node-utilities/ArrowFunctionExpression"
|
|
45
48
|
import { updateTryStatement } from "../node-utilities/TryStatement"
|
|
46
|
-
import { createVariableDeclaration, updateVariableDeclaration } from "../node-utilities/VariableDeclaration"
|
|
47
49
|
import { createAssignmentExpression, updateAssignmentExpression } from "../node-utilities/AssignmentExpression"
|
|
48
50
|
import { updateObjectExpression } from "../node-utilities/ObjectExpression"
|
|
49
51
|
import { updateETSTuple } from "../node-utilities/ETSTuple"
|
|
50
52
|
import { createArrayExpression, updateArrayExpression } from "../node-utilities/ArrayExpression"
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import { createBlockStatement, updateBlockStatement } from "../node-utilities/BlockStatement"
|
|
54
|
-
import { updateAnnotationUsage } from "../node-utilities/AnnotationUsage"
|
|
53
|
+
import { updateBlockStatement } from "../node-utilities/BlockStatement"
|
|
54
|
+
import { updateETSModule } from "../node-utilities/ETSModule"
|
|
55
55
|
|
|
56
56
|
export const factory = {
|
|
57
57
|
...generatedFactory,
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
createETSModule: ETSModule.createETSModule,
|
|
60
|
+
updateETSModule,
|
|
61
|
+
|
|
62
|
+
createCallExpression: CallExpression.createCallExpression,
|
|
60
63
|
updateCallExpression,
|
|
61
64
|
|
|
62
65
|
createMemberExpression: MemberExpression.createMemberExpression,
|
|
@@ -83,19 +86,13 @@ export const factory = {
|
|
|
83
86
|
createVariableDeclarator: VariableDeclarator.create1VariableDeclarator,
|
|
84
87
|
updateVariableDeclarator,
|
|
85
88
|
|
|
86
|
-
createVariableDeclaration,
|
|
87
|
-
updateVariableDeclaration,
|
|
88
|
-
|
|
89
89
|
createETSStructDeclaration: ETSStructDeclaration.createETSStructDeclaration,
|
|
90
90
|
updateETSStructDeclaration,
|
|
91
91
|
|
|
92
92
|
createClassDefinition: ClassDefinition.createClassDefinition,
|
|
93
93
|
updateClassDefinition,
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
updateClassDeclaration,
|
|
97
|
-
|
|
98
|
-
createClassProperty,
|
|
95
|
+
createClassProperty: ClassProperty.createClassProperty,
|
|
99
96
|
updateClassProperty,
|
|
100
97
|
|
|
101
98
|
createETSFunctionType,
|
|
@@ -107,9 +104,6 @@ export const factory = {
|
|
|
107
104
|
createInterfaceDeclaration: createTSInterfaceDeclaration,
|
|
108
105
|
updateInterfaceDeclaration: updateTSInterfaceDeclaration,
|
|
109
106
|
|
|
110
|
-
createArrowFunctionExpression,
|
|
111
|
-
updateArrowFunctionExpression,
|
|
112
|
-
|
|
113
107
|
createTryStatement: TryStatement.createTryStatement,
|
|
114
108
|
updateTryStatement,
|
|
115
109
|
|
|
@@ -125,13 +119,8 @@ export const factory = {
|
|
|
125
119
|
createArrayExpression,
|
|
126
120
|
updateArrayExpression,
|
|
127
121
|
|
|
128
|
-
|
|
129
|
-
updateTSTypeAliasDeclaration,
|
|
130
|
-
|
|
131
|
-
createBlockStatement,
|
|
122
|
+
createBlockStatement: BlockStatement.createBlockStatement,
|
|
132
123
|
updateBlockStatement,
|
|
133
124
|
|
|
134
|
-
|
|
135
|
-
update1AnnotationUsage: generatedFactory.updateAnnotationUsage,
|
|
136
|
-
updateInterfaceBody : generatedFactory.updateTSInterfaceBody
|
|
125
|
+
updateInterfaceBody : generatedFactory.updateTSInterfaceBody,
|
|
137
126
|
}
|
|
@@ -22,21 +22,19 @@ export * from "./factory/nodeFactory"
|
|
|
22
22
|
export * from "./visitor"
|
|
23
23
|
export * from "./AbstractVisitor"
|
|
24
24
|
export * from "./ChainExpressionFilter"
|
|
25
|
-
export * from "./CheckedBackFilter"
|
|
26
|
-
export * from "./SetBaseOverloads"
|
|
27
25
|
export * from "./plugins"
|
|
28
26
|
export * from "./ImportStorage"
|
|
29
|
-
export * from "./InferVoidReturnType"
|
|
30
27
|
export * from "./ProgramProvider"
|
|
31
|
-
export * from "./CompileWithCache"
|
|
32
28
|
|
|
33
29
|
export * from "./peers/AstNode"
|
|
34
30
|
export * from "./peers/Config"
|
|
35
31
|
export * from "./peers/Context"
|
|
32
|
+
export { GlobalContext } from "./peers/Context"
|
|
36
33
|
export * from "./peers/ExternalSource"
|
|
37
34
|
export * from "./peers/Options"
|
|
38
35
|
export * from "./node-utilities/ArkTsConfig"
|
|
39
36
|
export * from "./node-utilities/Program"
|
|
40
37
|
export * from "./peers/ImportPathManager"
|
|
38
|
+
export * from "./static/globalUtils"
|
|
41
39
|
export { global as arktsGlobal } from "./static/global"
|
|
42
40
|
export * from "./wrapper-compat"
|
|
@@ -17,10 +17,6 @@ import { BlockStatement, Statement } from "../../generated"
|
|
|
17
17
|
import { isSameNativeObject } from "../peers/ArktsObject"
|
|
18
18
|
import { updateNodeByNode } from "../utilities/private"
|
|
19
19
|
|
|
20
|
-
export function createBlockStatement(statements: readonly Statement[]): BlockStatement {
|
|
21
|
-
return BlockStatement.createBlockStatement(statements)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
20
|
export function updateBlockStatement(original: BlockStatement, statements: readonly Statement[]): BlockStatement {
|
|
25
21
|
if (isSameNativeObject(statements, original.statements)) {
|
|
26
22
|
return original
|
|
@@ -17,27 +17,6 @@ import { BlockStatement, CallExpression, Expression, TSTypeParameterInstantiatio
|
|
|
17
17
|
import { isSameNativeObject } from "../peers/ArktsObject"
|
|
18
18
|
import { updateNodeByNode } from "../utilities/private"
|
|
19
19
|
|
|
20
|
-
export function createCallExpression(
|
|
21
|
-
callee: Expression | undefined,
|
|
22
|
-
_arguments: readonly Expression[],
|
|
23
|
-
typeParams: TSTypeParameterInstantiation | undefined,
|
|
24
|
-
optional_arg: boolean = false,
|
|
25
|
-
trailingComma: boolean = false,
|
|
26
|
-
trailingBlock: BlockStatement | undefined = undefined,
|
|
27
|
-
): CallExpression {
|
|
28
|
-
const res = CallExpression.createCallExpression(
|
|
29
|
-
callee,
|
|
30
|
-
_arguments,
|
|
31
|
-
typeParams,
|
|
32
|
-
optional_arg,
|
|
33
|
-
trailingComma,
|
|
34
|
-
)
|
|
35
|
-
if (trailingBlock) {
|
|
36
|
-
res.setTrailingBlock(trailingBlock)
|
|
37
|
-
}
|
|
38
|
-
return res
|
|
39
|
-
}
|
|
40
|
-
|
|
41
20
|
export function updateCallExpression(
|
|
42
21
|
original: CallExpression,
|
|
43
22
|
callee: Expression | undefined,
|
|
@@ -57,7 +36,7 @@ export function updateCallExpression(
|
|
|
57
36
|
return original
|
|
58
37
|
}
|
|
59
38
|
return updateNodeByNode(
|
|
60
|
-
createCallExpression(callee, _arguments, typeParams, optional_arg, trailingComma, trailingBlock),
|
|
39
|
+
CallExpression.createCallExpression(callee, _arguments, typeParams, optional_arg, trailingComma, trailingBlock),
|
|
61
40
|
original
|
|
62
41
|
)
|
|
63
42
|
}
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import {
|
|
17
|
+
AnnotationUsage,
|
|
17
18
|
ClassDefinition,
|
|
18
19
|
Expression,
|
|
19
20
|
Identifier,
|
|
20
|
-
isMethodDefinition,
|
|
21
21
|
MethodDefinition,
|
|
22
22
|
TSClassImplements,
|
|
23
23
|
TSTypeParameterDeclaration,
|
|
@@ -27,7 +27,6 @@ import { isSameNativeObject } from "../peers/ArktsObject"
|
|
|
27
27
|
import { updateNodeByNode } from "../utilities/private"
|
|
28
28
|
import { AstNode } from "../peers/AstNode"
|
|
29
29
|
import { Es2pandaClassDefinitionModifiers, Es2pandaModifierFlags } from "../../generated/Es2pandaEnums"
|
|
30
|
-
import { throwError } from "../../utils"
|
|
31
30
|
|
|
32
31
|
export function updateClassDefinition(
|
|
33
32
|
original: ClassDefinition,
|
|
@@ -39,11 +38,9 @@ export function updateClassDefinition(
|
|
|
39
38
|
superClass: Expression | undefined,
|
|
40
39
|
body: readonly AstNode[],
|
|
41
40
|
modifiers: Es2pandaClassDefinitionModifiers,
|
|
42
|
-
flags: Es2pandaModifierFlags
|
|
41
|
+
flags: Es2pandaModifierFlags,
|
|
42
|
+
annotations?: readonly AnnotationUsage[]
|
|
43
43
|
): ClassDefinition {
|
|
44
|
-
if (original.ctor !== undefined && !isMethodDefinition(original.ctor)) {
|
|
45
|
-
throwError(`class definition constructor is not method definition: ${ctor?.dump()}`)
|
|
46
|
-
}
|
|
47
44
|
if (isSameNativeObject(ident, original.ident)
|
|
48
45
|
&& (isSameNativeObject(typeParams, original.typeParams))
|
|
49
46
|
&& (isSameNativeObject(superTypeParams, original.superTypeParams))
|
|
@@ -53,6 +50,7 @@ export function updateClassDefinition(
|
|
|
53
50
|
&& (isSameNativeObject(body, original.body))
|
|
54
51
|
&& (isSameNativeObject(modifiers, original.modifiers))
|
|
55
52
|
&& (isSameNativeObject(flags, original.modifierFlags))
|
|
53
|
+
&& (isSameNativeObject(annotations, original.annotations))
|
|
56
54
|
) {
|
|
57
55
|
return original
|
|
58
56
|
}
|
|
@@ -66,8 +64,9 @@ export function updateClassDefinition(
|
|
|
66
64
|
superClass,
|
|
67
65
|
body,
|
|
68
66
|
modifiers,
|
|
69
|
-
flags
|
|
70
|
-
|
|
67
|
+
flags,
|
|
68
|
+
annotations,
|
|
69
|
+
),
|
|
71
70
|
original
|
|
72
71
|
)
|
|
73
72
|
}
|
|
@@ -18,27 +18,6 @@ import { Es2pandaModifierFlags } from "../../generated/Es2pandaEnums"
|
|
|
18
18
|
import { isSameNativeObject } from "../peers/ArktsObject"
|
|
19
19
|
import { updateNodeByNode } from "../utilities/private"
|
|
20
20
|
|
|
21
|
-
export function createClassProperty(
|
|
22
|
-
key: Expression | undefined,
|
|
23
|
-
value: Expression | undefined,
|
|
24
|
-
typeAnnotation: TypeNode | undefined,
|
|
25
|
-
modifiers: Es2pandaModifierFlags,
|
|
26
|
-
isComputed: boolean,
|
|
27
|
-
annotations?: readonly AnnotationUsage[],
|
|
28
|
-
): ClassProperty {
|
|
29
|
-
const res = ClassProperty.createClassProperty(
|
|
30
|
-
key,
|
|
31
|
-
value,
|
|
32
|
-
typeAnnotation,
|
|
33
|
-
modifiers,
|
|
34
|
-
isComputed,
|
|
35
|
-
)
|
|
36
|
-
if (annotations) {
|
|
37
|
-
res.setAnnotations(annotations)
|
|
38
|
-
}
|
|
39
|
-
return res
|
|
40
|
-
}
|
|
41
|
-
|
|
42
21
|
export function updateClassProperty(
|
|
43
22
|
original: ClassProperty,
|
|
44
23
|
key: Expression | undefined,
|
|
@@ -58,7 +37,7 @@ export function updateClassProperty(
|
|
|
58
37
|
return original
|
|
59
38
|
}
|
|
60
39
|
return updateNodeByNode(
|
|
61
|
-
createClassProperty(key, value, typeAnnotation, modifiers, isComputed, annotations),
|
|
40
|
+
ClassProperty.createClassProperty(key, value, typeAnnotation, modifiers, isComputed, annotations),
|
|
62
41
|
original
|
|
63
42
|
)
|
|
64
43
|
}
|
|
@@ -26,7 +26,7 @@ export function createETSFunctionType(
|
|
|
26
26
|
funcFlags: Es2pandaScriptFunctionFlags,
|
|
27
27
|
annotations?: readonly AnnotationUsage[],
|
|
28
28
|
): ETSFunctionType {
|
|
29
|
-
|
|
29
|
+
return ETSFunctionType.createETSFunctionType(
|
|
30
30
|
FunctionSignature.createFunctionSignature(
|
|
31
31
|
typeParams,
|
|
32
32
|
params,
|
|
@@ -34,11 +34,8 @@ export function createETSFunctionType(
|
|
|
34
34
|
hasReceiver,
|
|
35
35
|
),
|
|
36
36
|
funcFlags,
|
|
37
|
+
annotations,
|
|
37
38
|
)
|
|
38
|
-
if (annotations) {
|
|
39
|
-
res.setAnnotations(annotations)
|
|
40
|
-
}
|
|
41
|
-
return res
|
|
42
39
|
}
|
|
43
40
|
|
|
44
41
|
export function updateETSFunctionType(
|
|
@@ -29,7 +29,7 @@ export function updateETSImportDeclaration(
|
|
|
29
29
|
&& isSameNativeObject(specifiers, original.specifiers)
|
|
30
30
|
/* no getter for importKind */
|
|
31
31
|
) {
|
|
32
|
-
/*
|
|
32
|
+
/* Improve: probably should set importMetadata, but no getter provided yet */
|
|
33
33
|
return original
|
|
34
34
|
}
|
|
35
35
|
return updateNodeByNode(
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { ETSModule, Identifier, Program, Statement } from "../../generated"
|
|
17
|
+
import { isSameNativeObject } from "../peers/ArktsObject"
|
|
18
|
+
import { updateNodeByNode } from "../utilities/private"
|
|
19
|
+
import { Es2pandaModuleFlag } from "../../generated/Es2pandaEnums"
|
|
20
|
+
|
|
21
|
+
export function updateETSModule(
|
|
22
|
+
original: ETSModule,
|
|
23
|
+
statementList: readonly Statement[],
|
|
24
|
+
ident: Identifier | undefined,
|
|
25
|
+
flag: Es2pandaModuleFlag,
|
|
26
|
+
program?: Program,
|
|
27
|
+
) {
|
|
28
|
+
if (isSameNativeObject(statementList, original.statements)
|
|
29
|
+
&& isSameNativeObject(ident, original.ident)
|
|
30
|
+
&& isSameNativeObject(flag, original.getNamespaceFlag())
|
|
31
|
+
&& isSameNativeObject(program, original.program)
|
|
32
|
+
) {
|
|
33
|
+
return original
|
|
34
|
+
}
|
|
35
|
+
return updateNodeByNode(
|
|
36
|
+
ETSModule.createETSModule(
|
|
37
|
+
statementList,
|
|
38
|
+
ident,
|
|
39
|
+
flag,
|
|
40
|
+
program,
|
|
41
|
+
),
|
|
42
|
+
original,
|
|
43
|
+
)
|
|
44
|
+
}
|
|
@@ -23,13 +23,10 @@ export function createETSParameterExpression(
|
|
|
23
23
|
initExpr?: Expression,
|
|
24
24
|
annotations?: readonly AnnotationUsage[]
|
|
25
25
|
): ETSParameterExpression {
|
|
26
|
-
const res = ETSParameterExpression.createETSParameterExpression(identOrSpread, isOptional)
|
|
26
|
+
const res = ETSParameterExpression.createETSParameterExpression(identOrSpread, isOptional, annotations)
|
|
27
27
|
if (initExpr) {
|
|
28
28
|
res.setInitializer(initExpr)
|
|
29
29
|
}
|
|
30
|
-
if (annotations) {
|
|
31
|
-
res.setAnnotations(annotations)
|
|
32
|
-
}
|
|
33
30
|
return res
|
|
34
31
|
}
|
|
35
32
|
|
|
@@ -13,11 +13,10 @@
|
|
|
13
13
|
* limitations under the License.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import {
|
|
16
|
+
import { Expression, MethodDefinition } from "../../generated"
|
|
17
17
|
import {
|
|
18
18
|
Es2pandaMethodDefinitionKind,
|
|
19
19
|
Es2pandaModifierFlags,
|
|
20
|
-
Es2pandaScriptFunctionFlags
|
|
21
20
|
} from "../../generated/Es2pandaEnums"
|
|
22
21
|
import { isSameNativeObject } from "../peers/ArktsObject"
|
|
23
22
|
import { updateNodeByNode } from "../utilities/private"
|
|
@@ -30,17 +29,14 @@ export function createMethodDefinition(
|
|
|
30
29
|
isComputed: boolean,
|
|
31
30
|
overloads?: readonly MethodDefinition[]
|
|
32
31
|
): MethodDefinition {
|
|
33
|
-
|
|
32
|
+
return MethodDefinition.createMethodDefinition(
|
|
34
33
|
kind,
|
|
35
34
|
key,
|
|
36
35
|
value,
|
|
37
36
|
modifiers,
|
|
38
37
|
isComputed,
|
|
38
|
+
overloads,
|
|
39
39
|
)
|
|
40
|
-
if (overloads) {
|
|
41
|
-
res.setOverloads(overloads)
|
|
42
|
-
}
|
|
43
|
-
return res
|
|
44
40
|
}
|
|
45
41
|
|
|
46
42
|
export function updateMethodDefinition(
|
|
@@ -28,7 +28,7 @@ export function updateObjectExpression(
|
|
|
28
28
|
ObjectExpression.createObjectExpression(
|
|
29
29
|
nodeType(original),
|
|
30
30
|
properties,
|
|
31
|
-
false), //
|
|
31
|
+
false), // Improve: provide trailingComma value from native module through ObjectExpression?
|
|
32
32
|
original
|
|
33
33
|
)
|
|
34
34
|
}
|
|
@@ -38,3 +38,13 @@ export function dumpProgramInfo(program: Program) {
|
|
|
38
38
|
console.log(`\tSourceFileFolder: ${program.sourceFileFolder}`)
|
|
39
39
|
console.log(`\tSourceFilePath: ${program.sourceFilePath}`)
|
|
40
40
|
}
|
|
41
|
+
|
|
42
|
+
export function dumpProgramSrcFormatted(program: Program, recursive: boolean, withLines: boolean = true) {
|
|
43
|
+
const lines = program.ast.dumpSrc()
|
|
44
|
+
console.log(`// file: ${program.absoluteName}`)
|
|
45
|
+
if (withLines) {
|
|
46
|
+
console.log(lines.split('\n').map((it, index) => `${`${index + 1}`.padStart(4)} |${it}`).join('\n'))
|
|
47
|
+
} else {
|
|
48
|
+
console.log(lines)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -26,6 +26,7 @@ import { AstNode } from "../peers/AstNode"
|
|
|
26
26
|
import { Es2pandaModifierFlags, Es2pandaScriptFunctionFlags } from "../../generated/Es2pandaEnums"
|
|
27
27
|
import { isSameNativeObject } from "../peers/ArktsObject"
|
|
28
28
|
import { updateNodeByNode } from "../utilities/private"
|
|
29
|
+
import { KNativePointer } from "@koalaui/interop"
|
|
29
30
|
|
|
30
31
|
export function createScriptFunction(
|
|
31
32
|
databody: AstNode | undefined,
|
|
@@ -37,6 +38,7 @@ export function createScriptFunction(
|
|
|
37
38
|
dataflags: Es2pandaModifierFlags,
|
|
38
39
|
ident: Identifier | undefined,
|
|
39
40
|
annotations: readonly AnnotationUsage[] | undefined,
|
|
41
|
+
preferredReturnTypePointer?: KNativePointer,
|
|
40
42
|
) {
|
|
41
43
|
const res = ScriptFunction.createScriptFunction(
|
|
42
44
|
databody,
|
|
@@ -47,13 +49,12 @@ export function createScriptFunction(
|
|
|
47
49
|
hasReceiver,
|
|
48
50
|
),
|
|
49
51
|
datafuncFlags,
|
|
50
|
-
dataflags
|
|
52
|
+
dataflags,
|
|
53
|
+
ident,
|
|
54
|
+
annotations,
|
|
51
55
|
)
|
|
52
|
-
if (
|
|
53
|
-
res.
|
|
54
|
-
}
|
|
55
|
-
if (annotations) {
|
|
56
|
-
res.setAnnotations(annotations)
|
|
56
|
+
if (preferredReturnTypePointer) {
|
|
57
|
+
res.setPreferredReturnTypePointer(preferredReturnTypePointer)
|
|
57
58
|
}
|
|
58
59
|
return res
|
|
59
60
|
}
|
|
@@ -69,6 +70,7 @@ export function updateScriptFunction(
|
|
|
69
70
|
dataflags: Es2pandaModifierFlags,
|
|
70
71
|
ident: Identifier | undefined,
|
|
71
72
|
annotations: readonly AnnotationUsage[] | undefined,
|
|
73
|
+
preferredReturnTypePointer?: KNativePointer,
|
|
72
74
|
) {
|
|
73
75
|
if (isSameNativeObject(databody, original.body)
|
|
74
76
|
&& isSameNativeObject(typeParams, original.typeParams)
|
|
@@ -79,6 +81,7 @@ export function updateScriptFunction(
|
|
|
79
81
|
&& isSameNativeObject(dataflags, original.modifierFlags)
|
|
80
82
|
&& isSameNativeObject(ident, original.id)
|
|
81
83
|
&& isSameNativeObject(annotations, original.annotations)
|
|
84
|
+
&& preferredReturnTypePointer == original.getPreferredReturnTypePointer()
|
|
82
85
|
) {
|
|
83
86
|
return original
|
|
84
87
|
}
|
|
@@ -92,7 +95,8 @@ export function updateScriptFunction(
|
|
|
92
95
|
datafuncFlags,
|
|
93
96
|
dataflags,
|
|
94
97
|
ident,
|
|
95
|
-
annotations
|
|
98
|
+
annotations,
|
|
99
|
+
preferredReturnTypePointer,
|
|
96
100
|
),
|
|
97
101
|
original
|
|
98
102
|
)
|
|
@@ -32,18 +32,15 @@ export function createTSInterfaceDeclaration(
|
|
|
32
32
|
isExternal: boolean,
|
|
33
33
|
modifierFlags?: Es2pandaModifierFlags,
|
|
34
34
|
): TSInterfaceDeclaration {
|
|
35
|
-
|
|
35
|
+
return TSInterfaceDeclaration.createTSInterfaceDeclaration(
|
|
36
36
|
_extends,
|
|
37
37
|
id,
|
|
38
38
|
typeParams,
|
|
39
39
|
body,
|
|
40
40
|
isStatic,
|
|
41
|
-
isExternal
|
|
41
|
+
isExternal,
|
|
42
|
+
modifierFlags,
|
|
42
43
|
)
|
|
43
|
-
if (modifierFlags) {
|
|
44
|
-
res.modifierFlags = modifierFlags
|
|
45
|
-
}
|
|
46
|
-
return res
|
|
47
44
|
}
|
|
48
45
|
|
|
49
46
|
export function updateTSInterfaceDeclaration(
|
|
@@ -59,14 +59,6 @@ export abstract class AstNode extends ArktsObject {
|
|
|
59
59
|
)
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
public setChildrenParentPtr(): this {
|
|
63
|
-
if (this.peer === nullptr) {
|
|
64
|
-
throwError('AstNodeSetChildrenParentPtr called on NULLPTR')
|
|
65
|
-
}
|
|
66
|
-
global.es2panda._AstNodeSetChildrenParentPtr(global.context, this.peer)
|
|
67
|
-
return this
|
|
68
|
-
}
|
|
69
|
-
|
|
70
62
|
public updateModifiers(modifierFlags: KInt | undefined): this {
|
|
71
63
|
global.generatedEs2panda._AstNodeClearModifier(global.context, this.peer, allFlags)
|
|
72
64
|
global.generatedEs2panda._AstNodeAddModifier(global.context, this.peer, modifierFlags ?? Es2pandaModifierFlags.MODIFIER_FLAGS_NONE)
|
|
@@ -151,10 +143,19 @@ export abstract class AstNode extends ArktsObject {
|
|
|
151
143
|
this.modifierFlags = flags
|
|
152
144
|
}
|
|
153
145
|
|
|
154
|
-
public
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
146
|
+
public setChildrenParentPtr(): void {
|
|
147
|
+
if (this.peer === nullptr) {
|
|
148
|
+
throwError('setChildrenParentPtr called on NULLPTR')
|
|
149
|
+
}
|
|
150
|
+
global.es2panda._AstNodeSetChildrenParentPtr(global.context, this.peer)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
public override onUpdate(original: AstNode): void {
|
|
154
|
+
// Improve: Update modifiers only for specific AST nodes in the generated factory code
|
|
155
|
+
this.modifierFlags = original.modifierFlags
|
|
156
|
+
global.generatedEs2panda._AstNodeSetOriginalNode(global.context, this.peer, original.originalPeer)
|
|
157
|
+
global.generatedEs2panda._AstNodeSetParent(global.context, this.peer, global.generatedEs2panda._AstNodeParent(global.context, original.peer))
|
|
158
|
+
this.setChildrenParentPtr()
|
|
158
159
|
}
|
|
159
160
|
|
|
160
161
|
public get isExport(): boolean {
|
|
@@ -21,7 +21,7 @@ import { KNativePointer, nullptr } from "@koalaui/interop"
|
|
|
21
21
|
export class Config extends ArktsObject {
|
|
22
22
|
constructor(peer: KNativePointer) {
|
|
23
23
|
super(peer)
|
|
24
|
-
//
|
|
24
|
+
// Improve: wait for getter from api
|
|
25
25
|
this.path = ``
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -17,17 +17,17 @@ import { ArktsObject } from "./ArktsObject"
|
|
|
17
17
|
import { Program } from "../../generated"
|
|
18
18
|
import { global } from "../static/global"
|
|
19
19
|
import { passString, passStringArray } from "../utilities/private"
|
|
20
|
-
import { KNativePointer, nullptr } from "@koalaui/interop"
|
|
20
|
+
import { KNativePointer, nullptr, KBoolean } from "@koalaui/interop"
|
|
21
21
|
import { Config } from "./Config"
|
|
22
|
+
import { filterSource, throwError } from "../../utils"
|
|
23
|
+
import { AstNode } from "./AstNode"
|
|
22
24
|
|
|
23
25
|
export class Context extends ArktsObject {
|
|
24
26
|
constructor(peer: KNativePointer) {
|
|
25
27
|
super(peer)
|
|
26
28
|
}
|
|
27
29
|
|
|
28
|
-
static createFromString(
|
|
29
|
-
source: string
|
|
30
|
-
): Context {
|
|
30
|
+
static createFromString(source: string): Context {
|
|
31
31
|
if (!global.configIsInitialized()) {
|
|
32
32
|
throw new Error(`Config not initialized`)
|
|
33
33
|
}
|
|
@@ -39,6 +39,18 @@ export class Context extends ArktsObject {
|
|
|
39
39
|
)
|
|
40
40
|
)
|
|
41
41
|
}
|
|
42
|
+
|
|
43
|
+
/** @deprecated Use {@link createCacheFromFile} instead */
|
|
44
|
+
static createCacheContextFromFile(
|
|
45
|
+
configPtr: KNativePointer,
|
|
46
|
+
fileName: string,
|
|
47
|
+
globalContextPtr: KNativePointer,
|
|
48
|
+
isExternal: KBoolean
|
|
49
|
+
): Context {
|
|
50
|
+
return new Context(
|
|
51
|
+
global.es2panda._CreateCacheContextFromFile(configPtr, passString(fileName), globalContextPtr, isExternal)
|
|
52
|
+
);
|
|
53
|
+
}
|
|
42
54
|
|
|
43
55
|
static createFromFile(filePath: string, configPath: string, stdlibPath: string, outputPath: string): Context | undefined {
|
|
44
56
|
const config = Config.create([
|
|
@@ -72,6 +84,15 @@ export class Context extends ArktsObject {
|
|
|
72
84
|
)
|
|
73
85
|
}
|
|
74
86
|
|
|
87
|
+
static createContextGenerateAbcForExternalSourceFiles(
|
|
88
|
+
filenames: string[]): Context {
|
|
89
|
+
if (!global.configIsInitialized()) {
|
|
90
|
+
throwError(`Config not initialized`);
|
|
91
|
+
}
|
|
92
|
+
return new Context(
|
|
93
|
+
global.es2panda._CreateContextGenerateAbcForExternalSourceFiles(global.config, filenames.length, passStringArray(filenames))
|
|
94
|
+
);
|
|
95
|
+
}
|
|
75
96
|
|
|
76
97
|
destroy() {
|
|
77
98
|
if (this.peer != nullptr) {
|
|
@@ -79,6 +100,16 @@ export class Context extends ArktsObject {
|
|
|
79
100
|
this.peer = nullptr
|
|
80
101
|
}
|
|
81
102
|
}
|
|
103
|
+
|
|
104
|
+
/** @deprecated */
|
|
105
|
+
static destroyAndRecreate(ast: AstNode): Context {
|
|
106
|
+
console.log('[TS WRAPPER] DESTROY AND RECREATE');
|
|
107
|
+
const source = filterSource(ast.dumpSrc());
|
|
108
|
+
global.es2panda._DestroyContext(global.context);
|
|
109
|
+
global.compilerContext = Context.createFromString(source) as any; // Improve: commonize Context
|
|
110
|
+
|
|
111
|
+
return new Context(global.context);
|
|
112
|
+
}
|
|
82
113
|
|
|
83
114
|
get program(): Program {
|
|
84
115
|
return new Program(global.es2panda._ContextProgram(this.peer));
|
|
@@ -19,18 +19,18 @@ import { ExternalSource } from "./peers/ExternalSource"
|
|
|
19
19
|
import { programGetExternalSources } from "./node-utilities/Program"
|
|
20
20
|
import { KNativePointer } from "@koalaui/interop"
|
|
21
21
|
import { global } from "./static/global"
|
|
22
|
+
import { RunTransformerHooks } from "../plugin-utils"
|
|
22
23
|
|
|
23
24
|
export interface CompilationOptions {
|
|
24
25
|
readonly isMainProgram: boolean,
|
|
25
|
-
readonly
|
|
26
|
-
readonly restart: boolean,
|
|
26
|
+
readonly state: Es2pandaContextState,
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export interface PluginContext {
|
|
30
30
|
setParameter<V>(name: string, value: V): void
|
|
31
31
|
parameter<V>(name: string) : V | undefined
|
|
32
|
-
|
|
33
32
|
}
|
|
33
|
+
|
|
34
34
|
export class PluginContextImpl implements PluginContext {
|
|
35
35
|
map = new Map<String, Object|undefined>()
|
|
36
36
|
parameter<V>(name: string): V|undefined {
|
|
@@ -60,3 +60,12 @@ export function listPrograms(program: Program, filter: (name: string) => boolean
|
|
|
60
60
|
})
|
|
61
61
|
]
|
|
62
62
|
}
|
|
63
|
+
|
|
64
|
+
export interface PluginEntry {
|
|
65
|
+
name?: string
|
|
66
|
+
parsed?: (hooks?: RunTransformerHooks) => void
|
|
67
|
+
checked?: (hooks?: RunTransformerHooks) => void
|
|
68
|
+
clean?: (hooks?: RunTransformerHooks) => void
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export type PluginInitializer = (parsedJson?: Object, checkedJson?: Object) => PluginEntry
|