diff --git a/arkui-plugins/common/arkts-utils.ts b/arkui-plugins/common/arkts-utils.ts index 9e8cd848153655c16a7c19640c3c3a63faddecd0..aae9ddc4380c9aa441e4cd262570a7e0c0688a98 100644 --- a/arkui-plugins/common/arkts-utils.ts +++ b/arkui-plugins/common/arkts-utils.ts @@ -18,6 +18,27 @@ import { DeclarationCollector } from './declaration-collector'; import { ARKUI_IMPORT_PREFIX_NAMES, DecoratorNames } from './predefines'; import * as fs from 'fs'; +/** + * Visit base method and all its overloads with visitor. + * + * @param method base method AstNode + * @param visitor rewrite visitor for each method AstNode + * @returns new base method AstNode with new overloads + */ +export function flatVisitMethodWithOverloads( + method: arkts.MethodDefinition, + visitor: (node: arkts.MethodDefinition) => arkts.MethodDefinition +): arkts.MethodDefinition { + const newOverloads: readonly arkts.MethodDefinition[] = method.overloads.map(visitor); + const newNode = visitor(method); + newNode.setOverloads(newOverloads); + newOverloads.forEach((it): void => { + it.setBaseOverloadMethod(newNode); + it.parent = newNode; + }); + return newNode; +} + export function coerceToAstNode(node: arkts.AstNode): T { return node as T; } @@ -145,9 +166,9 @@ export function moveToFront(arr: T[], idx: number): T[] { } /** - * Performs the specified action for each argument in a `arkts.CallExpression`'s arguments array - * paired with corresponding parameter from the function declaration node. - * + * Performs the specified action for each argument in a `arkts.CallExpression`'s arguments array + * paired with corresponding parameter from the function declaration node. + * * @param args An arguments array from a `arkts.CallExpression` node. * @param params A parameters array from a function declaration node. * @param callbackFn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. @@ -194,4 +215,4 @@ export function readFirstLineSync(filePath: string): string | null { const firstLine = content.split(/\r?\n/, 1)[0].trim(); return firstLine; -} \ No newline at end of file +} diff --git a/arkui-plugins/jest-test.config.js b/arkui-plugins/jest-test.config.js index cbca1f13e2e3c5cf964642ba71a4c025e339e706..1b2de513d763366bf3fe76f557d95162214795c2 100644 --- a/arkui-plugins/jest-test.config.js +++ b/arkui-plugins/jest-test.config.js @@ -27,6 +27,7 @@ module.exports = { '^.+\\.ts$': ['ts-jest'], }, testRegex: './test/ut/.+\\.test\\.ts$', + testPathIgnorePatterns: [], moduleFileExtensions: ['ts', 'js', 'json', 'node'], coverageDirectory: './test/report', collectCoverageFrom: [ diff --git a/arkui-plugins/memo-plugins/function-transformer.ts b/arkui-plugins/memo-plugins/function-transformer.ts index 4f2c55f1f4c572c8cabfa2ede178bc0d0cc1018d..f8e0561615d63e73c81f3f16e6c62822f06dd2d7 100644 --- a/arkui-plugins/memo-plugins/function-transformer.ts +++ b/arkui-plugins/memo-plugins/function-transformer.ts @@ -23,7 +23,6 @@ import { buildReturnTypeInfo, castArrowFunctionExpression, castIdentifier, - castOverloadsToMethods, castParameters, findMemoFromTypeAnnotation, findThisAttribute, @@ -298,8 +297,6 @@ export class FunctionTransformer extends AbstractVisitor { private updateMethodDefinition(node: arkts.MethodDefinition): arkts.MethodDefinition { let updateMethod: arkts.MethodDefinition; - const that = this; - const updateOverloads = node.overloads?.map((overload) => that.visitor(overload)) ?? undefined; const isMemo = hasMemoAnnotation(node.scriptFunction) || hasMemoIntrinsicAnnotation(node.scriptFunction) || @@ -327,9 +324,6 @@ export class FunctionTransformer extends AbstractVisitor { false ); } - if (!!updateOverloads) { - updateMethod.setOverloads(castOverloadsToMethods(updateOverloads)); - } this.modified ||= this.signatureTransformer.modified; return updateMethod; } diff --git a/arkui-plugins/memo-plugins/memo-cache-factory.ts b/arkui-plugins/memo-plugins/memo-cache-factory.ts index 6fb51b47eca943a32081389efb4ae77a043d3d01..1152c365be5657adf92613504992bd01e452ddba 100644 --- a/arkui-plugins/memo-plugins/memo-cache-factory.ts +++ b/arkui-plugins/memo-plugins/memo-cache-factory.ts @@ -117,7 +117,7 @@ export class RewriteFactory { return node; } node.type = RewriteFactory.rewriteType(node.type as arkts.TypeNode, metadata); - return arkts.factory.updateParameterDeclaration(node, node.identifier, node.initializer); + return node; } static rewriteProperty(node: arkts.Property, metadata?: CachedMetadata): arkts.Property { @@ -214,7 +214,7 @@ export class RewriteFactory { const _hasMemoIntrinsic = !!metadata?.hasMemoIntrinsic; const _internalsTransformer = metadata?.internalsTransformer; const _isDecl = arkts.hasModifierFlag(node, arkts.Es2pandaModifierFlags.MODIFIER_FLAGS_DECLARE); - const newParams: readonly arkts.Expression[] = prepareRewriteScriptFunctionParameters( + const newParams = prepareRewriteScriptFunctionParameters( node, _isSetter, _isGetter, @@ -237,22 +237,20 @@ export class RewriteFactory { _isGetter, _isSetter ); - return arkts.factory.updateScriptFunction( - node, - newBody, - arkts.factory.createFunctionSignature(node.typeParams, newParams, newReturnType, _hasReceiver), - node.flags, - node.modifiers - ); + node.setParams(newParams); + if (!!newReturnType) { + node.setReturnTypeAnnotation(newReturnType); + } + if (!!newBody) { + node.setBody(newBody); + } + return node; } static rewriteMethodDefinition(node: arkts.MethodDefinition, metadata?: CachedMetadata): arkts.MethodDefinition { const isSetter = node.kind === arkts.Es2pandaMethodDefinitionKind.METHOD_DEFINITION_KIND_SET; const isGetter = node.kind === arkts.Es2pandaMethodDefinitionKind.METHOD_DEFINITION_KIND_GET; - if (node.overloads.length > 0) { - node.setOverloads(node.overloads.map((o) => RewriteFactory.rewriteMethodDefinition(o, metadata))); - } - return arkts.factory.updateMethodDefinition( + const newNode = arkts.factory.updateMethodDefinition( node, node.kind, node.name, @@ -265,6 +263,7 @@ export class RewriteFactory { node.modifiers, false ); + return newNode; } static rewriteCallExpression(node: arkts.CallExpression, metadata?: CachedMetadata): arkts.CallExpression { diff --git a/arkui-plugins/memo-plugins/utils.ts b/arkui-plugins/memo-plugins/utils.ts index 54fc9691de3ae74f76dd6a7c989755f53fd00428..3a6823daab7bab769dc689ae5cdb58120128adb4 100644 --- a/arkui-plugins/memo-plugins/utils.ts +++ b/arkui-plugins/memo-plugins/utils.ts @@ -276,15 +276,6 @@ export function castIdentifier(value: arkts.AstNode | undefined): arkts.Identifi return value as unknown as arkts.Identifier; } -/** - * es2panda API is weird here - * - * @deprecated - */ -export function castOverloadsToMethods(overloads: arkts.AstNode[]): readonly arkts.MethodDefinition[] { - return overloads as unknown as readonly arkts.MethodDefinition[]; -} - export function isStandaloneArrowFunction(node: arkts.AstNode): node is arkts.ArrowFunctionExpression { if (!arkts.isArrowFunctionExpression(node)) return false; diff --git a/arkui-plugins/test/ut/common/annotation.test.ts b/arkui-plugins/test/ut/common/annotation.test.ts index 12aad35b66ccf01832d54476ca61a7f2c577af2a..538c961d68790b7d5f0ee34a99064875f40f8255 100644 --- a/arkui-plugins/test/ut/common/annotation.test.ts +++ b/arkui-plugins/test/ut/common/annotation.test.ts @@ -19,6 +19,7 @@ import { PluginTester } from '../../utils/plugin-tester'; import { BuildConfig, PluginTestContext } from '../../utils/shared-types'; import { mockBuildConfig } from '../../utils/artkts-config'; import { parseDumpSrc } from '../../utils/parse-string'; +import { dumpAnnotation, dumpGetterSetter, GetSetDumper } from '../../utils/simplify-dump'; import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../utils/path-config'; import { annotation } from '../../../common/arkts-utils'; import { PluginContext, Plugins } from '../../../common/plugin-context'; @@ -60,14 +61,6 @@ class AnnotationVisitor extends AbstractVisitor { node.annotations = [this.testAnnotation()]; } else if (arkts.isMethodDefinition(node)) { node.scriptFunction.setAnnotations([this.testAnnotation()]); - node.setOverloads( - node.overloads.map((ov) => { - if (this.isAnnotationNode(ov)) { - this.addTestAnnotation(ov); - } - return ov; - }) - ); } else { node.setAnnotations([this.testAnnotation()]); } @@ -78,14 +71,6 @@ class AnnotationVisitor extends AbstractVisitor { node.annotations = []; } else if (arkts.isMethodDefinition(node)) { node.scriptFunction.setAnnotations([]); - node.setOverloads( - node.overloads.map((ov) => { - if (this.isAnnotationNode(ov)) { - this.removeTestAnnotation(ov); - } - return ov; - }) - ); } else { node.setAnnotations([]); } @@ -204,8 +189,7 @@ import { Component as Component, ResourceStr as ResourceStr, Builder as Builder @TestAnno() public constructor() {} } @TestAnno() interface __A { - @TestAnno() set prop(prop: number) - @TestAnno() get prop(): number + ${dumpGetterSetter(GetSetDumper.BOTH, 'prop', 'number', [dumpAnnotation('TestAnno')], undefined, [dumpAnnotation('TestAnno')])} } `; diff --git a/arkui-plugins/test/ut/memo-plugins/function-declarations/complex-memo-intrinsic.test.ts b/arkui-plugins/test/ut/memo-plugins/function-declarations/complex-memo-intrinsic.test.ts index ba06b5787d39a952bd0dfaa26076b8baf031861d..e369025aed0d8fbe6ac96cbd32f9e67db84d8178 100644 --- a/arkui-plugins/test/ut/memo-plugins/function-declarations/complex-memo-intrinsic.test.ts +++ b/arkui-plugins/test/ut/memo-plugins/function-declarations/complex-memo-intrinsic.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../utils/path-config'; import { parseDumpSrc } from '../../../utils/parse-string'; import { beforeMemoNoRecheck, memoNoRecheck, recheck } from '../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../utils/simplify-dump'; import { ProjectConfig } from '../../../../common/plugin-context'; const FUNCTION_DIR_PATH: string = 'memo/functions'; @@ -77,9 +78,7 @@ export function cb(callback?: (()=> void)) { @Retention({policy:"SOURCE"}) @interface memo_intrinsic {} interface IA { - set ccc(ccc: boolean) - - get ccc(): boolean + ${dumpGetterSetter(GetSetDumper.BOTH, 'ccc', 'boolean')} } @@ -94,14 +93,14 @@ class A implements IA { private _$property$_ccc: boolean = false; - set ccc(_$property$_ccc: boolean) { - this._$property$_ccc = _$property$_ccc; - return; - } - public get ccc(): boolean { return this._$property$_ccc; } + + public set ccc(_$property$_ccc: boolean) { + this._$property$_ccc = _$property$_ccc; + return; + } } diff --git a/arkui-plugins/test/ut/memo-plugins/function-declarations/declare-and-call.test.ts b/arkui-plugins/test/ut/memo-plugins/function-declarations/declare-and-call.test.ts index 99fba4a09dabbb50bf34e9e9232a20a0090d82cb..d6dfd51c1aff0b1b12569511ae6eb98d163c0644 100644 --- a/arkui-plugins/test/ut/memo-plugins/function-declarations/declare-and-call.test.ts +++ b/arkui-plugins/test/ut/memo-plugins/function-declarations/declare-and-call.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../utils/path-config'; import { parseDumpSrc } from '../../../utils/parse-string'; import { beforeMemoNoRecheck, memoNoRecheck, recheck } from '../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../utils/shared-types'; +import { dumpAnnotation, dumpGetterSetter, GetSetDumper } from '../../../utils/simplify-dump'; const FUNCTION_DIR_PATH: string = 'memo/functions'; @@ -106,8 +107,8 @@ class A { public constructor() {} } interface MemoBuilder { - @memo() set builder(builder: ((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void)) - @memo() get builder(): ((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void) + ${dumpGetterSetter(GetSetDumper.BOTH, 'builder', '((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void)', [dumpAnnotation('memo')])} + } `; diff --git a/arkui-plugins/test/ut/memo-plugins/function-declarations/non-void-return-type.test.ts b/arkui-plugins/test/ut/memo-plugins/function-declarations/non-void-return-type.test.ts index c59453f5f38a497aedc52bc68b4102fc6d85c33f..389b434c30b5efdf0615521d987cbf2ee81168aa 100644 --- a/arkui-plugins/test/ut/memo-plugins/function-declarations/non-void-return-type.test.ts +++ b/arkui-plugins/test/ut/memo-plugins/function-declarations/non-void-return-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../utils/path-config'; import { parseDumpSrc } from '../../../utils/parse-string'; import { beforeMemoNoRecheck, memoNoRecheck, recheck } from '../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../utils/simplify-dump'; const FUNCTION_DIR_PATH: string = 'memo/functions'; @@ -86,8 +87,7 @@ function main() {} return __memo_scope.recache((() => {})); } interface A { - set str(str: string) - get str(): string + ${dumpGetterSetter(GetSetDumper.BOTH, 'str', 'string')} } type B = ((str: string)=> void); class C { diff --git a/arkui-plugins/test/ut/memo-plugins/function-declarations/type-reference.test.ts b/arkui-plugins/test/ut/memo-plugins/function-declarations/type-reference.test.ts index eca62211fc62871f30dcbfc225feb97dc0c82677..f357f1b34d4a1753c6783d2143fba32a95968023 100644 --- a/arkui-plugins/test/ut/memo-plugins/function-declarations/type-reference.test.ts +++ b/arkui-plugins/test/ut/memo-plugins/function-declarations/type-reference.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../utils/path-config'; import { parseDumpSrc } from '../../../utils/parse-string'; import { beforeMemoNoRecheck, memoNoRecheck, recheck } from '../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../utils/simplify-dump'; const FUNCTION_DIR_PATH: string = 'memo/functions'; @@ -55,8 +56,7 @@ function main() {} } @memo() type ItemBuilder = ((__memo_context: __memo_context_type, __memo_id: __memo_id_type, item: Item)=> void); interface Item { - set item(item: T) - get item(): T + ${dumpGetterSetter(GetSetDumper.BOTH, 'item', 'T')} } interface Attribute { @memo() each(__memo_context: __memo_context_type, __memo_id: __memo_id_type, @memo() itemGenerator: ItemBuilder): Attribute diff --git a/arkui-plugins/test/ut/memo-plugins/property-declarations/class-constructor.test.ts b/arkui-plugins/test/ut/memo-plugins/property-declarations/class-constructor.test.ts index b3be707bacd797ed55de8322d0854c2c26cf204d..9bb8bcce726500e81849cf0ba624bf6478861f38 100644 --- a/arkui-plugins/test/ut/memo-plugins/property-declarations/class-constructor.test.ts +++ b/arkui-plugins/test/ut/memo-plugins/property-declarations/class-constructor.test.ts @@ -19,6 +19,7 @@ import { mockBuildConfig } from '../../../utils/artkts-config'; import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../utils/path-config'; import { parseDumpSrc } from '../../../utils/parse-string'; import { beforeMemoNoRecheck, memoNoRecheck, recheck } from '../../../utils/plugins'; +import { dumpAnnotation, dumpGetterSetter, GetSetDumper } from '../../../utils/simplify-dump'; import { BuildConfig, PluginTestContext } from '../../../utils/shared-types'; const PROPERTY_DIR_PATH: string = 'memo/properties'; @@ -59,18 +60,17 @@ function main() {} } }); interface A { - @memo() set a(a: ((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void)) - @memo() get a(): ((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void) + ${dumpGetterSetter(GetSetDumper.BOTH, 'a', '((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void)', [dumpAnnotation('memo')])} } class AA { @memo() public a: (((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void) | undefined); - constructor() { - this(undefined); - } public constructor(arg: (A | undefined)) { this.a = ({let gensym%%_ = arg; (((gensym%%_) == (null)) ? undefined : gensym%%_.a)}); } + public constructor() { + this(undefined); + } @memo() public build(__memo_context: __memo_context_type, __memo_id: __memo_id_type) { const __memo_scope = __memo_context.scope(((__memo_id) + ()), 0); if (__memo_scope.unchanged) { diff --git a/arkui-plugins/test/ut/memo-plugins/property-declarations/interfaces.test.ts b/arkui-plugins/test/ut/memo-plugins/property-declarations/interfaces.test.ts index a28664fde2474320eb0656d51a88c3ef73b1cb8c..69ad79fc82aa01b9ac427b7af5a79daaac2044f8 100644 --- a/arkui-plugins/test/ut/memo-plugins/property-declarations/interfaces.test.ts +++ b/arkui-plugins/test/ut/memo-plugins/property-declarations/interfaces.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../utils/path-config'; import { parseDumpSrc } from '../../../utils/parse-string'; import { beforeMemoNoRecheck, memoNoRecheck, recheck } from '../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../utils/shared-types'; +import { dumpAnnotation, dumpGetterSetter, GetSetDumper } from '../../../utils/simplify-dump'; const PROPERTY_DIR_PATH: string = 'memo/properties'; @@ -80,16 +81,11 @@ function main() {} } }); interface A { - set arg(arg: (()=> void)) - get arg(): (()=> void) - @memo() set memo_arg(memo_arg: ((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void)) - @memo() get memo_arg(): ((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void) - @memo() set memo_optional_arg(memo_optional_arg: (((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void) | undefined)) - @memo() get memo_optional_arg(): (((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void) | undefined) - @memo() set memo_union_arg(memo_union_arg: (((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void) | undefined)) - @memo() get memo_union_arg(): (((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void) | undefined) - set arg_memo_type(arg_memo_type: @memo() ((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void)) - get arg_memo_type(): @memo() ((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void) + ${dumpGetterSetter(GetSetDumper.BOTH, 'arg', '(()=> void)')} + ${dumpGetterSetter(GetSetDumper.BOTH, 'memo_arg', '((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void)', [dumpAnnotation('memo')])} + ${dumpGetterSetter(GetSetDumper.BOTH, 'memo_optional_arg', '(((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void) | undefined)', [dumpAnnotation('memo')])} + ${dumpGetterSetter(GetSetDumper.BOTH, 'memo_union_arg', '(((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void) | undefined)', [dumpAnnotation('memo')])} + ${dumpGetterSetter(GetSetDumper.BOTH, 'arg_memo_type', '@memo() ((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/builder-lambda/condition-scope/block-in-switch-case.test.ts b/arkui-plugins/test/ut/ui-plugins/builder-lambda/condition-scope/block-in-switch-case.test.ts index f7c6d9d5a8ac83ab4da87e895bf0b2dbfa4842fa..7f28c4706adabb992480b3e50b875ea104d0b811 100644 --- a/arkui-plugins/test/ut/ui-plugins/builder-lambda/condition-scope/block-in-switch-case.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/builder-lambda/condition-scope/block-in-switch-case.test.ts @@ -21,6 +21,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { memoNoRecheck, recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -172,12 +173,8 @@ function main() {} } @Component() export interface __Options_SwitchCase { - set num(num: (int | undefined)) - - get num(): (int | undefined) - set __options_has_num(__options_has_num: (boolean | undefined)) - - get __options_has_num(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'num', '(int | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_num', '(boolean | undefined)')} } `; @@ -484,12 +481,8 @@ function main() {} } @Component() export interface __Options_SwitchCase { - set num(num: (int | undefined)) - - get num(): (int | undefined) - set __options_has_num(__options_has_num: (boolean | undefined)) - - get __options_has_num(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'num', '(int | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_num', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/builder-lambda/condition-scope/if-in-switch-in-content.test.ts b/arkui-plugins/test/ut/ui-plugins/builder-lambda/condition-scope/if-in-switch-in-content.test.ts index 0f996295608c33731407b5165f6e4d7c92f576df..569faa9ac704aa48f48e76decf0aaa5b388e6b70 100644 --- a/arkui-plugins/test/ut/ui-plugins/builder-lambda/condition-scope/if-in-switch-in-content.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/builder-lambda/condition-scope/if-in-switch-in-content.test.ts @@ -21,6 +21,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { memoNoRecheck, recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -122,12 +123,8 @@ function main() {} public constructor() {} } @Component() export interface __Options_IfInSwitch { - set num(num: (string | undefined)) - - get num(): (string | undefined) - set __options_has_num(__options_has_num: (boolean | undefined)) - - get __options_has_num(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'num', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_num', '(boolean | undefined)')} } `; @@ -365,12 +362,8 @@ function main() {} public constructor() {} } @Component() export interface __Options_IfInSwitch { - set num(num: (string | undefined)) - - get num(): (string | undefined) - set __options_has_num(__options_has_num: (boolean | undefined)) - - get __options_has_num(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'num', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_num', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/builder-lambda/condition-scope/switch-case-in-content.test.ts b/arkui-plugins/test/ut/ui-plugins/builder-lambda/condition-scope/switch-case-in-content.test.ts index 1d99db6b45c3190d62c537f2fd7c5b33ff80f5f0..56b52e96e480d2eff6763a49ad18d2aa729fd21b 100644 --- a/arkui-plugins/test/ut/ui-plugins/builder-lambda/condition-scope/switch-case-in-content.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/builder-lambda/condition-scope/switch-case-in-content.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { memoNoRecheck, recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -121,12 +122,8 @@ function main() {} public constructor() {} } @Component() export interface __Options_SwitchCase { - set num(num: (string | undefined)) - - get num(): (string | undefined) - set __options_has_num(__options_has_num: (boolean | undefined)) - - get __options_has_num(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'num', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_num', '(boolean | undefined)')} } `; @@ -355,12 +352,8 @@ function main() {} public constructor() {} } @Component() export interface __Options_SwitchCase { - set num(num: (string | undefined)) - - get num(): (string | undefined) - set __options_has_num(__options_has_num: (boolean | undefined)) - - get __options_has_num(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'num', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_num', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/builder-lambda/condition-scope/switch-in-if-in-content.test.ts b/arkui-plugins/test/ut/ui-plugins/builder-lambda/condition-scope/switch-in-if-in-content.test.ts index a3204273670a98efe33e27157d8cb34b74a868e2..721bca96f0eec768a022b9ab3739df51f7b82c15 100644 --- a/arkui-plugins/test/ut/ui-plugins/builder-lambda/condition-scope/switch-in-if-in-content.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/builder-lambda/condition-scope/switch-in-if-in-content.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { memoNoRecheck, recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -89,12 +90,8 @@ function main() {} public constructor() {} } @Component() export interface __Options_SwitchInIf { - set num(num: (string | undefined)) - - get num(): (string | undefined) - set __options_has_num(__options_has_num: (boolean | undefined)) - - get __options_has_num(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'num', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_num', '(boolean | undefined)')} } `; @@ -228,12 +225,8 @@ function main() {} public constructor() {} } @Component() export interface __Options_SwitchInIf { - set num(num: (string | undefined)) - - get num(): (string | undefined) - set __options_has_num(__options_has_num: (boolean | undefined)) - - get __options_has_num(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'num', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_num', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/builder-lambda/condition-scope/with-builder.test.ts b/arkui-plugins/test/ut/ui-plugins/builder-lambda/condition-scope/with-builder.test.ts index f2c66a2bf5645b5aa4de7d0358694f6254b94af0..b70e8a936298f620592847b6ed742fa2c485fe74 100644 --- a/arkui-plugins/test/ut/ui-plugins/builder-lambda/condition-scope/with-builder.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/builder-lambda/condition-scope/with-builder.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { memoNoRecheck, recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -172,10 +173,8 @@ function main() {} @Component() export interface __Options_MyStruct { } @Component() export interface __Options_Child { - set myBuilderParam(myBuilderParam: (@memo() (()=> void) | undefined)) - get myBuilderParam(): (@memo() (()=> void) | undefined) - set __options_has_myBuilderParam(__options_has_myBuilderParam: (boolean | undefined)) - get __options_has_myBuilderParam(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'myBuilderParam', '(@memo() (()=> void) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_myBuilderParam', '(boolean | undefined)')} } `; @@ -607,10 +606,8 @@ function main() {} @Component() export interface __Options_MyStruct { } @Component() export interface __Options_Child { - set myBuilderParam(myBuilderParam: (@memo() ((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void) | undefined)) - get myBuilderParam(): (@memo() ((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void) | undefined) - set __options_has_myBuilderParam(__options_has_myBuilderParam: (boolean | undefined)) - get __options_has_myBuilderParam(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'myBuilderParam', '(@memo() ((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_myBuilderParam', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/builder-lambda/custom-component/custom-component-call.test.ts b/arkui-plugins/test/ut/ui-plugins/builder-lambda/custom-component/custom-component-call.test.ts index d452276e882095772add7b9e1f9f11edfcfe5fd7..4cb07f2e4167a9ee519038b8c6b68ec039f7eea2 100644 --- a/arkui-plugins/test/ut/ui-plugins/builder-lambda/custom-component/custom-component-call.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/builder-lambda/custom-component/custom-component-call.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper, ignoreNewLines } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -83,8 +84,10 @@ import { Text as Text, Column as Column, Component as Component, Builder as Buil } @Component() export interface __Options_CustomContainer { + ${ignoreNewLines(` @BuilderParam() closer?: (()=> void); __options_has_closer?: boolean; + `)} } @@ -188,12 +191,8 @@ function main() {} } @Component() export interface __Options_CustomContainer { - set closer(closer: (@memo() (()=> void) | undefined)) - - get closer(): (@memo() (()=> void) | undefined) - set __options_has_closer(__options_has_closer: (boolean | undefined)) - - get __options_has_closer(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'closer', '(@memo() (()=> void) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_closer', '(boolean | undefined)')} } diff --git a/arkui-plugins/test/ut/ui-plugins/component/declare-component.test.ts b/arkui-plugins/test/ut/ui-plugins/component/declare-component.test.ts index 5b2025b8cab9bb947ee755bb775d851c88a38c1b..a7e31ec1e7253b33b70d6bcade84a2e4eec4c486 100644 --- a/arkui-plugins/test/ut/ui-plugins/component/declare-component.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/component/declare-component.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../utils/path-config'; import { parseDumpSrc } from '../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper, ignoreNewLines } from '../../../utils/simplify-dump'; import { uiTransform } from '../../../../ui-plugins'; import { Plugins } from '../../../../common/plugin-context'; @@ -60,6 +61,7 @@ import { PropRef as PropRef, State as State } from "@ohos.arkui.stateManagement" } @Component() export declare interface __Options_SwipeRefresher { + ${ignoreNewLines(` content?: (ResourceStr | undefined); @PropRef() __backing_content?: (ResourceStr | undefined); __options_has_content?: boolean; @@ -69,6 +71,7 @@ import { PropRef as PropRef, State as State } from "@ohos.arkui.stateManagement" code?: number; @State() __backing_code?: number; __options_has_code?: boolean; + `)} } `; @@ -108,33 +111,17 @@ function main() {} } @Component() export declare interface __Options_SwipeRefresher { - set content(content: ((ResourceStr | undefined) | undefined)) - - get content(): ((ResourceStr | undefined) | undefined) - set __backing_content(__backing_content: (IPropRefDecoratedVariable<(ResourceStr | undefined)> | undefined)) - - get __backing_content(): (IPropRefDecoratedVariable<(ResourceStr | undefined)> | undefined) - set __options_has_content(__options_has_content: (boolean | undefined)) - - get __options_has_content(): (boolean | undefined) - set isLoading(isLoading: (boolean | undefined)) - - get isLoading(): (boolean | undefined) - set __backing_isLoading(__backing_isLoading: (IPropRefDecoratedVariable | undefined)) - - get __backing_isLoading(): (IPropRefDecoratedVariable | undefined) - set __options_has_isLoading(__options_has_isLoading: (boolean | undefined)) - - get __options_has_isLoading(): (boolean | undefined) - set code(code: (number | undefined)) - - get code(): (number | undefined) - set __backing_code(__backing_code: (IStateDecoratedVariable | undefined)) - - get __backing_code(): (IStateDecoratedVariable | undefined) - set __options_has_code(__options_has_code: (boolean | undefined)) - - get __options_has_code(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'content', '((ResourceStr | undefined) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_content', '(IPropRefDecoratedVariable<(ResourceStr | undefined)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_content', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'isLoading', '(boolean | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_isLoading', '(IPropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_isLoading', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'code', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_code', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_code', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/component/for-each.test.ts b/arkui-plugins/test/ut/ui-plugins/component/for-each.test.ts index 45171495a2a9f6971c9dc389483f42aa60152807..d60c785c986a56782804fa1d7ffdaa1fba1f3207 100644 --- a/arkui-plugins/test/ut/ui-plugins/component/for-each.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/component/for-each.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../utils/path-config'; import { parseDumpSrc } from '../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../utils/simplify-dump'; import { uiTransform } from '../../../../ui-plugins'; import { Plugins } from '../../../../common/plugin-context'; @@ -174,10 +175,8 @@ class AB { } @Component() export interface __Options_ImportStruct { - get arr(): (Array | undefined) - set arr(arr: (Array | undefined)) - get __options_has_arr(): (boolean | undefined) - set __options_has_arr(__options_has_arr: (boolean | undefined)) + ${dumpGetterSetter(GetSetDumper.BOTH, 'arr', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_arr', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/builder-param/builder-param-passing.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/builder-param/builder-param-passing.test.ts index 5bd5c8cfe29ee24eb1c25fb8f5bc20c16c03da7a..1f0ce315b1ba8ecee1272072536e32c187293436 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/builder-param/builder-param-passing.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/builder-param/builder-param-passing.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { memoNoRecheck, recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -129,12 +130,8 @@ function main() {} } @Component() export interface __Options_Child { - set customBuilderParam(customBuilderParam: (@memo() (()=> void) | undefined)) - - get customBuilderParam(): (@memo() (()=> void) | undefined) - set __options_has_customBuilderParam(__options_has_customBuilderParam: (boolean | undefined)) - - get __options_has_customBuilderParam(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'customBuilderParam', '(@memo() (()=> void) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_customBuilderParam', '(boolean | undefined)')} } @@ -321,12 +318,8 @@ function main() {} } @Component() export interface __Options_Child { - set customBuilderParam(customBuilderParam: (@memo() ((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void) | undefined)) - - get customBuilderParam(): (@memo() ((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void) | undefined) - set __options_has_customBuilderParam(__options_has_customBuilderParam: (boolean | undefined)) - - get __options_has_customBuilderParam(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'customBuilderParam', '(@memo() ((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_customBuilderParam', '(boolean | undefined)')} } diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/builder-param/init-with-local-builder.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/builder-param/init-with-local-builder.test.ts index 3e2bb941468fb96f348716b2bf081e27ab6494d3..b35f0aceba9ee8d7eb2e471400aab29ae5a3519b 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/builder-param/init-with-local-builder.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/builder-param/init-with-local-builder.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { memoNoRecheck, recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -88,18 +89,11 @@ function main() {} } @Component() export interface __Options_Child { - set customBuilderParam(customBuilderParam: (@memo() (()=> void) | undefined)) - - get customBuilderParam(): (@memo() (()=> void) | undefined) - set __options_has_customBuilderParam(__options_has_customBuilderParam: (boolean | undefined)) - - get __options_has_customBuilderParam(): (boolean | undefined) - set customBuilderParam2(customBuilderParam2: (@memo() ((str: string)=> void) | undefined)) - - get customBuilderParam2(): (@memo() ((str: string)=> void) | undefined) - set __options_has_customBuilderParam2(__options_has_customBuilderParam2: (boolean | undefined)) - - get __options_has_customBuilderParam2(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'customBuilderParam', '(@memo() (()=> void) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_customBuilderParam', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'customBuilderParam2', '(@memo() ((str: string)=> void) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_customBuilderParam2', '(boolean | undefined)')} } `; @@ -186,18 +180,11 @@ function main() {} } @Component() export interface __Options_Child { - set customBuilderParam(customBuilderParam: (@memo() ((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void) | undefined)) - - get customBuilderParam(): (@memo() ((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void) | undefined) - set __options_has_customBuilderParam(__options_has_customBuilderParam: (boolean | undefined)) - - get __options_has_customBuilderParam(): (boolean | undefined) - set customBuilderParam2(customBuilderParam2: (@memo() ((__memo_context: __memo_context_type, __memo_id: __memo_id_type, str: string)=> void) | undefined)) - - get customBuilderParam2(): (@memo() ((__memo_context: __memo_context_type, __memo_id: __memo_id_type, str: string)=> void) | undefined) - set __options_has_customBuilderParam2(__options_has_customBuilderParam2: (boolean | undefined)) - - get __options_has_customBuilderParam2(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'customBuilderParam', '(@memo() ((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_customBuilderParam', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'customBuilderParam2', '(@memo() ((__memo_context: __memo_context_type, __memo_id: __memo_id_type, str: string)=> void) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_customBuilderParam2', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/builder-param/optional-builder-param.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/builder-param/optional-builder-param.test.ts index 8362bc1699d0484aa029b18fcafc651240e6cfe2..899349a1a7b1fd53aa56f458c71548b903aa4a95 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/builder-param/optional-builder-param.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/builder-param/optional-builder-param.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { memoNoRecheck, recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -149,18 +150,11 @@ function main() {} } @Component() export interface __Options_Child { - set customBuilderParam2(customBuilderParam2: (((()=> void) | undefined) | undefined)) - - get customBuilderParam2(): (((()=> void) | undefined) | undefined) - set __options_has_customBuilderParam2(__options_has_customBuilderParam2: (boolean | undefined)) - - get __options_has_customBuilderParam2(): (boolean | undefined) - set customBuilderParam1(customBuilderParam1: (@memo() (()=> void) | undefined)) - - get customBuilderParam1(): (@memo() (()=> void) | undefined) - set __options_has_customBuilderParam1(__options_has_customBuilderParam1: (boolean | undefined)) - - get __options_has_customBuilderParam1(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'customBuilderParam2', '(((()=> void) | undefined) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_customBuilderParam2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'customBuilderParam1', '(@memo() (()=> void) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_customBuilderParam1', '(boolean | undefined)')} } @@ -417,18 +411,11 @@ function main() {} } @Component() export interface __Options_Child { - set customBuilderParam2(customBuilderParam2: ((((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void) | undefined) | undefined)) - - get customBuilderParam2(): ((((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void) | undefined) | undefined) - set __options_has_customBuilderParam2(__options_has_customBuilderParam2: (boolean | undefined)) - - get __options_has_customBuilderParam2(): (boolean | undefined) - set customBuilderParam1(customBuilderParam1: (@memo() ((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void) | undefined)) - - get customBuilderParam1(): (@memo() ((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void) | undefined) - set __options_has_customBuilderParam1(__options_has_customBuilderParam1: (boolean | undefined)) - - get __options_has_customBuilderParam1(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'customBuilderParam2', '((((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void) | undefined) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_customBuilderParam2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'customBuilderParam1', '(@memo() ((__memo_context: __memo_context_type, __memo_id: __memo_id_type)=> void) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_customBuilderParam1', '(boolean | undefined)')} } diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/computed/computed-in-struct.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/computed/computed-in-struct.test.ts index a5d2f0f0562e4e6f63880fd0e5a1d18b5f7297a8..02f353c1b375e7d582801e7ba1201f016e6a5968 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/computed/computed-in-struct.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/computed/computed-in-struct.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { uiNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -163,30 +164,16 @@ function main() {} } @ComponentV2() export interface __Options_Index { - set firstName(firstName: (string | undefined)) - - get firstName(): (string | undefined) - set __backing_firstName(__backing_firstName: (ILocalDecoratedVariable | undefined)) - - get __backing_firstName(): (ILocalDecoratedVariable | undefined) - set __options_has_firstName(__options_has_firstName: (boolean | undefined)) - - get __options_has_firstName(): (boolean | undefined) - set lastName(lastName: (string | undefined)) - - get lastName(): (string | undefined) - set __backing_lastName(__backing_lastName: (ILocalDecoratedVariable | undefined)) - - get __backing_lastName(): (ILocalDecoratedVariable | undefined) - set __options_has_lastName(__options_has_lastName: (boolean | undefined)) - - get __options_has_lastName(): (boolean | undefined) - set age(age: (number | undefined)) - - get age(): (number | undefined) - set __options_has_age(__options_has_age: (boolean | undefined)) - - get __options_has_age(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'firstName', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_firstName', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_firstName', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'lastName', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_lastName', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_lastName', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'age', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_age', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/computed/computed-no-return-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/computed/computed-no-return-type.test.ts index b94bdc28bc3b6bbdb01191e18e09594fe1af01c2..731b6788e86f999b3aa665097926d6e7bfbcb679 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/computed/computed-no-return-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/computed/computed-no-return-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { uiNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -205,30 +206,16 @@ function main() {} } @ComponentV2() export interface __Options_Index { - set firstName(firstName: (string | undefined)) - - get firstName(): (string | undefined) - set __backing_firstName(__backing_firstName: (ILocalDecoratedVariable | undefined)) - - get __backing_firstName(): (ILocalDecoratedVariable | undefined) - set __options_has_firstName(__options_has_firstName: (boolean | undefined)) - - get __options_has_firstName(): (boolean | undefined) - set lastName(lastName: (string | undefined)) - - get lastName(): (string | undefined) - set __backing_lastName(__backing_lastName: (ILocalDecoratedVariable | undefined)) - - get __backing_lastName(): (ILocalDecoratedVariable | undefined) - set __options_has_lastName(__options_has_lastName: (boolean | undefined)) - - get __options_has_lastName(): (boolean | undefined) - set age(age: (number | undefined)) - - get age(): (number | undefined) - set __options_has_age(__options_has_age: (boolean | undefined)) - - get __options_has_age(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'firstName', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_firstName', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_firstName', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'lastName', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_lastName', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_lastName', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'age', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_age', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/computed/static-computed.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/computed/static-computed.test.ts index 7a3eda3bd626846ff46a58fd08ac16acb1c11cb2..144e605baeb63b2399ab5204e4fd765fbd6ae4af 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/computed/static-computed.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/computed/static-computed.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { uiNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -242,24 +243,13 @@ function main() {} } @ComponentV2() export interface __Options_Parent { - set localVar1(localVar1: (string | undefined)) - - get localVar1(): (string | undefined) - set __backing_localVar1(__backing_localVar1: (ILocalDecoratedVariable | undefined)) - - get __backing_localVar1(): (ILocalDecoratedVariable | undefined) - set __options_has_localVar1(__options_has_localVar1: (boolean | undefined)) - - get __options_has_localVar1(): (boolean | undefined) - set localVar2(localVar2: (number | undefined)) - - get localVar2(): (number | undefined) - set __backing_localVar2(__backing_localVar2: (ILocalDecoratedVariable | undefined)) - - get __backing_localVar2(): (ILocalDecoratedVariable | undefined) - set __options_has_localVar2(__options_has_localVar2: (boolean | undefined)) - - get __options_has_localVar2(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'localVar1', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_localVar1', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_localVar1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'localVar2', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_localVar2', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_localVar2', '(boolean | undefined)')} } diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/custom-dialog/base-custom-dialog.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/custom-dialog/base-custom-dialog.test.ts index ecf8d28dc33cb6550e6961619736da4377078eba..26c92c6ab2c721d8ab9eb5de0fb216d976405c09 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/custom-dialog/base-custom-dialog.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/custom-dialog/base-custom-dialog.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -254,52 +255,28 @@ function main() {} } @CustomDialog() export interface __Options_CustomDialogExample { - set aaController(aaController: ((CustomDialogController | undefined) | undefined)) - - get aaController(): ((CustomDialogController | undefined) | undefined) - set __options_has_aaController(__options_has_aaController: (boolean | undefined)) - - get __options_has_aaController(): (boolean | undefined) - set text(text: (string | undefined)) - - get text(): (string | undefined) - set __backing_text(__backing_text: (IStateDecoratedVariable | undefined)) - - get __backing_text(): (IStateDecoratedVariable | undefined) - set __options_has_text(__options_has_text: (boolean | undefined)) - - get __options_has_text(): (boolean | undefined) - set cancel(cancel: ((()=> void) | undefined)) - - get cancel(): ((()=> void) | undefined) - set __options_has_cancel(__options_has_cancel: (boolean | undefined)) - - get __options_has_cancel(): (boolean | undefined) - set confirm(confirm: ((()=> void) | undefined)) - - get confirm(): ((()=> void) | undefined) - set __options_has_confirm(__options_has_confirm: (boolean | undefined)) - - get __options_has_confirm(): (boolean | undefined) - set hh(hh: (string | undefined)) - - get hh(): (string | undefined) - set __backing_hh(__backing_hh: (IStateDecoratedVariable | undefined)) - - get __backing_hh(): (IStateDecoratedVariable | undefined) - set __options_has_hh(__options_has_hh: (boolean | undefined)) - - get __options_has_hh(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'aaController', '((CustomDialogController | undefined) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_aaController', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'text', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_text', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_text', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'cancel', '((()=> void) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_cancel', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'confirm', '((()=> void) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_confirm', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'hh', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_hh', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_hh', '(boolean | undefined)')} } @Component() export interface __Options_CustomDialogUser { - set dialogController(dialogController: ((CustomDialogController | null) | undefined)) - - get dialogController(): ((CustomDialogController | null) | undefined) - set __options_has_dialogController(__options_has_dialogController: (boolean | undefined)) - - get __options_has_dialogController(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'dialogController', '((CustomDialogController | null) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_dialogController', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/custom-dialog/builder-dialog-options.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/custom-dialog/builder-dialog-options.test.ts index 75823949817bd65a0ff3bd9fff0f74f85aa2a3a3..665b3614dfa156b1709c93807523cfae11de7e60 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/custom-dialog/builder-dialog-options.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/custom-dialog/builder-dialog-options.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { memoNoRecheck, recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper, ignoreNewLines } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -79,14 +80,18 @@ import hilog from "@ohos.hilog"; } @Component() export interface __Options_CustomDialogUser { + ${ignoreNewLines(` dialogController?: (CustomDialogController | null); __options_has_dialogController?: boolean; + `)} } @Component() export interface __Options_CustomDialogUser2 { + ${ignoreNewLines(` dialogController?: (CustomDialogController | null); __options_has_dialogController?: boolean; + `)} } `; @@ -185,22 +190,14 @@ function main() {} } @Component() export interface __Options_CustomDialogUser { - set dialogController(dialogController: ((CustomDialogController | null) | undefined)) - - get dialogController(): ((CustomDialogController | null) | undefined) - set __options_has_dialogController(__options_has_dialogController: (boolean | undefined)) - - get __options_has_dialogController(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'dialogController', '((CustomDialogController | null) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_dialogController', '(boolean | undefined)')} } @Component() export interface __Options_CustomDialogUser2 { - set dialogController(dialogController: ((CustomDialogController | null) | undefined)) - - get dialogController(): ((CustomDialogController | null) | undefined) - set __options_has_dialogController(__options_has_dialogController: (boolean | undefined)) - - get __options_has_dialogController(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'dialogController', '((CustomDialogController | null) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_dialogController', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/custom-dialog/controller-in-build.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/custom-dialog/controller-in-build.test.ts index 6601e01b9d3e8a0043c467da6c56e79f50f537d1..984e5ad98de1c7ab8ee4718b6a1686d462981f80 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/custom-dialog/controller-in-build.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/custom-dialog/controller-in-build.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -169,30 +170,16 @@ function main() {} } @CustomDialog() export interface __Options_CustomDialogExample { - set aaController(aaController: ((CustomDialogController | undefined) | undefined)) - - get aaController(): ((CustomDialogController | undefined) | undefined) - set __options_has_aaController(__options_has_aaController: (boolean | undefined)) - - get __options_has_aaController(): (boolean | undefined) - set text(text: (string | undefined)) - - get text(): (string | undefined) - set __backing_text(__backing_text: (IStateDecoratedVariable | undefined)) - - get __backing_text(): (IStateDecoratedVariable | undefined) - set __options_has_text(__options_has_text: (boolean | undefined)) - - get __options_has_text(): (boolean | undefined) - set hh(hh: (string | undefined)) - - get hh(): (string | undefined) - set __backing_hh(__backing_hh: (IStateDecoratedVariable | undefined)) - - get __backing_hh(): (IStateDecoratedVariable | undefined) - set __options_has_hh(__options_has_hh: (boolean | undefined)) - - get __options_has_hh(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'aaController', '((CustomDialogController | undefined) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_aaController', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'text', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_text', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_text', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'hh', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_hh', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_hh', '(boolean | undefined)')} } diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/custom-dialog/controller-in-method.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/custom-dialog/controller-in-method.test.ts index 1da0f6f11eeff2ef2f31856b5a660bda3d2965a9..1567658e364b270060ecae63ab45f3c06124069a 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/custom-dialog/controller-in-method.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/custom-dialog/controller-in-method.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -144,22 +145,14 @@ function main() {} } @CustomDialog() export interface __Options_CustomDialogExample { - set aaController(aaController: ((CustomDialogController | undefined) | undefined)) - - get aaController(): ((CustomDialogController | undefined) | undefined) - set __options_has_aaController(__options_has_aaController: (boolean | undefined)) - - get __options_has_aaController(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'aaController', '((CustomDialogController | undefined) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_aaController', '(boolean | undefined)')} } @Component() export interface __Options_CustomDialogUser { - set dialogController(dialogController: ((CustomDialogController | null) | undefined)) - - get dialogController(): ((CustomDialogController | null) | undefined) - set __options_has_dialogController(__options_has_dialogController: (boolean | undefined)) - - get __options_has_dialogController(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'dialogController', '((CustomDialogController | null) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_dialogController', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/custom-dialog/declare-custom-dialog.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/custom-dialog/declare-custom-dialog.test.ts index 23f9b2574c4eb03f7d0b1013d85f8666af0bcbfa..d4cd068d4820d3d70d0d6168b9d8080889beb85a 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/custom-dialog/declare-custom-dialog.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/custom-dialog/declare-custom-dialog.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { memoNoRecheck, recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -134,47 +135,27 @@ function main() {} } @CustomDialog() export declare interface __Options_CustomDialogExample { - set aaController(aaController: ((CustomDialogController | undefined) | undefined)) - - get aaController(): ((CustomDialogController | undefined) | undefined) - set __options_has_aaController(__options_has_aaController: (boolean | undefined)) - - get __options_has_aaController(): (boolean | undefined) - set text(text: (string | undefined)) - - get text(): (string | undefined) - set __backing_text(__backing_text: (IStateDecoratedVariable | undefined)) - - get __backing_text(): (IStateDecoratedVariable | undefined) - set __options_has_text(__options_has_text: (boolean | undefined)) - - get __options_has_text(): (boolean | undefined) - set hh(hh: (string | undefined)) - - get hh(): (string | undefined) - set __options_has_hh(__options_has_hh: (boolean | undefined)) - - get __options_has_hh(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'aaController', '((CustomDialogController | undefined) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_aaController', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'text', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_text', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_text', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'hh', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_hh', '(boolean | undefined)')} } @Component() export interface __Options_CustomDialogUserV1 { - set dialogController(dialogController: ((CustomDialogController | null) | undefined)) - - get dialogController(): ((CustomDialogController | null) | undefined) - set __options_has_dialogController(__options_has_dialogController: (boolean | undefined)) - - get __options_has_dialogController(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'dialogController', '((CustomDialogController | null) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_dialogController', '(boolean | undefined)')} } @ComponentV2() export interface __Options_CustomDialogUserV2 { - set dialogController(dialogController: ((CustomDialogController | null) | undefined)) - - get dialogController(): ((CustomDialogController | null) | undefined) - set __options_has_dialogController(__options_has_dialogController: (boolean | undefined)) - - get __options_has_dialogController(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'dialogController', '((CustomDialogController | null) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_dialogController', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/custom-dialog/extends-dialog-controller.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/custom-dialog/extends-dialog-controller.test.ts index 0aec64788a2345758cad68b7b08c0c6a83f020eb..780915bd1b260430da9df0c9837cd2129d2030d9 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/custom-dialog/extends-dialog-controller.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/custom-dialog/extends-dialog-controller.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -165,22 +166,14 @@ class DialogControllerV3 extends DialogControllerV2 { } @CustomDialog() export interface __Options_CustomDialogExample { - set aaController(aaController: ((CustomDialogController | undefined) | undefined)) - - get aaController(): ((CustomDialogController | undefined) | undefined) - set __options_has_aaController(__options_has_aaController: (boolean | undefined)) - - get __options_has_aaController(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'aaController', '((CustomDialogController | undefined) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_aaController', '(boolean | undefined)')} } @Component() export interface __Options_CustomDialogUser { - set dialogController(dialogController: ((CustomDialogController | null) | undefined)) - - get dialogController(): ((CustomDialogController | null) | undefined) - set __options_has_dialogController(__options_has_dialogController: (boolean | undefined)) - - get __options_has_dialogController(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'dialogController', '((CustomDialogController | null) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_dialogController', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/decorator-no-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/decorator-no-type.test.ts index 5d0255fc674b3e1ff68b8fdb1f97d59d9dc82cd2..07c4da42e4227b4f7183d8f1a7556edef8b06d6a 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/decorator-no-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/decorator-no-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../utils/path-config'; import { parseDumpSrc } from '../../../utils/parse-string'; import { structNoRecheck, recheck } from '../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../utils/shared-types'; +import { dumpAnnotation, dumpGetterSetter, GetSetDumper } from '../../../utils/simplify-dump'; import { uiTransform } from '../../../../ui-plugins'; import { Plugins } from '../../../../common/plugin-context'; @@ -670,284 +671,133 @@ final class StateType extends BaseEnum { } @Component() export interface __Options_Parent { - set stateVar1(stateVar1: (Any | undefined)) - - get stateVar1(): (Any | undefined) - set __backing_stateVar1(__backing_stateVar1: (IStateDecoratedVariable | undefined)) - - get __backing_stateVar1(): (IStateDecoratedVariable | undefined) - set __options_has_stateVar1(__options_has_stateVar1: (boolean | undefined)) - - get __options_has_stateVar1(): (boolean | undefined) - set stateVar2(stateVar2: (Any | undefined)) - - get stateVar2(): (Any | undefined) - set __backing_stateVar2(__backing_stateVar2: (IPropRefDecoratedVariable | undefined)) - - get __backing_stateVar2(): (IPropRefDecoratedVariable | undefined) - set __options_has_stateVar2(__options_has_stateVar2: (boolean | undefined)) - - get __options_has_stateVar2(): (boolean | undefined) - set stateVar3(stateVar3: (Any | undefined)) - - get stateVar3(): (Any | undefined) - set __backing_stateVar3(__backing_stateVar3: (IProvideDecoratedVariable | undefined)) - - get __backing_stateVar3(): (IProvideDecoratedVariable | undefined) - set __options_has_stateVar3(__options_has_stateVar3: (boolean | undefined)) - - get __options_has_stateVar3(): (boolean | undefined) - set stateVar8(stateVar8: (Any | undefined)) - - get stateVar8(): (Any | undefined) - set __options_has_stateVar8(__options_has_stateVar8: (boolean | undefined)) - - get __options_has_stateVar8(): (boolean | undefined) - set stateVar9(stateVar9: (Any | undefined)) - - get stateVar9(): (Any | undefined) - set __options_has_stateVar9(__options_has_stateVar9: (boolean | undefined)) - - get __options_has_stateVar9(): (boolean | undefined) - set stateVar11113(stateVar11113: (Any | undefined)) - - get stateVar11113(): (Any | undefined) - set __backing_stateVar11113(__backing_stateVar11113: (IProvideDecoratedVariable | undefined)) - - get __backing_stateVar11113(): (IProvideDecoratedVariable | undefined) - set __options_has_stateVar11113(__options_has_stateVar11113: (boolean | undefined)) - - get __options_has_stateVar11113(): (boolean | undefined) - set stateVar11114(stateVar11114: (Any | undefined)) - - get stateVar11114(): (Any | undefined) - set __backing_stateVar11114(__backing_stateVar11114: (IProvideDecoratedVariable | undefined)) - - get __backing_stateVar11114(): (IProvideDecoratedVariable | undefined) - set __options_has_stateVar11114(__options_has_stateVar11114: (boolean | undefined)) - - get __options_has_stateVar11114(): (boolean | undefined) - set stateVar11115(stateVar11115: (Any | undefined)) - - get stateVar11115(): (Any | undefined) - set __backing_stateVar11115(__backing_stateVar11115: (IStateDecoratedVariable | undefined)) - - get __backing_stateVar11115(): (IStateDecoratedVariable | undefined) - set __options_has_stateVar11115(__options_has_stateVar11115: (boolean | undefined)) - - get __options_has_stateVar11115(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar1', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar1', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar2', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar2', '(IPropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar3', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar3', '(IProvideDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar3', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar8', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar8', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar9', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar9', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar11113', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar11113', '(IProvideDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar11113', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar11114', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar11114', '(IProvideDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar11114', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar11115', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar11115', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar11115', '(boolean | undefined)')} } @ComponentV2() export interface __Options_V2Parent { - set stateVar4(stateVar4: (Any | undefined)) - - get stateVar4(): (Any | undefined) - @Param() set __backing_stateVar4(__backing_stateVar4: (IParamOnceDecoratedVariable | undefined)) - - @Param() get __backing_stateVar4(): (IParamOnceDecoratedVariable | undefined) - set __options_has_stateVar4(__options_has_stateVar4: (boolean | undefined)) - - get __options_has_stateVar4(): (boolean | undefined) - set stateVar5(stateVar5: (Any | undefined)) - - get stateVar5(): (Any | undefined) - set __backing_stateVar5(__backing_stateVar5: (ILocalDecoratedVariable | undefined)) - - get __backing_stateVar5(): (ILocalDecoratedVariable | undefined) - set __options_has_stateVar5(__options_has_stateVar5: (boolean | undefined)) - - get __options_has_stateVar5(): (boolean | undefined) - set stateVar6(stateVar6: (Any | undefined)) - - get stateVar6(): (Any | undefined) - set __backing_stateVar6(__backing_stateVar6: (ILocalDecoratedVariable | undefined)) - - get __backing_stateVar6(): (ILocalDecoratedVariable | undefined) - set __options_has_stateVar6(__options_has_stateVar6: (boolean | undefined)) - - get __options_has_stateVar6(): (boolean | undefined) - set stateVar7(stateVar7: (Any | undefined)) - - get stateVar7(): (Any | undefined) - set __options_has_stateVar7(__options_has_stateVar7: (boolean | undefined)) - - get __options_has_stateVar7(): (boolean | undefined) - set stateVar8(stateVar8: (Any | undefined)) - - get stateVar8(): (Any | undefined) - set __options_has_stateVar8(__options_has_stateVar8: (boolean | undefined)) - - get __options_has_stateVar8(): (boolean | undefined) - set stateVar9(stateVar9: (Any | undefined)) - - get stateVar9(): (Any | undefined) - set __backing_stateVar9(__backing_stateVar9: (IParamDecoratedVariable | undefined)) - - get __backing_stateVar9(): (IParamDecoratedVariable | undefined) - set __options_has_stateVar9(__options_has_stateVar9: (boolean | undefined)) - - get __options_has_stateVar9(): (boolean | undefined) - set stateVar10(stateVar10: (Any | undefined)) - - get stateVar10(): (Any | undefined) - set __backing_stateVar10(__backing_stateVar10: (IParamDecoratedVariable | undefined)) - - get __backing_stateVar10(): (IParamDecoratedVariable | undefined) - set __options_has_stateVar10(__options_has_stateVar10: (boolean | undefined)) - - get __options_has_stateVar10(): (boolean | undefined) - set stateVar11(stateVar11: (Any | undefined)) - - get stateVar11(): (Any | undefined) - @Param() set __backing_stateVar11(__backing_stateVar11: (IParamOnceDecoratedVariable | undefined)) - - @Param() get __backing_stateVar11(): (IParamOnceDecoratedVariable | undefined) - set __options_has_stateVar11(__options_has_stateVar11: (boolean | undefined)) - - get __options_has_stateVar11(): (boolean | undefined) - set stateVar12(stateVar12: (Any | undefined)) - - get stateVar12(): (Any | undefined) - set __backing_stateVar12(__backing_stateVar12: (IProviderDecoratedVariable | undefined)) - - get __backing_stateVar12(): (IProviderDecoratedVariable | undefined) - set __options_has_stateVar12(__options_has_stateVar12: (boolean | undefined)) - - get __options_has_stateVar12(): (boolean | undefined) - set stateVar11111(stateVar11111: (Any | undefined)) - - get stateVar11111(): (Any | undefined) - set __backing_stateVar11111(__backing_stateVar11111: (IConsumerDecoratedVariable | undefined)) - - get __backing_stateVar11111(): (IConsumerDecoratedVariable | undefined) - set __options_has_stateVar11111(__options_has_stateVar11111: (boolean | undefined)) - - get __options_has_stateVar11111(): (boolean | undefined) - set stateVar11188(stateVar11188: (Any | undefined)) - - get stateVar11188(): (Any | undefined) - set __backing_stateVar11188(__backing_stateVar11188: (IProviderDecoratedVariable | undefined)) - - get __backing_stateVar11188(): (IProviderDecoratedVariable | undefined) - set __options_has_stateVar11188(__options_has_stateVar11188: (boolean | undefined)) - - get __options_has_stateVar11188(): (boolean | undefined) - set stateVar11112(stateVar11112: (Any | undefined)) - - get stateVar11112(): (Any | undefined) - set __backing_stateVar11112(__backing_stateVar11112: (IConsumerDecoratedVariable | undefined)) - - get __backing_stateVar11112(): (IConsumerDecoratedVariable | undefined) - set __options_has_stateVar11112(__options_has_stateVar11112: (boolean | undefined)) - - get __options_has_stateVar11112(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar4', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar4', '(IParamOnceDecoratedVariable | undefined)', [dumpAnnotation('Param')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar4', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar5', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar5', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar5', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar6', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar6', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar6', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar7', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar7', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar8', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar8', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar9', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar9', '(IParamDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar9', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar10', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar10', '(IParamDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar10', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar11', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar11', '(IParamOnceDecoratedVariable | undefined)', [dumpAnnotation('Param')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar11', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar12', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar12', '(IProviderDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar12', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar11111', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar11111', '(IConsumerDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar11111', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar11188', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar11188', '(IProviderDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar11188', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar11112', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar11112', '(IConsumerDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar11112', '(boolean | undefined)')} } @CustomDialog() export interface __Options_CC { - set stateVar4(stateVar4: (Any | undefined)) - - get stateVar4(): (Any | undefined) - @Param() set __backing_stateVar4(__backing_stateVar4: (IParamOnceDecoratedVariable | undefined)) - - @Param() get __backing_stateVar4(): (IParamOnceDecoratedVariable | undefined) - set __options_has_stateVar4(__options_has_stateVar4: (boolean | undefined)) - - get __options_has_stateVar4(): (boolean | undefined) - set stateVar5(stateVar5: (Any | undefined)) - - get stateVar5(): (Any | undefined) - set __backing_stateVar5(__backing_stateVar5: (ILocalDecoratedVariable | undefined)) - - get __backing_stateVar5(): (ILocalDecoratedVariable | undefined) - set __options_has_stateVar5(__options_has_stateVar5: (boolean | undefined)) - - get __options_has_stateVar5(): (boolean | undefined) - set stateVar6(stateVar6: (Any | undefined)) - - get stateVar6(): (Any | undefined) - set __backing_stateVar6(__backing_stateVar6: (ILocalDecoratedVariable | undefined)) - - get __backing_stateVar6(): (ILocalDecoratedVariable | undefined) - set __options_has_stateVar6(__options_has_stateVar6: (boolean | undefined)) - - get __options_has_stateVar6(): (boolean | undefined) - set stateVar7(stateVar7: (Any | undefined)) - - get stateVar7(): (Any | undefined) - set __options_has_stateVar7(__options_has_stateVar7: (boolean | undefined)) - - get __options_has_stateVar7(): (boolean | undefined) - set stateVar8(stateVar8: (Any | undefined)) - - get stateVar8(): (Any | undefined) - set __options_has_stateVar8(__options_has_stateVar8: (boolean | undefined)) - - get __options_has_stateVar8(): (boolean | undefined) - set stateVar9(stateVar9: (Any | undefined)) - - get stateVar9(): (Any | undefined) - set __backing_stateVar9(__backing_stateVar9: (IParamDecoratedVariable | undefined)) - - get __backing_stateVar9(): (IParamDecoratedVariable | undefined) - set __options_has_stateVar9(__options_has_stateVar9: (boolean | undefined)) - - get __options_has_stateVar9(): (boolean | undefined) - set stateVar10(stateVar10: (Any | undefined)) - - get stateVar10(): (Any | undefined) - set __backing_stateVar10(__backing_stateVar10: (IParamDecoratedVariable | undefined)) - - get __backing_stateVar10(): (IParamDecoratedVariable | undefined) - set __options_has_stateVar10(__options_has_stateVar10: (boolean | undefined)) - - get __options_has_stateVar10(): (boolean | undefined) - set stateVar11(stateVar11: (Any | undefined)) - - get stateVar11(): (Any | undefined) - @Param() set __backing_stateVar11(__backing_stateVar11: (IParamOnceDecoratedVariable | undefined)) - - @Param() get __backing_stateVar11(): (IParamOnceDecoratedVariable | undefined) - set __options_has_stateVar11(__options_has_stateVar11: (boolean | undefined)) - - get __options_has_stateVar11(): (boolean | undefined) - set stateVar12(stateVar12: (Any | undefined)) - - get stateVar12(): (Any | undefined) - set __backing_stateVar12(__backing_stateVar12: (IProviderDecoratedVariable | undefined)) - - get __backing_stateVar12(): (IProviderDecoratedVariable | undefined) - set __options_has_stateVar12(__options_has_stateVar12: (boolean | undefined)) - - get __options_has_stateVar12(): (boolean | undefined) - set stateVar11111(stateVar11111: (Any | undefined)) - - get stateVar11111(): (Any | undefined) - set __backing_stateVar11111(__backing_stateVar11111: (IConsumerDecoratedVariable | undefined)) - - get __backing_stateVar11111(): (IConsumerDecoratedVariable | undefined) - set __options_has_stateVar11111(__options_has_stateVar11111: (boolean | undefined)) - - get __options_has_stateVar11111(): (boolean | undefined) - set stateVar11188(stateVar11188: (Any | undefined)) - - get stateVar11188(): (Any | undefined) - set __backing_stateVar11188(__backing_stateVar11188: (IProviderDecoratedVariable | undefined)) - - get __backing_stateVar11188(): (IProviderDecoratedVariable | undefined) - set __options_has_stateVar11188(__options_has_stateVar11188: (boolean | undefined)) - - get __options_has_stateVar11188(): (boolean | undefined) - set stateVar11112(stateVar11112: (Any | undefined)) - - get stateVar11112(): (Any | undefined) - set __backing_stateVar11112(__backing_stateVar11112: (IConsumerDecoratedVariable | undefined)) - - get __backing_stateVar11112(): (IConsumerDecoratedVariable | undefined) - set __options_has_stateVar11112(__options_has_stateVar11112: (boolean | undefined)) - - get __options_has_stateVar11112(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar4', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar4', '(IParamOnceDecoratedVariable | undefined)', [dumpAnnotation('Param')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar4', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar5', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar5', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar5', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar6', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar6', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar6', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar7', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar7', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar8', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar8', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar9', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar9', '(IParamDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar9', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar10', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar10', '(IParamDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar10', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar11', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar11', '(IParamOnceDecoratedVariable | undefined)', [dumpAnnotation('Param')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar11', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar12', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar12', '(IProviderDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar12', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar11111', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar11111', '(IConsumerDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar11111', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar11188', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar11188', '(IProviderDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar11188', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar11112', '(Any | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar11112', '(IConsumerDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar11112', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/event/event-initialize.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/event/event-initialize.test.ts index b67a9d4f15047362e8fff9726dd84c05d5cd6099..3bd484665c4bef4f12587bddacbb835416cfd21f 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/event/event-initialize.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/event/event-initialize.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper, ignoreNewLines } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -88,6 +89,7 @@ import { Event as Event, Param as Param, Local as Local } from "@ohos.arkui.stat } @ComponentV2() export interface __Options_Child { + ${ignoreNewLines(` index?: number; @Param() __backing_index?: number; __options_has_index?: boolean; @@ -97,14 +99,17 @@ import { Event as Event, Param as Param, Local as Local } from "@ohos.arkui.stat __options_has_testEvent?: boolean; testEvent2?: ((val: number)=> number); __options_has_testEvent2?: boolean; + `)} } @ComponentV2() export interface __Options_Index { + ${ignoreNewLines(` index?: number; @Local() __backing_index?: number; __options_has_index?: boolean; - + `)} + } `; @@ -250,46 +255,25 @@ function main() {} } @ComponentV2() export interface __Options_Child { - set index(index: (number | undefined)) - - get index(): (number | undefined) - set __backing_index(__backing_index: (IParamDecoratedVariable | undefined)) - - get __backing_index(): (IParamDecoratedVariable | undefined) - set __options_has_index(__options_has_index: (boolean | undefined)) - - get __options_has_index(): (boolean | undefined) - set changeIndex(changeIndex: (((val: number)=> void) | undefined)) - - get changeIndex(): (((val: number)=> void) | undefined) - set __options_has_changeIndex(__options_has_changeIndex: (boolean | undefined)) - - get __options_has_changeIndex(): (boolean | undefined) - set testEvent(testEvent: (((val: number)=> number) | undefined)) - - get testEvent(): (((val: number)=> number) | undefined) - set __options_has_testEvent(__options_has_testEvent: (boolean | undefined)) - - get __options_has_testEvent(): (boolean | undefined) - set testEvent2(testEvent2: (((val: number)=> number) | undefined)) - - get testEvent2(): (((val: number)=> number) | undefined) - set __options_has_testEvent2(__options_has_testEvent2: (boolean | undefined)) - - get __options_has_testEvent2(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'index', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_index', '(IParamDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_index', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'changeIndex', '(((val: number)=> void) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_changeIndex', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'testEvent', '(((val: number)=> number) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_testEvent', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'testEvent2', '(((val: number)=> number) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_testEvent2', '(boolean | undefined)')} } @ComponentV2() export interface __Options_Index { - set index(index: (number | undefined)) - - get index(): (number | undefined) - set __backing_index(__backing_index: (ILocalDecoratedVariable | undefined)) - - get __backing_index(): (ILocalDecoratedVariable | undefined) - set __options_has_index(__options_has_index: (boolean | undefined)) - - get __options_has_index(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'index', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_index', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_index', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/link/link-basic-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/link/link-basic-type.test.ts index 28431a068d2ea024aff1d316d7b3c918865c952a..99df21b189c1c85e9bc6297762f4c95003aa0834 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/link/link-basic-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/link/link-basic-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { structNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpAnnotation, dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -139,51 +140,25 @@ function main() {} @Retention({policy:"SOURCE"}) @interface __Link_intrinsic {} @Component() export interface __Options_LinkParent { - @__Link_intrinsic() set linkVar1(linkVar1: (string | undefined)) - - @__Link_intrinsic() get linkVar1(): (string | undefined) - set __backing_linkVar1(__backing_linkVar1: (LinkSourceType | undefined)) - - get __backing_linkVar1(): (LinkSourceType | undefined) - set __options_has_linkVar1(__options_has_linkVar1: (boolean | undefined)) - - get __options_has_linkVar1(): (boolean | undefined) - @__Link_intrinsic() set linkVar2(linkVar2: (number | undefined)) - - @__Link_intrinsic() get linkVar2(): (number | undefined) - set __backing_linkVar2(__backing_linkVar2: (LinkSourceType | undefined)) - - get __backing_linkVar2(): (LinkSourceType | undefined) - set __options_has_linkVar2(__options_has_linkVar2: (boolean | undefined)) - - get __options_has_linkVar2(): (boolean | undefined) - @__Link_intrinsic() set linkVar3(linkVar3: (boolean | undefined)) - - @__Link_intrinsic() get linkVar3(): (boolean | undefined) - set __backing_linkVar3(__backing_linkVar3: (LinkSourceType | undefined)) - - get __backing_linkVar3(): (LinkSourceType | undefined) - set __options_has_linkVar3(__options_has_linkVar3: (boolean | undefined)) - - get __options_has_linkVar3(): (boolean | undefined) - @__Link_intrinsic() set linkVar4(linkVar4: (undefined | undefined)) - - @__Link_intrinsic() get linkVar4(): (undefined | undefined) - set __backing_linkVar4(__backing_linkVar4: (LinkSourceType | undefined)) - - get __backing_linkVar4(): (LinkSourceType | undefined) - set __options_has_linkVar4(__options_has_linkVar4: (boolean | undefined)) - - get __options_has_linkVar4(): (boolean | undefined) - @__Link_intrinsic() set linkVar5(linkVar5: (null | undefined)) - - @__Link_intrinsic() get linkVar5(): (null | undefined) - set __backing_linkVar5(__backing_linkVar5: (LinkSourceType | undefined)) - - get __backing_linkVar5(): (LinkSourceType | undefined) - set __options_has_linkVar5(__options_has_linkVar5: (boolean | undefined)) - - get __options_has_linkVar5(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'linkVar1', '(string | undefined)', [dumpAnnotation('__Link_intrinsic')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_linkVar1', '(LinkSourceType | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_linkVar1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'linkVar2', '(number | undefined)', [dumpAnnotation('__Link_intrinsic')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_linkVar2', '(LinkSourceType | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_linkVar2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'linkVar3', '(boolean | undefined)', [dumpAnnotation('__Link_intrinsic')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_linkVar3', '(LinkSourceType | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_linkVar3', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'linkVar4', '(undefined | undefined)', [dumpAnnotation('__Link_intrinsic')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_linkVar4', '(LinkSourceType | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_linkVar4', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'linkVar5', '(null | undefined)', [dumpAnnotation('__Link_intrinsic')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_linkVar5', '(LinkSourceType | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_linkVar5', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/link/link-complex-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/link/link-complex-type.test.ts index 2f26f551d1a7a1dfc1d5a9de60da662ad88a66ef..5644da5a05a4254fd6a2c537b0f0226bb64181aa 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/link/link-complex-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/link/link-complex-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { structNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { GetSetDumper, dumpGetterSetter, dumpAnnotation } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -314,114 +315,53 @@ final class LinkType extends BaseEnum { @Retention({policy:"SOURCE"}) @interface __Link_intrinsic {} @Component() export interface __Options_Parent { - @__Link_intrinsic() set linkVar1(linkVar1: (Per | undefined)) - - @__Link_intrinsic() get linkVar1(): (Per | undefined) - set __backing_linkVar1(__backing_linkVar1: (LinkSourceType | undefined)) - - get __backing_linkVar1(): (LinkSourceType | undefined) - set __options_has_linkVar1(__options_has_linkVar1: (boolean | undefined)) - - get __options_has_linkVar1(): (boolean | undefined) - @__Link_intrinsic() set linkVar2(linkVar2: (Array | undefined)) - - @__Link_intrinsic() get linkVar2(): (Array | undefined) - set __backing_linkVar2(__backing_linkVar2: (LinkSourceType> | undefined)) - - get __backing_linkVar2(): (LinkSourceType> | undefined) - set __options_has_linkVar2(__options_has_linkVar2: (boolean | undefined)) - - get __options_has_linkVar2(): (boolean | undefined) - @__Link_intrinsic() set linkVar3(linkVar3: (LinkType | undefined)) - - @__Link_intrinsic() get linkVar3(): (LinkType | undefined) - set __backing_linkVar3(__backing_linkVar3: (LinkSourceType | undefined)) - - get __backing_linkVar3(): (LinkSourceType | undefined) - set __options_has_linkVar3(__options_has_linkVar3: (boolean | undefined)) - - get __options_has_linkVar3(): (boolean | undefined) - @__Link_intrinsic() set linkVar4(linkVar4: (Set | undefined)) - - @__Link_intrinsic() get linkVar4(): (Set | undefined) - set __backing_linkVar4(__backing_linkVar4: (LinkSourceType> | undefined)) - - get __backing_linkVar4(): (LinkSourceType> | undefined) - set __options_has_linkVar4(__options_has_linkVar4: (boolean | undefined)) - - get __options_has_linkVar4(): (boolean | undefined) - @__Link_intrinsic() set linkVar5(linkVar5: (Array | undefined)) - - @__Link_intrinsic() get linkVar5(): (Array | undefined) - set __backing_linkVar5(__backing_linkVar5: (LinkSourceType> | undefined)) - - get __backing_linkVar5(): (LinkSourceType> | undefined) - set __options_has_linkVar5(__options_has_linkVar5: (boolean | undefined)) - - get __options_has_linkVar5(): (boolean | undefined) - @__Link_intrinsic() set linkVar6(linkVar6: (Array | undefined)) - - @__Link_intrinsic() get linkVar6(): (Array | undefined) - set __backing_linkVar6(__backing_linkVar6: (LinkSourceType> | undefined)) - - get __backing_linkVar6(): (LinkSourceType> | undefined) - set __options_has_linkVar6(__options_has_linkVar6: (boolean | undefined)) - - get __options_has_linkVar6(): (boolean | undefined) - @__Link_intrinsic() set linkVar7(linkVar7: (Array | undefined)) - - @__Link_intrinsic() get linkVar7(): (Array | undefined) - set __backing_linkVar7(__backing_linkVar7: (LinkSourceType> | undefined)) - - get __backing_linkVar7(): (LinkSourceType> | undefined) - set __options_has_linkVar7(__options_has_linkVar7: (boolean | undefined)) - - get __options_has_linkVar7(): (boolean | undefined) - @__Link_intrinsic() set linkVar8(linkVar8: (((sr: string)=> void) | undefined)) - - @__Link_intrinsic() get linkVar8(): (((sr: string)=> void) | undefined) - set __backing_linkVar8(__backing_linkVar8: (LinkSourceType<((sr: string)=> void)> | undefined)) - - get __backing_linkVar8(): (LinkSourceType<((sr: string)=> void)> | undefined) - set __options_has_linkVar8(__options_has_linkVar8: (boolean | undefined)) - - get __options_has_linkVar8(): (boolean | undefined) - @__Link_intrinsic() set linkVar9(linkVar9: (Date | undefined)) - - @__Link_intrinsic() get linkVar9(): (Date | undefined) - set __backing_linkVar9(__backing_linkVar9: (LinkSourceType | undefined)) - - get __backing_linkVar9(): (LinkSourceType | undefined) - set __options_has_linkVar9(__options_has_linkVar9: (boolean | undefined)) - - get __options_has_linkVar9(): (boolean | undefined) - @__Link_intrinsic() set linkVar10(linkVar10: (Map | undefined)) - - @__Link_intrinsic() get linkVar10(): (Map | undefined) - set __backing_linkVar10(__backing_linkVar10: (LinkSourceType> | undefined)) - - get __backing_linkVar10(): (LinkSourceType> | undefined) - set __options_has_linkVar10(__options_has_linkVar10: (boolean | undefined)) - - get __options_has_linkVar10(): (boolean | undefined) - @__Link_intrinsic() set linkVar11(linkVar11: ((string | number) | undefined)) - - @__Link_intrinsic() get linkVar11(): ((string | number) | undefined) - set __backing_linkVar11(__backing_linkVar11: (LinkSourceType<(string | number)> | undefined)) - - get __backing_linkVar11(): (LinkSourceType<(string | number)> | undefined) - set __options_has_linkVar11(__options_has_linkVar11: (boolean | undefined)) - - get __options_has_linkVar11(): (boolean | undefined) - @__Link_intrinsic() set linkVar12(linkVar12: ((Set | Per) | undefined)) - - @__Link_intrinsic() get linkVar12(): ((Set | Per) | undefined) - set __backing_linkVar12(__backing_linkVar12: (LinkSourceType<(Set | Per)> | undefined)) - - get __backing_linkVar12(): (LinkSourceType<(Set | Per)> | undefined) - set __options_has_linkVar12(__options_has_linkVar12: (boolean | undefined)) - - get __options_has_linkVar12(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'linkVar1', '(Per | undefined)', [dumpAnnotation('__Link_intrinsic')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_linkVar1', '(LinkSourceType | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_linkVar1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'linkVar2', '(Array | undefined)', [dumpAnnotation('__Link_intrinsic')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_linkVar2', '(LinkSourceType> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_linkVar2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'linkVar3', '(LinkType | undefined)', [dumpAnnotation('__Link_intrinsic')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_linkVar3', '(LinkSourceType | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_linkVar3', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'linkVar4', '(Set | undefined)', [dumpAnnotation('__Link_intrinsic')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_linkVar4', '(LinkSourceType> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_linkVar4', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'linkVar5', '(Array | undefined)', [dumpAnnotation('__Link_intrinsic')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_linkVar5', '(LinkSourceType> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_linkVar5', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'linkVar6', '(Array | undefined)', [dumpAnnotation('__Link_intrinsic')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_linkVar6', '(LinkSourceType> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_linkVar6', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'linkVar7', '(Array | undefined)', [dumpAnnotation('__Link_intrinsic')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_linkVar7', '(LinkSourceType> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_linkVar7', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'linkVar8', '(((sr: string)=> void) | undefined)', [dumpAnnotation('__Link_intrinsic')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_linkVar8', '(LinkSourceType<((sr: string)=> void)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_linkVar8', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'linkVar9', '(Date | undefined)', [dumpAnnotation('__Link_intrinsic')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_linkVar9', '(LinkSourceType | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_linkVar9', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'linkVar10', '(Map | undefined)', [dumpAnnotation('__Link_intrinsic')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_linkVar10', '(LinkSourceType> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_linkVar10', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'linkVar11', '((string | number) | undefined)', [dumpAnnotation('__Link_intrinsic')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_linkVar11', '(LinkSourceType<(string | number)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_linkVar11', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'linkVar12', '((Set | Per) | undefined)', [dumpAnnotation('__Link_intrinsic')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_linkVar12', '(LinkSourceType<(Set | Per)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_linkVar12', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/link/link-to-link-propref-state.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/link/link-to-link-propref-state.test.ts index 8af0cc92228929997f226f4466766e36842cd54f..1b038ec84e08fee22df220ce5eac828768fc49d3 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/link/link-to-link-propref-state.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/link/link-to-link-propref-state.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { GetSetDumper, dumpGetterSetter, dumpAnnotation } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -197,55 +198,28 @@ function main() {} @Retention({policy:"SOURCE"}) @interface __Link_intrinsic {} @Component() export interface __Options_Parant { - @__Link_intrinsic() set text1(text1: (string | undefined)) - - @__Link_intrinsic() get text1(): (string | undefined) - set __backing_text1(__backing_text1: (LinkSourceType | undefined)) - - get __backing_text1(): (LinkSourceType | undefined) - set __options_has_text1(__options_has_text1: (boolean | undefined)) - - get __options_has_text1(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'text1', '(string | undefined)', [dumpAnnotation('__Link_intrinsic')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_text1', '(LinkSourceType | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_text1', '(boolean | undefined)')} } @Component() export interface __Options_Child { - @__Link_intrinsic() set childText(childText: (string | undefined)) - - @__Link_intrinsic() get childText(): (string | undefined) - set __backing_childText(__backing_childText: (LinkSourceType | undefined)) - - get __backing_childText(): (LinkSourceType | undefined) - set __options_has_childText(__options_has_childText: (boolean | undefined)) - - get __options_has_childText(): (boolean | undefined) - set childText2(childText2: (string | undefined)) - - get childText2(): (string | undefined) - set __backing_childText2(__backing_childText2: (IStateDecoratedVariable | undefined)) - - get __backing_childText2(): (IStateDecoratedVariable | undefined) - set __options_has_childText2(__options_has_childText2: (boolean | undefined)) - - get __options_has_childText2(): (boolean | undefined) - set childText3(childText3: (string | undefined)) - - get childText3(): (string | undefined) - set __backing_childText3(__backing_childText3: (IPropRefDecoratedVariable | undefined)) - - get __backing_childText3(): (IPropRefDecoratedVariable | undefined) - set __options_has_childText3(__options_has_childText3: (boolean | undefined)) - - get __options_has_childText3(): (boolean | undefined) - set childText4(childText4: (string | undefined)) - - get childText4(): (string | undefined) - set __backing_childText4(__backing_childText4: (IPropRefDecoratedVariable | undefined)) - - get __backing_childText4(): (IPropRefDecoratedVariable | undefined) - set __options_has_childText4(__options_has_childText4: (boolean | undefined)) - - get __options_has_childText4(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'childText', '(string | undefined)', [dumpAnnotation('__Link_intrinsic')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_childText', '(LinkSourceType | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_childText', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'childText2', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_childText2', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_childText2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'childText3', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_childText3', '(IPropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_childText3', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'childText4', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_childText4', '(IPropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_childText4', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/link/state-to-link.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/link/state-to-link.test.ts index df394256738de10f8385bbcc6e2af9706e3d679d..cf0a30ddc2959465a637a6b23c5e9d6742d6e754 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/link/state-to-link.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/link/state-to-link.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { GetSetDumper, dumpGetterSetter, dumpAnnotation } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -193,28 +194,16 @@ __EntryWrapper.RegisterNamedRouter("", new __EntryWrapper(), ({ @Retention({policy:"SOURCE"}) @interface __Link_intrinsic {} @Component() export interface __Options_DateComponent { - @__Link_intrinsic() set selectedDate(selectedDate: (Date | undefined)) - - @__Link_intrinsic() get selectedDate(): (Date | undefined) - set __backing_selectedDate(__backing_selectedDate: (LinkSourceType | undefined)) - - get __backing_selectedDate(): (LinkSourceType | undefined) - set __options_has_selectedDate(__options_has_selectedDate: (boolean | undefined)) - - get __options_has_selectedDate(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'selectedDate', '(Date | undefined)', [dumpAnnotation('__Link_intrinsic')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_selectedDate', '(LinkSourceType | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_selectedDate', '(boolean | undefined)')} } @Entry({useSharedStorage:false,storage:"",routeName:""}) @Component() export interface __Options_ParentComponent { - set parentSelectedDate(parentSelectedDate: (Date | undefined)) - - get parentSelectedDate(): (Date | undefined) - set __backing_parentSelectedDate(__backing_parentSelectedDate: (IStateDecoratedVariable | undefined)) - - get __backing_parentSelectedDate(): (IStateDecoratedVariable | undefined) - set __options_has_parentSelectedDate(__options_has_parentSelectedDate: (boolean | undefined)) - - get __options_has_parentSelectedDate(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'parentSelectedDate', '(Date | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_parentSelectedDate', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_parentSelectedDate', '(boolean | undefined)')} } diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/local/local-basic-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/local/local-basic-type.test.ts index 4f48fb98fab0bf473265e6e18e3ab2549b8950fc..4bc00dc6ff94915a376c9e6a5f0c201491447e6b 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/local/local-basic-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/local/local-basic-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { structNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -120,51 +121,25 @@ function main() {} } @ComponentV2() export interface __Options_Parent { - set localVar1(localVar1: (string | undefined)) - - get localVar1(): (string | undefined) - set __backing_localVar1(__backing_localVar1: (ILocalDecoratedVariable | undefined)) - - get __backing_localVar1(): (ILocalDecoratedVariable | undefined) - set __options_has_localVar1(__options_has_localVar1: (boolean | undefined)) - - get __options_has_localVar1(): (boolean | undefined) - set localVar2(localVar2: (number | undefined)) - - get localVar2(): (number | undefined) - set __backing_localVar2(__backing_localVar2: (ILocalDecoratedVariable | undefined)) - - get __backing_localVar2(): (ILocalDecoratedVariable | undefined) - set __options_has_localVar2(__options_has_localVar2: (boolean | undefined)) - - get __options_has_localVar2(): (boolean | undefined) - set localVar3(localVar3: (boolean | undefined)) - - get localVar3(): (boolean | undefined) - set __backing_localVar3(__backing_localVar3: (ILocalDecoratedVariable | undefined)) - - get __backing_localVar3(): (ILocalDecoratedVariable | undefined) - set __options_has_localVar3(__options_has_localVar3: (boolean | undefined)) - - get __options_has_localVar3(): (boolean | undefined) - set localVar4(localVar4: (undefined | undefined)) - - get localVar4(): (undefined | undefined) - set __backing_localVar4(__backing_localVar4: (ILocalDecoratedVariable | undefined)) - - get __backing_localVar4(): (ILocalDecoratedVariable | undefined) - set __options_has_localVar4(__options_has_localVar4: (boolean | undefined)) - - get __options_has_localVar4(): (boolean | undefined) - set localVar5(localVar5: (null | undefined)) - - get localVar5(): (null | undefined) - set __backing_localVar5(__backing_localVar5: (ILocalDecoratedVariable | undefined)) - - get __backing_localVar5(): (ILocalDecoratedVariable | undefined) - set __options_has_localVar5(__options_has_localVar5: (boolean | undefined)) - - get __options_has_localVar5(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'localVar1', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_localVar1', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_localVar1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'localVar2', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_localVar2', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_localVar2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'localVar3', '(boolean | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_localVar3', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_localVar3', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'localVar4', '(undefined | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_localVar4', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_localVar4', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'localVar5', '(null | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_localVar5', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_localVar5', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/local/local-complex-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/local/local-complex-type.test.ts index 949fed1621a58aa02308db5a57252c36902d1e96..f557a7d5edf5d5356785b2943cc251e152a0e694 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/local/local-complex-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/local/local-complex-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { structNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -263,105 +264,49 @@ final class StateType extends BaseEnum { } @ComponentV2() export interface __Options_Parent { - set localVar1(localVar1: (Per | undefined)) - - get localVar1(): (Per | undefined) - set __backing_localVar1(__backing_localVar1: (ILocalDecoratedVariable | undefined)) - - get __backing_localVar1(): (ILocalDecoratedVariable | undefined) - set __options_has_localVar1(__options_has_localVar1: (boolean | undefined)) - - get __options_has_localVar1(): (boolean | undefined) - set localVar2(localVar2: (Array | undefined)) - - get localVar2(): (Array | undefined) - set __backing_localVar2(__backing_localVar2: (ILocalDecoratedVariable> | undefined)) - - get __backing_localVar2(): (ILocalDecoratedVariable> | undefined) - set __options_has_localVar2(__options_has_localVar2: (boolean | undefined)) - - get __options_has_localVar2(): (boolean | undefined) - set localVar3(localVar3: (StateType | undefined)) - - get localVar3(): (StateType | undefined) - set __backing_localVar3(__backing_localVar3: (ILocalDecoratedVariable | undefined)) - - get __backing_localVar3(): (ILocalDecoratedVariable | undefined) - set __options_has_localVar3(__options_has_localVar3: (boolean | undefined)) - - get __options_has_localVar3(): (boolean | undefined) - set localVar4(localVar4: (Set | undefined)) - - get localVar4(): (Set | undefined) - set __backing_localVar4(__backing_localVar4: (ILocalDecoratedVariable> | undefined)) - - get __backing_localVar4(): (ILocalDecoratedVariable> | undefined) - set __options_has_localVar4(__options_has_localVar4: (boolean | undefined)) - - get __options_has_localVar4(): (boolean | undefined) - set localVar5(localVar5: (Array | undefined)) - - get localVar5(): (Array | undefined) - set __backing_localVar5(__backing_localVar5: (ILocalDecoratedVariable> | undefined)) - - get __backing_localVar5(): (ILocalDecoratedVariable> | undefined) - set __options_has_localVar5(__options_has_localVar5: (boolean | undefined)) - - get __options_has_localVar5(): (boolean | undefined) - set localVar6(localVar6: (Array | undefined)) - - get localVar6(): (Array | undefined) - set __backing_localVar6(__backing_localVar6: (ILocalDecoratedVariable> | undefined)) - - get __backing_localVar6(): (ILocalDecoratedVariable> | undefined) - set __options_has_localVar6(__options_has_localVar6: (boolean | undefined)) - - get __options_has_localVar6(): (boolean | undefined) - set localVar7(localVar7: (Array | undefined)) - - get localVar7(): (Array | undefined) - set __backing_localVar7(__backing_localVar7: (ILocalDecoratedVariable> | undefined)) - - get __backing_localVar7(): (ILocalDecoratedVariable> | undefined) - set __options_has_localVar7(__options_has_localVar7: (boolean | undefined)) - - get __options_has_localVar7(): (boolean | undefined) - set localVar9(localVar9: (Date | undefined)) - - get localVar9(): (Date | undefined) - set __backing_localVar9(__backing_localVar9: (ILocalDecoratedVariable | undefined)) - - get __backing_localVar9(): (ILocalDecoratedVariable | undefined) - set __options_has_localVar9(__options_has_localVar9: (boolean | undefined)) - - get __options_has_localVar9(): (boolean | undefined) - set localVar10(localVar10: (Map | undefined)) - - get localVar10(): (Map | undefined) - set __backing_localVar10(__backing_localVar10: (ILocalDecoratedVariable> | undefined)) - - get __backing_localVar10(): (ILocalDecoratedVariable> | undefined) - set __options_has_localVar10(__options_has_localVar10: (boolean | undefined)) - - get __options_has_localVar10(): (boolean | undefined) - set localVar11(localVar11: ((string | number) | undefined)) - - get localVar11(): ((string | number) | undefined) - set __backing_localVar11(__backing_localVar11: (ILocalDecoratedVariable<(string | number)> | undefined)) - - get __backing_localVar11(): (ILocalDecoratedVariable<(string | number)> | undefined) - set __options_has_localVar11(__options_has_localVar11: (boolean | undefined)) - - get __options_has_localVar11(): (boolean | undefined) - set localVar12(localVar12: ((Set | Per) | undefined)) - - get localVar12(): ((Set | Per) | undefined) - set __backing_localVar12(__backing_localVar12: (ILocalDecoratedVariable<(Set | Per)> | undefined)) - - get __backing_localVar12(): (ILocalDecoratedVariable<(Set | Per)> | undefined) - set __options_has_localVar12(__options_has_localVar12: (boolean | undefined)) - - get __options_has_localVar12(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'localVar1', '(Per | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_localVar1', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_localVar1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'localVar2', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_localVar2', '(ILocalDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_localVar2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'localVar3', '(StateType | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_localVar3', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_localVar3', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'localVar4', '(Set | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_localVar4', '(ILocalDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_localVar4', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'localVar5', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_localVar5', '(ILocalDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_localVar5', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'localVar6', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_localVar6', '(ILocalDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_localVar6', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'localVar7', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_localVar7', '(ILocalDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_localVar7', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'localVar9', '(Date | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_localVar9', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_localVar9', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'localVar10', '(Map | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_localVar10', '(ILocalDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_localVar10', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'localVar11', '((string | number) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_localVar11', '(ILocalDecoratedVariable<(string | number)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_localVar11', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'localVar12', '((Set | Per) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_localVar12', '(ILocalDecoratedVariable<(Set | Per)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_localVar12', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/local/static-local.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/local/static-local.test.ts index 3676ad7b4ad562c1967a931bf8101d8f60ebc17b..4735579f8c787d300ff8654e328ca0c5ed018541 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/local/static-local.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/local/static-local.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -102,33 +103,17 @@ class ABB { } @ComponentV2() export interface __Options_Parent { - set localVar1(localVar1: (string | undefined)) - - get localVar1(): (string | undefined) - set __backing_localVar1(__backing_localVar1: (ILocalDecoratedVariable | undefined)) - - get __backing_localVar1(): (ILocalDecoratedVariable | undefined) - set __options_has_localVar1(__options_has_localVar1: (boolean | undefined)) - - get __options_has_localVar1(): (boolean | undefined) - set localVar2(localVar2: (number | undefined)) - - get localVar2(): (number | undefined) - set __backing_localVar2(__backing_localVar2: (ILocalDecoratedVariable | undefined)) - - get __backing_localVar2(): (ILocalDecoratedVariable | undefined) - set __options_has_localVar2(__options_has_localVar2: (boolean | undefined)) - - get __options_has_localVar2(): (boolean | undefined) - set localVar3(localVar3: (ABB | undefined)) - - get localVar3(): (ABB | undefined) - set __backing_localVar3(__backing_localVar3: (ILocalDecoratedVariable | undefined)) - - get __backing_localVar3(): (ILocalDecoratedVariable | undefined) - set __options_has_localVar3(__options_has_localVar3: (boolean | undefined)) - - get __options_has_localVar3(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'localVar1', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_localVar1', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_localVar1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'localVar2', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_localVar2', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_localVar2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'localVar3', '(ABB | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_localVar3', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_localVar3', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/localstoragelink/localstoragelink-complex-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/localstoragelink/localstoragelink-complex-type.test.ts index ea1278cd2e8840573fd6689ea0cdb1ebb45661cd..81b0ca1908e47207645861610b3da481d938f399 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/localstoragelink/localstoragelink-complex-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/localstoragelink/localstoragelink-complex-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { uiNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -244,78 +245,37 @@ final class Status extends BaseEnum { } @Entry({useSharedStorage:false,storage:"",routeName:""}) @Component() export interface __Options_MyStateSample { - set arrayA(arrayA: (Array | undefined)) - - get arrayA(): (Array | undefined) - set __backing_arrayA(__backing_arrayA: (ILocalStorageLinkDecoratedVariable> | undefined)) - - get __backing_arrayA(): (ILocalStorageLinkDecoratedVariable> | undefined) - set __options_has_arrayA(__options_has_arrayA: (boolean | undefined)) - - get __options_has_arrayA(): (boolean | undefined) - set objectA(objectA: (Object | undefined)) - - get objectA(): (Object | undefined) - set __backing_objectA(__backing_objectA: (ILocalStorageLinkDecoratedVariable | undefined)) - - get __backing_objectA(): (ILocalStorageLinkDecoratedVariable | undefined) - set __options_has_objectA(__options_has_objectA: (boolean | undefined)) - - get __options_has_objectA(): (boolean | undefined) - set dateA(dateA: (Date | undefined)) - - get dateA(): (Date | undefined) - set __backing_dateA(__backing_dateA: (ILocalStorageLinkDecoratedVariable | undefined)) - - get __backing_dateA(): (ILocalStorageLinkDecoratedVariable | undefined) - set __options_has_dateA(__options_has_dateA: (boolean | undefined)) - - get __options_has_dateA(): (boolean | undefined) - set setA(setA: (Set | undefined)) - - get setA(): (Set | undefined) - set __backing_setA(__backing_setA: (ILocalStorageLinkDecoratedVariable> | undefined)) - - get __backing_setA(): (ILocalStorageLinkDecoratedVariable> | undefined) - set __options_has_setA(__options_has_setA: (boolean | undefined)) - - get __options_has_setA(): (boolean | undefined) - set mapA(mapA: (Map | undefined)) - - get mapA(): (Map | undefined) - set __backing_mapA(__backing_mapA: (ILocalStorageLinkDecoratedVariable> | undefined)) - - get __backing_mapA(): (ILocalStorageLinkDecoratedVariable> | undefined) - set __options_has_mapA(__options_has_mapA: (boolean | undefined)) - - get __options_has_mapA(): (boolean | undefined) - set unionA(unionA: ((string | undefined) | undefined)) - - get unionA(): ((string | undefined) | undefined) - set __backing_unionA(__backing_unionA: (ILocalStorageLinkDecoratedVariable<(string | undefined)> | undefined)) - - get __backing_unionA(): (ILocalStorageLinkDecoratedVariable<(string | undefined)> | undefined) - set __options_has_unionA(__options_has_unionA: (boolean | undefined)) - - get __options_has_unionA(): (boolean | undefined) - set classA(classA: (Person | undefined)) - - get classA(): (Person | undefined) - set __backing_classA(__backing_classA: (ILocalStorageLinkDecoratedVariable | undefined)) - - get __backing_classA(): (ILocalStorageLinkDecoratedVariable | undefined) - set __options_has_classA(__options_has_classA: (boolean | undefined)) - - get __options_has_classA(): (boolean | undefined) - set enumA(enumA: (Status | undefined)) - - get enumA(): (Status | undefined) - set __backing_enumA(__backing_enumA: (ILocalStorageLinkDecoratedVariable | undefined)) - - get __backing_enumA(): (ILocalStorageLinkDecoratedVariable | undefined) - set __options_has_enumA(__options_has_enumA: (boolean | undefined)) - - get __options_has_enumA(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'arrayA', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_arrayA', '(ILocalStorageLinkDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_arrayA', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'objectA', '(Object | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_objectA', '(ILocalStorageLinkDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_objectA', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'dateA', '(Date | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_dateA', '(ILocalStorageLinkDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_dateA', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'setA', '(Set | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_setA', '(ILocalStorageLinkDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_setA', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'mapA', '(Map | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_mapA', '(ILocalStorageLinkDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_mapA', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'unionA', '((string | undefined) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_unionA', '(ILocalStorageLinkDecoratedVariable<(string | undefined)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_unionA', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'classA', '(Person | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_classA', '(ILocalStorageLinkDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_classA', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'enumA', '(Status | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_enumA', '(ILocalStorageLinkDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_enumA', '(boolean | undefined)')} } diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/localstoragelink/localstoragelink-primitive-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/localstoragelink/localstoragelink-primitive-type.test.ts index 581f7c8e6887254df70ad24e4964c4af7d99e90e..a0d915cc8063e7cd0171b56ee5d6cff654d47700 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/localstoragelink/localstoragelink-primitive-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/localstoragelink/localstoragelink-primitive-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { uiNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -113,33 +114,17 @@ __EntryWrapper.RegisterNamedRouter("", new __EntryWrapper(), ({ } @Entry({useSharedStorage:false,storage:"",routeName:""}) @Component() export interface __Options_MyStateSample { - set numA(numA: (number | undefined)) - - get numA(): (number | undefined) - set __backing_numA(__backing_numA: (ILocalStorageLinkDecoratedVariable | undefined)) - - get __backing_numA(): (ILocalStorageLinkDecoratedVariable | undefined) - set __options_has_numA(__options_has_numA: (boolean | undefined)) - - get __options_has_numA(): (boolean | undefined) - set stringA(stringA: (string | undefined)) - - get stringA(): (string | undefined) - set __backing_stringA(__backing_stringA: (ILocalStorageLinkDecoratedVariable | undefined)) - - get __backing_stringA(): (ILocalStorageLinkDecoratedVariable | undefined) - set __options_has_stringA(__options_has_stringA: (boolean | undefined)) - - get __options_has_stringA(): (boolean | undefined) - set booleanA(booleanA: (boolean | undefined)) - - get booleanA(): (boolean | undefined) - set __backing_booleanA(__backing_booleanA: (ILocalStorageLinkDecoratedVariable | undefined)) - - get __backing_booleanA(): (ILocalStorageLinkDecoratedVariable | undefined) - set __options_has_booleanA(__options_has_booleanA: (boolean | undefined)) - - get __options_has_booleanA(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'numA', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_numA', '(ILocalStorageLinkDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_numA', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stringA', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stringA', '(ILocalStorageLinkDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stringA', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'booleanA', '(boolean | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_booleanA', '(ILocalStorageLinkDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_booleanA', '(boolean | undefined)')} } diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/localstorageprop-ref/localstorageprop-ref-complex-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/localstorageprop-ref/localstorageprop-ref-complex-type.test.ts index a1d42700d97526c57dd33d5912720953e8ddc00f..5e88c5774c174364617355823e63ed2589dec271 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/localstorageprop-ref/localstorageprop-ref-complex-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/localstorageprop-ref/localstorageprop-ref-complex-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { uiNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -217,69 +218,33 @@ final class Status extends BaseEnum { } @Component() export interface __Options_MyStateSample { - set arrayB(arrayB: (Array | undefined)) - - get arrayB(): (Array | undefined) - set __backing_arrayB(__backing_arrayB: (ILocalStoragePropRefDecoratedVariable> | undefined)) - - get __backing_arrayB(): (ILocalStoragePropRefDecoratedVariable> | undefined) - set __options_has_arrayB(__options_has_arrayB: (boolean | undefined)) - - get __options_has_arrayB(): (boolean | undefined) - set objectB(objectB: (Object | undefined)) - - get objectB(): (Object | undefined) - set __backing_objectB(__backing_objectB: (ILocalStoragePropRefDecoratedVariable | undefined)) - - get __backing_objectB(): (ILocalStoragePropRefDecoratedVariable | undefined) - set __options_has_objectB(__options_has_objectB: (boolean | undefined)) - - get __options_has_objectB(): (boolean | undefined) - set dateB(dateB: (Date | undefined)) - - get dateB(): (Date | undefined) - set __backing_dateB(__backing_dateB: (ILocalStoragePropRefDecoratedVariable | undefined)) - - get __backing_dateB(): (ILocalStoragePropRefDecoratedVariable | undefined) - set __options_has_dateB(__options_has_dateB: (boolean | undefined)) - - get __options_has_dateB(): (boolean | undefined) - set setB(setB: (Set | undefined)) - - get setB(): (Set | undefined) - set __backing_setB(__backing_setB: (ILocalStoragePropRefDecoratedVariable> | undefined)) - - get __backing_setB(): (ILocalStoragePropRefDecoratedVariable> | undefined) - set __options_has_setB(__options_has_setB: (boolean | undefined)) - - get __options_has_setB(): (boolean | undefined) - set mapB(mapB: (Map | undefined)) - - get mapB(): (Map | undefined) - set __backing_mapB(__backing_mapB: (ILocalStoragePropRefDecoratedVariable> | undefined)) - - get __backing_mapB(): (ILocalStoragePropRefDecoratedVariable> | undefined) - set __options_has_mapB(__options_has_mapB: (boolean | undefined)) - - get __options_has_mapB(): (boolean | undefined) - set classB(classB: (Person | undefined)) - - get classB(): (Person | undefined) - set __backing_classB(__backing_classB: (ILocalStoragePropRefDecoratedVariable | undefined)) - - get __backing_classB(): (ILocalStoragePropRefDecoratedVariable | undefined) - set __options_has_classB(__options_has_classB: (boolean | undefined)) - - get __options_has_classB(): (boolean | undefined) - set enumB(enumB: (Status | undefined)) - - get enumB(): (Status | undefined) - set __backing_enumB(__backing_enumB: (ILocalStoragePropRefDecoratedVariable | undefined)) - - get __backing_enumB(): (ILocalStoragePropRefDecoratedVariable | undefined) - set __options_has_enumB(__options_has_enumB: (boolean | undefined)) - - get __options_has_enumB(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'arrayB', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_arrayB', '(ILocalStoragePropRefDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_arrayB', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'objectB', '(Object | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_objectB', '(ILocalStoragePropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_objectB', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'dateB', '(Date | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_dateB', '(ILocalStoragePropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_dateB', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'setB', '(Set | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_setB', '(ILocalStoragePropRefDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_setB', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'mapB', '(Map | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_mapB', '(ILocalStoragePropRefDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_mapB', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'classB', '(Person | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_classB', '(ILocalStoragePropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_classB', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'enumB', '(Status | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_enumB', '(ILocalStoragePropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_enumB', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/localstorageprop-ref/localstorageprop-ref-primitive-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/localstorageprop-ref/localstorageprop-ref-primitive-type.test.ts index d73ad8837ac32846668df8c82ba88b5081029af7..dd3158507966a576dd82fb357fddf661c55d03c6 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/localstorageprop-ref/localstorageprop-ref-primitive-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/localstorageprop-ref/localstorageprop-ref-primitive-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { uiNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -120,51 +121,25 @@ function main() {} } @Component() export interface __Options_MyStateSample { - set numB(numB: (number | undefined)) - - get numB(): (number | undefined) - set __backing_numB(__backing_numB: (ILocalStoragePropRefDecoratedVariable | undefined)) - - get __backing_numB(): (ILocalStoragePropRefDecoratedVariable | undefined) - set __options_has_numB(__options_has_numB: (boolean | undefined)) - - get __options_has_numB(): (boolean | undefined) - set stringB(stringB: (string | undefined)) - - get stringB(): (string | undefined) - set __backing_stringB(__backing_stringB: (ILocalStoragePropRefDecoratedVariable | undefined)) - - get __backing_stringB(): (ILocalStoragePropRefDecoratedVariable | undefined) - set __options_has_stringB(__options_has_stringB: (boolean | undefined)) - - get __options_has_stringB(): (boolean | undefined) - set booleanB(booleanB: (boolean | undefined)) - - get booleanB(): (boolean | undefined) - set __backing_booleanB(__backing_booleanB: (ILocalStoragePropRefDecoratedVariable | undefined)) - - get __backing_booleanB(): (ILocalStoragePropRefDecoratedVariable | undefined) - set __options_has_booleanB(__options_has_booleanB: (boolean | undefined)) - - get __options_has_booleanB(): (boolean | undefined) - set undefinedB(undefinedB: (undefined | undefined)) - - get undefinedB(): (undefined | undefined) - set __backing_undefinedB(__backing_undefinedB: (ILocalStoragePropRefDecoratedVariable | undefined)) - - get __backing_undefinedB(): (ILocalStoragePropRefDecoratedVariable | undefined) - set __options_has_undefinedB(__options_has_undefinedB: (boolean | undefined)) - - get __options_has_undefinedB(): (boolean | undefined) - set nullB(nullB: (null | undefined)) - - get nullB(): (null | undefined) - set __backing_nullB(__backing_nullB: (ILocalStoragePropRefDecoratedVariable | undefined)) - - get __backing_nullB(): (ILocalStoragePropRefDecoratedVariable | undefined) - set __options_has_nullB(__options_has_nullB: (boolean | undefined)) + ${dumpGetterSetter(GetSetDumper.BOTH, 'numB', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_numB', '(ILocalStoragePropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_numB', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stringB', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stringB', '(ILocalStoragePropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stringB', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'booleanB', '(boolean | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_booleanB', '(ILocalStoragePropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_booleanB', '(boolean | undefined)')} - get __options_has_nullB(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'undefinedB', '(undefined | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_undefinedB', '(ILocalStoragePropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_undefinedB', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'nullB', '(null | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_nullB', '(ILocalStoragePropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_nullB', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/monitor/enum-monitor-params.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/monitor/enum-monitor-params.test.ts index ed04cda5d5cc279e3d6d351a6da9db2e1b32ee71..33be10f5b7bce56f2ce1f3439e7baa7d9ccab9c2 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/monitor/enum-monitor-params.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/monitor/enum-monitor-params.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -268,15 +269,9 @@ final class MonitorNames extends BaseEnum { } @ComponentV2() export interface __Options_Index { - set varF(varF: (FFF | undefined)) - - get varF(): (FFF | undefined) - set __backing_varF(__backing_varF: (ILocalDecoratedVariable | undefined)) - - get __backing_varF(): (ILocalDecoratedVariable | undefined) - set __options_has_varF(__options_has_varF: (boolean | undefined)) - - get __options_has_varF(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'varF', '(FFF | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_varF', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_varF', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/monitor/monitor-before-state-variable.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/monitor/monitor-before-state-variable.test.ts index 27ec76c7d2fd8409cd00b70afc1fa67f99e8f632..12c84be9e9ee827782a6840c9f9b895f29f07ea6 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/monitor/monitor-before-state-variable.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/monitor/monitor-before-state-variable.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -151,33 +152,17 @@ function main() {} } @ComponentV2() export interface __Options_Index { - set message(message: (string | undefined)) - - get message(): (string | undefined) - set __backing_message(__backing_message: (ILocalDecoratedVariable | undefined)) - - get __backing_message(): (ILocalDecoratedVariable | undefined) - set __options_has_message(__options_has_message: (boolean | undefined)) - - get __options_has_message(): (boolean | undefined) - set name(name: (string | undefined)) - - get name(): (string | undefined) - set __backing_name(__backing_name: (ILocalDecoratedVariable | undefined)) - - get __backing_name(): (ILocalDecoratedVariable | undefined) - set __options_has_name(__options_has_name: (boolean | undefined)) - - get __options_has_name(): (boolean | undefined) - set age(age: (number | undefined)) - - get age(): (number | undefined) - set __backing_age(__backing_age: (ILocalDecoratedVariable | undefined)) - - get __backing_age(): (ILocalDecoratedVariable | undefined) - set __options_has_age(__options_has_age: (boolean | undefined)) - - get __options_has_age(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'message', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_message', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_message', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'name', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_name', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_name', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'age', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_age', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_age', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/monitor/monitor-in-observedv2-class.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/monitor/monitor-in-observedv2-class.test.ts index 438c7fdffb036444a0c5a63f8b91cb708c9efb85..a8b4c1a7dc9d2ebd4ece2c76154b052ec8311ec8 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/monitor/monitor-in-observedv2-class.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/monitor/monitor-in-observedv2-class.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -263,12 +264,8 @@ function main() {} } @ComponentV2() export interface __Options_Index { - set info(info: (Info | undefined)) - - get info(): (Info | undefined) - set __options_has_info(__options_has_info: (boolean | undefined)) - - get __options_has_info(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'info', '(Info | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_info', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/monitor/monitor-in-struct.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/monitor/monitor-in-struct.test.ts index 6c805cc892d79e6ca3d13b26131d191c6a12e995..1b9e8de3c0bc96cfcce64c59f3844b02158dae01 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/monitor/monitor-in-struct.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/monitor/monitor-in-struct.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -146,33 +147,17 @@ function main() {} } @ComponentV2() export interface __Options_Index { - set message(message: (string | undefined)) - - get message(): (string | undefined) - set __backing_message(__backing_message: (ILocalDecoratedVariable | undefined)) - - get __backing_message(): (ILocalDecoratedVariable | undefined) - set __options_has_message(__options_has_message: (boolean | undefined)) - - get __options_has_message(): (boolean | undefined) - set name(name: (string | undefined)) - - get name(): (string | undefined) - set __backing_name(__backing_name: (ILocalDecoratedVariable | undefined)) - - get __backing_name(): (ILocalDecoratedVariable | undefined) - set __options_has_name(__options_has_name: (boolean | undefined)) - - get __options_has_name(): (boolean | undefined) - set age(age: (number | undefined)) - - get age(): (number | undefined) - set __backing_age(__backing_age: (ILocalDecoratedVariable | undefined)) - - get __backing_age(): (ILocalDecoratedVariable | undefined) - set __options_has_age(__options_has_age: (boolean | undefined)) - - get __options_has_age(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'message', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_message', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_message', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'name', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_name', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_name', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'age', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_age', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_age', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/monitor/monitor-params.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/monitor/monitor-params.test.ts index 63ad17e81675eb352aa17a3a78b6f81f2bb889a8..d4f87939eba045f423d55552edaa095de5677441 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/monitor/monitor-params.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/monitor/monitor-params.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -318,33 +319,17 @@ class GGG { } @ComponentV2() export interface __Options_Index { - set per(per: (EEE | undefined)) - - get per(): (EEE | undefined) - set __backing_per(__backing_per: (ILocalDecoratedVariable | undefined)) - - get __backing_per(): (ILocalDecoratedVariable | undefined) - set __options_has_per(__options_has_per: (boolean | undefined)) - - get __options_has_per(): (boolean | undefined) - set v1(v1: (boolean | undefined)) - - get v1(): (boolean | undefined) - set __backing_v1(__backing_v1: (ILocalDecoratedVariable | undefined)) - - get __backing_v1(): (ILocalDecoratedVariable | undefined) - set __options_has_v1(__options_has_v1: (boolean | undefined)) - - get __options_has_v1(): (boolean | undefined) - set numArr(numArr: (Array | undefined)) - - get numArr(): (Array | undefined) - set __backing_numArr(__backing_numArr: (ILocalDecoratedVariable> | undefined)) - - get __backing_numArr(): (ILocalDecoratedVariable> | undefined) - set __options_has_numArr(__options_has_numArr: (boolean | undefined)) - - get __options_has_numArr(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'per', '(EEE | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_per', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_per', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'v1', '(boolean | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_v1', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_v1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'numArr', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_numArr', '(ILocalDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_numArr', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/objectlink/objectlink-basic.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/objectlink/objectlink-basic.test.ts index c42ce7782b1ad8e9b08f6990cf76bb38cda08f5b..9f377e590a4d916970804e420fbbc7517f8f7eb2 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/objectlink/objectlink-basic.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/objectlink/objectlink-basic.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -205,46 +206,24 @@ function main() {} } @Component() export interface __Options_MyStateSample { - set objectlinkvar(objectlinkvar: (A | undefined)) - - get objectlinkvar(): (A | undefined) - set __backing_objectlinkvar(__backing_objectlinkvar: (IObjectLinkDecoratedVariable | undefined)) - - get __backing_objectlinkvar(): (IObjectLinkDecoratedVariable | undefined) - set __options_has_objectlinkvar(__options_has_objectlinkvar: (boolean | undefined)) - - get __options_has_objectlinkvar(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'objectlinkvar', '(A | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_objectlinkvar', '(IObjectLinkDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_objectlinkvar', '(boolean | undefined)')} } @Component() export interface __Options_MyStateSample2 { - set objectlinkvar1(objectlinkvar1: ((A | undefined) | undefined)) - - get objectlinkvar1(): ((A | undefined) | undefined) - set __backing_objectlinkvar1(__backing_objectlinkvar1: (IObjectLinkDecoratedVariable<(A | undefined)> | undefined)) - - get __backing_objectlinkvar1(): (IObjectLinkDecoratedVariable<(A | undefined)> | undefined) - set __options_has_objectlinkvar1(__options_has_objectlinkvar1: (boolean | undefined)) - - get __options_has_objectlinkvar1(): (boolean | undefined) - set objectlinkvar2(objectlinkvar2: ((A | B) | undefined)) - - get objectlinkvar2(): ((A | B) | undefined) - set __backing_objectlinkvar2(__backing_objectlinkvar2: (IObjectLinkDecoratedVariable<(A | B)> | undefined)) - - get __backing_objectlinkvar2(): (IObjectLinkDecoratedVariable<(A | B)> | undefined) - set __options_has_objectlinkvar2(__options_has_objectlinkvar2: (boolean | undefined)) - - get __options_has_objectlinkvar2(): (boolean | undefined) - set objectlinkvar3(objectlinkvar3: ((A | B | null) | undefined)) - - get objectlinkvar3(): ((A | B | null) | undefined) - set __backing_objectlinkvar3(__backing_objectlinkvar3: (IObjectLinkDecoratedVariable<(A | B | null)> | undefined)) - - get __backing_objectlinkvar3(): (IObjectLinkDecoratedVariable<(A | B | null)> | undefined) - set __options_has_objectlinkvar3(__options_has_objectlinkvar3: (boolean | undefined)) - - get __options_has_objectlinkvar3(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'objectlinkvar1', '((A | undefined) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_objectlinkvar1', '(IObjectLinkDecoratedVariable<(A | undefined)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_objectlinkvar1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'objectlinkvar2', '((A | B) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_objectlinkvar2', '(IObjectLinkDecoratedVariable<(A | B)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_objectlinkvar2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'objectlinkvar3', '((A | B | null) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_objectlinkvar3', '(IObjectLinkDecoratedVariable<(A | B | null)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_objectlinkvar3', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/objectlink/objectlink-observed.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/objectlink/objectlink-observed.test.ts index 50e93abfed592286c1748f745c43dcd141199aad..7f1cbcf13740cdade27208a6bd8adcfb6b09c8e1 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/objectlink/objectlink-observed.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/objectlink/objectlink-observed.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -274,34 +275,19 @@ __EntryWrapper.RegisterNamedRouter("", new __EntryWrapper(), ({ } @Component() export interface __Options_Child { - set label(label: (string | undefined)) - - get label(): (string | undefined) - set __options_has_label(__options_has_label: (boolean | undefined)) - - get __options_has_label(): (boolean | undefined) - set data(data: (DateClass | undefined)) - - get data(): (DateClass | undefined) - set __backing_data(__backing_data: (IObjectLinkDecoratedVariable | undefined)) - - get __backing_data(): (IObjectLinkDecoratedVariable | undefined) - set __options_has_data(__options_has_data: (boolean | undefined)) - - get __options_has_data(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'label', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_label', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'data', '(DateClass | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_data', '(IObjectLinkDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_data', '(boolean | undefined)')} } @Entry({useSharedStorage:false,storage:"",routeName:""}) @Component() export interface __Options_Parent { - set newData(newData: (NewDate | undefined)) - - get newData(): (NewDate | undefined) - set __backing_newData(__backing_newData: (IStateDecoratedVariable | undefined)) - - get __backing_newData(): (IStateDecoratedVariable | undefined) - set __options_has_newData(__options_has_newData: (boolean | undefined)) - - get __options_has_newData(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'newData', '(NewDate | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_newData', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_newData', '(boolean | undefined)')} } diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/observed-track/observed-jsonrename.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/observed-track/observed-jsonrename.test.ts index ce55069e0f757221fd12d01197ecb6356e5e6814..85e385f51e4398fbf71d6341639b875b3b3c1ab7 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/observed-track/observed-jsonrename.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/observed-track/observed-jsonrename.test.ts @@ -65,7 +65,7 @@ function main() {} -@Retention({policy:"SOURCE"}) @interface TestDecor {} +@Retention({policy:"SOURCE"}) export declare @interface TestDecor {} @Observed() class testJsonRename implements IObservedObject, ISubscribedWatches { @JSONStringifyIgnore() private subscribedWatches: ISubscribedWatches = STATE_MGMT_FACTORY.makeSubscribedWatches(); diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/observed-track/observed-jsonstringifyignore.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/observed-track/observed-jsonstringifyignore.test.ts index 9c398f8afe6f949253860e81c0812c9a3b762d46..aac6e7711d97b689cc928477837d351650655272 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/observed-track/observed-jsonstringifyignore.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/observed-track/observed-jsonstringifyignore.test.ts @@ -65,7 +65,7 @@ function main() {} -@Retention({policy:"SOURCE"}) @interface TestDecor {} +@Retention({policy:"SOURCE"}) export declare @interface TestDecor {} @Observed() class testJSONStringifyIgnore implements IObservedObject, ISubscribedWatches { @JSONStringifyIgnore() private subscribedWatches: ISubscribedWatches = STATE_MGMT_FACTORY.makeSubscribedWatches(); diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/observed-track/observed-track-implements.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/observed-track/observed-track-implements.test.ts index 067c357e0637dee7341febcef4c428397b74fbf9..3de8b7d9c225c5c60c56cb011958df71ba501bbd 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/observed-track/observed-track-implements.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/observed-track/observed-track-implements.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpAnnotation, dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -66,16 +67,12 @@ function main() {} interface PropInterface { - set propF(propF: number) - - get propF(): number + ${dumpGetterSetter(GetSetDumper.BOTH, 'propF', 'number')} } interface trackInterface { - set trackF(trackF: number) - - get trackF(): number + ${dumpGetterSetter(GetSetDumper.BOTH, 'trackF', 'number')} } @@ -114,7 +111,12 @@ interface trackInterface { public constructor() {} - set propF(newValue: number) { + public get propF(): number { + this.conditionalAddRef(this.__meta); + return this.__backing_propF; + } + + public set propF(newValue: number) { if (((this.__backing_propF) !== (newValue))) { this.__backing_propF = newValue; this.__meta.fireChange(); @@ -122,12 +124,12 @@ interface trackInterface { } } - public get propF(): number { + public get trackF(): number { this.conditionalAddRef(this.__meta); - return this.__backing_propF; + return this.__backing_trackF; } - set trackF(newValue: number) { + public set trackF(newValue: number) { if (((this.__backing_trackF) !== (newValue))) { this.__backing_trackF = newValue; this.__meta.fireChange(); @@ -135,11 +137,6 @@ interface trackInterface { } } - public get trackF(): number { - this.conditionalAddRef(this.__meta); - return this.__backing_trackF; - } - } @Component() final struct MyStateSample extends CustomComponent { diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/observedv2-trace/observed-serialization.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/observedv2-trace/observed-serialization.test.ts index f4091bd26deec6b5a3c0f824c6baf57c4f85234e..fc032f3a04411d39764c5df4518ce5b5420eebbc 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/observedv2-trace/observed-serialization.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/observedv2-trace/observed-serialization.test.ts @@ -56,7 +56,7 @@ import { ObservedV2 as ObservedV2, Trace as Trace } from "@ohos.arkui.stateManag function main() {} -@Retention({policy:"SOURCE"}) @interface TestDecor {} +@Retention({policy:"SOURCE"}) export declare @interface TestDecor {} @ObservedV2() class testJSONStringifyIgnore implements IObservedObject, ISubscribedWatches { @JSONStringifyIgnore() private subscribedWatches: ISubscribedWatches = STATE_MGMT_FACTORY.makeSubscribedWatches(); diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/observedv2-trace/observedv2-trace-implements.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/observedv2-trace/observedv2-trace-implements.test.ts index c1e2137ce9dac034dcbd9cead570c543c126880c..c1fa0d4ec05d6afc9d01e9ae1ecf16fa5edcce9b 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/observedv2-trace/observedv2-trace-implements.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/observedv2-trace/observedv2-trace-implements.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -57,16 +58,12 @@ import { ObservedV2 as ObservedV2, Trace as Trace } from "@ohos.arkui.stateManag function main() {} interface PropInterface { - set propF(propF: number) - - get propF(): number + ${dumpGetterSetter(GetSetDumper.BOTH, 'propF', 'number')} } interface trackInterface { - set trackF(trackF: number) - - get trackF(): number + ${dumpGetterSetter(GetSetDumper.BOTH, 'trackF', 'number')} } @@ -100,8 +97,13 @@ interface trackInterface { @JSONStringifyIgnore() private __meta_propF: IMutableStateMeta = STATE_MGMT_FACTORY.makeMutableStateMeta(); private _$property$_trackF: number = 2; - - set propF(newValue: number) { + + public get propF(): number { + this.conditionalAddRef(this.__meta_propF); + return UIUtils.makeObserved(this.__backing_propF); + } + + public set propF(newValue: number) { if (((this.__backing_propF) !== (newValue))) { this.__backing_propF = newValue; this.__meta_propF.fireChange(); @@ -109,20 +111,15 @@ interface trackInterface { } } - public get propF(): number { - this.conditionalAddRef(this.__meta_propF); - return UIUtils.makeObserved(this.__backing_propF); + public get trackF(): number { + return this._$property$_trackF; } - - set trackF(_$property$_trackF: number) { + + public set trackF(_$property$_trackF: number) { this._$property$_trackF = _$property$_trackF; return; } - public get trackF(): number { - return this._$property$_trackF; - } - public get bb(): boolean { this.conditionalAddRef(this.__meta_bb); return UIUtils.makeObserved((this.__backing_bb as boolean)); diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/once/once-basic-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/once/once-basic-type.test.ts index 7d64b281da57ed667d6fb61d186a3c0b7f2510d1..b1ccd85686ba119e68c6a281d87cae6d0fec7674 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/once/once-basic-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/once/once-basic-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpAnnotation, dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -125,51 +126,25 @@ function main() {} } @ComponentV2() export interface __Options_Parent { - set onceVar1(onceVar1: (string | undefined)) - - get onceVar1(): (string | undefined) - @Param() set __backing_onceVar1(__backing_onceVar1: (IParamOnceDecoratedVariable | undefined)) - - @Param() get __backing_onceVar1(): (IParamOnceDecoratedVariable | undefined) - set __options_has_onceVar1(__options_has_onceVar1: (boolean | undefined)) - - get __options_has_onceVar1(): (boolean | undefined) - set onceVar2(onceVar2: (number | undefined)) - - get onceVar2(): (number | undefined) - @Param() set __backing_onceVar2(__backing_onceVar2: (IParamOnceDecoratedVariable | undefined)) - - @Param() get __backing_onceVar2(): (IParamOnceDecoratedVariable | undefined) - set __options_has_onceVar2(__options_has_onceVar2: (boolean | undefined)) - - get __options_has_onceVar2(): (boolean | undefined) - set onceVar3(onceVar3: (boolean | undefined)) - - get onceVar3(): (boolean | undefined) - @Param() set __backing_onceVar3(__backing_onceVar3: (IParamOnceDecoratedVariable | undefined)) - - @Param() get __backing_onceVar3(): (IParamOnceDecoratedVariable | undefined) - set __options_has_onceVar3(__options_has_onceVar3: (boolean | undefined)) - - get __options_has_onceVar3(): (boolean | undefined) - set onceVar4(onceVar4: (undefined | undefined)) - - get onceVar4(): (undefined | undefined) - @Param() set __backing_onceVar4(__backing_onceVar4: (IParamOnceDecoratedVariable | undefined)) - - @Param() get __backing_onceVar4(): (IParamOnceDecoratedVariable | undefined) - set __options_has_onceVar4(__options_has_onceVar4: (boolean | undefined)) - - get __options_has_onceVar4(): (boolean | undefined) - set onceVar5(onceVar5: (null | undefined)) - - get onceVar5(): (null | undefined) - @Param() set __backing_onceVar5(__backing_onceVar5: (IParamOnceDecoratedVariable | undefined)) - - @Param() get __backing_onceVar5(): (IParamOnceDecoratedVariable | undefined) - set __options_has_onceVar5(__options_has_onceVar5: (boolean | undefined)) - - get __options_has_onceVar5(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'onceVar1', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_onceVar1', '(IParamOnceDecoratedVariable | undefined)', [dumpAnnotation('Param')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_onceVar1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'onceVar2', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_onceVar2', '(IParamOnceDecoratedVariable | undefined)', [dumpAnnotation('Param')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_onceVar2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'onceVar3', '(boolean | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_onceVar3', '(IParamOnceDecoratedVariable | undefined)', [dumpAnnotation('Param')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_onceVar3', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'onceVar4', '(undefined | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_onceVar4', '(IParamOnceDecoratedVariable | undefined)', [dumpAnnotation('Param')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_onceVar4', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'onceVar5', '(null | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_onceVar5', '(IParamOnceDecoratedVariable | undefined)', [dumpAnnotation('Param')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_onceVar5', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/once/once-complex-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/once/once-complex-type.test.ts index b55accd91e3b4737a3fc77d316f00b16b9d6ff31..f2f5bccfa1872d6cdc239bbec8793e9674d35dd3 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/once/once-complex-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/once/once-complex-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpAnnotation, dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -286,114 +287,53 @@ final class StateType extends BaseEnum { } @ComponentV2() export interface __Options_Parent { - set onceVar1(onceVar1: (Per | undefined)) - - get onceVar1(): (Per | undefined) - @Param() set __backing_onceVar1(__backing_onceVar1: (IParamOnceDecoratedVariable | undefined)) - - @Param() get __backing_onceVar1(): (IParamOnceDecoratedVariable | undefined) - set __options_has_onceVar1(__options_has_onceVar1: (boolean | undefined)) - - get __options_has_onceVar1(): (boolean | undefined) - set onceVar2(onceVar2: (Array | undefined)) - - get onceVar2(): (Array | undefined) - @Param() set __backing_onceVar2(__backing_onceVar2: (IParamOnceDecoratedVariable> | undefined)) - - @Param() get __backing_onceVar2(): (IParamOnceDecoratedVariable> | undefined) - set __options_has_onceVar2(__options_has_onceVar2: (boolean | undefined)) - - get __options_has_onceVar2(): (boolean | undefined) - set onceVar3(onceVar3: (StateType | undefined)) - - get onceVar3(): (StateType | undefined) - @Param() set __backing_onceVar3(__backing_onceVar3: (IParamOnceDecoratedVariable | undefined)) - - @Param() get __backing_onceVar3(): (IParamOnceDecoratedVariable | undefined) - set __options_has_onceVar3(__options_has_onceVar3: (boolean | undefined)) - - get __options_has_onceVar3(): (boolean | undefined) - set onceVar4(onceVar4: (Set | undefined)) - - get onceVar4(): (Set | undefined) - @Param() set __backing_onceVar4(__backing_onceVar4: (IParamOnceDecoratedVariable> | undefined)) - - @Param() get __backing_onceVar4(): (IParamOnceDecoratedVariable> | undefined) - set __options_has_onceVar4(__options_has_onceVar4: (boolean | undefined)) - - get __options_has_onceVar4(): (boolean | undefined) - set onceVar5(onceVar5: (Array | undefined)) - - get onceVar5(): (Array | undefined) - @Param() set __backing_onceVar5(__backing_onceVar5: (IParamOnceDecoratedVariable> | undefined)) - - @Param() get __backing_onceVar5(): (IParamOnceDecoratedVariable> | undefined) - set __options_has_onceVar5(__options_has_onceVar5: (boolean | undefined)) - - get __options_has_onceVar5(): (boolean | undefined) - set onceVar6(onceVar6: (Array | undefined)) - - get onceVar6(): (Array | undefined) - @Param() set __backing_onceVar6(__backing_onceVar6: (IParamOnceDecoratedVariable> | undefined)) - - @Param() get __backing_onceVar6(): (IParamOnceDecoratedVariable> | undefined) - set __options_has_onceVar6(__options_has_onceVar6: (boolean | undefined)) - - get __options_has_onceVar6(): (boolean | undefined) - set onceVar7(onceVar7: (Array | undefined)) - - get onceVar7(): (Array | undefined) - @Param() set __backing_onceVar7(__backing_onceVar7: (IParamOnceDecoratedVariable> | undefined)) - - @Param() get __backing_onceVar7(): (IParamOnceDecoratedVariable> | undefined) - set __options_has_onceVar7(__options_has_onceVar7: (boolean | undefined)) - - get __options_has_onceVar7(): (boolean | undefined) - set onceVar8(onceVar8: (((sr: string)=> void) | undefined)) - - get onceVar8(): (((sr: string)=> void) | undefined) - @Param() set __backing_onceVar8(__backing_onceVar8: (IParamOnceDecoratedVariable<((sr: string)=> void)> | undefined)) - - @Param() get __backing_onceVar8(): (IParamOnceDecoratedVariable<((sr: string)=> void)> | undefined) - set __options_has_onceVar8(__options_has_onceVar8: (boolean | undefined)) - - get __options_has_onceVar8(): (boolean | undefined) - set onceVar9(onceVar9: (Date | undefined)) - - get onceVar9(): (Date | undefined) - @Param() set __backing_onceVar9(__backing_onceVar9: (IParamOnceDecoratedVariable | undefined)) - - @Param() get __backing_onceVar9(): (IParamOnceDecoratedVariable | undefined) - set __options_has_onceVar9(__options_has_onceVar9: (boolean | undefined)) - - get __options_has_onceVar9(): (boolean | undefined) - set onceVar10(onceVar10: (Map | undefined)) - - get onceVar10(): (Map | undefined) - @Param() set __backing_onceVar10(__backing_onceVar10: (IParamOnceDecoratedVariable> | undefined)) - - @Param() get __backing_onceVar10(): (IParamOnceDecoratedVariable> | undefined) - set __options_has_onceVar10(__options_has_onceVar10: (boolean | undefined)) - - get __options_has_onceVar10(): (boolean | undefined) - set onceVar11(onceVar11: ((string | number) | undefined)) - - get onceVar11(): ((string | number) | undefined) - @Param() set __backing_onceVar11(__backing_onceVar11: (IParamOnceDecoratedVariable<(string | number)> | undefined)) - - @Param() get __backing_onceVar11(): (IParamOnceDecoratedVariable<(string | number)> | undefined) - set __options_has_onceVar11(__options_has_onceVar11: (boolean | undefined)) - - get __options_has_onceVar11(): (boolean | undefined) - set onceVar12(onceVar12: ((Set | Per) | undefined)) - - get onceVar12(): ((Set | Per) | undefined) - @Param() set __backing_onceVar12(__backing_onceVar12: (IParamOnceDecoratedVariable<(Set | Per)> | undefined)) - - @Param() get __backing_onceVar12(): (IParamOnceDecoratedVariable<(Set | Per)> | undefined) - set __options_has_onceVar12(__options_has_onceVar12: (boolean | undefined)) - - get __options_has_onceVar12(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'onceVar1', '(Per | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_onceVar1', '(IParamOnceDecoratedVariable | undefined)', [dumpAnnotation('Param')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_onceVar1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'onceVar2', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_onceVar2', '(IParamOnceDecoratedVariable> | undefined)', [dumpAnnotation('Param')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_onceVar2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'onceVar3', '(StateType | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_onceVar3', '(IParamOnceDecoratedVariable | undefined)', [dumpAnnotation('Param')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_onceVar3', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'onceVar4', '(Set | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_onceVar4', '(IParamOnceDecoratedVariable> | undefined)', [dumpAnnotation('Param')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_onceVar4', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'onceVar5', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_onceVar5', '(IParamOnceDecoratedVariable> | undefined)', [dumpAnnotation('Param')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_onceVar5', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'onceVar6', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_onceVar6', '(IParamOnceDecoratedVariable> | undefined)', [dumpAnnotation('Param')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_onceVar6', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'onceVar7', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_onceVar7', '(IParamOnceDecoratedVariable> | undefined)', [dumpAnnotation('Param')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_onceVar7', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'onceVar8', '(((sr: string)=> void) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_onceVar8', '(IParamOnceDecoratedVariable<((sr: string)=> void)> | undefined)', [dumpAnnotation('Param')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_onceVar8', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'onceVar9', '(Date | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_onceVar9', '(IParamOnceDecoratedVariable | undefined)', [dumpAnnotation('Param')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_onceVar9', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'onceVar10', '(Map | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_onceVar10', '(IParamOnceDecoratedVariable> | undefined)', [dumpAnnotation('Param')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_onceVar10', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'onceVar11', '((string | number) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_onceVar11', '(IParamOnceDecoratedVariable<(string | number)> | undefined)', [dumpAnnotation('Param')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_onceVar11', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'onceVar12', '((Set | Per) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_onceVar12', '(IParamOnceDecoratedVariable<(Set | Per)> | undefined)', [dumpAnnotation('Param')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_onceVar12', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/once/once-only.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/once/once-only.test.ts index a4b807d9a663197f9bb079f25423728223bc4832..f680ddba764e5dc6df34e29a1dfa2ad681658f20 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/once/once-only.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/once/once-only.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -84,24 +85,13 @@ function main() {} } @ComponentV2() export interface __Options_Child { - set onceParamNum(onceParamNum: (number | undefined)) - - get onceParamNum(): (number | undefined) - set __backing_onceParamNum(__backing_onceParamNum: (IParamOnceDecoratedVariable | undefined)) - - get __backing_onceParamNum(): (IParamOnceDecoratedVariable | undefined) - set __options_has_onceParamNum(__options_has_onceParamNum: (boolean | undefined)) - - get __options_has_onceParamNum(): (boolean | undefined) - set onceVar4(onceVar4: (Set | undefined)) - - get onceVar4(): (Set | undefined) - set __backing_onceVar4(__backing_onceVar4: (IParamOnceDecoratedVariable> | undefined)) - - get __backing_onceVar4(): (IParamOnceDecoratedVariable> | undefined) - set __options_has_onceVar4(__options_has_onceVar4: (boolean | undefined)) - - get __options_has_onceVar4(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'onceParamNum', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_onceParamNum', '(IParamOnceDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_onceParamNum', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'onceVar4', '(Set | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_onceVar4', '(IParamOnceDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_onceVar4', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/once/once-with-require.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/once/once-with-require.test.ts index 1663ec2e2e99ad636c6bb9a3c9808121a3b56396..203323503d1e0fbb3522b68f2c5825e26293f93e 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/once/once-with-require.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/once/once-with-require.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpAnnotation, dumpGetterSetter, GetSetDumper, ignoreNewLines } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -91,22 +92,26 @@ import { Param as Param, Once as Once, ObservedV2 as ObservedV2, Trace as Trace, } @ComponentV2() export interface __Options_Child { + ${ignoreNewLines(` onceParamNum?: number; @Param() @Once() __backing_onceParamNum?: number; __options_has_onceParamNum?: boolean; onceParamInfo?: Info; @Param() @Once() @Require() __backing_onceParamInfo?: Info; __options_has_onceParamInfo?: boolean; + `)} } @ComponentV2() export interface __Options_Index { + ${ignoreNewLines(` localNum?: number; @Local() __backing_localNum?: number; __options_has_localNum?: boolean; localInfo?: Info; @Local() __backing_localInfo?: Info; __options_has_localInfo?: boolean; + `)} } `; @@ -308,46 +313,24 @@ function main() {} } @ComponentV2() export interface __Options_Child { - set onceParamNum(onceParamNum: (number | undefined)) - - get onceParamNum(): (number | undefined) - @Param() set __backing_onceParamNum(__backing_onceParamNum: (IParamOnceDecoratedVariable | undefined)) - - @Param() get __backing_onceParamNum(): (IParamOnceDecoratedVariable | undefined) - set __options_has_onceParamNum(__options_has_onceParamNum: (boolean | undefined)) - - get __options_has_onceParamNum(): (boolean | undefined) - set onceParamInfo(onceParamInfo: (Info | undefined)) - - get onceParamInfo(): (Info | undefined) - @Param() @Require() set __backing_onceParamInfo(__backing_onceParamInfo: (IParamOnceDecoratedVariable | undefined)) - - @Param() @Require() get __backing_onceParamInfo(): (IParamOnceDecoratedVariable | undefined) - set __options_has_onceParamInfo(__options_has_onceParamInfo: (boolean | undefined)) - - get __options_has_onceParamInfo(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'onceParamNum', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_onceParamNum', '(IParamOnceDecoratedVariable | undefined)', [dumpAnnotation('Param')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_onceParamNum', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'onceParamInfo', '(Info | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_onceParamInfo', '(IParamOnceDecoratedVariable | undefined)', [dumpAnnotation('Param'), dumpAnnotation('Require')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_onceParamInfo', '(boolean | undefined)')} } @ComponentV2() export interface __Options_Index { - set localNum(localNum: (number | undefined)) - - get localNum(): (number | undefined) - set __backing_localNum(__backing_localNum: (ILocalDecoratedVariable | undefined)) - - get __backing_localNum(): (ILocalDecoratedVariable | undefined) - set __options_has_localNum(__options_has_localNum: (boolean | undefined)) - - get __options_has_localNum(): (boolean | undefined) - set localInfo(localInfo: (Info | undefined)) - - get localInfo(): (Info | undefined) - set __backing_localInfo(__backing_localInfo: (ILocalDecoratedVariable | undefined)) - - get __backing_localInfo(): (ILocalDecoratedVariable | undefined) - set __options_has_localInfo(__options_has_localInfo: (boolean | undefined)) - - get __options_has_localInfo(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'localNum', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_localNum', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_localNum', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'localInfo', '(Info | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_localInfo', '(ILocalDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_localInfo', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/param/param-basic-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/param/param-basic-type.test.ts index bc80b1e39545f7b9e6a04bb8f77ad08058fe623a..24830ae307227d67ec970983fd823307e7602fc8 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/param/param-basic-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/param/param-basic-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -126,51 +127,25 @@ function main() {} } @ComponentV2() export interface __Options_Parent { - set paramVar1(paramVar1: (string | undefined)) - - get paramVar1(): (string | undefined) - set __backing_paramVar1(__backing_paramVar1: (IParamDecoratedVariable | undefined)) - - get __backing_paramVar1(): (IParamDecoratedVariable | undefined) - set __options_has_paramVar1(__options_has_paramVar1: (boolean | undefined)) - - get __options_has_paramVar1(): (boolean | undefined) - set paramVar2(paramVar2: (number | undefined)) - - get paramVar2(): (number | undefined) - set __backing_paramVar2(__backing_paramVar2: (IParamDecoratedVariable | undefined)) - - get __backing_paramVar2(): (IParamDecoratedVariable | undefined) - set __options_has_paramVar2(__options_has_paramVar2: (boolean | undefined)) - - get __options_has_paramVar2(): (boolean | undefined) - set paramVar3(paramVar3: (boolean | undefined)) - - get paramVar3(): (boolean | undefined) - set __backing_paramVar3(__backing_paramVar3: (IParamDecoratedVariable | undefined)) - - get __backing_paramVar3(): (IParamDecoratedVariable | undefined) - set __options_has_paramVar3(__options_has_paramVar3: (boolean | undefined)) - - get __options_has_paramVar3(): (boolean | undefined) - set paramVar4(paramVar4: (undefined | undefined)) - - get paramVar4(): (undefined | undefined) - set __backing_paramVar4(__backing_paramVar4: (IParamDecoratedVariable | undefined)) - - get __backing_paramVar4(): (IParamDecoratedVariable | undefined) - set __options_has_paramVar4(__options_has_paramVar4: (boolean | undefined)) - - get __options_has_paramVar4(): (boolean | undefined) - set paramVar5(paramVar5: (null | undefined)) - - get paramVar5(): (null | undefined) - set __backing_paramVar5(__backing_paramVar5: (IParamDecoratedVariable | undefined)) - - get __backing_paramVar5(): (IParamDecoratedVariable | undefined) - set __options_has_paramVar5(__options_has_paramVar5: (boolean | undefined)) - - get __options_has_paramVar5(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar1', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar1', '(IParamDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar2', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar2', '(IParamDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar3', '(boolean | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar3', '(IParamDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar3', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar4', '(undefined | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar4', '(IParamDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar4', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar5', '(null | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar5', '(IParamDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar5', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/param/param-complex-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/param/param-complex-type.test.ts index 8bb1816401c1fce6a9eccfb007fc00622eb82fba..dbbe30a5639b485334b0fbd4237012d83ad45229 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/param/param-complex-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/param/param-complex-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -287,114 +288,53 @@ final class StateType extends BaseEnum { } @ComponentV2() export interface __Options_Parent { - set paramVar1(paramVar1: (Per | undefined)) - - get paramVar1(): (Per | undefined) - set __backing_paramVar1(__backing_paramVar1: (IParamDecoratedVariable | undefined)) - - get __backing_paramVar1(): (IParamDecoratedVariable | undefined) - set __options_has_paramVar1(__options_has_paramVar1: (boolean | undefined)) - - get __options_has_paramVar1(): (boolean | undefined) - set paramVar2(paramVar2: (Array | undefined)) - - get paramVar2(): (Array | undefined) - set __backing_paramVar2(__backing_paramVar2: (IParamDecoratedVariable> | undefined)) - - get __backing_paramVar2(): (IParamDecoratedVariable> | undefined) - set __options_has_paramVar2(__options_has_paramVar2: (boolean | undefined)) - - get __options_has_paramVar2(): (boolean | undefined) - set paramVar3(paramVar3: (StateType | undefined)) - - get paramVar3(): (StateType | undefined) - set __backing_paramVar3(__backing_paramVar3: (IParamDecoratedVariable | undefined)) - - get __backing_paramVar3(): (IParamDecoratedVariable | undefined) - set __options_has_paramVar3(__options_has_paramVar3: (boolean | undefined)) - - get __options_has_paramVar3(): (boolean | undefined) - set paramVar4(paramVar4: (Set | undefined)) - - get paramVar4(): (Set | undefined) - set __backing_paramVar4(__backing_paramVar4: (IParamDecoratedVariable> | undefined)) - - get __backing_paramVar4(): (IParamDecoratedVariable> | undefined) - set __options_has_paramVar4(__options_has_paramVar4: (boolean | undefined)) - - get __options_has_paramVar4(): (boolean | undefined) - set paramVar5(paramVar5: (Array | undefined)) - - get paramVar5(): (Array | undefined) - set __backing_paramVar5(__backing_paramVar5: (IParamDecoratedVariable> | undefined)) - - get __backing_paramVar5(): (IParamDecoratedVariable> | undefined) - set __options_has_paramVar5(__options_has_paramVar5: (boolean | undefined)) - - get __options_has_paramVar5(): (boolean | undefined) - set paramVar6(paramVar6: (Array | undefined)) - - get paramVar6(): (Array | undefined) - set __backing_paramVar6(__backing_paramVar6: (IParamDecoratedVariable> | undefined)) - - get __backing_paramVar6(): (IParamDecoratedVariable> | undefined) - set __options_has_paramVar6(__options_has_paramVar6: (boolean | undefined)) - - get __options_has_paramVar6(): (boolean | undefined) - set paramVar7(paramVar7: (Array | undefined)) - - get paramVar7(): (Array | undefined) - set __backing_paramVar7(__backing_paramVar7: (IParamDecoratedVariable> | undefined)) - - get __backing_paramVar7(): (IParamDecoratedVariable> | undefined) - set __options_has_paramVar7(__options_has_paramVar7: (boolean | undefined)) - - get __options_has_paramVar7(): (boolean | undefined) - set paramVar8(paramVar8: (((sr: string)=> void) | undefined)) - - get paramVar8(): (((sr: string)=> void) | undefined) - set __backing_paramVar8(__backing_paramVar8: (IParamDecoratedVariable<((sr: string)=> void)> | undefined)) - - get __backing_paramVar8(): (IParamDecoratedVariable<((sr: string)=> void)> | undefined) - set __options_has_paramVar8(__options_has_paramVar8: (boolean | undefined)) - - get __options_has_paramVar8(): (boolean | undefined) - set paramVar9(paramVar9: (Date | undefined)) - - get paramVar9(): (Date | undefined) - set __backing_paramVar9(__backing_paramVar9: (IParamDecoratedVariable | undefined)) - - get __backing_paramVar9(): (IParamDecoratedVariable | undefined) - set __options_has_paramVar9(__options_has_paramVar9: (boolean | undefined)) - - get __options_has_paramVar9(): (boolean | undefined) - set paramVar10(paramVar10: (Map | undefined)) - - get paramVar10(): (Map | undefined) - set __backing_paramVar10(__backing_paramVar10: (IParamDecoratedVariable> | undefined)) - - get __backing_paramVar10(): (IParamDecoratedVariable> | undefined) - set __options_has_paramVar10(__options_has_paramVar10: (boolean | undefined)) - - get __options_has_paramVar10(): (boolean | undefined) - set paramVar11(paramVar11: ((string | number) | undefined)) - - get paramVar11(): ((string | number) | undefined) - set __backing_paramVar11(__backing_paramVar11: (IParamDecoratedVariable<(string | number)> | undefined)) - - get __backing_paramVar11(): (IParamDecoratedVariable<(string | number)> | undefined) - set __options_has_paramVar11(__options_has_paramVar11: (boolean | undefined)) - - get __options_has_paramVar11(): (boolean | undefined) - set paramVar12(paramVar12: ((Set | Per) | undefined)) - - get paramVar12(): ((Set | Per) | undefined) - set __backing_paramVar12(__backing_paramVar12: (IParamDecoratedVariable<(Set | Per)> | undefined)) - - get __backing_paramVar12(): (IParamDecoratedVariable<(Set | Per)> | undefined) - set __options_has_paramVar12(__options_has_paramVar12: (boolean | undefined)) - - get __options_has_paramVar12(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar1', '(Per | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar1', '(IParamDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar2', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar2', '(IParamDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar3', '(StateType | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar3', '(IParamDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar3', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar4', '(Set | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar4', '(IParamDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar4', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar5', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar5', '(IParamDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar5', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar6', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar6', '(IParamDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar6', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar7', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar7', '(IParamDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar7', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar8', '(((sr: string)=> void) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar8', '(IParamDecoratedVariable<((sr: string)=> void)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar8', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar9', '(Date | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar9', '(IParamDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar9', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar10', '(Map | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar10', '(IParamDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar10', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar11', '((string | number) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar11', '(IParamDecoratedVariable<(string | number)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar11', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar12', '((Set | Per) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar12', '(IParamDecoratedVariable<(Set | Per)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar12', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/param/param-with-require.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/param/param-with-require.test.ts index 76197b2c0ad11290daf4283d46e20a3b4a791de5..4290f85d4f2bfd8627c31de2b1747ac2f24928b1 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/param/param-with-require.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/param/param-with-require.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpAnnotation, dumpGetterSetter, GetSetDumper, ignoreNewLines } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -124,23 +125,29 @@ class Info { } @ComponentV2() export interface __Options_Index { + ${ignoreNewLines(` infoList?: Info[]; @Local() __backing_infoList?: Info[]; __options_has_infoList?: boolean; + `)} } @ComponentV2() export interface __Options_MiddleComponent { + ${ignoreNewLines(` info?: Info; @Require() @Param() __backing_info?: Info; __options_has_info?: boolean; + `)} } @ComponentV2() export interface __Options_SubComponent { + ${ignoreNewLines(` region?: Region; @Require() @Param() __backing_region?: Region; __options_has_region?: boolean; + `)} } `; @@ -327,32 +334,23 @@ class Info { } @ComponentV2() export interface __Options_Index { - get infoList(): (Array | undefined) - set infoList(infoList: (Array | undefined)) - get __backing_infoList(): (ILocalDecoratedVariable> | undefined) - set __backing_infoList(__backing_infoList: (ILocalDecoratedVariable> | undefined)) - get __options_has_infoList(): (boolean | undefined) - set __options_has_infoList(__options_has_infoList: (boolean | undefined)) + ${dumpGetterSetter(GetSetDumper.BOTH, 'infoList', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_infoList', '(ILocalDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_infoList', '(boolean | undefined)')} } @ComponentV2() export interface __Options_MiddleComponent { - get info(): (Info | undefined) - set info(info: (Info | undefined)) - @Require() get __backing_info(): (IParamDecoratedVariable | undefined) - @Require() set __backing_info(__backing_info: (IParamDecoratedVariable | undefined)) - get __options_has_info(): (boolean | undefined) - set __options_has_info(__options_has_info: (boolean | undefined)) + ${dumpGetterSetter(GetSetDumper.BOTH, 'info', '(Info | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_info', '(IParamDecoratedVariable | undefined)', [dumpAnnotation('Require')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_info', '(boolean | undefined)')} } @ComponentV2() export interface __Options_SubComponent { - get region(): (Region | undefined) - set region(region: (Region | undefined)) - @Require() get __backing_region(): (IParamDecoratedVariable | undefined) - @Require() set __backing_region(__backing_region: (IParamDecoratedVariable | undefined)) - get __options_has_region(): (boolean | undefined) - set __options_has_region(__options_has_region: (boolean | undefined)) + ${dumpGetterSetter(GetSetDumper.BOTH, 'region', '(Region | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_region', '(IParamDecoratedVariable | undefined)', [dumpAnnotation('Require')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_region', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/prop-ref/prop-ref-basic-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/prop-ref/prop-ref-basic-type.test.ts index b4f07a481602ad0fd263dfc15307717ece8ec20f..fff7c8bd39c86532c6c05632418f9270a4d2869d 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/prop-ref/prop-ref-basic-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/prop-ref/prop-ref-basic-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { structNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -148,52 +149,26 @@ function main() {} } @Component() export interface __Options_PropParent { - set propVar1(propVar1: (string | undefined)) - - get propVar1(): (string | undefined) - set __backing_propVar1(__backing_propVar1: (IPropRefDecoratedVariable | undefined)) - - get __backing_propVar1(): (IPropRefDecoratedVariable | undefined) - set __options_has_propVar1(__options_has_propVar1: (boolean | undefined)) - - get __options_has_propVar1(): (boolean | undefined) - set propVar2(propVar2: (number | undefined)) - - get propVar2(): (number | undefined) - set __backing_propVar2(__backing_propVar2: (IPropRefDecoratedVariable | undefined)) - - get __backing_propVar2(): (IPropRefDecoratedVariable | undefined) - set __options_has_propVar2(__options_has_propVar2: (boolean | undefined)) - - get __options_has_propVar2(): (boolean | undefined) - set propVar3(propVar3: (boolean | undefined)) - - get propVar3(): (boolean | undefined) - set __backing_propVar3(__backing_propVar3: (IPropRefDecoratedVariable | undefined)) - - get __backing_propVar3(): (IPropRefDecoratedVariable | undefined) - set __options_has_propVar3(__options_has_propVar3: (boolean | undefined)) - - get __options_has_propVar3(): (boolean | undefined) - set propVar4(propVar4: (undefined | undefined)) - - get propVar4(): (undefined | undefined) - set __backing_propVar4(__backing_propVar4: (IPropRefDecoratedVariable | undefined)) - - get __backing_propVar4(): (IPropRefDecoratedVariable | undefined) - set __options_has_propVar4(__options_has_propVar4: (boolean | undefined)) - - get __options_has_propVar4(): (boolean | undefined) - set propVar5(propVar5: (null | undefined)) - - get propVar5(): (null | undefined) - set __backing_propVar5(__backing_propVar5: (IPropRefDecoratedVariable | undefined)) - - get __backing_propVar5(): (IPropRefDecoratedVariable | undefined) - set __options_has_propVar5(__options_has_propVar5: (boolean | undefined)) - - get __options_has_propVar5(): (boolean | undefined) - + ${dumpGetterSetter(GetSetDumper.BOTH, 'propVar1', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_propVar1', '(IPropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_propVar1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'propVar2', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_propVar2', '(IPropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_propVar2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'propVar3', '(boolean | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_propVar3', '(IPropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_propVar3', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'propVar4', '(undefined | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_propVar4', '(IPropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_propVar4', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'propVar5', '(null | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_propVar5', '(IPropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_propVar5', '(boolean | undefined)')} + } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/prop-ref/prop-ref-complex-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/prop-ref/prop-ref-complex-type.test.ts index 90dcb9280cf5300fb3ec4126cce3ba6c66df5415..c6e94460f38a8f12c52df13726a2471c6814fc09 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/prop-ref/prop-ref-complex-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/prop-ref/prop-ref-complex-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { structNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -335,114 +336,53 @@ final class PropType extends BaseEnum { } @Component() export interface __Options_Parent { - set propVar1(propVar1: (Per | undefined)) - - get propVar1(): (Per | undefined) - set __backing_propVar1(__backing_propVar1: (IPropRefDecoratedVariable | undefined)) - - get __backing_propVar1(): (IPropRefDecoratedVariable | undefined) - set __options_has_propVar1(__options_has_propVar1: (boolean | undefined)) - - get __options_has_propVar1(): (boolean | undefined) - set propVar2(propVar2: (Array | undefined)) - - get propVar2(): (Array | undefined) - set __backing_propVar2(__backing_propVar2: (IPropRefDecoratedVariable> | undefined)) - - get __backing_propVar2(): (IPropRefDecoratedVariable> | undefined) - set __options_has_propVar2(__options_has_propVar2: (boolean | undefined)) - - get __options_has_propVar2(): (boolean | undefined) - set propVar3(propVar3: (PropType | undefined)) - - get propVar3(): (PropType | undefined) - set __backing_propVar3(__backing_propVar3: (IPropRefDecoratedVariable | undefined)) - - get __backing_propVar3(): (IPropRefDecoratedVariable | undefined) - set __options_has_propVar3(__options_has_propVar3: (boolean | undefined)) - - get __options_has_propVar3(): (boolean | undefined) - set propVar4(propVar4: (Set | undefined)) - - get propVar4(): (Set | undefined) - set __backing_propVar4(__backing_propVar4: (IPropRefDecoratedVariable> | undefined)) - - get __backing_propVar4(): (IPropRefDecoratedVariable> | undefined) - set __options_has_propVar4(__options_has_propVar4: (boolean | undefined)) - - get __options_has_propVar4(): (boolean | undefined) - set propVar5(propVar5: (Array | undefined)) - - get propVar5(): (Array | undefined) - set __backing_propVar5(__backing_propVar5: (IPropRefDecoratedVariable> | undefined)) - - get __backing_propVar5(): (IPropRefDecoratedVariable> | undefined) - set __options_has_propVar5(__options_has_propVar5: (boolean | undefined)) - - get __options_has_propVar5(): (boolean | undefined) - set propVar6(propVar6: (Array | undefined)) - - get propVar6(): (Array | undefined) - set __backing_propVar6(__backing_propVar6: (IPropRefDecoratedVariable> | undefined)) - - get __backing_propVar6(): (IPropRefDecoratedVariable> | undefined) - set __options_has_propVar6(__options_has_propVar6: (boolean | undefined)) - - get __options_has_propVar6(): (boolean | undefined) - set propVar7(propVar7: (Array | undefined)) - - get propVar7(): (Array | undefined) - set __backing_propVar7(__backing_propVar7: (IPropRefDecoratedVariable> | undefined)) - - get __backing_propVar7(): (IPropRefDecoratedVariable> | undefined) - set __options_has_propVar7(__options_has_propVar7: (boolean | undefined)) - - get __options_has_propVar7(): (boolean | undefined) - set propVar8(propVar8: (((sr: string)=> void) | undefined)) - - get propVar8(): (((sr: string)=> void) | undefined) - set __backing_propVar8(__backing_propVar8: (IPropRefDecoratedVariable<((sr: string)=> void)> | undefined)) - - get __backing_propVar8(): (IPropRefDecoratedVariable<((sr: string)=> void)> | undefined) - set __options_has_propVar8(__options_has_propVar8: (boolean | undefined)) - - get __options_has_propVar8(): (boolean | undefined) - set propVar9(propVar9: (Date | undefined)) - - get propVar9(): (Date | undefined) - set __backing_propVar9(__backing_propVar9: (IPropRefDecoratedVariable | undefined)) - - get __backing_propVar9(): (IPropRefDecoratedVariable | undefined) - set __options_has_propVar9(__options_has_propVar9: (boolean | undefined)) - - get __options_has_propVar9(): (boolean | undefined) - set propVar10(propVar10: (Map | undefined)) - - get propVar10(): (Map | undefined) - set __backing_propVar10(__backing_propVar10: (IPropRefDecoratedVariable> | undefined)) - - get __backing_propVar10(): (IPropRefDecoratedVariable> | undefined) - set __options_has_propVar10(__options_has_propVar10: (boolean | undefined)) - - get __options_has_propVar10(): (boolean | undefined) - set propVar11(propVar11: ((string | number) | undefined)) - - get propVar11(): ((string | number) | undefined) - set __backing_propVar11(__backing_propVar11: (IPropRefDecoratedVariable<(string | number)> | undefined)) - - get __backing_propVar11(): (IPropRefDecoratedVariable<(string | number)> | undefined) - set __options_has_propVar11(__options_has_propVar11: (boolean | undefined)) - - get __options_has_propVar11(): (boolean | undefined) - set propVar12(propVar12: ((Set | Per) | undefined)) - - get propVar12(): ((Set | Per) | undefined) - set __backing_propVar12(__backing_propVar12: (IPropRefDecoratedVariable<(Set | Per)> | undefined)) - - get __backing_propVar12(): (IPropRefDecoratedVariable<(Set | Per)> | undefined) - set __options_has_propVar12(__options_has_propVar12: (boolean | undefined)) - - get __options_has_propVar12(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'propVar1', '(Per | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_propVar1', '(IPropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_propVar1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'propVar2', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_propVar2', '(IPropRefDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_propVar2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'propVar3', '(PropType | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_propVar3', '(IPropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_propVar3', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'propVar4', '(Set | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_propVar4', '(IPropRefDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_propVar4', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'propVar5', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_propVar5', '(IPropRefDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_propVar5', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'propVar6', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_propVar6', '(IPropRefDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_propVar6', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'propVar7', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_propVar7', '(IPropRefDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_propVar7', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'propVar8', '(((sr: string)=> void) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_propVar8', '(IPropRefDecoratedVariable<((sr: string)=> void)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_propVar8', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'propVar9', '(Date | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_propVar9', '(IPropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_propVar9', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'propVar10', '(Map | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_propVar10', '(IPropRefDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_propVar10', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'propVar11', '((string | number) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_propVar11', '(IPropRefDecoratedVariable<(string | number)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_propVar11', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'propVar12', '((Set | Per) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_propVar12', '(IPropRefDecoratedVariable<(Set | Per)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_propVar12', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/prop-ref/prop-ref-without-initialization.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/prop-ref/prop-ref-without-initialization.test.ts index abc92ef96d19b9b3b42dc14e09d8ed9e85565893..5a2ddf63101f05736f221485324eb10f502b2433 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/prop-ref/prop-ref-without-initialization.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/prop-ref/prop-ref-without-initialization.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { structNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper, ignoreNewLines } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -66,6 +67,7 @@ import { PropRef as PropRef } from "@ohos.arkui.stateManagement"; } @Component() export interface __Options_PropParent { + ${ignoreNewLines(` propVar1?: string; @PropRef() __backing_propVar1?: string; __options_has_propVar1?: boolean; @@ -87,6 +89,7 @@ import { PropRef as PropRef } from "@ohos.arkui.stateManagement"; propVar7?: (Map | undefined); @PropRef() __backing_propVar7?: (Map | undefined); __options_has_propVar7?: boolean; + `)} } `; @@ -225,69 +228,33 @@ function main() {} } @Component() export interface __Options_PropParent { - set propVar1(propVar1: (string | undefined)) - - get propVar1(): (string | undefined) - set __backing_propVar1(__backing_propVar1: (IPropRefDecoratedVariable | undefined)) - - get __backing_propVar1(): (IPropRefDecoratedVariable | undefined) - set __options_has_propVar1(__options_has_propVar1: (boolean | undefined)) - - get __options_has_propVar1(): (boolean | undefined) - set propVar2(propVar2: ((number | undefined) | undefined)) - - get propVar2(): ((number | undefined) | undefined) - set __backing_propVar2(__backing_propVar2: (IPropRefDecoratedVariable<(number | undefined)> | undefined)) - - get __backing_propVar2(): (IPropRefDecoratedVariable<(number | undefined)> | undefined) - set __options_has_propVar2(__options_has_propVar2: (boolean | undefined)) - - get __options_has_propVar2(): (boolean | undefined) - set propVar3(propVar3: (boolean | undefined)) - - get propVar3(): (boolean | undefined) - set __backing_propVar3(__backing_propVar3: (IPropRefDecoratedVariable | undefined)) - - get __backing_propVar3(): (IPropRefDecoratedVariable | undefined) - set __options_has_propVar3(__options_has_propVar3: (boolean | undefined)) - - get __options_has_propVar3(): (boolean | undefined) - set propVar4(propVar4: (undefined | undefined)) - - get propVar4(): (undefined | undefined) - set __backing_propVar4(__backing_propVar4: (IPropRefDecoratedVariable | undefined)) - - get __backing_propVar4(): (IPropRefDecoratedVariable | undefined) - set __options_has_propVar4(__options_has_propVar4: (boolean | undefined)) - - get __options_has_propVar4(): (boolean | undefined) - set propVar5(propVar5: (null | undefined)) - - get propVar5(): (null | undefined) - set __backing_propVar5(__backing_propVar5: (IPropRefDecoratedVariable | undefined)) - - get __backing_propVar5(): (IPropRefDecoratedVariable | undefined) - set __options_has_propVar5(__options_has_propVar5: (boolean | undefined)) - - get __options_has_propVar5(): (boolean | undefined) - set propVar6(propVar6: ((Array | null) | undefined)) - - get propVar6(): ((Array | null) | undefined) - set __backing_propVar6(__backing_propVar6: (IPropRefDecoratedVariable<(Array | null)> | undefined)) - - get __backing_propVar6(): (IPropRefDecoratedVariable<(Array | null)> | undefined) - set __options_has_propVar6(__options_has_propVar6: (boolean | undefined)) - - get __options_has_propVar6(): (boolean | undefined) - set propVar7(propVar7: ((Map | undefined) | undefined)) - - get propVar7(): ((Map | undefined) | undefined) - set __backing_propVar7(__backing_propVar7: (IPropRefDecoratedVariable<(Map | undefined)> | undefined)) - - get __backing_propVar7(): (IPropRefDecoratedVariable<(Map | undefined)> | undefined) - set __options_has_propVar7(__options_has_propVar7: (boolean | undefined)) - - get __options_has_propVar7(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'propVar1', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_propVar1', '(IPropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_propVar1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'propVar2', '((number | undefined) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_propVar2', '(IPropRefDecoratedVariable<(number | undefined)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_propVar2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'propVar3', '(boolean | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_propVar3', '(IPropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_propVar3', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'propVar4', '(undefined | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_propVar4', '(IPropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_propVar4', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'propVar5', '(null | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_propVar5', '(IPropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_propVar5', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'propVar6', '((Array | null) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_propVar6', '(IPropRefDecoratedVariable<(Array | null)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_propVar6', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'propVar7', '((Map | undefined) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_propVar7', '(IPropRefDecoratedVariable<(Map | undefined)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_propVar7', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/prop-ref/state-to-propref.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/prop-ref/state-to-propref.test.ts index fe1056f3043f53f444af8e6049695c8277eb2fb9..ef62b3d81e951f282870e9bbed5698c5392db2e5 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/prop-ref/state-to-propref.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/prop-ref/state-to-propref.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { uiNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -195,34 +196,19 @@ function main() {} } @Component() export interface __Options_CountDownComponent { - set count(count: (number | undefined)) - - get count(): (number | undefined) - set __backing_count(__backing_count: (IPropRefDecoratedVariable | undefined)) - - get __backing_count(): (IPropRefDecoratedVariable | undefined) - set __options_has_count(__options_has_count: (boolean | undefined)) - - get __options_has_count(): (boolean | undefined) - set costOfOneAttempt(costOfOneAttempt: (number | undefined)) - - get costOfOneAttempt(): (number | undefined) - set __options_has_costOfOneAttempt(__options_has_costOfOneAttempt: (boolean | undefined)) - - get __options_has_costOfOneAttempt(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'count', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_count', '(IPropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_count', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'costOfOneAttempt', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_costOfOneAttempt', '(boolean | undefined)')} } @Component() export interface __Options_ParentComponent { - set countDownStartValue(countDownStartValue: (number | undefined)) - - get countDownStartValue(): (number | undefined) - set __backing_countDownStartValue(__backing_countDownStartValue: (IStateDecoratedVariable | undefined)) - - get __backing_countDownStartValue(): (IStateDecoratedVariable | undefined) - set __options_has_countDownStartValue(__options_has_countDownStartValue: (boolean | undefined)) - - get __options_has_countDownStartValue(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'countDownStartValue', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_countDownStartValue', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_countDownStartValue', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/provide-and-consume/consume-basic-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/provide-and-consume/consume-basic-type.test.ts index 738828d241d128858f65636008aba108940ae240..acc89b07ad654ce34a53893f732f935fe7fa2fac 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/provide-and-consume/consume-basic-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/provide-and-consume/consume-basic-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { structNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper, ignoreNewLines } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -62,6 +63,7 @@ import { Consume as Consume } from "@ohos.arkui.stateManagement"; } @Component() export interface __Options_PropParent { + ${ignoreNewLines(` conVar1?: string; @Consume() __backing_conVar1?: string; __options_has_conVar1?: boolean; @@ -77,6 +79,7 @@ import { Consume as Consume } from "@ohos.arkui.stateManagement"; conVar5?: null; @Consume() __backing_conVar5?: null; __options_has_conVar5?: boolean; + `)} } `; @@ -166,51 +169,25 @@ function main() {} } @Component() export interface __Options_PropParent { - set conVar1(conVar1: (string | undefined)) - - get conVar1(): (string | undefined) - set __backing_conVar1(__backing_conVar1: (IConsumeDecoratedVariable | undefined)) - - get __backing_conVar1(): (IConsumeDecoratedVariable | undefined) - set __options_has_conVar1(__options_has_conVar1: (boolean | undefined)) - - get __options_has_conVar1(): (boolean | undefined) - set conVar2(conVar2: (number | undefined)) - - get conVar2(): (number | undefined) - set __backing_conVar2(__backing_conVar2: (IConsumeDecoratedVariable | undefined)) - - get __backing_conVar2(): (IConsumeDecoratedVariable | undefined) - set __options_has_conVar2(__options_has_conVar2: (boolean | undefined)) - - get __options_has_conVar2(): (boolean | undefined) - set conVar3(conVar3: (boolean | undefined)) - - get conVar3(): (boolean | undefined) - set __backing_conVar3(__backing_conVar3: (IConsumeDecoratedVariable | undefined)) - - get __backing_conVar3(): (IConsumeDecoratedVariable | undefined) - set __options_has_conVar3(__options_has_conVar3: (boolean | undefined)) - - get __options_has_conVar3(): (boolean | undefined) - set conVar4(conVar4: (undefined | undefined)) - - get conVar4(): (undefined | undefined) - set __backing_conVar4(__backing_conVar4: (IConsumeDecoratedVariable | undefined)) - - get __backing_conVar4(): (IConsumeDecoratedVariable | undefined) - set __options_has_conVar4(__options_has_conVar4: (boolean | undefined)) - - get __options_has_conVar4(): (boolean | undefined) - set conVar5(conVar5: (null | undefined)) - - get conVar5(): (null | undefined) - set __backing_conVar5(__backing_conVar5: (IConsumeDecoratedVariable | undefined)) - - get __backing_conVar5(): (IConsumeDecoratedVariable | undefined) - set __options_has_conVar5(__options_has_conVar5: (boolean | undefined)) - - get __options_has_conVar5(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'conVar1', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_conVar1', '(IConsumeDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_conVar1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'conVar2', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_conVar2', '(IConsumeDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_conVar2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'conVar3', '(boolean | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_conVar3', '(IConsumeDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_conVar3', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'conVar4', '(undefined | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_conVar4', '(IConsumeDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_conVar4', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'conVar5', '(null | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_conVar5', '(IConsumeDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_conVar5', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/provide-and-consume/consume-complex-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/provide-and-consume/consume-complex-type.test.ts index 64e085c6c5cfb12fbc6be8b4e1f738728f8eede9..caa55060c206adcfe6eeb10eed72527571f9394d 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/provide-and-consume/consume-complex-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/provide-and-consume/consume-complex-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { structNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper, ignoreNewLines } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -93,6 +94,7 @@ enum PropType { } @Component() export interface __Options_Parent { + ${ignoreNewLines(` conVar1?: Per; @Consume() __backing_conVar1?: Per; __options_has_conVar1?: boolean; @@ -132,6 +134,7 @@ enum PropType { conVar13?: (Set | null); @Consume() __backing_conVar13?: (Set | null); __options_has_conVar13?: boolean; + `)} } `; @@ -386,123 +389,57 @@ final class PropType extends BaseEnum { } @Component() export interface __Options_Parent { - set conVar1(conVar1: (Per | undefined)) - - get conVar1(): (Per | undefined) - set __backing_conVar1(__backing_conVar1: (IConsumeDecoratedVariable | undefined)) - - get __backing_conVar1(): (IConsumeDecoratedVariable | undefined) - set __options_has_conVar1(__options_has_conVar1: (boolean | undefined)) - - get __options_has_conVar1(): (boolean | undefined) - set conVar2(conVar2: (Array | undefined)) - - get conVar2(): (Array | undefined) - set __backing_conVar2(__backing_conVar2: (IConsumeDecoratedVariable> | undefined)) - - get __backing_conVar2(): (IConsumeDecoratedVariable> | undefined) - set __options_has_conVar2(__options_has_conVar2: (boolean | undefined)) - - get __options_has_conVar2(): (boolean | undefined) - set conVar3(conVar3: (PropType | undefined)) - - get conVar3(): (PropType | undefined) - set __backing_conVar3(__backing_conVar3: (IConsumeDecoratedVariable | undefined)) - - get __backing_conVar3(): (IConsumeDecoratedVariable | undefined) - set __options_has_conVar3(__options_has_conVar3: (boolean | undefined)) - - get __options_has_conVar3(): (boolean | undefined) - set conVar4(conVar4: (Set | undefined)) - - get conVar4(): (Set | undefined) - set __backing_conVar4(__backing_conVar4: (IConsumeDecoratedVariable> | undefined)) - - get __backing_conVar4(): (IConsumeDecoratedVariable> | undefined) - set __options_has_conVar4(__options_has_conVar4: (boolean | undefined)) - - get __options_has_conVar4(): (boolean | undefined) - set conVar5(conVar5: (Array | undefined)) - - get conVar5(): (Array | undefined) - set __backing_conVar5(__backing_conVar5: (IConsumeDecoratedVariable> | undefined)) - - get __backing_conVar5(): (IConsumeDecoratedVariable> | undefined) - set __options_has_conVar5(__options_has_conVar5: (boolean | undefined)) - - get __options_has_conVar5(): (boolean | undefined) - set conVar6(conVar6: (Array | undefined)) - - get conVar6(): (Array | undefined) - set __backing_conVar6(__backing_conVar6: (IConsumeDecoratedVariable> | undefined)) - - get __backing_conVar6(): (IConsumeDecoratedVariable> | undefined) - set __options_has_conVar6(__options_has_conVar6: (boolean | undefined)) - - get __options_has_conVar6(): (boolean | undefined) - set conVar7(conVar7: (Array | undefined)) - - get conVar7(): (Array | undefined) - set __backing_conVar7(__backing_conVar7: (IConsumeDecoratedVariable> | undefined)) - - get __backing_conVar7(): (IConsumeDecoratedVariable> | undefined) - set __options_has_conVar7(__options_has_conVar7: (boolean | undefined)) - - get __options_has_conVar7(): (boolean | undefined) - set conVar8(conVar8: (((sr: string)=> void) | undefined)) - - get conVar8(): (((sr: string)=> void) | undefined) - set __backing_conVar8(__backing_conVar8: (IConsumeDecoratedVariable<((sr: string)=> void)> | undefined)) - - get __backing_conVar8(): (IConsumeDecoratedVariable<((sr: string)=> void)> | undefined) - set __options_has_conVar8(__options_has_conVar8: (boolean | undefined)) - - get __options_has_conVar8(): (boolean | undefined) - set conVar9(conVar9: (Date | undefined)) - - get conVar9(): (Date | undefined) - set __backing_conVar9(__backing_conVar9: (IConsumeDecoratedVariable | undefined)) - - get __backing_conVar9(): (IConsumeDecoratedVariable | undefined) - set __options_has_conVar9(__options_has_conVar9: (boolean | undefined)) - - get __options_has_conVar9(): (boolean | undefined) - set conVar10(conVar10: (Map | undefined)) - - get conVar10(): (Map | undefined) - set __backing_conVar10(__backing_conVar10: (IConsumeDecoratedVariable> | undefined)) - - get __backing_conVar10(): (IConsumeDecoratedVariable> | undefined) - set __options_has_conVar10(__options_has_conVar10: (boolean | undefined)) - - get __options_has_conVar10(): (boolean | undefined) - set conVar11(conVar11: ((string | number) | undefined)) - - get conVar11(): ((string | number) | undefined) - set __backing_conVar11(__backing_conVar11: (IConsumeDecoratedVariable<(string | number)> | undefined)) - - get __backing_conVar11(): (IConsumeDecoratedVariable<(string | number)> | undefined) - set __options_has_conVar11(__options_has_conVar11: (boolean | undefined)) - - get __options_has_conVar11(): (boolean | undefined) - set conVar12(conVar12: ((Set | Per) | undefined)) - - get conVar12(): ((Set | Per) | undefined) - set __backing_conVar12(__backing_conVar12: (IConsumeDecoratedVariable<(Set | Per)> | undefined)) - - get __backing_conVar12(): (IConsumeDecoratedVariable<(Set | Per)> | undefined) - set __options_has_conVar12(__options_has_conVar12: (boolean | undefined)) - - get __options_has_conVar12(): (boolean | undefined) - set conVar13(conVar13: ((Set | null) | undefined)) - - get conVar13(): ((Set | null) | undefined) - set __backing_conVar13(__backing_conVar13: (IConsumeDecoratedVariable<(Set | null)> | undefined)) - - get __backing_conVar13(): (IConsumeDecoratedVariable<(Set | null)> | undefined) - set __options_has_conVar13(__options_has_conVar13: (boolean | undefined)) - - get __options_has_conVar13(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'conVar1', '(Per | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_conVar1', '(IConsumeDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_conVar1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'conVar2', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_conVar2', '(IConsumeDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_conVar2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'conVar3', '(PropType | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_conVar3', '(IConsumeDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_conVar3', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'conVar4', '(Set | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_conVar4', '(IConsumeDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_conVar4', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'conVar5', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_conVar5', '(IConsumeDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_conVar5', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'conVar6', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_conVar6', '(IConsumeDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_conVar6', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'conVar7', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_conVar7', '(IConsumeDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_conVar7', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'conVar8', '(((sr: string)=> void) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_conVar8', '(IConsumeDecoratedVariable<((sr: string)=> void)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_conVar8', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'conVar9', '(Date | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_conVar9', '(IConsumeDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_conVar9', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'conVar10', '(Map | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_conVar10', '(IConsumeDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_conVar10', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'conVar11', '((string | number) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_conVar11', '(IConsumeDecoratedVariable<(string | number)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_conVar11', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'conVar12', '((Set | Per) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_conVar12', '(IConsumeDecoratedVariable<(Set | Per)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_conVar12', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'conVar13', '((Set | null) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_conVar13', '(IConsumeDecoratedVariable<(Set | null)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_conVar13', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/provide-and-consume/provide-annotation-usage.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/provide-and-consume/provide-annotation-usage.test.ts index e47739f418baabac612cabd948909272231a2b94..ac5da84c8f9344bbedc3724cb1c135d3eb6b28fe 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/provide-and-consume/provide-annotation-usage.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/provide-and-consume/provide-annotation-usage.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { structNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -161,78 +162,37 @@ function main() {} } @Component() export interface __Options_Ancestors { - set count(count: ((string | undefined) | undefined)) - - get count(): ((string | undefined) | undefined) - set __backing_count(__backing_count: (IProvideDecoratedVariable<(string | undefined)> | undefined)) - - get __backing_count(): (IProvideDecoratedVariable<(string | undefined)> | undefined) - set __options_has_count(__options_has_count: (boolean | undefined)) - - get __options_has_count(): (boolean | undefined) - set count1(count1: ((string | undefined) | undefined)) - - get count1(): ((string | undefined) | undefined) - set __backing_count1(__backing_count1: (IProvideDecoratedVariable<(string | undefined)> | undefined)) - - get __backing_count1(): (IProvideDecoratedVariable<(string | undefined)> | undefined) - set __options_has_count1(__options_has_count1: (boolean | undefined)) - - get __options_has_count1(): (boolean | undefined) - set count2(count2: ((string | undefined) | undefined)) - - get count2(): ((string | undefined) | undefined) - set __backing_count2(__backing_count2: (IProvideDecoratedVariable<(string | undefined)> | undefined)) - - get __backing_count2(): (IProvideDecoratedVariable<(string | undefined)> | undefined) - set __options_has_count2(__options_has_count2: (boolean | undefined)) - - get __options_has_count2(): (boolean | undefined) - set count3(count3: ((string | undefined) | undefined)) - - get count3(): ((string | undefined) | undefined) - set __backing_count3(__backing_count3: (IProvideDecoratedVariable<(string | undefined)> | undefined)) - - get __backing_count3(): (IProvideDecoratedVariable<(string | undefined)> | undefined) - set __options_has_count3(__options_has_count3: (boolean | undefined)) - - get __options_has_count3(): (boolean | undefined) - set count4(count4: ((string | undefined) | undefined)) - - get count4(): ((string | undefined) | undefined) - set __backing_count4(__backing_count4: (IProvideDecoratedVariable<(string | undefined)> | undefined)) - - get __backing_count4(): (IProvideDecoratedVariable<(string | undefined)> | undefined) - set __options_has_count4(__options_has_count4: (boolean | undefined)) - - get __options_has_count4(): (boolean | undefined) - set count5(count5: ((string | undefined) | undefined)) - - get count5(): ((string | undefined) | undefined) - set __backing_count5(__backing_count5: (IProvideDecoratedVariable<(string | undefined)> | undefined)) - - get __backing_count5(): (IProvideDecoratedVariable<(string | undefined)> | undefined) - set __options_has_count5(__options_has_count5: (boolean | undefined)) - - get __options_has_count5(): (boolean | undefined) - set count6(count6: ((string | undefined) | undefined)) - - get count6(): ((string | undefined) | undefined) - set __backing_count6(__backing_count6: (IProvideDecoratedVariable<(string | undefined)> | undefined)) - - get __backing_count6(): (IProvideDecoratedVariable<(string | undefined)> | undefined) - set __options_has_count6(__options_has_count6: (boolean | undefined)) - - get __options_has_count6(): (boolean | undefined) - set count7(count7: ((string | undefined) | undefined)) - - get count7(): ((string | undefined) | undefined) - set __backing_count7(__backing_count7: (IProvideDecoratedVariable<(string | undefined)> | undefined)) - - get __backing_count7(): (IProvideDecoratedVariable<(string | undefined)> | undefined) - set __options_has_count7(__options_has_count7: (boolean | undefined)) - - get __options_has_count7(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'count', '((string | undefined) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_count', '(IProvideDecoratedVariable<(string | undefined)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_count', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'count1', '((string | undefined) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_count1', '(IProvideDecoratedVariable<(string | undefined)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_count1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'count2', '((string | undefined) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_count2', '(IProvideDecoratedVariable<(string | undefined)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_count2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'count3', '((string | undefined) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_count3', '(IProvideDecoratedVariable<(string | undefined)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_count3', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'count4', '((string | undefined) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_count4', '(IProvideDecoratedVariable<(string | undefined)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_count4', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'count5', '((string | undefined) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_count5', '(IProvideDecoratedVariable<(string | undefined)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_count5', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'count6', '((string | undefined) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_count6', '(IProvideDecoratedVariable<(string | undefined)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_count6', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'count7', '((string | undefined) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_count7', '(IProvideDecoratedVariable<(string | undefined)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_count7', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/provide-and-consume/provide-basic-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/provide-and-consume/provide-basic-type.test.ts index b94cf597fec640bca023192461084a1d166a2ba0..fd80e117210d403bf95ad8037b517f250ae42645 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/provide-and-consume/provide-basic-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/provide-and-consume/provide-basic-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { structNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -125,51 +126,25 @@ function main() {} } @Component() export interface __Options_PropParent { - set provideVar1(provideVar1: (string | undefined)) - - get provideVar1(): (string | undefined) - set __backing_provideVar1(__backing_provideVar1: (IProvideDecoratedVariable | undefined)) - - get __backing_provideVar1(): (IProvideDecoratedVariable | undefined) - set __options_has_provideVar1(__options_has_provideVar1: (boolean | undefined)) - - get __options_has_provideVar1(): (boolean | undefined) - set provideVar2(provideVar2: (number | undefined)) - - get provideVar2(): (number | undefined) - set __backing_provideVar2(__backing_provideVar2: (IProvideDecoratedVariable | undefined)) - - get __backing_provideVar2(): (IProvideDecoratedVariable | undefined) - set __options_has_provideVar2(__options_has_provideVar2: (boolean | undefined)) - - get __options_has_provideVar2(): (boolean | undefined) - set provideVar3(provideVar3: (boolean | undefined)) - - get provideVar3(): (boolean | undefined) - set __backing_provideVar3(__backing_provideVar3: (IProvideDecoratedVariable | undefined)) - - get __backing_provideVar3(): (IProvideDecoratedVariable | undefined) - set __options_has_provideVar3(__options_has_provideVar3: (boolean | undefined)) - - get __options_has_provideVar3(): (boolean | undefined) - set provideVar4(provideVar4: (undefined | undefined)) - - get provideVar4(): (undefined | undefined) - set __backing_provideVar4(__backing_provideVar4: (IProvideDecoratedVariable | undefined)) - - get __backing_provideVar4(): (IProvideDecoratedVariable | undefined) - set __options_has_provideVar4(__options_has_provideVar4: (boolean | undefined)) - - get __options_has_provideVar4(): (boolean | undefined) - set provideVar5(provideVar5: (null | undefined)) - - get provideVar5(): (null | undefined) - set __backing_provideVar5(__backing_provideVar5: (IProvideDecoratedVariable | undefined)) - - get __backing_provideVar5(): (IProvideDecoratedVariable | undefined) - set __options_has_provideVar5(__options_has_provideVar5: (boolean | undefined)) - - get __options_has_provideVar5(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'provideVar1', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_provideVar1', '(IProvideDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_provideVar1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'provideVar2', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_provideVar2', '(IProvideDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_provideVar2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'provideVar3', '(boolean | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_provideVar3', '(IProvideDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_provideVar3', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'provideVar4', '(undefined | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_provideVar4', '(IProvideDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_provideVar4', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'provideVar5', '(null | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_provideVar5', '(IProvideDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_provideVar5', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/provide-and-consume/provide-complex-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/provide-and-consume/provide-complex-type.test.ts index b3f5f162f254a581398d4d25c9900606113f404c..240e5bdfb4fd9d936050935af05237d983e6d8a4 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/provide-and-consume/provide-complex-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/provide-and-consume/provide-complex-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { structNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -286,114 +287,53 @@ final class PropType extends BaseEnum { } @Component() export interface __Options_Parent { - set provideVar1(provideVar1: (Per | undefined)) - - get provideVar1(): (Per | undefined) - set __backing_provideVar1(__backing_provideVar1: (IProvideDecoratedVariable | undefined)) - - get __backing_provideVar1(): (IProvideDecoratedVariable | undefined) - set __options_has_provideVar1(__options_has_provideVar1: (boolean | undefined)) - - get __options_has_provideVar1(): (boolean | undefined) - set provideVar2(provideVar2: (Array | undefined)) - - get provideVar2(): (Array | undefined) - set __backing_provideVar2(__backing_provideVar2: (IProvideDecoratedVariable> | undefined)) - - get __backing_provideVar2(): (IProvideDecoratedVariable> | undefined) - set __options_has_provideVar2(__options_has_provideVar2: (boolean | undefined)) - - get __options_has_provideVar2(): (boolean | undefined) - set provideVar3(provideVar3: (PropType | undefined)) - - get provideVar3(): (PropType | undefined) - set __backing_provideVar3(__backing_provideVar3: (IProvideDecoratedVariable | undefined)) - - get __backing_provideVar3(): (IProvideDecoratedVariable | undefined) - set __options_has_provideVar3(__options_has_provideVar3: (boolean | undefined)) - - get __options_has_provideVar3(): (boolean | undefined) - set provideVar4(provideVar4: (Set | undefined)) - - get provideVar4(): (Set | undefined) - set __backing_provideVar4(__backing_provideVar4: (IProvideDecoratedVariable> | undefined)) - - get __backing_provideVar4(): (IProvideDecoratedVariable> | undefined) - set __options_has_provideVar4(__options_has_provideVar4: (boolean | undefined)) - - get __options_has_provideVar4(): (boolean | undefined) - set provideVar5(provideVar5: (Array | undefined)) - - get provideVar5(): (Array | undefined) - set __backing_provideVar5(__backing_provideVar5: (IProvideDecoratedVariable> | undefined)) - - get __backing_provideVar5(): (IProvideDecoratedVariable> | undefined) - set __options_has_provideVar5(__options_has_provideVar5: (boolean | undefined)) - - get __options_has_provideVar5(): (boolean | undefined) - set provideVar6(provideVar6: (Array | undefined)) - - get provideVar6(): (Array | undefined) - set __backing_provideVar6(__backing_provideVar6: (IProvideDecoratedVariable> | undefined)) - - get __backing_provideVar6(): (IProvideDecoratedVariable> | undefined) - set __options_has_provideVar6(__options_has_provideVar6: (boolean | undefined)) - - get __options_has_provideVar6(): (boolean | undefined) - set provideVar7(provideVar7: (Array | undefined)) - - get provideVar7(): (Array | undefined) - set __backing_provideVar7(__backing_provideVar7: (IProvideDecoratedVariable> | undefined)) - - get __backing_provideVar7(): (IProvideDecoratedVariable> | undefined) - set __options_has_provideVar7(__options_has_provideVar7: (boolean | undefined)) - - get __options_has_provideVar7(): (boolean | undefined) - set provideVar8(provideVar8: (((sr: string)=> void) | undefined)) - - get provideVar8(): (((sr: string)=> void) | undefined) - set __backing_provideVar8(__backing_provideVar8: (IProvideDecoratedVariable<((sr: string)=> void)> | undefined)) - - get __backing_provideVar8(): (IProvideDecoratedVariable<((sr: string)=> void)> | undefined) - set __options_has_provideVar8(__options_has_provideVar8: (boolean | undefined)) - - get __options_has_provideVar8(): (boolean | undefined) - set provideVar9(provideVar9: (Date | undefined)) - - get provideVar9(): (Date | undefined) - set __backing_provideVar9(__backing_provideVar9: (IProvideDecoratedVariable | undefined)) - - get __backing_provideVar9(): (IProvideDecoratedVariable | undefined) - set __options_has_provideVar9(__options_has_provideVar9: (boolean | undefined)) - - get __options_has_provideVar9(): (boolean | undefined) - set provideVar10(provideVar10: (Map | undefined)) - - get provideVar10(): (Map | undefined) - set __backing_provideVar10(__backing_provideVar10: (IProvideDecoratedVariable> | undefined)) - - get __backing_provideVar10(): (IProvideDecoratedVariable> | undefined) - set __options_has_provideVar10(__options_has_provideVar10: (boolean | undefined)) - - get __options_has_provideVar10(): (boolean | undefined) - set provideVar11(provideVar11: ((string | number) | undefined)) - - get provideVar11(): ((string | number) | undefined) - set __backing_provideVar11(__backing_provideVar11: (IProvideDecoratedVariable<(string | number)> | undefined)) - - get __backing_provideVar11(): (IProvideDecoratedVariable<(string | number)> | undefined) - set __options_has_provideVar11(__options_has_provideVar11: (boolean | undefined)) - - get __options_has_provideVar11(): (boolean | undefined) - set provideVar12(provideVar12: ((Set | Per) | undefined)) - - get provideVar12(): ((Set | Per) | undefined) - set __backing_provideVar12(__backing_provideVar12: (IProvideDecoratedVariable<(Set | Per)> | undefined)) - - get __backing_provideVar12(): (IProvideDecoratedVariable<(Set | Per)> | undefined) - set __options_has_provideVar12(__options_has_provideVar12: (boolean | undefined)) - - get __options_has_provideVar12(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'provideVar1', '(Per | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_provideVar1', '(IProvideDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_provideVar1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'provideVar2', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_provideVar2', '(IProvideDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_provideVar2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'provideVar3', '(PropType | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_provideVar3', '(IProvideDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_provideVar3', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'provideVar4', '(Set | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_provideVar4', '(IProvideDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_provideVar4', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'provideVar5', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_provideVar5', '(IProvideDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_provideVar5', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'provideVar6', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_provideVar6', '(IProvideDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_provideVar6', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'provideVar7', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_provideVar7', '(IProvideDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_provideVar7', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'provideVar8', '(((sr: string)=> void) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_provideVar8', '(IProvideDecoratedVariable<((sr: string)=> void)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_provideVar8', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'provideVar9', '(Date | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_provideVar9', '(IProvideDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_provideVar9', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'provideVar10', '(Map | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_provideVar10', '(IProvideDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_provideVar10', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'provideVar11', '((string | number) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_provideVar11', '(IProvideDecoratedVariable<(string | number)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_provideVar11', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'provideVar12', '((Set | Per) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_provideVar12', '(IProvideDecoratedVariable<(Set | Per)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_provideVar12', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/provide-and-consume/provide-to-consume.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/provide-and-consume/provide-to-consume.test.ts index ea9464d99a557ff6a2536326b3f8127f70dac8b6..aeab2882e9a6155f0c59f50d8178b177e255b2aa 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/provide-and-consume/provide-to-consume.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/provide-and-consume/provide-to-consume.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper, ignoreNewLines } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -78,22 +79,26 @@ import { Consume as Consume, Provide as Provide } from "@ohos.arkui.stateManagem } @Component() export interface __Options_Child { + ${ignoreNewLines(` num?: number; @Consume() __backing_num?: number; __options_has_num?: boolean; str?: string; @Consume({value:"ss"}) __backing_str?: string; __options_has_str?: boolean; + `)} } @Component() export interface __Options_Parent { + ${ignoreNewLines(` num?: number; @Provide({alias:"num"}) __backing_num?: number; __options_has_num?: boolean; str?: string; @Provide({alias:"ss"}) __backing_str?: string; __options_has_str?: boolean; + `)} } `; @@ -225,46 +230,24 @@ function main() {} } @Component() export interface __Options_Child { - set num(num: (number | undefined)) - - get num(): (number | undefined) - set __backing_num(__backing_num: (IConsumeDecoratedVariable | undefined)) - - get __backing_num(): (IConsumeDecoratedVariable | undefined) - set __options_has_num(__options_has_num: (boolean | undefined)) - - get __options_has_num(): (boolean | undefined) - set str(str: (string | undefined)) - - get str(): (string | undefined) - set __backing_str(__backing_str: (IConsumeDecoratedVariable | undefined)) - - get __backing_str(): (IConsumeDecoratedVariable | undefined) - set __options_has_str(__options_has_str: (boolean | undefined)) - - get __options_has_str(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'num', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_num', '(IConsumeDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_num', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'str', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_str', '(IConsumeDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_str', '(boolean | undefined)')} } @Component() export interface __Options_Parent { - set num(num: (number | undefined)) - - get num(): (number | undefined) - set __backing_num(__backing_num: (IProvideDecoratedVariable | undefined)) - - get __backing_num(): (IProvideDecoratedVariable | undefined) - set __options_has_num(__options_has_num: (boolean | undefined)) - - get __options_has_num(): (boolean | undefined) - set str(str: (string | undefined)) - - get str(): (string | undefined) - set __backing_str(__backing_str: (IProvideDecoratedVariable | undefined)) - - get __backing_str(): (IProvideDecoratedVariable | undefined) - set __options_has_str(__options_has_str: (boolean | undefined)) - - get __options_has_str(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'num', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_num', '(IProvideDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_num', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'str', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_str', '(IProvideDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_str', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/provider-and-consumer/consumer-basic-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/provider-and-consumer/consumer-basic-type.test.ts index a92a9bda9b38f23c72256ff3e172746e94358d8d..ae8a373f218b6ce34e09e2639271745fc8cff280 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/provider-and-consumer/consumer-basic-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/provider-and-consumer/consumer-basic-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { structNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -122,51 +123,25 @@ function main() {} } @ComponentV2() export interface __Options_Parent { - set consumerVar1(consumerVar1: (string | undefined)) - - get consumerVar1(): (string | undefined) - set __backing_consumerVar1(__backing_consumerVar1: (IConsumerDecoratedVariable | undefined)) - - get __backing_consumerVar1(): (IConsumerDecoratedVariable | undefined) - set __options_has_consumerVar1(__options_has_consumerVar1: (boolean | undefined)) - - get __options_has_consumerVar1(): (boolean | undefined) - set consumerVar2(consumerVar2: (number | undefined)) - - get consumerVar2(): (number | undefined) - set __backing_consumerVar2(__backing_consumerVar2: (IConsumerDecoratedVariable | undefined)) - - get __backing_consumerVar2(): (IConsumerDecoratedVariable | undefined) - set __options_has_consumerVar2(__options_has_consumerVar2: (boolean | undefined)) - - get __options_has_consumerVar2(): (boolean | undefined) - set consumerVar3(consumerVar3: (boolean | undefined)) - - get consumerVar3(): (boolean | undefined) - set __backing_consumerVar3(__backing_consumerVar3: (IConsumerDecoratedVariable | undefined)) - - get __backing_consumerVar3(): (IConsumerDecoratedVariable | undefined) - set __options_has_consumerVar3(__options_has_consumerVar3: (boolean | undefined)) - - get __options_has_consumerVar3(): (boolean | undefined) - set consumerVar4(consumerVar4: (undefined | undefined)) - - get consumerVar4(): (undefined | undefined) - set __backing_consumerVar4(__backing_consumerVar4: (IConsumerDecoratedVariable | undefined)) - - get __backing_consumerVar4(): (IConsumerDecoratedVariable | undefined) - set __options_has_consumerVar4(__options_has_consumerVar4: (boolean | undefined)) - - get __options_has_consumerVar4(): (boolean | undefined) - set consumerVar5(consumerVar5: (null | undefined)) - - get consumerVar5(): (null | undefined) - set __backing_consumerVar5(__backing_consumerVar5: (IConsumerDecoratedVariable | undefined)) - - get __backing_consumerVar5(): (IConsumerDecoratedVariable | undefined) - set __options_has_consumerVar5(__options_has_consumerVar5: (boolean | undefined)) - - get __options_has_consumerVar5(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'consumerVar1', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_consumerVar1', '(IConsumerDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_consumerVar1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'consumerVar2', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_consumerVar2', '(IConsumerDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_consumerVar2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'consumerVar3', '(boolean | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_consumerVar3', '(IConsumerDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_consumerVar3', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'consumerVar4', '(undefined | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_consumerVar4', '(IConsumerDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_consumerVar4', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'consumerVar5', '(null | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_consumerVar5', '(IConsumerDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_consumerVar5', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/provider-and-consumer/consumer-complex-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/provider-and-consumer/consumer-complex-type.test.ts index aa2a9cc552c0095bda19e91d5317a7c31524d780..9d4a85feeb264725ff50dd8a468b39ce6ac0b6fe 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/provider-and-consumer/consumer-complex-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/provider-and-consumer/consumer-complex-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { structNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -265,105 +266,49 @@ final class StateType extends BaseEnum { } @ComponentV2() export interface __Options_Parent { - set paramVar1(paramVar1: (Per | undefined)) - - get paramVar1(): (Per | undefined) - set __backing_paramVar1(__backing_paramVar1: (IConsumerDecoratedVariable | undefined)) - - get __backing_paramVar1(): (IConsumerDecoratedVariable | undefined) - set __options_has_paramVar1(__options_has_paramVar1: (boolean | undefined)) - - get __options_has_paramVar1(): (boolean | undefined) - set paramVar2(paramVar2: (Array | undefined)) - - get paramVar2(): (Array | undefined) - set __backing_paramVar2(__backing_paramVar2: (IConsumerDecoratedVariable> | undefined)) - - get __backing_paramVar2(): (IConsumerDecoratedVariable> | undefined) - set __options_has_paramVar2(__options_has_paramVar2: (boolean | undefined)) - - get __options_has_paramVar2(): (boolean | undefined) - set paramVar3(paramVar3: (StateType | undefined)) - - get paramVar3(): (StateType | undefined) - set __backing_paramVar3(__backing_paramVar3: (IConsumerDecoratedVariable | undefined)) - - get __backing_paramVar3(): (IConsumerDecoratedVariable | undefined) - set __options_has_paramVar3(__options_has_paramVar3: (boolean | undefined)) - - get __options_has_paramVar3(): (boolean | undefined) - set paramVar4(paramVar4: (Set | undefined)) - - get paramVar4(): (Set | undefined) - set __backing_paramVar4(__backing_paramVar4: (IConsumerDecoratedVariable> | undefined)) - - get __backing_paramVar4(): (IConsumerDecoratedVariable> | undefined) - set __options_has_paramVar4(__options_has_paramVar4: (boolean | undefined)) - - get __options_has_paramVar4(): (boolean | undefined) - set paramVar5(paramVar5: (Array | undefined)) - - get paramVar5(): (Array | undefined) - set __backing_paramVar5(__backing_paramVar5: (IConsumerDecoratedVariable> | undefined)) - - get __backing_paramVar5(): (IConsumerDecoratedVariable> | undefined) - set __options_has_paramVar5(__options_has_paramVar5: (boolean | undefined)) - - get __options_has_paramVar5(): (boolean | undefined) - set paramVar6(paramVar6: (Array | undefined)) - - get paramVar6(): (Array | undefined) - set __backing_paramVar6(__backing_paramVar6: (IConsumerDecoratedVariable> | undefined)) - - get __backing_paramVar6(): (IConsumerDecoratedVariable> | undefined) - set __options_has_paramVar6(__options_has_paramVar6: (boolean | undefined)) - - get __options_has_paramVar6(): (boolean | undefined) - set paramVar7(paramVar7: (Array | undefined)) - - get paramVar7(): (Array | undefined) - set __backing_paramVar7(__backing_paramVar7: (IConsumerDecoratedVariable> | undefined)) - - get __backing_paramVar7(): (IConsumerDecoratedVariable> | undefined) - set __options_has_paramVar7(__options_has_paramVar7: (boolean | undefined)) - - get __options_has_paramVar7(): (boolean | undefined) - set paramVar9(paramVar9: (Date | undefined)) - - get paramVar9(): (Date | undefined) - set __backing_paramVar9(__backing_paramVar9: (IConsumerDecoratedVariable | undefined)) - - get __backing_paramVar9(): (IConsumerDecoratedVariable | undefined) - set __options_has_paramVar9(__options_has_paramVar9: (boolean | undefined)) - - get __options_has_paramVar9(): (boolean | undefined) - set paramVar10(paramVar10: (Map | undefined)) - - get paramVar10(): (Map | undefined) - set __backing_paramVar10(__backing_paramVar10: (IConsumerDecoratedVariable> | undefined)) - - get __backing_paramVar10(): (IConsumerDecoratedVariable> | undefined) - set __options_has_paramVar10(__options_has_paramVar10: (boolean | undefined)) - - get __options_has_paramVar10(): (boolean | undefined) - set paramVar11(paramVar11: ((string | number) | undefined)) - - get paramVar11(): ((string | number) | undefined) - set __backing_paramVar11(__backing_paramVar11: (IConsumerDecoratedVariable<(string | number)> | undefined)) - - get __backing_paramVar11(): (IConsumerDecoratedVariable<(string | number)> | undefined) - set __options_has_paramVar11(__options_has_paramVar11: (boolean | undefined)) - - get __options_has_paramVar11(): (boolean | undefined) - set paramVar12(paramVar12: ((Set | Per) | undefined)) - - get paramVar12(): ((Set | Per) | undefined) - set __backing_paramVar12(__backing_paramVar12: (IConsumerDecoratedVariable<(Set | Per)> | undefined)) - - get __backing_paramVar12(): (IConsumerDecoratedVariable<(Set | Per)> | undefined) - set __options_has_paramVar12(__options_has_paramVar12: (boolean | undefined)) - - get __options_has_paramVar12(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar1', '(Per | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar1', '(IConsumerDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar2', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar2', '(IConsumerDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar3', '(StateType | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar3', '(IConsumerDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar3', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar4', '(Set | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar4', '(IConsumerDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar4', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar5', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar5', '(IConsumerDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar5', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar6', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar6', '(IConsumerDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar6', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar7', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar7', '(IConsumerDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar7', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar9', '(Date | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar9', '(IConsumerDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar9', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar10', '(Map | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar10', '(IConsumerDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar10', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar11', '((string | number) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar11', '(IConsumerDecoratedVariable<(string | number)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar11', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar12', '((Set | Per) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar12', '(IConsumerDecoratedVariable<(Set | Per)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar12', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/provider-and-consumer/provider-basic-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/provider-and-consumer/provider-basic-type.test.ts index b47aef4a9f720846c426c5eba382b7dd15511df2..bb310da781e7854a92562898a2815b37b2c232ce 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/provider-and-consumer/provider-basic-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/provider-and-consumer/provider-basic-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { structNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -122,51 +123,25 @@ function main() {} } @ComponentV2() export interface __Options_Parent { - set providerVar1(providerVar1: (string | undefined)) - - get providerVar1(): (string | undefined) - set __backing_providerVar1(__backing_providerVar1: (IProviderDecoratedVariable | undefined)) - - get __backing_providerVar1(): (IProviderDecoratedVariable | undefined) - set __options_has_providerVar1(__options_has_providerVar1: (boolean | undefined)) - - get __options_has_providerVar1(): (boolean | undefined) - set providerVar2(providerVar2: (number | undefined)) - - get providerVar2(): (number | undefined) - set __backing_providerVar2(__backing_providerVar2: (IProviderDecoratedVariable | undefined)) - - get __backing_providerVar2(): (IProviderDecoratedVariable | undefined) - set __options_has_providerVar2(__options_has_providerVar2: (boolean | undefined)) - - get __options_has_providerVar2(): (boolean | undefined) - set providerVar3(providerVar3: (boolean | undefined)) - - get providerVar3(): (boolean | undefined) - set __backing_providerVar3(__backing_providerVar3: (IProviderDecoratedVariable | undefined)) - - get __backing_providerVar3(): (IProviderDecoratedVariable | undefined) - set __options_has_providerVar3(__options_has_providerVar3: (boolean | undefined)) - - get __options_has_providerVar3(): (boolean | undefined) - set providerVar4(providerVar4: (undefined | undefined)) - - get providerVar4(): (undefined | undefined) - set __backing_providerVar4(__backing_providerVar4: (IProviderDecoratedVariable | undefined)) - - get __backing_providerVar4(): (IProviderDecoratedVariable | undefined) - set __options_has_providerVar4(__options_has_providerVar4: (boolean | undefined)) - - get __options_has_providerVar4(): (boolean | undefined) - set providerVar5(providerVar5: (null | undefined)) - - get providerVar5(): (null | undefined) - set __backing_providerVar5(__backing_providerVar5: (IProviderDecoratedVariable | undefined)) - - get __backing_providerVar5(): (IProviderDecoratedVariable | undefined) - set __options_has_providerVar5(__options_has_providerVar5: (boolean | undefined)) - - get __options_has_providerVar5(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'providerVar1', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_providerVar1', '(IProviderDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_providerVar1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'providerVar2', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_providerVar2', '(IProviderDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_providerVar2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'providerVar3', '(boolean | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_providerVar3', '(IProviderDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_providerVar3', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'providerVar4', '(undefined | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_providerVar4', '(IProviderDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_providerVar4', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'providerVar5', '(null | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_providerVar5', '(IProviderDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_providerVar5', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/provider-and-consumer/provider-complex-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/provider-and-consumer/provider-complex-type.test.ts index 20ed1c320b166e065555309c9f4589d13759b75d..25fd1cca80da697088fbbdc3ea8e36d217ff9f71 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/provider-and-consumer/provider-complex-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/provider-and-consumer/provider-complex-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { structNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -265,105 +266,49 @@ final class StateType extends BaseEnum { } @ComponentV2() export interface __Options_Parent { - set paramVar1(paramVar1: (Per | undefined)) - - get paramVar1(): (Per | undefined) - set __backing_paramVar1(__backing_paramVar1: (IProviderDecoratedVariable | undefined)) - - get __backing_paramVar1(): (IProviderDecoratedVariable | undefined) - set __options_has_paramVar1(__options_has_paramVar1: (boolean | undefined)) - - get __options_has_paramVar1(): (boolean | undefined) - set paramVar2(paramVar2: (Array | undefined)) - - get paramVar2(): (Array | undefined) - set __backing_paramVar2(__backing_paramVar2: (IProviderDecoratedVariable> | undefined)) - - get __backing_paramVar2(): (IProviderDecoratedVariable> | undefined) - set __options_has_paramVar2(__options_has_paramVar2: (boolean | undefined)) - - get __options_has_paramVar2(): (boolean | undefined) - set paramVar3(paramVar3: (StateType | undefined)) - - get paramVar3(): (StateType | undefined) - set __backing_paramVar3(__backing_paramVar3: (IProviderDecoratedVariable | undefined)) - - get __backing_paramVar3(): (IProviderDecoratedVariable | undefined) - set __options_has_paramVar3(__options_has_paramVar3: (boolean | undefined)) - - get __options_has_paramVar3(): (boolean | undefined) - set paramVar4(paramVar4: (Set | undefined)) - - get paramVar4(): (Set | undefined) - set __backing_paramVar4(__backing_paramVar4: (IProviderDecoratedVariable> | undefined)) - - get __backing_paramVar4(): (IProviderDecoratedVariable> | undefined) - set __options_has_paramVar4(__options_has_paramVar4: (boolean | undefined)) - - get __options_has_paramVar4(): (boolean | undefined) - set paramVar5(paramVar5: (Array | undefined)) - - get paramVar5(): (Array | undefined) - set __backing_paramVar5(__backing_paramVar5: (IProviderDecoratedVariable> | undefined)) - - get __backing_paramVar5(): (IProviderDecoratedVariable> | undefined) - set __options_has_paramVar5(__options_has_paramVar5: (boolean | undefined)) - - get __options_has_paramVar5(): (boolean | undefined) - set paramVar6(paramVar6: (Array | undefined)) - - get paramVar6(): (Array | undefined) - set __backing_paramVar6(__backing_paramVar6: (IProviderDecoratedVariable> | undefined)) - - get __backing_paramVar6(): (IProviderDecoratedVariable> | undefined) - set __options_has_paramVar6(__options_has_paramVar6: (boolean | undefined)) - - get __options_has_paramVar6(): (boolean | undefined) - set paramVar7(paramVar7: (Array | undefined)) - - get paramVar7(): (Array | undefined) - set __backing_paramVar7(__backing_paramVar7: (IProviderDecoratedVariable> | undefined)) - - get __backing_paramVar7(): (IProviderDecoratedVariable> | undefined) - set __options_has_paramVar7(__options_has_paramVar7: (boolean | undefined)) - - get __options_has_paramVar7(): (boolean | undefined) - set paramVar9(paramVar9: (Date | undefined)) - - get paramVar9(): (Date | undefined) - set __backing_paramVar9(__backing_paramVar9: (IProviderDecoratedVariable | undefined)) - - get __backing_paramVar9(): (IProviderDecoratedVariable | undefined) - set __options_has_paramVar9(__options_has_paramVar9: (boolean | undefined)) - - get __options_has_paramVar9(): (boolean | undefined) - set paramVar10(paramVar10: (Map | undefined)) - - get paramVar10(): (Map | undefined) - set __backing_paramVar10(__backing_paramVar10: (IProviderDecoratedVariable> | undefined)) - - get __backing_paramVar10(): (IProviderDecoratedVariable> | undefined) - set __options_has_paramVar10(__options_has_paramVar10: (boolean | undefined)) - - get __options_has_paramVar10(): (boolean | undefined) - set paramVar11(paramVar11: ((string | number) | undefined)) - - get paramVar11(): ((string | number) | undefined) - set __backing_paramVar11(__backing_paramVar11: (IProviderDecoratedVariable<(string | number)> | undefined)) - - get __backing_paramVar11(): (IProviderDecoratedVariable<(string | number)> | undefined) - set __options_has_paramVar11(__options_has_paramVar11: (boolean | undefined)) - - get __options_has_paramVar11(): (boolean | undefined) - set paramVar12(paramVar12: ((Set | Per) | undefined)) - - get paramVar12(): ((Set | Per) | undefined) - set __backing_paramVar12(__backing_paramVar12: (IProviderDecoratedVariable<(Set | Per)> | undefined)) - - get __backing_paramVar12(): (IProviderDecoratedVariable<(Set | Per)> | undefined) - set __options_has_paramVar12(__options_has_paramVar12: (boolean | undefined)) - - get __options_has_paramVar12(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar1', '(Per | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar1', '(IProviderDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar2', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar2', '(IProviderDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar3', '(StateType | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar3', '(IProviderDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar3', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar4', '(Set | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar4', '(IProviderDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar4', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar5', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar5', '(IProviderDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar5', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar6', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar6', '(IProviderDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar6', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar7', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar7', '(IProviderDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar7', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar9', '(Date | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar9', '(IProviderDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar9', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar10', '(Map | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar10', '(IProviderDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar10', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar11', '((string | number) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar11', '(IProviderDecoratedVariable<(string | number)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar11', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'paramVar12', '((Set | Per) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_paramVar12', '(IProviderDecoratedVariable<(Set | Per)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_paramVar12', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/provider-and-consumer/provider-to-consumer.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/provider-and-consumer/provider-to-consumer.test.ts index 21643ae7d0d9b7cc827aae59cff99f3fbf1ac8ed..7ea2d8ee8ee5433cc7b3e11b1a6feb992846f1b3 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/provider-and-consumer/provider-to-consumer.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/provider-and-consumer/provider-to-consumer.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -247,22 +248,16 @@ function main() {} } @ComponentV2() export interface __Options_Parent { - get users(): (Array | undefined) - set users(users: (Array | undefined)) - get __backing_users(): (IProviderDecoratedVariable> | undefined) - set __backing_users(__backing_users: (IProviderDecoratedVariable> | undefined)) - get __options_has_users(): (boolean | undefined) - set __options_has_users(__options_has_users: (boolean | undefined)) + ${dumpGetterSetter(GetSetDumper.BOTH, 'users', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_users', '(IProviderDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_users', '(boolean | undefined)')} } @ComponentV2() export interface __Options_Child { - get users(): (Array | undefined) - set users(users: (Array | undefined)) - get __backing_users(): (IConsumerDecoratedVariable> | undefined) - set __backing_users(__backing_users: (IConsumerDecoratedVariable> | undefined)) - get __options_has_users(): (boolean | undefined) - set __options_has_users(__options_has_users: (boolean | undefined)) + ${dumpGetterSetter(GetSetDumper.BOTH, 'users', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_users', '(IConsumerDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_users', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/require/basic-require.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/require/basic-require.test.ts index 7148daa6fc3e4cc654ecb1aab590fe1a2e0b1838..afb86ec4bc8a2119afc998d0ea8669bf886cea6e 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/require/basic-require.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/require/basic-require.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { structNoRecheck, recheck, uiNoRecheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpAnnotation, dumpGetterSetter, GetSetDumper, ignoreNewLines } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -80,6 +81,7 @@ import { State as State, Require as Require, PropRef as PropRef, Provide as Prov } @Component() export interface __Options_MyStateSample { + ${ignoreNewLines(` hello?: string; __options_has_hello?: boolean; state1?: boolean; @@ -107,13 +109,16 @@ import { State as State, Require as Require, PropRef as PropRef, Provide as Prov __options_has_select6?: boolean; @BuilderParam() builder?: (()=> void); __options_has_builder?: boolean; + `)} } @ComponentV2() export interface __Options_V2222 { + ${ignoreNewLines(` select1?: string; @Require() @Param() __backing_select1?: string; __options_has_select1?: boolean; + `)} } `; @@ -288,100 +293,49 @@ function main() {} } @Component() export interface __Options_MyStateSample { - set hello(hello: (string | undefined)) - - get hello(): (string | undefined) - set __options_has_hello(__options_has_hello: (boolean | undefined)) - - get __options_has_hello(): (boolean | undefined) - set state1(state1: (boolean | undefined)) - - get state1(): (boolean | undefined) - set __backing_state1(__backing_state1: (IStateDecoratedVariable | undefined)) - - get __backing_state1(): (IStateDecoratedVariable | undefined) - set __options_has_state1(__options_has_state1: (boolean | undefined)) - - get __options_has_state1(): (boolean | undefined) - set select100(select100: (string | undefined)) - - get select100(): (string | undefined) - set __options_has_select100(__options_has_select100: (boolean | undefined)) - - get __options_has_select100(): (boolean | undefined) - set select0(select0: (number | undefined)) - - get select0(): (number | undefined) - @Require() set __backing_select0(__backing_select0: (IStateDecoratedVariable | undefined)) - - @Require() get __backing_select0(): (IStateDecoratedVariable | undefined) - set __options_has_select0(__options_has_select0: (boolean | undefined)) - - get __options_has_select0(): (boolean | undefined) - set select3(select3: ((number | null) | undefined)) - - get select3(): ((number | null) | undefined) - @Require() set __backing_select3(__backing_select3: (IStateDecoratedVariable<(number | null)> | undefined)) - - @Require() get __backing_select3(): (IStateDecoratedVariable<(number | null)> | undefined) - set __options_has_select3(__options_has_select3: (boolean | undefined)) - - get __options_has_select3(): (boolean | undefined) - set select4(select4: (undefined | undefined)) - - get select4(): (undefined | undefined) - @Require() set __backing_select4(__backing_select4: (IStateDecoratedVariable | undefined)) - - @Require() get __backing_select4(): (IStateDecoratedVariable | undefined) - set __options_has_select4(__options_has_select4: (boolean | undefined)) - - get __options_has_select4(): (boolean | undefined) - set select1(select1: (string | undefined)) - - get select1(): (string | undefined) - @Require() set __backing_select1(__backing_select1: (IPropRefDecoratedVariable | undefined)) - - @Require() get __backing_select1(): (IPropRefDecoratedVariable | undefined) - set __options_has_select1(__options_has_select1: (boolean | undefined)) - - get __options_has_select1(): (boolean | undefined) - set select2(select2: (Array | undefined)) - - get select2(): (Array | undefined) - @Require() set __backing_select2(__backing_select2: (IProvideDecoratedVariable> | undefined)) - - @Require() get __backing_select2(): (IProvideDecoratedVariable> | undefined) - set __options_has_select2(__options_has_select2: (boolean | undefined)) - - get __options_has_select2(): (boolean | undefined) - set select6(select6: ((Array | undefined | string) | undefined)) - - get select6(): ((Array | undefined | string) | undefined) - @Require() set __backing_select6(__backing_select6: (IProvideDecoratedVariable<(Array | undefined | string)> | undefined)) - - @Require() get __backing_select6(): (IProvideDecoratedVariable<(Array | undefined | string)> | undefined) - set __options_has_select6(__options_has_select6: (boolean | undefined)) - - get __options_has_select6(): (boolean | undefined) - set builder(builder: (@memo() (()=> void) | undefined)) - - get builder(): (@memo() (()=> void) | undefined) - set __options_has_builder(__options_has_builder: (boolean | undefined)) - - get __options_has_builder(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'hello', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_hello', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'state1', '(boolean | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_state1', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_state1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'select100', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_select100', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'select0', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_select0', '(IStateDecoratedVariable | undefined)', [dumpAnnotation('Require')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_select0', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'select3', '((number | null) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_select3', '(IStateDecoratedVariable<(number | null)> | undefined)', [dumpAnnotation('Require')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_select3', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'select4', '(undefined | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_select4', '(IStateDecoratedVariable | undefined)', [dumpAnnotation('Require')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_select4', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'select1', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_select1', '(IPropRefDecoratedVariable | undefined)', [dumpAnnotation('Require')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_select1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'select2', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_select2', '(IProvideDecoratedVariable> | undefined)', [dumpAnnotation('Require')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_select2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'select6', '((Array | undefined | string) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_select6', '(IProvideDecoratedVariable<(Array | undefined | string)> | undefined)', [dumpAnnotation('Require')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_select6', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'builder', '(@memo() (()=> void) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_builder', '(boolean | undefined)')} } @ComponentV2() export interface __Options_V2222 { - set select1(select1: (string | undefined)) - - get select1(): (string | undefined) - @Require() set __backing_select1(__backing_select1: (IParamDecoratedVariable | undefined)) - - @Require() get __backing_select1(): (IParamDecoratedVariable | undefined) - set __options_has_select1(__options_has_select1: (boolean | undefined)) - - get __options_has_select1(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'select1', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_select1', '(IParamDecoratedVariable | undefined)', [dumpAnnotation('Require')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_select1', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/resource/resource-in-build.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/resource/resource-in-build.test.ts index 3ba9e9e185da02ee3c17d6a37c5261995023b50a..b027e4c4b67feb8b3f7e0aba715717770f0f9745 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/resource/resource-in-build.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/resource/resource-in-build.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { uiNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -191,24 +192,14 @@ function main() {} } @Component() export interface __Options_ResourceComponent { - set str1(str1: (string | undefined)) - - get str1(): (string | undefined) - set __options_has_str1(__options_has_str1: (boolean | undefined)) - - get __options_has_str1(): (boolean | undefined) - set str2(str2: (string | undefined)) - - get str2(): (string | undefined) - set __options_has_str2(__options_has_str2: (boolean | undefined)) - - get __options_has_str2(): (boolean | undefined) - set numbers(numbers: (Array | undefined)) - - get numbers(): (Array | undefined) - set __options_has_numbers(__options_has_numbers: (boolean | undefined)) - - get __options_has_numbers(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'str1', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_str1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'str2', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_str2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'numbers', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_numbers', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/resource/resource-in-property.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/resource/resource-in-property.test.ts index 18a77f790fd9410091648d773559a8e844047690..eb22fc2f493ea5973d9fe38f3ad2455d94b5175e 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/resource/resource-in-property.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/resource/resource-in-property.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { uiNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -102,18 +103,11 @@ i = _r(16777216, 10003, "com.example.mock", "entry"); } @Component() export interface __Options_ResourceComponent { - set str(str: (Resource | undefined)) - - get str(): (Resource | undefined) - set __options_has_str(__options_has_str: (boolean | undefined)) - - get __options_has_str(): (boolean | undefined) - set icon(icon: (Resource | undefined)) - - get icon(): (Resource | undefined) - set __options_has_icon(__options_has_icon: (boolean | undefined)) - - get __options_has_icon(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'str', '(Resource | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_str', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'icon', '(Resource | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_icon', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/reusable/reusable-basic.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/reusable/reusable-basic.test.ts index 733f63063fcfc9167f5bfe0013fcf3d04f463871..9b37af82085df387b41371fec843f6c9fa38a63d 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/reusable/reusable-basic.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/reusable/reusable-basic.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { uiNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -126,24 +127,13 @@ function main() {} } @Component() @Reusable() export interface __Options_Child { - set num(num: (number | undefined)) - - get num(): (number | undefined) - set __backing_num(__backing_num: (IPropRefDecoratedVariable | undefined)) - - get __backing_num(): (IPropRefDecoratedVariable | undefined) - set __options_has_num(__options_has_num: (boolean | undefined)) - - get __options_has_num(): (boolean | undefined) - set num1(num1: (number | undefined)) - - get num1(): (number | undefined) - set __backing_num1(__backing_num1: (IStateDecoratedVariable | undefined)) - - get __backing_num1(): (IStateDecoratedVariable | undefined) - set __options_has_num1(__options_has_num1: (boolean | undefined)) - - get __options_has_num1(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'num', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_num', '(IPropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_num', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'num1', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_num1', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_num1', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/reusable/reusable-complex.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/reusable/reusable-complex.test.ts index 7766bb51cfe7aee827fde8241fac2c1e9485e65c..ed14d8ccca65a9e20ee6ba6ba324fbc540ba9e37 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/reusable/reusable-complex.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/reusable/reusable-complex.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { uiNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -183,28 +184,16 @@ class Message { } @Entry({useSharedStorage:false,storage:"",routeName:""}) @Component() export interface __Options_Index { - set display(display: (boolean | undefined)) - - get display(): (boolean | undefined) - set __backing_display(__backing_display: (IStateDecoratedVariable | undefined)) - - get __backing_display(): (IStateDecoratedVariable | undefined) - set __options_has_display(__options_has_display: (boolean | undefined)) - - get __options_has_display(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'display', '(boolean | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_display', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_display', '(boolean | undefined)')} } @Reusable() @Component() export interface __Options_Child { - set message(message: (Message | undefined)) - - get message(): (Message | undefined) - set __backing_message(__backing_message: (IStateDecoratedVariable | undefined)) - - get __backing_message(): (IStateDecoratedVariable | undefined) - set __options_has_message(__options_has_message: (boolean | undefined)) - - get __options_has_message(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'message', '(Message | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_message', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_message', '(boolean | undefined)')} } diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/state/state-basic-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/state/state-basic-type.test.ts index 5ef1bad98cbaddb260187ded025c9776872c05ea..09b0495509c2202fc7d98b752c1921aaf5062789 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/state/state-basic-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/state/state-basic-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { structNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -125,51 +126,25 @@ function main() {} } @Component() export interface __Options_Parent { - set stateVar1(stateVar1: (string | undefined)) - - get stateVar1(): (string | undefined) - set __backing_stateVar1(__backing_stateVar1: (IStateDecoratedVariable | undefined)) - - get __backing_stateVar1(): (IStateDecoratedVariable | undefined) - set __options_has_stateVar1(__options_has_stateVar1: (boolean | undefined)) - - get __options_has_stateVar1(): (boolean | undefined) - set stateVar2(stateVar2: (number | undefined)) - - get stateVar2(): (number | undefined) - set __backing_stateVar2(__backing_stateVar2: (IStateDecoratedVariable | undefined)) - - get __backing_stateVar2(): (IStateDecoratedVariable | undefined) - set __options_has_stateVar2(__options_has_stateVar2: (boolean | undefined)) - - get __options_has_stateVar2(): (boolean | undefined) - set stateVar3(stateVar3: (boolean | undefined)) - - get stateVar3(): (boolean | undefined) - set __backing_stateVar3(__backing_stateVar3: (IStateDecoratedVariable | undefined)) - - get __backing_stateVar3(): (IStateDecoratedVariable | undefined) - set __options_has_stateVar3(__options_has_stateVar3: (boolean | undefined)) - - get __options_has_stateVar3(): (boolean | undefined) - set stateVar4(stateVar4: (undefined | undefined)) - - get stateVar4(): (undefined | undefined) - set __backing_stateVar4(__backing_stateVar4: (IStateDecoratedVariable | undefined)) - - get __backing_stateVar4(): (IStateDecoratedVariable | undefined) - set __options_has_stateVar4(__options_has_stateVar4: (boolean | undefined)) - - get __options_has_stateVar4(): (boolean | undefined) - set stateVar5(stateVar5: (null | undefined)) - - get stateVar5(): (null | undefined) - set __backing_stateVar5(__backing_stateVar5: (IStateDecoratedVariable | undefined)) - - get __backing_stateVar5(): (IStateDecoratedVariable | undefined) - set __options_has_stateVar5(__options_has_stateVar5: (boolean | undefined)) - - get __options_has_stateVar5(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar1', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar1', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar2', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar2', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar3', '(boolean | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar3', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar3', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar4', '(undefined | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar4', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar4', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar5', '(null | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar5', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar5', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/state/state-complex-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/state/state-complex-type.test.ts index 920170b7e64b596a073b9977f1fc3a3d19975907..d6661d5fb8ff29a7ffda37980fa83bac2f0d69b5 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/state/state-complex-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/state/state-complex-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { structNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -286,114 +287,53 @@ final class StateType extends BaseEnum { } @Component() export interface __Options_Parent { - set stateVar1(stateVar1: (Per | undefined)) - - get stateVar1(): (Per | undefined) - set __backing_stateVar1(__backing_stateVar1: (IStateDecoratedVariable | undefined)) - - get __backing_stateVar1(): (IStateDecoratedVariable | undefined) - set __options_has_stateVar1(__options_has_stateVar1: (boolean | undefined)) - - get __options_has_stateVar1(): (boolean | undefined) - set stateVar2(stateVar2: (Array | undefined)) - - get stateVar2(): (Array | undefined) - set __backing_stateVar2(__backing_stateVar2: (IStateDecoratedVariable> | undefined)) - - get __backing_stateVar2(): (IStateDecoratedVariable> | undefined) - set __options_has_stateVar2(__options_has_stateVar2: (boolean | undefined)) - - get __options_has_stateVar2(): (boolean | undefined) - set stateVar3(stateVar3: (StateType | undefined)) - - get stateVar3(): (StateType | undefined) - set __backing_stateVar3(__backing_stateVar3: (IStateDecoratedVariable | undefined)) - - get __backing_stateVar3(): (IStateDecoratedVariable | undefined) - set __options_has_stateVar3(__options_has_stateVar3: (boolean | undefined)) - - get __options_has_stateVar3(): (boolean | undefined) - set stateVar4(stateVar4: (Set | undefined)) - - get stateVar4(): (Set | undefined) - set __backing_stateVar4(__backing_stateVar4: (IStateDecoratedVariable> | undefined)) - - get __backing_stateVar4(): (IStateDecoratedVariable> | undefined) - set __options_has_stateVar4(__options_has_stateVar4: (boolean | undefined)) - - get __options_has_stateVar4(): (boolean | undefined) - set stateVar5(stateVar5: (Array | undefined)) - - get stateVar5(): (Array | undefined) - set __backing_stateVar5(__backing_stateVar5: (IStateDecoratedVariable> | undefined)) - - get __backing_stateVar5(): (IStateDecoratedVariable> | undefined) - set __options_has_stateVar5(__options_has_stateVar5: (boolean | undefined)) - - get __options_has_stateVar5(): (boolean | undefined) - set stateVar6(stateVar6: (Array | undefined)) - - get stateVar6(): (Array | undefined) - set __backing_stateVar6(__backing_stateVar6: (IStateDecoratedVariable> | undefined)) - - get __backing_stateVar6(): (IStateDecoratedVariable> | undefined) - set __options_has_stateVar6(__options_has_stateVar6: (boolean | undefined)) - - get __options_has_stateVar6(): (boolean | undefined) - set stateVar7(stateVar7: (Array | undefined)) - - get stateVar7(): (Array | undefined) - set __backing_stateVar7(__backing_stateVar7: (IStateDecoratedVariable> | undefined)) - - get __backing_stateVar7(): (IStateDecoratedVariable> | undefined) - set __options_has_stateVar7(__options_has_stateVar7: (boolean | undefined)) - - get __options_has_stateVar7(): (boolean | undefined) - set stateVar8(stateVar8: (((sr: string)=> void) | undefined)) - - get stateVar8(): (((sr: string)=> void) | undefined) - set __backing_stateVar8(__backing_stateVar8: (IStateDecoratedVariable<((sr: string)=> void)> | undefined)) - - get __backing_stateVar8(): (IStateDecoratedVariable<((sr: string)=> void)> | undefined) - set __options_has_stateVar8(__options_has_stateVar8: (boolean | undefined)) - - get __options_has_stateVar8(): (boolean | undefined) - set stateVar9(stateVar9: (Date | undefined)) - - get stateVar9(): (Date | undefined) - set __backing_stateVar9(__backing_stateVar9: (IStateDecoratedVariable | undefined)) - - get __backing_stateVar9(): (IStateDecoratedVariable | undefined) - set __options_has_stateVar9(__options_has_stateVar9: (boolean | undefined)) - - get __options_has_stateVar9(): (boolean | undefined) - set stateVar10(stateVar10: (Map | undefined)) - - get stateVar10(): (Map | undefined) - set __backing_stateVar10(__backing_stateVar10: (IStateDecoratedVariable> | undefined)) - - get __backing_stateVar10(): (IStateDecoratedVariable> | undefined) - set __options_has_stateVar10(__options_has_stateVar10: (boolean | undefined)) - - get __options_has_stateVar10(): (boolean | undefined) - set stateVar11(stateVar11: ((string | number) | undefined)) - - get stateVar11(): ((string | number) | undefined) - set __backing_stateVar11(__backing_stateVar11: (IStateDecoratedVariable<(string | number)> | undefined)) - - get __backing_stateVar11(): (IStateDecoratedVariable<(string | number)> | undefined) - set __options_has_stateVar11(__options_has_stateVar11: (boolean | undefined)) - - get __options_has_stateVar11(): (boolean | undefined) - set stateVar12(stateVar12: ((Set | Per) | undefined)) - - get stateVar12(): ((Set | Per) | undefined) - set __backing_stateVar12(__backing_stateVar12: (IStateDecoratedVariable<(Set | Per)> | undefined)) - - get __backing_stateVar12(): (IStateDecoratedVariable<(Set | Per)> | undefined) - set __options_has_stateVar12(__options_has_stateVar12: (boolean | undefined)) - - get __options_has_stateVar12(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar1', '(Per | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar1', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar1', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar2', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar2', '(IStateDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar2', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar3', '(StateType | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar3', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar3', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar4', '(Set | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar4', '(IStateDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar4', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar5', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar5', '(IStateDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar5', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar6', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar6', '(IStateDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar6', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar7', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar7', '(IStateDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar7', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar8', '(((sr: string)=> void) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar8', '(IStateDecoratedVariable<((sr: string)=> void)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar8', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar9', '(Date | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar9', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar9', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar10', '(Map | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar10', '(IStateDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar10', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar11', '((string | number) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar11', '(IStateDecoratedVariable<(string | number)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar11', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stateVar12', '((Set | Per) | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stateVar12', '(IStateDecoratedVariable<(Set | Per)> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stateVar12', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/state/state-to-state.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/state/state-to-state.test.ts index 1454507a67ee587e191777ea79884b494cd02c4f..c9198623466bce577867bb09e6266a7de3bdd5c2 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/state/state-to-state.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/state/state-to-state.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { uiNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -135,28 +136,16 @@ class Per { } @Component() export interface __Options_Parent { - set parentVar1(parentVar1: (Per | undefined)) - - get parentVar1(): (Per | undefined) - set __backing_parentVar1(__backing_parentVar1: (IStateDecoratedVariable | undefined)) - - get __backing_parentVar1(): (IStateDecoratedVariable | undefined) - set __options_has_parentVar1(__options_has_parentVar1: (boolean | undefined)) - - get __options_has_parentVar1(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'parentVar1', '(Per | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_parentVar1', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_parentVar1', '(boolean | undefined)')} } @Component() export interface __Options_Child { - set childVar1(childVar1: (Per | undefined)) - - get childVar1(): (Per | undefined) - set __backing_childVar1(__backing_childVar1: (IStateDecoratedVariable | undefined)) - - get __backing_childVar1(): (IStateDecoratedVariable | undefined) - set __options_has_childVar1(__options_has_childVar1: (boolean | undefined)) - - get __options_has_childVar1(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'childVar1', '(Per | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_childVar1', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_childVar1', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/storagelink/storagelink-appstorage.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/storagelink/storagelink-appstorage.test.ts index 7307972f914372bcc119cc62a8fb71005f333603..5809128c41c22e8e888f4eda08d995054978723c 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/storagelink/storagelink-appstorage.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/storagelink/storagelink-appstorage.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { uiNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -125,24 +126,13 @@ class Data { } @Entry({useSharedStorage:false,storage:"",routeName:""}) @Component() export interface __Options_Index { - set storageLink(storageLink: (number | undefined)) - - get storageLink(): (number | undefined) - set __backing_storageLink(__backing_storageLink: (IStorageLinkDecoratedVariable | undefined)) - - get __backing_storageLink(): (IStorageLinkDecoratedVariable | undefined) - set __options_has_storageLink(__options_has_storageLink: (boolean | undefined)) - - get __options_has_storageLink(): (boolean | undefined) - set storageLinkObject(storageLinkObject: (Data | undefined)) - - get storageLinkObject(): (Data | undefined) - set __backing_storageLinkObject(__backing_storageLinkObject: (IStorageLinkDecoratedVariable | undefined)) - - get __backing_storageLinkObject(): (IStorageLinkDecoratedVariable | undefined) - set __options_has_storageLinkObject(__options_has_storageLinkObject: (boolean | undefined)) - - get __options_has_storageLinkObject(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'storageLink', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_storageLink', '(IStorageLinkDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_storageLink', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'storageLinkObject', '(Data | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_storageLinkObject', '(IStorageLinkDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_storageLinkObject', '(boolean | undefined)')} } diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/storagelink/storagelink-complex-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/storagelink/storagelink-complex-type.test.ts index 07cf51d725af4167b9c89657c1feaf4f788f04c8..265b6b03c8a4665fae2495b18053cad667bc3648 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/storagelink/storagelink-complex-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/storagelink/storagelink-complex-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { uiNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -223,69 +224,33 @@ final class Status extends BaseEnum { } @Entry({useSharedStorage:false,storage:"",routeName:""}) @Component() export interface __Options_MyStateSample { - set arrayA(arrayA: (Array | undefined)) - - get arrayA(): (Array | undefined) - set __backing_arrayA(__backing_arrayA: (IStorageLinkDecoratedVariable> | undefined)) - - get __backing_arrayA(): (IStorageLinkDecoratedVariable> | undefined) - set __options_has_arrayA(__options_has_arrayA: (boolean | undefined)) - - get __options_has_arrayA(): (boolean | undefined) - set objectA(objectA: (Object | undefined)) - - get objectA(): (Object | undefined) - set __backing_objectA(__backing_objectA: (IStorageLinkDecoratedVariable | undefined)) - - get __backing_objectA(): (IStorageLinkDecoratedVariable | undefined) - set __options_has_objectA(__options_has_objectA: (boolean | undefined)) - - get __options_has_objectA(): (boolean | undefined) - set dateA(dateA: (Date | undefined)) - - get dateA(): (Date | undefined) - set __backing_dateA(__backing_dateA: (IStorageLinkDecoratedVariable | undefined)) - - get __backing_dateA(): (IStorageLinkDecoratedVariable | undefined) - set __options_has_dateA(__options_has_dateA: (boolean | undefined)) - - get __options_has_dateA(): (boolean | undefined) - set setA(setA: (Set | undefined)) - - get setA(): (Set | undefined) - set __backing_setA(__backing_setA: (IStorageLinkDecoratedVariable> | undefined)) - - get __backing_setA(): (IStorageLinkDecoratedVariable> | undefined) - set __options_has_setA(__options_has_setA: (boolean | undefined)) - - get __options_has_setA(): (boolean | undefined) - set mapA(mapA: (Map | undefined)) - - get mapA(): (Map | undefined) - set __backing_mapA(__backing_mapA: (IStorageLinkDecoratedVariable> | undefined)) - - get __backing_mapA(): (IStorageLinkDecoratedVariable> | undefined) - set __options_has_mapA(__options_has_mapA: (boolean | undefined)) - - get __options_has_mapA(): (boolean | undefined) - set classA(classA: (Person | undefined)) - - get classA(): (Person | undefined) - set __backing_classA(__backing_classA: (IStorageLinkDecoratedVariable | undefined)) - - get __backing_classA(): (IStorageLinkDecoratedVariable | undefined) - set __options_has_classA(__options_has_classA: (boolean | undefined)) - - get __options_has_classA(): (boolean | undefined) - set enumA(enumA: (Status | undefined)) - - get enumA(): (Status | undefined) - set __backing_enumA(__backing_enumA: (IStorageLinkDecoratedVariable | undefined)) - - get __backing_enumA(): (IStorageLinkDecoratedVariable | undefined) - set __options_has_enumA(__options_has_enumA: (boolean | undefined)) - - get __options_has_enumA(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'arrayA', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_arrayA', '(IStorageLinkDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_arrayA', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'objectA', '(Object | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_objectA', '(IStorageLinkDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_objectA', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'dateA', '(Date | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_dateA', '(IStorageLinkDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_dateA', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'setA', '(Set | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_setA', '(IStorageLinkDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_setA', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'mapA', '(Map | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_mapA', '(IStorageLinkDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_mapA', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'classA', '(Person | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_classA', '(IStorageLinkDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_classA', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'enumA', '(Status | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_enumA', '(IStorageLinkDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_enumA', '(boolean | undefined)')} } diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/storagelink/storagelink-primitive-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/storagelink/storagelink-primitive-type.test.ts index 439ff46b7210bdf5fb9ff7aceab65527322987cc..7f3ec3c205e09ab1bdfb00d624c95b8999f161d5 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/storagelink/storagelink-primitive-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/storagelink/storagelink-primitive-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { uiNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -104,33 +105,17 @@ __EntryWrapper.RegisterNamedRouter("", new __EntryWrapper(), ({ } @Entry({useSharedStorage:false,storage:"",routeName:""}) @Component() export interface __Options_MyStateSample { - set numA(numA: (number | undefined)) - - get numA(): (number | undefined) - set __backing_numA(__backing_numA: (IStorageLinkDecoratedVariable | undefined)) - - get __backing_numA(): (IStorageLinkDecoratedVariable | undefined) - set __options_has_numA(__options_has_numA: (boolean | undefined)) - - get __options_has_numA(): (boolean | undefined) - set stringA(stringA: (string | undefined)) - - get stringA(): (string | undefined) - set __backing_stringA(__backing_stringA: (IStorageLinkDecoratedVariable | undefined)) - - get __backing_stringA(): (IStorageLinkDecoratedVariable | undefined) - set __options_has_stringA(__options_has_stringA: (boolean | undefined)) - - get __options_has_stringA(): (boolean | undefined) - set booleanA(booleanA: (boolean | undefined)) - - get booleanA(): (boolean | undefined) - set __backing_booleanA(__backing_booleanA: (IStorageLinkDecoratedVariable | undefined)) - - get __backing_booleanA(): (IStorageLinkDecoratedVariable | undefined) - set __options_has_booleanA(__options_has_booleanA: (boolean | undefined)) - - get __options_has_booleanA(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'numA', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_numA', '(IStorageLinkDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_numA', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stringA', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stringA', '(IStorageLinkDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stringA', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'booleanA', '(boolean | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_booleanA', '(IStorageLinkDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_booleanA', '(boolean | undefined)')} } diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/storageprop-ref/storageprop-ref-complex-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/storageprop-ref/storageprop-ref-complex-type.test.ts index 3ecdc503099575b4075d47072aa8d3d0687a11f8..6202824da2cde6a8f98c44e8ee5afc0b833db0c1 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/storageprop-ref/storageprop-ref-complex-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/storageprop-ref/storageprop-ref-complex-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { uiNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -217,69 +218,33 @@ final class Status extends BaseEnum { } @Component() export interface __Options_MyStateSample { - set arrayB(arrayB: (Array | undefined)) - - get arrayB(): (Array | undefined) - set __backing_arrayB(__backing_arrayB: (IStoragePropRefDecoratedVariable> | undefined)) - - get __backing_arrayB(): (IStoragePropRefDecoratedVariable> | undefined) - set __options_has_arrayB(__options_has_arrayB: (boolean | undefined)) - - get __options_has_arrayB(): (boolean | undefined) - set objectB(objectB: (Object | undefined)) - - get objectB(): (Object | undefined) - set __backing_objectB(__backing_objectB: (IStoragePropRefDecoratedVariable | undefined)) - - get __backing_objectB(): (IStoragePropRefDecoratedVariable | undefined) - set __options_has_objectB(__options_has_objectB: (boolean | undefined)) - - get __options_has_objectB(): (boolean | undefined) - set dateB(dateB: (Date | undefined)) - - get dateB(): (Date | undefined) - set __backing_dateB(__backing_dateB: (IStoragePropRefDecoratedVariable | undefined)) - - get __backing_dateB(): (IStoragePropRefDecoratedVariable | undefined) - set __options_has_dateB(__options_has_dateB: (boolean | undefined)) - - get __options_has_dateB(): (boolean | undefined) - set setB(setB: (Set | undefined)) - - get setB(): (Set | undefined) - set __backing_setB(__backing_setB: (IStoragePropRefDecoratedVariable> | undefined)) - - get __backing_setB(): (IStoragePropRefDecoratedVariable> | undefined) - set __options_has_setB(__options_has_setB: (boolean | undefined)) - - get __options_has_setB(): (boolean | undefined) - set mapB(mapB: (Map | undefined)) - - get mapB(): (Map | undefined) - set __backing_mapB(__backing_mapB: (IStoragePropRefDecoratedVariable> | undefined)) - - get __backing_mapB(): (IStoragePropRefDecoratedVariable> | undefined) - set __options_has_mapB(__options_has_mapB: (boolean | undefined)) - - get __options_has_mapB(): (boolean | undefined) - set classB(classB: (Person | undefined)) - - get classB(): (Person | undefined) - set __backing_classB(__backing_classB: (IStoragePropRefDecoratedVariable | undefined)) - - get __backing_classB(): (IStoragePropRefDecoratedVariable | undefined) - set __options_has_classB(__options_has_classB: (boolean | undefined)) - - get __options_has_classB(): (boolean | undefined) - set enumB(enumB: (Status | undefined)) - - get enumB(): (Status | undefined) - set __backing_enumB(__backing_enumB: (IStoragePropRefDecoratedVariable | undefined)) - - get __backing_enumB(): (IStoragePropRefDecoratedVariable | undefined) - set __options_has_enumB(__options_has_enumB: (boolean | undefined)) - - get __options_has_enumB(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'arrayB', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_arrayB', '(IStoragePropRefDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_arrayB', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'objectB', '(Object | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_objectB', '(IStoragePropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_objectB', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'dateB', '(Date | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_dateB', '(IStoragePropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_dateB', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'setB', '(Set | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_setB', '(IStoragePropRefDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_setB', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'mapB', '(Map | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_mapB', '(IStoragePropRefDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_mapB', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'classB', '(Person | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_classB', '(IStoragePropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_classB', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'enumB', '(Status | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_enumB', '(IStoragePropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_enumB', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/storageprop-ref/storageprop-ref-primitive-type.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/storageprop-ref/storageprop-ref-primitive-type.test.ts index 22719b1f62d7dcb5a2ecdb2ee43495dc755b40e6..ad190b6585f191bea45146e323114f688cc3aa92 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/storageprop-ref/storageprop-ref-primitive-type.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/storageprop-ref/storageprop-ref-primitive-type.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { uiNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -120,51 +121,25 @@ function main() {} } @Component() export interface __Options_MyStateSample { - set numB(numB: (number | undefined)) - - get numB(): (number | undefined) - set __backing_numB(__backing_numB: (IStoragePropRefDecoratedVariable | undefined)) - - get __backing_numB(): (IStoragePropRefDecoratedVariable | undefined) - set __options_has_numB(__options_has_numB: (boolean | undefined)) - - get __options_has_numB(): (boolean | undefined) - set stringB(stringB: (string | undefined)) - - get stringB(): (string | undefined) - set __backing_stringB(__backing_stringB: (IStoragePropRefDecoratedVariable | undefined)) - - get __backing_stringB(): (IStoragePropRefDecoratedVariable | undefined) - set __options_has_stringB(__options_has_stringB: (boolean | undefined)) - - get __options_has_stringB(): (boolean | undefined) - set booleanB(booleanB: (boolean | undefined)) - - get booleanB(): (boolean | undefined) - set __backing_booleanB(__backing_booleanB: (IStoragePropRefDecoratedVariable | undefined)) - - get __backing_booleanB(): (IStoragePropRefDecoratedVariable | undefined) - set __options_has_booleanB(__options_has_booleanB: (boolean | undefined)) - - get __options_has_booleanB(): (boolean | undefined) - set undefinedB(undefinedB: (undefined | undefined)) - - get undefinedB(): (undefined | undefined) - set __backing_undefinedB(__backing_undefinedB: (IStoragePropRefDecoratedVariable | undefined)) - - get __backing_undefinedB(): (IStoragePropRefDecoratedVariable | undefined) - set __options_has_undefinedB(__options_has_undefinedB: (boolean | undefined)) - - get __options_has_undefinedB(): (boolean | undefined) - set nullB(nullB: (null | undefined)) - - get nullB(): (null | undefined) - set __backing_nullB(__backing_nullB: (IStoragePropRefDecoratedVariable | undefined)) - - get __backing_nullB(): (IStoragePropRefDecoratedVariable | undefined) - set __options_has_nullB(__options_has_nullB: (boolean | undefined)) - - get __options_has_nullB(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'numB', '(number | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_numB', '(IStoragePropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_numB', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'stringB', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_stringB', '(IStoragePropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_stringB', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'booleanB', '(boolean | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_booleanB', '(IStoragePropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_booleanB', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'undefinedB', '(undefined | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_undefinedB', '(IStoragePropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_undefinedB', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'nullB', '(null | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_nullB', '(IStoragePropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_nullB', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/decorators/watch/watch-basic.test.ts b/arkui-plugins/test/ut/ui-plugins/decorators/watch/watch-basic.test.ts index 84ea8f8769c3bef331612826c5fd2e3d3ddc979a..c4a9f9255dc528fe80fa44ca594683c3b76ae88f 100644 --- a/arkui-plugins/test/ut/ui-plugins/decorators/watch/watch-basic.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/decorators/watch/watch-basic.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../../utils/path-config' import { parseDumpSrc } from '../../../../utils/parse-string'; import { uiNoRecheck, recheck } from '../../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../../utils/shared-types'; +import { dumpAnnotation, dumpGetterSetter, GetSetDumper } from '../../../../utils/simplify-dump'; import { uiTransform } from '../../../../../ui-plugins'; import { Plugins } from '../../../../../common/plugin-context'; @@ -316,82 +317,40 @@ __EntryWrapper.RegisterNamedRouter("", new __EntryWrapper(), ({ @Retention({policy:"SOURCE"}) @interface __Link_intrinsic {} @Entry({useSharedStorage:false,storage:"",routeName:""}) @Component() export interface __Options_MyStateSample { - set statevar(statevar: (string | undefined)) - - get statevar(): (string | undefined) - @Watch({value:"stateOnChange"}) set __backing_statevar(__backing_statevar: (IStateDecoratedVariable | undefined)) - - @Watch({value:"stateOnChange"}) get __backing_statevar(): (IStateDecoratedVariable | undefined) - set __options_has_statevar(__options_has_statevar: (boolean | undefined)) - - get __options_has_statevar(): (boolean | undefined) - set propvar(propvar: (string | undefined)) - - get propvar(): (string | undefined) - @Watch({value:"propOnChange"}) set __backing_propvar(__backing_propvar: (IPropRefDecoratedVariable | undefined)) - - @Watch({value:"propOnChange"}) get __backing_propvar(): (IPropRefDecoratedVariable | undefined) - set __options_has_propvar(__options_has_propvar: (boolean | undefined)) - - get __options_has_propvar(): (boolean | undefined) - @__Link_intrinsic() set linkvar(linkvar: (string | undefined)) - - @__Link_intrinsic() get linkvar(): (string | undefined) - @Watch({value:"linkOnChange"}) set __backing_linkvar(__backing_linkvar: (LinkSourceType | undefined)) - - @Watch({value:"linkOnChange"}) get __backing_linkvar(): (LinkSourceType | undefined) - set __options_has_linkvar(__options_has_linkvar: (boolean | undefined)) - - get __options_has_linkvar(): (boolean | undefined) - set storagelinkvar(storagelinkvar: (string | undefined)) - - get storagelinkvar(): (string | undefined) - @Watch({value:"storageLinkOnChange"}) set __backing_storagelinkvar(__backing_storagelinkvar: (IStorageLinkDecoratedVariable | undefined)) - - @Watch({value:"storageLinkOnChange"}) get __backing_storagelinkvar(): (IStorageLinkDecoratedVariable | undefined) - set __options_has_storagelinkvar(__options_has_storagelinkvar: (boolean | undefined)) - - get __options_has_storagelinkvar(): (boolean | undefined) - set storagepropvar(storagepropvar: (string | undefined)) - - get storagepropvar(): (string | undefined) - @Watch({value:"storagePropOnChange"}) set __backing_storagepropvar(__backing_storagepropvar: (IStoragePropRefDecoratedVariable | undefined)) - - @Watch({value:"storagePropOnChange"}) get __backing_storagepropvar(): (IStoragePropRefDecoratedVariable | undefined) - set __options_has_storagepropvar(__options_has_storagepropvar: (boolean | undefined)) - - get __options_has_storagepropvar(): (boolean | undefined) - set objectlinkvar(objectlinkvar: (A | undefined)) - - get objectlinkvar(): (A | undefined) - @Watch({value:"objectLinkOnChange"}) set __backing_objectlinkvar(__backing_objectlinkvar: (IObjectLinkDecoratedVariable | undefined)) - - @Watch({value:"objectLinkOnChange"}) get __backing_objectlinkvar(): (IObjectLinkDecoratedVariable | undefined) - set __options_has_objectlinkvar(__options_has_objectlinkvar: (boolean | undefined)) - - get __options_has_objectlinkvar(): (boolean | undefined) - set providevar(providevar: (string | undefined)) - - get providevar(): (string | undefined) - @Watch({value:"ProvideOnChange"}) set __backing_providevar(__backing_providevar: (IProvideDecoratedVariable | undefined)) - - @Watch({value:"ProvideOnChange"}) get __backing_providevar(): (IProvideDecoratedVariable | undefined) - set __options_has_providevar(__options_has_providevar: (boolean | undefined)) - - get __options_has_providevar(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'statevar', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_statevar', '(IStateDecoratedVariable | undefined)', [dumpAnnotation('Watch', { value: 'stateOnChange' })])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_statevar', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'propvar', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_propvar', '(IPropRefDecoratedVariable | undefined)', [dumpAnnotation('Watch', { value: 'propOnChange' })])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_propvar', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'linkvar', '(string | undefined)', [dumpAnnotation('__Link_intrinsic')])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_linkvar', '(LinkSourceType | undefined)', [dumpAnnotation('Watch', { value: 'linkOnChange' })])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_linkvar', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'storagelinkvar', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_storagelinkvar', '(IStorageLinkDecoratedVariable | undefined)', [dumpAnnotation('Watch', { value: 'storageLinkOnChange' })])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_storagelinkvar', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'storagepropvar', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_storagepropvar', '(IStoragePropRefDecoratedVariable | undefined)', [dumpAnnotation('Watch', { value: 'storagePropOnChange' })])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_storagepropvar', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'objectlinkvar', '(A | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_objectlinkvar', '(IObjectLinkDecoratedVariable | undefined)', [dumpAnnotation('Watch', { value: 'objectLinkOnChange' })])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_objectlinkvar', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'providevar', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_providevar', '(IProvideDecoratedVariable | undefined)', [dumpAnnotation('Watch', { value: 'ProvideOnChange' })])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_providevar', '(boolean | undefined)')} } @Component() export interface __Options_Child { - set providevar(providevar: (string | undefined)) - - get providevar(): (string | undefined) - @Watch({value:"ConsumeOnChange"}) set __backing_providevar(__backing_providevar: (IConsumeDecoratedVariable | undefined)) - - @Watch({value:"ConsumeOnChange"}) get __backing_providevar(): (IConsumeDecoratedVariable | undefined) - set __options_has_providevar(__options_has_providevar: (boolean | undefined)) - - get __options_has_providevar(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'providevar', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_providevar', '(IConsumeDecoratedVariable | undefined)', [dumpAnnotation('Watch', { value: 'ConsumeOnChange' })])} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_providevar', '(boolean | undefined)')} } diff --git a/arkui-plugins/test/ut/ui-plugins/double-dollar/double-dollar-griditem.test.ts b/arkui-plugins/test/ut/ui-plugins/double-dollar/double-dollar-griditem.test.ts index 87ae59c72f133d9adef7a791a596912351fbe4ac..c41c27191c5191c7b5f99851d8ae96eaef04dcc2 100644 --- a/arkui-plugins/test/ut/ui-plugins/double-dollar/double-dollar-griditem.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/double-dollar/double-dollar-griditem.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../utils/path-config'; import { parseDumpSrc } from '../../../utils/parse-string'; import { uiNoRecheck, recheck } from '../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../utils/simplify-dump'; import { uiTransform } from '../../../../ui-plugins'; import { Plugins } from '../../../../common/plugin-context'; @@ -151,15 +152,9 @@ __EntryWrapper.RegisterNamedRouter("", new __EntryWrapper(), ({ } @Entry({useSharedStorage:false,storage:"",routeName:""}) @Component() export interface __Options_MyStateSample { - set boo(boo: (boolean | undefined)) - - get boo(): (boolean | undefined) - set __backing_boo(__backing_boo: (IStateDecoratedVariable | undefined)) - - get __backing_boo(): (IStateDecoratedVariable | undefined) - set __options_has_boo(__options_has_boo: (boolean | undefined)) - - get __options_has_boo(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'boo', '(boolean | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_boo', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_boo', '(boolean | undefined)')} } diff --git a/arkui-plugins/test/ut/ui-plugins/double-dollar/double-dollar-toggle.test.ts b/arkui-plugins/test/ut/ui-plugins/double-dollar/double-dollar-toggle.test.ts index c3da53f01e5937c93edf0157f196280868d92749..a017a56e53eeab93a517a2cabb8c84284abfae14 100644 --- a/arkui-plugins/test/ut/ui-plugins/double-dollar/double-dollar-toggle.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/double-dollar/double-dollar-toggle.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../utils/path-config'; import { parseDumpSrc } from '../../../utils/parse-string'; import { uiNoRecheck, recheck } from '../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../utils/simplify-dump'; import { uiTransform } from '../../../../ui-plugins'; import { Plugins } from '../../../../common/plugin-context'; @@ -142,24 +143,13 @@ class BooleanClass { } @Component() export interface __Options_MyStateSample { - set boo(boo: (Array | undefined)) - - get boo(): (Array | undefined) - set __backing_boo(__backing_boo: (IStateDecoratedVariable> | undefined)) - - get __backing_boo(): (IStateDecoratedVariable> | undefined) - set __options_has_boo(__options_has_boo: (boolean | undefined)) - - get __options_has_boo(): (boolean | undefined) - set booClass(booClass: (BooleanClass | undefined)) - - get booClass(): (BooleanClass | undefined) - set __backing_booClass(__backing_booClass: (IStateDecoratedVariable | undefined)) - - get __backing_booClass(): (IStateDecoratedVariable | undefined) - set __options_has_booClass(__options_has_booClass: (boolean | undefined)) - - get __options_has_booClass(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'boo', '(Array | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_boo', '(IStateDecoratedVariable> | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_boo', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'booClass', '(BooleanClass | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_booClass', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_booClass', '(boolean | undefined)')} } `; diff --git a/arkui-plugins/test/ut/ui-plugins/imports/kit-import.test.ts b/arkui-plugins/test/ut/ui-plugins/imports/kit-import.test.ts index ff42ad246a199cb7ac12af49fb477c4bcd5ab88a..a5334b186ecd74d780f55f0379366cb12e8059e1 100644 --- a/arkui-plugins/test/ut/ui-plugins/imports/kit-import.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/imports/kit-import.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../utils/path-config'; import { parseDumpSrc } from '../../../utils/parse-string'; import { recheck, uiNoRecheck } from '../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper, ignoreNewLines } from '../../../utils/simplify-dump'; import { uiTransform } from '../../../../ui-plugins'; import { Plugins } from '../../../../common/plugin-context'; @@ -73,12 +74,14 @@ import hilog from "@ohos.hilog"; } @Entry() @Component() export interface __Options_A { + ${ignoreNewLines(` a?: string; @State() __backing_a?: string; __options_has_a?: boolean; b?: string; @PropRef() __backing_b?: string; __options_has_b?: boolean; + `)} } @@ -203,24 +206,13 @@ __EntryWrapper.RegisterNamedRouter("", new __EntryWrapper(), ({ } @Entry({useSharedStorage:false,storage:"",routeName:""}) @Component() export interface __Options_A { - set a(a: (string | undefined)) - - get a(): (string | undefined) - set __backing_a(__backing_a: (IStateDecoratedVariable | undefined)) - - get __backing_a(): (IStateDecoratedVariable | undefined) - set __options_has_a(__options_has_a: (boolean | undefined)) - - get __options_has_a(): (boolean | undefined) - set b(b: (string | undefined)) - - get b(): (string | undefined) - set __backing_b(__backing_b: (IPropRefDecoratedVariable | undefined)) - - get __backing_b(): (IPropRefDecoratedVariable | undefined) - set __options_has_b(__options_has_b: (boolean | undefined)) - - get __options_has_b(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'a', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_a', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_a', '(boolean | undefined)')} + + ${dumpGetterSetter(GetSetDumper.BOTH, 'b', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_b', '(IPropRefDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_b', '(boolean | undefined)')} } diff --git a/arkui-plugins/test/ut/ui-plugins/wrap-builder/builder-in-generic.test.ts b/arkui-plugins/test/ut/ui-plugins/wrap-builder/builder-in-generic.test.ts index 53fb43fa8cfed6e73057a1269afd172f00c1eece..3fec3f20775a5cd29e37fe16d892171fd4c2037f 100644 --- a/arkui-plugins/test/ut/ui-plugins/wrap-builder/builder-in-generic.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/wrap-builder/builder-in-generic.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../utils/path-config'; import { parseDumpSrc } from '../../../utils/parse-string'; import { uiNoRecheck, recheck, memoNoRecheck } from '../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../utils/simplify-dump'; import { uiTransform } from '../../../../ui-plugins'; import { Plugins } from '../../../../common/plugin-context'; @@ -96,12 +97,12 @@ __EntryWrapper.RegisterNamedRouter(\"\", new __EntryWrapper(), ({ instance.setRowOptions(undefined).height("100%").applyAttributesFinish(); return; }), @memo() (() => { - globalBuilder.builder(this.message, 50); + globalBuilder(this.message, 50); ForEachImpl(@memo() ((instance: ForEachAttribute): void => { - instance.setForEachOptions(((): Array void)>> => { + instance.setForEachOptions(((): Array<@Builder() ((value: string, size: number)=> void)> => { return builderArr; - }), @memo() ((item: WrappedBuilder<@Builder() ((value: string, size: number)=> void)>) => { - item.builder("Hello World", 30); + }), @memo() ((item: @Builder() ((value: string, size: number)=> void)) => { + item("Hello World", 30); }), undefined); return; })); @@ -110,12 +111,9 @@ __EntryWrapper.RegisterNamedRouter(\"\", new __EntryWrapper(), ({ public constructor() {} } @Entry({useSharedStorage:false,storage:\"\",routeName:\"\"}) @Component() export interface __Options_Index { - set message(message: (string | undefined)) - get message(): (string | undefined) - set __backing_message(__backing_message: (IStateDecoratedVariable | undefined)) - get __backing_message(): (IStateDecoratedVariable | undefined) - set __options_has_message(__options_has_message: (boolean | undefined)) - get __options_has_message(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'message', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_message', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_message', '(boolean | undefined)')} } class __EntryWrapper extends EntryPoint { @memo() public entry(): void { @@ -136,6 +134,8 @@ import { __memo_context_type as __memo_context_type, __memo_id_type as __memo_id import { STATE_MGMT_FACTORY as STATE_MGMT_FACTORY } from \"arkui.stateManagement.decorator\"; import { IStateDecoratedVariable as IStateDecoratedVariable } from \"arkui.stateManagement.decorator\"; import { RowAttribute as RowAttribute } from \"arkui.component.row\"; +import { ForEachAttribute as ForEachAttribute } from "arkui.component.forEach"; +import { ForEachImpl as ForEachImpl } from "arkui.component.forEach"; import { RowImpl as RowImpl } from "arkui.component.row"; import { MemoSkip as MemoSkip } from "arkui.stateManagement.runtime"; import { memo as memo } from \"arkui.stateManagement.runtime\"; @@ -244,7 +244,7 @@ __EntryWrapper.RegisterNamedRouter(\"\", new __EntryWrapper(), ({ __memo_scope.cached; return; } - globalBuilder.builder(__memo_context, ((__memo_id) + (76711614)), this.message, 50); + globalBuilder(__memo_context, ((__memo_id) + (76711614)), this.message, 50); ForEachImpl(__memo_context, ((__memo_id) + (213687742)), @memo() ((__memo_context: __memo_context_type, __memo_id: __memo_id_type, instance: ForEachAttribute): void => { const __memo_scope = __memo_context.scope(((__memo_id) + (192802443)), 1); const __memo_parameter_instance = __memo_scope.param(0, instance); @@ -252,16 +252,16 @@ __EntryWrapper.RegisterNamedRouter(\"\", new __EntryWrapper(), ({ __memo_scope.cached; return; } - __memo_parameter_instance.value.setForEachOptions(((): Array void)>> => { + __memo_parameter_instance.value.setForEachOptions(((): Array<@Builder() ((__memo_context: __memo_context_type, __memo_id: __memo_id_type, value: string, size: number)=> void)> => { return builderArr; - }), @memo() ((__memo_context: __memo_context_type, __memo_id: __memo_id_type, item: WrappedBuilder<@Builder() ((__memo_context: __memo_context_type, __memo_id: __memo_id_type, value: string, size: number)=> void)>) => { + }), @memo() ((__memo_context: __memo_context_type, __memo_id: __memo_id_type, item: @Builder() ((__memo_context: __memo_context_type, __memo_id: __memo_id_type, value: string, size: number)=> void)) => { const __memo_scope = __memo_context.scope(((__memo_id) + (223657391)), 1); const __memo_parameter_item = __memo_scope.param(0, item); if (__memo_scope.unchanged) { __memo_scope.cached; return; } - item.builder(__memo_context, ((__memo_id) + (218979098)), "Hello World", 30); + item(__memo_context, ((__memo_id) + (218979098)), "Hello World", 30); { __memo_scope.recache(); return; @@ -285,12 +285,9 @@ __EntryWrapper.RegisterNamedRouter(\"\", new __EntryWrapper(), ({ public constructor() {} } @Entry({useSharedStorage:false,storage:\"\",routeName:\"\"}) @Component() export interface __Options_Index { - set message(message: (string | undefined)) - get message(): (string | undefined) - set __backing_message(__backing_message: (IStateDecoratedVariable | undefined)) - get __backing_message(): (IStateDecoratedVariable | undefined) - set __options_has_message(__options_has_message: (boolean | undefined)) - get __options_has_message(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'message', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_message', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_message', '(boolean | undefined)')} } class __EntryWrapper extends EntryPoint { @memo() public entry(__memo_context: __memo_context_type, __memo_id: __memo_id_type): void { diff --git a/arkui-plugins/test/ut/ui-plugins/wrap-builder/wrap-builder-in-generic.test.ts b/arkui-plugins/test/ut/ui-plugins/wrap-builder/wrap-builder-in-generic.test.ts index 4b57f10241efcf2f642605585e0922410fe103bf..0c594e2c3dde89e4db165eb557b2b83eceb42f27 100644 --- a/arkui-plugins/test/ut/ui-plugins/wrap-builder/wrap-builder-in-generic.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/wrap-builder/wrap-builder-in-generic.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../utils/path-config'; import { parseDumpSrc } from '../../../utils/parse-string'; import { uiNoRecheck, recheck, memoNoRecheck } from '../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../utils/simplify-dump'; import { uiTransform } from '../../../../ui-plugins'; import { Plugins } from '../../../../common/plugin-context'; @@ -41,6 +42,8 @@ const expectedUIScript: string = ` import { STATE_MGMT_FACTORY as STATE_MGMT_FACTORY } from \"arkui.stateManagement.decorator\"; import { IStateDecoratedVariable as IStateDecoratedVariable } from \"arkui.stateManagement.decorator\"; import { RowAttribute as RowAttribute } from \"arkui.component.row\"; +import { ForEachAttribute as ForEachAttribute } from "arkui.component.forEach"; +import { ForEachImpl as ForEachImpl } from "arkui.component.forEach"; import { RowImpl as RowImpl } from "arkui.component.row"; import { MemoSkip as MemoSkip } from "arkui.stateManagement.runtime"; import { memo as memo } from \"arkui.stateManagement.runtime\"; @@ -118,15 +121,9 @@ __EntryWrapper.RegisterNamedRouter(\"\", new __EntryWrapper(), ({ } @Entry({useSharedStorage:false,storage:\"\",routeName:\"\"}) @Component() export interface __Options_Index { - set message(message: (string | undefined)) - - get message(): (string | undefined) - set __backing_message(__backing_message: (IStateDecoratedVariable | undefined)) - - get __backing_message(): (IStateDecoratedVariable | undefined) - set __options_has_message(__options_has_message: (boolean | undefined)) - - get __options_has_message(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'message', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_message', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_message', '(boolean | undefined)')} } class __EntryWrapper extends EntryPoint { @@ -148,6 +145,8 @@ import { __memo_context_type as __memo_context_type, __memo_id_type as __memo_id import { STATE_MGMT_FACTORY as STATE_MGMT_FACTORY } from \"arkui.stateManagement.decorator\"; import { IStateDecoratedVariable as IStateDecoratedVariable } from \"arkui.stateManagement.decorator\"; import { RowAttribute as RowAttribute } from \"arkui.component.row\"; +import { ForEachAttribute as ForEachAttribute } from "arkui.component.forEach"; +import { ForEachImpl as ForEachImpl } from "arkui.component.forEach"; import { RowImpl as RowImpl } from "arkui.component.row"; import { MemoSkip as MemoSkip } from "arkui.stateManagement.runtime"; import { memo as memo } from \"arkui.stateManagement.runtime\"; @@ -307,15 +306,9 @@ __EntryWrapper.RegisterNamedRouter(\"\", new __EntryWrapper(), ({ } @Entry({useSharedStorage:false,storage:\"\",routeName:\"\"}) @Component() export interface __Options_Index { - set message(message: (string | undefined)) - - get message(): (string | undefined) - set __backing_message(__backing_message: (IStateDecoratedVariable | undefined)) - - get __backing_message(): (IStateDecoratedVariable | undefined) - set __options_has_message(__options_has_message: (boolean | undefined)) - - get __options_has_message(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'message', '(string | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_message', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_message', '(boolean | undefined)')} } class __EntryWrapper extends EntryPoint { diff --git a/arkui-plugins/test/ut/ui-plugins/wrap-builder/wrap-builder-in-ui.test.ts b/arkui-plugins/test/ut/ui-plugins/wrap-builder/wrap-builder-in-ui.test.ts index 489c9efe92fba07ae7f3af4872784c2928d94e6e..15526f9ce20a4806472f65dfdfc7efb6a0b09b1a 100644 --- a/arkui-plugins/test/ut/ui-plugins/wrap-builder/wrap-builder-in-ui.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/wrap-builder/wrap-builder-in-ui.test.ts @@ -42,6 +42,10 @@ import { ColumnAttribute as ColumnAttribute } from "arkui.component.column"; import { ColumnImpl as ColumnImpl } from "arkui.component.column"; +import { ForEachAttribute as ForEachAttribute } from "arkui.component.forEach"; + +import { ForEachImpl as ForEachImpl } from "arkui.component.forEach"; + import { MemoSkip as MemoSkip } from "arkui.stateManagement.runtime"; import { memo as memo } from "arkui.stateManagement.runtime"; @@ -120,6 +124,10 @@ import { ColumnAttribute as ColumnAttribute } from "arkui.component.column"; import { ColumnImpl as ColumnImpl } from "arkui.component.column"; +import { ForEachAttribute as ForEachAttribute } from "arkui.component.forEach"; + +import { ForEachImpl as ForEachImpl } from "arkui.component.forEach"; + import { MemoSkip as MemoSkip } from "arkui.stateManagement.runtime"; import { memo as memo } from "arkui.stateManagement.runtime"; diff --git a/arkui-plugins/test/ut/ui-plugins/wrap-builder/wrap-builder-with-lambda.test.ts b/arkui-plugins/test/ut/ui-plugins/wrap-builder/wrap-builder-with-lambda.test.ts index 3e49e8632a67b93eff1551127b45cb43cf570573..01d322758acff1216444cc909ecb75b9c428db80 100644 --- a/arkui-plugins/test/ut/ui-plugins/wrap-builder/wrap-builder-with-lambda.test.ts +++ b/arkui-plugins/test/ut/ui-plugins/wrap-builder/wrap-builder-with-lambda.test.ts @@ -20,6 +20,7 @@ import { getRootPath, MOCK_ENTRY_DIR_PATH } from '../../../utils/path-config'; import { parseDumpSrc } from '../../../utils/parse-string'; import { uiNoRecheck, recheck, memoNoRecheck } from '../../../utils/plugins'; import { BuildConfig, PluginTestContext } from '../../../utils/shared-types'; +import { dumpGetterSetter, GetSetDumper } from '../../../utils/simplify-dump'; import { uiTransform } from '../../../../ui-plugins'; import { Plugins } from '../../../../common/plugin-context'; @@ -188,15 +189,9 @@ function main() {} } @Component() export interface __Options_Parent { - set label(label: (Tmp | undefined)) - - get label(): (Tmp | undefined) - set __backing_label(__backing_label: (IStateDecoratedVariable | undefined)) - - get __backing_label(): (IStateDecoratedVariable | undefined) - set __options_has_label(__options_has_label: (boolean | undefined)) - - get __options_has_label(): (boolean | undefined) + ${dumpGetterSetter(GetSetDumper.BOTH, 'label', '(Tmp | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_label', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_label', '(boolean | undefined)')} } `; @@ -430,16 +425,10 @@ function main() {} } @Component() export interface __Options_Parent { - set label(label: (Tmp | undefined)) - - get label(): (Tmp | undefined) - set __backing_label(__backing_label: (IStateDecoratedVariable | undefined)) - - get __backing_label(): (IStateDecoratedVariable | undefined) - set __options_has_label(__options_has_label: (boolean | undefined)) - - get __options_has_label(): (boolean | undefined) - + ${dumpGetterSetter(GetSetDumper.BOTH, 'label', '(Tmp | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__backing_label', '(IStateDecoratedVariable | undefined)')} + ${dumpGetterSetter(GetSetDumper.BOTH, '__options_has_label', '(boolean | undefined)')} + } `; diff --git a/arkui-plugins/test/utils/simplify-dump.ts b/arkui-plugins/test/utils/simplify-dump.ts new file mode 100644 index 0000000000000000000000000000000000000000..26690a38cd92fd7cda58bad2b3c375727f1ebf99 --- /dev/null +++ b/arkui-plugins/test/utils/simplify-dump.ts @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +enum GetSetDumper { + GET, + SET, + BOTH, +} + +function dumpGetterSetter( + getOrSet: GetSetDumper, + name: string, + type: string, + annotations: string[] = [], + body: string | undefined = undefined, + paramAnnotations: string[] = [] +): string { + if (getOrSet === GetSetDumper.BOTH) { + return [ + dumpGetterSetter(GetSetDumper.GET, name, type, annotations, body, paramAnnotations), + dumpGetterSetter(GetSetDumper.SET, name, type, annotations, body, paramAnnotations), + ].join('\n\n'); + } + let methodStr: string; + if (getOrSet === GetSetDumper.GET) { + methodStr = `get ${name}(): ${type}`; + } else { + const paramStr = [...paramAnnotations, name].join(' '); + methodStr = `set ${name}(${paramStr}: ${type})`; + } + const strList: string[] = [...annotations, methodStr, ...(!!body ? [body] : [])]; + return strList.join(' '); +} + +function stringifyWithoutKeyQuotes(obj: Record): string { + const jsonString = JSON.stringify(obj); + return jsonString.replace(/"([^"]+)":/g, '$1:'); +} + +function dumpAnnotation(annotationName: string, properties: Record = {}): string { + const propertyStr: string = Object.keys(properties).length > 0 ? stringifyWithoutKeyQuotes(properties) : ''; + return `@${annotationName}(${propertyStr})`; +} + +function ignoreNewLines(dumpStr: string): string { + return dumpStr.replaceAll(/\n[\s]+/g, ''); +} + +export { GetSetDumper, dumpGetterSetter, dumpAnnotation, ignoreNewLines }; diff --git a/arkui-plugins/ui-plugins/builder-lambda-translators/factory.ts b/arkui-plugins/ui-plugins/builder-lambda-translators/factory.ts index 6bffb9de5fcfd93f46ef6a760851c2a3faf93317..fb5650213c02566e2501d21639e63c31ef2fb1eb 100644 --- a/arkui-plugins/ui-plugins/builder-lambda-translators/factory.ts +++ b/arkui-plugins/ui-plugins/builder-lambda-translators/factory.ts @@ -78,6 +78,7 @@ import { collectMemoableInfoInFunctionReturnType, collectMemoableInfoInParameter, collectScriptFunctionReturnTypeFromInfo, + findCanAddMemoFromArrowFunction, } from '../../collectors/memo-collectors/utils'; import { TypeRecord } from '../../collectors/utils/collect-types'; import { StyleInternalsVisitor } from './style-internals-visitor'; @@ -475,13 +476,15 @@ export class factory { static createOrUpdateArgInBuilderLambda( fallback: arkts.AstNode | undefined, arg: arkts.Expression | undefined, - canAddMemo?: boolean, + param: arkts.Expression, declInfo?: BuilderLambdaDeclInfo ): arkts.AstNode | undefined { if (!arg) { return fallback; } if (arkts.isArrowFunctionExpression(arg)) { + const memoableInfo = collectMemoableInfoInParameter(param); + const canAddMemo = findCanAddMemoFromArrowFunction(arg) || checkIsMemoFromMemoableInfo(memoableInfo, false); const newNode = this.processArgArrowFunction(arg, canAddMemo); if (canAddMemo) { addMemoAnnotation(newNode); @@ -498,9 +501,9 @@ export class factory { static createSecondLastArgInBuilderLambda(argInfo: BuilderLambdaSecondLastArgInfo): arkts.AstNode | undefined { if (!!argInfo.isReusable && !!argInfo.reuseId) { const reuseIdNode = arkts.factory.createStringLiteral(argInfo.reuseId); - return this.createOrUpdateArgInBuilderLambda(reuseIdNode, undefined, undefined); + return reuseIdNode; } else if (!argInfo.isFunctionCall) { - return this.createOrUpdateArgInBuilderLambda(arkts.factory.createUndefinedLiteral(), undefined, undefined); + return arkts.factory.createUndefinedLiteral(); } return undefined; } @@ -530,10 +533,8 @@ export class factory { modifiedArg = this.createSecondLastArgInBuilderLambda(secondLastArgInfo); } if (!modifiedArg) { - const memoableInfo = collectMemoableInfoInParameter(param); - const canAddMemo = checkIsMemoFromMemoableInfo(memoableInfo, false); const fallback = arkts.factory.createUndefinedLiteral(); - const updatedArg = this.createOrUpdateArgInBuilderLambda(fallback, arg, canAddMemo, declInfo); + const updatedArg = this.createOrUpdateArgInBuilderLambda(fallback, arg, param, declInfo); modifiedArg = factory.processModifiedArg(updatedArg, index, leaf.arguments, moduleName, type?.name); } const shouldInsertToArgs = !isFunctionCall || (index === params.length - 1 && hasLastTrailingLambda); diff --git a/arkui-plugins/ui-plugins/property-translators/builderParam.ts b/arkui-plugins/ui-plugins/property-translators/builderParam.ts index 40b3a54ea1c4d3043f8fb38482805ca38170f3e3..b7619dd0de4032b1009e92a3cee25a34dc6a60c2 100644 --- a/arkui-plugins/ui-plugins/property-translators/builderParam.ts +++ b/arkui-plugins/ui-plugins/property-translators/builderParam.ts @@ -15,7 +15,7 @@ import * as arkts from '@koalaui/libarkts'; -import { backingField, expectName } from '../../common/arkts-utils'; +import { backingField, expectName, flatVisitMethodWithOverloads } from '../../common/arkts-utils'; import { DecoratorNames } from '../../common/predefines'; import { createGetter, createSetter, generateThisBacking, hasDecorator, removeDecorator } from './utils'; import { InterfacePropertyTranslator, InterfacePropertyTypes, PropertyTranslator } from './base'; @@ -111,7 +111,7 @@ export class BuilderParamInterfaceTranslator e translateProperty(): T { if (arkts.isMethodDefinition(this.property)) { this.modified = true; - return this.updateBuilderParamMethodInInterface(this.property) as T; + return flatVisitMethodWithOverloads(this.property, this.updateBuilderParamMethodInInterface) as T; } else if (arkts.isClassProperty(this.property)) { this.modified = true; return this.updateBuilderParamPropertyInInterface(this.property) as T; @@ -139,13 +139,6 @@ export class BuilderParamInterfaceTranslator e if (!!type && (arkts.isETSFunctionType(type) || arkts.isETSUnionType(type))) { addMemoAnnotation(type); } - const newOverLoads = method.overloads.map((overload) => { - if (arkts.isMethodDefinition(overload)) { - return this.updateBuilderParamMethodInInterface(overload); - } - return overload; - }); - method.setOverloads(newOverLoads); removeDecorator(method, DecoratorNames.BUILDER_PARAM); arkts.NodeCache.getInstance().collect(method, { isGetter: true }); } else if (method.kind === arkts.Es2pandaMethodDefinitionKind.METHOD_DEFINITION_KIND_SET) { diff --git a/arkui-plugins/ui-plugins/property-translators/computed.ts b/arkui-plugins/ui-plugins/property-translators/computed.ts index 8e5cc573ae2be4963a059f43fc84770b530ca3e9..1777a36208896bbb2389a1cead345b74c01e2d59 100644 --- a/arkui-plugins/ui-plugins/property-translators/computed.ts +++ b/arkui-plugins/ui-plugins/property-translators/computed.ts @@ -17,8 +17,9 @@ import * as arkts from '@koalaui/libarkts'; import { expectName } from '../../common/arkts-utils'; import { GetSetTypes, StateManagementTypes } from '../../common/predefines'; +import { AbstractVisitor } from '../../common/abstract-visitor'; import { ClassInfo, computedField } from '../utils'; -import { generateThisBacking, generateGetOrSetCall, getGetterReturnType } from './utils'; +import { generateThisBacking, generateGetOrSetCall } from './utils'; import { MethodTranslator } from './base'; import { InitializerConstructor } from './types'; import { factory as UIFactory } from '../ui-factory'; @@ -86,3 +87,48 @@ export class ComputedTranslator extends MethodTranslator implements InitializerC return generateGetOrSetCall(thisValue, GetSetTypes.GET); } } + +function getGetterReturnType(method: arkts.MethodDefinition): arkts.TypeNode | undefined { + const body = method.scriptFunction.body; + if (!body || !arkts.isBlockStatement(body) || body.statements.length <= 0) { + return undefined; + } + let returnType: arkts.TypeNode | undefined = undefined; + const returnTransformer = new ReturnTransformer(); + returnTransformer.visitor(body); + const typeArray = returnTransformer.types; + if (typeArray.length <= 0) { + returnType = undefined; + } else if (typeArray.length === 1) { + returnType = typeArray.at(0); + } else { + returnType = arkts.factory.createUnionType(typeArray); + } + returnTransformer.reset(); + return returnType?.clone(); +} + +class ReturnTransformer extends AbstractVisitor { + private _types: arkts.TypeNode[] = []; + + reset(): void { + super.reset(); + this._types = []; + } + + visitor(beforeChildren: arkts.AstNode): arkts.AstNode { + const node = this.visitEachChild(beforeChildren); + if (arkts.isReturnStatement(node) && node.argument) { + const type = arkts.createTypeNodeFromTsType(node.argument); + if (!!type && arkts.isTypeNode(type)) { + this._types.push(type); + } + return node; + } + return node; + } + + get types(): arkts.TypeNode[] { + return this._types; + } +} diff --git a/arkui-plugins/ui-plugins/property-translators/consume.ts b/arkui-plugins/ui-plugins/property-translators/consume.ts index 52f38c6fa53ffe1f7668a1aa7d8d67c8d846b4cd..ab60f984620175dae9acf17a214b719892a09011 100644 --- a/arkui-plugins/ui-plugins/property-translators/consume.ts +++ b/arkui-plugins/ui-plugins/property-translators/consume.ts @@ -15,7 +15,7 @@ import * as arkts from '@koalaui/libarkts'; -import { backingField, expectName } from '../../common/arkts-utils'; +import { backingField, expectName, flatVisitMethodWithOverloads } from '../../common/arkts-utils'; import { DecoratorNames, GetSetTypes, StateManagementTypes } from '../../common/predefines'; import { generateToRecord, @@ -103,7 +103,7 @@ export class ConsumeInterfaceTranslator extend translateProperty(): T { if (arkts.isMethodDefinition(this.property)) { this.modified = true; - return this.updateStateMethodInInterface(this.property) as T; + return flatVisitMethodWithOverloads(this.property, this.updateStateMethodInInterface) as T; } else if (arkts.isClassProperty(this.property)) { this.modified = true; return this.updateStatePropertyInInterface(this.property) as T; diff --git a/arkui-plugins/ui-plugins/property-translators/consumer.ts b/arkui-plugins/ui-plugins/property-translators/consumer.ts index ccfb63461aebc739a052439144d73cf48c5aad62..a645d581188f9796e4fd3ed3f67a28febb53fc67 100644 --- a/arkui-plugins/ui-plugins/property-translators/consumer.ts +++ b/arkui-plugins/ui-plugins/property-translators/consumer.ts @@ -15,7 +15,7 @@ import * as arkts from '@koalaui/libarkts'; -import { backingField, expectName } from '../../common/arkts-utils'; +import { backingField, expectName, flatVisitMethodWithOverloads } from '../../common/arkts-utils'; import { DecoratorNames, GetSetTypes, StateManagementTypes } from '../../common/predefines'; import { createGetter, @@ -98,7 +98,7 @@ export class ConsumerInterfaceTranslator exten translateProperty(): T { if (arkts.isMethodDefinition(this.property)) { this.modified = true; - return this.updateStateMethodInInterface(this.property) as T; + return flatVisitMethodWithOverloads(this.property, this.updateStateMethodInInterface) as T; } else if (arkts.isClassProperty(this.property)) { this.modified = true; return this.updateStatePropertyInInterface(this.property) as T; diff --git a/arkui-plugins/ui-plugins/property-translators/factory.ts b/arkui-plugins/ui-plugins/property-translators/factory.ts index 4e1d043164c21761d7ec27e2f83456914befccc0..5bca64afe1fbef7451c7aad43aeec25128f86f13 100644 --- a/arkui-plugins/ui-plugins/property-translators/factory.ts +++ b/arkui-plugins/ui-plugins/property-translators/factory.ts @@ -711,30 +711,28 @@ export class factory { decorator: DecoratorNames ): arkts.MethodDefinition { if (method.kind === arkts.Es2pandaMethodDefinitionKind.METHOD_DEFINITION_KIND_GET) { + const func = method.scriptFunction; const newType: arkts.TypeNode | undefined = factory.wrapStateManagementTypeToType( - method.scriptFunction.returnTypeAnnotation, + func.returnTypeAnnotation, decorator ); - const newOverLoads = method.overloads.map((overload) => { - if (arkts.isMethodDefinition(overload)) { - return factory.wrapStateManagementTypeToMethodInInterface(overload, decorator); - } - return overload; - }); - method.setOverloads(newOverLoads); removeDecorator(method, decorator); if (!!newType) { - method.scriptFunction.setReturnTypeAnnotation(newType); + func.setReturnTypeAnnotation(newType); } - } else if (method.kind === arkts.Es2pandaMethodDefinitionKind.METHOD_DEFINITION_KIND_SET) { + return method; + } + if (method.kind === arkts.Es2pandaMethodDefinitionKind.METHOD_DEFINITION_KIND_SET) { + const func = method.scriptFunction; const newParam: arkts.Expression | undefined = factory.wrapStateManagementTypeToParam( method.scriptFunction.params.at(0), decorator ); removeDecorator(method, decorator); if (!!newParam) { - return UIFactory.updateMethodDefinition(method, { function: { params: [newParam] } }); + func.setParams([newParam]); } + return method; } return method; } diff --git a/arkui-plugins/ui-plugins/property-translators/link.ts b/arkui-plugins/ui-plugins/property-translators/link.ts index cd1b149bd59d5ec759e56f6889dbd8bec0e1253a..edc9b4d3cc549b571da08c80259b6bc775fa68b8 100644 --- a/arkui-plugins/ui-plugins/property-translators/link.ts +++ b/arkui-plugins/ui-plugins/property-translators/link.ts @@ -15,7 +15,7 @@ import * as arkts from '@koalaui/libarkts'; -import { backingField, expectName } from '../../common/arkts-utils'; +import { backingField, expectName, flatVisitMethodWithOverloads } from '../../common/arkts-utils'; import { DecoratorNames, GetSetTypes, StateManagementTypes } from '../../common/predefines'; import { CustomComponentNames, optionsHasField } from '../utils'; import { @@ -122,7 +122,7 @@ export class LinkInterfaceTranslator extends I translateProperty(): T { if (arkts.isMethodDefinition(this.property)) { this.modified = true; - return this.updateStateMethodInInterface(this.property) as T; + return flatVisitMethodWithOverloads(this.property, this.updateStateMethodInInterface) as T; } else if (arkts.isClassProperty(this.property)) { this.modified = true; return this.updateStatePropertyInInterface(this.property) as T; diff --git a/arkui-plugins/ui-plugins/property-translators/local.ts b/arkui-plugins/ui-plugins/property-translators/local.ts index 84a76401ef8c85ece2e07179945637ce804efdb1..bdd9b2899cea60ce7f587330ab8a8cc9eebbad0c 100644 --- a/arkui-plugins/ui-plugins/property-translators/local.ts +++ b/arkui-plugins/ui-plugins/property-translators/local.ts @@ -15,7 +15,7 @@ import * as arkts from '@koalaui/libarkts'; -import { backingField, expectName } from '../../common/arkts-utils'; +import { backingField, expectName, flatVisitMethodWithOverloads } from '../../common/arkts-utils'; import { DecoratorNames, GetSetTypes, StateManagementTypes } from '../../common/predefines'; import { createGetter, @@ -135,7 +135,7 @@ export class LocalInterfaceTranslator extends translateProperty(): T { if (arkts.isMethodDefinition(this.property)) { this.modified = true; - return this.updateStateMethodInInterface(this.property) as T; + return flatVisitMethodWithOverloads(this.property, this.updateStateMethodInInterface) as T; } else if (arkts.isClassProperty(this.property)) { this.modified = true; return this.updateStatePropertyInInterface(this.property) as T; diff --git a/arkui-plugins/ui-plugins/property-translators/localStoragePropRef.ts b/arkui-plugins/ui-plugins/property-translators/localStoragePropRef.ts index 1f1909c4545e558475ee9469d520b6e45996d0ae..f7fe9dddc3771136de1c3115ba487b9e0af9674b 100644 --- a/arkui-plugins/ui-plugins/property-translators/localStoragePropRef.ts +++ b/arkui-plugins/ui-plugins/property-translators/localStoragePropRef.ts @@ -15,7 +15,7 @@ import * as arkts from '@koalaui/libarkts'; -import { backingField, expectName } from '../../common/arkts-utils'; +import { backingField, expectName, flatVisitMethodWithOverloads } from '../../common/arkts-utils'; import { DecoratorNames, GetSetTypes, StateManagementTypes } from '../../common/predefines'; import { InterfacePropertyTranslator, InterfacePropertyTypes, PropertyTranslator } from './base'; import { GetterSetter, InitializerConstructor } from './types'; @@ -118,7 +118,7 @@ export class LocalStoragePropRefInterfaceTranslator< translateProperty(): T { if (arkts.isMethodDefinition(this.property)) { this.modified = true; - return this.updateStateMethodInInterface(this.property) as T; + return flatVisitMethodWithOverloads(this.property, this.updateStateMethodInInterface) as T; } else if (arkts.isClassProperty(this.property)) { this.modified = true; return this.updateStatePropertyInInterface(this.property) as T; diff --git a/arkui-plugins/ui-plugins/property-translators/localstoragelink.ts b/arkui-plugins/ui-plugins/property-translators/localstoragelink.ts index da1c0787ecb3602fce78881d033521a9a3bbde0a..3b477dea02e220fc31e0adc6cf9a3d8a5d9bea0d 100755 --- a/arkui-plugins/ui-plugins/property-translators/localstoragelink.ts +++ b/arkui-plugins/ui-plugins/property-translators/localstoragelink.ts @@ -15,7 +15,7 @@ import * as arkts from '@koalaui/libarkts'; -import { backingField, expectName } from '../../common/arkts-utils'; +import { backingField, expectName, flatVisitMethodWithOverloads } from '../../common/arkts-utils'; import { DecoratorNames, GetSetTypes, StateManagementTypes } from '../../common/predefines'; import { InterfacePropertyTranslator, InterfacePropertyTypes, PropertyTranslator } from './base'; import { GetterSetter, InitializerConstructor } from './types'; @@ -118,7 +118,7 @@ export class LocalStorageLinkInterfaceTranslator< translateProperty(): T { if (arkts.isMethodDefinition(this.property)) { this.modified = true; - return this.updateStateMethodInInterface(this.property) as T; + return flatVisitMethodWithOverloads(this.property, this.updateStateMethodInInterface) as T; } else if (arkts.isClassProperty(this.property)) { this.modified = true; return this.updateStatePropertyInInterface(this.property) as T; diff --git a/arkui-plugins/ui-plugins/property-translators/objectlink.ts b/arkui-plugins/ui-plugins/property-translators/objectlink.ts index 9e1612ad294597e496bf85af1afac216f905da36..133192ee8fd3a6e6203897e457f31b1280be77d4 100644 --- a/arkui-plugins/ui-plugins/property-translators/objectlink.ts +++ b/arkui-plugins/ui-plugins/property-translators/objectlink.ts @@ -15,7 +15,7 @@ import * as arkts from '@koalaui/libarkts'; -import { backingField, expectName } from '../../common/arkts-utils'; +import { backingField, expectName, flatVisitMethodWithOverloads } from '../../common/arkts-utils'; import { DecoratorNames, GetSetTypes, StateManagementTypes } from '../../common/predefines'; import { CustomComponentNames } from '../utils'; import { createGetter, generateGetOrSetCall, generateThisBacking, generateToRecord, hasDecorator } from './utils'; @@ -109,7 +109,7 @@ export class ObjectLinkInterfaceTranslator ext translateProperty(): T { if (arkts.isMethodDefinition(this.property)) { this.modified = true; - return this.updateStateMethodInInterface(this.property) as T; + return flatVisitMethodWithOverloads(this.property, this.updateStateMethodInInterface) as T; } else if (arkts.isClassProperty(this.property)) { this.modified = true; return this.updateStatePropertyInInterface(this.property) as T; diff --git a/arkui-plugins/ui-plugins/property-translators/once.ts b/arkui-plugins/ui-plugins/property-translators/once.ts index df0468990e8c9782fd8635a6cc10fd423a21783d..1af0383aebacc7a94b1695faa987ec8b57a9e286 100644 --- a/arkui-plugins/ui-plugins/property-translators/once.ts +++ b/arkui-plugins/ui-plugins/property-translators/once.ts @@ -15,7 +15,7 @@ import * as arkts from '@koalaui/libarkts'; -import { backingField, expectName } from '../../common/arkts-utils'; +import { backingField, expectName, flatVisitMethodWithOverloads } from '../../common/arkts-utils'; import { DecoratorNames, GetSetTypes, StateManagementTypes } from '../../common/predefines'; import { CustomComponentNames } from '../utils'; import { @@ -101,7 +101,7 @@ export class OnceInterfaceTranslator extends I translateProperty(): T { if (arkts.isMethodDefinition(this.property)) { this.modified = true; - return this.updateStateMethodInInterface(this.property) as T; + return flatVisitMethodWithOverloads(this.property, this.updateStateMethodInInterface) as T; } else if (arkts.isClassProperty(this.property)) { this.modified = true; return this.updateStatePropertyInInterface(this.property) as T; diff --git a/arkui-plugins/ui-plugins/property-translators/param.ts b/arkui-plugins/ui-plugins/property-translators/param.ts index 95caf467a11ca75b30bf0f353c1254db96b43643..e6b64bfe401a480b792b26786a1e3ee3462214bb 100644 --- a/arkui-plugins/ui-plugins/property-translators/param.ts +++ b/arkui-plugins/ui-plugins/property-translators/param.ts @@ -15,7 +15,7 @@ import * as arkts from '@koalaui/libarkts'; -import { backingField, expectName } from '../../common/arkts-utils'; +import { backingField, expectName, flatVisitMethodWithOverloads } from '../../common/arkts-utils'; import { DecoratorNames, GetSetTypes, StateManagementTypes } from '../../common/predefines'; import { CustomComponentNames } from '../utils'; import { @@ -108,7 +108,7 @@ export class ParamInterfaceTranslator extends translateProperty(): T { if (arkts.isMethodDefinition(this.property)) { this.modified = true; - return this.updateStateMethodInInterface(this.property) as T; + return flatVisitMethodWithOverloads(this.property, this.updateStateMethodInInterface) as T; } else if (arkts.isClassProperty(this.property)) { this.modified = true; return this.updateStatePropertyInInterface(this.property) as T; diff --git a/arkui-plugins/ui-plugins/property-translators/propRef.ts b/arkui-plugins/ui-plugins/property-translators/propRef.ts index 750b1a5d9e3bb559e8b93ffb9172659b895f0a96..e8447835d71be94b9ce5a87691c0a1043faed4db 100644 --- a/arkui-plugins/ui-plugins/property-translators/propRef.ts +++ b/arkui-plugins/ui-plugins/property-translators/propRef.ts @@ -15,7 +15,7 @@ import * as arkts from '@koalaui/libarkts'; -import { backingField, expectName } from '../../common/arkts-utils'; +import { backingField, expectName, flatVisitMethodWithOverloads } from '../../common/arkts-utils'; import { DecoratorNames, GetSetTypes, StateManagementTypes } from '../../common/predefines'; import { CustomComponentNames } from '../utils'; import { @@ -129,7 +129,7 @@ export class PropRefInterfaceTranslator extend translateProperty(): T { if (arkts.isMethodDefinition(this.property)) { this.modified = true; - return this.updateStateMethodInInterface(this.property) as T; + return flatVisitMethodWithOverloads(this.property, this.updateStateMethodInInterface) as T; } else if (arkts.isClassProperty(this.property)) { this.modified = true; return this.updateStatePropertyInInterface(this.property) as T; diff --git a/arkui-plugins/ui-plugins/property-translators/provide.ts b/arkui-plugins/ui-plugins/property-translators/provide.ts index 84a84a4f7c2a08310d7abde697317dd8673f4307..ea50f8807c6a225bf93155d9ca543e8cb5e8a98f 100644 --- a/arkui-plugins/ui-plugins/property-translators/provide.ts +++ b/arkui-plugins/ui-plugins/property-translators/provide.ts @@ -15,7 +15,7 @@ import * as arkts from '@koalaui/libarkts'; -import { backingField, expectName } from '../../common/arkts-utils'; +import { backingField, expectName, flatVisitMethodWithOverloads } from '../../common/arkts-utils'; import { DecoratorNames, GetSetTypes, StateManagementTypes } from '../../common/predefines'; import { CustomComponentNames } from '../utils'; import { @@ -108,7 +108,7 @@ export class ProvideInterfaceTranslator extend translateProperty(): T { if (arkts.isMethodDefinition(this.property)) { this.modified = true; - return this.updateStateMethodInInterface(this.property) as T; + return flatVisitMethodWithOverloads(this.property, this.updateStateMethodInInterface) as T; } else if (arkts.isClassProperty(this.property)) { this.modified = true; return this.updateStatePropertyInInterface(this.property) as T; diff --git a/arkui-plugins/ui-plugins/property-translators/provider.ts b/arkui-plugins/ui-plugins/property-translators/provider.ts index 1b70ff77dc188461c7e46f6cecd9aaa7585a0571..0a157a4913e8dffa71336b4b29d3466021e76574 100644 --- a/arkui-plugins/ui-plugins/property-translators/provider.ts +++ b/arkui-plugins/ui-plugins/property-translators/provider.ts @@ -15,7 +15,7 @@ import * as arkts from '@koalaui/libarkts'; -import { backingField, expectName } from '../../common/arkts-utils'; +import { backingField, expectName, flatVisitMethodWithOverloads } from '../../common/arkts-utils'; import { DecoratorNames, GetSetTypes, StateManagementTypes } from '../../common/predefines'; import { createGetter, @@ -98,7 +98,7 @@ export class ProviderInterfaceTranslator exten translateProperty(): T { if (arkts.isMethodDefinition(this.property)) { this.modified = true; - return this.updateStateMethodInInterface(this.property) as T; + return flatVisitMethodWithOverloads(this.property, this.updateStateMethodInInterface) as T; } else if (arkts.isClassProperty(this.property)) { this.modified = true; return this.updateStatePropertyInInterface(this.property) as T; diff --git a/arkui-plugins/ui-plugins/property-translators/return-transformer.ts b/arkui-plugins/ui-plugins/property-translators/return-transformer.ts deleted file mode 100644 index bdc1a536e91dca94b0080d07ccc8068f7e148b92..0000000000000000000000000000000000000000 --- a/arkui-plugins/ui-plugins/property-translators/return-transformer.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2022-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import * as arkts from '@koalaui/libarkts'; -import { AbstractVisitor } from '../../common/abstract-visitor'; - -export class ReturnTransformer extends AbstractVisitor { - private _types: arkts.TypeNode[] = []; - - reset(): void { - super.reset(); - this._types = []; - } - - visitor(beforeChildren: arkts.AstNode): arkts.AstNode { - const node = this.visitEachChild(beforeChildren); - if (arkts.isReturnStatement(node) && node.argument) { - const type = arkts.createTypeNodeFromTsType(node.argument); - if (!!type && arkts.isTypeNode(type)) { - this._types.push(type); - } - return node; - } - return node; - } - - get types(): arkts.TypeNode[] { - return this._types; - } -} diff --git a/arkui-plugins/ui-plugins/property-translators/state.ts b/arkui-plugins/ui-plugins/property-translators/state.ts index 20df22709c73a8de83689a51bad060c8368cc84c..565a024359592c70fc4d5b508f8b2551e5168181 100644 --- a/arkui-plugins/ui-plugins/property-translators/state.ts +++ b/arkui-plugins/ui-plugins/property-translators/state.ts @@ -15,7 +15,7 @@ import * as arkts from '@koalaui/libarkts'; -import { backingField, expectName } from '../../common/arkts-utils'; +import { backingField, expectName, flatVisitMethodWithOverloads } from '../../common/arkts-utils'; import { DecoratorNames, GetSetTypes, StateManagementTypes } from '../../common/predefines'; import { CustomComponentNames } from '../utils'; import { @@ -103,7 +103,7 @@ export class StateInterfaceTranslator extends translateProperty(): T { if (arkts.isMethodDefinition(this.property)) { this.modified = true; - return this.updateStateMethodInInterface(this.property) as T; + return flatVisitMethodWithOverloads(this.property, this.updateStateMethodInInterface) as T; } else if (arkts.isClassProperty(this.property)) { this.modified = true; return this.updateStatePropertyInInterface(this.property) as T; diff --git a/arkui-plugins/ui-plugins/property-translators/storagePropRef.ts b/arkui-plugins/ui-plugins/property-translators/storagePropRef.ts index a27aa4be09f793d6b1fbf656e93da672cfd23918..5203e623f017ccb22066fc4f242c360ba09e3c17 100644 --- a/arkui-plugins/ui-plugins/property-translators/storagePropRef.ts +++ b/arkui-plugins/ui-plugins/property-translators/storagePropRef.ts @@ -15,7 +15,7 @@ import * as arkts from '@koalaui/libarkts'; -import { backingField, expectName } from '../../common/arkts-utils'; +import { backingField, expectName, flatVisitMethodWithOverloads } from '../../common/arkts-utils'; import { DecoratorNames, GetSetTypes, StateManagementTypes } from '../../common/predefines'; import { InterfacePropertyTranslator, InterfacePropertyTypes, PropertyTranslator } from './base'; import { GetterSetter, InitializerConstructor } from './types'; @@ -119,7 +119,7 @@ export class StoragePropRefInterfaceTranslator< translateProperty(): T { if (arkts.isMethodDefinition(this.property)) { this.modified = true; - return this.updateStateMethodInInterface(this.property) as T; + return flatVisitMethodWithOverloads(this.property, this.updateStateMethodInInterface) as T; } else if (arkts.isClassProperty(this.property)) { this.modified = true; return this.updateStatePropertyInInterface(this.property) as T; diff --git a/arkui-plugins/ui-plugins/property-translators/storagelink.ts b/arkui-plugins/ui-plugins/property-translators/storagelink.ts index e90016c3c3650dfef416ca4d4aefb46446b5c6a1..bb0812c757cc8fb8273ce83814e00a184547394a 100644 --- a/arkui-plugins/ui-plugins/property-translators/storagelink.ts +++ b/arkui-plugins/ui-plugins/property-translators/storagelink.ts @@ -15,7 +15,7 @@ import * as arkts from '@koalaui/libarkts'; -import { backingField, expectName } from '../../common/arkts-utils'; +import { backingField, expectName, flatVisitMethodWithOverloads } from '../../common/arkts-utils'; import { DecoratorNames, GetSetTypes, StateManagementTypes } from '../../common/predefines'; import { InterfacePropertyTranslator, InterfacePropertyTypes, PropertyTranslator } from './base'; import { GetterSetter, InitializerConstructor } from './types'; @@ -111,7 +111,7 @@ export class StorageLinkInterfaceTranslator ex translateProperty(): T { if (arkts.isMethodDefinition(this.property)) { this.modified = true; - return this.updateStateMethodInInterface(this.property) as T; + return flatVisitMethodWithOverloads(this.property, this.updateStateMethodInInterface) as T; } else if (arkts.isClassProperty(this.property)) { this.modified = true; return this.updateStatePropertyInInterface(this.property) as T; diff --git a/arkui-plugins/ui-plugins/property-translators/utils.ts b/arkui-plugins/ui-plugins/property-translators/utils.ts index 186a353bcb528ba02f6fc86199a908403bd5d3f3..3a298cef7fdcbbd1bb20ea4c7fc271914488a892 100644 --- a/arkui-plugins/ui-plugins/property-translators/utils.ts +++ b/arkui-plugins/ui-plugins/property-translators/utils.ts @@ -29,7 +29,6 @@ import { findCanAddMemoFromTypeAnnotation, } from '../../collectors/memo-collectors/utils'; import { CustomDialogNames } from '../utils'; -import { ReturnTransformer } from './return-transformer'; export interface DecoratorInfo { annotation: arkts.AnnotationUsage; @@ -66,26 +65,6 @@ export function removeDecorator( } } -export function getGetterReturnType(method: arkts.MethodDefinition): arkts.TypeNode | undefined { - const body = method.scriptFunction.body; - if (!body || !arkts.isBlockStatement(body) || body.statements.length <= 0) { - return undefined; - } - let returnType: arkts.TypeNode | undefined = undefined; - const returnTransformer = new ReturnTransformer(); - returnTransformer.visitor(body); - const typeArray = returnTransformer.types; - if (typeArray.length <= 0) { - returnType = undefined; - } else if (typeArray.length === 1) { - returnType = typeArray.at(0); - } else { - returnType = arkts.factory.createUnionType(typeArray); - } - returnTransformer.reset(); - return returnType?.clone(); -} - /** * checking whether astNode's annotations contain given corresponding decorator name, * regardless where the annotation's declaration is from arkui declaration files. diff --git a/arkui-plugins/ui-plugins/struct-translators/factory.ts b/arkui-plugins/ui-plugins/struct-translators/factory.ts index a7ebee0c7d42b7c9377d8c09958d755b5ee92911..f330329c3d6f3cde02b836c54eb0e7a8258d6947 100644 --- a/arkui-plugins/ui-plugins/struct-translators/factory.ts +++ b/arkui-plugins/ui-plugins/struct-translators/factory.ts @@ -31,7 +31,7 @@ import { factory as UIFactory } from '../ui-factory'; import { factory as PropertyFactory } from '../property-translators/factory'; import { factory as BuilderLambdaFactory } from '../builder-lambda-translators/factory'; import { BuilderFactory } from '../builder-lambda-translators/builder-factory'; -import { backingField, collect, filterDefined } from '../../common/arkts-utils'; +import { backingField, collect, filterDefined, flatVisitMethodWithOverloads } from '../../common/arkts-utils'; import { classifyInObservedClass, classifyPropertyInInterface, @@ -137,12 +137,17 @@ export class factory { } static transformControllerInterfaceType(node: arkts.TSInterfaceDeclaration): arkts.TSInterfaceDeclaration { - if (!node.body || node.body.body.length <= 0 || !arkts.isMethodDefinition(node.body.body[0])) { + if (!node.body) { + return node; + } + const nodeBody = node.body.body; + const firstGetter = nodeBody.at(0); + if (!firstGetter || !arkts.isMethodDefinition(firstGetter!)) { return node; } const updatedBody = arkts.factory.updateInterfaceBody(node.body, [ - this.updateBuilderType(node.body.body[0]), - ...node.body.body.slice(1), + flatVisitMethodWithOverloads(firstGetter, this.updateBuilderType), + ...nodeBody.slice(1), ]); return arkts.factory.updateInterfaceDeclaration( node, diff --git a/arkui-plugins/ui-plugins/ui-factory.ts b/arkui-plugins/ui-plugins/ui-factory.ts index 29cd1b6af751eea9f7d4c1f64125aff6dd6ae9cf..3900f3b1473fa2dfb771c7e85460c4b93ce73566 100644 --- a/arkui-plugins/ui-plugins/ui-factory.ts +++ b/arkui-plugins/ui-plugins/ui-factory.ts @@ -44,7 +44,6 @@ export interface MethodDefinitionConfiguration { key: arkts.Identifier; kind: arkts.Es2pandaMethodDefinitionKind; function: ScriptFunctionConfiguration; - overloads: arkts.MethodDefinition[]; modifiers: arkts.Es2pandaModifierFlags; isComputed: boolean; } @@ -271,9 +270,6 @@ export class factory { config.modifiers ?? original.modifiers, config.isComputed ?? false ); - if (!!config.overloads) { - newMethod.setOverloads(config.overloads); - } return newMethod; } @@ -292,9 +288,6 @@ export class factory { config.modifiers ?? arkts.Es2pandaModifierFlags.MODIFIER_FLAGS_NONE, config.isComputed ?? false ); - if (!!config.overloads) { - newMethod.setOverloads(config.overloads); - } return newMethod; } diff --git a/koala-wrapper/native/src/bridges.cc b/koala-wrapper/native/src/bridges.cc index 380cab265664a6d45de5f175cbd550fb8eb935d3..5ba7851dc4cac7446133bd664c5090336c367edf 100644 --- a/koala-wrapper/native/src/bridges.cc +++ b/koala-wrapper/native/src/bridges.cc @@ -827,4 +827,16 @@ KNativePointer impl_CreateTypeNodeFromTsType(KNativePointer context, KNativePoin auto _typeAnnotation = GetImpl()->CreateOpaqueTypeNode(_context, _nodeTsType); return _typeAnnotation; } -KOALA_INTEROP_2(CreateTypeNodeFromTsType, KNativePointer, KNativePointer, KNativePointer); \ No newline at end of file +KOALA_INTEROP_2(CreateTypeNodeFromTsType, KNativePointer, KNativePointer, KNativePointer); + +void impl_ScriptFunctionSetParams( + KNativePointer context, KNativePointer receiver, KNativePointerArray paramsList, KUInt paramsListSequenceLength) +{ + const auto _context = reinterpret_cast(context); + const auto _receiver = reinterpret_cast(receiver); + const auto _paramsList = reinterpret_cast(paramsList); + const auto _paramsListSequenceLength = static_cast(paramsListSequenceLength); + GetImpl()->ScriptFunctionSetParams(_context, _receiver, _paramsList, _paramsListSequenceLength); + return; +} +KOALA_INTEROP_V4(ScriptFunctionSetParams, KNativePointer, KNativePointer, KNativePointerArray, KUInt); \ No newline at end of file diff --git a/koala-wrapper/src/Es2pandaNativeModule.ts b/koala-wrapper/src/Es2pandaNativeModule.ts index 2ade57a5adb790745ec5c02ff8685ff204062eb0..37c3c7f73256e20c8b3e3effb1d3bf502da5aec1 100644 --- a/koala-wrapper/src/Es2pandaNativeModule.ts +++ b/koala-wrapper/src/Es2pandaNativeModule.ts @@ -993,6 +993,14 @@ export class Es2pandaNativeModule { throw new Error('Not implemented'); } + _ScriptFunctionSetParams( + context: KNativePointer, + receiver: KNativePointer, + paramsList: BigUint64Array, + paramsListSequenceLength: KUInt + ): void { + throw new Error('This methods was not overloaded by native module initialization'); + } } export function initEs2panda(): Es2pandaNativeModule { diff --git a/koala-wrapper/src/arkts-api/node-utilities/MethodDefinition.ts b/koala-wrapper/src/arkts-api/node-utilities/MethodDefinition.ts index 6318a0c84fd2c28d360abd7169b37f8eaec4c74b..238680c75f1685f71c769d87c8e38b7ce8f56576 100644 --- a/koala-wrapper/src/arkts-api/node-utilities/MethodDefinition.ts +++ b/koala-wrapper/src/arkts-api/node-utilities/MethodDefinition.ts @@ -40,9 +40,7 @@ export function updateMethodDefinition( return original; } - const update = updateThenAttach(MethodDefinition.update, (node: MethodDefinition, original: MethodDefinition) => - node.setOverloads(original.overloads) - ); + const update = updateThenAttach(MethodDefinition.update); const newNode = update(original, kind, key, value, modifiers, isComputed); if (NodeCache.getInstance().has(original)) { NodeCache.getInstance().refresh(original, newNode); diff --git a/koala-wrapper/src/arkts-api/types.ts b/koala-wrapper/src/arkts-api/types.ts index 530c5bf7af7ea002a35eb1c413605f4a900542c4..5347f4e2e89169ce3695068c8f365272091f3920 100644 --- a/koala-wrapper/src/arkts-api/types.ts +++ b/koala-wrapper/src/arkts-api/types.ts @@ -755,6 +755,15 @@ export class MethodDefinition extends AstNode { return this; } + setBaseOverloadMethod(baseOverloadMethod?: MethodDefinition): this { + global.generatedEs2panda._MethodDefinitionSetBaseOverloadMethod( + global.context, + this.peer, + passNode(baseOverloadMethod) + ); + return this; + } + readonly kind: Es2pandaMethodDefinitionKind; readonly scriptFunction: ScriptFunction; readonly name: Identifier; diff --git a/koala-wrapper/src/arkts-api/visitor.ts b/koala-wrapper/src/arkts-api/visitor.ts index 7898501f2cdba9066a4bcc53da78d25bdea3786d..d6c1232617454e5313342f42dadf3d18e887e7e8 100644 --- a/koala-wrapper/src/arkts-api/visitor.ts +++ b/koala-wrapper/src/arkts-api/visitor.ts @@ -80,6 +80,7 @@ import { import { classDefinitionFlags } from './utilities/public'; import { Es2pandaAstNodeType } from '../Es2pandaEnums'; import { updateFunctionExpression } from './node-utilities/FunctionExpression'; +import { MethodDefinition } from './types'; type Visitor = (node: AstNode) => AstNode; @@ -287,6 +288,24 @@ function visitDeclaration(node: AstNode, visitor: Visitor): AstNode { return node; } +function visitMethodDefinition(node: MethodDefinition, visitor: Visitor): MethodDefinition { + const newOverloads: readonly MethodDefinition[] = nodesVisitor(node.overloads, visitor); + const newNode = factory.updateMethodDefinition( + node, + node.kind, + node.name, + nodeVisitor(node.scriptFunction, visitor), + node.modifiers, + false + ); + node.setOverloads(newOverloads); + newOverloads.forEach((it): void => { + it.setBaseOverloadMethod(node); + it.parent = node; + }); + return newNode; +} + function visitDefinition(node: AstNode, visitor: Visitor): AstNode { if (updated) { return node; @@ -308,14 +327,7 @@ function visitDefinition(node: AstNode, visitor: Visitor): AstNode { } if (isMethodDefinition(node)) { updated = true; - return factory.updateMethodDefinition( - node, - node.kind, - node.name, - nodeVisitor(node.scriptFunction, visitor), - node.modifiers, - false - ); + return visitMethodDefinition(node, visitor); } if (isTSInterfaceBody(node)) { updated = true; diff --git a/koala-wrapper/src/generated/peers/ScriptFunction.ts b/koala-wrapper/src/generated/peers/ScriptFunction.ts index d04c69b5e0d0d3cb32eea3f5fa996c840e9944da..4b79ecc88ae9963febd75eb3015b5adb2b1958a7 100644 --- a/koala-wrapper/src/generated/peers/ScriptFunction.ts +++ b/koala-wrapper/src/generated/peers/ScriptFunction.ts @@ -184,6 +184,16 @@ export class ScriptFunction extends AstNode { global.generatedEs2panda._ScriptFunctionSetAnnotations(global.context, this.peer, passNodeArray(annotations), annotations.length) return this } + /** @deprecated */ + setParams(paramsList: readonly Expression[]): this { + global.es2panda._ScriptFunctionSetParams( + global.context, + this.peer, + passNodeArray(paramsList), + paramsList.length + ); + return this; + } } export function isScriptFunction(node: AstNode): node is ScriptFunction { return node instanceof ScriptFunction