mirror of
https://gitee.com/openharmony/third_party_typescript
synced 2024-11-27 00:51:12 +00:00
fallback bugfix
Issue: https://gitee.com/openharmony/third_party_typescript/issues/IAJECL Signed-off-by: azwenqiang <dengwenqiang5@huawei.com> Change-Id: Ibc557fbd25065b4a54c309907b52e490f082b929
This commit is contained in:
parent
3438daf290
commit
6b2d00454e
@ -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