From 1db9121d7f1f5f011423fc3d29c0d0881a9b1716 Mon Sep 17 00:00:00 2001 From: yfwang6 Date: Sat, 27 Aug 2022 10:41:32 +0800 Subject: [PATCH] fixed a48de73 from https://gitee.com/yfwang6/developtools_ace-ets2bundle/pulls/1042 fixed 36835b2 from https://gitee.com/yfwang6/developtools_ace-ets2bundle/pulls/1024 wangyongfei6@huawei.com watch callback do not trigger Signed-off-by: yfwang6 Change-Id: I638e4b1cf0c4c8af9f41071a4e8f5feee4c788c0 --- compiler/src/pre_define.ts | 5 ++--- compiler/src/process_component_constructor.ts | 2 +- compiler/src/process_component_member.ts | 9 +++------ 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/compiler/src/pre_define.ts b/compiler/src/pre_define.ts index a1698ab..a1cfde8 100644 --- a/compiler/src/pre_define.ts +++ b/compiler/src/pre_define.ts @@ -68,9 +68,8 @@ export const INITIALIZE_CONSUME_FUNCTION: string = 'initializeConsume'; export const ADD_PROVIDED_VAR: string = 'addProvidedVar'; export const APP_STORAGE: string = 'AppStorage'; -export const APP_STORAGE_SET_AND_PROP: string = 'setAndProp'; -export const APP_STORAGE_SET_AND_LINK: string = 'setAndLink'; -export const APP_STORAGE_GET_OR_SET: string = 'GetOrCreate'; +export const APP_STORAGE_SET_AND_PROP: string = 'SetAndProp'; +export const APP_STORAGE_SET_AND_LINK: string = 'SetAndLink'; export const PAGE_ENTRY_FUNCTION_NAME: string = 'loadDocument'; export const STORE_PREVIEW_COMPONENTS: string = 'storePreviewComponents'; diff --git a/compiler/src/process_component_constructor.ts b/compiler/src/process_component_constructor.ts index 469c6c4..5b04845 100644 --- a/compiler/src/process_component_constructor.ts +++ b/compiler/src/process_component_constructor.ts @@ -168,5 +168,5 @@ export function addConstructor(ctorNode: any, watchMap: Map, ts.factory.createThis(), ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_UPDATE_PARAMS)), undefined, [ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_PARAMS)])); return updateConstructor(updateConstructor(ctorNode, [], [callSuperStatement], true), [], - [updateWithValueParamsStatement, ...watchStatements], false, true, parentComponentName); + [...watchStatements, updateWithValueParamsStatement], false, true, parentComponentName); } diff --git a/compiler/src/process_component_member.ts b/compiler/src/process_component_member.ts index c432788..444a90c 100644 --- a/compiler/src/process_component_member.ts +++ b/compiler/src/process_component_member.ts @@ -44,7 +44,6 @@ import { APP_STORAGE, APP_STORAGE_SET_AND_PROP, APP_STORAGE_SET_AND_LINK, - APP_STORAGE_GET_OR_SET, COMPONENT_CONSTRUCTOR_UNDEFINED, SET_CONTROLLER_METHOD, SET_CONTROLLER_CTR, @@ -509,11 +508,9 @@ function updateStoragePropAndLinkProperty(node: ts.PropertyDeclaration, name: ts return ts.factory.createExpressionStatement(ts.factory.createBinaryExpression( createPropertyAccessExpressionWithThis(`__${name.getText()}`), ts.factory.createToken(ts.SyntaxKind.EqualsToken), ts.factory.createCallExpression( - ts.factory.createPropertyAccessExpression(ts.factory.createCallExpression( - ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(APP_STORAGE), - ts.factory.createIdentifier(APP_STORAGE_GET_OR_SET)), undefined, []), - ts.factory.createIdentifier(setFuncName)), undefined, [node.decorators[0].expression.arguments[0], - node.initializer, ts.factory.createThis()]))); + ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(APP_STORAGE), + ts.factory.createIdentifier(setFuncName)), undefined, [node.decorators[0].expression.arguments[0], + node.initializer, ts.factory.createThis(), ts.factory.createStringLiteral(name.getText())]))); } else { validateAppStorageDecoractorsNonSingleKey(node, log); }