mirror of
https://gitee.com/openharmony/developtools_ace_ets2bundle
synced 2025-02-28 06:15:38 +00:00
Signed-off-by: BoJiang <jiangbo91@huawei.com> Change-Id: I8d9c730934f0142e6117816daa0dc28d7ca12a6f
This commit is contained in:
parent
cdacc2629d
commit
de78ddee60
@ -20,7 +20,7 @@
|
||||
"fastbuild": "rollup -c rollup.config.js",
|
||||
"run:arkTest": "mocha \"arkTest_build/ark_compiler_ut/**/*.test.js\"",
|
||||
"run:cleanArkTest": "rm -rf arkTest_build",
|
||||
"arkTest": "./node_modules/.bin/babel ./test/ark_compiler_ut --out-dir arkTest_build/ark_compiler_ut --extensions .ts && npm run run:arkTest && npm run run:cleanArkTest",
|
||||
"arkTest": "npm run generateKitConfigs && ./node_modules/.bin/babel ./test/ark_compiler_ut --out-dir arkTest_build/ark_compiler_ut --extensions .ts && npm run run:arkTest && npm run run:cleanArkTest",
|
||||
"coverage": "node_modules/nyc/bin/nyc.js npm run test:coverage",
|
||||
"duplicate": "jscpd",
|
||||
"generateKitConfigs": "node ./build_kitConfigs_file.js ../../../interface/sdk-js/kits ./kit_configs ../../../interface/sdk-js/api ../../../interface/sdk-js/arkts"
|
||||
|
@ -40,7 +40,7 @@ import {
|
||||
STYLE_ADD_DOUBLE_DOLLAR,
|
||||
$$,
|
||||
PROPERTIES_ADD_DOUBLE_DOLLAR,
|
||||
$$_BLOCK_INTERFACE,
|
||||
DOLLAR_BLOCK_INTERFACE,
|
||||
COMPONENT_EXTEND_DECORATOR,
|
||||
COMPONENT_BUILDER_DECORATOR,
|
||||
ESMODULE,
|
||||
@ -1056,7 +1056,7 @@ function traverseBuild(node: ts.Node, index: number): void {
|
||||
}
|
||||
node = node.expression;
|
||||
if (ts.isEtsComponentExpression(node) && node.body && ts.isBlock(node.body) &&
|
||||
ts.isIdentifier(node.expression) && !$$_BLOCK_INTERFACE.has(node.expression.escapedText.toString())) {
|
||||
ts.isIdentifier(node.expression) && !DOLLAR_BLOCK_INTERFACE.has(node.expression.escapedText.toString())) {
|
||||
node.body.statements.forEach((item: ts.Statement, indexBlock: number) => {
|
||||
traverseBuild(item, indexBlock);
|
||||
});
|
||||
@ -1091,7 +1091,7 @@ function isPropertiesAddDoubleDollar(node: ts.Node): boolean {
|
||||
if (ts.isCallExpression(node) && ts.isIdentifier(node.expression) && node.arguments && node.arguments.length) {
|
||||
return true;
|
||||
} else if (ts.isEtsComponentExpression(node) && node.body && ts.isBlock(node.body) &&
|
||||
ts.isIdentifier(node.expression) && $$_BLOCK_INTERFACE.has(node.expression.escapedText.toString())) {
|
||||
ts.isIdentifier(node.expression) && DOLLAR_BLOCK_INTERFACE.has(node.expression.escapedText.toString())) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@ -1115,8 +1115,8 @@ function loopNodeFindDoubleDollar(node: ts.Node, parentComponentName: string): v
|
||||
doubleDollarCollection(param.initializer);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (STYLE_ADD_DOUBLE_DOLLAR.has(node.expression.getText()) && ts.isPropertyAccessExpression(item)) {
|
||||
} else if (ts.isPropertyAccessExpression(item) && (handleComponentDollarBlock(node as ts.CallExpression, parentComponentName) ||
|
||||
STYLE_ADD_DOUBLE_DOLLAR.has(node.expression.getText()))) {
|
||||
doubleDollarCollection(item);
|
||||
}
|
||||
});
|
||||
@ -1125,6 +1125,12 @@ function loopNodeFindDoubleDollar(node: ts.Node, parentComponentName: string): v
|
||||
}
|
||||
}
|
||||
|
||||
function handleComponentDollarBlock(node: ts.CallExpression, parentComponentName: string): boolean {
|
||||
return ts.isCallExpression(node) && ts.isIdentifier(node.expression) &&
|
||||
DOLLAR_BLOCK_INTERFACE.has(parentComponentName) && PROPERTIES_ADD_DOUBLE_DOLLAR.has(parentComponentName) &&
|
||||
PROPERTIES_ADD_DOUBLE_DOLLAR.get(parentComponentName).has(node.expression.escapedText.toString());
|
||||
}
|
||||
|
||||
function doubleDollarCollection(item: ts.Node): void {
|
||||
if (item.getText().startsWith($$)) {
|
||||
while (item.expression) {
|
||||
|
@ -352,9 +352,9 @@ export const GRID_ITEM: string = 'GridItem';
|
||||
export const LIST_ITEM: string = 'ListItem';
|
||||
export const UPDATE_FUNC_BY_ELMT_ID: string = 'updateFuncByElmtId';
|
||||
|
||||
export const $$_BLOCK_INTERFACE: Set<string> = new Set([
|
||||
REFRESH, DATE_PICKER, TIME_PICKER, RATING, SEAECH, CALENDAR, STEPPER, TABS, MENU_ITEM,
|
||||
TIME_PICKER, GRID_ITEM, LIST_ITEM]);
|
||||
export const DOLLAR_BLOCK_INTERFACE: Set<string> = new Set([
|
||||
CHECK_BOX, CHECKBOX_GROUP, DATE_PICKER, TIME_PICKER, MENU_ITEM, PANEL, RATING, SIDE_BAR_CONTAINER, STEPPER, SWIPER, TABS, TEXT_PICKER, TOGGLE, SELECT,
|
||||
REFRESH, CALENDAR, GRID_ITEM, LIST_ITEM, TEXT_TIMER, SEAECH]);
|
||||
export const STYLE_ADD_DOUBLE_DOLLAR: Set<string> = new Set([
|
||||
BIND_POPUP, $$_VISIBILITY, BIND_CONTENT_COVER, BIND_SHEET]);
|
||||
export const PROPERTIES_ADD_DOUBLE_DOLLAR: Map<string, Set<string>> = new Map([
|
||||
|
Loading…
x
Reference in New Issue
Block a user