diff --git a/compiler/src/process_component_build.ts b/compiler/src/process_component_build.ts index ee016a4041c2d2e4ef8786e183843932117771c2..b5ecb196f18f125d2175a68baca0063ff00caf48 100644 --- a/compiler/src/process_component_build.ts +++ b/compiler/src/process_component_build.ts @@ -557,8 +557,7 @@ export function bindComponentAttr(node: ts.ExpressionStatement, identifierNode: function processCustomBuilderProperty(node: ts.CallExpression): ts.CallExpression { const newArguments: ts.Expression[] = []; node.arguments.forEach((argument: ts.Expression | ts.Identifier, index: number) => { - if (index === 0 && (ts.isPropertyAccessExpression(argument) || ts.isCallExpression(argument) || - ts.isIdentifier(argument))) { + if (index === 0 && isBuilderChangeNode(argument)) { newArguments.push(parseBuilderNode(argument)); } else { newArguments.push(argument); @@ -568,6 +567,15 @@ function processCustomBuilderProperty(node: ts.CallExpression): ts.CallExpressio return node; } +function isBuilderChangeNode(argument: ts.Node): boolean { + return (ts.isPropertyAccessExpression(argument) && argument.name && ts.isIdentifier(argument.name) + && CUSTOM_BUILDER_METHOD.has(argument.name.getText())) || + (ts.isCallExpression(argument) && argument.expression && argument.expression.name && + ts.isIdentifier(argument.expression.name) && + CUSTOM_BUILDER_METHOD.has(argument.expression.name.getText())) || (ts.isIdentifier(argument) && + argument.escapedText && CUSTOM_BUILDER_METHOD.has(argument.escapedText.toString())); +} + function parseBuilderNode(node: ts.Node): ts.ObjectLiteralExpression { if (isPropertyAccessExpressionNode(node)) { return processPropertyBuilder(node as ts.PropertyAccessExpression); diff --git a/compiler/src/process_component_class.ts b/compiler/src/process_component_class.ts index 3f464cca46b9a742d94db7aa9837b66c69d25260..9d01a94318466f0caec072dd6981ea435e45a6af 100644 --- a/compiler/src/process_component_class.ts +++ b/compiler/src/process_component_class.ts @@ -50,8 +50,7 @@ import { COMPONENT_STYLES_DECORATOR, STYLES, INTERFACE_NAME_SUFFIX, - OBSERVED_PROPERTY_ABSTRACT, - CUSTOM_COMPONENT_EARLIER_CREATE_CHILD + OBSERVED_PROPERTY_ABSTRACT } from './pre_define'; import { BUILDIN_STYLE_NAMES,