diff --git a/compiler/src/ets_checker.ts b/compiler/src/ets_checker.ts index cd304f7..9d56bda 100644 --- a/compiler/src/ets_checker.ts +++ b/compiler/src/ets_checker.ts @@ -28,7 +28,7 @@ import { COMPONENT_IF, COMPONENT_DECORATORS_PARAMS, COMPONENT_BUILD_FUNCTION, - BIND_POPUP, + STYLE_ADD_DOUBLE_DOLLAR, $$, PROPERTIES_ADD_DOUBLE_DOLLAR } from './pre_define'; @@ -307,6 +307,9 @@ function loopNodeFindDoubleDollar(node: ts.Node, parentComponentName: string): v } }); } + if (STYLE_ADD_DOUBLE_DOLLAR.has(node.expression.getText()) && ts.isPropertyAccessExpression(item)) { + doubleDollarCollection(item); + } }); } node = node.expression; @@ -331,7 +334,7 @@ function isObjectPram(param: ts.Node, parentComponentName:string): boolean { function isCanAddDoubleDollar(propertyName: string, parentComponentName: string): boolean { return PROPERTIES_ADD_DOUBLE_DOLLAR.has(parentComponentName) && PROPERTIES_ADD_DOUBLE_DOLLAR.get(parentComponentName).has(propertyName) || - propertyName === BIND_POPUP; + STYLE_ADD_DOUBLE_DOLLAR.has(propertyName); } function isDecoratorCollection(item: ts.Decorator, decoratorName: string): boolean { diff --git a/compiler/src/pre_define.ts b/compiler/src/pre_define.ts index f5ab22c..eacc4d2 100644 --- a/compiler/src/pre_define.ts +++ b/compiler/src/pre_define.ts @@ -213,7 +213,9 @@ export const COUNT: string = 'count'; export const $$_THIS: string = '$$this'; export const $$_NEW_VALUE: string = 'newValue'; export const $$: string = '$$'; +export const $$_VISIBILITY: string = 'visibility'; +export const STYLE_ADD_DOUBLE_DOLLAR: Set = new Set([BIND_POPUP, $$_VISIBILITY]) export const PROPERTIES_ADD_DOUBLE_DOLLAR: Map> = new Map([ [RADIO, new Set([CHECKED])], [TEXT_TIMER, new Set([FORMAT, COUNT, IS_COUNT_DOWN])], ]);; diff --git a/compiler/src/process_component_build.ts b/compiler/src/process_component_build.ts index d1a797d..ee5ec5b 100644 --- a/compiler/src/process_component_build.ts +++ b/compiler/src/process_component_build.ts @@ -48,7 +48,7 @@ import { THIS, VISUAL_STATE, VIEW_STACK_PROCESSOR, - BIND_POPUP, + STYLE_ADD_DOUBLE_DOLLAR, $$_VALUE, $$_CHANGE_EVENT, $$_THIS, @@ -961,7 +961,7 @@ function isDoubleDollarToChange(isStylesAttr: boolean, identifierNode: ts.Identi return !isStylesAttr && PROPERTIES_ADD_DOUBLE_DOLLAR.has(identifierNode.escapedText.toString()) && PROPERTIES_ADD_DOUBLE_DOLLAR.get(identifierNode.escapedText.toString()).has(propName) || - propName === BIND_POPUP && temp.arguments.length && temp.arguments[0] ? + STYLE_ADD_DOUBLE_DOLLAR.has(propName) && temp.arguments.length && temp.arguments[0] ? temp.arguments[0].getText().match(/^\$\$(.|\n)+/) !== null ? true : false : false; } @@ -1013,11 +1013,12 @@ function changeEtsComponentKind(node: ts.Node): ts.Node { function classifyArgumentsNum(args: any, argumentsArr: ts.Expression[], propName: string, identifierNode: ts.Identifier): void { - if (propName === BIND_POPUP && args.length === 2) { + if (STYLE_ADD_DOUBLE_DOLLAR.has(propName) && args.length === 2) { const varExp: ts.Expression = updateArgumentFor$$(args[0]); argumentsArr.push(generateObjectFor$$(varExp), args[1]); } else if (PROPERTIES_ADD_DOUBLE_DOLLAR.has(identifierNode.getText()) && args.length === 1 && - PROPERTIES_ADD_DOUBLE_DOLLAR.get(identifierNode.getText()).has(propName)) { + PROPERTIES_ADD_DOUBLE_DOLLAR.get(identifierNode.getText()).has(propName) || + STYLE_ADD_DOUBLE_DOLLAR.has(propName) && args.length === 1) { const varExp: ts.Expression = updateArgumentFor$$(args[0]); argumentsArr.push(varExp, createArrowFunctionFor$$(varExp)); }