mirror of
https://gitee.com/openharmony/third_party_typescript
synced 2024-11-23 06:50:54 +00:00
!450 [Linter] 回退SendableFunction相关问题修复
Merge pull request !450 from azwenqiang/0812_bugfix_faultId
This commit is contained in:
commit
347b48503a
@ -198426,7 +198426,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, faultId)) {
|
||||
if (!ts.isIdentifier(node) || _this.checkNamespaceImportVar(node)) {
|
||||
return;
|
||||
}
|
||||
// The "b" of "A.b" should not be checked since it's load from object "A"
|
||||
@ -198502,13 +198502,13 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
TypeScriptLinter.prototype.checkNamespaceImportVar = function (node, faultId) {
|
||||
TypeScriptLinter.prototype.checkNamespaceImportVar = function (node) {
|
||||
// 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);
|
||||
this.incrementCounters(node, FaultID.SendableCapturedVars);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -198171,7 +198171,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, faultId)) {
|
||||
if (!ts.isIdentifier(node) || _this.checkNamespaceImportVar(node)) {
|
||||
return;
|
||||
}
|
||||
// The "b" of "A.b" should not be checked since it's load from object "A"
|
||||
@ -198247,13 +198247,13 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
TypeScriptLinter.prototype.checkNamespaceImportVar = function (node, faultId) {
|
||||
TypeScriptLinter.prototype.checkNamespaceImportVar = function (node) {
|
||||
// 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);
|
||||
this.incrementCounters(node, FaultID.SendableCapturedVars);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -187265,7 +187265,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, faultId)) {
|
||||
if (!ts.isIdentifier(node) || _this.checkNamespaceImportVar(node)) {
|
||||
return;
|
||||
}
|
||||
// The "b" of "A.b" should not be checked since it's load from object "A"
|
||||
@ -187341,13 +187341,13 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
TypeScriptLinter.prototype.checkNamespaceImportVar = function (node, faultId) {
|
||||
TypeScriptLinter.prototype.checkNamespaceImportVar = function (node) {
|
||||
// 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);
|
||||
this.incrementCounters(node, FaultID.SendableCapturedVars);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -187265,7 +187265,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, faultId)) {
|
||||
if (!ts.isIdentifier(node) || _this.checkNamespaceImportVar(node)) {
|
||||
return;
|
||||
}
|
||||
// The "b" of "A.b" should not be checked since it's load from object "A"
|
||||
@ -187341,13 +187341,13 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
TypeScriptLinter.prototype.checkNamespaceImportVar = function (node, faultId) {
|
||||
TypeScriptLinter.prototype.checkNamespaceImportVar = function (node) {
|
||||
// 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);
|
||||
this.incrementCounters(node, FaultID.SendableCapturedVars);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,12 @@ export function runArkTSLinter(tsBuilderProgram: BuilderProgram, srcFile?: Sourc
|
||||
const tscDiagnosticsLinter = new TSCCompiledProgram(tsBuilderProgram);
|
||||
const program = tscDiagnosticsLinter.getProgram();
|
||||
const compilerOptions = program.getCompilerOptions();
|
||||
const changedFiles = collectChangedFilesFromProgramState(programState, arkTSVersion, compilerOptions.compatibleSdkVersion, compilerOptions.compatibleSdkVersionStage);
|
||||
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;
|
||||
|
@ -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, faultId)) {
|
||||
if (!ts.isIdentifier(node) || this.checkNamespaceImportVar(node)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1397,13 +1397,13 @@ export class TypeScriptLinter {
|
||||
return false;
|
||||
}
|
||||
|
||||
private checkNamespaceImportVar(node: ts.Node, faultId: FaultID): boolean {
|
||||
private checkNamespaceImportVar(node: ts.Node): 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);
|
||||
this.incrementCounters(node, FaultID.SendableCapturedVars);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user