@abaplint/cli 2.85.4 → 2.85.8
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/build/cli.js +7 -7
- package/package.json +3 -3
package/build/cli.js
CHANGED
|
@@ -1523,7 +1523,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
1523
1523
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1524
1524
|
|
|
1525
1525
|
"use strict";
|
|
1526
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MethodSource = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst tokens_1 = __webpack_require__(/*! ../../1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nconst _1 = __webpack_require__(/*! . */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nclass MethodSource extends combi_1.Expression {\r\n getRunnable() {\r\n const mname = (0, combi_1.alt)(_1.MethodName, _1.Dynamic);\r\n const cname = (0, combi_1.alt)(_1.FieldChain, _1.MethodCallChain, _1.Dynamic);\r\n const stati = (0, combi_1.seq)(_1.ClassName, (0, combi_1.tok)(tokens_1.StaticArrow));\r\n const part1 = (0, combi_1.seq)(cname, (0, combi_1.alt)((0, combi_1.tok)(tokens_1.InstanceArrow), (0, combi_1.tok)(tokens_1.StaticArrow)));\r\n return (0, combi_1.
|
|
1526
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MethodSource = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst tokens_1 = __webpack_require__(/*! ../../1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nconst _1 = __webpack_require__(/*! . */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nclass MethodSource extends combi_1.Expression {\r\n getRunnable() {\r\n const mname = (0, combi_1.alt)(_1.MethodName, _1.Dynamic);\r\n const cname = (0, combi_1.alt)(_1.FieldChain, _1.MethodCallChain, _1.Dynamic);\r\n // this is a bit tricky, this part is required as FieldChain takes a AttributeName\r\n const stati = (0, combi_1.seq)(_1.ClassName, (0, combi_1.tok)(tokens_1.StaticArrow), mname);\r\n const part1 = (0, combi_1.seq)(cname, (0, combi_1.alt)((0, combi_1.tok)(tokens_1.InstanceArrow), (0, combi_1.tok)(tokens_1.StaticArrow)));\r\n return (0, combi_1.alt)(stati, (0, combi_1.seq)((0, combi_1.starPrio)(part1), mname));\r\n }\r\n}\r\nexports.MethodSource = MethodSource;\r\n//# sourceMappingURL=method_source.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/method_source.js?");
|
|
1527
1527
|
|
|
1528
1528
|
/***/ }),
|
|
1529
1529
|
|
|
@@ -2568,7 +2568,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
2568
2568
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2569
2569
|
|
|
2570
2570
|
"use strict";
|
|
2571
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Assign = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst tokens_1 = __webpack_require__(/*! ../../1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nclass Assign {\r\n getMatcher() {\r\n const component = (0, combi_1.seq)(\"COMPONENT\", expressions_1.Source, \"OF STRUCTURE\", expressions_1.Source);\r\n const tableField = (0, combi_1.seq)(\"TABLE FIELD\", (0, combi_1.alt)(expressions_1.Source, expressions_1.Dynamic));\r\n const arrow = (0, combi_1.alt)((0, combi_1.tok)(tokens_1.InstanceArrow), (0, combi_1.tok)(tokens_1.StaticArrow));\r\n const source = (0, combi_1.alt)((0, combi_1.seq)(expressions_1.Source, (0, combi_1.opt)((0, combi_1.seq)(arrow, expressions_1.Dynamic))), component, tableField, (0, combi_1.seq)(expressions_1.Dynamic, (0, combi_1.opt)((0, combi_1.seq)(arrow, (0, combi_1.alt)(expressions_1.Field, expressions_1.Dynamic)))));\r\n const type = (0, combi_1.seq)(\"TYPE\", (0, combi_1.alt)(expressions_1.Dynamic, expressions_1.
|
|
2571
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Assign = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst tokens_1 = __webpack_require__(/*! ../../1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nclass Assign {\r\n getMatcher() {\r\n const component = (0, combi_1.seq)(\"COMPONENT\", expressions_1.Source, \"OF STRUCTURE\", expressions_1.Source);\r\n const tableField = (0, combi_1.seq)(\"TABLE FIELD\", (0, combi_1.alt)(expressions_1.Source, expressions_1.Dynamic));\r\n const arrow = (0, combi_1.alt)((0, combi_1.tok)(tokens_1.InstanceArrow), (0, combi_1.tok)(tokens_1.StaticArrow));\r\n const source = (0, combi_1.alt)((0, combi_1.seq)(expressions_1.Source, (0, combi_1.opt)((0, combi_1.seq)(arrow, expressions_1.Dynamic))), component, tableField, (0, combi_1.seq)(expressions_1.Dynamic, (0, combi_1.opt)((0, combi_1.seq)(arrow, (0, combi_1.alt)(expressions_1.Field, expressions_1.Dynamic)))));\r\n const type = (0, combi_1.seq)(\"TYPE\", (0, combi_1.alt)(expressions_1.Dynamic, expressions_1.TypeName));\r\n const like = (0, combi_1.seq)(\"LIKE\", (0, combi_1.alt)(expressions_1.Dynamic, expressions_1.Source));\r\n const handle = (0, combi_1.seq)(\"TYPE HANDLE\", expressions_1.Source);\r\n const range = (0, combi_1.seq)(\"RANGE\", expressions_1.Source);\r\n const decimals = (0, combi_1.seq)(\"DECIMALS\", expressions_1.Source);\r\n const casting = (0, combi_1.seq)(\"CASTING\", (0, combi_1.opt)((0, combi_1.alt)(like, handle, (0, combi_1.per)(type, decimals))));\r\n const obsoleteType = (0, combi_1.seq)(\"TYPE\", expressions_1.Source, (0, combi_1.optPrio)(decimals));\r\n const ret = (0, combi_1.seq)(\"ASSIGN\", (0, combi_1.opt)((0, combi_1.seq)(expressions_1.Target, \"INCREMENT\")), source, \"TO\", expressions_1.FSTarget, (0, combi_1.opt)((0, combi_1.altPrio)(casting, obsoleteType)), (0, combi_1.opt)(range));\r\n return ret;\r\n }\r\n}\r\nexports.Assign = Assign;\r\n//# sourceMappingURL=assign.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/2_statements/statements/assign.js?");
|
|
2572
2572
|
|
|
2573
2573
|
/***/ }),
|
|
2574
2574
|
|
|
@@ -4427,7 +4427,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
4427
4427
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
4428
4428
|
|
|
4429
4429
|
"use strict";
|
|
4430
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ModifyInternal = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nclass ModifyInternal {\r\n getMatcher() {\r\n const index = (0, combi_1.seq)(\"INDEX\", expressions_1.Source);\r\n const from = (0, combi_1.seq)(\"FROM\", expressions_1.Source);\r\n const transporting = (0, combi_1.seq)(\"TRANSPORTING\", (0, combi_1.plus)((0, combi_1.alt)(expressions_1.
|
|
4430
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ModifyInternal = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nclass ModifyInternal {\r\n getMatcher() {\r\n const index = (0, combi_1.seq)(\"INDEX\", expressions_1.Source);\r\n const from = (0, combi_1.seq)(\"FROM\", expressions_1.Source);\r\n const transporting = (0, combi_1.seq)(\"TRANSPORTING\", (0, combi_1.plus)((0, combi_1.alt)(expressions_1.ComponentChainSimple, expressions_1.Dynamic)));\r\n const where = (0, combi_1.seq)(\"WHERE\", expressions_1.ComponentCond);\r\n const assigning = (0, combi_1.seq)(\"ASSIGNING\", expressions_1.FSTarget);\r\n const using = (0, combi_1.seq)(\"USING KEY\", expressions_1.SimpleName);\r\n const additions = (0, combi_1.per)(where, assigning, using);\r\n const target = (0, combi_1.alt)(expressions_1.Target, expressions_1.Dynamic);\r\n const options = (0, combi_1.alt)((0, combi_1.per)(index, transporting), (0, combi_1.seq)(from, (0, combi_1.opt)((0, combi_1.per)(index, transporting))), (0, combi_1.seq)((0, combi_1.per)(index, transporting), from, (0, combi_1.opt)((0, combi_1.per)(index, transporting))));\r\n const long = (0, combi_1.seq)(\"MODIFY\", (0, combi_1.opt)(\"TABLE\"), target, (0, combi_1.opt)(options), (0, combi_1.opt)(additions));\r\n const simple = (0, combi_1.seq)(\"MODIFY TABLE\", target, from, (0, combi_1.opt)(using));\r\n return (0, combi_1.alt)(long, simple);\r\n }\r\n}\r\nexports.ModifyInternal = ModifyInternal;\r\n//# sourceMappingURL=modify_internal.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/2_statements/statements/modify_internal.js?");
|
|
4431
4431
|
|
|
4432
4432
|
/***/ }),
|
|
4433
4433
|
|
|
@@ -6407,7 +6407,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
6407
6407
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
6408
6408
|
|
|
6409
6409
|
"use strict";
|
|
6410
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ObjectOriented = void 0;\r\nconst Statements = __webpack_require__(/*! ../2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst visibility_1 = __webpack_require__(/*! ../4_file_information/visibility */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js\");\r\n// todo, think some of the public methods can be made private\r\nclass ObjectOriented {\r\n constructor(scope) {\r\n this.scope = scope;\r\n }\r\n fromInterfaceByName(name, ignore) {\r\n const idef = this.scope.findInterfaceDefinition(name);\r\n if (idef === undefined || ignore.includes(name.toUpperCase())) {\r\n return [];\r\n }\r\n const ret = [name.toUpperCase()];\r\n for (const t of idef.getTypeDefinitions().getAll()) {\r\n const n = name + \"~\" + t.type.getName();\r\n this.scope.addTypeNamed(n, t.type);\r\n }\r\n this.scope.addListPrefix(idef.getAttributes().getConstants(), name + \"~\");\r\n this.scope.addListPrefix(idef.getAttributes().getStatic(), name + \"~\");\r\n this.scope.addListPrefix(idef.getAttributes().getInstance(), name + \"~\");\r\n for (const i of idef.getImplementing()) {\r\n if (ignore.includes(i.name.toUpperCase())) {\r\n continue;\r\n }\r\n ret.push(...this.fromInterfaceByName(i.name, ignore));\r\n ignore.push(i.name.toUpperCase());\r\n ret.push(i.name.toUpperCase());\r\n }\r\n return ret;\r\n }\r\n addAliasedAttributes(classDefinition) {\r\n for (const alias of classDefinition.getAliases().getAll()) {\r\n const comp = alias.getComponent();\r\n const idef = this.scope.findInterfaceDefinition(comp.split(\"~\")[0]);\r\n if (idef) {\r\n const found = idef.getAttributes().findByName(comp.split(\"~\")[1]);\r\n if (found) {\r\n this.scope.addNamedIdentifier(alias.getName(), found);\r\n }\r\n }\r\n }\r\n }\r\n addAliasedTypes(aliases) {\r\n for (const alias of aliases.getAll()) {\r\n const comp = alias.getComponent();\r\n const idef = this.scope.findInterfaceDefinition(comp.split(\"~\")[0]);\r\n if (idef) {\r\n const found = idef.getTypeDefinitions().getByName(comp.split(\"~\")[1]);\r\n if (found) {\r\n this.scope.addTypeNamed(alias.getName(), found);\r\n }\r\n }\r\n }\r\n }\r\n findMethodInInterface(interfaceName, methodName) {\r\n const idef = this.scope.findInterfaceDefinition(interfaceName);\r\n if (idef) {\r\n const methods = idef.getMethodDefinitions().getAll();\r\n for (const method of methods) {\r\n if (method.getName().toUpperCase() === methodName.toUpperCase()) {\r\n return { method, def: idef };\r\n }\r\n }\r\n return this.findMethodViaAlias(methodName, idef);\r\n }\r\n return undefined;\r\n }\r\n findMethodViaAlias(methodName, def) {\r\n for (const a of def.getAliases().getAll()) {\r\n if (a.getName().toUpperCase() === methodName.toUpperCase()) {\r\n const comp = a.getComponent();\r\n const res = this.findMethodInInterface(comp.split(\"~\")[0], comp.split(\"~\")[1]);\r\n if (res) {\r\n return res;\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n findClassName(node) {\r\n if (!(node.get() instanceof Statements.ClassImplementation\r\n || node.get() instanceof Statements.ClassDefinition)) {\r\n throw new Error(\"findClassName, unexpected node type\");\r\n }\r\n const className = node.findFirstExpression(Expressions.ClassName);\r\n if (className === undefined) {\r\n throw new Error(\"findClassName, unexpected node type\");\r\n }\r\n return className.getFirstToken().getStr();\r\n }\r\n findInterfaces(cd) {\r\n var _a;\r\n const ret = [...cd.getImplementing()];\r\n for (const r of ret) {\r\n const nested = (_a = this.scope.findInterfaceDefinition(r.name)) === null || _a === void 0 ? void 0 : _a.getImplementing();\r\n if (nested) {\r\n ret.push(...nested);\r\n }\r\n }\r\n const sup = cd.getSuperClass();\r\n if (sup) {\r\n try {\r\n ret.push(...this.findInterfaces(this.findSuperDefinition(sup)));\r\n }\r\n catch (_b) {\r\n // ignore errors, they will show up as variable not found anyhow\r\n }\r\n }\r\n return ret;\r\n }\r\n searchEvent(def, name) {\r\n var _a;\r\n if (def === undefined || name === undefined) {\r\n return undefined;\r\n }\r\n const found = def.getEvents().find(e => e.getName().toUpperCase() === (name === null || name === void 0 ? void 0 : name.toUpperCase()));\r\n if (found) {\r\n return found;\r\n }\r\n for (const a of ((_a = def.getAliases()) === null || _a === void 0 ? void 0 : _a.getAll()) || []) {\r\n if (a.getName().toUpperCase() === name.toUpperCase()) {\r\n const comp = a.getComponent();\r\n const res = this.searchEvent(this.scope.findObjectDefinition(comp.split(\"~\")[0]), comp.split(\"~\")[1]);\r\n if (res) {\r\n return res;\r\n }\r\n }\r\n }\r\n const sup = def.getSuperClass();\r\n if (sup) {\r\n return this.searchEvent(this.findSuperDefinition(sup), name);\r\n }\r\n return undefined;\r\n }\r\n // search in via super class, interfaces and aliases\r\n searchAttributeName(def, name) {\r\n var _a;\r\n if (def === undefined || name === undefined) {\r\n return undefined;\r\n }\r\n const upper = name.toUpperCase();\r\n for (const a of def.getAttributes().getAll()) {\r\n if (a.getName().toUpperCase() === upper) {\r\n return a;\r\n }\r\n }\r\n for (const a of ((_a = def.getAliases()) === null || _a === void 0 ? void 0 : _a.getAll()) || []) {\r\n if (a.getName().toUpperCase() === upper) {\r\n const comp = a.getComponent();\r\n const res = this.searchAttributeName(this.scope.findObjectDefinition(comp.split(\"~\")[0]), comp.split(\"~\")[1]);\r\n if (res) {\r\n return res;\r\n }\r\n }\r\n }\r\n if (name.includes(\"~\")) {\r\n const interfaceName = upper.split(\"~\")[0];\r\n if (def.getImplementing().some((a) => a.name.toUpperCase() === interfaceName)) {\r\n return this.searchAttributeName(this.scope.findInterfaceDefinition(interfaceName), name.split(\"~\")[1]);\r\n }\r\n }\r\n const sup = def.getSuperClass();\r\n if (sup) {\r\n return this.searchAttributeName(this.findSuperDefinition(sup), name);\r\n }\r\n return undefined;\r\n }\r\n // search in via super class, interfaces and aliases\r\n searchTypeName(def, name) {\r\n if (def === undefined || name === undefined) {\r\n return undefined;\r\n }\r\n const search = def.getTypeDefinitions().getByName(name);\r\n if (search) {\r\n return search;\r\n }\r\n if (name.includes(\"~\")) {\r\n const interfaceName = name.split(\"~\")[0];\r\n if (def.getImplementing().some((a) => a.name.toUpperCase() === interfaceName.toUpperCase())) {\r\n return this.searchTypeName(this.scope.findInterfaceDefinition(interfaceName), name.split(\"~\")[1]);\r\n }\r\n }\r\n const sup = def.getSuperClass();\r\n if (sup) {\r\n return this.searchTypeName(this.findSuperDefinition(sup), name);\r\n }\r\n return undefined;\r\n }\r\n // search in via super class, interfaces and aliases\r\n searchConstantName(def, name) {\r\n if (def === undefined || name === undefined) {\r\n return undefined;\r\n }\r\n const upper = name.toUpperCase();\r\n for (const a of def.getAttributes().getConstants()) {\r\n if (a.getName().toUpperCase() === upper) {\r\n return a;\r\n }\r\n }\r\n for (const a of def.getAliases().getAll()) {\r\n if (a.getName().toUpperCase() === upper) {\r\n const comp = a.getComponent();\r\n const res = this.searchConstantName(this.scope.findObjectDefinition(comp.split(\"~\")[0]), comp.split(\"~\")[1]);\r\n if (res) {\r\n return res;\r\n }\r\n }\r\n }\r\n if (name.includes(\"~\")) {\r\n const interfaceName = upper.split(\"~\")[0];\r\n if (def.getImplementing().some((a) => a.name.toUpperCase() === interfaceName)) {\r\n return this.searchConstantName(this.scope.findInterfaceDefinition(interfaceName), name.split(\"~\")[1]);\r\n }\r\n }\r\n const sup = def.getSuperClass();\r\n if (sup) {\r\n return this.searchConstantName(this.findSuperDefinition(sup), name);\r\n }\r\n return undefined;\r\n }\r\n // search in via super class, interfaces and aliases\r\n searchMethodName(def, name) {\r\n if (def === undefined || name === undefined) {\r\n return { method: undefined, def: undefined };\r\n }\r\n const methodDefinition = this.findMethod(def, name);\r\n if (methodDefinition) {\r\n return { method: methodDefinition, def };\r\n }\r\n let interfaceName = undefined;\r\n if (name.includes(\"~\")) {\r\n interfaceName = name.split(\"~\")[0];\r\n if (interfaceName && this.findInterfaces(def).some(i => i.name.toUpperCase() === (interfaceName === null || interfaceName === void 0 ? void 0 : interfaceName.toUpperCase())) === false) {\r\n return { method: undefined, def: undefined };\r\n }\r\n }\r\n // todo, this is not completely correct? hmm, why? visibility?\r\n if (methodDefinition === undefined && interfaceName) {\r\n name = name.split(\"~\")[1];\r\n const found = this.findMethodInInterface(interfaceName, name);\r\n if (found) {\r\n return found;\r\n }\r\n }\r\n else if (methodDefinition === undefined) {\r\n const found = this.findMethodViaAlias(name, def);\r\n if (found) {\r\n return found;\r\n }\r\n }\r\n const sup = def.getSuperClass();\r\n if (methodDefinition === undefined && sup) {\r\n return this.searchMethodName(this.findSuperDefinition(sup), name);\r\n }\r\n return { method: undefined, def: undefined };\r\n }\r\n findMethod(def, methodName) {\r\n for (const method of def.getMethodDefinitions().getAll()) {\r\n if (method.getName().toUpperCase() === methodName.toUpperCase()) {\r\n if (method.isRedefinition()) {\r\n return this.findMethodInSuper(def, methodName);\r\n }\r\n else {\r\n return method;\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n findMethodInSuper(child, methodName) {\r\n let sup = child.getSuperClass();\r\n while (sup !== undefined) {\r\n const cdef = this.findSuperDefinition(sup);\r\n const found = this.findMethod(cdef, methodName);\r\n if (found) {\r\n return found;\r\n }\r\n sup = cdef.getSuperClass();\r\n }\r\n return undefined;\r\n }\r\n findSuperDefinition(name) {\r\n const csup = this.scope.findClassDefinition(name);\r\n if (csup === undefined) {\r\n throw new Error(\"Super class \\\"\" + name + \"\\\" not found or contains errors\");\r\n }\r\n return csup;\r\n }\r\n fromSuperClassesAndInterfaces(child) {\r\n const implemented = this.fromSuperClasses(child);\r\n this.fromInterfaces(child, implemented);\r\n }\r\n // returns list of interfaces implemented\r\n fromSuperClasses(child) {\r\n let sup = child.getSuperClass();\r\n const ignore = [];\r\n while (sup !== undefined) {\r\n const cdef = this.findSuperDefinition(sup);\r\n for (const a of cdef.getAttributes().getAll()) {\r\n if (a.getVisibility() !== visibility_1.Visibility.Private) {\r\n this.scope.addIdentifier(a);\r\n // todo, handle scope and instance vs static\r\n }\r\n }\r\n for (const c of cdef.getAttributes().getConstants()) {\r\n if (c.getVisibility() !== visibility_1.Visibility.Private) {\r\n this.scope.addIdentifier(c);\r\n }\r\n }\r\n for (const t of cdef.getTypeDefinitions().getAll()) {\r\n if (t.visibility !== visibility_1.Visibility.Private) {\r\n this.scope.addType(t.type);\r\n }\r\n }\r\n ignore.push(...this.fromInterfaces(cdef, ignore));\r\n sup = cdef.getSuperClass();\r\n }\r\n return ignore;\r\n }\r\n // returns list of interfaces implemented\r\n fromInterfaces(classDefinition, skip) {\r\n const ignore = [];\r\n for (const i of classDefinition.getImplementing()) {\r\n ignore.push(...this.fromInterfaceByName(i.name, ignore.concat(skip || [])));\r\n }\r\n return ignore;\r\n }\r\n}\r\nexports.ObjectOriented = ObjectOriented;\r\n//# sourceMappingURL=_object_oriented.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js?");
|
|
6410
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ObjectOriented = void 0;\r\nconst Statements = __webpack_require__(/*! ../2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst visibility_1 = __webpack_require__(/*! ../4_file_information/visibility */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js\");\r\n// todo, think some of the public methods can be made private\r\nclass ObjectOriented {\r\n constructor(scope) {\r\n this.scope = scope;\r\n }\r\n fromInterfaceByName(name, ignore) {\r\n const idef = this.scope.findInterfaceDefinition(name);\r\n if (idef === undefined || ignore.includes(name.toUpperCase())) {\r\n return [];\r\n }\r\n const ret = [name.toUpperCase()];\r\n for (const t of idef.getTypeDefinitions().getAll()) {\r\n const n = name + \"~\" + t.type.getName();\r\n this.scope.addTypeNamed(n, t.type);\r\n }\r\n this.scope.addListPrefix(idef.getAttributes().getConstants(), name + \"~\");\r\n this.scope.addListPrefix(idef.getAttributes().getStatic(), name + \"~\");\r\n this.scope.addListPrefix(idef.getAttributes().getInstance(), name + \"~\");\r\n for (const i of idef.getImplementing()) {\r\n if (ignore.includes(i.name.toUpperCase())) {\r\n continue;\r\n }\r\n ret.push(...this.fromInterfaceByName(i.name, ignore));\r\n ignore.push(i.name.toUpperCase());\r\n ret.push(i.name.toUpperCase());\r\n }\r\n return ret;\r\n }\r\n addAliasedAttributes(classDefinition) {\r\n for (const alias of classDefinition.getAliases().getAll()) {\r\n const comp = alias.getComponent();\r\n const idef = this.scope.findInterfaceDefinition(comp.split(\"~\")[0]);\r\n if (idef) {\r\n const found = idef.getAttributes().findByName(comp.split(\"~\")[1]);\r\n if (found) {\r\n this.scope.addNamedIdentifier(alias.getName(), found);\r\n }\r\n }\r\n }\r\n const superName = classDefinition.getSuperClass();\r\n if (superName !== undefined) {\r\n const def = this.scope.findClassDefinition(superName);\r\n if (def) {\r\n this.addAliasedAttributes(def);\r\n }\r\n }\r\n }\r\n addAliasedTypes(aliases) {\r\n for (const alias of aliases.getAll()) {\r\n const comp = alias.getComponent();\r\n const idef = this.scope.findInterfaceDefinition(comp.split(\"~\")[0]);\r\n if (idef) {\r\n const found = idef.getTypeDefinitions().getByName(comp.split(\"~\")[1]);\r\n if (found) {\r\n this.scope.addTypeNamed(alias.getName(), found);\r\n }\r\n }\r\n }\r\n }\r\n findMethodInInterface(interfaceName, methodName) {\r\n const idef = this.scope.findInterfaceDefinition(interfaceName);\r\n if (idef) {\r\n const methods = idef.getMethodDefinitions().getAll();\r\n for (const method of methods) {\r\n if (method.getName().toUpperCase() === methodName.toUpperCase()) {\r\n return { method, def: idef };\r\n }\r\n }\r\n return this.findMethodViaAlias(methodName, idef);\r\n }\r\n return undefined;\r\n }\r\n findMethodViaAlias(methodName, def) {\r\n for (const a of def.getAliases().getAll()) {\r\n if (a.getName().toUpperCase() === methodName.toUpperCase()) {\r\n const comp = a.getComponent();\r\n const res = this.findMethodInInterface(comp.split(\"~\")[0], comp.split(\"~\")[1]);\r\n if (res) {\r\n return res;\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n findClassName(node) {\r\n if (!(node.get() instanceof Statements.ClassImplementation\r\n || node.get() instanceof Statements.ClassDefinition)) {\r\n throw new Error(\"findClassName, unexpected node type\");\r\n }\r\n const className = node.findFirstExpression(Expressions.ClassName);\r\n if (className === undefined) {\r\n throw new Error(\"findClassName, unexpected node type\");\r\n }\r\n return className.getFirstToken().getStr();\r\n }\r\n findInterfaces(cd) {\r\n var _a;\r\n const ret = [...cd.getImplementing()];\r\n for (const r of ret) {\r\n const nested = (_a = this.scope.findInterfaceDefinition(r.name)) === null || _a === void 0 ? void 0 : _a.getImplementing();\r\n if (nested) {\r\n ret.push(...nested);\r\n }\r\n }\r\n const sup = cd.getSuperClass();\r\n if (sup) {\r\n try {\r\n ret.push(...this.findInterfaces(this.findSuperDefinition(sup)));\r\n }\r\n catch (_b) {\r\n // ignore errors, they will show up as variable not found anyhow\r\n }\r\n }\r\n return ret;\r\n }\r\n searchEvent(def, name) {\r\n var _a;\r\n if (def === undefined || name === undefined) {\r\n return undefined;\r\n }\r\n const found = def.getEvents().find(e => e.getName().toUpperCase() === (name === null || name === void 0 ? void 0 : name.toUpperCase()));\r\n if (found) {\r\n return found;\r\n }\r\n for (const a of ((_a = def.getAliases()) === null || _a === void 0 ? void 0 : _a.getAll()) || []) {\r\n if (a.getName().toUpperCase() === name.toUpperCase()) {\r\n const comp = a.getComponent();\r\n const res = this.searchEvent(this.scope.findObjectDefinition(comp.split(\"~\")[0]), comp.split(\"~\")[1]);\r\n if (res) {\r\n return res;\r\n }\r\n }\r\n }\r\n const sup = def.getSuperClass();\r\n if (sup) {\r\n return this.searchEvent(this.findSuperDefinition(sup), name);\r\n }\r\n return undefined;\r\n }\r\n // search in via super class, interfaces and aliases\r\n searchAttributeName(def, name) {\r\n var _a;\r\n if (def === undefined || name === undefined) {\r\n return undefined;\r\n }\r\n const upper = name.toUpperCase();\r\n for (const a of def.getAttributes().getAll()) {\r\n if (a.getName().toUpperCase() === upper) {\r\n return a;\r\n }\r\n }\r\n for (const a of ((_a = def.getAliases()) === null || _a === void 0 ? void 0 : _a.getAll()) || []) {\r\n if (a.getName().toUpperCase() === upper) {\r\n const comp = a.getComponent();\r\n const res = this.searchAttributeName(this.scope.findObjectDefinition(comp.split(\"~\")[0]), comp.split(\"~\")[1]);\r\n if (res) {\r\n return res;\r\n }\r\n }\r\n }\r\n if (name.includes(\"~\")) {\r\n const interfaceName = upper.split(\"~\")[0];\r\n if (def.getImplementing().some((a) => a.name.toUpperCase() === interfaceName)) {\r\n return this.searchAttributeName(this.scope.findInterfaceDefinition(interfaceName), name.split(\"~\")[1]);\r\n }\r\n }\r\n const sup = def.getSuperClass();\r\n if (sup) {\r\n return this.searchAttributeName(this.findSuperDefinition(sup), name);\r\n }\r\n return undefined;\r\n }\r\n // search in via super class, interfaces and aliases\r\n searchTypeName(def, name) {\r\n if (def === undefined || name === undefined) {\r\n return undefined;\r\n }\r\n const search = def.getTypeDefinitions().getByName(name);\r\n if (search) {\r\n return search;\r\n }\r\n if (name.includes(\"~\")) {\r\n const interfaceName = name.split(\"~\")[0];\r\n if (def.getImplementing().some((a) => a.name.toUpperCase() === interfaceName.toUpperCase())) {\r\n return this.searchTypeName(this.scope.findInterfaceDefinition(interfaceName), name.split(\"~\")[1]);\r\n }\r\n }\r\n const sup = def.getSuperClass();\r\n if (sup) {\r\n return this.searchTypeName(this.findSuperDefinition(sup), name);\r\n }\r\n return undefined;\r\n }\r\n // search in via super class, interfaces and aliases\r\n searchConstantName(def, name) {\r\n if (def === undefined || name === undefined) {\r\n return undefined;\r\n }\r\n const upper = name.toUpperCase();\r\n for (const a of def.getAttributes().getConstants()) {\r\n if (a.getName().toUpperCase() === upper) {\r\n return a;\r\n }\r\n }\r\n for (const a of def.getAliases().getAll()) {\r\n if (a.getName().toUpperCase() === upper) {\r\n const comp = a.getComponent();\r\n const res = this.searchConstantName(this.scope.findObjectDefinition(comp.split(\"~\")[0]), comp.split(\"~\")[1]);\r\n if (res) {\r\n return res;\r\n }\r\n }\r\n }\r\n if (name.includes(\"~\")) {\r\n const interfaceName = upper.split(\"~\")[0];\r\n if (def.getImplementing().some((a) => a.name.toUpperCase() === interfaceName)) {\r\n return this.searchConstantName(this.scope.findInterfaceDefinition(interfaceName), name.split(\"~\")[1]);\r\n }\r\n }\r\n const sup = def.getSuperClass();\r\n if (sup) {\r\n return this.searchConstantName(this.findSuperDefinition(sup), name);\r\n }\r\n return undefined;\r\n }\r\n // search in via super class, interfaces and aliases\r\n searchMethodName(def, name) {\r\n if (def === undefined || name === undefined) {\r\n return { method: undefined, def: undefined };\r\n }\r\n const methodDefinition = this.findMethod(def, name);\r\n if (methodDefinition) {\r\n return { method: methodDefinition, def };\r\n }\r\n let interfaceName = undefined;\r\n if (name.includes(\"~\")) {\r\n interfaceName = name.split(\"~\")[0];\r\n if (interfaceName && this.findInterfaces(def).some(i => i.name.toUpperCase() === (interfaceName === null || interfaceName === void 0 ? void 0 : interfaceName.toUpperCase())) === false) {\r\n return { method: undefined, def: undefined };\r\n }\r\n }\r\n // todo, this is not completely correct? hmm, why? visibility?\r\n if (methodDefinition === undefined && interfaceName) {\r\n name = name.split(\"~\")[1];\r\n const found = this.findMethodInInterface(interfaceName, name);\r\n if (found) {\r\n return found;\r\n }\r\n }\r\n else if (methodDefinition === undefined) {\r\n const found = this.findMethodViaAlias(name, def);\r\n if (found) {\r\n return found;\r\n }\r\n }\r\n const sup = def.getSuperClass();\r\n if (methodDefinition === undefined && sup) {\r\n return this.searchMethodName(this.findSuperDefinition(sup), name);\r\n }\r\n return { method: undefined, def: undefined };\r\n }\r\n findMethod(def, methodName) {\r\n for (const method of def.getMethodDefinitions().getAll()) {\r\n if (method.getName().toUpperCase() === methodName.toUpperCase()) {\r\n if (method.isRedefinition()) {\r\n return this.findMethodInSuper(def, methodName);\r\n }\r\n else {\r\n return method;\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n findMethodInSuper(child, methodName) {\r\n let sup = child.getSuperClass();\r\n while (sup !== undefined) {\r\n const cdef = this.findSuperDefinition(sup);\r\n const found = this.findMethod(cdef, methodName);\r\n if (found) {\r\n return found;\r\n }\r\n sup = cdef.getSuperClass();\r\n }\r\n return undefined;\r\n }\r\n findSuperDefinition(name) {\r\n const csup = this.scope.findClassDefinition(name);\r\n if (csup === undefined) {\r\n throw new Error(\"Super class \\\"\" + name + \"\\\" not found or contains errors\");\r\n }\r\n return csup;\r\n }\r\n fromSuperClassesAndInterfaces(child) {\r\n const implemented = this.fromSuperClasses(child);\r\n this.fromInterfaces(child, implemented);\r\n }\r\n // returns list of interfaces implemented\r\n fromSuperClasses(child) {\r\n let sup = child.getSuperClass();\r\n const ignore = [];\r\n while (sup !== undefined) {\r\n const cdef = this.findSuperDefinition(sup);\r\n for (const a of cdef.getAttributes().getAll()) {\r\n if (a.getVisibility() !== visibility_1.Visibility.Private) {\r\n this.scope.addIdentifier(a);\r\n // todo, handle scope and instance vs static\r\n }\r\n }\r\n for (const c of cdef.getAttributes().getConstants()) {\r\n if (c.getVisibility() !== visibility_1.Visibility.Private) {\r\n this.scope.addIdentifier(c);\r\n }\r\n }\r\n for (const t of cdef.getTypeDefinitions().getAll()) {\r\n if (t.visibility !== visibility_1.Visibility.Private) {\r\n this.scope.addType(t.type);\r\n }\r\n }\r\n ignore.push(...this.fromInterfaces(cdef, ignore));\r\n sup = cdef.getSuperClass();\r\n }\r\n return ignore;\r\n }\r\n // returns list of interfaces implemented\r\n fromInterfaces(classDefinition, skip) {\r\n const ignore = [];\r\n for (const i of classDefinition.getImplementing()) {\r\n ignore.push(...this.fromInterfaceByName(i.name, ignore.concat(skip || [])));\r\n }\r\n return ignore;\r\n }\r\n}\r\nexports.ObjectOriented = ObjectOriented;\r\n//# sourceMappingURL=_object_oriented.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js?");
|
|
6411
6411
|
|
|
6412
6412
|
/***/ }),
|
|
6413
6413
|
|
|
@@ -6451,7 +6451,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
6451
6451
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
6452
6452
|
|
|
6453
6453
|
"use strict";
|
|
6454
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.TypeUtils = void 0;\r\nconst basic_1 = __webpack_require__(/*! ../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nclass TypeUtils {\r\n static isCharLike(type) {\r\n if (type === undefined) {\r\n return false;\r\n }\r\n else if (type instanceof basic_1.StructureType) {\r\n for (const c of type.getComponents()) {\r\n if (this.isCharLike(c.type) === false) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n else if (type instanceof basic_1.StringType\r\n || type instanceof basic_1.VoidType\r\n || type instanceof basic_1.AnyType\r\n || type instanceof basic_1.UnknownType\r\n || type instanceof basic_1.NumericType\r\n || type instanceof basic_1.CSequenceType\r\n || type instanceof basic_1.DateType\r\n || type instanceof basic_1.CLikeType\r\n || type instanceof basic_1.PackedType\r\n || type instanceof basic_1.TimeType\r\n || type instanceof basic_1.CharacterType) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n static isHexLike(type) {\r\n if (type === undefined) {\r\n return false;\r\n }\r\n else if (type instanceof basic_1.StructureType) {\r\n for (const c of type.getComponents()) {\r\n if (this.isHexLike(c.type) === false) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n else if (type instanceof basic_1.XStringType\r\n || type instanceof basic_1.HexType\r\n || type instanceof basic_1.VoidType\r\n || type instanceof basic_1.AnyType\r\n || type instanceof basic_1.UnknownType) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n static isAssignable(source, target) {\r\n /*\r\n
|
|
6454
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.TypeUtils = void 0;\r\nconst basic_1 = __webpack_require__(/*! ../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nclass TypeUtils {\r\n static isCharLike(type) {\r\n if (type === undefined) {\r\n return false;\r\n }\r\n else if (type instanceof basic_1.StructureType) {\r\n for (const c of type.getComponents()) {\r\n if (this.isCharLike(c.type) === false) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n else if (type instanceof basic_1.StringType\r\n || type instanceof basic_1.VoidType\r\n || type instanceof basic_1.AnyType\r\n || type instanceof basic_1.UnknownType\r\n || type instanceof basic_1.NumericType\r\n || type instanceof basic_1.CSequenceType\r\n || type instanceof basic_1.DateType\r\n || type instanceof basic_1.CLikeType\r\n || type instanceof basic_1.PackedType\r\n || type instanceof basic_1.TimeType\r\n || type instanceof basic_1.CharacterType) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n static isHexLike(type) {\r\n if (type === undefined) {\r\n return false;\r\n }\r\n else if (type instanceof basic_1.StructureType) {\r\n for (const c of type.getComponents()) {\r\n if (this.isHexLike(c.type) === false) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n else if (type instanceof basic_1.XStringType\r\n || type instanceof basic_1.HexType\r\n || type instanceof basic_1.VoidType\r\n || type instanceof basic_1.AnyType\r\n || type instanceof basic_1.UnknownType) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n static isAssignable(source, target) {\r\n /*\r\n console.dir(source);\r\n console.dir(target);\r\n */\r\n if (target instanceof basic_1.TableType) {\r\n if (target.isWithHeader()) {\r\n return this.isAssignable(source, target.getRowType());\r\n }\r\n if (source instanceof basic_1.TableType\r\n || source instanceof basic_1.VoidType\r\n || source instanceof basic_1.AnyType\r\n || source instanceof basic_1.UnknownType) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n else if (target instanceof basic_1.ObjectReferenceType || target instanceof basic_1.GenericObjectReferenceType) {\r\n if (source instanceof basic_1.ObjectReferenceType\r\n || source instanceof basic_1.GenericObjectReferenceType\r\n || source instanceof basic_1.VoidType\r\n || source instanceof basic_1.AnyType\r\n || source instanceof basic_1.UnknownType) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n else if (target instanceof basic_1.DataReference) {\r\n if (source instanceof basic_1.DataReference\r\n || source instanceof basic_1.VoidType\r\n || source instanceof basic_1.AnyType\r\n || source instanceof basic_1.UnknownType) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n else if (target instanceof basic_1.StructureType) {\r\n if (source instanceof basic_1.TableType && source.isWithHeader()) {\r\n return this.isAssignable(source.getRowType(), target);\r\n }\r\n else if (source instanceof basic_1.StructureType\r\n || source instanceof basic_1.VoidType\r\n || source instanceof basic_1.AnyType\r\n || source instanceof basic_1.UnknownType) {\r\n return true;\r\n }\r\n else if (this.isCharLike(target)\r\n && (this.isCharLike(source) || source instanceof basic_1.IntegerType)) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n else if (target instanceof basic_1.IntegerType\r\n || target instanceof basic_1.StringType) {\r\n if (source instanceof basic_1.DataReference\r\n || source instanceof basic_1.ObjectReferenceType\r\n || source instanceof basic_1.GenericObjectReferenceType\r\n || source instanceof basic_1.TableType) {\r\n return false;\r\n }\r\n return true;\r\n }\r\n return true;\r\n }\r\n}\r\nexports.TypeUtils = TypeUtils;\r\n//# sourceMappingURL=_type_utils.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js?");
|
|
6455
6455
|
|
|
6456
6456
|
/***/ }),
|
|
6457
6457
|
|
|
@@ -6693,7 +6693,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
6693
6693
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
6694
6694
|
|
|
6695
6695
|
"use strict";
|
|
6696
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FieldChain = void 0;\r\nconst nodes_1 = __webpack_require__(/*! ../../nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst tokens_1 = __webpack_require__(/*! ../../1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nconst basic_1 = __webpack_require__(/*! ../../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst component_name_1 = __webpack_require__(/*! ./component_name */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/component_name.js\");\r\nconst attribute_name_1 = __webpack_require__(/*! ./attribute_name */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/attribute_name.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nconst field_offset_1 = __webpack_require__(/*! ./field_offset */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/field_offset.js\");\r\nconst field_length_1 = __webpack_require__(/*! ./field_length */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/field_length.js\");\r\nconst table_expression_1 = __webpack_require__(/*! ./table_expression */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/table_expression.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst dereference_1 = __webpack_require__(/*! ./dereference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/dereference.js\");\r\nclass FieldChain {\r\n runSyntax(node, scope, filename, refType) {\r\n const concat = node.concatTokens();\r\n if (concat.includes(\"-\")) {\r\n // workaround for names with dashes\r\n const found = scope.findVariable(concat);\r\n if (found) {\r\n if (refType) {\r\n scope.addReference(node.getFirstToken(), found, refType, filename);\r\n }\r\n return found.getType();\r\n }\r\n }\r\n const children = node.getChildren().slice();\r\n let contextName = children[0].concatTokens();\r\n let context = this.findTop(children.shift(), scope, filename, refType);\r\n while (children.length > 0) {\r\n contextName += children[0].concatTokens();\r\n const current = children.shift();\r\n if (current === undefined) {\r\n break;\r\n }\r\n if (current.get() instanceof tokens_1.Dash) {\r\n if (context instanceof basic_1.UnknownType) {\r\n throw new Error(\"Not a structure, type unknown, FieldChain\");\r\n }\r\n else if (!(context instanceof basic_1.StructureType)\r\n && !(context instanceof basic_1.TableType && context.isWithHeader())\r\n && !(context instanceof basic_1.VoidType)) {\r\n if (context instanceof basic_1.TableType && context.isWithHeader() === false) {\r\n if (scope.isAllowHeaderUse(contextName.substring(0, contextName.length - 1))) {\r\n // FOR ALL ENTRIES workaround\r\n context = context.getRowType();\r\n if (!(context instanceof basic_1.StructureType) && !(context instanceof basic_1.VoidType)) {\r\n context = new basic_1.StructureType([{ name: \"TABLE_LINE\", type: context }]);\r\n }\r\n }\r\n else {\r\n throw new Error(\"Table without header, cannot access fields, \" + contextName);\r\n }\r\n }\r\n else {\r\n throw new Error(\"Not a structure, FieldChain\");\r\n }\r\n }\r\n }\r\n else if (current.get() instanceof tokens_1.InstanceArrow) {\r\n if (!(context instanceof basic_1.ObjectReferenceType)\r\n && !(context instanceof basic_1.DataReference)\r\n && !(context instanceof basic_1.VoidType)) {\r\n throw new Error(\"Not a object reference, field chain\");\r\n }\r\n }\r\n else if (current.get() instanceof expressions_1.Dereference) {\r\n context = new dereference_1.Dereference().runSyntax(context);\r\n }\r\n else if (current.get() instanceof Expressions.ComponentName) {\r\n context = new component_name_1.ComponentName().runSyntax(context, current);\r\n }\r\n else if (current instanceof nodes_1.ExpressionNode\r\n && current.get() instanceof Expressions.TableExpression) {\r\n if (!(context instanceof basic_1.TableType) && !(context instanceof basic_1.VoidType)) {\r\n throw new Error(\"Table expression, expected table\");\r\n }\r\n new table_expression_1.TableExpression().runSyntax(current, scope, filename);\r\n if (!(context instanceof basic_1.VoidType)) {\r\n context = context.getRowType();\r\n }\r\n }\r\n else if (current.get() instanceof Expressions.AttributeName) {\r\n context = new attribute_name_1.AttributeName().runSyntax(context, current, scope, filename, refType);\r\n }\r\n else if (current.get() instanceof Expressions.FieldOffset && current instanceof nodes_1.ExpressionNode) {\r\n new field_offset_1.FieldOffset().runSyntax(current, scope, filename);\r\n }\r\n else if (current.get() instanceof Expressions.FieldLength && current instanceof nodes_1.ExpressionNode) {\r\n new field_length_1.FieldLength().runSyntax(current, scope, filename);\r\n }\r\n }\r\n return context;\r\n }\r\n ////////////////\r\n findTop(node, scope, filename, type) {\r\n if (node === undefined) {\r\n return undefined;\r\n }\r\n if (node.get() instanceof Expressions.SourceField\r\n || node.get() instanceof Expressions.SourceFieldSymbol) {\r\n const token = node.getFirstToken();\r\n const name = token.getStr();\r\n const found = scope.findVariable(name);\r\n if (found === undefined) {\r\n throw new Error(\"\\\"\" + name + \"\\\" not found, findTop\");\r\n }\r\n if (type) {\r\n scope.addReference(token, found, type, filename);\r\n }\r\n if (name.includes(\"~\")) {\r\n const idef = scope.findInterfaceDefinition(name.split(\"~\")[0]);\r\n if (idef) {\r\n scope.addReference(token, idef, _reference_1.ReferenceType.ObjectOrientedReference, filename);\r\n }\r\n }\r\n return found.getType();\r\n }\r\n if (node.get() instanceof Expressions.ClassName) {\r\n const classTok = node.getFirstToken();\r\n const classNam = classTok.getStr();\r\n if (classNam.toUpperCase() === \"OBJECT\") {\r\n return new basic_1.GenericObjectReferenceType();\r\n }\r\n const found = scope.existsObject(classNam);\r\n if (found.found === true && found.id) {\r\n scope.addReference(classTok, found.id, found.type, filename);\r\n return new basic_1.ObjectReferenceType(found.id);\r\n }\r\n else if (scope.getDDIC().inErrorNamespace(classNam) === false) {\r\n scope.addReference(classTok, undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, filename, { ooName: classNam.toUpperCase() });\r\n return new basic_1.VoidType(classNam);\r\n }\r\n else {\r\n throw new Error(\"Unknown class \" + classNam);\r\n }\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.FieldChain = FieldChain;\r\n//# sourceMappingURL=field_chain.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/field_chain.js?");
|
|
6696
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FieldChain = void 0;\r\nconst nodes_1 = __webpack_require__(/*! ../../nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst tokens_1 = __webpack_require__(/*! ../../1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nconst basic_1 = __webpack_require__(/*! ../../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst component_name_1 = __webpack_require__(/*! ./component_name */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/component_name.js\");\r\nconst attribute_name_1 = __webpack_require__(/*! ./attribute_name */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/attribute_name.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nconst field_offset_1 = __webpack_require__(/*! ./field_offset */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/field_offset.js\");\r\nconst field_length_1 = __webpack_require__(/*! ./field_length */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/field_length.js\");\r\nconst table_expression_1 = __webpack_require__(/*! ./table_expression */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/table_expression.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst dereference_1 = __webpack_require__(/*! ./dereference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/dereference.js\");\r\nclass FieldChain {\r\n runSyntax(node, scope, filename, refType) {\r\n const concat = node.concatTokens();\r\n if (concat.includes(\"-\")) {\r\n // workaround for names with dashes\r\n const found = scope.findVariable(concat);\r\n if (found) {\r\n if (refType) {\r\n scope.addReference(node.getFirstToken(), found, refType, filename);\r\n }\r\n return found.getType();\r\n }\r\n }\r\n const children = node.getChildren().slice();\r\n let contextName = children[0].concatTokens();\r\n let context = this.findTop(children.shift(), scope, filename, refType);\r\n while (children.length > 0) {\r\n contextName += children[0].concatTokens();\r\n const current = children.shift();\r\n if (current === undefined) {\r\n break;\r\n }\r\n if (current.get() instanceof tokens_1.Dash) {\r\n if (context instanceof basic_1.UnknownType) {\r\n throw new Error(\"Not a structure, type unknown, FieldChain\");\r\n }\r\n else if (!(context instanceof basic_1.StructureType)\r\n && !(context instanceof basic_1.TableType && context.isWithHeader())\r\n && !(context instanceof basic_1.VoidType)) {\r\n if (context instanceof basic_1.TableType && context.isWithHeader() === false) {\r\n if (scope.isAllowHeaderUse(contextName.substring(0, contextName.length - 1))) {\r\n // FOR ALL ENTRIES workaround\r\n context = context.getRowType();\r\n if (!(context instanceof basic_1.StructureType) && !(context instanceof basic_1.VoidType)) {\r\n context = new basic_1.StructureType([{ name: \"TABLE_LINE\", type: context }]);\r\n }\r\n }\r\n else {\r\n throw new Error(\"Table without header, cannot access fields, \" + contextName);\r\n }\r\n }\r\n else {\r\n throw new Error(\"Not a structure, FieldChain\");\r\n }\r\n }\r\n }\r\n else if (current.get() instanceof tokens_1.InstanceArrow) {\r\n if (!(context instanceof basic_1.ObjectReferenceType)\r\n && !(context instanceof basic_1.DataReference)\r\n && !(context instanceof basic_1.VoidType)) {\r\n throw new Error(\"Not a object reference, field chain\");\r\n }\r\n }\r\n else if (current.get() instanceof expressions_1.Dereference) {\r\n context = new dereference_1.Dereference().runSyntax(context);\r\n }\r\n else if (current.get() instanceof Expressions.ComponentName) {\r\n if (context instanceof basic_1.TableType && context.isWithHeader()) {\r\n context = context.getRowType();\r\n }\r\n context = new component_name_1.ComponentName().runSyntax(context, current);\r\n }\r\n else if (current instanceof nodes_1.ExpressionNode\r\n && current.get() instanceof Expressions.TableExpression) {\r\n if (!(context instanceof basic_1.TableType) && !(context instanceof basic_1.VoidType)) {\r\n throw new Error(\"Table expression, expected table\");\r\n }\r\n new table_expression_1.TableExpression().runSyntax(current, scope, filename);\r\n if (!(context instanceof basic_1.VoidType)) {\r\n context = context.getRowType();\r\n }\r\n }\r\n else if (current.get() instanceof Expressions.AttributeName) {\r\n context = new attribute_name_1.AttributeName().runSyntax(context, current, scope, filename, refType);\r\n }\r\n else if (current.get() instanceof Expressions.FieldOffset && current instanceof nodes_1.ExpressionNode) {\r\n new field_offset_1.FieldOffset().runSyntax(current, scope, filename);\r\n }\r\n else if (current.get() instanceof Expressions.FieldLength && current instanceof nodes_1.ExpressionNode) {\r\n new field_length_1.FieldLength().runSyntax(current, scope, filename);\r\n }\r\n }\r\n return context;\r\n }\r\n ////////////////\r\n findTop(node, scope, filename, type) {\r\n if (node === undefined) {\r\n return undefined;\r\n }\r\n if (node.get() instanceof Expressions.SourceField\r\n || node.get() instanceof Expressions.SourceFieldSymbol) {\r\n const token = node.getFirstToken();\r\n const name = token.getStr();\r\n const found = scope.findVariable(name);\r\n if (found === undefined) {\r\n throw new Error(\"\\\"\" + name + \"\\\" not found, findTop\");\r\n }\r\n if (type) {\r\n scope.addReference(token, found, type, filename);\r\n }\r\n if (name.includes(\"~\")) {\r\n const idef = scope.findInterfaceDefinition(name.split(\"~\")[0]);\r\n if (idef) {\r\n scope.addReference(token, idef, _reference_1.ReferenceType.ObjectOrientedReference, filename);\r\n }\r\n }\r\n return found.getType();\r\n }\r\n if (node.get() instanceof Expressions.ClassName) {\r\n const classTok = node.getFirstToken();\r\n const classNam = classTok.getStr();\r\n if (classNam.toUpperCase() === \"OBJECT\") {\r\n return new basic_1.GenericObjectReferenceType();\r\n }\r\n const found = scope.existsObject(classNam);\r\n if (found.found === true && found.id) {\r\n scope.addReference(classTok, found.id, found.type, filename);\r\n return new basic_1.ObjectReferenceType(found.id);\r\n }\r\n else if (scope.getDDIC().inErrorNamespace(classNam) === false) {\r\n scope.addReference(classTok, undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, filename, { ooName: classNam.toUpperCase() });\r\n return new basic_1.VoidType(classNam);\r\n }\r\n else {\r\n throw new Error(\"Unknown class \" + classNam);\r\n }\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.FieldChain = FieldChain;\r\n//# sourceMappingURL=field_chain.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/field_chain.js?");
|
|
6697
6697
|
|
|
6698
6698
|
/***/ }),
|
|
6699
6699
|
|
|
@@ -11170,7 +11170,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11170
11170
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11171
11171
|
|
|
11172
11172
|
"use strict";
|
|
11173
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Registry = void 0;\nconst config_1 = __webpack_require__(/*! ./config */ \"./node_modules/@abaplint/core/build/src/config.js\");\nconst artifacts_objects_1 = __webpack_require__(/*! ./artifacts_objects */ \"./node_modules/@abaplint/core/build/src/artifacts_objects.js\");\nconst artifacts_rules_1 = __webpack_require__(/*! ./artifacts_rules */ \"./node_modules/@abaplint/core/build/src/artifacts_rules.js\");\nconst skip_logic_1 = __webpack_require__(/*! ./skip_logic */ \"./node_modules/@abaplint/core/build/src/skip_logic.js\");\nconst _abap_object_1 = __webpack_require__(/*! ./objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\nconst find_global_definitions_1 = __webpack_require__(/*! ./abap/5_syntax/global_definitions/find_global_definitions */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/global_definitions/find_global_definitions.js\");\nconst syntax_1 = __webpack_require__(/*! ./abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\nconst excludeHelper_1 = __webpack_require__(/*! ./utils/excludeHelper */ \"./node_modules/@abaplint/core/build/src/utils/excludeHelper.js\");\nconst ddic_references_1 = __webpack_require__(/*! ./ddic_references */ \"./node_modules/@abaplint/core/build/src/ddic_references.js\");\n// todo, this should really be an instance in case there are multiple Registry'ies\nclass ParsingPerformance {\n static clear() {\n this.results = [];\n this.lexing = 0;\n this.statements = 0;\n this.structure = 0;\n }\n static push(obj, result) {\n if (result.runtimeExtra) {\n this.lexing += result.runtimeExtra.lexing;\n this.statements += result.runtimeExtra.statements;\n this.structure += result.runtimeExtra.structure;\n }\n if (result.runtime < 100) {\n return;\n }\n if (this.results === undefined) {\n this.results = [];\n }\n let extra = \"\";\n if (result.runtimeExtra) {\n extra = `\\t(lexing: ${result.runtimeExtra.lexing}ms, statements: ${result.runtimeExtra.statements}ms, structure: ${result.runtimeExtra.structure}ms)`;\n }\n this.results.push({\n runtime: result.runtime,\n extra,\n name: obj.getType() + \" \" + obj.getName(),\n });\n }\n static output() {\n const MAX = 10;\n this.results.sort((a, b) => { return b.runtime - a.runtime; });\n for (let i = 0; i < MAX; i++) {\n const row = this.results[i];\n if (row === undefined) {\n break;\n }\n process.stderr.write(`\\t${row.runtime}ms\\t${row.name} ${row.extra}\\n`);\n }\n process.stderr.write(`\\tTotal lexing: ${this.lexing}ms\\n`);\n process.stderr.write(`\\tTotal statements: ${this.statements}ms\\n`);\n process.stderr.write(`\\tTotal structure: ${this.structure}ms\\n`);\n }\n}\n///////////////////////////////////////////////////////////////////////////////////////////////\nclass Registry {\n constructor(conf) {\n this.objects = {};\n this.objectsByType = {};\n /** object containing filenames of dependencies */\n this.dependencies = {};\n this.issues = [];\n this.conf = conf ? conf : config_1.Config.getDefault();\n this.references = new ddic_references_1.DDICReferences();\n }\n static abaplintVersion() {\n // magic, see build script \"version.sh\"\n return \"2.85.4\";\n }\n getDDICReferences() {\n return this.references;\n }\n *getObjects() {\n for (const name in this.objects) {\n for (const type in this.objects[name]) {\n yield this.objects[name][type];\n }\n }\n }\n *getObjectsByType(type) {\n for (const name in this.objectsByType[type] || []) {\n yield this.objectsByType[type][name];\n }\n }\n *getFiles() {\n for (const obj of this.getObjects()) {\n for (const file of obj.getFiles()) {\n yield file;\n }\n }\n }\n getFirstObject() {\n for (const name in this.objects) {\n for (const type in this.objects[name]) {\n return this.objects[name][type];\n }\n }\n return undefined;\n }\n getObjectCount(skipDependencies = true) {\n let res = 0;\n for (const o of this.getObjects()) {\n if (skipDependencies === true && this.isDependency(o)) {\n continue;\n }\n res = res + 1;\n }\n return res;\n }\n getFileByName(filename) {\n const upper = filename.toUpperCase();\n for (const o of this.getObjects()) {\n for (const f of o.getFiles()) {\n if (f.getFilename().toUpperCase() === upper) {\n return f;\n }\n }\n }\n return undefined;\n }\n getObject(type, name) {\n if (type === undefined || name === undefined) {\n return undefined;\n }\n const searchName = name.toUpperCase();\n if (this.objects[searchName]) {\n return this.objects[searchName][type];\n }\n return undefined;\n }\n getConfig() {\n return this.conf;\n }\n // assumption: Config is immutable, and can only be changed via this method\n setConfig(conf) {\n for (const obj of this.getObjects()) {\n obj.setDirty();\n }\n this.conf = conf;\n return this;\n }\n inErrorNamespace(name) {\n const reg = new RegExp(this.getConfig().getSyntaxSetttings().errorNamespace, \"i\");\n return reg.test(name);\n }\n addFile(file) {\n return this.addFiles([file]);\n }\n updateFile(file) {\n const obj = this.find(file.getObjectName(), file.getObjectType());\n obj.updateFile(file);\n return this;\n }\n removeFile(file) {\n const obj = this.find(file.getObjectName(), file.getObjectType());\n obj.removeFile(file);\n if (obj.getFiles().length === 0) {\n this.references.clear(obj);\n this.removeObject(obj);\n }\n return this;\n }\n addFiles(files) {\n var _a;\n const globalExclude = ((_a = this.conf.getGlobal().exclude) !== null && _a !== void 0 ? _a : [])\n .map(pattern => new RegExp(pattern, \"i\"));\n for (const f of files) {\n const filename = f.getFilename();\n const isNotAbapgitFile = filename.split(\".\").length <= 2;\n if (isNotAbapgitFile || excludeHelper_1.ExcludeHelper.isExcluded(filename, globalExclude)) {\n continue;\n }\n const found = this.findOrCreate(f.getObjectName(), f.getObjectType());\n found.addFile(f);\n }\n return this;\n }\n addDependencies(files) {\n for (const f of files) {\n this.dependencies[f.getFilename().toUpperCase()] = true;\n }\n return this.addFiles(files);\n }\n addDependency(file) {\n this.dependencies[file.getFilename().toUpperCase()] = true;\n this.addFile(file);\n return this;\n }\n isDependency(obj) {\n const filename = obj.getFiles()[0].getFilename().toUpperCase();\n return this.dependencies[filename] === true;\n }\n isFileDependency(filename) {\n return this.dependencies[filename.toUpperCase()] === true;\n }\n // assumption: the file is already in the registry\n findObjectForFile(file) {\n const filename = file.getFilename();\n for (const obj of this.getObjects()) {\n for (const ofile of obj.getFiles()) {\n if (ofile.getFilename() === filename) {\n return obj;\n }\n }\n }\n return undefined;\n }\n // todo, this will be changed to async sometime\n findIssues(input) {\n if (this.isDirty() === true) {\n this.parse();\n }\n return this.runRules(input);\n }\n // todo, this will be changed to async sometime\n findIssuesObject(iobj) {\n if (this.isDirty() === true) {\n this.parse();\n }\n return this.runRules(undefined, iobj);\n }\n // todo, this will be changed to async sometime\n parse() {\n if (this.isDirty() === false) {\n return this;\n }\n ParsingPerformance.clear();\n this.issues = [];\n for (const o of this.getObjects()) {\n this.parsePrivate(o);\n this.issues.push(...o.getParsingIssues());\n }\n new find_global_definitions_1.FindGlobalDefinitions(this).run();\n return this;\n }\n async parseAsync(input) {\n var _a, _b;\n if (this.isDirty() === false) {\n return this;\n }\n ParsingPerformance.clear();\n (_a = input === null || input === void 0 ? void 0 : input.progress) === null || _a === void 0 ? void 0 : _a.set(this.getObjectCount(false), \"Lexing and parsing\");\n this.issues = [];\n for (const o of this.getObjects()) {\n await ((_b = input === null || input === void 0 ? void 0 : input.progress) === null || _b === void 0 ? void 0 : _b.tick(\"Lexing and parsing(\" + this.conf.getVersion() + \") - \" + o.getType() + \" \" + o.getName()));\n this.parsePrivate(o);\n this.issues.push(...o.getParsingIssues());\n }\n if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {\n ParsingPerformance.output();\n }\n new find_global_definitions_1.FindGlobalDefinitions(this).run(input === null || input === void 0 ? void 0 : input.progress);\n return this;\n }\n //////////////////////////////////////////\n // todo, refactor, this is a mess, see where-used, a lot of the code should be in this method instead\n parsePrivate(input) {\n const config = this.getConfig();\n const result = input.parse(config.getVersion(), config.getSyntaxSetttings().globalMacros, this);\n ParsingPerformance.push(input, result);\n }\n isDirty() {\n for (const o of this.getObjects()) {\n const dirty = o.isDirty();\n if (dirty === true) {\n return true;\n }\n }\n return false;\n }\n runRules(input, iobj) {\n var _a, _b, _c, _d, _e, _f;\n const rulePerformance = {};\n const issues = this.issues.slice(0);\n const objects = iobj ? [iobj] : this.getObjects();\n const rules = this.conf.getEnabledRules();\n const skipLogic = new skip_logic_1.SkipLogic(this);\n (_a = input === null || input === void 0 ? void 0 : input.progress) === null || _a === void 0 ? void 0 : _a.set(iobj ? 1 : this.getObjectCount(false), \"Run Syntax\");\n const check = [];\n for (const obj of objects) {\n (_b = input === null || input === void 0 ? void 0 : input.progress) === null || _b === void 0 ? void 0 : _b.tick(\"Run Syntax - \" + obj.getName());\n if (skipLogic.skip(obj) || this.isDependency(obj)) {\n continue;\n }\n if (obj instanceof _abap_object_1.ABAPObject) {\n new syntax_1.SyntaxLogic(this, obj).run();\n }\n check.push(obj);\n }\n (_c = input === null || input === void 0 ? void 0 : input.progress) === null || _c === void 0 ? void 0 : _c.set(rules.length, \"Initialize Rules\");\n for (const rule of rules) {\n (_d = input === null || input === void 0 ? void 0 : input.progress) === null || _d === void 0 ? void 0 : _d.tick(\"Initialize Rules - \" + rule.getMetadata().key);\n if (rule.initialize === undefined) {\n throw new Error(rule.getMetadata().key + \" missing initialize method\");\n }\n rule.initialize(this);\n rulePerformance[rule.getMetadata().key] = 0;\n }\n (_e = input === null || input === void 0 ? void 0 : input.progress) === null || _e === void 0 ? void 0 : _e.set(check.length, \"Finding Issues\");\n for (const obj of check) {\n (_f = input === null || input === void 0 ? void 0 : input.progress) === null || _f === void 0 ? void 0 : _f.tick(\"Finding Issues - \" + obj.getType() + \" \" + obj.getName());\n for (const rule of rules) {\n const before = Date.now();\n issues.push(...rule.run(obj));\n const runtime = Date.now() - before;\n rulePerformance[rule.getMetadata().key] = rulePerformance[rule.getMetadata().key] + runtime;\n }\n }\n if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {\n const perf = [];\n for (const p in rulePerformance) {\n if (rulePerformance[p] > 100) { // ignore rules if it takes less than 100ms\n perf.push({ name: p, time: rulePerformance[p] });\n }\n }\n perf.sort((a, b) => { return b.time - a.time; });\n for (const p of perf) {\n process.stderr.write(\"\\t\" + p.time + \"ms\\t\" + p.name + \"\\n\");\n }\n }\n return this.excludeIssues(issues);\n }\n excludeIssues(issues) {\n var _a;\n const ret = issues;\n const globalNoIssues = this.conf.getGlobal().noIssues || [];\n const globalNoIssuesPatterns = globalNoIssues.map(x => new RegExp(x, \"i\"));\n if (globalNoIssuesPatterns.length > 0) {\n for (let i = ret.length - 1; i >= 0; i--) {\n const filename = ret[i].getFilename();\n if (excludeHelper_1.ExcludeHelper.isExcluded(filename, globalNoIssuesPatterns)) {\n ret.splice(i, 1);\n }\n }\n }\n // exclude issues, as now we know both the filename and issue key\n for (const rule of artifacts_rules_1.ArtifactsRules.getRules()) {\n const key = rule.getMetadata().key;\n const ruleExclude = (_a = this.conf.readByKey(key, \"exclude\")) !== null && _a !== void 0 ? _a : [];\n if (ruleExclude.length === 0) {\n continue;\n }\n const ruleExcludePatterns = ruleExclude.map(x => new RegExp(x, \"i\"));\n for (let i = ret.length - 1; i >= 0; i--) {\n if (ret[i].getKey() !== key) {\n continue;\n }\n const filename = ret[i].getFilename();\n if (excludeHelper_1.ExcludeHelper.isExcluded(filename, ruleExcludePatterns)) {\n ret.splice(i, 1);\n }\n }\n }\n return ret;\n }\n findOrCreate(name, type) {\n try {\n return this.find(name, type);\n }\n catch (_a) {\n const newName = name.toUpperCase();\n const newType = type ? type : \"UNKNOWN\";\n const add = artifacts_objects_1.ArtifactsObjects.newObject(newName, newType);\n if (this.objects[newName] === undefined) {\n this.objects[newName] = {};\n }\n this.objects[newName][newType] = add;\n if (this.objectsByType[newType] === undefined) {\n this.objectsByType[newType] = {};\n }\n this.objectsByType[newType][newName] = add;\n return add;\n }\n }\n removeObject(remove) {\n if (remove === undefined) {\n return;\n }\n if (this.objects[remove.getName()][remove.getType()] === undefined) {\n throw new Error(\"removeObject: object not found\");\n }\n if (Object.keys(this.objects[remove.getName()]).length === 1) {\n delete this.objects[remove.getName()];\n }\n else {\n delete this.objects[remove.getName()][remove.getType()];\n }\n if (Object.keys(this.objectsByType[remove.getType()]).length === 1) {\n delete this.objectsByType[remove.getType()];\n }\n else {\n delete this.objectsByType[remove.getType()][remove.getName()];\n }\n }\n find(name, type) {\n const searchType = type ? type : \"UNKNOWN\";\n const searchName = name.toUpperCase();\n if (this.objects[searchName] !== undefined\n && this.objects[searchName][searchType]) {\n return this.objects[searchName][searchType];\n }\n throw new Error(\"find: object not found, \" + type + \" \" + name);\n }\n}\nexports.Registry = Registry;\n//# sourceMappingURL=registry.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/registry.js?");
|
|
11173
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Registry = void 0;\nconst config_1 = __webpack_require__(/*! ./config */ \"./node_modules/@abaplint/core/build/src/config.js\");\nconst artifacts_objects_1 = __webpack_require__(/*! ./artifacts_objects */ \"./node_modules/@abaplint/core/build/src/artifacts_objects.js\");\nconst artifacts_rules_1 = __webpack_require__(/*! ./artifacts_rules */ \"./node_modules/@abaplint/core/build/src/artifacts_rules.js\");\nconst skip_logic_1 = __webpack_require__(/*! ./skip_logic */ \"./node_modules/@abaplint/core/build/src/skip_logic.js\");\nconst _abap_object_1 = __webpack_require__(/*! ./objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\nconst find_global_definitions_1 = __webpack_require__(/*! ./abap/5_syntax/global_definitions/find_global_definitions */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/global_definitions/find_global_definitions.js\");\nconst syntax_1 = __webpack_require__(/*! ./abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\nconst excludeHelper_1 = __webpack_require__(/*! ./utils/excludeHelper */ \"./node_modules/@abaplint/core/build/src/utils/excludeHelper.js\");\nconst ddic_references_1 = __webpack_require__(/*! ./ddic_references */ \"./node_modules/@abaplint/core/build/src/ddic_references.js\");\n// todo, this should really be an instance in case there are multiple Registry'ies\nclass ParsingPerformance {\n static clear() {\n this.results = [];\n this.lexing = 0;\n this.statements = 0;\n this.structure = 0;\n }\n static push(obj, result) {\n if (result.runtimeExtra) {\n this.lexing += result.runtimeExtra.lexing;\n this.statements += result.runtimeExtra.statements;\n this.structure += result.runtimeExtra.structure;\n }\n if (result.runtime < 100) {\n return;\n }\n if (this.results === undefined) {\n this.results = [];\n }\n let extra = \"\";\n if (result.runtimeExtra) {\n extra = `\\t(lexing: ${result.runtimeExtra.lexing}ms, statements: ${result.runtimeExtra.statements}ms, structure: ${result.runtimeExtra.structure}ms)`;\n }\n this.results.push({\n runtime: result.runtime,\n extra,\n name: obj.getType() + \" \" + obj.getName(),\n });\n }\n static output() {\n const MAX = 10;\n this.results.sort((a, b) => { return b.runtime - a.runtime; });\n for (let i = 0; i < MAX; i++) {\n const row = this.results[i];\n if (row === undefined) {\n break;\n }\n process.stderr.write(`\\t${row.runtime}ms\\t${row.name} ${row.extra}\\n`);\n }\n process.stderr.write(`\\tTotal lexing: ${this.lexing}ms\\n`);\n process.stderr.write(`\\tTotal statements: ${this.statements}ms\\n`);\n process.stderr.write(`\\tTotal structure: ${this.structure}ms\\n`);\n }\n}\n///////////////////////////////////////////////////////////////////////////////////////////////\nclass Registry {\n constructor(conf) {\n this.objects = {};\n this.objectsByType = {};\n /** object containing filenames of dependencies */\n this.dependencies = {};\n this.issues = [];\n this.conf = conf ? conf : config_1.Config.getDefault();\n this.references = new ddic_references_1.DDICReferences();\n }\n static abaplintVersion() {\n // magic, see build script \"version.sh\"\n return \"2.85.8\";\n }\n getDDICReferences() {\n return this.references;\n }\n *getObjects() {\n for (const name in this.objects) {\n for (const type in this.objects[name]) {\n yield this.objects[name][type];\n }\n }\n }\n *getObjectsByType(type) {\n for (const name in this.objectsByType[type] || []) {\n yield this.objectsByType[type][name];\n }\n }\n *getFiles() {\n for (const obj of this.getObjects()) {\n for (const file of obj.getFiles()) {\n yield file;\n }\n }\n }\n getFirstObject() {\n for (const name in this.objects) {\n for (const type in this.objects[name]) {\n return this.objects[name][type];\n }\n }\n return undefined;\n }\n getObjectCount(skipDependencies = true) {\n let res = 0;\n for (const o of this.getObjects()) {\n if (skipDependencies === true && this.isDependency(o)) {\n continue;\n }\n res = res + 1;\n }\n return res;\n }\n getFileByName(filename) {\n const upper = filename.toUpperCase();\n for (const o of this.getObjects()) {\n for (const f of o.getFiles()) {\n if (f.getFilename().toUpperCase() === upper) {\n return f;\n }\n }\n }\n return undefined;\n }\n getObject(type, name) {\n if (type === undefined || name === undefined) {\n return undefined;\n }\n const searchName = name.toUpperCase();\n if (this.objects[searchName]) {\n return this.objects[searchName][type];\n }\n return undefined;\n }\n getConfig() {\n return this.conf;\n }\n // assumption: Config is immutable, and can only be changed via this method\n setConfig(conf) {\n for (const obj of this.getObjects()) {\n obj.setDirty();\n }\n this.conf = conf;\n return this;\n }\n inErrorNamespace(name) {\n const reg = new RegExp(this.getConfig().getSyntaxSetttings().errorNamespace, \"i\");\n return reg.test(name);\n }\n addFile(file) {\n return this.addFiles([file]);\n }\n updateFile(file) {\n const obj = this.find(file.getObjectName(), file.getObjectType());\n obj.updateFile(file);\n return this;\n }\n removeFile(file) {\n const obj = this.find(file.getObjectName(), file.getObjectType());\n obj.removeFile(file);\n if (obj.getFiles().length === 0) {\n this.references.clear(obj);\n this.removeObject(obj);\n }\n return this;\n }\n addFiles(files) {\n var _a;\n const globalExclude = ((_a = this.conf.getGlobal().exclude) !== null && _a !== void 0 ? _a : [])\n .map(pattern => new RegExp(pattern, \"i\"));\n for (const f of files) {\n const filename = f.getFilename();\n const isNotAbapgitFile = filename.split(\".\").length <= 2;\n if (isNotAbapgitFile || excludeHelper_1.ExcludeHelper.isExcluded(filename, globalExclude)) {\n continue;\n }\n const found = this.findOrCreate(f.getObjectName(), f.getObjectType());\n found.addFile(f);\n }\n return this;\n }\n addDependencies(files) {\n for (const f of files) {\n this.dependencies[f.getFilename().toUpperCase()] = true;\n }\n return this.addFiles(files);\n }\n addDependency(file) {\n this.dependencies[file.getFilename().toUpperCase()] = true;\n this.addFile(file);\n return this;\n }\n isDependency(obj) {\n const filename = obj.getFiles()[0].getFilename().toUpperCase();\n return this.dependencies[filename] === true;\n }\n isFileDependency(filename) {\n return this.dependencies[filename.toUpperCase()] === true;\n }\n // assumption: the file is already in the registry\n findObjectForFile(file) {\n const filename = file.getFilename();\n for (const obj of this.getObjects()) {\n for (const ofile of obj.getFiles()) {\n if (ofile.getFilename() === filename) {\n return obj;\n }\n }\n }\n return undefined;\n }\n // todo, this will be changed to async sometime\n findIssues(input) {\n if (this.isDirty() === true) {\n this.parse();\n }\n return this.runRules(input);\n }\n // todo, this will be changed to async sometime\n findIssuesObject(iobj) {\n if (this.isDirty() === true) {\n this.parse();\n }\n return this.runRules(undefined, iobj);\n }\n // todo, this will be changed to async sometime\n parse() {\n if (this.isDirty() === false) {\n return this;\n }\n ParsingPerformance.clear();\n this.issues = [];\n for (const o of this.getObjects()) {\n this.parsePrivate(o);\n this.issues.push(...o.getParsingIssues());\n }\n new find_global_definitions_1.FindGlobalDefinitions(this).run();\n return this;\n }\n async parseAsync(input) {\n var _a, _b;\n if (this.isDirty() === false) {\n return this;\n }\n ParsingPerformance.clear();\n (_a = input === null || input === void 0 ? void 0 : input.progress) === null || _a === void 0 ? void 0 : _a.set(this.getObjectCount(false), \"Lexing and parsing\");\n this.issues = [];\n for (const o of this.getObjects()) {\n await ((_b = input === null || input === void 0 ? void 0 : input.progress) === null || _b === void 0 ? void 0 : _b.tick(\"Lexing and parsing(\" + this.conf.getVersion() + \") - \" + o.getType() + \" \" + o.getName()));\n this.parsePrivate(o);\n this.issues.push(...o.getParsingIssues());\n }\n if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {\n ParsingPerformance.output();\n }\n new find_global_definitions_1.FindGlobalDefinitions(this).run(input === null || input === void 0 ? void 0 : input.progress);\n return this;\n }\n //////////////////////////////////////////\n // todo, refactor, this is a mess, see where-used, a lot of the code should be in this method instead\n parsePrivate(input) {\n const config = this.getConfig();\n const result = input.parse(config.getVersion(), config.getSyntaxSetttings().globalMacros, this);\n ParsingPerformance.push(input, result);\n }\n isDirty() {\n for (const o of this.getObjects()) {\n const dirty = o.isDirty();\n if (dirty === true) {\n return true;\n }\n }\n return false;\n }\n runRules(input, iobj) {\n var _a, _b, _c, _d, _e, _f;\n const rulePerformance = {};\n const issues = this.issues.slice(0);\n const objects = iobj ? [iobj] : this.getObjects();\n const rules = this.conf.getEnabledRules();\n const skipLogic = new skip_logic_1.SkipLogic(this);\n (_a = input === null || input === void 0 ? void 0 : input.progress) === null || _a === void 0 ? void 0 : _a.set(iobj ? 1 : this.getObjectCount(false), \"Run Syntax\");\n const check = [];\n for (const obj of objects) {\n (_b = input === null || input === void 0 ? void 0 : input.progress) === null || _b === void 0 ? void 0 : _b.tick(\"Run Syntax - \" + obj.getName());\n if (skipLogic.skip(obj) || this.isDependency(obj)) {\n continue;\n }\n if (obj instanceof _abap_object_1.ABAPObject) {\n new syntax_1.SyntaxLogic(this, obj).run();\n }\n check.push(obj);\n }\n (_c = input === null || input === void 0 ? void 0 : input.progress) === null || _c === void 0 ? void 0 : _c.set(rules.length, \"Initialize Rules\");\n for (const rule of rules) {\n (_d = input === null || input === void 0 ? void 0 : input.progress) === null || _d === void 0 ? void 0 : _d.tick(\"Initialize Rules - \" + rule.getMetadata().key);\n if (rule.initialize === undefined) {\n throw new Error(rule.getMetadata().key + \" missing initialize method\");\n }\n rule.initialize(this);\n rulePerformance[rule.getMetadata().key] = 0;\n }\n (_e = input === null || input === void 0 ? void 0 : input.progress) === null || _e === void 0 ? void 0 : _e.set(check.length, \"Finding Issues\");\n for (const obj of check) {\n (_f = input === null || input === void 0 ? void 0 : input.progress) === null || _f === void 0 ? void 0 : _f.tick(\"Finding Issues - \" + obj.getType() + \" \" + obj.getName());\n for (const rule of rules) {\n const before = Date.now();\n issues.push(...rule.run(obj));\n const runtime = Date.now() - before;\n rulePerformance[rule.getMetadata().key] = rulePerformance[rule.getMetadata().key] + runtime;\n }\n }\n if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {\n const perf = [];\n for (const p in rulePerformance) {\n if (rulePerformance[p] > 100) { // ignore rules if it takes less than 100ms\n perf.push({ name: p, time: rulePerformance[p] });\n }\n }\n perf.sort((a, b) => { return b.time - a.time; });\n for (const p of perf) {\n process.stderr.write(\"\\t\" + p.time + \"ms\\t\" + p.name + \"\\n\");\n }\n }\n return this.excludeIssues(issues);\n }\n excludeIssues(issues) {\n var _a;\n const ret = issues;\n const globalNoIssues = this.conf.getGlobal().noIssues || [];\n const globalNoIssuesPatterns = globalNoIssues.map(x => new RegExp(x, \"i\"));\n if (globalNoIssuesPatterns.length > 0) {\n for (let i = ret.length - 1; i >= 0; i--) {\n const filename = ret[i].getFilename();\n if (excludeHelper_1.ExcludeHelper.isExcluded(filename, globalNoIssuesPatterns)) {\n ret.splice(i, 1);\n }\n }\n }\n // exclude issues, as now we know both the filename and issue key\n for (const rule of artifacts_rules_1.ArtifactsRules.getRules()) {\n const key = rule.getMetadata().key;\n const ruleExclude = (_a = this.conf.readByKey(key, \"exclude\")) !== null && _a !== void 0 ? _a : [];\n if (ruleExclude.length === 0) {\n continue;\n }\n const ruleExcludePatterns = ruleExclude.map(x => new RegExp(x, \"i\"));\n for (let i = ret.length - 1; i >= 0; i--) {\n if (ret[i].getKey() !== key) {\n continue;\n }\n const filename = ret[i].getFilename();\n if (excludeHelper_1.ExcludeHelper.isExcluded(filename, ruleExcludePatterns)) {\n ret.splice(i, 1);\n }\n }\n }\n return ret;\n }\n findOrCreate(name, type) {\n try {\n return this.find(name, type);\n }\n catch (_a) {\n const newName = name.toUpperCase();\n const newType = type ? type : \"UNKNOWN\";\n const add = artifacts_objects_1.ArtifactsObjects.newObject(newName, newType);\n if (this.objects[newName] === undefined) {\n this.objects[newName] = {};\n }\n this.objects[newName][newType] = add;\n if (this.objectsByType[newType] === undefined) {\n this.objectsByType[newType] = {};\n }\n this.objectsByType[newType][newName] = add;\n return add;\n }\n }\n removeObject(remove) {\n if (remove === undefined) {\n return;\n }\n if (this.objects[remove.getName()][remove.getType()] === undefined) {\n throw new Error(\"removeObject: object not found\");\n }\n if (Object.keys(this.objects[remove.getName()]).length === 1) {\n delete this.objects[remove.getName()];\n }\n else {\n delete this.objects[remove.getName()][remove.getType()];\n }\n if (Object.keys(this.objectsByType[remove.getType()]).length === 1) {\n delete this.objectsByType[remove.getType()];\n }\n else {\n delete this.objectsByType[remove.getType()][remove.getName()];\n }\n }\n find(name, type) {\n const searchType = type ? type : \"UNKNOWN\";\n const searchName = name.toUpperCase();\n if (this.objects[searchName] !== undefined\n && this.objects[searchName][searchType]) {\n return this.objects[searchName][searchType];\n }\n throw new Error(\"find: object not found, \" + type + \" \" + name);\n }\n}\nexports.Registry = Registry;\n//# sourceMappingURL=registry.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/registry.js?");
|
|
11174
11174
|
|
|
11175
11175
|
/***/ }),
|
|
11176
11176
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/cli",
|
|
3
|
-
"version": "2.85.
|
|
3
|
+
"version": "2.85.8",
|
|
4
4
|
"description": "abaplint - Command Line Interface",
|
|
5
5
|
"bin": {
|
|
6
6
|
"abaplint": "./abaplint"
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
},
|
|
40
40
|
"homepage": "https://abaplint.org",
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@abaplint/core": "^2.85.
|
|
42
|
+
"@abaplint/core": "^2.85.8",
|
|
43
43
|
"@types/chai": "^4.3.0",
|
|
44
44
|
"@types/glob": "^7.2.0",
|
|
45
45
|
"@types/minimist": "^1.2.2",
|
|
46
46
|
"@types/mocha": "^9.1.0",
|
|
47
|
-
"@types/node": "^17.0.
|
|
47
|
+
"@types/node": "^17.0.14",
|
|
48
48
|
"@types/progress": "^2.0.5",
|
|
49
49
|
"chai": "^4.3.6",
|
|
50
50
|
"chalk": "=4.1.2",
|