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,9 @@
1
+ export declare class ValueAsserts {
2
+ static ENABLE: boolean;
3
+ static enable(): void;
4
+ static disable(): void;
5
+ static assert(cond: boolean, msg?: string): any;
6
+ static assertDefined(val: any, msg?: string): asserts val;
7
+ static assertNotEmptyArray(val: any[], msg?: string): asserts val;
8
+ }
9
+ //# sourceMappingURL=ValueAsserts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValueAsserts.d.ts","sourceRoot":"","sources":["../../src/utils/ValueAsserts.ts"],"names":[],"mappings":"AAmBA,qBAAa,YAAY;IACrB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAS;WAEjB,MAAM,IAAI,IAAI;WAId,OAAO,IAAI,IAAI;WAIf,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG;WAYxC,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG;WAclD,mBAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG;CAa3E"}
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 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.ValueAsserts = void 0;
41
+ const logger_1 = __importStar(require("./logger"));
42
+ const logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER, 'ValueAsserts');
43
+ class ValueAsserts {
44
+ static enable() {
45
+ this.ENABLE = true;
46
+ }
47
+ static disable() {
48
+ this.ENABLE = false;
49
+ }
50
+ static assert(cond, msg) {
51
+ if (!ValueAsserts.ENABLE || cond) {
52
+ return;
53
+ }
54
+ let errorMsg = 'Assert failed: condition is false';
55
+ if (msg) {
56
+ errorMsg = 'Assert failed: ' + msg;
57
+ }
58
+ logger.error(errorMsg);
59
+ throw Error(errorMsg);
60
+ }
61
+ static assertDefined(val, msg) {
62
+ if (!ValueAsserts.ENABLE) {
63
+ return;
64
+ }
65
+ if (val === undefined) {
66
+ let errorMsg = 'Assert failed: value is undefined';
67
+ if (msg) {
68
+ errorMsg = 'Assert failed: ' + msg;
69
+ }
70
+ logger.error(errorMsg);
71
+ throw Error(errorMsg);
72
+ }
73
+ }
74
+ static assertNotEmptyArray(val, msg) {
75
+ if (!ValueAsserts.ENABLE) {
76
+ return;
77
+ }
78
+ if (val.length === 0) {
79
+ let errorMsg = 'Assert failed: array is empty';
80
+ if (msg) {
81
+ errorMsg = 'Assert failed: ' + msg;
82
+ }
83
+ logger.error(errorMsg);
84
+ throw Error(errorMsg);
85
+ }
86
+ }
87
+ }
88
+ exports.ValueAsserts = ValueAsserts;
89
+ ValueAsserts.ENABLE = false;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "arkanalyzer",
3
- "version": "1.0.41",
4
- "commit_id": "49dc535b",
3
+ "version": "1.0.42",
4
+ "commit_id": "9990fed7",
5
5
  "files": [
6
6
  "docs",
7
7
  "lib",