diff --git a/BUILD.gn b/BUILD.gn index 265e5c6d6c32820c5d93af09a86473482cab99b7..2b0d682e3aa6f6d90afa9b4bf1cc5608ee8192af 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -170,7 +170,6 @@ ets_loader_sources = [ "compiler/tsconfig.esm.json", "compiler/tsconfig.json", "compiler/webpack.config.js", - "compiler/config/stmgmtWhiteList.json" ] ohos_copy("ets_loader") { diff --git a/compiler/config/stmgmtWhiteList.json b/compiler/config/stmgmtWhiteList.json deleted file mode 100644 index 243c2ae4fdcdebe81fcc0c1363c2cae307b724af..0000000000000000000000000000000000000000 --- a/compiler/config/stmgmtWhiteList.json +++ /dev/null @@ -1,178 +0,0 @@ -{ - "attrs": [ - "isRenderInProgress", - "isInitialRenderDone", - "runReuse_", - "paramsGenerator_", - "watchedProps", - "recycleManager_", - "hasBeenRecycled_", - "preventRecursiveRecycle_", - "delayRecycleNodeRerender", - "delayRecycleNodeRerenderDeep", - "defaultConsume_", - "reconnectConsume_", - "providedVars_", - "dirtyElementIdsNeedsUpdateSynchronously_", - "localStoragebackStore_", - "ownObservedPropertiesStore__", - "obtainOwnObservedProperties", - "localStorage_", - "isViewV2", - "purgeDeleteElmtId", - "purgeVariableDependenciesOnElmtIdOwnFunc", - "debugInfoStateVars", - "initAllowComponentFreeze", - "onInactiveInternal", - "purgeVariableDependenciesOnElmtId", - "initialRender", - "updateRecycleElmtId", - "updateStateVars", - "initialRenderView", - "delayCompleteRerender", - "flushDelayCompleteRerender", - "forceRerenderNode", - "collectElementsNeedToUpdateSynchronously", - "viewPropertyHasChanged", - "uiNodeNeedUpdateV2", - "performDelayedUpdate", - "addProvidedVar", - "findProvidePU__", - "initializeConsume", - "reconnectToConsume", - "disconnectedConsume", - "markElemenDirtyById", - "updateDirtyElements", - "observeComponentCreation", - "observeComponentCreation2", - "getOrCreateRecycleManager", - "getRecycleManager", - "hasRecycleManager", - "initRecycleManager", - "rebuildUpdateFunc", - "observeRecycleComponentCreation", - "stopRecursiveRecycle", - "recycleSelf", - "UpdateLazyForEachElements", - "debugInfoView", - "debugInfoViewInternal", - "debugInfoDirtDescendantElementIds", - "debugInfoDirtDescendantElementIdsInternal", - "mkRepeatAPI", - "reuseOrCreateNewComponent", - "dirtDescendantElementIds", - "monitorIdsDelayedUpdate", - "monitorIdsDelayedUpdateForAddMonitor", - "computedIdsDelayedUpdate", - "recyclePoolV2_", - "resetStateVarsOnReuse", - "freezeRecycledComponent", - "unfreezeReusedComponent", - "getOrCreateRecyclePool", - "getRecyclePool", - "hasRecyclePool", - "cleanupRecycledElmtId", - "resetMonitorsOnReuse", - "resetComputed", - "resetConsumer", - "getViewV2ChildById", - "addDelayedMonitorIdsForAddMonitor", - "addDelayedComputedIds", - "finalizeConstruction", - "inactiveComponents_", - "isReusable_", - "currentlyRenderedElmtIdStack_", - "dirtDescendantElementIds_", - "dirtRetakenElementIds_", - "renderingPaused", - "isDeleting_", - "isCompFreezeAllowed_", - "prebuildFuncQueues", - "propertyChangedFuncQueues", - "extraInfo_", - "isBlockRecycleOrReuse", - "elmtIdsDelayedUpdate_", - "prebuildPhase_", - "isPrebuilding_", - "prebuildingElmtId_", - "nativeViewPartialUpdate", - "createRecycle", - "markNeedUpdate", - "markStatic", - "finishUpdateFunc", - "elmtIdExists", - "isLazyItemRender", - "isFirstRender", - "findChildByIdForPreview", - "resetRecycleCustomNode", - "queryNavDestinationInfo", - "queryNavigationInfo", - "queryRouterPageInfo", - "getUIContext", - "sendStateInfo", - "getDialogController", - "allowReusableV2Descendant", - "scheduleDelayedUpdate", - "elmtIdsDelayedUpdate", - "removeChild", - "isDeleting", - "setDeleting", - "setDeleteStatusRecursively", - "setActiveCount", - "getChildViewV2ForElmtId", - "debugInfoRegisteredElmtIds", - "debugInfoElmtIds", - "dumpStateVars", - "isViewActive", - "dumpReport", - "forceCompleteRerender", - "ClearAllRecyle__PUV2ViewBase__Internal", - "hasNodeUpdateFunc", - "pauseRendering", - "restoreRendering", - "forEachUpdateFunction", - "getNodeById", - "getCurrentlyRenderedElmtId", - "debugInfoViewHierarchy", - "debugInfoUpdateFuncByElmtId", - "debugInfoUpdateFuncByElmtIdInternal", - "debugInfoInactiveComponents", - "findViewInHierarchy", - "onDumpInfo", - "printDFXHeader", - "processOnDumpCommands", - "traverseChildDoRecycleOrReuse", - "processPropertyChangedFuncQueue", - "setPrebuildPhase", - "isNeedBuildPrebuildCmd", - "prebuildComponent", - "isEnablePrebuildInMultiFrame", - "onDumpInspector", - "activeCount", - "childrenWeakrefMap", - "builderNodeWeakrefMap_", - "updateFuncByElmtId", - "shareLocalStorage_", - "parentViewBuildNode", - "enableBuilderNodeConsume", - "elmtId2Repeat_", - "arkThemeScopeManager", - "getChildById", - "setParentBuilderNode__", - "addChildBuilderNode", - "propagateToChildrenToConnected", - "removeChildBuilderNode", - "clearChildBuilderNode", - "propagateToChildrenToDisconnected", - "purgeDeletedElmtIds", - "updateStateVarsOfChildByElmtId", - "createOrGetNode", - "setArkThemeScopeManager", - "onWillApplyThemeInternally", - "onWillApplyTheme", - "onGlobalThemeChanged", - "getShareLocalStorage", - "setShareLocalStorage", - "propagateToChildren" - ] -} \ No newline at end of file diff --git a/compiler/src/process_struct_componentV2.ts b/compiler/src/process_struct_componentV2.ts index ffbc6ca1ff22b6e1d47d8b606b1b52e1716db45f..76ea76642e777dc636b12b12d1d102c92cf5a17f 100644 --- a/compiler/src/process_struct_componentV2.ts +++ b/compiler/src/process_struct_componentV2.ts @@ -53,8 +53,7 @@ import { isReuseInV2 } from './process_custom_component'; import { judgeBuilderParamAssignedByBuilder } from './process_component_member'; import { componentCollection, - builderParamObjectCollection, - validateStmgmtKeywords + builderParamObjectCollection } from './validate_ui_syntax'; import logMessageCollection from './log_message_collection'; import { globalProgram } from '../main'; @@ -420,9 +419,6 @@ function createInitNode(propName: string, defaultValue: ts.Expression): ts.Expre function parseComponentProperty(node: ts.StructDeclaration, structInfo: StructInfo, log: LogInfo[], sourceFileNode: ts.SourceFile): void { node.members.forEach((member: ts.ClassElement) => { - if (member && member.name && ts.isIdentifier(member.name)) { - validateStmgmtKeywords(member.name.getText(), member.name); - } if (ts.isPropertyDeclaration(member)) { const decorators: readonly ts.Decorator[] = ts.getAllDecorators(member); const modifiers: readonly ts.Modifier[] = ts.getModifiers(member); diff --git a/compiler/src/validate_ui_syntax.ts b/compiler/src/validate_ui_syntax.ts index 0dd4ef4e0b1e12fa6cdfbbe6fb719dad0c10d81b..4543facef4b2604fbb20bde25fc1d33235c17ac2 100644 --- a/compiler/src/validate_ui_syntax.ts +++ b/compiler/src/validate_ui_syntax.ts @@ -15,7 +15,6 @@ import ts from 'typescript'; import path from 'path'; -import fs from 'fs'; import { INNER_COMPONENT_DECORATORS, @@ -186,15 +185,12 @@ export const useOSFiles: Set = new Set(); export const sourcemapNamesCollection: Map> = new Map(); export const originalImportNamesMap: Map = new Map(); -export let stmgmtWhiteList: Set = new Set(); - export function validateUISyntax(source: string, content: string, filePath: string, fileQuery: string, sourceFile: ts.SourceFile = null): LogInfo[] { let log: LogInfo[] = []; if (process.env.compileMode === 'moduleJson' || path.resolve(filePath) !== path.resolve(projectConfig.projectPath || '', 'app.ets')) { componentCollection = new ComponentCollection(); - readStmgmtWhiteList(); const res: LogInfo[] = checkComponentDecorator(source, filePath, fileQuery, sourceFile); if (res) { log = log.concat(res); @@ -1483,9 +1479,6 @@ function traversalComponentProps(node: ts.StructDeclaration, componentSet: IComp if (node.members) { const currentMethodCollection: Set = new Set(); node.members.forEach(item => { - if (item && item.name && ts.isIdentifier(item.name)) { - validateStmgmtKeywords(item.name.getText(), item.name); - } if (ts.isPropertyDeclaration(item) && ts.isIdentifier(item.name)) { const propertyName: string = item.name.getText(); componentSet.properties.add(propertyName); @@ -1960,35 +1953,6 @@ export function getLocalStorageCollection(componentName: string, collection: Set } } -function readStmgmtWhiteList(): void { - const relPath: string = '../stmgmtWhiteList.json'; - const absolutePath: string = path.join(__dirname, relPath); - if (!fs.existsSync(absolutePath)) { - return; - } - const stats: any = fs.statSync(absolutePath); - if (!stats.isFile()) { - return; - } - const fileContent: any = require(absolutePath); - if (fileContent) { - stmgmtWhiteList = new Set(fileContent.attrs ?? []); - } -} - -export function validateStmgmtKeywords(itemName: string, memberNode: ts.Identifier): void { - const message: string = `Methods, properties and accessors in structures decorated by '@Component'` + - ` and '@ComponentV2' cannot have name as '${itemName}'.`; - if (stmgmtWhiteList && stmgmtWhiteList.has(itemName)) { - transformLog.errors.push({ - message: message, - pos: memberNode.getStart(), - type: LogType.ERROR, - code: '10905361' - }); - } -} - export function resetValidateUiSyntax(): void { observedClassCollection.clear(); enumCollection.clear(); @@ -2007,5 +1971,4 @@ export function resetValidateUiSyntax(): void { useOSFiles.clear(); sourcemapNamesCollection.clear(); originalImportNamesMap.clear(); - stmgmtWhiteList.clear(); }