diff --git a/compiler/src/process_component_build.ts b/compiler/src/process_component_build.ts index 1a9cabc4238148d3c821660f9ef5b6966a50b5f7..7b7623e503b9bf51023501a4308f078f1f873bfe 100644 --- a/compiler/src/process_component_build.ts +++ b/compiler/src/process_component_build.ts @@ -2363,7 +2363,7 @@ function isWrappedBuilderCallExpression(node: ts.CallExpression): boolean { } function parseBuilderNode(node: ts.Node, propertyName: string): - ts.ObjectLiteralExpression | ts.CallExpression | ts.ArrowFunction { + ts.ObjectLiteralExpression | ts.CallExpression | ts.ArrowFunction | ts.PropertyAccessExpression { if (isWrappedBuilder(node as ts.PropertyAccessExpression) || isPropertyAccessExpressionNode(node)) { if (CUSTOM_BUILDER_PROPERTIES_WITHOUTKEY.has(propertyName)) { return processPropertyBuilderWithoutKey(node as ts.PropertyAccessExpression); @@ -2384,6 +2384,8 @@ function parseBuilderNode(node: ts.Node, propertyName: string): } } else if (ts.isObjectLiteralExpression(node)) { return processObjectPropertyBuilder(node); + } else if (ts.isPropertyAccessExpression(node)) { + return node; } return undefined; } diff --git a/compiler/test/transform_ut/application/entry/build/default/cache/default/default@CompileArkTS/esmodule/debug/entry/src/main/ets/pages/utForPartialUpdate/render_decorator/@builder/@builderParam.js.sample b/compiler/test/transform_ut/application/entry/build/default/cache/default/default@CompileArkTS/esmodule/debug/entry/src/main/ets/pages/utForPartialUpdate/render_decorator/@builder/@builderParam.js.sample new file mode 100644 index 0000000000000000000000000000000000000000..a161a4c9e4626a0a8d33222920000eb92da799eb --- /dev/null +++ b/compiler/test/transform_ut/application/entry/build/default/cache/default/default@CompileArkTS/esmodule/debug/entry/src/main/ets/pages/utForPartialUpdate/render_decorator/@builder/@builderParam.js.sample @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2022-2024 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. + */ +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +if (!("finalizeConstruction" in ViewPU.prototype)) { + Reflect.set(ViewPU.prototype, "finalizeConstruction", () => { }); +} +class TextInput1 extends ViewV2 { + constructor(parent, params, __localStorage, elmtId = -1, paramsLambda, extraInfo) { + super(parent, elmtId, extraInfo); + this.finalizeConstruction(); + } + resetStateVarsOnReuse(params) { + } + initialRender() { + this.observeComponentCreation2((elmtId, isInitialRender) => { + Row.create(); + }, Row); + textInputBuilder.bind(this)(makeBuilderParameterProxy("textInputBuilder", { customKeyboardBuilder: () => this.customKeyboardBuilder() })); + Row.pop(); + } + customKeyboardBuilder(parent = null) { + } + rerender() { + this.updateDirtyElements(); + } + static getEntryName() { + return "TextInput1"; + } +} +function textInputBuilder(options, parent = null) { + const __options__ = options; + (parent ? parent : this).observeComponentCreation2((elmtId, isInitialRender, options = __options__) => { + TextInput.create(); + TextInput.customKeyboard(options.customKeyboardBuilder); + }, TextInput); +} +let textInputModel = class textInputModel { + constructor() { + this.customKeyboardBuilder = () => { }; + } +}; +textInputModel = __decorate([ + ObservedV2 +], textInputModel); +registerNamedRoute(() => new TextInput1(undefined, {}), "", { bundleName: "com.example.application", moduleName: "application", pagePath: "pages/utForPartialUpdate/render_decorator/@builder/@builderParam", pageFullPath: "application/entry/src/main/ets/pages/utForPartialUpdate/render_decorator/@builder/@builderParam", integratedHsp: "false", moduleType: "followWithHap" }); +//# sourceMappingURL=@builderParam.js.map \ No newline at end of file diff --git a/compiler/test/transform_ut/application/entry/src/main/ets/pages/utForPartialUpdate/render_decorator/@builder/@builderParam.ets b/compiler/test/transform_ut/application/entry/src/main/ets/pages/utForPartialUpdate/render_decorator/@builder/@builderParam.ets new file mode 100644 index 0000000000000000000000000000000000000000..d48bb35db8e7ba29461097ea1897c5fbd0d85b64 --- /dev/null +++ b/compiler/test/transform_ut/application/entry/src/main/ets/pages/utForPartialUpdate/render_decorator/@builder/@builderParam.ets @@ -0,0 +1,40 @@ +/* + * 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. + */ +// @Builder param test +@Entry +@ComponentV2 +struct TextInput1 { + build() { + Row() { + textInputBuilder({ + customKeyboardBuilder:this.customKeyboardBuilder() + }) + } + + } + @Builder customKeyboardBuilder() { + + } +} + +@Builder function textInputBuilder(options: textInputModel) { + TextInput() + .customKeyboard(options.customKeyboardBuilder) +} + +@ObservedV2 +class textInputModel { + customKeyboardBuilder: CustomBuilder = () =>{} +} \ No newline at end of file diff --git a/compiler/test/transform_ut/helpers/pathConfig.ts b/compiler/test/transform_ut/helpers/pathConfig.ts index 14a3de177907a9f06934862fc2792078f98fb85e..ac5d2e11e78f57958b0f02c4820f828947b5f797 100644 --- a/compiler/test/transform_ut/helpers/pathConfig.ts +++ b/compiler/test/transform_ut/helpers/pathConfig.ts @@ -136,6 +136,7 @@ export const UT_PARTIAL_UPFATE_PAGES: string[] = [ 'render_decorator/@builder/@builderWithForEach', 'render_decorator/@builder/@builderWithLinkData', 'render_decorator/@builder/handleCustomBuilder', + 'render_decorator/@builder/@builderParam', 'render_decorator/@builderParam/@builderParam', 'render_decorator/@builderParam/@builderParam1', 'render_decorator/@builderParam/@builderParamQuestionMark',