@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
|
@@ -1,68 +0,0 @@
|
|
|
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 { Es2pandaModifierFlags } from ".."
|
|
17
|
-
import { AnnotationUsage, Identifier, TSTypeAliasDeclaration, TSTypeParameterDeclaration, TypeNode } from "../../generated"
|
|
18
|
-
import { isSameNativeObject } from "../peers/ArktsObject"
|
|
19
|
-
import { updateNodeByNode } from "../utilities/private"
|
|
20
|
-
|
|
21
|
-
export function createTSTypeAliasDeclaration(
|
|
22
|
-
id?: Identifier,
|
|
23
|
-
typeParams?: TSTypeParameterDeclaration,
|
|
24
|
-
typeAnnotation?: TypeNode,
|
|
25
|
-
annotations?: readonly AnnotationUsage[],
|
|
26
|
-
modifiers?: Es2pandaModifierFlags
|
|
27
|
-
): TSTypeAliasDeclaration {
|
|
28
|
-
const res = TSTypeAliasDeclaration.createTSTypeAliasDeclaration(
|
|
29
|
-
id,
|
|
30
|
-
typeParams,
|
|
31
|
-
typeAnnotation
|
|
32
|
-
)
|
|
33
|
-
if (annotations) {
|
|
34
|
-
res.setAnnotations(annotations)
|
|
35
|
-
}
|
|
36
|
-
if (modifiers) {
|
|
37
|
-
res.modifierFlags = modifiers
|
|
38
|
-
}
|
|
39
|
-
return res
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function updateTSTypeAliasDeclaration(
|
|
43
|
-
original: TSTypeAliasDeclaration,
|
|
44
|
-
id?: Identifier,
|
|
45
|
-
typeParams?: TSTypeParameterDeclaration,
|
|
46
|
-
typeAnnotation?: TypeNode,
|
|
47
|
-
annotations?: readonly AnnotationUsage[],
|
|
48
|
-
modifiers?: Es2pandaModifierFlags
|
|
49
|
-
): TSTypeAliasDeclaration {
|
|
50
|
-
if (isSameNativeObject(id, original.id)
|
|
51
|
-
&& isSameNativeObject(typeParams, original.typeParams)
|
|
52
|
-
&& isSameNativeObject(typeAnnotation, original.typeAnnotation)
|
|
53
|
-
&& isSameNativeObject(annotations, original.annotations)
|
|
54
|
-
&& isSameNativeObject(modifiers, original.modifierFlags)
|
|
55
|
-
) {
|
|
56
|
-
return original
|
|
57
|
-
}
|
|
58
|
-
return updateNodeByNode(
|
|
59
|
-
createTSTypeAliasDeclaration(
|
|
60
|
-
id,
|
|
61
|
-
typeParams,
|
|
62
|
-
typeAnnotation,
|
|
63
|
-
annotations,
|
|
64
|
-
modifiers
|
|
65
|
-
),
|
|
66
|
-
original,
|
|
67
|
-
)
|
|
68
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2025 Huawei Device Co., Ltd.
|
|
3
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License.
|
|
5
|
-
* You may obtain a copy of the License at
|
|
6
|
-
*
|
|
7
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
*
|
|
9
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
* See the License for the specific language governing permissions and
|
|
13
|
-
* limitations under the License.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import { AnnotationUsage, VariableDeclaration, VariableDeclarator } from "../../generated"
|
|
17
|
-
import { Es2pandaVariableDeclarationKind } from "../../generated/Es2pandaEnums"
|
|
18
|
-
import { isSameNativeObject } from "../peers/ArktsObject"
|
|
19
|
-
import { updateNodeByNode } from "../utilities/private"
|
|
20
|
-
|
|
21
|
-
export function createVariableDeclaration(
|
|
22
|
-
kind: Es2pandaVariableDeclarationKind,
|
|
23
|
-
declarators: readonly VariableDeclarator[],
|
|
24
|
-
annotations?: readonly AnnotationUsage[]
|
|
25
|
-
): VariableDeclaration {
|
|
26
|
-
const res = VariableDeclaration.createVariableDeclaration(
|
|
27
|
-
kind,
|
|
28
|
-
declarators
|
|
29
|
-
)
|
|
30
|
-
if (annotations) {
|
|
31
|
-
res.setAnnotations(
|
|
32
|
-
annotations
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
return res
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function updateVariableDeclaration(
|
|
39
|
-
original: VariableDeclaration,
|
|
40
|
-
kind: Es2pandaVariableDeclarationKind,
|
|
41
|
-
declarators: readonly VariableDeclarator[],
|
|
42
|
-
annotations?: readonly AnnotationUsage[]
|
|
43
|
-
): VariableDeclaration {
|
|
44
|
-
if (isSameNativeObject(kind, original.kind)
|
|
45
|
-
&& isSameNativeObject(declarators, original.declarators)
|
|
46
|
-
&& isSameNativeObject(annotations, original.annotations)
|
|
47
|
-
) {
|
|
48
|
-
return original
|
|
49
|
-
}
|
|
50
|
-
return updateNodeByNode(
|
|
51
|
-
createVariableDeclaration(kind, declarators, annotations),
|
|
52
|
-
original
|
|
53
|
-
)
|
|
54
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2025 Huawei Device Co., Ltd.
|
|
3
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License.
|
|
5
|
-
* You may obtain a copy of the License at
|
|
6
|
-
*
|
|
7
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
*
|
|
9
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
* See the License for the specific language governing permissions and
|
|
13
|
-
* limitations under the License.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import { KNativePointer } from '@koalaui/interop';
|
|
17
|
-
|
|
18
|
-
export abstract class ArktsObject {
|
|
19
|
-
protected constructor(peer: KNativePointer) {
|
|
20
|
-
this.peer = peer;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
readonly peer: KNativePointer;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function isSameNativeObject<T extends ArktsObject | number | string | boolean | undefined>(
|
|
27
|
-
first: T | readonly T[],
|
|
28
|
-
second: T | readonly T[]
|
|
29
|
-
): boolean {
|
|
30
|
-
if (Array.isArray(first) && Array.isArray(second)) {
|
|
31
|
-
if (first.length !== second.length) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
for (let i = 0; i < first.length; i++) {
|
|
35
|
-
if (!isSameNativeObject(first[i], second[i])) {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
if (first instanceof ArktsObject && second instanceof ArktsObject) {
|
|
42
|
-
return first?.peer === second?.peer;
|
|
43
|
-
}
|
|
44
|
-
return first === second;
|
|
45
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2025 Huawei Device Co., Ltd.
|
|
3
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License.
|
|
5
|
-
* You may obtain a copy of the License at
|
|
6
|
-
*
|
|
7
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
*
|
|
9
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
* See the License for the specific language governing permissions and
|
|
13
|
-
* limitations under the License.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import { ArktsObject } from "./ArktsObject"
|
|
17
|
-
import { global } from "../static/global"
|
|
18
|
-
import { passStringArray } from "../utilities/private"
|
|
19
|
-
import { KNativePointer } from "@koalaui/interop"
|
|
20
|
-
|
|
21
|
-
export class Config extends ArktsObject {
|
|
22
|
-
constructor(peer: KNativePointer) {
|
|
23
|
-
super(peer)
|
|
24
|
-
// TODO: wait for getter from api
|
|
25
|
-
this.path = ``
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
static create(
|
|
29
|
-
input: readonly string[]
|
|
30
|
-
): Config {
|
|
31
|
-
console.log("[TS WRAPPER] CREATE CONFIG");
|
|
32
|
-
return new Config(
|
|
33
|
-
global.es2panda._CreateConfig(input.length, passStringArray(input))
|
|
34
|
-
)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
static createDefault(): Config {
|
|
38
|
-
if (global.configIsInitialized()) {
|
|
39
|
-
console.warn(`Config already initialized`)
|
|
40
|
-
return new Config(
|
|
41
|
-
global.config
|
|
42
|
-
)
|
|
43
|
-
}
|
|
44
|
-
return new Config(
|
|
45
|
-
global.es2panda._CreateConfig(
|
|
46
|
-
4,
|
|
47
|
-
passStringArray(["", "--arktsconfig", "./arktsconfig.json", global.filePath])
|
|
48
|
-
)
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
readonly path: string
|
|
53
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2025 Huawei Device Co., Ltd.
|
|
3
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License.
|
|
5
|
-
* You may obtain a copy of the License at
|
|
6
|
-
*
|
|
7
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
*
|
|
9
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
* See the License for the specific language governing permissions and
|
|
13
|
-
* limitations under the License.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import { ArktsObject } from './ArktsObject';
|
|
17
|
-
import { global } from '../static/global';
|
|
18
|
-
import { throwError, filterSource } from '../../../utils';
|
|
19
|
-
import { passString } from '../utilities/private';
|
|
20
|
-
import { KBoolean, KNativePointer } from '@koalaui/interop';
|
|
21
|
-
import { AstNode } from './AstNode';
|
|
22
|
-
import { Program } from './Program';
|
|
23
|
-
export class Context extends ArktsObject {
|
|
24
|
-
constructor(peer: KNativePointer) {
|
|
25
|
-
super(peer);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
static createFromString(source: string): Context {
|
|
29
|
-
if (!global.configIsInitialized()) {
|
|
30
|
-
throwError(`Config not initialized`);
|
|
31
|
-
}
|
|
32
|
-
return new Context(
|
|
33
|
-
global.es2panda._CreateContextFromString(global.config, passString(source), passString(global.filePath))
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
static createCacheContextFromFile(
|
|
38
|
-
configPtr: KNativePointer,
|
|
39
|
-
fileName: string,
|
|
40
|
-
globalContextPtr: KNativePointer,
|
|
41
|
-
isExternal: KBoolean
|
|
42
|
-
): Context {
|
|
43
|
-
return new Context(
|
|
44
|
-
global.es2panda._CreateCacheContextFromFile(configPtr, passString(fileName), globalContextPtr, isExternal)
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
static destroyAndRecreate(ast: AstNode): Context {
|
|
49
|
-
console.log('[TS WRAPPER] DESTROY AND RECREATE');
|
|
50
|
-
const source = filterSource(ast.dumpSrc());
|
|
51
|
-
global.es2panda._DestroyContext(global.context);
|
|
52
|
-
global.compilerContext = Context.createFromString(source) as any; // TODO commonize Context
|
|
53
|
-
|
|
54
|
-
return new Context(global.context);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
get program(): Program {
|
|
58
|
-
return new Program(global.es2panda._ContextProgram(this.peer));
|
|
59
|
-
}
|
|
60
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2025 Huawei Device Co., Ltd.
|
|
3
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License.
|
|
5
|
-
* You may obtain a copy of the License at
|
|
6
|
-
*
|
|
7
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
*
|
|
9
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
* See the License for the specific language governing permissions and
|
|
13
|
-
* limitations under the License.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import { ArktsObject } from "./ArktsObject"
|
|
17
|
-
import { global } from "../static/global"
|
|
18
|
-
import { KNativePointer } from "@koalaui/interop"
|
|
19
|
-
|
|
20
|
-
export class SourcePosition extends ArktsObject {
|
|
21
|
-
constructor(peer: KNativePointer) {
|
|
22
|
-
super(peer)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
static create(index: number, line: number): SourcePosition {
|
|
26
|
-
return new SourcePosition(
|
|
27
|
-
global.es2panda._CreateSourcePosition(global.context, index, line)
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
index(): number {
|
|
32
|
-
return global.es2panda._SourcePositionIndex(global.context, this.peer);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
line(): number {
|
|
36
|
-
return global.es2panda._SourcePositionLine(global.context, this.peer);
|
|
37
|
-
}
|
|
38
|
-
}
|