mirror of
https://gitee.com/openharmony/third_party_typescript
synced 2024-11-27 00:51:12 +00:00
Fix increment
Issue: https://gitee.com/openharmony/third_party_typescript/issues/IAGZ78 Signed-off-by: azwenqiang <dengwenqiang5@huawei.com> Change-Id: I7a5bf6503fb9159b8dcfcae3561d052f2773bf74
This commit is contained in:
parent
fed4091393
commit
88e401ccd8
@ -104182,6 +104182,8 @@ var ts;
|
||||
}
|
||||
}
|
||||
state.arkTSVersion = useOldState ? oldState === null || oldState === void 0 ? void 0 : oldState.arkTSVersion : undefined;
|
||||
state.compatibleSdkVersion = useOldState ? oldState === null || oldState === void 0 ? void 0 : oldState.compatibleSdkVersion : undefined;
|
||||
state.compatibleSdkVersionStage = useOldState ? oldState === null || oldState === void 0 ? void 0 : oldState.compatibleSdkVersionStage : undefined;
|
||||
var referencedMap = state.referencedMap;
|
||||
var oldReferencedMap = useOldState ? oldState.referencedMap : undefined;
|
||||
var copyDeclarationFileDiagnostics = canCopySemanticDiagnostics && !compilerOptions.skipLibCheck === !oldCompilerOptions.skipLibCheck;
|
||||
@ -104697,6 +104699,8 @@ var ts;
|
||||
});
|
||||
}
|
||||
var arkTSVersion = state.arkTSVersion;
|
||||
var compatibleSdkVersion = state.compatibleSdkVersion;
|
||||
var compatibleSdkVersionStage = state.compatibleSdkVersionStage;
|
||||
var result = {
|
||||
fileNames: fileNames,
|
||||
fileInfos: fileInfos,
|
||||
@ -104711,6 +104715,8 @@ var ts;
|
||||
emitSignatures: emitSignatures,
|
||||
latestChangedDtsFile: latestChangedDtsFile,
|
||||
arkTSVersion: arkTSVersion,
|
||||
compatibleSdkVersion: compatibleSdkVersion,
|
||||
compatibleSdkVersionStage: compatibleSdkVersionStage,
|
||||
};
|
||||
if (hasConstEnumRelateInfo) {
|
||||
result.constEnumRelateCache = constEnumRelateCache;
|
||||
@ -105180,6 +105186,8 @@ var ts;
|
||||
emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
|
||||
constEnumRelatePerFile: constEnumRelatePerFile,
|
||||
arkTSVersion: program.arkTSVersion,
|
||||
compatibleSdkVersion: program.compatibleSdkVersion,
|
||||
compatibleSdkVersionStage: program.compatibleSdkVersionStage,
|
||||
};
|
||||
}
|
||||
return {
|
||||
|
@ -125402,6 +125402,8 @@ var ts;
|
||||
}
|
||||
}
|
||||
state.arkTSVersion = useOldState ? oldState === null || oldState === void 0 ? void 0 : oldState.arkTSVersion : undefined;
|
||||
state.compatibleSdkVersion = useOldState ? oldState === null || oldState === void 0 ? void 0 : oldState.compatibleSdkVersion : undefined;
|
||||
state.compatibleSdkVersionStage = useOldState ? oldState === null || oldState === void 0 ? void 0 : oldState.compatibleSdkVersionStage : undefined;
|
||||
// Update changed files and copy semantic diagnostics if we can
|
||||
var referencedMap = state.referencedMap;
|
||||
var oldReferencedMap = useOldState ? oldState.referencedMap : undefined;
|
||||
@ -126027,6 +126029,8 @@ var ts;
|
||||
});
|
||||
}
|
||||
var arkTSVersion = state.arkTSVersion;
|
||||
var compatibleSdkVersion = state.compatibleSdkVersion;
|
||||
var compatibleSdkVersionStage = state.compatibleSdkVersionStage;
|
||||
var result = {
|
||||
fileNames: fileNames,
|
||||
fileInfos: fileInfos,
|
||||
@ -126041,6 +126045,8 @@ var ts;
|
||||
emitSignatures: emitSignatures,
|
||||
latestChangedDtsFile: latestChangedDtsFile,
|
||||
arkTSVersion: arkTSVersion,
|
||||
compatibleSdkVersion: compatibleSdkVersion,
|
||||
compatibleSdkVersionStage: compatibleSdkVersionStage,
|
||||
};
|
||||
if (hasConstEnumRelateInfo) {
|
||||
result.constEnumRelateCache = constEnumRelateCache;
|
||||
@ -126584,6 +126590,8 @@ var ts;
|
||||
emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
|
||||
constEnumRelatePerFile: constEnumRelatePerFile,
|
||||
arkTSVersion: program.arkTSVersion,
|
||||
compatibleSdkVersion: program.compatibleSdkVersion,
|
||||
compatibleSdkVersionStage: program.compatibleSdkVersionStage,
|
||||
};
|
||||
}
|
||||
return {
|
||||
@ -193209,11 +193217,11 @@ var ts;
|
||||
ArkTSLinter_1_1.cookBookTag[180] =
|
||||
'The "@Sendable" decorator can only be used on "class", "function" and "typeAlias" (arkts-sendable-decorator-limited)';
|
||||
ArkTSLinter_1_1.cookBookTag[181] =
|
||||
'The exported "Sendable" class or function cannot be captured by "Sendable" Class or function in current file (arkts-sendable-closure-export)';
|
||||
'The exported "Sendable" class or function cannot be captured by "Sendable" class or function in current file (arkts-sendable-closure-export)';
|
||||
ArkTSLinter_1_1.cookBookTag[182] =
|
||||
'Sendable functions and sendable typealias are not available when compatibleSdkVersionStage is lowering than Beta3 of API12 (arkts-sendable-beta-compatible)';
|
||||
'Sendable functions and sendable typealias are not available when compatibleSdkVersionStage is lowering than beta3 of API12 (arkts-sendable-beta-compatible)';
|
||||
ArkTSLinter_1_1.cookBookTag[183] =
|
||||
'Lazy imports are not available when compatibleSdkVersionStage is lowering than Beta3 of API12 (arkts-import-lazy-beta-compatible)';
|
||||
'Lazy imports are not available when compatibleSdkVersionStage is lowering than beta3 of API12 (arkts-import-lazy-beta-compatible)';
|
||||
})(ArkTSLinter_1_1 = ts.ArkTSLinter_1_1 || (ts.ArkTSLinter_1_1 = {}));
|
||||
})(ts || (ts = {}));
|
||||
/*
|
||||
@ -197230,7 +197238,7 @@ var ts;
|
||||
var _this = this;
|
||||
var callback = function (node) {
|
||||
// Namespace import will introduce closure in the es2abc compiler stage
|
||||
if (!ts.isIdentifier(node) || _this.checkNamespaceImportVar(node)) {
|
||||
if (!ts.isIdentifier(node) || _this.checkNamespaceImportVar(node, faultId)) {
|
||||
return;
|
||||
}
|
||||
// The "b" of "A.b" should not be checked since it's load from object "A"
|
||||
@ -197306,13 +197314,13 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
TypeScriptLinter.prototype.checkNamespaceImportVar = function (node) {
|
||||
TypeScriptLinter.prototype.checkNamespaceImportVar = function (node, faultId) {
|
||||
// Namespace import cannot be determined by the true symbol
|
||||
var sym = TypeScriptLinter.tsTypeChecker.getSymbolAtLocation(node);
|
||||
var decls = sym === null || sym === void 0 ? void 0 : sym.getDeclarations();
|
||||
if (decls === null || decls === void 0 ? void 0 : decls.length) {
|
||||
if (ts.isNamespaceImport(decls[0])) {
|
||||
this.incrementCounters(node, FaultID.SendableCapturedVars);
|
||||
this.incrementCounters(node, faultId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -197465,7 +197473,7 @@ var ts;
|
||||
if (tsImportClause.name) {
|
||||
this.countDeclarationsWithDuplicateName(tsImportClause.name, tsImportClause);
|
||||
}
|
||||
this.isImportLazyValid(tsImportClause);
|
||||
this.checkImportLazy(tsImportClause);
|
||||
};
|
||||
TypeScriptLinter.prototype.handleImportSpecifier = function (node) {
|
||||
var tsImportSpecifier = node;
|
||||
@ -198349,14 +198357,13 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
TypeScriptLinter.prototype.isImportLazyValid = function (tsImportClause) {
|
||||
TypeScriptLinter.prototype.checkImportLazy = function (tsImportClause) {
|
||||
if (!tsImportClause.isLazy ||
|
||||
this.compatibleSdkVersion > 12 ||
|
||||
this.compatibleSdkVersion === 12 && (this.compatibleSdkVersionStage !== 'beta1' && this.compatibleSdkVersionStage !== 'beta2')) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
this.incrementCounters(tsImportClause, FaultID.ImportLazyBetaCompatible);
|
||||
return false;
|
||||
};
|
||||
TypeScriptLinter.reportDiagnostics = true;
|
||||
// The SyntaxKind enum defines additional elements at the end of the enum
|
||||
@ -198978,12 +198985,17 @@ var ts;
|
||||
var programState = tsBuilderProgram.getState();
|
||||
var oldDiagnostics = programState.arktsLinterDiagnosticsPerFile;
|
||||
programState.arktsLinterDiagnosticsPerFile = new ts.Map();
|
||||
var changedFiles = collectChangedFilesFromProgramState(programState, arkTSVersion);
|
||||
var tscDiagnosticsLinter = new ArkTSLinter_1_1.TSCCompiledProgram(tsBuilderProgram);
|
||||
var program = tscDiagnosticsLinter.getProgram();
|
||||
var compilerOptions = program.getCompilerOptions();
|
||||
var changedFiles = collectChangedFilesFromProgramState(programState, arkTSVersion, compilerOptions.compatibleSdkVersion, compilerOptions.compatibleSdkVersionStage);
|
||||
// Set arkTSVersion info for file .tsbuildinfo.
|
||||
// File .tsbuildinfo.linter dosen't need to set arkTSVersion because it dosen't contain linter diagnostics.
|
||||
programState.arkTSVersion = arkTSVersion;
|
||||
var tscDiagnosticsLinter = new ArkTSLinter_1_1.TSCCompiledProgram(tsBuilderProgram);
|
||||
var program = tscDiagnosticsLinter.getProgram();
|
||||
// Record the compatible version information configured in 'build-profile.json5',
|
||||
// so that incremental compilation needs to recheck all files when the configuration changes.
|
||||
programState.compatibleSdkVersion = compilerOptions.compatibleSdkVersion;
|
||||
programState.compatibleSdkVersionStage = compilerOptions.compatibleSdkVersionStage;
|
||||
var timePrinterInstance = ts.ArkTSLinterTimePrinter.getInstance();
|
||||
timePrinterInstance.appendTime(ts.TimePhase.INIT);
|
||||
tscDiagnosticsLinter.doAllGetDiagnostics();
|
||||
@ -199059,11 +199071,14 @@ var ts;
|
||||
ArkTSLinter_1_1.Utils.clearTypeChecker();
|
||||
ArkTSLinter_1_1.Utils.clearTrueSymbolAtLocationCache();
|
||||
}
|
||||
function collectChangedFilesFromProgramState(state, arkTSVersion) {
|
||||
function collectChangedFilesFromProgramState(state, arkTSVersion, compatibleSdkVersion, compatibleSdkVersionStage) {
|
||||
var changedFiles = new ts.Set(state.changedFilesSet);
|
||||
// If old arkTSVersion from last run is not same current arkTSVersion from ets_loader,
|
||||
// the process all files in project.
|
||||
if (state.arkTSVersion !== arkTSVersion) {
|
||||
// The compatibleSdkVersion and compatibleSdkVersionStage is the same as arkTSVersion
|
||||
if (state.arkTSVersion !== arkTSVersion ||
|
||||
state.compatibleSdkVersion !== compatibleSdkVersion ||
|
||||
state.compatibleSdkVersionStage !== compatibleSdkVersionStage) {
|
||||
return new ts.Set(ts.arrayFrom(state.fileInfos.keys()));
|
||||
}
|
||||
// If any source file that affects global scope has been changed,
|
||||
|
2
lib/tsserverlibrary.d.ts
vendored
2
lib/tsserverlibrary.d.ts
vendored
@ -13617,7 +13617,7 @@ declare namespace ts {
|
||||
private checkAssignmentMatching;
|
||||
private handleDecorator;
|
||||
private isSendableDecoratorValid;
|
||||
private isImportLazyValid;
|
||||
private checkImportLazy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -125401,6 +125401,8 @@ var ts;
|
||||
}
|
||||
}
|
||||
state.arkTSVersion = useOldState ? oldState === null || oldState === void 0 ? void 0 : oldState.arkTSVersion : undefined;
|
||||
state.compatibleSdkVersion = useOldState ? oldState === null || oldState === void 0 ? void 0 : oldState.compatibleSdkVersion : undefined;
|
||||
state.compatibleSdkVersionStage = useOldState ? oldState === null || oldState === void 0 ? void 0 : oldState.compatibleSdkVersionStage : undefined;
|
||||
// Update changed files and copy semantic diagnostics if we can
|
||||
var referencedMap = state.referencedMap;
|
||||
var oldReferencedMap = useOldState ? oldState.referencedMap : undefined;
|
||||
@ -126026,6 +126028,8 @@ var ts;
|
||||
});
|
||||
}
|
||||
var arkTSVersion = state.arkTSVersion;
|
||||
var compatibleSdkVersion = state.compatibleSdkVersion;
|
||||
var compatibleSdkVersionStage = state.compatibleSdkVersionStage;
|
||||
var result = {
|
||||
fileNames: fileNames,
|
||||
fileInfos: fileInfos,
|
||||
@ -126040,6 +126044,8 @@ var ts;
|
||||
emitSignatures: emitSignatures,
|
||||
latestChangedDtsFile: latestChangedDtsFile,
|
||||
arkTSVersion: arkTSVersion,
|
||||
compatibleSdkVersion: compatibleSdkVersion,
|
||||
compatibleSdkVersionStage: compatibleSdkVersionStage,
|
||||
};
|
||||
if (hasConstEnumRelateInfo) {
|
||||
result.constEnumRelateCache = constEnumRelateCache;
|
||||
@ -126583,6 +126589,8 @@ var ts;
|
||||
emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
|
||||
constEnumRelatePerFile: constEnumRelatePerFile,
|
||||
arkTSVersion: program.arkTSVersion,
|
||||
compatibleSdkVersion: program.compatibleSdkVersion,
|
||||
compatibleSdkVersionStage: program.compatibleSdkVersionStage,
|
||||
};
|
||||
}
|
||||
return {
|
||||
@ -192954,11 +192962,11 @@ var ts;
|
||||
ArkTSLinter_1_1.cookBookTag[180] =
|
||||
'The "@Sendable" decorator can only be used on "class", "function" and "typeAlias" (arkts-sendable-decorator-limited)';
|
||||
ArkTSLinter_1_1.cookBookTag[181] =
|
||||
'The exported "Sendable" class or function cannot be captured by "Sendable" Class or function in current file (arkts-sendable-closure-export)';
|
||||
'The exported "Sendable" class or function cannot be captured by "Sendable" class or function in current file (arkts-sendable-closure-export)';
|
||||
ArkTSLinter_1_1.cookBookTag[182] =
|
||||
'Sendable functions and sendable typealias are not available when compatibleSdkVersionStage is lowering than Beta3 of API12 (arkts-sendable-beta-compatible)';
|
||||
'Sendable functions and sendable typealias are not available when compatibleSdkVersionStage is lowering than beta3 of API12 (arkts-sendable-beta-compatible)';
|
||||
ArkTSLinter_1_1.cookBookTag[183] =
|
||||
'Lazy imports are not available when compatibleSdkVersionStage is lowering than Beta3 of API12 (arkts-import-lazy-beta-compatible)';
|
||||
'Lazy imports are not available when compatibleSdkVersionStage is lowering than beta3 of API12 (arkts-import-lazy-beta-compatible)';
|
||||
})(ArkTSLinter_1_1 = ts.ArkTSLinter_1_1 || (ts.ArkTSLinter_1_1 = {}));
|
||||
})(ts || (ts = {}));
|
||||
/*
|
||||
@ -196975,7 +196983,7 @@ var ts;
|
||||
var _this = this;
|
||||
var callback = function (node) {
|
||||
// Namespace import will introduce closure in the es2abc compiler stage
|
||||
if (!ts.isIdentifier(node) || _this.checkNamespaceImportVar(node)) {
|
||||
if (!ts.isIdentifier(node) || _this.checkNamespaceImportVar(node, faultId)) {
|
||||
return;
|
||||
}
|
||||
// The "b" of "A.b" should not be checked since it's load from object "A"
|
||||
@ -197051,13 +197059,13 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
TypeScriptLinter.prototype.checkNamespaceImportVar = function (node) {
|
||||
TypeScriptLinter.prototype.checkNamespaceImportVar = function (node, faultId) {
|
||||
// Namespace import cannot be determined by the true symbol
|
||||
var sym = TypeScriptLinter.tsTypeChecker.getSymbolAtLocation(node);
|
||||
var decls = sym === null || sym === void 0 ? void 0 : sym.getDeclarations();
|
||||
if (decls === null || decls === void 0 ? void 0 : decls.length) {
|
||||
if (ts.isNamespaceImport(decls[0])) {
|
||||
this.incrementCounters(node, FaultID.SendableCapturedVars);
|
||||
this.incrementCounters(node, faultId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -197210,7 +197218,7 @@ var ts;
|
||||
if (tsImportClause.name) {
|
||||
this.countDeclarationsWithDuplicateName(tsImportClause.name, tsImportClause);
|
||||
}
|
||||
this.isImportLazyValid(tsImportClause);
|
||||
this.checkImportLazy(tsImportClause);
|
||||
};
|
||||
TypeScriptLinter.prototype.handleImportSpecifier = function (node) {
|
||||
var tsImportSpecifier = node;
|
||||
@ -198094,14 +198102,13 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
TypeScriptLinter.prototype.isImportLazyValid = function (tsImportClause) {
|
||||
TypeScriptLinter.prototype.checkImportLazy = function (tsImportClause) {
|
||||
if (!tsImportClause.isLazy ||
|
||||
this.compatibleSdkVersion > 12 ||
|
||||
this.compatibleSdkVersion === 12 && (this.compatibleSdkVersionStage !== 'beta1' && this.compatibleSdkVersionStage !== 'beta2')) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
this.incrementCounters(tsImportClause, FaultID.ImportLazyBetaCompatible);
|
||||
return false;
|
||||
};
|
||||
TypeScriptLinter.reportDiagnostics = true;
|
||||
// The SyntaxKind enum defines additional elements at the end of the enum
|
||||
@ -198723,12 +198730,17 @@ var ts;
|
||||
var programState = tsBuilderProgram.getState();
|
||||
var oldDiagnostics = programState.arktsLinterDiagnosticsPerFile;
|
||||
programState.arktsLinterDiagnosticsPerFile = new ts.Map();
|
||||
var changedFiles = collectChangedFilesFromProgramState(programState, arkTSVersion);
|
||||
var tscDiagnosticsLinter = new ArkTSLinter_1_1.TSCCompiledProgram(tsBuilderProgram);
|
||||
var program = tscDiagnosticsLinter.getProgram();
|
||||
var compilerOptions = program.getCompilerOptions();
|
||||
var changedFiles = collectChangedFilesFromProgramState(programState, arkTSVersion, compilerOptions.compatibleSdkVersion, compilerOptions.compatibleSdkVersionStage);
|
||||
// Set arkTSVersion info for file .tsbuildinfo.
|
||||
// File .tsbuildinfo.linter dosen't need to set arkTSVersion because it dosen't contain linter diagnostics.
|
||||
programState.arkTSVersion = arkTSVersion;
|
||||
var tscDiagnosticsLinter = new ArkTSLinter_1_1.TSCCompiledProgram(tsBuilderProgram);
|
||||
var program = tscDiagnosticsLinter.getProgram();
|
||||
// Record the compatible version information configured in 'build-profile.json5',
|
||||
// so that incremental compilation needs to recheck all files when the configuration changes.
|
||||
programState.compatibleSdkVersion = compilerOptions.compatibleSdkVersion;
|
||||
programState.compatibleSdkVersionStage = compilerOptions.compatibleSdkVersionStage;
|
||||
var timePrinterInstance = ts.ArkTSLinterTimePrinter.getInstance();
|
||||
timePrinterInstance.appendTime(ts.TimePhase.INIT);
|
||||
tscDiagnosticsLinter.doAllGetDiagnostics();
|
||||
@ -198804,11 +198816,14 @@ var ts;
|
||||
ArkTSLinter_1_1.Utils.clearTypeChecker();
|
||||
ArkTSLinter_1_1.Utils.clearTrueSymbolAtLocationCache();
|
||||
}
|
||||
function collectChangedFilesFromProgramState(state, arkTSVersion) {
|
||||
function collectChangedFilesFromProgramState(state, arkTSVersion, compatibleSdkVersion, compatibleSdkVersionStage) {
|
||||
var changedFiles = new ts.Set(state.changedFilesSet);
|
||||
// If old arkTSVersion from last run is not same current arkTSVersion from ets_loader,
|
||||
// the process all files in project.
|
||||
if (state.arkTSVersion !== arkTSVersion) {
|
||||
// The compatibleSdkVersion and compatibleSdkVersionStage is the same as arkTSVersion
|
||||
if (state.arkTSVersion !== arkTSVersion ||
|
||||
state.compatibleSdkVersion !== compatibleSdkVersion ||
|
||||
state.compatibleSdkVersionStage !== compatibleSdkVersionStage) {
|
||||
return new ts.Set(ts.arrayFrom(state.fileInfos.keys()));
|
||||
}
|
||||
// If any source file that affects global scope has been changed,
|
||||
|
2
lib/typescript.d.ts
vendored
2
lib/typescript.d.ts
vendored
@ -9671,7 +9671,7 @@ declare namespace ts {
|
||||
private checkAssignmentMatching;
|
||||
private handleDecorator;
|
||||
private isSendableDecoratorValid;
|
||||
private isImportLazyValid;
|
||||
private checkImportLazy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -125392,6 +125392,8 @@ var ts;
|
||||
}
|
||||
}
|
||||
state.arkTSVersion = useOldState ? oldState === null || oldState === void 0 ? void 0 : oldState.arkTSVersion : undefined;
|
||||
state.compatibleSdkVersion = useOldState ? oldState === null || oldState === void 0 ? void 0 : oldState.compatibleSdkVersion : undefined;
|
||||
state.compatibleSdkVersionStage = useOldState ? oldState === null || oldState === void 0 ? void 0 : oldState.compatibleSdkVersionStage : undefined;
|
||||
// Update changed files and copy semantic diagnostics if we can
|
||||
var referencedMap = state.referencedMap;
|
||||
var oldReferencedMap = useOldState ? oldState.referencedMap : undefined;
|
||||
@ -126017,6 +126019,8 @@ var ts;
|
||||
});
|
||||
}
|
||||
var arkTSVersion = state.arkTSVersion;
|
||||
var compatibleSdkVersion = state.compatibleSdkVersion;
|
||||
var compatibleSdkVersionStage = state.compatibleSdkVersionStage;
|
||||
var result = {
|
||||
fileNames: fileNames,
|
||||
fileInfos: fileInfos,
|
||||
@ -126031,6 +126035,8 @@ var ts;
|
||||
emitSignatures: emitSignatures,
|
||||
latestChangedDtsFile: latestChangedDtsFile,
|
||||
arkTSVersion: arkTSVersion,
|
||||
compatibleSdkVersion: compatibleSdkVersion,
|
||||
compatibleSdkVersionStage: compatibleSdkVersionStage,
|
||||
};
|
||||
if (hasConstEnumRelateInfo) {
|
||||
result.constEnumRelateCache = constEnumRelateCache;
|
||||
@ -126574,6 +126580,8 @@ var ts;
|
||||
emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
|
||||
constEnumRelatePerFile: constEnumRelatePerFile,
|
||||
arkTSVersion: program.arkTSVersion,
|
||||
compatibleSdkVersion: program.compatibleSdkVersion,
|
||||
compatibleSdkVersionStage: program.compatibleSdkVersionStage,
|
||||
};
|
||||
}
|
||||
return {
|
||||
@ -182048,11 +182056,11 @@ var ts;
|
||||
ArkTSLinter_1_1.cookBookTag[180] =
|
||||
'The "@Sendable" decorator can only be used on "class", "function" and "typeAlias" (arkts-sendable-decorator-limited)';
|
||||
ArkTSLinter_1_1.cookBookTag[181] =
|
||||
'The exported "Sendable" class or function cannot be captured by "Sendable" Class or function in current file (arkts-sendable-closure-export)';
|
||||
'The exported "Sendable" class or function cannot be captured by "Sendable" class or function in current file (arkts-sendable-closure-export)';
|
||||
ArkTSLinter_1_1.cookBookTag[182] =
|
||||
'Sendable functions and sendable typealias are not available when compatibleSdkVersionStage is lowering than Beta3 of API12 (arkts-sendable-beta-compatible)';
|
||||
'Sendable functions and sendable typealias are not available when compatibleSdkVersionStage is lowering than beta3 of API12 (arkts-sendable-beta-compatible)';
|
||||
ArkTSLinter_1_1.cookBookTag[183] =
|
||||
'Lazy imports are not available when compatibleSdkVersionStage is lowering than Beta3 of API12 (arkts-import-lazy-beta-compatible)';
|
||||
'Lazy imports are not available when compatibleSdkVersionStage is lowering than beta3 of API12 (arkts-import-lazy-beta-compatible)';
|
||||
})(ArkTSLinter_1_1 = ts.ArkTSLinter_1_1 || (ts.ArkTSLinter_1_1 = {}));
|
||||
})(ts || (ts = {}));
|
||||
/*
|
||||
@ -186069,7 +186077,7 @@ var ts;
|
||||
var _this = this;
|
||||
var callback = function (node) {
|
||||
// Namespace import will introduce closure in the es2abc compiler stage
|
||||
if (!ts.isIdentifier(node) || _this.checkNamespaceImportVar(node)) {
|
||||
if (!ts.isIdentifier(node) || _this.checkNamespaceImportVar(node, faultId)) {
|
||||
return;
|
||||
}
|
||||
// The "b" of "A.b" should not be checked since it's load from object "A"
|
||||
@ -186145,13 +186153,13 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
TypeScriptLinter.prototype.checkNamespaceImportVar = function (node) {
|
||||
TypeScriptLinter.prototype.checkNamespaceImportVar = function (node, faultId) {
|
||||
// Namespace import cannot be determined by the true symbol
|
||||
var sym = TypeScriptLinter.tsTypeChecker.getSymbolAtLocation(node);
|
||||
var decls = sym === null || sym === void 0 ? void 0 : sym.getDeclarations();
|
||||
if (decls === null || decls === void 0 ? void 0 : decls.length) {
|
||||
if (ts.isNamespaceImport(decls[0])) {
|
||||
this.incrementCounters(node, FaultID.SendableCapturedVars);
|
||||
this.incrementCounters(node, faultId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -186304,7 +186312,7 @@ var ts;
|
||||
if (tsImportClause.name) {
|
||||
this.countDeclarationsWithDuplicateName(tsImportClause.name, tsImportClause);
|
||||
}
|
||||
this.isImportLazyValid(tsImportClause);
|
||||
this.checkImportLazy(tsImportClause);
|
||||
};
|
||||
TypeScriptLinter.prototype.handleImportSpecifier = function (node) {
|
||||
var tsImportSpecifier = node;
|
||||
@ -187188,14 +187196,13 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
TypeScriptLinter.prototype.isImportLazyValid = function (tsImportClause) {
|
||||
TypeScriptLinter.prototype.checkImportLazy = function (tsImportClause) {
|
||||
if (!tsImportClause.isLazy ||
|
||||
this.compatibleSdkVersion > 12 ||
|
||||
this.compatibleSdkVersion === 12 && (this.compatibleSdkVersionStage !== 'beta1' && this.compatibleSdkVersionStage !== 'beta2')) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
this.incrementCounters(tsImportClause, FaultID.ImportLazyBetaCompatible);
|
||||
return false;
|
||||
};
|
||||
TypeScriptLinter.reportDiagnostics = true;
|
||||
// The SyntaxKind enum defines additional elements at the end of the enum
|
||||
@ -187817,12 +187824,17 @@ var ts;
|
||||
var programState = tsBuilderProgram.getState();
|
||||
var oldDiagnostics = programState.arktsLinterDiagnosticsPerFile;
|
||||
programState.arktsLinterDiagnosticsPerFile = new ts.Map();
|
||||
var changedFiles = collectChangedFilesFromProgramState(programState, arkTSVersion);
|
||||
var tscDiagnosticsLinter = new ArkTSLinter_1_1.TSCCompiledProgram(tsBuilderProgram);
|
||||
var program = tscDiagnosticsLinter.getProgram();
|
||||
var compilerOptions = program.getCompilerOptions();
|
||||
var changedFiles = collectChangedFilesFromProgramState(programState, arkTSVersion, compilerOptions.compatibleSdkVersion, compilerOptions.compatibleSdkVersionStage);
|
||||
// Set arkTSVersion info for file .tsbuildinfo.
|
||||
// File .tsbuildinfo.linter dosen't need to set arkTSVersion because it dosen't contain linter diagnostics.
|
||||
programState.arkTSVersion = arkTSVersion;
|
||||
var tscDiagnosticsLinter = new ArkTSLinter_1_1.TSCCompiledProgram(tsBuilderProgram);
|
||||
var program = tscDiagnosticsLinter.getProgram();
|
||||
// Record the compatible version information configured in 'build-profile.json5',
|
||||
// so that incremental compilation needs to recheck all files when the configuration changes.
|
||||
programState.compatibleSdkVersion = compilerOptions.compatibleSdkVersion;
|
||||
programState.compatibleSdkVersionStage = compilerOptions.compatibleSdkVersionStage;
|
||||
var timePrinterInstance = ts.ArkTSLinterTimePrinter.getInstance();
|
||||
timePrinterInstance.appendTime(ts.TimePhase.INIT);
|
||||
tscDiagnosticsLinter.doAllGetDiagnostics();
|
||||
@ -187898,11 +187910,14 @@ var ts;
|
||||
ArkTSLinter_1_1.Utils.clearTypeChecker();
|
||||
ArkTSLinter_1_1.Utils.clearTrueSymbolAtLocationCache();
|
||||
}
|
||||
function collectChangedFilesFromProgramState(state, arkTSVersion) {
|
||||
function collectChangedFilesFromProgramState(state, arkTSVersion, compatibleSdkVersion, compatibleSdkVersionStage) {
|
||||
var changedFiles = new ts.Set(state.changedFilesSet);
|
||||
// If old arkTSVersion from last run is not same current arkTSVersion from ets_loader,
|
||||
// the process all files in project.
|
||||
if (state.arkTSVersion !== arkTSVersion) {
|
||||
// The compatibleSdkVersion and compatibleSdkVersionStage is the same as arkTSVersion
|
||||
if (state.arkTSVersion !== arkTSVersion ||
|
||||
state.compatibleSdkVersion !== compatibleSdkVersion ||
|
||||
state.compatibleSdkVersionStage !== compatibleSdkVersionStage) {
|
||||
return new ts.Set(ts.arrayFrom(state.fileInfos.keys()));
|
||||
}
|
||||
// If any source file that affects global scope has been changed,
|
||||
|
2
lib/typescriptServices.d.ts
vendored
2
lib/typescriptServices.d.ts
vendored
@ -9671,7 +9671,7 @@ declare namespace ts {
|
||||
private checkAssignmentMatching;
|
||||
private handleDecorator;
|
||||
private isSendableDecoratorValid;
|
||||
private isImportLazyValid;
|
||||
private checkImportLazy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -125392,6 +125392,8 @@ var ts;
|
||||
}
|
||||
}
|
||||
state.arkTSVersion = useOldState ? oldState === null || oldState === void 0 ? void 0 : oldState.arkTSVersion : undefined;
|
||||
state.compatibleSdkVersion = useOldState ? oldState === null || oldState === void 0 ? void 0 : oldState.compatibleSdkVersion : undefined;
|
||||
state.compatibleSdkVersionStage = useOldState ? oldState === null || oldState === void 0 ? void 0 : oldState.compatibleSdkVersionStage : undefined;
|
||||
// Update changed files and copy semantic diagnostics if we can
|
||||
var referencedMap = state.referencedMap;
|
||||
var oldReferencedMap = useOldState ? oldState.referencedMap : undefined;
|
||||
@ -126017,6 +126019,8 @@ var ts;
|
||||
});
|
||||
}
|
||||
var arkTSVersion = state.arkTSVersion;
|
||||
var compatibleSdkVersion = state.compatibleSdkVersion;
|
||||
var compatibleSdkVersionStage = state.compatibleSdkVersionStage;
|
||||
var result = {
|
||||
fileNames: fileNames,
|
||||
fileInfos: fileInfos,
|
||||
@ -126031,6 +126035,8 @@ var ts;
|
||||
emitSignatures: emitSignatures,
|
||||
latestChangedDtsFile: latestChangedDtsFile,
|
||||
arkTSVersion: arkTSVersion,
|
||||
compatibleSdkVersion: compatibleSdkVersion,
|
||||
compatibleSdkVersionStage: compatibleSdkVersionStage,
|
||||
};
|
||||
if (hasConstEnumRelateInfo) {
|
||||
result.constEnumRelateCache = constEnumRelateCache;
|
||||
@ -126574,6 +126580,8 @@ var ts;
|
||||
emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
|
||||
constEnumRelatePerFile: constEnumRelatePerFile,
|
||||
arkTSVersion: program.arkTSVersion,
|
||||
compatibleSdkVersion: program.compatibleSdkVersion,
|
||||
compatibleSdkVersionStage: program.compatibleSdkVersionStage,
|
||||
};
|
||||
}
|
||||
return {
|
||||
@ -182048,11 +182056,11 @@ var ts;
|
||||
ArkTSLinter_1_1.cookBookTag[180] =
|
||||
'The "@Sendable" decorator can only be used on "class", "function" and "typeAlias" (arkts-sendable-decorator-limited)';
|
||||
ArkTSLinter_1_1.cookBookTag[181] =
|
||||
'The exported "Sendable" class or function cannot be captured by "Sendable" Class or function in current file (arkts-sendable-closure-export)';
|
||||
'The exported "Sendable" class or function cannot be captured by "Sendable" class or function in current file (arkts-sendable-closure-export)';
|
||||
ArkTSLinter_1_1.cookBookTag[182] =
|
||||
'Sendable functions and sendable typealias are not available when compatibleSdkVersionStage is lowering than Beta3 of API12 (arkts-sendable-beta-compatible)';
|
||||
'Sendable functions and sendable typealias are not available when compatibleSdkVersionStage is lowering than beta3 of API12 (arkts-sendable-beta-compatible)';
|
||||
ArkTSLinter_1_1.cookBookTag[183] =
|
||||
'Lazy imports are not available when compatibleSdkVersionStage is lowering than Beta3 of API12 (arkts-import-lazy-beta-compatible)';
|
||||
'Lazy imports are not available when compatibleSdkVersionStage is lowering than beta3 of API12 (arkts-import-lazy-beta-compatible)';
|
||||
})(ArkTSLinter_1_1 = ts.ArkTSLinter_1_1 || (ts.ArkTSLinter_1_1 = {}));
|
||||
})(ts || (ts = {}));
|
||||
/*
|
||||
@ -186069,7 +186077,7 @@ var ts;
|
||||
var _this = this;
|
||||
var callback = function (node) {
|
||||
// Namespace import will introduce closure in the es2abc compiler stage
|
||||
if (!ts.isIdentifier(node) || _this.checkNamespaceImportVar(node)) {
|
||||
if (!ts.isIdentifier(node) || _this.checkNamespaceImportVar(node, faultId)) {
|
||||
return;
|
||||
}
|
||||
// The "b" of "A.b" should not be checked since it's load from object "A"
|
||||
@ -186145,13 +186153,13 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
TypeScriptLinter.prototype.checkNamespaceImportVar = function (node) {
|
||||
TypeScriptLinter.prototype.checkNamespaceImportVar = function (node, faultId) {
|
||||
// Namespace import cannot be determined by the true symbol
|
||||
var sym = TypeScriptLinter.tsTypeChecker.getSymbolAtLocation(node);
|
||||
var decls = sym === null || sym === void 0 ? void 0 : sym.getDeclarations();
|
||||
if (decls === null || decls === void 0 ? void 0 : decls.length) {
|
||||
if (ts.isNamespaceImport(decls[0])) {
|
||||
this.incrementCounters(node, FaultID.SendableCapturedVars);
|
||||
this.incrementCounters(node, faultId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -186304,7 +186312,7 @@ var ts;
|
||||
if (tsImportClause.name) {
|
||||
this.countDeclarationsWithDuplicateName(tsImportClause.name, tsImportClause);
|
||||
}
|
||||
this.isImportLazyValid(tsImportClause);
|
||||
this.checkImportLazy(tsImportClause);
|
||||
};
|
||||
TypeScriptLinter.prototype.handleImportSpecifier = function (node) {
|
||||
var tsImportSpecifier = node;
|
||||
@ -187188,14 +187196,13 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
TypeScriptLinter.prototype.isImportLazyValid = function (tsImportClause) {
|
||||
TypeScriptLinter.prototype.checkImportLazy = function (tsImportClause) {
|
||||
if (!tsImportClause.isLazy ||
|
||||
this.compatibleSdkVersion > 12 ||
|
||||
this.compatibleSdkVersion === 12 && (this.compatibleSdkVersionStage !== 'beta1' && this.compatibleSdkVersionStage !== 'beta2')) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
this.incrementCounters(tsImportClause, FaultID.ImportLazyBetaCompatible);
|
||||
return false;
|
||||
};
|
||||
TypeScriptLinter.reportDiagnostics = true;
|
||||
// The SyntaxKind enum defines additional elements at the end of the enum
|
||||
@ -187817,12 +187824,17 @@ var ts;
|
||||
var programState = tsBuilderProgram.getState();
|
||||
var oldDiagnostics = programState.arktsLinterDiagnosticsPerFile;
|
||||
programState.arktsLinterDiagnosticsPerFile = new ts.Map();
|
||||
var changedFiles = collectChangedFilesFromProgramState(programState, arkTSVersion);
|
||||
var tscDiagnosticsLinter = new ArkTSLinter_1_1.TSCCompiledProgram(tsBuilderProgram);
|
||||
var program = tscDiagnosticsLinter.getProgram();
|
||||
var compilerOptions = program.getCompilerOptions();
|
||||
var changedFiles = collectChangedFilesFromProgramState(programState, arkTSVersion, compilerOptions.compatibleSdkVersion, compilerOptions.compatibleSdkVersionStage);
|
||||
// Set arkTSVersion info for file .tsbuildinfo.
|
||||
// File .tsbuildinfo.linter dosen't need to set arkTSVersion because it dosen't contain linter diagnostics.
|
||||
programState.arkTSVersion = arkTSVersion;
|
||||
var tscDiagnosticsLinter = new ArkTSLinter_1_1.TSCCompiledProgram(tsBuilderProgram);
|
||||
var program = tscDiagnosticsLinter.getProgram();
|
||||
// Record the compatible version information configured in 'build-profile.json5',
|
||||
// so that incremental compilation needs to recheck all files when the configuration changes.
|
||||
programState.compatibleSdkVersion = compilerOptions.compatibleSdkVersion;
|
||||
programState.compatibleSdkVersionStage = compilerOptions.compatibleSdkVersionStage;
|
||||
var timePrinterInstance = ts.ArkTSLinterTimePrinter.getInstance();
|
||||
timePrinterInstance.appendTime(ts.TimePhase.INIT);
|
||||
tscDiagnosticsLinter.doAllGetDiagnostics();
|
||||
@ -187898,11 +187910,14 @@ var ts;
|
||||
ArkTSLinter_1_1.Utils.clearTypeChecker();
|
||||
ArkTSLinter_1_1.Utils.clearTrueSymbolAtLocationCache();
|
||||
}
|
||||
function collectChangedFilesFromProgramState(state, arkTSVersion) {
|
||||
function collectChangedFilesFromProgramState(state, arkTSVersion, compatibleSdkVersion, compatibleSdkVersionStage) {
|
||||
var changedFiles = new ts.Set(state.changedFilesSet);
|
||||
// If old arkTSVersion from last run is not same current arkTSVersion from ets_loader,
|
||||
// the process all files in project.
|
||||
if (state.arkTSVersion !== arkTSVersion) {
|
||||
// The compatibleSdkVersion and compatibleSdkVersionStage is the same as arkTSVersion
|
||||
if (state.arkTSVersion !== arkTSVersion ||
|
||||
state.compatibleSdkVersion !== compatibleSdkVersion ||
|
||||
state.compatibleSdkVersionStage !== compatibleSdkVersionStage) {
|
||||
return new ts.Set(ts.arrayFrom(state.fileInfos.keys()));
|
||||
}
|
||||
// If any source file that affects global scope has been changed,
|
||||
|
@ -125382,6 +125382,8 @@ var ts;
|
||||
}
|
||||
}
|
||||
state.arkTSVersion = useOldState ? oldState === null || oldState === void 0 ? void 0 : oldState.arkTSVersion : undefined;
|
||||
state.compatibleSdkVersion = useOldState ? oldState === null || oldState === void 0 ? void 0 : oldState.compatibleSdkVersion : undefined;
|
||||
state.compatibleSdkVersionStage = useOldState ? oldState === null || oldState === void 0 ? void 0 : oldState.compatibleSdkVersionStage : undefined;
|
||||
// Update changed files and copy semantic diagnostics if we can
|
||||
var referencedMap = state.referencedMap;
|
||||
var oldReferencedMap = useOldState ? oldState.referencedMap : undefined;
|
||||
@ -126007,6 +126009,8 @@ var ts;
|
||||
});
|
||||
}
|
||||
var arkTSVersion = state.arkTSVersion;
|
||||
var compatibleSdkVersion = state.compatibleSdkVersion;
|
||||
var compatibleSdkVersionStage = state.compatibleSdkVersionStage;
|
||||
var result = {
|
||||
fileNames: fileNames,
|
||||
fileInfos: fileInfos,
|
||||
@ -126021,6 +126025,8 @@ var ts;
|
||||
emitSignatures: emitSignatures,
|
||||
latestChangedDtsFile: latestChangedDtsFile,
|
||||
arkTSVersion: arkTSVersion,
|
||||
compatibleSdkVersion: compatibleSdkVersion,
|
||||
compatibleSdkVersionStage: compatibleSdkVersionStage,
|
||||
};
|
||||
if (hasConstEnumRelateInfo) {
|
||||
result.constEnumRelateCache = constEnumRelateCache;
|
||||
@ -126564,6 +126570,8 @@ var ts;
|
||||
emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
|
||||
constEnumRelatePerFile: constEnumRelatePerFile,
|
||||
arkTSVersion: program.arkTSVersion,
|
||||
compatibleSdkVersion: program.compatibleSdkVersion,
|
||||
compatibleSdkVersionStage: program.compatibleSdkVersionStage,
|
||||
};
|
||||
}
|
||||
return {
|
||||
|
@ -82,6 +82,14 @@ namespace ts {
|
||||
* Cache the ArkTSVersion info
|
||||
*/
|
||||
arkTSVersion?: string;
|
||||
/**
|
||||
* Cache the compatibleSdkVersion info
|
||||
*/
|
||||
compatibleSdkVersion?: number;
|
||||
/**
|
||||
* Cache the compatibleSdkVersionStage info
|
||||
*/
|
||||
compatibleSdkVersionStage?: string;
|
||||
}
|
||||
|
||||
export const enum BuilderFileEmit {
|
||||
@ -165,6 +173,14 @@ namespace ts {
|
||||
* should be called when obtaining Diagnostics later.
|
||||
*/
|
||||
isForLinter?: boolean;
|
||||
/**
|
||||
* Cache the compatibleSdkVersion info
|
||||
*/
|
||||
compatibleSdkVersion?: number;
|
||||
/**
|
||||
* Cache the compatibleSdkVersionStage info
|
||||
*/
|
||||
compatibleSdkVersionStage?: string;
|
||||
}
|
||||
|
||||
export type SavedBuildProgramEmitState = Pick<BuilderProgramState,
|
||||
@ -232,6 +248,8 @@ namespace ts {
|
||||
}
|
||||
|
||||
state.arkTSVersion = useOldState ? oldState?.arkTSVersion : undefined;
|
||||
state.compatibleSdkVersion = useOldState ? oldState?.compatibleSdkVersion : undefined;
|
||||
state.compatibleSdkVersionStage = useOldState ? oldState?.compatibleSdkVersionStage : undefined;
|
||||
|
||||
// Update changed files and copy semantic diagnostics if we can
|
||||
const referencedMap = state.referencedMap;
|
||||
@ -893,6 +911,8 @@ namespace ts {
|
||||
latestChangedDtsFile?: string;
|
||||
constEnumRelateCache?: Record<string, Record<string, string>>;
|
||||
arkTSVersion?: string;
|
||||
compatibleSdkVersion?: number;
|
||||
compatibleSdkVersionStage?: string;
|
||||
}
|
||||
|
||||
export interface ProgramBundleEmitBuildInfo {
|
||||
@ -1055,6 +1075,8 @@ namespace ts {
|
||||
}
|
||||
|
||||
const arkTSVersion = state.arkTSVersion;
|
||||
const compatibleSdkVersion = state.compatibleSdkVersion;
|
||||
const compatibleSdkVersionStage = state.compatibleSdkVersionStage;
|
||||
|
||||
const result: ProgramMultiFileEmitBuildInfo = {
|
||||
fileNames,
|
||||
@ -1070,6 +1092,8 @@ namespace ts {
|
||||
emitSignatures,
|
||||
latestChangedDtsFile,
|
||||
arkTSVersion,
|
||||
compatibleSdkVersion,
|
||||
compatibleSdkVersionStage,
|
||||
};
|
||||
if (hasConstEnumRelateInfo) {
|
||||
result.constEnumRelateCache = constEnumRelateCache;
|
||||
@ -1681,6 +1705,8 @@ namespace ts {
|
||||
emitSignatures: emitSignatures?.size ? emitSignatures : undefined,
|
||||
constEnumRelatePerFile: constEnumRelatePerFile,
|
||||
arkTSVersion: program.arkTSVersion,
|
||||
compatibleSdkVersion: program.compatibleSdkVersion,
|
||||
compatibleSdkVersionStage: program.compatibleSdkVersionStage,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -203,10 +203,10 @@ cookBookTag[179] = 'Casting "Non-sendable" function to "Sendable" typeAlias is n
|
||||
cookBookTag[180] =
|
||||
'The "@Sendable" decorator can only be used on "class", "function" and "typeAlias" (arkts-sendable-decorator-limited)';
|
||||
cookBookTag[181] =
|
||||
'The exported "Sendable" class or function cannot be captured by "Sendable" Class or function in current file (arkts-sendable-closure-export)';
|
||||
'The exported "Sendable" class or function cannot be captured by "Sendable" class or function in current file (arkts-sendable-closure-export)';
|
||||
cookBookTag[182] =
|
||||
'Sendable functions and sendable typealias are not available when compatibleSdkVersionStage is lowering than Beta3 of API12 (arkts-sendable-beta-compatible)';
|
||||
'Sendable functions and sendable typealias are not available when compatibleSdkVersionStage is lowering than beta3 of API12 (arkts-sendable-beta-compatible)';
|
||||
cookBookTag[183] =
|
||||
'Lazy imports are not available when compatibleSdkVersionStage is lowering than Beta3 of API12 (arkts-import-lazy-beta-compatible)';
|
||||
'Lazy imports are not available when compatibleSdkVersionStage is lowering than beta3 of API12 (arkts-import-lazy-beta-compatible)';
|
||||
}
|
||||
}
|
@ -43,13 +43,18 @@ export function runArkTSLinter(tsBuilderProgram: BuilderProgram, srcFile?: Sourc
|
||||
let programState = tsBuilderProgram.getState();
|
||||
const oldDiagnostics = programState.arktsLinterDiagnosticsPerFile;
|
||||
programState.arktsLinterDiagnosticsPerFile = new Map();
|
||||
const changedFiles = collectChangedFilesFromProgramState(programState, arkTSVersion);
|
||||
// Set arkTSVersion info for file .tsbuildinfo.
|
||||
// File .tsbuildinfo.linter dosen't need to set arkTSVersion because it dosen't contain linter diagnostics.
|
||||
programState.arkTSVersion = arkTSVersion;
|
||||
|
||||
const tscDiagnosticsLinter = new TSCCompiledProgram(tsBuilderProgram);
|
||||
const program = tscDiagnosticsLinter.getProgram();
|
||||
const compilerOptions = program.getCompilerOptions();
|
||||
const changedFiles = collectChangedFilesFromProgramState(programState, arkTSVersion, compilerOptions.compatibleSdkVersion, compilerOptions.compatibleSdkVersionStage);
|
||||
// Set arkTSVersion info for file .tsbuildinfo.
|
||||
// File .tsbuildinfo.linter dosen't need to set arkTSVersion because it dosen't contain linter diagnostics.
|
||||
programState.arkTSVersion = arkTSVersion;
|
||||
// Record the compatible version information configured in 'build-profile.json5',
|
||||
// so that incremental compilation needs to recheck all files when the configuration changes.
|
||||
programState.compatibleSdkVersion = compilerOptions.compatibleSdkVersion;
|
||||
programState.compatibleSdkVersionStage = compilerOptions.compatibleSdkVersionStage;
|
||||
|
||||
const timePrinterInstance = ts.ArkTSLinterTimePrinter.getInstance();
|
||||
timePrinterInstance.appendTime(ts.TimePhase.INIT);
|
||||
@ -132,12 +137,22 @@ function releaseReferences(): void {
|
||||
Utils.clearTrueSymbolAtLocationCache();
|
||||
}
|
||||
|
||||
function collectChangedFilesFromProgramState(state: ReusableBuilderProgramState, arkTSVersion?: string): Set<Path> {
|
||||
function collectChangedFilesFromProgramState(
|
||||
state: ReusableBuilderProgramState,
|
||||
arkTSVersion?: string,
|
||||
compatibleSdkVersion?: number,
|
||||
compatibleSdkVersionStage?: string
|
||||
): Set<Path> {
|
||||
const changedFiles = new Set<Path>(state.changedFilesSet);
|
||||
|
||||
// If old arkTSVersion from last run is not same current arkTSVersion from ets_loader,
|
||||
// the process all files in project.
|
||||
if (state.arkTSVersion !== arkTSVersion) {
|
||||
// The compatibleSdkVersion and compatibleSdkVersionStage is the same as arkTSVersion
|
||||
if (
|
||||
state.arkTSVersion !== arkTSVersion ||
|
||||
state.compatibleSdkVersion !== compatibleSdkVersion ||
|
||||
state.compatibleSdkVersionStage !== compatibleSdkVersionStage
|
||||
) {
|
||||
return new Set<Path>(arrayFrom(state.fileInfos.keys()));
|
||||
}
|
||||
|
||||
|
@ -1307,7 +1307,7 @@ export class TypeScriptLinter {
|
||||
private scanCapturedVarsInSendableScope(startNode: ts.Node, scope: ts.Node, faultId: FaultID): void {
|
||||
const callback = (node: ts.Node): void => {
|
||||
// Namespace import will introduce closure in the es2abc compiler stage
|
||||
if (!ts.isIdentifier(node) || this.checkNamespaceImportVar(node)) {
|
||||
if (!ts.isIdentifier(node) || this.checkNamespaceImportVar(node, faultId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1397,13 +1397,13 @@ export class TypeScriptLinter {
|
||||
return false;
|
||||
}
|
||||
|
||||
private checkNamespaceImportVar(node: ts.Node): boolean {
|
||||
private checkNamespaceImportVar(node: ts.Node, faultId: FaultID): boolean {
|
||||
// Namespace import cannot be determined by the true symbol
|
||||
const sym = TypeScriptLinter.tsTypeChecker.getSymbolAtLocation(node);
|
||||
const decls = sym?.getDeclarations();
|
||||
if (decls?.length) {
|
||||
if (ts.isNamespaceImport(decls[0])) {
|
||||
this.incrementCounters(node, FaultID.SendableCapturedVars);
|
||||
this.incrementCounters(node, faultId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -1567,7 +1567,7 @@ export class TypeScriptLinter {
|
||||
if (tsImportClause.name) {
|
||||
this.countDeclarationsWithDuplicateName(tsImportClause.name, tsImportClause);
|
||||
}
|
||||
this.isImportLazyValid(tsImportClause);
|
||||
this.checkImportLazy(tsImportClause);
|
||||
}
|
||||
|
||||
private handleImportSpecifier(node: Node): void {
|
||||
@ -2570,16 +2570,15 @@ export class TypeScriptLinter {
|
||||
return false;
|
||||
}
|
||||
|
||||
private isImportLazyValid(tsImportClause: ImportClause): boolean {
|
||||
private checkImportLazy(tsImportClause: ImportClause): void {
|
||||
if (
|
||||
!tsImportClause.isLazy ||
|
||||
this.compatibleSdkVersion > 12 ||
|
||||
this.compatibleSdkVersion === 12 && (this.compatibleSdkVersionStage !== 'beta1' && this.compatibleSdkVersionStage !== 'beta2')
|
||||
) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
this.incrementCounters(tsImportClause, FaultID.ImportLazyBetaCompatible);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,5 +24,8 @@
|
||||
"testcase/arkts-sendable-as-expr/arkts-sendable-as-expr-ts/@arkts.lang.d.ets",
|
||||
"testcase/arkts-sendable-generic-types/@arkts.lang.d.ets",
|
||||
"testcase/arkts-sendable-obj-init/@arkts.lang.d.ets",
|
||||
"testcase/arkts-no-structural-typing/@arkts.lang.d.ets"]
|
||||
"testcase/arkts-no-structural-typing/@arkts.lang.d.ets",
|
||||
"testcase/arkts-import-lazy-beta-compatible/arkts-import-lazy-beta-compatible-1-error.ets",
|
||||
"testcase/arkts-import-lazy-beta-compatible/declarationr.ets",
|
||||
"testcase/arkts-sendable-beta-compatible/arkts-sendable-beta-compatible-1-errorr.ets"]
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import lazy { SomeClass } from './declaration';
|
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export class SomeClass {
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@Sendable
|
||||
function sf(): void {}
|
||||
|
||||
@Sendable
|
||||
type Sft = () => void;
|
@ -45,98 +45,98 @@
|
||||
],
|
||||
"arktsVersion_1_1": [
|
||||
{
|
||||
"messageText": "The exported \"Sendable\" class or function cannot be captured by \"Sendable\" Class or function in current file (arkts-sendable-closure-export)",
|
||||
"messageText": "The exported \"Sendable\" class or function cannot be captured by \"Sendable\" class or function in current file (arkts-sendable-closure-export)",
|
||||
"expectLineAndCharacter": {
|
||||
"line": 71,
|
||||
"character": 9
|
||||
}
|
||||
},
|
||||
{
|
||||
"messageText": "The exported \"Sendable\" class or function cannot be captured by \"Sendable\" Class or function in current file (arkts-sendable-closure-export)",
|
||||
"messageText": "The exported \"Sendable\" class or function cannot be captured by \"Sendable\" class or function in current file (arkts-sendable-closure-export)",
|
||||
"expectLineAndCharacter": {
|
||||
"line": 72,
|
||||
"character": 5
|
||||
}
|
||||
},
|
||||
{
|
||||
"messageText": "The exported \"Sendable\" class or function cannot be captured by \"Sendable\" Class or function in current file (arkts-sendable-closure-export)",
|
||||
"messageText": "The exported \"Sendable\" class or function cannot be captured by \"Sendable\" class or function in current file (arkts-sendable-closure-export)",
|
||||
"expectLineAndCharacter": {
|
||||
"line": 73,
|
||||
"character": 9
|
||||
}
|
||||
},
|
||||
{
|
||||
"messageText": "The exported \"Sendable\" class or function cannot be captured by \"Sendable\" Class or function in current file (arkts-sendable-closure-export)",
|
||||
"messageText": "The exported \"Sendable\" class or function cannot be captured by \"Sendable\" class or function in current file (arkts-sendable-closure-export)",
|
||||
"expectLineAndCharacter": {
|
||||
"line": 74,
|
||||
"character": 5
|
||||
}
|
||||
},
|
||||
{
|
||||
"messageText": "The exported \"Sendable\" class or function cannot be captured by \"Sendable\" Class or function in current file (arkts-sendable-closure-export)",
|
||||
"messageText": "The exported \"Sendable\" class or function cannot be captured by \"Sendable\" class or function in current file (arkts-sendable-closure-export)",
|
||||
"expectLineAndCharacter": {
|
||||
"line": 75,
|
||||
"character": 9
|
||||
}
|
||||
},
|
||||
{
|
||||
"messageText": "The exported \"Sendable\" class or function cannot be captured by \"Sendable\" Class or function in current file (arkts-sendable-closure-export)",
|
||||
"messageText": "The exported \"Sendable\" class or function cannot be captured by \"Sendable\" class or function in current file (arkts-sendable-closure-export)",
|
||||
"expectLineAndCharacter": {
|
||||
"line": 76,
|
||||
"character": 5
|
||||
}
|
||||
},
|
||||
{
|
||||
"messageText": "The exported \"Sendable\" class or function cannot be captured by \"Sendable\" Class or function in current file (arkts-sendable-closure-export)",
|
||||
"messageText": "The exported \"Sendable\" class or function cannot be captured by \"Sendable\" class or function in current file (arkts-sendable-closure-export)",
|
||||
"expectLineAndCharacter": {
|
||||
"line": 77,
|
||||
"character": 9
|
||||
}
|
||||
},
|
||||
{
|
||||
"messageText": "The exported \"Sendable\" class or function cannot be captured by \"Sendable\" Class or function in current file (arkts-sendable-closure-export)",
|
||||
"messageText": "The exported \"Sendable\" class or function cannot be captured by \"Sendable\" class or function in current file (arkts-sendable-closure-export)",
|
||||
"expectLineAndCharacter": {
|
||||
"line": 85,
|
||||
"character": 7
|
||||
}
|
||||
},
|
||||
{
|
||||
"messageText": "The exported \"Sendable\" class or function cannot be captured by \"Sendable\" Class or function in current file (arkts-sendable-closure-export)",
|
||||
"messageText": "The exported \"Sendable\" class or function cannot be captured by \"Sendable\" class or function in current file (arkts-sendable-closure-export)",
|
||||
"expectLineAndCharacter": {
|
||||
"line": 86,
|
||||
"character": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"messageText": "The exported \"Sendable\" class or function cannot be captured by \"Sendable\" Class or function in current file (arkts-sendable-closure-export)",
|
||||
"messageText": "The exported \"Sendable\" class or function cannot be captured by \"Sendable\" class or function in current file (arkts-sendable-closure-export)",
|
||||
"expectLineAndCharacter": {
|
||||
"line": 87,
|
||||
"character": 7
|
||||
}
|
||||
},
|
||||
{
|
||||
"messageText": "The exported \"Sendable\" class or function cannot be captured by \"Sendable\" Class or function in current file (arkts-sendable-closure-export)",
|
||||
"messageText": "The exported \"Sendable\" class or function cannot be captured by \"Sendable\" class or function in current file (arkts-sendable-closure-export)",
|
||||
"expectLineAndCharacter": {
|
||||
"line": 88,
|
||||
"character": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"messageText": "The exported \"Sendable\" class or function cannot be captured by \"Sendable\" Class or function in current file (arkts-sendable-closure-export)",
|
||||
"messageText": "The exported \"Sendable\" class or function cannot be captured by \"Sendable\" class or function in current file (arkts-sendable-closure-export)",
|
||||
"expectLineAndCharacter": {
|
||||
"line": 89,
|
||||
"character": 7
|
||||
}
|
||||
},
|
||||
{
|
||||
"messageText": "The exported \"Sendable\" class or function cannot be captured by \"Sendable\" Class or function in current file (arkts-sendable-closure-export)",
|
||||
"messageText": "The exported \"Sendable\" class or function cannot be captured by \"Sendable\" class or function in current file (arkts-sendable-closure-export)",
|
||||
"expectLineAndCharacter": {
|
||||
"line": 90,
|
||||
"character": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"messageText": "The exported \"Sendable\" class or function cannot be captured by \"Sendable\" Class or function in current file (arkts-sendable-closure-export)",
|
||||
"messageText": "The exported \"Sendable\" class or function cannot be captured by \"Sendable\" class or function in current file (arkts-sendable-closure-export)",
|
||||
"expectLineAndCharacter": {
|
||||
"line": 91,
|
||||
"character": 7
|
||||
|
@ -13617,7 +13617,7 @@ declare namespace ts {
|
||||
private checkAssignmentMatching;
|
||||
private handleDecorator;
|
||||
private isSendableDecoratorValid;
|
||||
private isImportLazyValid;
|
||||
private checkImportLazy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9671,7 +9671,7 @@ declare namespace ts {
|
||||
private checkAssignmentMatching;
|
||||
private handleDecorator;
|
||||
private isSendableDecoratorValid;
|
||||
private isImportLazyValid;
|
||||
private checkImportLazy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user