mirror of
https://github.com/openharmony/developtools_ace-ets2bundle.git
synced 2026-07-19 16:43:34 -04:00
Merge branch 'master' of gitee.com:openharmony/developtools_ace-ets2bundle into master21
Change-Id: If494a7b40857ae7a90925f1f365210070cf85224
This commit is contained in:
@@ -257,6 +257,17 @@ export class ResultStates {
|
||||
}
|
||||
this.printResult();
|
||||
});
|
||||
|
||||
compiler.hooks.watchRun.tap('Listening State', (compiler: Compiler) => {
|
||||
if (compiler.modifiedFiles) {
|
||||
const isTsAndEtsFile: boolean = [...compiler.modifiedFiles].some((item: string) => {
|
||||
return /.(ts|ets)$/.test(item);
|
||||
});
|
||||
if (!isTsAndEtsFile) {
|
||||
process.env.watchTs = 'end';
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private printDiagnostic(diagnostic: ts.Diagnostic): void {
|
||||
|
||||
@@ -60,7 +60,8 @@ import {
|
||||
BIND_POPUP_SET,
|
||||
$$,
|
||||
PROPERTIES_ADD_DOUBLE_DOLLAR,
|
||||
ATTRIBUTE_ID
|
||||
ATTRIBUTE_ID,
|
||||
RESOURCE
|
||||
} from './pre_define';
|
||||
import {
|
||||
INNER_COMPONENT_NAMES,
|
||||
@@ -413,6 +414,7 @@ function processInnerComponent(node: ts.ExpressionStatement, newStatements: ts.S
|
||||
}
|
||||
if (etsComponentResult.etsComponentNode.body && ts.isBlock(etsComponentResult.etsComponentNode.body)) {
|
||||
if (res.isButton) {
|
||||
checkButtonParamHasLabel(etsComponentResult.etsComponentNode, log);
|
||||
if (projectConfig.isPreview) {
|
||||
newStatements.splice(-2, 1, createComponent(node, COMPONENT_CREATE_CHILD_FUNCTION).newNode);
|
||||
} else {
|
||||
@@ -1385,3 +1387,20 @@ function checkEtsComponent(node: ts.ExpressionStatement, log: LogInfo[]): void {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function checkButtonParamHasLabel(node: ts.EtsComponentExpression, log: LogInfo[]): void {
|
||||
if (node.arguments && node.arguments.length !== 0) {
|
||||
for (let i = 0; i < node.arguments.length; i++) {
|
||||
let argument: ts.Expression = node.arguments[i];
|
||||
if (ts.isStringLiteral(argument) || (ts.isCallExpression(argument) && ts.isIdentifier(argument.expression) &&
|
||||
(argument.expression.escapedText.toString() === RESOURCE))) {
|
||||
log.push({
|
||||
type: LogType.ERROR,
|
||||
message: "The Button component with a label parameter can not have any child.",
|
||||
pos: node.getStart(),
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user