@lcap/nasl-language-server-core 3.14.0-rc.3 → 3.14.0-rc.4
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.
- package/out/checker.d.ts.map +1 -1
- package/out/checker.js +88 -34
- package/out/checker.js.map +1 -1
- package/out/index.d.ts +1 -1
- package/out/index.d.ts.map +1 -1
- package/out/index.js +3 -1
- package/out/index.js.map +1 -1
- package/out/reference-manager/builtin-q-name.d.ts +8 -1
- package/out/reference-manager/builtin-q-name.d.ts.map +1 -1
- package/out/reference-manager/builtin-q-name.js +55 -1
- package/out/reference-manager/builtin-q-name.js.map +1 -1
- package/out/reference-manager/reference-manager.d.ts +3 -1
- package/out/reference-manager/reference-manager.d.ts.map +1 -1
- package/out/reference-manager/reference-manager.js +166 -56
- package/out/reference-manager/reference-manager.js.map +1 -1
- package/out/reference-manager/symbol-type.d.ts +2 -2
- package/out/reference-manager/symbol-type.d.ts.map +1 -1
- package/out/reference-manager/symbol-type.js +2 -1
- package/out/reference-manager/symbol-type.js.map +1 -1
- package/out/typer/collectGlobalDefs.d.ts.map +1 -1
- package/out/typer/collectGlobalDefs.js +79 -15
- package/out/typer/collectGlobalDefs.js.map +1 -1
- package/out/typer/component-def-manager/component-def-manager.d.ts +11 -7
- package/out/typer/component-def-manager/component-def-manager.d.ts.map +1 -1
- package/out/typer/component-def-manager/component-def-manager.js +17 -6
- package/out/typer/component-def-manager/component-def-manager.js.map +1 -1
- package/out/typer/dispatch-def.d.ts +0 -2
- package/out/typer/dispatch-def.d.ts.map +1 -1
- package/out/typer/dispatch-def.js +10 -38
- package/out/typer/dispatch-def.js.map +1 -1
- package/out/typer/dispatch-expr.d.ts.map +1 -1
- package/out/typer/dispatch-expr.js +55 -68
- package/out/typer/dispatch-expr.js.map +1 -1
- package/out/typer/dispatch-process.d.ts.map +1 -1
- package/out/typer/dispatch-process.js +4 -2
- package/out/typer/dispatch-process.js.map +1 -1
- package/out/typer/dispatch-stmt.d.ts.map +1 -1
- package/out/typer/dispatch-stmt.js +26 -20
- package/out/typer/dispatch-stmt.js.map +1 -1
- package/out/typer/dispatch-view.d.ts.map +1 -1
- package/out/typer/dispatch-view.js +6 -3
- package/out/typer/dispatch-view.js.map +1 -1
- package/out/typer/incremental-update.d.ts +1 -1
- package/out/typer/incremental-update.d.ts.map +1 -1
- package/out/typer/incremental-update.js +18 -14
- package/out/typer/incremental-update.js.map +1 -1
- package/out/typer/index.d.ts +3 -4
- package/out/typer/index.d.ts.map +1 -1
- package/out/typer/index.js +4 -4
- package/out/typer/index.js.map +1 -1
- package/out/typer/sem-diag.d.ts +1 -0
- package/out/typer/sem-diag.d.ts.map +1 -1
- package/out/typer/sem-diag.js +24 -17
- package/out/typer/sem-diag.js.map +1 -1
- package/out/typer/solver.d.ts +1 -0
- package/out/typer/solver.d.ts.map +1 -1
- package/out/typer/solver.js +9 -1
- package/out/typer/solver.js.map +1 -1
- package/out/typer/subster.d.ts.map +1 -1
- package/out/typer/subster.js +20 -6
- package/out/typer/subster.js.map +1 -1
- package/out/typer/type-manager.d.ts +1 -2
- package/out/typer/type-manager.d.ts.map +1 -1
- package/out/typer/type-manager.js +22 -17
- package/out/typer/type-manager.js.map +1 -1
- package/out/typer/type-predicate.d.ts.map +1 -1
- package/out/typer/type-predicate.js +2 -1
- package/out/typer/type-predicate.js.map +1 -1
- package/out/typer/typer.d.ts +14 -2
- package/out/typer/typer.d.ts.map +1 -1
- package/out/typer/typer.js +20 -2
- package/out/typer/typer.js.map +1 -1
- package/out/typer/unifier.d.ts.map +1 -1
- package/out/typer/unifier.js +37 -27
- package/out/typer/unifier.js.map +1 -1
- package/out/utils/parseTsClassType.d.ts +2 -0
- package/out/utils/parseTsClassType.d.ts.map +1 -1
- package/out/utils/parseTsClassType.js +4 -2
- package/out/utils/parseTsClassType.js.map +1 -1
- package/out/utils/type-operator.d.ts +1 -1
- package/out/utils/type-operator.d.ts.map +1 -1
- package/out/utils/type-operator.js +18 -3
- package/out/utils/type-operator.js.map +1 -1
- package/package.json +5 -5
package/out/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from './module';
|
|
2
2
|
export * from './symbol';
|
|
3
3
|
export { dispatchAsyncDef, firstScreenCheckAndCompare, traverseListAndCompareType } from './typer/dispatch-all';
|
|
4
|
-
export { printConstraints, printType, showType, printTySubst, TypingEnv, SemEnv, dispatchDef, parseTsFnToNaslQNameRefMaps, topoSortLogicAndSetTypes, findErrMutRecFns, createRefTyAnnFromDef, isEqualTy, divideBy } from './typer/index';
|
|
4
|
+
export { printConstraints, printType, showType, printTySubst, TypingEnv, SemEnv, dispatchDef, parseTsFnToNaslQNameRefMaps, topoSortLogicAndSetTypes, findErrMutRecFns, createRefTyAnnFromDef, isEqualTy, divideBy, isUnResolvedTy, isResolvedUserTy } from './typer/index';
|
|
5
5
|
export * from './typer/incremental-update';
|
|
6
6
|
export * from './reference-manager/reference-manager';
|
|
7
7
|
export * as checker from './checker';
|
package/out/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAEhH,OAAO,EAAE,gBAAgB,EACrB,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,MAAM,EACN,WAAW,EACX,2BAA2B,EAC3B,wBAAwB,EACxB,gBAAgB,EAChB,qBAAqB,EACrB,SAAS,EACT,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAEhH,OAAO,EAAE,gBAAgB,EACrB,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,MAAM,EACN,WAAW,EACX,2BAA2B,EAC3B,wBAAwB,EACxB,gBAAgB,EAChB,qBAAqB,EACrB,SAAS,EACT,QAAQ,EACR,cAAc,EACd,gBAAgB,EACnB,MAAM,eAAe,CAAC;AAEvB,cAAc,4BAA4B,CAAC;AAE3C,cAAc,uCAAuC,CAAC;AAEtD,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC,cAAc,qBAAqB,CAAC;AAEpC,cAAc,yBAAyB,CAAC"}
|
package/out/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
26
26
|
return result;
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.checker = exports.divideBy = exports.isEqualTy = exports.createRefTyAnnFromDef = exports.findErrMutRecFns = exports.topoSortLogicAndSetTypes = exports.parseTsFnToNaslQNameRefMaps = exports.dispatchDef = exports.SemEnv = exports.printTySubst = exports.showType = exports.printType = exports.printConstraints = exports.traverseListAndCompareType = exports.firstScreenCheckAndCompare = exports.dispatchAsyncDef = void 0;
|
|
29
|
+
exports.checker = exports.isResolvedUserTy = exports.isUnResolvedTy = exports.divideBy = exports.isEqualTy = exports.createRefTyAnnFromDef = exports.findErrMutRecFns = exports.topoSortLogicAndSetTypes = exports.parseTsFnToNaslQNameRefMaps = exports.dispatchDef = exports.SemEnv = exports.printTySubst = exports.showType = exports.printType = exports.printConstraints = exports.traverseListAndCompareType = exports.firstScreenCheckAndCompare = exports.dispatchAsyncDef = void 0;
|
|
30
30
|
__exportStar(require("./module"), exports);
|
|
31
31
|
__exportStar(require("./symbol"), exports);
|
|
32
32
|
var dispatch_all_1 = require("./typer/dispatch-all");
|
|
@@ -46,6 +46,8 @@ Object.defineProperty(exports, "findErrMutRecFns", { enumerable: true, get: func
|
|
|
46
46
|
Object.defineProperty(exports, "createRefTyAnnFromDef", { enumerable: true, get: function () { return index_1.createRefTyAnnFromDef; } });
|
|
47
47
|
Object.defineProperty(exports, "isEqualTy", { enumerable: true, get: function () { return index_1.isEqualTy; } });
|
|
48
48
|
Object.defineProperty(exports, "divideBy", { enumerable: true, get: function () { return index_1.divideBy; } });
|
|
49
|
+
Object.defineProperty(exports, "isUnResolvedTy", { enumerable: true, get: function () { return index_1.isUnResolvedTy; } });
|
|
50
|
+
Object.defineProperty(exports, "isResolvedUserTy", { enumerable: true, get: function () { return index_1.isResolvedUserTy; } });
|
|
49
51
|
__exportStar(require("./typer/incremental-update"), exports);
|
|
50
52
|
__exportStar(require("./reference-manager/reference-manager"), exports);
|
|
51
53
|
exports.checker = __importStar(require("./checker"));
|
package/out/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,2CAAyB;AACzB,qDAAgH;AAAvG,gHAAA,gBAAgB,OAAA;AAAE,0HAAA,0BAA0B,OAAA;AAAE,0HAAA,0BAA0B,OAAA;AAEjF,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,2CAAyB;AACzB,qDAAgH;AAAvG,gHAAA,gBAAgB,OAAA;AAAE,0HAAA,0BAA0B,OAAA;AAAE,0HAAA,0BAA0B,OAAA;AAEjF,uCAeuB;AAfd,yGAAA,gBAAgB,OAAA;AACrB,kGAAA,SAAS,OAAA;AACT,iGAAA,QAAQ,OAAA;AACR,qGAAA,YAAY,OAAA;AAEZ,+FAAA,MAAM,OAAA;AACN,oGAAA,WAAW,OAAA;AACX,oHAAA,2BAA2B,OAAA;AAC3B,iHAAA,wBAAwB,OAAA;AACxB,yGAAA,gBAAgB,OAAA;AAChB,8GAAA,qBAAqB,OAAA;AACrB,kGAAA,SAAS,OAAA;AACT,iGAAA,QAAQ,OAAA;AACR,uGAAA,cAAc,OAAA;AACd,yGAAA,gBAAgB,OAAA;AAGpB,6DAA2C;AAE3C,wEAAsD;AAEtD,qDAAqC;AAErC,sDAAoC;AAEpC,0DAAwC"}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import { Module } from '@lcap/nasl-concepts';
|
|
1
|
+
import { Module, Logic } from '@lcap/nasl-concepts';
|
|
2
2
|
import { DefConcept } from './reference-manager';
|
|
3
3
|
import { SemEnv } from '../typer';
|
|
4
4
|
export declare function collectBuiltInStructsAndLogics(env: SemEnv, fileContent: string, nsp: string): void;
|
|
5
5
|
export declare function collectProcessLibStructsAndLogics(qNameDefs: Map<string, DefConcept>, m: Module): void;
|
|
6
6
|
export declare function collectAllNaslNameSpace(m: Map<string, DefConcept>): void;
|
|
7
|
+
export declare const buildBuiltinTypeQNameDefs: (qNameDefs: Map<string, DefConcept>) => void;
|
|
8
|
+
/**
|
|
9
|
+
* 为重载函数生成一份默认定义,方便排除报错 找不到xxx函数
|
|
10
|
+
* 'Convert', 'Length', 'CAST', 'MAX', 'MIN', 'SUM', 'LAST_DAY', 'ADD_MONTHS'
|
|
11
|
+
* @warning 'nasl.sqlFunction' 这个路径是不对的,真实的路径是 'nasl.sqlFunction.mysql' 等带数据库名的,但是一般用不到它
|
|
12
|
+
*/
|
|
13
|
+
export declare const createDefaultOverloadedFnDef: (fnName: string, nsp: 'nasl.util' | 'nasl.sqlFunction') => Logic;
|
|
7
14
|
//# sourceMappingURL=builtin-q-name.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtin-q-name.d.ts","sourceRoot":"","sources":["../../src/reference-manager/builtin-q-name.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgD,MAAM,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"builtin-q-name.d.ts","sourceRoot":"","sources":["../../src/reference-manager/builtin-q-name.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgD,MAAM,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAGlG,OAAO,EAAE,UAAU,EAAyB,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,MAAM,EAA2C,MAAM,UAAU,CAAC;AAK3E,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAiClG;AAGD,wBAAgB,iCAAiC,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,CAAC,EAAE,MAAM,QAE9F;AAED,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,QA2C/D;AAEH,eAAO,MAAM,yBAAyB,cAAe,IAAI,MAAM,EAAE,UAAU,CAAC,SAmC3E,CAAA;AAGD;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,WAAY,MAAM,OAAO,WAAW,GAAG,kBAAkB,UAejG,CAAA"}
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.collectAllNaslNameSpace = exports.collectProcessLibStructsAndLogics = exports.collectBuiltInStructsAndLogics = void 0;
|
|
7
|
+
exports.createDefaultOverloadedFnDef = exports.buildBuiltinTypeQNameDefs = exports.collectAllNaslNameSpace = exports.collectProcessLibStructsAndLogics = exports.collectBuiltInStructsAndLogics = void 0;
|
|
8
8
|
const nasl_concepts_1 = require("@lcap/nasl-concepts");
|
|
9
9
|
const parseTsClassType_1 = require("../utils/parseTsClassType");
|
|
10
10
|
const typescript_1 = __importDefault(require("typescript"));
|
|
@@ -88,4 +88,58 @@ function collectAllNaslNameSpace(m) {
|
|
|
88
88
|
}));
|
|
89
89
|
}
|
|
90
90
|
exports.collectAllNaslNameSpace = collectAllNaslNameSpace;
|
|
91
|
+
const buildBuiltinTypeQNameDefs = (qNameDefs) => {
|
|
92
|
+
const createNaslPrimTyDef = (name) => nasl_concepts_1.Structure.createProtoTypeOnly({ name, properties: [] });
|
|
93
|
+
['Boolean', 'String', 'Long', 'Decimal', 'Date', 'DateTime', 'Time', 'Binary', 'Null', 'any', 'void'].forEach(str => {
|
|
94
|
+
const def = createNaslPrimTyDef(str);
|
|
95
|
+
if (def.name === 'String') {
|
|
96
|
+
def.properties.push(nasl_concepts_1.StructureProperty.createProtoTypeOnly({
|
|
97
|
+
name: 'length',
|
|
98
|
+
typeAnnotation: typer_1.naslLongTy
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
101
|
+
// type namespace is nasl.core
|
|
102
|
+
qNameDefs.set(`nasl.core.${str}`, def);
|
|
103
|
+
});
|
|
104
|
+
const createNaslGenericTyDef = (name) => nasl_concepts_1.Structure.createProtoTypeOnly({
|
|
105
|
+
name,
|
|
106
|
+
properties: [nasl_concepts_1.StructureProperty.createProtoTypeOnly({ name: 'length', typeAnnotation: typer_1.naslLongTy })],
|
|
107
|
+
});
|
|
108
|
+
['Map', 'List'].forEach(str => {
|
|
109
|
+
const def = createNaslGenericTyDef(str);
|
|
110
|
+
if (str === 'List') {
|
|
111
|
+
def.typeParams = [(0, typer_1.createTyParam)('T')];
|
|
112
|
+
}
|
|
113
|
+
else if (str === 'Map') {
|
|
114
|
+
def.typeParams = [(0, typer_1.createTyParam)('K'), (0, typer_1.createTyParam)('V')];
|
|
115
|
+
}
|
|
116
|
+
// type namespace is nasl.collection
|
|
117
|
+
qNameDefs.set(`nasl.collection.${str}`, def);
|
|
118
|
+
});
|
|
119
|
+
// Current<T>
|
|
120
|
+
collectAllNaslNameSpace(qNameDefs);
|
|
121
|
+
};
|
|
122
|
+
exports.buildBuiltinTypeQNameDefs = buildBuiltinTypeQNameDefs;
|
|
123
|
+
/**
|
|
124
|
+
* 为重载函数生成一份默认定义,方便排除报错 找不到xxx函数
|
|
125
|
+
* 'Convert', 'Length', 'CAST', 'MAX', 'MIN', 'SUM', 'LAST_DAY', 'ADD_MONTHS'
|
|
126
|
+
* @warning 'nasl.sqlFunction' 这个路径是不对的,真实的路径是 'nasl.sqlFunction.mysql' 等带数据库名的,但是一般用不到它
|
|
127
|
+
*/
|
|
128
|
+
const createDefaultOverloadedFnDef = (fnName, nsp) => {
|
|
129
|
+
const lgc = nasl_concepts_1.Logic.createProtoTypeOnly({
|
|
130
|
+
name: `${nsp}.${fnName}`,
|
|
131
|
+
body: [],
|
|
132
|
+
variables: [],
|
|
133
|
+
returns: [],
|
|
134
|
+
params: [],
|
|
135
|
+
virtualParams: [],
|
|
136
|
+
typeParams: [],
|
|
137
|
+
playground: []
|
|
138
|
+
});
|
|
139
|
+
// Override the getNamespace method to return our namespace
|
|
140
|
+
// This will make calleewholeKey getter work properly
|
|
141
|
+
lgc.getNamespace = () => nsp || '';
|
|
142
|
+
return lgc;
|
|
143
|
+
};
|
|
144
|
+
exports.createDefaultOverloadedFnDef = createDefaultOverloadedFnDef;
|
|
91
145
|
//# sourceMappingURL=builtin-q-name.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtin-q-name.js","sourceRoot":"","sources":["../../src/reference-manager/builtin-q-name.ts"],"names":[],"mappings":";AAAA,mEAAmE;;;;;;AAGnE,
|
|
1
|
+
{"version":3,"file":"builtin-q-name.js","sourceRoot":"","sources":["../../src/reference-manager/builtin-q-name.ts"],"names":[],"mappings":";AAAA,mEAAmE;;;;;;AAGnE,uDAAkG;AAClG,gEAAiF;AACjF,4DAA4B;AAC5B,2DAAwE;AACxE,oCAA2E;AAC3E,qDAA4D;AAG5D,mCAAmC;AACnC,SAAgB,8BAA8B,CAAC,GAAW,EAAE,WAAmB,EAAE,GAAW;IACxF,IAAI,CAAC,WAAW,EAAE,CAAC;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C;IACnC,OAAO,GAAG,CAAC;AACb,CAAC,CAAA;AAfY,QAAA,4BAA4B,gCAexC"}
|
|
@@ -151,7 +151,7 @@ export declare class ReferenceManager {
|
|
|
151
151
|
slowBuildSymbolRefsForApp: (env: SemEnv, app: App) => void;
|
|
152
152
|
private fastBuildQNameDefs;
|
|
153
153
|
/**
|
|
154
|
-
* FIXME wudengke rename this
|
|
154
|
+
* FIXME wudengke rename this to collectFullDefs
|
|
155
155
|
* @param app
|
|
156
156
|
*/
|
|
157
157
|
addQNameDefs: (app: App) => void;
|
|
@@ -217,6 +217,7 @@ export declare class ReferenceManager {
|
|
|
217
217
|
handleRefOp: (env: SemEnv, mode: Operation, refNd: RefConcept, qName: string) => void;
|
|
218
218
|
handleSymbolImplicitRefs: (nd: SyntaxNode | undefined) => void;
|
|
219
219
|
private handleNewCompositeNode;
|
|
220
|
+
private handleForeignKeyRef;
|
|
220
221
|
/**
|
|
221
222
|
* 无论根节点是 ref 还是 def,都要递归收集下层所有的引用节点
|
|
222
223
|
* 会打散 a.b.c、A | B、x.a.b 等结构,并记录必要的信息
|
|
@@ -264,6 +265,7 @@ export declare class ReferenceManager {
|
|
|
264
265
|
*/
|
|
265
266
|
private splitPolyType;
|
|
266
267
|
private splitQueryLike;
|
|
268
|
+
private splitFieldPermissionV2;
|
|
267
269
|
static getEntityLogicQNames(nd: Entity): string[];
|
|
268
270
|
clearAll(): void;
|
|
269
271
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reference-manager.d.ts","sourceRoot":"","sources":["../../src/reference-manager/reference-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,MAAM,EACN,cAAc,EACd,IAAI,EACJ,UAAU,EAGV,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EAEnB,SAAS,EACT,iBAAiB,EACjB,KAAK,UAAU,EACf,cAAc,EAId,GAAG,EACH,QAAQ,EACR,WAAW,EAaX,gBAAgB,
|
|
1
|
+
{"version":3,"file":"reference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OAMG;IACH;;;;;;;OAOG;IACH,OAAO,CAAC,WAAW,CAyElB;IAEM,oBAAoB,OAAQ,UAAU,KAAG,IAAI,UAAU,EAAE,KAAK,CAAC,CAerE;IAED;;;OAGG;IACI,sBAAsB,QAAS,MAAM,QAAQ,UAAU,UAiC7D;IAED;;;OAGG;IACI,mBAAmB,QAAS,MAAM,MAAM,UAAU,UAsBxD;IAEM,iBAAiB,OAAQ,UAAU,UAKzC;IAED;;;;;;;;OAQG;IACH,OAAO,CAAC,WAAW,CA6IlB;IAED;;;;;;OAMG;IACH,OAAO,CAAC,aAAa,CAuBpB;IAGD,OAAO,CAAC,cAAc,CAuCpB;IAEF,OAAO,CAAC,sBAAsB,CAoB5B;IAEF,MAAM,CAAC,oBAAoB,CAAC,EAAE,EAAE,MAAM;IAS/B,QAAQ;IAaf;;OAEG;IACH,cAAc,4BAiDb;IAEM,oBAAoB,6BAA8B,CAAC,KAAG,CAAC,CAsB7D;CACJ;AAgGD,eAAO,MAAM,eAAe,UAAW,MAAM,WAAW,MAAM,KAAG,MAWhE,CAAC;AAkBF;;GAEG;AACH,eAAO,MAAM,aAAa,OAAQ,UAAU,GAAG,IAAI,GAAG,SAAS,KAAG,OACuB,CAAC;AAE1F,eAAO,MAAM,kBAAkB,QAAS,MAAM,WAK7C,CAAA;AAGD;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,OACxB,cAAc,YACR,iBAAiB,GAAG,SAAS,SAChC,UAAU,KAClB,CAAC,UAAU,EAAE,KAAK,CAAC,GAAG,SAQxB,CAAA;AAsCD,eAAO,MAAM,kBAAkB,SAAU,MAAM,WAErC,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,QAAS,UAAU,WActD,CAAA"}
|
|
@@ -21,6 +21,7 @@ const set_1 = require("mnemonist/set");
|
|
|
21
21
|
const nasl_predicate_1 = require("../typer/nasl-predicate");
|
|
22
22
|
const type_manager_1 = require("../typer/type-manager");
|
|
23
23
|
const oql_1 = require("../utils/oql");
|
|
24
|
+
const parseTsClassType_1 = require("../utils/parseTsClassType");
|
|
24
25
|
/**
|
|
25
26
|
* 考虑这样一个例子:
|
|
26
27
|
* x = f(...)
|
|
@@ -202,20 +203,62 @@ class ReferenceManager {
|
|
|
202
203
|
// 约 20 万节点 200ms
|
|
203
204
|
this.slowBuildSymbolRefsForApp = (env, app) => {
|
|
204
205
|
this.modeForCollect = "create" /* Operation.Create */;
|
|
205
|
-
const allRefs =
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
206
|
+
const allRefs = new Array();
|
|
207
|
+
for (const dataSource of app.dataSources) {
|
|
208
|
+
allRefs.push(...this.collectRefs(env, dataSource));
|
|
209
|
+
}
|
|
210
|
+
for (const structure of app.structures) {
|
|
211
|
+
allRefs.push(...this.collectRefs(env, structure));
|
|
212
|
+
}
|
|
213
|
+
for (const e of app.enums) {
|
|
214
|
+
allRefs.push(...this.collectRefs(env, e));
|
|
215
|
+
}
|
|
216
|
+
for (const l of app.logics) {
|
|
217
|
+
allRefs.push(...this.collectRefs(env, l));
|
|
218
|
+
}
|
|
219
|
+
for (const ol of app.overriddenLogics) {
|
|
220
|
+
allRefs.push(...this.collectRefs(env, ol));
|
|
221
|
+
}
|
|
222
|
+
for (const i of app.interfaces) {
|
|
223
|
+
allRefs.push(...this.collectRefs(env, i));
|
|
224
|
+
}
|
|
225
|
+
// 见下面
|
|
226
|
+
// for (const frontendType of app.frontendTypes) {
|
|
227
|
+
// allRefs.push(...this.collectRefs(env, frontendType));
|
|
228
|
+
// }
|
|
229
|
+
for (const process of app.processes) {
|
|
230
|
+
allRefs.push(...this.collectRefs(env, process));
|
|
231
|
+
}
|
|
232
|
+
// 见下面
|
|
233
|
+
// for (const processV2 of app.processV2s) {
|
|
234
|
+
// allRefs.push(...this.collectRefs(env, processV2));
|
|
235
|
+
// }
|
|
236
|
+
for (const role of app.roles) {
|
|
237
|
+
allRefs.push(...this.collectRefs(env, role));
|
|
238
|
+
}
|
|
239
|
+
for (const connectorDependency of app.connectorDependencies) {
|
|
240
|
+
allRefs.push(...this.collectRefs(env, connectorDependency));
|
|
241
|
+
}
|
|
242
|
+
for (const interfaceDependency of app.interfaceDependencies) {
|
|
243
|
+
allRefs.push(...this.collectRefs(env, interfaceDependency));
|
|
244
|
+
}
|
|
245
|
+
for (const sharedAppDependency of app?.sharedAppDependencies) {
|
|
246
|
+
allRefs.push(...this.collectRefs(env, sharedAppDependency));
|
|
247
|
+
}
|
|
248
|
+
for (const authLogic of app.authLogics) {
|
|
249
|
+
allRefs.push(...this.collectRefs(env, authLogic));
|
|
250
|
+
}
|
|
251
|
+
for (const triggerLauncher of app.triggerLaunchers) {
|
|
252
|
+
allRefs.push(...this.collectRefs(env, triggerLauncher));
|
|
253
|
+
}
|
|
254
|
+
for (const metadataType of app.metadataTypes) {
|
|
255
|
+
allRefs.push(...this.collectRefs(env, metadataType));
|
|
256
|
+
}
|
|
257
|
+
// for (const preference of app.preferenceMap) {
|
|
258
|
+
// allRefs.push(...this.collectRefs(env, preference as any as ValidExtInp));
|
|
259
|
+
// }
|
|
260
|
+
app.integration && allRefs.push(...this.collectRefs(env, app.integration));
|
|
261
|
+
app.backend && allRefs.push(...this.collectRefs(env, app.backend));
|
|
219
262
|
allRefs.forEach(([ref, qName]) => {
|
|
220
263
|
if (!ref) {
|
|
221
264
|
return;
|
|
@@ -233,6 +276,42 @@ class ReferenceManager {
|
|
|
233
276
|
}
|
|
234
277
|
}
|
|
235
278
|
});
|
|
279
|
+
// 如果 QA 说查找引用要能看到实体逻辑里的类型啥的,再给注释去掉
|
|
280
|
+
// 处理一下实体逻辑
|
|
281
|
+
// app.dataSources.forEach(ds => {
|
|
282
|
+
// ds.entities.forEach(e => {
|
|
283
|
+
// e.logics.forEach((l: Logic) => {
|
|
284
|
+
// const refsInLogic = this.collectRefs(env, l);
|
|
285
|
+
// refsInLogic.forEach((qName, ref) => {
|
|
286
|
+
// console.log('xx')
|
|
287
|
+
// allRefs.set(ref, qName);
|
|
288
|
+
// });
|
|
289
|
+
// });
|
|
290
|
+
// });
|
|
291
|
+
// });
|
|
292
|
+
// 暂时特殊处理一下流程,应该不会太慢
|
|
293
|
+
for (const p of app.processV2s) {
|
|
294
|
+
this.addRefsForGlobalSym(env, p);
|
|
295
|
+
}
|
|
296
|
+
for (const fet of app.frontendTypes) {
|
|
297
|
+
for (const bc of fet.businessComponents) {
|
|
298
|
+
this.addRefsForGlobalSym(env, bc);
|
|
299
|
+
}
|
|
300
|
+
for (const cd of fet.componentDependencies) {
|
|
301
|
+
this.addRefsForGlobalSym(env, cd);
|
|
302
|
+
}
|
|
303
|
+
for (const fe of fet.frontends) {
|
|
304
|
+
for (const v of fe.views) {
|
|
305
|
+
this.addRefsForGlobalSym(env, v);
|
|
306
|
+
}
|
|
307
|
+
for (const be of fe.bindEvents) {
|
|
308
|
+
this.addRefsForGlobalSym(env, be);
|
|
309
|
+
}
|
|
310
|
+
for (const v of fe.variables) {
|
|
311
|
+
this.addRefsForGlobalSym(env, v);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
236
315
|
this.modeForCollect = null;
|
|
237
316
|
};
|
|
238
317
|
this.fastBuildQNameDefs = (app) => {
|
|
@@ -242,7 +321,15 @@ class ReferenceManager {
|
|
|
242
321
|
this.addQNameDefs(app);
|
|
243
322
|
}
|
|
244
323
|
// Build builtin types
|
|
245
|
-
buildBuiltinTypeQNameDefs(this.qNameDefs);
|
|
324
|
+
(0, builtin_q_name_1.buildBuiltinTypeQNameDefs)(this.qNameDefs);
|
|
325
|
+
for (const fn of parseTsClassType_1.overloadedBuiltinFns) {
|
|
326
|
+
const def = (0, builtin_q_name_1.createDefaultOverloadedFnDef)(fn, 'nasl.util');
|
|
327
|
+
this.addQNameDef(def.name, def); // name 已经带了 namespace
|
|
328
|
+
}
|
|
329
|
+
for (const fn of parseTsClassType_1.overloadedSqlFns) {
|
|
330
|
+
const def = (0, builtin_q_name_1.createDefaultOverloadedFnDef)(fn, 'nasl.sqlFunction');
|
|
331
|
+
this.addQNameDef(def.name, def); // name 已经带了 namespace
|
|
332
|
+
}
|
|
246
333
|
// Process enums
|
|
247
334
|
const processEnumCollection = (0, collect_q_name_1.adhocBuildProcessEnum)();
|
|
248
335
|
processEnumCollection.forEach(([qName, def]) => {
|
|
@@ -262,7 +349,7 @@ class ReferenceManager {
|
|
|
262
349
|
};
|
|
263
350
|
// Update the addQNameDefs method to use the new collection functions
|
|
264
351
|
/**
|
|
265
|
-
* FIXME wudengke rename this
|
|
352
|
+
* FIXME wudengke rename this to collectFullDefs
|
|
266
353
|
* @param app
|
|
267
354
|
*/
|
|
268
355
|
this.addQNameDefs = (app) => {
|
|
@@ -270,11 +357,9 @@ class ReferenceManager {
|
|
|
270
357
|
const qNameDefs = (0, collect_q_name_1.collectAllQNames)('')(app);
|
|
271
358
|
qNameDefs.forEach(([qName, def]) => {
|
|
272
359
|
if ((0, component_def_manager_1.isGeneralViewElementDefinition)(def)) {
|
|
273
|
-
this.compDefMgr.add(def, 'referenceManager
|
|
274
|
-
}
|
|
275
|
-
else {
|
|
276
|
-
this.addQNameDef(qName, def);
|
|
360
|
+
this.compDefMgr.add(def, 'referenceManager#addQNameDefs');
|
|
277
361
|
}
|
|
362
|
+
this.addQNameDef(qName, def);
|
|
278
363
|
});
|
|
279
364
|
}
|
|
280
365
|
};
|
|
@@ -567,6 +652,9 @@ class ReferenceManager {
|
|
|
567
652
|
oldRefs && this.setSymbolRefs(defNode, oldRefs);
|
|
568
653
|
// qName 链接到新的 defNode 的 mem addr
|
|
569
654
|
this.addQNameDef(qName, defNode);
|
|
655
|
+
if ((0, component_def_manager_1.isGeneralViewElementDefinition)(defNode)) {
|
|
656
|
+
this.compDefMgr.add(defNode, 'handleDefOp');
|
|
657
|
+
}
|
|
570
658
|
// 删除缓存
|
|
571
659
|
this.cachedQNameSymbolRefs.delete(qName);
|
|
572
660
|
}
|
|
@@ -582,6 +670,9 @@ class ReferenceManager {
|
|
|
582
670
|
const refs = this.getSymbolRefs(defNode);
|
|
583
671
|
refs && this.cachedQNameSymbolRefs.set(qName, refs);
|
|
584
672
|
this.qNameDefs.delete(qName);
|
|
673
|
+
if ((0, component_def_manager_1.isGeneralViewElementDefinition)(defNode)) {
|
|
674
|
+
this.compDefMgr.removeComponentGroup(defNode);
|
|
675
|
+
}
|
|
585
676
|
this.deleteSymbolRefs(defNode);
|
|
586
677
|
}
|
|
587
678
|
break;
|
|
@@ -669,7 +760,7 @@ class ReferenceManager {
|
|
|
669
760
|
}
|
|
670
761
|
};
|
|
671
762
|
this.handleNewCompositeNode = (nd) => {
|
|
672
|
-
if (
|
|
763
|
+
if (!nd.typeAnnotation) {
|
|
673
764
|
return;
|
|
674
765
|
}
|
|
675
766
|
if (!(0, type_predicate_1.isEntityTy)(nd.typeAnnotation) && !(0, type_predicate_1.isStructureTy)(nd.typeAnnotation)) {
|
|
@@ -698,6 +789,19 @@ class ReferenceManager {
|
|
|
698
789
|
}
|
|
699
790
|
}
|
|
700
791
|
};
|
|
792
|
+
this.handleForeignKeyRef = (env, nd) => {
|
|
793
|
+
const relNsp = nd.relationNamespace;
|
|
794
|
+
const relEntity = nd.relationEntity;
|
|
795
|
+
const relProperty = nd.relationProperty;
|
|
796
|
+
if (!relNsp || !relEntity || !relProperty) {
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
const relEntityQName = `${relNsp}.${relEntity}`;
|
|
800
|
+
// RefConcept 里暂时没有加 EntityProperty,因为它是个 Definition
|
|
801
|
+
this.handleRefOp(env, this.modeForCollect, nd, relEntityQName);
|
|
802
|
+
const relPropQName = (0, get_q_name_1.getPropQName)(`${relNsp}.${relEntity}`, `${relProperty}`, 'Entity');
|
|
803
|
+
this.handleRefOp(env, this.modeForCollect, nd, relPropQName);
|
|
804
|
+
};
|
|
701
805
|
/**
|
|
702
806
|
* 无论根节点是 ref 还是 def,都要递归收集下层所有的引用节点
|
|
703
807
|
* 会打散 a.b.c、A | B、x.a.b 等结构,并记录必要的信息
|
|
@@ -720,7 +824,8 @@ class ReferenceManager {
|
|
|
720
824
|
// 隐式引用 - 来自 __TypeAnnotation
|
|
721
825
|
this.handleSymbolImplicitRefs(n);
|
|
722
826
|
// New 左侧不是成员访问,需单独特殊处理,但也不用终止子树迭代
|
|
723
|
-
this.handleNewCompositeNode(n);
|
|
827
|
+
n.concept === 'NewComposite' && this.handleNewCompositeNode(n);
|
|
828
|
+
n.concept === 'EntityProperty' && this.handleForeignKeyRef(env, n);
|
|
724
829
|
if (!symbol_type_1.refConcept.includes(n.concept)) {
|
|
725
830
|
return;
|
|
726
831
|
}
|
|
@@ -735,7 +840,8 @@ class ReferenceManager {
|
|
|
735
840
|
const compositeNodePred = (n) => n.concept === 'MemberExpression' ||
|
|
736
841
|
n.concept === 'QueryFieldExpression' ||
|
|
737
842
|
n.concept === 'TypeAnnotation' ||
|
|
738
|
-
n.concept === 'OqlQueryComponent'
|
|
843
|
+
n.concept === 'OqlQueryComponent' ||
|
|
844
|
+
n.concept === 'FieldPermissionV2';
|
|
739
845
|
// 会终止子树迭代
|
|
740
846
|
const compositeNodeCb = (n) => {
|
|
741
847
|
let qNameRefs = new Array();
|
|
@@ -760,6 +866,9 @@ class ReferenceManager {
|
|
|
760
866
|
qNameRefs.push([n, qName]);
|
|
761
867
|
}
|
|
762
868
|
break;
|
|
869
|
+
case 'FieldPermissionV2':
|
|
870
|
+
qNameRefs = this.splitFieldPermissionV2(env, n);
|
|
871
|
+
break;
|
|
763
872
|
default: break;
|
|
764
873
|
}
|
|
765
874
|
for (const [ref, qName] of qNameRefs) {
|
|
@@ -801,6 +910,9 @@ class ReferenceManager {
|
|
|
801
910
|
if (rmNd.concept === 'View' || rmNd.concept === 'BusinessComponent') {
|
|
802
911
|
env.viewAssocProcess = env.processViewBindings.get((0, get_q_name_1.getTokenQualifiedName)(rmNd)) ?? null;
|
|
803
912
|
}
|
|
913
|
+
if (rmNd.concept === 'ProcessV2') {
|
|
914
|
+
env.processAssocBind = rmNd.bind;
|
|
915
|
+
}
|
|
804
916
|
const localVars = env.localVars.get(rmNd) ?? [];
|
|
805
917
|
const refAndQNames = this.collectRefs(env, rmNd);
|
|
806
918
|
for (const [ref, qName] of refAndQNames) {
|
|
@@ -823,6 +935,7 @@ class ReferenceManager {
|
|
|
823
935
|
(0, update_nasl_fragment_1.removeBindAttrRef)(this, rmNd);
|
|
824
936
|
}
|
|
825
937
|
env.viewAssocProcess = null;
|
|
938
|
+
env.processAssocBind = null;
|
|
826
939
|
};
|
|
827
940
|
/**
|
|
828
941
|
* @warning Only handle global symbols
|
|
@@ -835,6 +948,9 @@ class ReferenceManager {
|
|
|
835
948
|
// 如果是 null,则设置为 null,否则会报错
|
|
836
949
|
env.viewAssocProcess = env.processViewBindings.get((0, get_q_name_1.getTokenQualifiedName)(nd)) ?? null;
|
|
837
950
|
}
|
|
951
|
+
if (nd.concept === 'ProcessV2') {
|
|
952
|
+
env.processAssocBind = nd.bind;
|
|
953
|
+
}
|
|
838
954
|
const refAndQNames = this.collectRefs(env, nd);
|
|
839
955
|
const localVars = env.localVars.get(nd) ?? [];
|
|
840
956
|
for (const [ref, qName] of refAndQNames) {
|
|
@@ -846,6 +962,7 @@ class ReferenceManager {
|
|
|
846
962
|
this.modeForCollect = null;
|
|
847
963
|
this.curFileNode = undefined;
|
|
848
964
|
env.viewAssocProcess = null;
|
|
965
|
+
env.processAssocBind = null;
|
|
849
966
|
};
|
|
850
967
|
this.removeLocalSymbol = (nd) => {
|
|
851
968
|
const qName = (0, get_q_name_1.getTokenQualifiedName)(nd);
|
|
@@ -1053,6 +1170,24 @@ class ReferenceManager {
|
|
|
1053
1170
|
}
|
|
1054
1171
|
return res;
|
|
1055
1172
|
};
|
|
1173
|
+
this.splitFieldPermissionV2 = (env, nd) => {
|
|
1174
|
+
const res = [];
|
|
1175
|
+
const bind = env.processAssocBind;
|
|
1176
|
+
if (!bind) {
|
|
1177
|
+
return res;
|
|
1178
|
+
}
|
|
1179
|
+
const entityRef = bind.typeAnnotation.properties.find(p => p.name === nd.propertyName);
|
|
1180
|
+
if (!entityRef) {
|
|
1181
|
+
return res;
|
|
1182
|
+
}
|
|
1183
|
+
const entityQName = nd.propertyName === 'data'
|
|
1184
|
+
? (0, get_q_name_1.getTokenQualifiedName)(entityRef.typeAnnotation) // data 是 Entity
|
|
1185
|
+
: (0, get_q_name_1.getTokenQualifiedName)(entityRef.typeAnnotation.typeArguments[0]); // relation_data 是 List<Entity>
|
|
1186
|
+
for (const sub of nd.subFieldPermissions) {
|
|
1187
|
+
res.push([sub, (0, get_q_name_1.getPropQName)(entityQName, sub.propertyName, 'Entity')]);
|
|
1188
|
+
}
|
|
1189
|
+
return res;
|
|
1190
|
+
};
|
|
1056
1191
|
/**
|
|
1057
1192
|
* 获取 Reference Manager 的内存统计信息
|
|
1058
1193
|
*/
|
|
@@ -1177,37 +1312,6 @@ class ReferenceManager {
|
|
|
1177
1312
|
}
|
|
1178
1313
|
}
|
|
1179
1314
|
exports.ReferenceManager = ReferenceManager;
|
|
1180
|
-
const buildBuiltinTypeQNameDefs = (qNameDefs) => {
|
|
1181
|
-
const createNaslPrimTyDef = (name) => nasl_concepts_1.Structure.createProtoTypeOnly({ name, properties: [] });
|
|
1182
|
-
['Boolean', 'String', 'Long', 'Decimal', 'Date', 'DateTime', 'Time', 'Binary', 'Null', 'any', 'void'].forEach(str => {
|
|
1183
|
-
const def = createNaslPrimTyDef(str);
|
|
1184
|
-
if (def.name === 'String') {
|
|
1185
|
-
def.properties.push(nasl_concepts_1.StructureProperty.createProtoTypeOnly({
|
|
1186
|
-
name: 'length',
|
|
1187
|
-
typeAnnotation: typer_1.naslLongTy
|
|
1188
|
-
}));
|
|
1189
|
-
}
|
|
1190
|
-
// type namespace is nasl.core
|
|
1191
|
-
qNameDefs.set(`nasl.core.${str}`, def);
|
|
1192
|
-
});
|
|
1193
|
-
const createNaslGenericTyDef = (name) => nasl_concepts_1.Structure.createProtoTypeOnly({
|
|
1194
|
-
name,
|
|
1195
|
-
properties: [nasl_concepts_1.StructureProperty.createProtoTypeOnly({ name: 'length', typeAnnotation: typer_1.naslLongTy })],
|
|
1196
|
-
});
|
|
1197
|
-
['Map', 'List'].forEach(str => {
|
|
1198
|
-
const def = createNaslGenericTyDef(str);
|
|
1199
|
-
if (str === 'List') {
|
|
1200
|
-
def.typeParams = [(0, typer_1.createTyParam)('T')];
|
|
1201
|
-
}
|
|
1202
|
-
else if (str === 'Map') {
|
|
1203
|
-
def.typeParams = [(0, typer_1.createTyParam)('K'), (0, typer_1.createTyParam)('V')];
|
|
1204
|
-
}
|
|
1205
|
-
// type namespace is nasl.collection
|
|
1206
|
-
qNameDefs.set(`nasl.collection.${str}`, def);
|
|
1207
|
-
});
|
|
1208
|
-
// Current<T>
|
|
1209
|
-
(0, builtin_q_name_1.collectAllNaslNameSpace)(qNameDefs);
|
|
1210
|
-
};
|
|
1211
1315
|
// prependStr moved to get-q-name.ts
|
|
1212
1316
|
// getTokenQualifiedName moved to get-q-name.ts
|
|
1213
1317
|
// getTokenQualifiedNameForMatchedExpr moved to get-q-name.ts
|
|
@@ -1401,8 +1505,14 @@ const cheapTestLocalSymbol = (qName) => {
|
|
|
1401
1505
|
if (qName.startsWith('a+') || qName.startsWith('Tp+') ||
|
|
1402
1506
|
qName.startsWith('nasl.core') || qName.startsWith('elements.') ||
|
|
1403
1507
|
qName.startsWith('nasl.util') ||
|
|
1404
|
-
qName.startsWith('nasl.collection')
|
|
1405
|
-
|
|
1508
|
+
qName.startsWith('nasl.collection')) {
|
|
1509
|
+
return true;
|
|
1510
|
+
}
|
|
1511
|
+
// 页面下引用的 Process 的 qName
|
|
1512
|
+
// if (qName.startsWith('Process_')) {
|
|
1513
|
+
// return false;
|
|
1514
|
+
// }
|
|
1515
|
+
if (qName.indexOf('.') === -1) {
|
|
1406
1516
|
return true;
|
|
1407
1517
|
}
|
|
1408
1518
|
return false;
|