diff --git a/compiler/src/ets_checker.ts b/compiler/src/ets_checker.ts index dd490b47131fb2c77ff2f1ace712637803a9fa84..d3506861ca974f909e1b898464b7ea3c64c2e464 100644 --- a/compiler/src/ets_checker.ts +++ b/compiler/src/ets_checker.ts @@ -113,19 +113,9 @@ export interface LanguageServiceCache { maxFlowDepth?: number; preTsImportSendable?: boolean; preSkipOhModulesLint?: boolean; - preEnableStrictCheckOHModule?: boolean; preMixCompile?: boolean; } -export interface RebuildOptions { - targetESVersionDiffers?: boolean; - tsImportSendableDiff?: boolean; - maxFlowDepthDiffers?: boolean; - skipOhModulesLintDiff?: boolean; - enableStrictCheckOHModuleDiff?: boolean; - mixCompileDiff?: boolean; -} - export const SOURCE_FILES: Map = new Map(); export let localPackageSet: Set = new Set(); export const TSC_SYSTEM_CODE = '105'; @@ -221,7 +211,6 @@ function setCompilerOptions(resolveModulePaths: string[]): void { 'compatibleSdkVersionStage': projectConfig.compatibleSdkVersionStage, 'compatibleSdkVersion': projectConfig.compatibleSdkVersion, 'skipOhModulesLint': skipOhModulesLint, - 'enableStrictCheckOHModule': enableStrictCheckOHModule, 'mixCompile': mixCompile, 'isCompileJsHar': isCompileJsHar(), 'moduleRootPath': projectConfig.moduleRootPath, @@ -470,20 +459,16 @@ function getOrCreateLanguageService(servicesHost: ts.LanguageServiceHost, rootFi cache?.preTsImportSendable !== tsImportSendable; const skipOhModulesLintDiff: boolean = (cache?.preSkipOhModulesLint === undefined && !skipOhModulesLint) ? false : cache?.preSkipOhModulesLint !== skipOhModulesLint; - const enableStrictCheckOHModuleDiff: boolean = (cache?.preEnableStrictCheckOHModule === undefined && !enableStrictCheckOHModule) ? - false : cache?.preEnableStrictCheckOHModule !== enableStrictCheckOHModule; const mixCompileDiff: boolean = (cache?.preMixCompile === undefined && !mixCompile) ? false : cache?.preMixCompile !== mixCompile; const shouldRebuild: boolean | undefined = shouldRebuildForDepDiffers || targetESVersionDiffers || - tsImportSendableDiff || maxFlowDepthDiffers || skipOhModulesLintDiff || enableStrictCheckOHModuleDiff || mixCompileDiff; + tsImportSendableDiff || maxFlowDepthDiffers || skipOhModulesLintDiff || mixCompileDiff; if (reuseLanguageServiceForDepChange && hashDiffers && rollupShareObject?.depInfo?.enableIncre) { needReCheckForChangedDepUsers = true; } if (!service || shouldRebuild) { - const options: RebuildOptions = {targetESVersionDiffers, tsImportSendableDiff, maxFlowDepthDiffers, skipOhModulesLintDiff, - enableStrictCheckOHModuleDiff, mixCompileDiff}; - rebuildProgram(options); + rebuildProgram(targetESVersionDiffers, tsImportSendableDiff, maxFlowDepthDiffers, skipOhModulesLintDiff, mixCompileDiff); service = ts.createLanguageService(servicesHost, ts.createDocumentRegistry()); } else { // Found language service from cache, update root files @@ -492,27 +477,25 @@ function getOrCreateLanguageService(servicesHost: ts.LanguageServiceHost, rootFi } const newCache: LanguageServiceCache = { - service: service, pkgJsonFileHash: currentHash, targetESVersion: currentTargetESVersion, maxFlowDepth: currentMaxFlowDepth, - preTsImportSendable: tsImportSendable, preSkipOhModulesLint: skipOhModulesLint, preEnableStrictCheckOHModule: enableStrictCheckOHModule, - preMixCompile: mixCompile}; + service: service, + pkgJsonFileHash: currentHash, + targetESVersion: currentTargetESVersion, + maxFlowDepth: currentMaxFlowDepth, + preTsImportSendable: tsImportSendable, + preSkipOhModulesLint: skipOhModulesLint, + preMixCompile: mixCompile + }; setRollupCache(rollupShareObject, projectConfig, cacheKey, newCache); return service; } -function rebuildProgram(options: RebuildOptions): void { - const { - targetESVersionDiffers, - tsImportSendableDiff, - maxFlowDepthDiffers, - skipOhModulesLintDiff, - enableStrictCheckOHModuleDiff, - mixCompileDiff - } = options; +function rebuildProgram(targetESVersionDiffers: boolean | undefined, tsImportSendableDiff: boolean, + maxFlowDepthDiffers: boolean | undefined, skipOhModulesLintDiff: boolean, mixCompileDiff: boolean): void { if (targetESVersionDiffers) { // If the targetESVersion is changed, we need to delete the build info cahce files deleteBuildInfoCache(compilerOptions.tsBuildInfoFile); targetESVersionChanged = true; - } else if (tsImportSendableDiff || maxFlowDepthDiffers || skipOhModulesLintDiff || enableStrictCheckOHModuleDiff || mixCompileDiff) { + } else if (tsImportSendableDiff || maxFlowDepthDiffers || skipOhModulesLintDiff || mixCompileDiff) { // When tsImportSendable or maxFlowDepth is changed, we need to delete the build info cahce files deleteBuildInfoCache(compilerOptions.tsBuildInfoFile); } @@ -573,7 +556,6 @@ export const warnCheckerResult: WarnCheckerResult = { count: 0 }; export let languageService: ts.LanguageService = null; let tsImportSendable: boolean = false; let skipOhModulesLint: boolean = false; -let enableStrictCheckOHModule: boolean = false; let mixCompile: boolean = false; export let maxMemoryInServiceChecker: number = 0; export function serviceChecker(rootFileNames: string[], newLogger: Object = null, resolveModulePaths: string[] = null, @@ -582,7 +564,6 @@ export function serviceChecker(rootFileNames: string[], newLogger: Object = null let cacheFile: string = null; tsImportSendable = rollupShareObject?.projectConfig.tsImportSendable; skipOhModulesLint = rollupShareObject?.projectConfig.skipOhModulesLint; - enableStrictCheckOHModule = rollupShareObject?.projectConfig.enableStrictCheckOHModule; mixCompile = rollupShareObject?.projectConfig.mixCompile; if (projectConfig.xtsMode || process.env.watchMode === 'true') { if (projectConfig.hotReload) { diff --git a/compiler/src/interop/src/ets_checker.ts b/compiler/src/interop/src/ets_checker.ts index 9fffb6876425511bfc1efd9a30953cdc17b8b7a4..d943be38740bb5907ffeafc7077d71519cb1fe1d 100644 --- a/compiler/src/interop/src/ets_checker.ts +++ b/compiler/src/interop/src/ets_checker.ts @@ -126,19 +126,9 @@ export interface LanguageServiceCache { maxFlowDepth?: number; preTsImportSendable?: boolean; preSkipOhModulesLint?: boolean; - preEnableStrictCheckOHModule?: boolean; preMixCompile?: boolean; } -export interface RebuildOptions { - targetESVersionDiffers?: boolean; - tsImportSendableDiff?: boolean; - maxFlowDepthDiffers?: boolean; - skipOhModulesLintDiff?: boolean; - enableStrictCheckOHModuleDiff?: boolean; - mixCompileDiff?: boolean; -} - export const SOURCE_FILES: Map = new Map(); export let localPackageSet: Set = new Set(); export const TSC_SYSTEM_CODE = '105'; @@ -237,7 +227,6 @@ function setCompilerOptions(resolveModulePaths: string[]): void { 'compatibleSdkVersionStage': projectConfig.compatibleSdkVersionStage, 'compatibleSdkVersion': projectConfig.compatibleSdkVersion, 'skipOhModulesLint': skipOhModulesLint, - 'enableStrictCheckOHModule': enableStrictCheckOHModule, 'mixCompile': mixCompile, 'isCompileJsHar': isCompileJsHar(), 'moduleRootPath': projectConfig.moduleRootPath, @@ -490,20 +479,16 @@ function getOrCreateLanguageService(servicesHost: ts.LanguageServiceHost, rootFi cache?.preTsImportSendable !== tsImportSendable; const skipOhModulesLintDiff: boolean = (cache?.preSkipOhModulesLint === undefined && !skipOhModulesLint) ? false : cache?.preSkipOhModulesLint !== skipOhModulesLint; - const enableStrictCheckOHModuleDiff: boolean = (cache?.preEnableStrictCheckOHModule === undefined && !enableStrictCheckOHModule) ? - false : cache?.preEnableStrictCheckOHModule !== enableStrictCheckOHModule; const mixCompileDiff: boolean = (cache?.preMixCompile === undefined && !mixCompile) ? false : cache?.preMixCompile !== mixCompile; const shouldRebuild: boolean | undefined = shouldRebuildForDepDiffers || targetESVersionDiffers || - tsImportSendableDiff || maxFlowDepthDiffers || skipOhModulesLintDiff || enableStrictCheckOHModuleDiff || mixCompileDiff; + tsImportSendableDiff || maxFlowDepthDiffers || skipOhModulesLintDiff || mixCompileDiff; if (reuseLanguageServiceForDepChange && hashDiffers && rollupShareObject?.depInfo?.enableIncre) { needReCheckForChangedDepUsers = true; } if (!service || shouldRebuild) { - const options: RebuildOptions = {targetESVersionDiffers, tsImportSendableDiff, maxFlowDepthDiffers, skipOhModulesLintDiff, - enableStrictCheckOHModuleDiff, mixCompileDiff}; - rebuildProgram(options); + rebuildProgram(targetESVersionDiffers, tsImportSendableDiff, maxFlowDepthDiffers, skipOhModulesLintDiff, mixCompileDiff); service = ts.createLanguageService(servicesHost, ts.createDocumentRegistry()); } else { // Found language service from cache, update root files @@ -512,27 +497,25 @@ function getOrCreateLanguageService(servicesHost: ts.LanguageServiceHost, rootFi } const newCache: LanguageServiceCache = { - service: service, pkgJsonFileHash: currentHash, targetESVersion: currentTargetESVersion, - maxFlowDepth: currentMaxFlowDepth, preTsImportSendable: tsImportSendable, preSkipOhModulesLint: skipOhModulesLint, - preEnableStrictCheckOHModule: enableStrictCheckOHModule, preMixCompile: mixCompile}; + service: service, + pkgJsonFileHash: currentHash, + targetESVersion: currentTargetESVersion, + maxFlowDepth: currentMaxFlowDepth, + preTsImportSendable: tsImportSendable, + preSkipOhModulesLint: skipOhModulesLint, + preMixCompile: mixCompile + }; setRollupCache(rollupShareObject, projectConfig, cacheKey, newCache); return service; } -function rebuildProgram(options: RebuildOptions): void { - const { - targetESVersionDiffers, - tsImportSendableDiff, - maxFlowDepthDiffers, - skipOhModulesLintDiff, - enableStrictCheckOHModuleDiff, - mixCompileDiff - } = options; +function rebuildProgram(targetESVersionDiffers: boolean | undefined, tsImportSendableDiff: boolean, + maxFlowDepthDiffers: boolean | undefined, skipOhModulesLintDiff: boolean, mixCompileDiff: boolean): void { if (targetESVersionDiffers) { // If the targetESVersion is changed, we need to delete the build info cahce files deleteBuildInfoCache(compilerOptions.tsBuildInfoFile); targetESVersionChanged = true; - } else if (tsImportSendableDiff || maxFlowDepthDiffers || skipOhModulesLintDiff || enableStrictCheckOHModuleDiff || mixCompileDiff) { + } else if (tsImportSendableDiff || maxFlowDepthDiffers || skipOhModulesLintDiff || mixCompileDiff) { // When tsImportSendable or maxFlowDepth is changed, we need to delete the build info cahce files deleteBuildInfoCache(compilerOptions.tsBuildInfoFile); } @@ -593,7 +576,6 @@ export const warnCheckerResult: WarnCheckerResult = { count: 0 }; export let languageService: ts.LanguageService = null; let tsImportSendable: boolean = false; let skipOhModulesLint: boolean = false; -let enableStrictCheckOHModule: boolean = false; let mixCompile: boolean = false; export let maxMemoryInServiceChecker: number = 0; export function serviceChecker(rootFileNames: string[], newLogger: Object = null, resolveModulePaths: string[] = null, @@ -602,7 +584,6 @@ export function serviceChecker(rootFileNames: string[], newLogger: Object = null let cacheFile: string = null; tsImportSendable = rollupShareObject?.projectConfig.tsImportSendable; skipOhModulesLint = rollupShareObject?.projectConfig.skipOhModulesLint; - enableStrictCheckOHModule = rollupShareObject?.projectConfig.enableStrictCheckOHModule; mixCompile = rollupShareObject?.projectConfig.mixCompile; if (projectConfig.xtsMode || process.env.watchMode === 'true') { if (projectConfig.hotReload) {