arkanalyzer 1.0.87 → 1.0.88

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 (91) hide show
  1. package/lib/Config.d.ts +4 -1
  2. package/lib/Config.d.ts.map +1 -1
  3. package/lib/Config.js +17 -2
  4. package/lib/Scene.d.ts.map +1 -1
  5. package/lib/Scene.js +7 -8
  6. package/lib/cli/commands/cg.d.ts +27 -6
  7. package/lib/cli/commands/cg.d.ts.map +1 -1
  8. package/lib/cli/commands/cg.js +9 -6
  9. package/lib/core/base/Expr.js +3 -3
  10. package/lib/core/base/Position.d.ts +1 -1
  11. package/lib/core/base/Position.d.ts.map +1 -1
  12. package/lib/core/base/Position.js +2 -2
  13. package/lib/core/common/Const.d.ts +1 -0
  14. package/lib/core/common/Const.d.ts.map +1 -1
  15. package/lib/core/common/Const.js +2 -1
  16. package/lib/core/common/IRInference.d.ts.map +1 -1
  17. package/lib/core/common/IRInference.js +1 -1
  18. package/lib/core/common/IRUtils.d.ts.map +1 -1
  19. package/lib/core/common/IRUtils.js +3 -33
  20. package/lib/core/model/ArkClass.d.ts +3 -0
  21. package/lib/core/model/ArkClass.d.ts.map +1 -1
  22. package/lib/core/model/ArkClass.js +13 -2
  23. package/lib/core/model/ArkMetadata.d.ts +32 -1
  24. package/lib/core/model/ArkMetadata.d.ts.map +1 -1
  25. package/lib/core/model/ArkMetadata.js +28 -2
  26. package/lib/core/model/builder/ArkMetadataBuilder.d.ts +21 -0
  27. package/lib/core/model/builder/ArkMetadataBuilder.d.ts.map +1 -0
  28. package/lib/core/model/builder/ArkMetadataBuilder.js +160 -0
  29. package/lib/core/model/builder/ArkMethodBuilder.d.ts.map +1 -1
  30. package/lib/core/model/builder/ArkMethodBuilder.js +32 -24
  31. package/lib/frontend/cppFrontend/ast/astJsonNapi/napiApi.d.ts +8 -0
  32. package/lib/frontend/cppFrontend/ast/astJsonNapi/napiApi.d.ts.map +1 -0
  33. package/lib/frontend/cppFrontend/ast/astJsonNapi/napiApi.js +90 -0
  34. package/lib/frontend/cppFrontend/ast/astJsonNapi/napiRunner.d.ts +8 -0
  35. package/lib/frontend/cppFrontend/ast/astJsonNapi/napiRunner.d.ts.map +1 -0
  36. package/lib/frontend/cppFrontend/ast/astJsonNapi/napiRunner.js +183 -0
  37. package/lib/frontend/cppFrontend/ast/astParser.d.ts +25 -0
  38. package/lib/frontend/cppFrontend/ast/astParser.d.ts.map +1 -0
  39. package/lib/frontend/cppFrontend/ast/astParser.js +280 -0
  40. package/lib/frontend/cppFrontend/ast/astUtils.d.ts +12 -45
  41. package/lib/frontend/cppFrontend/ast/astUtils.d.ts.map +1 -1
  42. package/lib/frontend/cppFrontend/ast/astUtils.js +62 -374
  43. package/lib/frontend/cppFrontend/ast/const.d.ts +0 -13
  44. package/lib/frontend/cppFrontend/ast/const.d.ts.map +1 -1
  45. package/lib/frontend/cppFrontend/ast/const.js +1 -77
  46. package/lib/frontend/cppFrontend/ast/index.d.ts +5 -0
  47. package/lib/frontend/cppFrontend/ast/index.d.ts.map +1 -0
  48. package/lib/frontend/cppFrontend/ast/index.js +31 -0
  49. package/lib/frontend/cppFrontend/common/ArkIRTransformer.d.ts +1 -1
  50. package/lib/frontend/cppFrontend/common/ArkIRTransformer.d.ts.map +1 -1
  51. package/lib/frontend/cppFrontend/common/ArkIRTransformer.js +55 -55
  52. package/lib/frontend/cppFrontend/common/ArkValueTransformer.d.ts +1 -1
  53. package/lib/frontend/cppFrontend/common/ArkValueTransformer.d.ts.map +1 -1
  54. package/lib/frontend/cppFrontend/common/ArkValueTransformer.js +151 -151
  55. package/lib/frontend/cppFrontend/common/IRInference.js +2 -2
  56. package/lib/frontend/cppFrontend/common/IRUtils.d.ts +1 -1
  57. package/lib/frontend/cppFrontend/common/IRUtils.d.ts.map +1 -1
  58. package/lib/frontend/cppFrontend/common/IRUtils.js +2 -2
  59. package/lib/frontend/cppFrontend/graph/builder/CfgBuilder.d.ts +1 -1
  60. package/lib/frontend/cppFrontend/graph/builder/CfgBuilder.d.ts.map +1 -1
  61. package/lib/frontend/cppFrontend/graph/builder/CfgBuilder.js +74 -74
  62. package/lib/frontend/cppFrontend/model/builder/ArkClassBuilder.d.ts +1 -1
  63. package/lib/frontend/cppFrontend/model/builder/ArkClassBuilder.d.ts.map +1 -1
  64. package/lib/frontend/cppFrontend/model/builder/ArkClassBuilder.js +3 -3
  65. package/lib/frontend/cppFrontend/model/builder/ArkFieldBuilder.d.ts +1 -1
  66. package/lib/frontend/cppFrontend/model/builder/ArkFieldBuilder.d.ts.map +1 -1
  67. package/lib/frontend/cppFrontend/model/builder/ArkFileBuilder.d.ts +1 -1
  68. package/lib/frontend/cppFrontend/model/builder/ArkFileBuilder.d.ts.map +1 -1
  69. package/lib/frontend/cppFrontend/model/builder/ArkFileBuilder.js +16 -17
  70. package/lib/frontend/cppFrontend/model/builder/ArkImportBuilder.d.ts +1 -1
  71. package/lib/frontend/cppFrontend/model/builder/ArkImportBuilder.d.ts.map +1 -1
  72. package/lib/frontend/cppFrontend/model/builder/ArkMethodBuilder.d.ts +1 -1
  73. package/lib/frontend/cppFrontend/model/builder/ArkMethodBuilder.d.ts.map +1 -1
  74. package/lib/frontend/cppFrontend/model/builder/ArkMethodBuilder.js +2 -2
  75. package/lib/frontend/cppFrontend/model/builder/ArkNamespaceBuilder.d.ts +1 -1
  76. package/lib/frontend/cppFrontend/model/builder/ArkNamespaceBuilder.d.ts.map +1 -1
  77. package/lib/frontend/cppFrontend/model/builder/ArkNamespaceBuilder.js +2 -2
  78. package/lib/frontend/cppFrontend/model/builder/BodyBuilder.d.ts +1 -1
  79. package/lib/frontend/cppFrontend/model/builder/BodyBuilder.d.ts.map +1 -1
  80. package/lib/frontend/cppFrontend/model/builder/builderUtils.d.ts +1 -1
  81. package/lib/frontend/cppFrontend/model/builder/builderUtils.d.ts.map +1 -1
  82. package/lib/frontend/cppFrontend/model/builder/builderUtils.js +3 -3
  83. package/lib/index.d.ts +2 -2
  84. package/lib/index.d.ts.map +1 -1
  85. package/lib/index.js +7 -6
  86. package/lib/save/source/SourceStmt.d.ts.map +1 -1
  87. package/lib/save/source/SourceStmt.js +3 -1
  88. package/lib/utils/FileUtils.d.ts +1 -0
  89. package/lib/utils/FileUtils.d.ts.map +1 -1
  90. package/lib/utils/FileUtils.js +11 -3
  91. package/package.json +5 -2
@@ -0,0 +1,25 @@
1
+ import { CxxAstNode, CxxAstNodeLite } from './ArkCxxAstNode';
2
+ export type GetParentFn = {
3
+ (isNeedInner: true): CxxAstNode;
4
+ (isNeedInner?: false): CxxAstNodeLite;
5
+ };
6
+ export declare class AstParser {
7
+ private static currentAccess;
8
+ private static deleteFileSync;
9
+ static parse(sourceFile: string, ccJsonPath: string | null, includeDirs: string[] | null, llvmPath: string, cppAstPath: string): CxxAstNode;
10
+ private static resolveProjectRoot;
11
+ private static getWorkingDir;
12
+ private static processAstFile;
13
+ private static createEmptyNode;
14
+ private static updateInner;
15
+ private static filter;
16
+ private static filterChildren;
17
+ private static makeGetParent;
18
+ private static fullInfo;
19
+ private static processAccess;
20
+ private static getCodeForExtractModifiers;
21
+ private static stripFucntionParams;
22
+ private static getAstOutputPath;
23
+ private static ensureOutputDir;
24
+ }
25
+ //# sourceMappingURL=astParser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"astParser.d.ts","sourceRoot":"","sources":["../../../../src/frontend/cppFrontend/ast/astParser.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAW,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAMtE,MAAM,MAAM,WAAW,GAAG;IACtB,CAAC,WAAW,EAAE,IAAI,GAAG,UAAU,CAAC;IAChC,CAAC,WAAW,CAAC,EAAE,KAAK,GAAG,cAAc,CAAC;CACzC,CAAC;AAEF,qBAAa,SAAS;IAClB,OAAO,CAAC,MAAM,CAAC,aAAa,CAAc;IAE1C,OAAO,CAAC,MAAM,CAAC,cAAc;WAQf,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,UAAU;IA4BlJ,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAoBjC,OAAO,CAAC,MAAM,CAAC,aAAa;IAa5B,OAAO,CAAC,MAAM,CAAC,cAAc;IAqB7B,OAAO,CAAC,MAAM,CAAC,eAAe;IAI9B,OAAO,CAAC,MAAM,CAAC,WAAW;IAY1B,OAAO,CAAC,MAAM,CAAC,MAAM;IAYrB,OAAO,CAAC,MAAM,CAAC,cAAc;IAO7B,OAAO,CAAC,MAAM,CAAC,aAAa;IAa5B,OAAO,CAAC,MAAM,CAAC,QAAQ;IA8BvB,OAAO,CAAC,MAAM,CAAC,aAAa;IAgB5B,OAAO,CAAC,MAAM,CAAC,0BAA0B;IAUzC,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAyBlC,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAQ/B,OAAO,CAAC,MAAM,CAAC,eAAe;CAKjC"}
@@ -0,0 +1,280 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2026 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
+ var __rest = (this && this.__rest) || function (s, e) {
40
+ var t = {};
41
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
42
+ t[p] = s[p];
43
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
44
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
45
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
46
+ t[p[i]] = s[p[i]];
47
+ }
48
+ return t;
49
+ };
50
+ Object.defineProperty(exports, "__esModule", { value: true });
51
+ exports.AstParser = void 0;
52
+ const fs = __importStar(require("fs"));
53
+ const path = __importStar(require("path"));
54
+ const logger_1 = __importStar(require("../../../utils/logger"));
55
+ const ArkCxxAstNode_1 = require("./ArkCxxAstNode");
56
+ const napiApi_1 = require("./astJsonNapi/napiApi");
57
+ const astUtils_1 = require("./astUtils");
58
+ const logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER, 'astParser');
59
+ class AstParser {
60
+ static deleteFileSync(filePath) {
61
+ try {
62
+ fs.unlinkSync(filePath);
63
+ }
64
+ catch (_a) {
65
+ logger.warn('delete file failed:', filePath);
66
+ }
67
+ }
68
+ static parse(sourceFile, ccJsonPath, includeDirs, llvmPath, cppAstPath) {
69
+ logger.info(`[Debug] Parsing File: ${sourceFile}`);
70
+ if (!fs.existsSync(sourceFile)) {
71
+ logger.warn('parse file is not exists');
72
+ return this.createEmptyNode();
73
+ }
74
+ const rawAstPath = this.getAstOutputPath(sourceFile, cppAstPath);
75
+ const astPath = path.resolve(rawAstPath);
76
+ this.ensureOutputDir(path.dirname(astPath));
77
+ const workingDir = this.getWorkingDir(ccJsonPath);
78
+ const finalIncludeDirs = includeDirs ? [...includeDirs] : [];
79
+ const projectRoot = this.resolveProjectRoot(sourceFile);
80
+ if (projectRoot && !finalIncludeDirs.includes(projectRoot)) {
81
+ finalIncludeDirs.push(projectRoot);
82
+ }
83
+ const status = (0, napiApi_1.dumpAstJson)({
84
+ sourceFile,
85
+ outputFile: astPath,
86
+ ccJsonPath: ccJsonPath !== null && ccJsonPath !== void 0 ? ccJsonPath : undefined,
87
+ includeDirs: finalIncludeDirs,
88
+ }, workingDir, llvmPath);
89
+ return this.processAstFile(astPath, sourceFile, status);
90
+ }
91
+ static resolveProjectRoot(sourceFile) {
92
+ try {
93
+ let currentDir = path.dirname(sourceFile);
94
+ for (let i = 0; i < 10; i++) {
95
+ if (path.dirname(currentDir) === currentDir) {
96
+ break;
97
+ }
98
+ if (path.basename(currentDir) === 'cpp' && path.basename(path.dirname(currentDir)) === 'main') {
99
+ const absRoot = path.resolve(currentDir);
100
+ logger.info(`[Debug] Found Source Root: ${absRoot}`);
101
+ return absRoot;
102
+ }
103
+ currentDir = path.dirname(currentDir);
104
+ }
105
+ }
106
+ catch (e) {
107
+ logger.error('[Debug] Error finding source root:', e);
108
+ }
109
+ return null;
110
+ }
111
+ static getWorkingDir(ccJsonPath) {
112
+ let workingDir = process.cwd();
113
+ if (ccJsonPath && fs.existsSync(ccJsonPath)) {
114
+ const stats = fs.statSync(ccJsonPath);
115
+ if (stats.isFile()) {
116
+ workingDir = path.dirname(ccJsonPath);
117
+ }
118
+ else {
119
+ workingDir = ccJsonPath;
120
+ }
121
+ }
122
+ return workingDir;
123
+ }
124
+ static processAstFile(astPath, sourceFile, status) {
125
+ try {
126
+ if (!fs.existsSync(astPath)) {
127
+ logger.error(`[Debug] AST file missing at: ${astPath}`);
128
+ return this.createEmptyNode();
129
+ }
130
+ const content = fs.readFileSync(astPath, 'utf-8');
131
+ if (!content || content.trim() === '') {
132
+ return this.createEmptyNode();
133
+ }
134
+ let tu = JSON.parse(content);
135
+ tu = this.filter(sourceFile, tu);
136
+ return tu;
137
+ }
138
+ catch (e) {
139
+ logger.error('Failed to parse AST json:', e);
140
+ return this.createEmptyNode();
141
+ }
142
+ finally {
143
+ this.deleteFileSync(astPath);
144
+ }
145
+ }
146
+ static createEmptyNode() {
147
+ return { kind: '', name: '', code: '', type: { qualType: '' }, inner: [] };
148
+ }
149
+ static updateInner(sourceFile, entry, newInner) {
150
+ if (entry.isImplicit) {
151
+ return;
152
+ }
153
+ const loc = entry.loc;
154
+ if (!loc) {
155
+ logger.warn('Node skipped due to missing "locFile", kind of node: ', entry.kind);
156
+ return;
157
+ }
158
+ newInner.push(entry);
159
+ }
160
+ static filter(sourceFile, translationUnit) {
161
+ const newInner = [];
162
+ for (const entry of translationUnit.inner) {
163
+ this.updateInner(sourceFile, entry, newInner);
164
+ }
165
+ translationUnit.inner = newInner;
166
+ translationUnit.fileName = sourceFile;
167
+ translationUnit.projectName = path.dirname(sourceFile);
168
+ this.fullInfo(translationUnit);
169
+ return translationUnit;
170
+ }
171
+ static filterChildren(cursor) {
172
+ if (!cursor.inner) {
173
+ return [];
174
+ }
175
+ return cursor.inner.filter((item) => !item.isImplicit);
176
+ }
177
+ static makeGetParent(cursor) {
178
+ function getParent(isNeedInner) {
179
+ if (isNeedInner) {
180
+ return Object.assign({}, cursor);
181
+ }
182
+ const { inner } = cursor, rest = __rest(cursor, ["inner"]);
183
+ return rest;
184
+ }
185
+ return getParent;
186
+ }
187
+ static fullInfo(cursor) {
188
+ if (!cursor.inner) {
189
+ cursor.inner = [];
190
+ }
191
+ cursor.inner = this.filterChildren(cursor);
192
+ if (cursor.name === undefined) {
193
+ cursor.name = '';
194
+ }
195
+ if (cursor.kind === 'LambdaExpr') {
196
+ this.processAccess(cursor);
197
+ }
198
+ if (cursor.kind === ArkCxxAstNode_1.astKind.CXXRecordDecl && cursor.tagUsed === 'class') {
199
+ this.currentAccess = 'private';
200
+ }
201
+ else if (cursor.kind === ArkCxxAstNode_1.astKind.CXXRecordDecl && cursor.tagUsed === 'struct') {
202
+ this.currentAccess = 'public';
203
+ }
204
+ else {
205
+ this.currentAccess = '';
206
+ }
207
+ for (const currentCursor of cursor.inner) {
208
+ Object.assign(currentCursor, { getParent: this.makeGetParent(cursor) });
209
+ if (cursor.kind === ArkCxxAstNode_1.astKind.CXXRecordDecl || cursor.kind === ArkCxxAstNode_1.astKind.CXXMethodDecl || cursor.kind === ArkCxxAstNode_1.astKind.FunctionDecl) {
210
+ this.processAccess(currentCursor);
211
+ }
212
+ this.fullInfo(currentCursor);
213
+ }
214
+ }
215
+ static processAccess(cursor) {
216
+ var _a, _b;
217
+ cursor.modifiers = [];
218
+ if (cursor.kind === 'AccessSpecDecl') {
219
+ this.currentAccess = (_b = (_a = cursor.access) !== null && _a !== void 0 ? _a : (0, astUtils_1.extractAllCppModifiers)(cursor.code)[0]) !== null && _b !== void 0 ? _b : '';
220
+ }
221
+ else {
222
+ const extractedCode = this.getCodeForExtractModifiers(cursor);
223
+ const codeModifier = (0, astUtils_1.extractAllCppModifiers)(extractedCode);
224
+ if (this.currentAccess !== '') {
225
+ cursor.modifiers.push(this.currentAccess);
226
+ }
227
+ if (codeModifier !== null) {
228
+ cursor.modifiers.push(...codeModifier);
229
+ }
230
+ }
231
+ }
232
+ static getCodeForExtractModifiers(cursor) {
233
+ const extractedCode = cursor.code;
234
+ if (!['CXXConstructorDecl', 'CXXDestructorDecl', 'CXXMethodDecl', 'FriendDecl', 'FunctionDecl', 'FunctionTemplateDecl'].includes(cursor.kind)) {
235
+ return extractedCode;
236
+ }
237
+ const bodyNode = cursor.inner.filter((inner) => inner.kind === 'CompoundStmt');
238
+ const bodyCode = bodyNode.length === 0 ? '' : bodyNode[0].code;
239
+ return this.stripFucntionParams(extractedCode.replace(bodyCode, ''));
240
+ }
241
+ static stripFucntionParams(code) {
242
+ let depth = 0;
243
+ let start = -1;
244
+ let end = -1;
245
+ for (let i = 0; i < code.length; i++) {
246
+ const ch = code[i];
247
+ if (ch === '(') {
248
+ if (depth === 0) {
249
+ start = i;
250
+ }
251
+ depth++;
252
+ }
253
+ else if (ch === ')') {
254
+ depth--;
255
+ if (depth === 0) {
256
+ end = i;
257
+ break;
258
+ }
259
+ }
260
+ }
261
+ if (start === -1 || end === -1) {
262
+ return code;
263
+ }
264
+ return code.slice(0, start).trimEnd() + ' ' + code.slice(end + 1).trimStart();
265
+ }
266
+ static getAstOutputPath(sourceFile, cppAstPath) {
267
+ const fileName = `${path.parse(path.basename(sourceFile)).name}_AST.json`;
268
+ if (cppAstPath !== '') {
269
+ return path.join(cppAstPath, fileName);
270
+ }
271
+ return path.join(astUtils_1.ClangPath.protectRoot, 'src', 'frontend', 'cppFrontend', 'ast', 'out', fileName);
272
+ }
273
+ static ensureOutputDir(dir) {
274
+ if (!fs.existsSync(dir)) {
275
+ fs.mkdirSync(dir, { recursive: true });
276
+ }
277
+ }
278
+ }
279
+ exports.AstParser = AstParser;
280
+ AstParser.currentAccess = '';
@@ -1,51 +1,18 @@
1
- import { CxxAstNode, CxxAstNodeLite } from './ArkCxxAstNode';
2
- export type GetParentFn = {
3
- (isNeedInner: true): CxxAstNode;
4
- (isNeedInner?: false): CxxAstNodeLite;
5
- };
6
- export declare class AstUtils {
7
- private static currentAccess;
8
- private static deleteFileSync;
9
- static parse(sourceFile: string, ccJsonPath: string | null, includeDirs: string[] | null, llvmPath: string, cppAstPath: string): CxxAstNode;
10
- /**
11
- * Auxiliary method: Try to find and return the root directory of src/main/cpp
12
- */
13
- private static resolveProjectRoot;
14
- /**
15
- * Auxiliary method: Determine Work Catalog (CWD)
16
- */
17
- private static getWorkingDir;
18
- /**
19
- * Auxiliary method: Execute Clang process and print debugging logs
20
- */
21
- private static runClang;
22
- /**
23
- * Auxiliary method: Read and parse the generated AST JSON file
24
- */
25
- private static processAstFile;
26
- private static createEmptyNode;
27
- private static updateInner;
28
- private static filter;
29
- private static filterChildren;
30
- private static makeGetParent;
31
- private static fullInfo;
32
- static extractAllCppModifiers(code: string): string[];
33
- private static processAccess;
34
- private static getCodeForExtractModifiers;
35
- private static stripFucntionParams;
36
- private static getAstOutputPath;
37
- private static ensureOutputDir;
38
- private static getPlatformClang;
1
+ export declare function findProjectRoot(startDir?: string): string;
2
+ /**
3
+ * Resolved path to the astJsonDumper N-API addon ({@code astJsonDumper.node} under dumper/ or lib/ast/).
4
+ */
5
+ export declare function getAstJsonDumperNodePath(): string;
6
+ /** True when {@link getAstJsonDumperNodePath} exists on disk. */
7
+ export declare function isAstJsonDumperAvailable(): boolean;
8
+ /** Project-root anchor for C++ AST output paths (legacy name: historically held Clang binary paths). */
9
+ export declare class ClangPath {
10
+ static protectRoot: string;
39
11
  }
12
+ export declare function extractAllCppModifiers(code: string): string[];
40
13
  /**
41
14
  * Find the absolute path of compile_commands.json starting from a file path.
42
- * Strict logic: Only traverses upward (ancestors) to find a ".cxx" directory.
43
- * Does NOT search sibling/uncle directories.
44
- * Caches the result based on the project root (the directory containing .cxx).
45
- * CxxTodo :Further confirmation can be made on whether there is a summary of the entire project's ccjson,
46
- * which only needs to be provided once in the scene build,(the directory containing ./.idea/.deveco/cxx/.cache)
47
- * * @param filePath Absolute path of the input file
48
- * @returns Absolute path of compile_commands.json if found, otherwise empty string
15
+ * Strict logic: only traverses upward (ancestors) to find a ".cxx" directory.
49
16
  */
50
17
  export declare function findCompileCommands(filePath: string): string;
51
18
  //# sourceMappingURL=astUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"astUtils.d.ts","sourceRoot":"","sources":["../../../../src/front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