From 972c1d74dd4bd367819e5ebeb3008ac96567ceb4 Mon Sep 17 00:00:00 2001 From: houhaoyu Date: Sun, 6 Mar 2022 16:17:25 +0800 Subject: [PATCH] fixed f43de76 from https://gitee.com/houhaoyu/developtools_ace-ets2bundle/pulls/303 houhaoyu@huawei.com fix @Preview bug Signed-off-by: houhaoyu Change-Id: I32807fab6bc96ee2d735f6fd985852f952f8d0e9 --- compiler/src/process_component_class.ts | 2 +- compiler/src/validate_ui_syntax.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/src/process_component_class.ts b/compiler/src/process_component_class.ts index 38f0c8ef8..9de77666a 100644 --- a/compiler/src/process_component_class.ts +++ b/compiler/src/process_component_class.ts @@ -99,7 +99,7 @@ function checkPreview(node: ts.ClassDeclaration) { let hasPreview: boolean = false; if (node && node.decorators) { for (let i = 0; i < node.decorators.length; i++) { - const name: string = node.decorators[i].getText().replace(/\((.|\n)*\)/, '').trim(); + const name: string = node.decorators[i].getText().replace(/\([^\(\)]*\)/, '').trim(); if (name === COMPONENT_DECORATOR_PREVIEW) { hasPreview = true; break; diff --git a/compiler/src/validate_ui_syntax.ts b/compiler/src/validate_ui_syntax.ts index 5dd4474de..7efd1f804 100644 --- a/compiler/src/validate_ui_syntax.ts +++ b/compiler/src/validate_ui_syntax.ts @@ -271,7 +271,7 @@ function checkDecorators(node: ts.MissingDeclaration | ts.ExportAssignment, resu let hasComponentDecorator: boolean = false; const componentName: string = component.getText(); node.decorators.forEach((element) => { - const name: string = element.getText().replace(/\((.|\n)*\)/, '').trim(); + const name: string = element.getText().replace(/\([^\(\)]*\)/, '').trim(); if (INNER_COMPONENT_DECORATORS.has(name)) { componentCollection.customComponents.add(componentName); switch (name) { -- Gitee