mirror of
https://github.com/openharmony/developtools_ace-ets2bundle.git
synced 2026-07-20 19:47:44 -04:00
fix builder bug Signed-off-by: puyajun <puyajun@huawei.com> Change-Id: I12282fdcc6429ca43081c3565e8406f3cbb93d14
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user