arkanalyzer 1.0.41 → 1.0.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/config/arkanalyzer.json +1 -2
  2. package/lib/Scene.d.ts.map +1 -1
  3. package/lib/Scene.js +9 -2
  4. package/lib/callgraph/pointerAnalysis/PagBuilder.d.ts.map +1 -1
  5. package/lib/callgraph/pointerAnalysis/PagBuilder.js +10 -4
  6. package/lib/core/base/Expr.d.ts +1 -0
  7. package/lib/core/base/Expr.d.ts.map +1 -1
  8. package/lib/core/base/Expr.js +9 -0
  9. package/lib/core/common/IRInference.d.ts +1 -1
  10. package/lib/core/common/IRInference.d.ts.map +1 -1
  11. package/lib/core/common/IRInference.js +7 -3
  12. package/lib/core/common/ModelUtils.js +1 -1
  13. package/lib/core/common/SdkUtils.d.ts +2 -1
  14. package/lib/core/common/SdkUtils.d.ts.map +1 -1
  15. package/lib/core/common/SdkUtils.js +31 -31
  16. package/lib/core/common/TypeInference.d.ts.map +1 -1
  17. package/lib/core/common/TypeInference.js +5 -3
  18. package/lib/core/dataflow/DataflowSolver.js +3 -3
  19. package/lib/core/dataflow/UndefinedVariable.js +2 -2
  20. package/lib/core/graph/BasicBlock.d.ts.map +1 -1
  21. package/lib/core/graph/BasicBlock.js +9 -4
  22. package/lib/core/graph/Cfg.d.ts.map +1 -1
  23. package/lib/core/graph/Cfg.js +4 -1
  24. package/lib/core/graph/builder/CfgBuilder.d.ts.map +1 -1
  25. package/lib/core/graph/builder/CfgBuilder.js +3 -3
  26. package/lib/core/graph/builder/ConditionBuilder.d.ts +2 -1
  27. package/lib/core/graph/builder/ConditionBuilder.d.ts.map +1 -1
  28. package/lib/core/graph/builder/ConditionBuilder.js +7 -3
  29. package/lib/core/graph/builder/TrapBuilder.d.ts +19 -1
  30. package/lib/core/graph/builder/TrapBuilder.d.ts.map +1 -1
  31. package/lib/core/graph/builder/TrapBuilder.js +195 -68
  32. package/lib/core/model/ArkMethod.d.ts.map +1 -1
  33. package/lib/core/model/ArkMethod.js +3 -4
  34. package/lib/core/model/builder/ArkClassBuilder.d.ts.map +1 -1
  35. package/lib/core/model/builder/ArkClassBuilder.js +24 -20
  36. package/lib/core/model/builder/ArkImportBuilder.js +28 -25
  37. package/lib/core/model/builder/ArkMethodBuilder.d.ts.map +1 -1
  38. package/lib/core/model/builder/ArkMethodBuilder.js +1 -2
  39. package/lib/pass/Context.d.ts +47 -0
  40. package/lib/pass/Context.d.ts.map +1 -0
  41. package/lib/pass/Context.js +72 -0
  42. package/lib/pass/Dispatcher.d.ts +102 -0
  43. package/lib/pass/Dispatcher.d.ts.map +1 -0
  44. package/lib/pass/Dispatcher.js +202 -0
  45. package/lib/pass/Pass.d.ts +83 -0
  46. package/lib/pass/Pass.d.ts.map +1 -0
  47. package/lib/pass/Pass.js +95 -0
  48. package/lib/pass/ScenePassMgr.d.ts +73 -0
  49. package/lib/pass/ScenePassMgr.d.ts.map +1 -0
  50. package/lib/pass/ScenePassMgr.js +156 -0
  51. package/lib/pass/SceneValidator.d.ts +215 -0
  52. package/lib/pass/SceneValidator.d.ts.map +1 -0
  53. package/lib/pass/SceneValidator.js +339 -0
  54. package/lib/save/JsonPrinter.d.ts.map +1 -1
  55. package/lib/save/JsonPrinter.js +26 -102
  56. package/lib/save/source/SourceStmt.d.ts +1 -0
  57. package/lib/save/source/SourceStmt.d.ts.map +1 -1
  58. package/lib/save/source/SourceStmt.js +4 -7
  59. package/lib/utils/FileUtils.d.ts.map +1 -1
  60. package/lib/utils/FileUtils.js +13 -6
  61. package/lib/utils/ValueAsserts.d.ts +9 -0
  62. package/lib/utils/ValueAsserts.d.ts.map +1 -0
  63. package/lib/utils/ValueAsserts.js +89 -0
  64. package/package.json +2 -2
@@ -0,0 +1,73 @@
1
+ import { Scene } from '../Scene';
2
+ import { AnyKey, Context, CtxArg, UpperRoot } from './Context';
3
+ import { Dispatcher } from './Dispatcher';
4
+ import { ClassPass, FilePass, MethodPass } from './Pass';
5
+ import { ArkFile } from '../core/model/ArkFile';
6
+ import { ArkClass } from '../core/model/ArkClass';
7
+ import { ArkMethod } from '../core/model/ArkMethod';
8
+ /**
9
+ * Represents a specialized context class that extends the base Context class with specific types.
10
+ * Provides functionality to access the root context within a hierarchical structure.
11
+ * The SceneCtx is bound to a UpperRoot and CtxArg, defining its operational scope.
12
+ * The root method retrieves the top-level SceneCtx itself.
13
+ */
14
+ export declare class SceneCtx extends Context<UpperRoot, CtxArg> {
15
+ constructor();
16
+ root(): SceneCtx;
17
+ }
18
+ /**
19
+ * Represents the properties required for configuring various passes in a system.
20
+ * The PassProps interface is designed to hold arrays of different types of passes,
21
+ * specifically file-level, class-level, and method-level passes. Each pass type
22
+ * is identified by a unique key and associated with specific configurations or rules.
23
+ * These passes are used to define how certain operations or validations should be
24
+ * applied at different levels of granularity within the system.
25
+ */
26
+ export interface PassProps {
27
+ file: AnyKey<FilePass>[];
28
+ klass: AnyKey<ClassPass>[];
29
+ method: AnyKey<MethodPass>[];
30
+ }
31
+ /**
32
+ * Represents the properties for a selector configuration.
33
+ * Provides options to define callback functions for selecting files, classes, and methods.
34
+ * The file property allows specifying a function to select files from a given scene.
35
+ * The klass property allows specifying a function to select classes from a given file.
36
+ * The method property allows specifying a function to select methods from a given class.
37
+ */
38
+ export interface SelectorProps {
39
+ file?: (s: Scene) => ArkFile[];
40
+ klass?: (s: ArkFile) => ArkClass[];
41
+ method?: (s: ArkClass) => ArkMethod[];
42
+ }
43
+ /**
44
+ * Represents the properties for configuring a scene pass manager.
45
+ *
46
+ * The SceneProps interface allows defining optional configurations for a scene,
47
+ * including rendering passes, selector properties, and a dispatcher implementation.
48
+ *
49
+ * The passes property defines the configuration for rendering stages or phases within the scene.
50
+ *
51
+ * The selectors property provides options for selecting elements or components within the scene.
52
+ *
53
+ * The dispatcher property specifies the dispatcher class responsible for handling events or actions
54
+ * within the scene, defaulting to the base Dispatcher type if not provided.
55
+ */
56
+ export interface SceneProps {
57
+ passes?: PassProps;
58
+ selectors?: SelectorProps;
59
+ dispatcher?: typeof Dispatcher;
60
+ }
61
+ export declare class ScenePassMgr {
62
+ private passes;
63
+ private selectors?;
64
+ private dispatcher?;
65
+ private sctx;
66
+ constructor(props: SceneProps);
67
+ sceneContext(): SceneCtx;
68
+ run(scene: Scene): void;
69
+ private iterFile;
70
+ private iterClass;
71
+ private iterMethod;
72
+ }
73
+ //# sourceMappingURL=ScenePassMgr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScenePassMgr.d.ts","sourceRoot":"","sources":["../../src/pass/ScenePassMgr.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAY,SAAS,EAAuB,QAAQ,EAAa,UAAU,EAAE,MAAM,QAAQ,CAAC;AACnG,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAIpD;;;;;GAKG;AACH,qBAAa,QAAS,SAAQ,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC;;IAKpD,IAAI,IAAI,QAAQ;CAGnB;AAGD;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IAEtB,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;IAEzB,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;IAE3B,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,EAAE,CAAA;CAC/B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAE1B,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,OAAO,EAAE,CAAC;IAE/B,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,QAAQ,EAAE,CAAC;IAEnC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,KAAK,SAAS,EAAE,CAAA;CACxC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,UAAU;IACvB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,UAAU,CAAC,EAAE,OAAO,UAAU,CAAC;CAClC;AAED,qBAAa,YAAY;IACrB,OAAO,CAAC,MAAM,CAIZ;IACF,OAAO,CAAC,SAAS,CAAC,CAA4B;IAC9C,OAAO,CAAC,UAAU,CAAC,CAAiC;IACpD,OAAO,CAAC,IAAI,CAA4B;gBAE5B,KAAK,EAAE,UAAU;IAY7B,YAAY,IAAI,QAAQ;IAIxB,GAAG,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAavB,OAAO,CAAC,QAAQ;IAmBhB,OAAO,CAAC,SAAS;IAmBjB,OAAO,CAAC,UAAU;CAgBrB"}
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2024-2025 Huawei Device Co., Ltd.
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ var desc = Object.getOwnPropertyDescriptor(m, k);
19
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
20
+ desc = { enumerable: true, get: function() { return m[k]; } };
21
+ }
22
+ Object.defineProperty(o, k2, desc);
23
+ }) : (function(o, m, k, k2) {
24
+ if (k2 === undefined) k2 = k;
25
+ o[k2] = m[k];
26
+ }));
27
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
28
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
29
+ }) : function(o, v) {
30
+ o["default"] = v;
31
+ });
32
+ var __importStar = (this && this.__importStar) || function (mod) {
33
+ if (mod && mod.__esModule) return mod;
34
+ var result = {};
35
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
36
+ __setModuleDefault(result, mod);
37
+ return result;
38
+ };
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.ScenePassMgr = exports.SceneCtx = void 0;
41
+ const Context_1 = require("./Context");
42
+ const logger_1 = __importStar(require("../utils/logger"));
43
+ const Dispatcher_1 = require("./Dispatcher");
44
+ const Pass_1 = require("./Pass");
45
+ const logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER, 'SceneMgr');
46
+ /**
47
+ * Represents a specialized context class that extends the base Context class with specific types.
48
+ * Provides functionality to access the root context within a hierarchical structure.
49
+ * The SceneCtx is bound to a UpperRoot and CtxArg, defining its operational scope.
50
+ * The root method retrieves the top-level SceneCtx itself.
51
+ */
52
+ class SceneCtx extends Context_1.Context {
53
+ constructor() {
54
+ super(Context_1.UpperRoot.getInstance());
55
+ }
56
+ root() {
57
+ return this;
58
+ }
59
+ }
60
+ exports.SceneCtx = SceneCtx;
61
+ class ScenePassMgr {
62
+ constructor(props) {
63
+ this.passes = {
64
+ file: [],
65
+ klass: [],
66
+ method: [],
67
+ };
68
+ this.selectors = undefined;
69
+ this.dispatcher = Dispatcher_1.Dispatcher;
70
+ this.sctx = new SceneCtx();
71
+ if (props.passes) {
72
+ this.passes = props.passes;
73
+ }
74
+ if (props.selectors) {
75
+ this.selectors = props.selectors;
76
+ }
77
+ if (props.dispatcher) {
78
+ this.dispatcher = props.dispatcher;
79
+ }
80
+ }
81
+ sceneContext() {
82
+ return this.sctx;
83
+ }
84
+ run(scene) {
85
+ var _a;
86
+ logger.info('run scene');
87
+ let files;
88
+ if ((_a = this.selectors) === null || _a === void 0 ? void 0 : _a.file) {
89
+ files = this.selectors.file(scene);
90
+ }
91
+ else {
92
+ files = scene.getFiles();
93
+ }
94
+ for (let file of files) {
95
+ this.iterFile(file);
96
+ }
97
+ }
98
+ iterFile(file) {
99
+ var _a;
100
+ let fctx = new Pass_1.FileCtx(this.sctx);
101
+ for (let P of this.passes.file) {
102
+ let p = new P();
103
+ if (p.run(file, fctx) === 1 /* FallAction.Break */) {
104
+ break;
105
+ }
106
+ }
107
+ let classes;
108
+ if ((_a = this.selectors) === null || _a === void 0 ? void 0 : _a.klass) {
109
+ classes = this.selectors.klass(file);
110
+ }
111
+ else {
112
+ classes = file.getClasses();
113
+ }
114
+ for (let cls of classes) {
115
+ this.iterClass(cls, fctx);
116
+ }
117
+ }
118
+ iterClass(cls, fctx) {
119
+ var _a;
120
+ let cctx = new Pass_1.ClassCtx(fctx);
121
+ for (let P of this.passes.klass) {
122
+ let p = new P();
123
+ if (p.run(cls, cctx) === 1 /* FallAction.Break */) {
124
+ break;
125
+ }
126
+ }
127
+ let methods;
128
+ if ((_a = this.selectors) === null || _a === void 0 ? void 0 : _a.method) {
129
+ methods = this.selectors.method(cls);
130
+ }
131
+ else {
132
+ methods = cls.getMethods();
133
+ }
134
+ for (let mtd of methods) {
135
+ this.iterMethod(mtd, cctx);
136
+ }
137
+ }
138
+ iterMethod(mtd, cctx) {
139
+ var _a;
140
+ let mctx = new Pass_1.MethodCtx(cctx);
141
+ for (let P of this.passes.method) {
142
+ let p = new P();
143
+ if (p.run(mtd, mctx) === 1 /* FallAction.Break */) {
144
+ break;
145
+ }
146
+ }
147
+ if (this.dispatcher) {
148
+ let stmts = ((_a = mtd.getCfg()) === null || _a === void 0 ? void 0 : _a.getStmts()) || [];
149
+ let dispatcher = new this.dispatcher(mctx);
150
+ for (let s of stmts) {
151
+ dispatcher.dispatchStmt(mtd, s);
152
+ }
153
+ }
154
+ }
155
+ }
156
+ exports.ScenePassMgr = ScenePassMgr;
@@ -0,0 +1,215 @@
1
+ import { Scene } from '../Scene';
2
+ import { Dispatch, Dispatcher, StmtInit, StmtTy, ValueInit, ValueTy } from './Dispatcher';
3
+ import { ClassCtx, ClassPass, FallAction, FileCtx, FilePass, MethodCtx, MethodPass } from './Pass';
4
+ import { ArkFile } from '../core/model/ArkFile';
5
+ import { ArkClass } from '../core/model/ArkClass';
6
+ import { ArkMethod } from '../core/model/ArkMethod';
7
+ import { Value } from '../core/base/Value';
8
+ import { Stmt } from '../core/base/Stmt';
9
+ export declare const enum SummaryLevel {
10
+ info = 0,
11
+ warn = 1,
12
+ error = 2
13
+ }
14
+ /**
15
+ * Abstract class representing a statement validator.
16
+ * Provides a mechanism to validate statements of a specific type within a given context.
17
+ * Implementations must define the `validate` method to perform custom validation logic.
18
+ */
19
+ export declare abstract class StmtValidator<S extends StmtTy> {
20
+ /**
21
+ * Validates the given input using the provided context and reports the results.
22
+ *
23
+ * @param s The input value to be validated.
24
+ * @param ctx The context used for validation, which includes reporting mechanisms.
25
+ * @return The result of the validation process.
26
+ */
27
+ abstract validate(s: S, ctx: SummaryReporter): void;
28
+ run(s: S, ctx: MethodCtx, mtd: ArkMethod): void;
29
+ static register(init: StmtInit): void;
30
+ }
31
+ /**
32
+ * Abstract class representing a validator for values of a specific type.
33
+ * Provides a mechanism to validate values and report the results through a summary reporter.
34
+ * The validation logic is defined by implementing the `validate` method in derived classes.
35
+ */
36
+ export declare abstract class ValueValidator<S extends ValueTy> {
37
+ /**
38
+ * Validates the given input against specific criteria and reports the validation status.
39
+ *
40
+ * @param s The input value to be validated. This can be of any type depending on the implementation.
41
+ * @param ctx The context object used for reporting validation results or summaries.
42
+ * @return The result of the validation process.
43
+ */
44
+ abstract validate(s: S, ctx: SummaryReporter): void;
45
+ run(s: S, ctx: MethodCtx, mtd: ArkMethod): void;
46
+ static register(init: ValueInit): void;
47
+ }
48
+ /**
49
+ * The ArkValidatorRegistry class is responsible for managing and registering statement and value initializers
50
+ * used in validation processes. It extends the Dispatcher class and provides mechanisms to dynamically
51
+ * register and invalidate dispatch configurations.
52
+ */
53
+ export declare class ArkValidatorRegistry extends Dispatcher {
54
+ private static readonly stmtsHolder;
55
+ private static readonly valuesHolder;
56
+ private static dispatchHolder?;
57
+ constructor(ctx: MethodCtx);
58
+ static getDispatch(): Dispatch;
59
+ static stmt(init: StmtInit): void;
60
+ static value(init: ValueInit): void;
61
+ }
62
+ /**
63
+ * Interface representing a summary reporter for logging messages with different severity levels.
64
+ * Provides methods to log informational, warning, and error messages.
65
+ * The `info` method is used to log general informational messages.
66
+ * The `warn` method is used to log warning messages that indicate potential issues.
67
+ * The `error` method is used to log error messages that represent critical problems.
68
+ */
69
+ export interface SummaryReporter {
70
+ info(msg: string): void;
71
+ warn(msg: string): void;
72
+ error(msg: string): void;
73
+ }
74
+ /**
75
+ * An abstract class that extends FilePass and provides a framework for validating files.
76
+ * The FileValidator class is designed to be subclassed with specific validation logic
77
+ * implemented in the `validate` method. It provides a default implementation of the `run`
78
+ * method, which processes a file and submits validation results (info, warning, or error)
79
+ * to a summary object associated with the file context.
80
+ */
81
+ export declare abstract class FileValidator extends FilePass {
82
+ /**
83
+ * Validates the given file and reports the results through the provided context.
84
+ *
85
+ * @param file The file to be validated, represented as an ArkFile object.
86
+ * @param ctx The context used for reporting validation results, implemented as a SummaryReporter.
87
+ * @return The result of the validation process.
88
+ */
89
+ abstract validate(file: ArkFile, ctx: SummaryReporter): void;
90
+ run(file: ArkFile, ctx: FileCtx): void;
91
+ }
92
+ export declare abstract class ClassValidator extends ClassPass {
93
+ /**
94
+ * Validates the given class and reports any issues found during validation.
95
+ *
96
+ * @param cls The class to be validated. This should be an instance of ArkClass.
97
+ * @param ctx The context used for reporting validation results or issues. This should be an instance of SummaryReporter.
98
+ * @return This method does not return any value.
99
+ */
100
+ abstract validate(cls: ArkClass, ctx: SummaryReporter): void;
101
+ run(cls: ArkClass, ctx: ClassCtx): FallAction | void;
102
+ }
103
+ export declare abstract class MethodValidator extends MethodPass {
104
+ /**
105
+ * Validates the given method and reports any issues found.
106
+ *
107
+ * @param mtd The method to be validated. This is an instance of ArkMethod.
108
+ * @param ctx The context for reporting validation results or issues. This is an instance of SummaryReporter.
109
+ * @return This method does not return a value.
110
+ */
111
+ abstract validate(mtd: ArkMethod, ctx: SummaryReporter): void;
112
+ run(mtd: ArkMethod, ctx: MethodCtx): FallAction | void;
113
+ }
114
+ /**
115
+ * Represents a summary of a scene, containing metadata and associated file summaries.
116
+ * The name property provides a default identifier for the scene summary.
117
+ * The files property maintains a mapping of ArkFile instances to their corresponding FileSummary objects.
118
+ * This class is used to encapsulate and manage information about a scene and its related files.
119
+ */
120
+ export declare class SceneSummary {
121
+ name: string;
122
+ files: Map<ArkFile, FileSummary>;
123
+ }
124
+ /**
125
+ * Represents a summary of a file containing information about classes and messages.
126
+ * Provides methods to manage and retrieve file summaries within a given context.
127
+ * The class maintains a collection of messages and a mapping of classes to their summaries.
128
+ * It supports operations to submit new messages and retrieve or create summaries for files.
129
+ */
130
+ export declare class FileSummary {
131
+ name: string;
132
+ classes: Map<ArkClass, ClassSummary>;
133
+ msgList: SummaryMsg[];
134
+ constructor();
135
+ submit(msg: SummaryMsg): void;
136
+ /**
137
+ * Retrieves an existing FileSummary instance from the given context or creates a new one if it does not exist.
138
+ *
139
+ * @param ctx The context object that holds the FileSummary instance. It is used to check if a FileSummary already exists.
140
+ * @param file The ArkFile object for which the FileSummary is being retrieved or created.
141
+ * @return The existing or newly created FileSummary instance associated with the provided file.
142
+ */
143
+ static getOrNew(ctx: FileCtx, file: ArkFile): FileSummary;
144
+ }
145
+ /**
146
+ * Represents a summary of a class, containing its name, associated methods, and messages.
147
+ * Provides functionality to submit messages and retrieve or create a ClassSummary instance.
148
+ * The class maintains a collection of method summaries and tracks messages related to the class.
149
+ * It is designed to be used in the context of a larger system that processes class information.
150
+ */
151
+ export declare class ClassSummary {
152
+ name: string;
153
+ methods: Map<ArkMethod, MethodSummary>;
154
+ msgList: SummaryMsg[];
155
+ constructor();
156
+ submit(msg: SummaryMsg): void;
157
+ /**
158
+ * Retrieves an existing ClassSummary instance from the given context or creates a new one if it does not exist.
159
+ * If the ClassSummary is not found in the context, it attempts to retrieve or create a FileSummary for the declaring file of the class.
160
+ * Ensures that the ClassSummary is associated with the provided class and context before returning it.
161
+ *
162
+ * @param ctx The context in which to search for or store the ClassSummary instance.
163
+ * @param cls The class for which the ClassSummary is being retrieved or created.
164
+ * @return The existing or newly created ClassSummary instance associated with the provided class and context.
165
+ */
166
+ static getOrNew(ctx: ClassCtx, cls: ArkClass): ClassSummary;
167
+ }
168
+ /**
169
+ * Represents a summary message with an associated level and content.
170
+ * The SummaryMsg class is used to encapsulate messages that have a specific severity or importance level.
171
+ * It provides a way to associate a textual message with a defined level, making it suitable for logging, notifications, or summaries.
172
+ * The constructor initializes the message and its level, ensuring both are explicitly defined at creation.
173
+ */
174
+ export declare class SummaryMsg {
175
+ level: SummaryLevel;
176
+ msg: string;
177
+ constructor(level: SummaryLevel, msg: string);
178
+ }
179
+ /**
180
+ * Represents a summary of a method, capturing various messages and associations with values and statements.
181
+ * This class provides methods to submit messages and associate them with specific values or statements.
182
+ * It also supports retrieving or creating a method summary within a given context.
183
+ */
184
+ export declare class MethodSummary {
185
+ name: string;
186
+ values: Map<Value, SummaryMsg[]>;
187
+ stmts: Map<Stmt, SummaryMsg[]>;
188
+ msgList: SummaryMsg[];
189
+ constructor();
190
+ submit(msg: SummaryMsg): void;
191
+ submitValue(value: Value, msg: SummaryMsg): void;
192
+ submitStmt(stmt: Stmt, msg: SummaryMsg): void;
193
+ /**
194
+ * Retrieves an existing MethodSummary from the context or creates a new one if it does not exist.
195
+ *
196
+ * @param ctx The method context in which the MethodSummary is stored or will be created.
197
+ * @param mtd The ArkMethod for which the MethodSummary is being retrieved or created.
198
+ * @return The existing or newly created MethodSummary associated with the provided context and method.
199
+ */
200
+ static getOrNew(ctx: MethodCtx, mtd: ArkMethod): MethodSummary;
201
+ }
202
+ /**
203
+ * The SceneValidator class is responsible for validating a given scene by leveraging the ScenePassMgr.
204
+ * It sets up a context for validation, executes the validation process, and retrieves the summary of the validation.
205
+ *
206
+ * The validate method initializes a new SceneSummary instance, associates it with the current scene context,
207
+ * runs the validation process using the configured manager, and finally returns the generated summary.
208
+ *
209
+ * This class ensures that the validation logic is encapsulated and provides a clean interface for processing scenes.
210
+ */
211
+ export declare class SceneValidator {
212
+ private mgr;
213
+ validate(scene: Scene): SceneSummary;
214
+ }
215
+ //# sourceMappingURL=SceneValidator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SceneValidator.d.ts","sourceRoot":"","sources":["../../src/pass/SceneValidator.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACnG,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAKzC,0BAAkB,YAAY;IAC1B,IAAI,IAAA;IACJ,IAAI,IAAA;IACJ,KAAK,IAAA;CACR;AAED;;;;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