From 9d0dd3095f76c5d3a49755e8f7b12cbb2a94ad4c Mon Sep 17 00:00:00 2001 From: houhaoyu Date: Fri, 15 Oct 2021 17:37:29 +0800 Subject: [PATCH] houhaoyu@huawei.com Signed-off-by: houhaoyu Change-Id: I643363a6509a7bf0bb7c9602d67fde34a399ad51 --- compiler/src/validate_ui_syntax.ts | 52 ++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/compiler/src/validate_ui_syntax.ts b/compiler/src/validate_ui_syntax.ts index 94838aba7..fa852ad07 100644 --- a/compiler/src/validate_ui_syntax.ts +++ b/compiler/src/validate_ui_syntax.ts @@ -166,9 +166,15 @@ function checkComponentDecorator(source: string, filePath: string, addLog(LogType.ERROR, message, pos, log, sourceFile); } } - if (ts.isMissingDeclaration(item) && /struct/.test(item.getText())) { - const message: string = `Please use a valid decorator.`; - addLog(LogType.ERROR, message, item.getStart(), log, sourceFile); + if (ts.isMissingDeclaration(item)) { + const decorators: ts.NodeArray = item.decorators; + for (let i = 0; i < decorators.length; i++) { + if (decorators[i] && /struct/.test(item.getText())) { + const message: string = `Please use a valid decorator.`; + addLog(LogType.ERROR, message, item.getStart(), log, sourceFile); + break; + } + } } }); validateEntryCount(result, fileQuery, sourceFile.fileName, log); @@ -379,11 +385,17 @@ function getBlockChildrenCount(blockNode: ts.Block, allComponentNames: Set 1) { @@ -482,15 +494,21 @@ function isNonspecificChildBlock(blockNode: ts.Block, specificChildSet: Set