mirror of
https://gitee.com/openharmony/developtools_ace_ets2bundle
synced 2024-11-26 18:21:00 +00:00
'@Styles'内使用逻辑组件时输出警告
Signed-off-by: lixinnan <lixinnan1@huawei.com> Change-Id: Ie2512cd40eca5949d389b09e6e5e6c2400528865
This commit is contained in:
parent
886df2ad26
commit
5aa1d5eff2
@ -2126,6 +2126,7 @@ export function bindComponentAttr(node: ts.ExpressionStatement, identifierNode:
|
||||
newStatements: ts.Statement[], log: LogInfo[], reverse: boolean = true,
|
||||
isStylesAttr: boolean = false, newImmutableStatements: ts.Statement[] = null,
|
||||
isStyleFunction: boolean = false, componentAttrInfo: ComponentAttrInfo = null): void {
|
||||
const isStylesUIComponent: boolean = validateStylesUIComponent(node, isStylesAttr);
|
||||
let temp = node.expression;
|
||||
const statements: ts.Statement[] = [];
|
||||
const immutableStatements: ts.Statement[] = [];
|
||||
@ -2136,9 +2137,9 @@ export function bindComponentAttr(node: ts.ExpressionStatement, identifierNode:
|
||||
hasAnimationAttr: false
|
||||
};
|
||||
const isRecycleComponent: boolean = isRecycle(componentCollection.currentClassName);
|
||||
if (ts.isPropertyAccessExpression(temp)) {
|
||||
if (ts.isPropertyAccessExpression(temp) || isStylesUIComponent) {
|
||||
log.push({
|
||||
type: LogType.ERROR,
|
||||
type: isStylesUIComponent ? LogType.WARN :LogType.ERROR,
|
||||
message: `'${node.getText()}' does not meet UI component syntax.`,
|
||||
pos: node.getStart()
|
||||
});
|
||||
@ -2203,6 +2204,10 @@ export function bindComponentAttr(node: ts.ExpressionStatement, identifierNode:
|
||||
reverse ? newImmutableStatements.push(...immutableStatements.reverse()) : newImmutableStatements.push(...immutableStatements);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function validateStylesUIComponent(node: ts.ExpressionStatement, isStylesAttr: boolean): boolean {
|
||||
return (ts.isIfStatement(node) || ts.isSwitchStatement(node)) && isStylesAttr;
|
||||
}
|
||||
|
||||
function parseRecycleId(node: ts.CallExpression, attr: ts.Identifier, isRecycleComponent: boolean,
|
||||
|
Loading…
Reference in New Issue
Block a user