import { Scene } from '../../Scene'; import { ArkClass } from '../model/ArkClass'; import { ArkMethod } from '../model/ArkMethod'; import { CallGraph } from '../../callgraph/model/CallGraph'; /** 收集所有的 Ability 和 Component 类,构造一个虚拟函数进行类的实例生成、初始化、生命周期函数调用等操作,具体为: classA.%statInit() const %1 = new classA() %1.%instInit() %1.onCreate() %1.onWindowStageCreate() %1.aboutToAppear() ... count = 0 while (true) { if (count === 0) { %1.aboutToRecycle() %1.aboutToReuse() } if (count === 1) { %1.onPageShow() %1.onPageHide() } if (count === 2) { %2.onWillForeground() %2.onForeground() %2.onDidForeground() %2.onWillBackground() %2.onBackground() %2.onDidBackground() } ... if (count === N) { %1.build() } ... } %1.onWindowStageWillDestroy() %1.aboutToDisappear() %1.onDetached() %1.onWindowStageDestroy() %2.onDestroy() ... return */ export declare class DummyMainCreater { private entryMethods; private entryClasses; private startMethods; private endMethods; private pairedMethodGroups; private classLocalMap; private dummyMain; private scene; private tempLocalIndex; private tempBlockIndex; private extraInstanceAssign; private classScope?; private dummyMethodName?; /** * Create dummy entry method and add it to the specified scene. * @param scene * @param extraInstanceAssign if enabled, then will add extra assign stmt like %1000 = %1, after each instance invoke stmt * @param dummyMethodName if not provided, using the default method name '@dummyMain' * @param classScope if not provided, collect all Ability class and Component struct. */ constructor(scene: Scene, dummyMethodName?: string, classScope?: ArkClass[], extraInstanceAssign?: boolean); setEntryMethods(methods: ArkMethod[]): void; createDummyMain(): void; private addStaticInit; private addClassInit; private addParamInit; private addStartMethods; private addEndMethods; private classifyMethod; private addBranches; private createConditionAndInvokeBlockPair; private createDummyMainCfg; private addMethodsInvokeStmt; private linkBlocks; private addCfg2Stmt; getDummyMain(): ArkMethod; private getEntryMethodsFromComponents; private classInheritsAbility; private getMethodsFromAllAbilities; /** * Analysis the coverage of files, methods, stmts when starting from the dummy main method according to the given call graph. * @param callGraph - the call graph create within ArkAnalyzer * @param generated - whether to include the generated methods */ analysisCoverage(callGraph: CallGraph, generated?: boolean): Coverage; } interface Coverage { filesCoverage: number; methodsCoverage: number; stmtsCoverage: number; totalFiles: number; totalMethods: number; totalStmts: number; visitedFiles: number; visitedMethods: number; visitedStmts: number; } export {}; //# sourceMappingURL=DummyMainCreater.d.ts.map