diff --git a/compiler/src/process_struct_componentV2.ts b/compiler/src/process_struct_componentV2.ts index 34e0e906e6e017108fea49ab22866bd997b60ffb..17baf35db8be0e6ec7b6a0c2d9a7fd763d20cf49 100644 --- a/compiler/src/process_struct_componentV2.ts +++ b/compiler/src/process_struct_componentV2.ts @@ -333,6 +333,9 @@ function processComponentProperty(member: ts.PropertyDeclaration, structInfo: St if (structInfo.staticPropertySet.has(propName)) { initializer = member.initializer; } + if (structInfo.paramDecoratorMap.has(propName) && structInfo.builderParamDecoratorSet.has(propName)) { + return processRequireBuilderParamProperty(member, decorators, initializer); + } if (structInfo.paramDecoratorMap.has(propName)) { return processParamProperty(member, decorators, initializer); } @@ -361,6 +364,15 @@ function processParamProperty(member: ts.PropertyDeclaration, member.name, member.questionToken, member.type, initializer); } +function processRequireBuilderParamProperty(member: ts.PropertyDeclaration, + decorators: readonly ts.Decorator[], initializer: ts.Expression): ts.PropertyDeclaration { + const tempDecorators: readonly ts.Decorator[] = removeDecorator(decorators, constantDefine.REQUIRE); + const newDecorators: readonly ts.Decorator[] = removeDecorator(tempDecorators, constantDefine.BUILDER_PARAM); + return ts.factory.updatePropertyDeclaration(member, + ts.concatenateDecoratorsAndModifiers(newDecorators, ts.getModifiers(member)), + member.name, member.questionToken, member.type, initializer); +} + function processBuilderParamProperty(member: ts.PropertyDeclaration, log: LogInfo[], decorators: readonly ts.Decorator[], initializer: ts.Expression): ts.PropertyDeclaration { if (judgeBuilderParamAssignedByBuilder(member)) {