mirror of
https://gitee.com/openharmony/developtools_ace_ets2bundle
synced 2024-11-23 00:19:53 +00:00
!3956 增加Span使用通用属性不生效告警提示
Merge pull request !3956 from zhouyan/spantip
This commit is contained in:
commit
f632f7310c
@ -603,3 +603,4 @@ export const ARKTS_MODULE_PREFIX: string = '@arkts';
|
||||
export const ARKTS_MODULE_NAME: string = 'arkts';
|
||||
export const COLD_RELOAD_MODE: string = 'coldReload';
|
||||
export const INTEGRATED_HSP: string = 'integratedHsp';
|
||||
export const SpanComponents: string[] = ['Span'];
|
@ -137,7 +137,8 @@ import {
|
||||
NAVIGATION,
|
||||
CREATE_ROUTER_COMPONENT_COLLECT,
|
||||
NAV_PATH_STACK,
|
||||
IS_USER_CREATE_STACK
|
||||
IS_USER_CREATE_STACK,
|
||||
SpanComponents
|
||||
} from './pre_define';
|
||||
import {
|
||||
INNER_COMPONENT_NAMES,
|
||||
@ -2147,6 +2148,7 @@ export function bindComponentAttr(node: ts.ExpressionStatement, identifierNode:
|
||||
}
|
||||
while (temp && ts.isCallExpression(temp) && temp.expression) {
|
||||
let flag: boolean = false;
|
||||
validatePropertyAccessExpressionOnSpanComponent(temp.expression, identifierNode, log);
|
||||
if (temp.expression && (validatePropertyAccessExpressionWithCustomBuilder(temp.expression) ||
|
||||
validateIdentifierWithCustomBuilder(temp.expression))) {
|
||||
let propertyName: string = '';
|
||||
@ -2595,6 +2597,17 @@ function validateIdentifierWithCustomBuilder(node: ts.Node): boolean {
|
||||
return ts.isIdentifier(node) && CUSTOM_BUILDER_PROPERTIES.has(node.escapedText.toString());
|
||||
}
|
||||
|
||||
function validatePropertyAccessExpressionOnSpanComponent(node: ts.Node, identifierNode: ts.Identifier, log: LogInfo[]): void {
|
||||
if (SpanComponents.includes(identifierNode.escapedText.toString()) && ts.isPropertyAccessExpression(node) && node.name &&
|
||||
ts.isIdentifier(node.name) && BUILDIN_STYLE_NAMES.has(node.name.escapedText.toString())) {
|
||||
log.push({
|
||||
type: LogType.WARN,
|
||||
message: `Property '${node.name.escapedText.toString()}' does not take effect on '${identifierNode.escapedText.toString()}'.`,
|
||||
pos: node.getStart()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function createArrowFunctionForDollar($$varExp: ts.Expression): ts.ArrowFunction {
|
||||
return ts.factory.createArrowFunction(
|
||||
undefined, undefined,
|
||||
|
Loading…
Reference in New Issue
Block a user