@abaplint/cli 2.93.72 → 2.93.73
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 +4 -4
- package/package.json +2 -2
package/build/cli.js
CHANGED
|
@@ -2590,7 +2590,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
2590
2590
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2591
2591
|
|
|
2592
2592
|
"use strict";
|
|
2593
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.TypeTable = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst _1 = __webpack_require__(/*! . */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst field_chain_1 = __webpack_require__(/*! ./field_chain */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/field_chain.js\");\r\nconst type_table_key_1 = __webpack_require__(/*! ./type_table_key */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/type_table_key.js\");\r\nconst version_1 = __webpack_require__(/*! ../../../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nclass TypeTable extends combi_1.Expression {\r\n getRunnable() {\r\n const header = \"WITH HEADER LINE\";\r\n const initial = (0, combi_1.seq)(\"INITIAL SIZE\", _1.Constant);\r\n const normal1 = (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.alt)(\"STANDARD\", \"HASHED\", \"INDEX\", \"SORTED\", \"ANY\")), \"TABLE\", (0, combi_1.opt)(\"OF\"), (0, combi_1.opt)(\"REF TO\"), (0, combi_1.opt)(_1.TypeName));\r\n const likeType = (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.alt)(\"STANDARD\", \"HASHED\", \"INDEX\", \"SORTED\", \"ANY\")), \"TABLE OF\", (0, combi_1.optPrio)(\"REF TO\"), (0, combi_1.opt)(field_chain_1.FieldChain), (0, combi_1.opt)((0, combi_1.per)(header, initial, (0, combi_1.plusPrio)(type_table_key_1.TypeTableKey))));\r\n const rangeType = (0, combi_1.seq)(\"RANGE OF\", _1.TypeName, (0, combi_1.opt)(header), (0, combi_1.opt)(initial));\r\n const rangeLike = (0, combi_1.seq)(\"RANGE OF\", _1.SimpleFieldChain, (0, combi_1.opt)(header), (0, combi_1.opt)(initial));\r\n // a maximum of 15 secondary table keys can be defined\r\n // \"WITH\" is not allowed as a field name in keys\r\n const typetable = (0, combi_1.seq)(normal1, (0, combi_1.alt)((0, combi_1.opt)((0, combi_1.per)(header, initial, (0, combi_1.plusPrio)(type_table_key_1.TypeTableKey))), (0, combi_1.seq)((0, combi_1.plus)(type_table_key_1.TypeTableKey), (0, combi_1.optPrio)(initial))));\r\n const occurs = (0, combi_1.seq)(\"OCCURS\", _1.Integer);\r\n const derived = (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)(\"TABLE FOR\", (0, combi_1.altPrio)(\"
|
|
2593
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.TypeTable = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst _1 = __webpack_require__(/*! . */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst field_chain_1 = __webpack_require__(/*! ./field_chain */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/field_chain.js\");\r\nconst type_table_key_1 = __webpack_require__(/*! ./type_table_key */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/type_table_key.js\");\r\nconst version_1 = __webpack_require__(/*! ../../../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nclass TypeTable extends combi_1.Expression {\r\n getRunnable() {\r\n const header = \"WITH HEADER LINE\";\r\n const initial = (0, combi_1.seq)(\"INITIAL SIZE\", _1.Constant);\r\n const normal1 = (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.alt)(\"STANDARD\", \"HASHED\", \"INDEX\", \"SORTED\", \"ANY\")), \"TABLE\", (0, combi_1.opt)(\"OF\"), (0, combi_1.opt)(\"REF TO\"), (0, combi_1.opt)(_1.TypeName));\r\n const likeType = (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.alt)(\"STANDARD\", \"HASHED\", \"INDEX\", \"SORTED\", \"ANY\")), \"TABLE OF\", (0, combi_1.optPrio)(\"REF TO\"), (0, combi_1.opt)(field_chain_1.FieldChain), (0, combi_1.opt)((0, combi_1.per)(header, initial, (0, combi_1.plusPrio)(type_table_key_1.TypeTableKey))));\r\n const rangeType = (0, combi_1.seq)(\"RANGE OF\", _1.TypeName, (0, combi_1.opt)(header), (0, combi_1.opt)(initial));\r\n const rangeLike = (0, combi_1.seq)(\"RANGE OF\", _1.SimpleFieldChain, (0, combi_1.opt)(header), (0, combi_1.opt)(initial));\r\n // a maximum of 15 secondary table keys can be defined\r\n // \"WITH\" is not allowed as a field name in keys\r\n const typetable = (0, combi_1.seq)(normal1, (0, combi_1.alt)((0, combi_1.opt)((0, combi_1.per)(header, initial, (0, combi_1.plusPrio)(type_table_key_1.TypeTableKey))), (0, combi_1.seq)((0, combi_1.plus)(type_table_key_1.TypeTableKey), (0, combi_1.optPrio)(initial))));\r\n const occurs = (0, combi_1.seq)(\"OCCURS\", _1.Integer);\r\n const derived = (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)(\"TABLE FOR\", (0, combi_1.altPrio)(\"ACTION IMPORT\", \"ACTION RESULT\", \"CREATE\", \"FAILED\", \"LOCK\", \"READ RESULT\", \"UPDATE\"), _1.TypeName));\r\n const oldType = (0, combi_1.seq)((0, combi_1.opt)(\"REF TO\"), _1.TypeName, (0, combi_1.alt)((0, combi_1.seq)(occurs, (0, combi_1.opt)(header)), header));\r\n const oldLike = (0, combi_1.seq)((0, combi_1.opt)(\"REF TO\"), field_chain_1.FieldChain, (0, combi_1.alt)((0, combi_1.seq)(occurs, (0, combi_1.opt)(header)), header));\r\n const ret = (0, combi_1.altPrio)((0, combi_1.seq)(occurs, (0, combi_1.opt)(header)), (0, combi_1.seq)(\"LIKE\", (0, combi_1.alt)(oldLike, likeType, rangeLike)), (0, combi_1.seq)(\"TYPE\", (0, combi_1.alt)(oldType, typetable, rangeType, derived)));\r\n return ret;\r\n }\r\n}\r\nexports.TypeTable = TypeTable;\r\n//# sourceMappingURL=type_table.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/type_table.js?");
|
|
2594
2594
|
|
|
2595
2595
|
/***/ }),
|
|
2596
2596
|
|
|
@@ -6715,7 +6715,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
6715
6715
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
6716
6716
|
|
|
6717
6717
|
"use strict";
|
|
6718
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.BasicTypes = void 0;\r\n/* eslint-disable default-case */\r\nconst _typed_identifier_1 = __webpack_require__(/*! ../types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\r\nconst Expressions = __webpack_require__(/*! ../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst Statements = __webpack_require__(/*! ../2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Types = __webpack_require__(/*! ../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst _scope_type_1 = __webpack_require__(/*! ./_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\r\nconst _object_oriented_1 = __webpack_require__(/*! ./_object_oriented */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js\");\r\nconst class_constant_1 = __webpack_require__(/*! ../types/class_constant */ \"./node_modules/@abaplint/core/build/src/abap/types/class_constant.js\");\r\nconst identifier_1 = __webpack_require__(/*! ../1_lexer/tokens/identifier */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/identifier.js\");\r\nconst _reference_1 = __webpack_require__(/*! ./_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nconst basic_1 = __webpack_require__(/*! ../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst field_chain_1 = __webpack_require__(/*! ./expressions/field_chain */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/field_chain.js\");\r\nconst types_1 = __webpack_require__(/*! ../types */ \"./node_modules/@abaplint/core/build/src/abap/types/index.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _builtin_1 = __webpack_require__(/*! ./_builtin */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_builtin.js\");\r\nconst position_1 = __webpack_require__(/*! ../../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nclass BasicTypes {\r\n constructor(filename, scope) {\r\n this.filename = filename;\r\n this.scope = scope;\r\n }\r\n lookupQualifiedName(name) {\r\n var _a;\r\n // argh, todo, rewrite this entire method, more argh\r\n if (name === undefined) {\r\n return undefined;\r\n }\r\n const found = this.scope.findType(name);\r\n if (found) {\r\n return found;\r\n }\r\n if (name.includes(\"=>\")) {\r\n const split = name.split(\"=>\");\r\n const ooName = split[0];\r\n const typeName = split[1];\r\n const oo = this.scope.findObjectDefinition(ooName);\r\n if (oo) {\r\n if (typeName.includes(\"-\")) {\r\n const split = typeName.split(\"-\");\r\n const subTypeName = split[0];\r\n const fieldName = split[1];\r\n const stru = oo.getTypeDefinitions().getByName(subTypeName);\r\n const struType = stru === null || stru === void 0 ? void 0 : stru.getType();\r\n if (stru && struType instanceof basic_1.StructureType) {\r\n const f = struType.getComponentByName(fieldName);\r\n if (f) {\r\n return new _typed_identifier_1.TypedIdentifier(stru.getToken(), stru.getFilename(), f);\r\n }\r\n }\r\n }\r\n else {\r\n const f = oo.getTypeDefinitions().getByName(typeName);\r\n if (f) {\r\n return f;\r\n }\r\n }\r\n }\r\n }\r\n else if (name.includes(\"-\")) {\r\n const split = name.split(\"-\");\r\n const typeName = split[0];\r\n const fieldName = split[1];\r\n const type = this.scope.findType(typeName);\r\n if (type) {\r\n const stru = type.getType();\r\n if (stru instanceof basic_1.StructureType) {\r\n const f = stru.getComponentByName(fieldName);\r\n if (f) {\r\n return new _typed_identifier_1.TypedIdentifier(type.getToken(), type.getFilename(), f);\r\n }\r\n }\r\n }\r\n }\r\n const lookup = this.scope.getDDIC().lookupNoVoid(name);\r\n const id = (_a = lookup === null || lookup === void 0 ? void 0 : lookup.object) === null || _a === void 0 ? void 0 : _a.getIdentifier();\r\n if (id && (lookup === null || lookup === void 0 ? void 0 : lookup.type)) {\r\n return new _typed_identifier_1.TypedIdentifier(id.getToken(), id.getFilename(), lookup.type);\r\n }\r\n const builtin = this.scope.getDDIC().lookupBuiltinType(name);\r\n if (builtin) {\r\n return new _typed_identifier_1.TypedIdentifier(new identifier_1.Identifier(new position_1.Position(1, 1), name), _builtin_1.BuiltIn.filename, builtin);\r\n }\r\n const type = this.scope.findTypePoolType(name);\r\n if (type) {\r\n return type;\r\n }\r\n return undefined;\r\n }\r\n resolveLikeName(node, headerLogic = true) {\r\n var _a;\r\n if (node === undefined) {\r\n return undefined;\r\n }\r\n let chain = node.findFirstExpression(Expressions.FieldChain);\r\n if (chain === undefined) {\r\n chain = node.findFirstExpression(Expressions.TypeName);\r\n }\r\n if (chain === undefined) {\r\n chain = node.findFirstExpression(Expressions.FieldSub);\r\n }\r\n if (chain === undefined) {\r\n chain = node.findFirstExpression(Expressions.SimpleFieldChain);\r\n }\r\n if (chain === undefined) {\r\n throw new Error(\"resolveLikeName, chain undefined\");\r\n }\r\n const fullName = chain.concatTokens();\r\n const children = [...chain.getChildren()];\r\n if (children.length === 0) {\r\n return new Types.UnknownType(\"Type error, could not resolve \\\"\" + fullName + \"\\\", resolveLikeName1\");\r\n }\r\n let type = undefined;\r\n if (children[1] && (children[1].getFirstToken().getStr() === \"=>\" || children[1].getFirstToken().getStr() === \"->\")) {\r\n type = new field_chain_1.FieldChain().runSyntax(chain, this.scope, this.filename, _reference_1.ReferenceType.TypeReference);\r\n }\r\n else {\r\n const name = children.shift().getFirstToken().getStr();\r\n let found = this.scope.findVariable(name);\r\n type = found === null || found === void 0 ? void 0 : found.getType();\r\n if (found === undefined) {\r\n found = this.scope.findExtraLikeType(name);\r\n type = found === null || found === void 0 ? void 0 : found.getType();\r\n }\r\n if (found) {\r\n this.scope.addReference(chain === null || chain === void 0 ? void 0 : chain.getFirstToken(), found, _reference_1.ReferenceType.TypeReference, this.filename);\r\n }\r\n if (type === undefined) {\r\n type = (_a = this.scope.getDDIC().lookupNoVoid(name)) === null || _a === void 0 ? void 0 : _a.type;\r\n }\r\n if (type === undefined && this.scope.isOO() === false && this.scope.getDDIC().inErrorNamespace(name) === false) {\r\n this.scope.addReference(chain.getChildren()[0].getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.filename);\r\n return new Types.VoidType(name);\r\n }\r\n while (children.length > 0) {\r\n const child = children.shift();\r\n if (child.getFirstToken().getStr() === \"-\") {\r\n if (type instanceof Types.VoidType) {\r\n return type;\r\n }\r\n }\r\n else if (child.concatTokens() === \"[]\") {\r\n if (type instanceof Types.TableType) {\r\n type = new basic_1.TableType(type.getRowType(), { withHeader: false });\r\n }\r\n }\r\n else { // field name\r\n let sub = undefined;\r\n if (type instanceof Types.TableType) {\r\n type = type.getRowType();\r\n }\r\n if (type instanceof Types.StructureType) {\r\n sub = type.getComponentByName(child.getFirstToken().getStr());\r\n }\r\n if (sub === undefined) {\r\n return new Types.UnknownType(\"Type error, field not part of structure \" + fullName);\r\n }\r\n type = sub;\r\n }\r\n }\r\n if (type instanceof Types.VoidType) {\r\n return type;\r\n }\r\n else if (type instanceof basic_1.TableType\r\n && type.isWithHeader()\r\n && headerLogic === true) {\r\n type = type.getRowType();\r\n }\r\n else if (type instanceof Types.TableType\r\n && type.isWithHeader() === true\r\n && type.getRowType() instanceof Types.VoidType) {\r\n return type.getRowType();\r\n }\r\n }\r\n if (!type) {\r\n return new Types.UnknownType(\"Type error, could not resolve \\\"\" + fullName + \"\\\", resolveLikeName2\");\r\n }\r\n return type;\r\n }\r\n resolveTypeName(typeName, length, decimals, qualifiedName) {\r\n var _a;\r\n if (typeName === undefined) {\r\n return undefined;\r\n }\r\n let chain = this.resolveTypeChain(typeName);\r\n if (chain) {\r\n if (chain instanceof basic_1.CharacterType && qualifiedName) {\r\n chain = chain.cloneType(qualifiedName);\r\n }\r\n return chain;\r\n }\r\n const chainText = typeName.concatTokens().toUpperCase();\r\n const f = this.scope.getDDIC().lookupBuiltinType(chainText, length, decimals, qualifiedName);\r\n if (f !== undefined) {\r\n return f;\r\n }\r\n const typ = this.scope.findType(chainText);\r\n if (typ) {\r\n const token = typeName.getFirstToken();\r\n if (chainText.includes(\"~\")) {\r\n const name = chainText.split(\"~\")[0];\r\n const idef = this.scope.findInterfaceDefinition(name);\r\n if (idef) {\r\n this.scope.addReference(token, idef, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: \"INTF\", ooName: name });\r\n }\r\n }\r\n this.scope.addReference(token, typ, _reference_1.ReferenceType.TypeReference, this.filename);\r\n return typ.getType();\r\n }\r\n const type = (_a = this.scope.findTypePoolType(chainText)) === null || _a === void 0 ? void 0 : _a.getType();\r\n if (type) {\r\n // this.scope.addReference(typeName.getFirstToken(), type, ReferenceType.TypeReference, this.filename);\r\n return type;\r\n }\r\n const ddic = this.scope.getDDIC().lookup(chainText);\r\n if (ddic) {\r\n this.scope.getDDICReferences().addUsing(this.scope.getParentObj(), { object: ddic.object, token: typeName.getFirstToken(), filename: this.filename });\r\n if (ddic.type instanceof _typed_identifier_1.TypedIdentifier) {\r\n this.scope.addReference(typeName.getFirstToken(), ddic.type, _reference_1.ReferenceType.TypeReference, this.filename);\r\n }\r\n else if (ddic.type instanceof basic_1.VoidType) {\r\n this.scope.addReference(typeName.getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.filename);\r\n }\r\n return ddic.type;\r\n }\r\n return undefined;\r\n }\r\n simpleType(node, qualifiedNamePrefix) {\r\n let nameExpr = node.findFirstExpression(Expressions.NamespaceSimpleName);\r\n if (nameExpr === undefined) {\r\n nameExpr = node.findFirstExpression(Expressions.DefinitionName);\r\n }\r\n if (nameExpr === undefined) {\r\n return undefined;\r\n }\r\n let name = nameExpr.getFirstToken();\r\n if (nameExpr.countTokens() > 1) { // workaround for names with dashes\r\n name = new identifier_1.Identifier(name.getStart(), nameExpr.concatTokens());\r\n }\r\n let qualifiedName = undefined;\r\n if (node.get() instanceof Statements.Type) {\r\n if (this.scope.isTypePool() === true) {\r\n qualifiedName = name.getStr();\r\n }\r\n else {\r\n qualifiedName = (qualifiedNamePrefix || \"\") + name.getStr();\r\n if (this.scope.getType() === _scope_type_1.ScopeType.ClassDefinition\r\n || this.scope.getType() === _scope_type_1.ScopeType.Interface) {\r\n qualifiedName = this.scope.getName() + \"=>\" + qualifiedName;\r\n }\r\n }\r\n }\r\n else if (qualifiedNamePrefix) {\r\n qualifiedName = qualifiedNamePrefix + qualifiedName;\r\n }\r\n const found = this.parseType(node, qualifiedName);\r\n if (found) {\r\n return new _typed_identifier_1.TypedIdentifier(name, this.filename, found);\r\n }\r\n return undefined;\r\n }\r\n parseTable(node, name) {\r\n var _a;\r\n const typename = node.findFirstExpression(Expressions.TypeName);\r\n const text = (_a = node.findFirstExpression(Expressions.TypeTable)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();\r\n if (text === undefined) {\r\n return undefined;\r\n }\r\n let type = undefined;\r\n if (text.includes(\" STANDARD TABLE \")) {\r\n type = basic_1.TableAccessType.standard;\r\n }\r\n else if (text.includes(\" SORTED TABLE \")) {\r\n type = basic_1.TableAccessType.sorted;\r\n }\r\n else if (text.includes(\" HASHED TABLE \")) {\r\n type = basic_1.TableAccessType.hashed;\r\n }\r\n const keyFields = [];\r\n if (type) {\r\n const keys = node.findFirstExpression(expressions_1.TypeTableKey);\r\n for (const k of (keys === null || keys === void 0 ? void 0 : keys.findDirectExpressions(expressions_1.FieldSub)) || []) {\r\n keyFields.push(k.concatTokens().toUpperCase());\r\n }\r\n }\r\n const options = {\r\n withHeader: text.includes(\" WITH HEADER LINE\"),\r\n type: type,\r\n isUnique: text.includes(\" WITH UNIQUE\"),\r\n keyFields: keyFields,\r\n };\r\n let found = undefined;\r\n if (text.startsWith(\"TYPE TABLE OF REF TO \")\r\n || text.startsWith(\"TYPE STANDARD TABLE OF REF TO \")\r\n || text.startsWith(\"TYPE SORTED TABLE OF REF TO \")\r\n || text.startsWith(\"TYPE HASHED TABLE OF REF TO \")) {\r\n found = this.resolveTypeRef(typename);\r\n if (found) {\r\n return new Types.TableType(found, options, name);\r\n }\r\n }\r\n else if (text.startsWith(\"TYPE TABLE OF \")\r\n || text.startsWith(\"TYPE STANDARD TABLE OF \")\r\n || text.startsWith(\"TYPE SORTED TABLE OF \")\r\n || text.startsWith(\"TYPE HASHED TABLE OF \")) {\r\n found = this.resolveTypeName(typename);\r\n if (found) {\r\n return new Types.TableType(found, options, name);\r\n }\r\n }\r\n else if (text.startsWith(\"LIKE TABLE OF \")\r\n || text.startsWith(\"LIKE STANDARD TABLE OF \")\r\n || text.startsWith(\"LIKE SORTED TABLE OF \")\r\n || text.startsWith(\"LIKE HASHED TABLE OF \")) {\r\n found = this.resolveLikeName(node);\r\n if (found) {\r\n return new Types.TableType(found, options, name);\r\n }\r\n }\r\n else if (text === \"TYPE STANDARD TABLE\"\r\n || text === \"TYPE SORTED TABLE\"\r\n || text === \"TYPE HASHED TABLE\"\r\n || text === \"TYPE INDEX TABLE\"\r\n || text === \"TYPE ANY TABLE\") {\r\n return new Types.TableType(new Types.AnyType(), options);\r\n }\r\n else if (text.startsWith(\"TYPE RANGE OF \")) {\r\n const sub = node.findFirstExpression(Expressions.TypeName);\r\n found = this.resolveTypeName(sub);\r\n if (found === undefined) {\r\n return new Types.UnknownType(\"TYPE RANGE OF, could not resolve type\");\r\n }\r\n const structure = new Types.StructureType([\r\n { name: \"sign\", type: new Types.CharacterType(1) },\r\n { name: \"option\", type: new Types.CharacterType(2) },\r\n { name: \"low\", type: found },\r\n { name: \"high\", type: found },\r\n ]);\r\n return new Types.TableType(structure, options, name);\r\n }\r\n else if (text.startsWith(\"LIKE RANGE OF \")) {\r\n const sub = node.findFirstExpression(Expressions.SimpleFieldChain);\r\n found = this.resolveLikeName(sub);\r\n if (found === undefined) {\r\n return new Types.UnknownType(\"LIKE RANGE OF, could not resolve type\");\r\n }\r\n const structure = new Types.StructureType([\r\n { name: \"sign\", type: new Types.CharacterType(1) },\r\n { name: \"option\", type: new Types.CharacterType(2) },\r\n { name: \"low\", type: found },\r\n { name: \"high\", type: found },\r\n ], name);\r\n return new Types.TableType(structure, options);\r\n }\r\n // fallback to old style syntax, OCCURS etc\r\n return this.parseType(node, name);\r\n }\r\n parseType(node, qualifiedName) {\r\n var _a, _b, _c, _d, _e, _f;\r\n const typeName = node.findFirstExpression(Expressions.TypeName);\r\n let text = (_a = node.findFirstExpression(Expressions.Type)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();\r\n if (text === undefined) {\r\n text = (_b = node.findFirstExpression(Expressions.TypeParam)) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase();\r\n }\r\n if (text === undefined) {\r\n text = (_c = node.findFirstExpression(Expressions.TypeTable)) === null || _c === void 0 ? void 0 : _c.concatTokens().toUpperCase();\r\n if ((text === null || text === void 0 ? void 0 : text.startsWith(\"TYPE\")) === false && (text === null || text === void 0 ? void 0 : text.startsWith(\"LIKE\")) === false) {\r\n text = \"TYPE\";\r\n }\r\n }\r\n if (text === undefined) {\r\n text = (_d = node.findFirstExpression(Expressions.FormParamType)) === null || _d === void 0 ? void 0 : _d.concatTokens().toUpperCase();\r\n }\r\n if (text === undefined) {\r\n text = \"TYPE\";\r\n }\r\n let found = undefined;\r\n if (text.startsWith(\"LIKE LINE OF \")) {\r\n const name = (_e = node.findFirstExpression(Expressions.FieldChain)) === null || _e === void 0 ? void 0 : _e.concatTokens();\r\n let e = node.findFirstExpression(Expressions.Type);\r\n if (e === undefined) {\r\n e = node.findFirstExpression(Expressions.FormParamType);\r\n }\r\n const type = this.resolveLikeName(e, false);\r\n if (type === undefined) {\r\n return new Types.UnknownType(\"Type error, could not resolve \\\"\" + name + \"\\\", parseType\");\r\n }\r\n else if (type instanceof Types.TableType) {\r\n return type.getRowType();\r\n }\r\n else if (type instanceof Types.VoidType) {\r\n return type;\r\n }\r\n else {\r\n return new Types.UnknownType(\"Type error, not a table type \" + name);\r\n }\r\n }\r\n else if (text.startsWith(\"LIKE REF TO \")) {\r\n const name = (_f = node.findFirstExpression(Expressions.FieldChain)) === null || _f === void 0 ? void 0 : _f.concatTokens();\r\n const type = this.resolveLikeName(node.findFirstExpression(Expressions.Type), false);\r\n if (type === undefined) {\r\n return new Types.UnknownType(\"Type error, could not resolve \\\"\" + name + \"\\\", parseType\");\r\n }\r\n return new Types.DataReference(type, name);\r\n }\r\n else if (text === \"TYPE STANDARD TABLE\"\r\n || text === \"TYPE SORTED TABLE\"\r\n || text === \"TYPE HASHED TABLE\"\r\n || text === \"TYPE INDEX TABLE\"\r\n || text === \"TYPE ANY TABLE\") {\r\n return new Types.TableType(new Types.AnyType(), { withHeader: node.concatTokens().toUpperCase().includes(\"WITH HEADER LINE\") });\r\n }\r\n else if (text.startsWith(\"LIKE \")) {\r\n let sub = node.findFirstExpression(Expressions.Type);\r\n if (sub === undefined) {\r\n sub = node.findFirstExpression(Expressions.FormParamType);\r\n }\r\n if (sub === undefined) {\r\n sub = node.findFirstExpression(Expressions.TypeParam);\r\n }\r\n if (sub === undefined) {\r\n sub = node.findFirstExpression(Expressions.FieldChain);\r\n }\r\n found = this.resolveLikeName(sub);\r\n if (found && this.isOccurs(node)) {\r\n found = new Types.TableType(found, { withHeader: text.includes(\"WITH HEADER LINE\") }, qualifiedName);\r\n }\r\n }\r\n else if (text.startsWith(\"TYPE LINE OF \")) {\r\n const sub = node.findFirstExpression(Expressions.TypeName);\r\n found = this.resolveTypeName(sub);\r\n if (found instanceof _typed_identifier_1.TypedIdentifier) {\r\n found = found.getType();\r\n }\r\n if (found instanceof Types.TableType) {\r\n return found.getRowType();\r\n }\r\n else if (found instanceof Types.VoidType) {\r\n return found;\r\n }\r\n else if (found instanceof Types.UnknownType) {\r\n return new Types.UnknownType(\"TYPE LINE OF, unknown type, \" + found.getError());\r\n }\r\n else {\r\n return new Types.UnknownType(\"TYPE LINE OF, unexpected type, \" + (found === null || found === void 0 ? void 0 : found.constructor.name));\r\n }\r\n }\r\n else if (text.startsWith(\"TYPE REF TO \")) {\r\n found = this.resolveTypeRef(typeName);\r\n }\r\n else if (text.startsWith(\"TYPE\")) {\r\n found = this.resolveTypeName(typeName, this.findLength(node), this.findDecimals(node), qualifiedName);\r\n const concat = node.concatTokens().toUpperCase();\r\n if (found && this.isOccurs(node)) {\r\n found = new Types.TableType(found, { withHeader: concat.includes(\" WITH HEADER LINE\") }, qualifiedName);\r\n }\r\n else if (found && concat.includes(\" WITH HEADER LINE\")) {\r\n if (found instanceof Types.VoidType) {\r\n found = new Types.TableType(found, { withHeader: true });\r\n }\r\n else if (!(found instanceof Types.TableType)) {\r\n throw new Error(\"WITH HEADER LINE can only be used with internal table\");\r\n }\r\n else {\r\n found = new Types.TableType(found.getRowType(), { withHeader: true });\r\n }\r\n }\r\n if (found === undefined && typeName === undefined) {\r\n let length = 1;\r\n const len = node.findDirectExpression(Expressions.ConstantFieldLength);\r\n if (len) {\r\n const int = len.findDirectExpression(Expressions.Integer);\r\n if (int) {\r\n length = parseInt(int.concatTokens(), 10);\r\n }\r\n }\r\n found = new Types.CharacterType(length, qualifiedName); // fallback\r\n if (this.isOccurs(node)) {\r\n found = new Types.TableType(found, { withHeader: concat.includes(\" WITH HEADER LINE\") }, qualifiedName);\r\n }\r\n }\r\n }\r\n return found;\r\n }\r\n /////////////////////\r\n isOccurs(node) {\r\n var _a;\r\n if (node.findDirectTokenByText(\"OCCURS\")) {\r\n return true;\r\n }\r\n else if ((_a = node.findFirstExpression(Expressions.TypeTable)) === null || _a === void 0 ? void 0 : _a.findDirectTokenByText(\"OCCURS\")) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n // todo, rewrite this method\r\n resolveTypeChain(expr) {\r\n var _a;\r\n const chainText = expr.concatTokens().toUpperCase();\r\n if (chainText.includes(\"=>\") === false && chainText.includes(\"-\") === false) {\r\n return undefined;\r\n }\r\n let className;\r\n let rest = chainText;\r\n if (chainText.includes(\"=>\")) {\r\n const split = chainText.split(\"=>\");\r\n className = split[0];\r\n rest = split[1];\r\n }\r\n else if (chainText.includes(\"->\")) {\r\n const split = chainText.split(\"->\");\r\n className = split[0];\r\n rest = split[1];\r\n }\r\n const subs = rest.split(\"-\");\r\n let foundType = undefined;\r\n if (className && chainText.includes(\"=>\")) {\r\n const split = chainText.split(\"=>\");\r\n const className = split[0];\r\n // the prefix might be itself\r\n if ((this.scope.getType() === _scope_type_1.ScopeType.Interface\r\n || this.scope.getType() === _scope_type_1.ScopeType.ClassDefinition)\r\n && this.scope.getName().toUpperCase() === className.toUpperCase()) {\r\n const foundId = this.scope.findType(subs[0]);\r\n foundType = foundId === null || foundId === void 0 ? void 0 : foundId.getType();\r\n if (foundType === undefined) {\r\n return new Types.UnknownType(\"Could not resolve type \" + chainText);\r\n }\r\n this.scope.addReference(expr.getTokens()[2], foundId, _reference_1.ReferenceType.TypeReference, this.filename);\r\n }\r\n else {\r\n // lookup in local and global scope\r\n const obj = this.scope.findObjectDefinition(className);\r\n if (obj === undefined && this.scope.getDDIC().inErrorNamespace(className) === false) {\r\n this.scope.addReference(expr.getFirstToken(), undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, this.filename, { ooName: className.toUpperCase() });\r\n return new Types.VoidType(className);\r\n }\r\n else if (obj === undefined) {\r\n return new Types.UnknownType(\"Could not resolve top \" + className + \", resolveTypeChain\");\r\n }\r\n const type = obj instanceof types_1.ClassDefinition ? \"CLAS\" : \"INTF\";\r\n this.scope.addReference(expr.getFirstToken(), obj, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: type, ooName: className });\r\n const byName = new _object_oriented_1.ObjectOriented(this.scope).searchTypeName(obj, subs[0]);\r\n foundType = byName === null || byName === void 0 ? void 0 : byName.getType();\r\n if (byName === undefined || foundType === undefined) {\r\n return new Types.UnknownType(subs[0] + \" not found in class or interface\");\r\n }\r\n this.scope.addReference(expr.getTokens()[2], byName, _reference_1.ReferenceType.TypeReference, this.filename);\r\n }\r\n }\r\n else if (className && chainText.includes(\"->\")) {\r\n const varVar = this.scope.findVariable(className);\r\n const foo = varVar === null || varVar === void 0 ? void 0 : varVar.getType();\r\n if (foo instanceof basic_1.ObjectReferenceType) {\r\n const typeName = subs[0];\r\n const id = foo.getIdentifier();\r\n if (id instanceof types_1.ClassDefinition || id instanceof types_1.InterfaceDefinition) {\r\n const type = id instanceof types_1.ClassDefinition ? \"CLAS\" : \"INTF\";\r\n this.scope.addReference(expr.getFirstToken(), id, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: type, ooName: id.getName() });\r\n const byName = new _object_oriented_1.ObjectOriented(this.scope).searchTypeName(id, typeName);\r\n foundType = byName === null || byName === void 0 ? void 0 : byName.getType();\r\n if (byName === undefined || foundType === undefined) {\r\n return new Types.UnknownType(typeName + \" not found in class or interface\");\r\n }\r\n this.scope.addReference(expr.getTokens()[2], byName, _reference_1.ReferenceType.TypeReference, this.filename);\r\n }\r\n else {\r\n return new Types.UnknownType(\"Not a object reference, \" + className + \", \" + id.constructor.name);\r\n }\r\n }\r\n else if (foo === undefined) {\r\n return new Types.UnknownType(className + \" not found in scope\");\r\n }\r\n else {\r\n return new Types.UnknownType(\"Not a object reference, \" + className);\r\n }\r\n }\r\n else {\r\n const found = this.scope.findType(subs[0]);\r\n foundType = found === null || found === void 0 ? void 0 : found.getType();\r\n if (foundType === undefined) {\r\n const typePoolType = (_a = this.scope.findTypePoolType(subs[0])) === null || _a === void 0 ? void 0 : _a.getType();\r\n if (typePoolType) {\r\n // this.scope.addReference(typeName.getFirstToken(), typePoolType, ReferenceType.TypeReference, this.filename);\r\n foundType = typePoolType;\r\n }\r\n if (foundType === undefined) {\r\n const f = this.scope.getDDIC().lookupTableOrView(subs[0]);\r\n this.scope.getDDICReferences().addUsing(this.scope.getParentObj(), { object: f.object, filename: this.filename, token: expr.getFirstToken() });\r\n if (f.type instanceof _typed_identifier_1.TypedIdentifier) {\r\n foundType = f.type.getType();\r\n }\r\n else {\r\n foundType = f.type;\r\n }\r\n }\r\n }\r\n else {\r\n this.scope.addReference(expr.getFirstToken(), found, _reference_1.ReferenceType.TypeReference, this.filename);\r\n }\r\n if (foundType === undefined && this.scope.getDDIC().inErrorNamespace(subs[0]) === false) {\r\n this.scope.addReference(expr.getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.filename);\r\n return new Types.VoidType(subs[0]);\r\n }\r\n else if (foundType instanceof Types.VoidType) {\r\n this.scope.addReference(expr.getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.filename);\r\n return foundType;\r\n }\r\n else if (foundType === undefined) {\r\n return new Types.UnknownType(\"Unknown type \" + subs[0]);\r\n }\r\n }\r\n subs.shift();\r\n while (subs.length > 0) {\r\n if (foundType instanceof Types.UnknownType\r\n || foundType instanceof Types.VoidType) {\r\n return foundType;\r\n }\r\n else if (!(foundType instanceof Types.StructureType)) {\r\n return new Types.UnknownType(\"Not a structured type\");\r\n }\r\n foundType = foundType.getComponentByName(subs[0]);\r\n subs.shift();\r\n }\r\n return foundType;\r\n }\r\n resolveConstantValue(expr) {\r\n var _a, _b;\r\n if (!(expr.get() instanceof Expressions.SimpleFieldChain)) {\r\n throw new Error(\"resolveConstantValue\");\r\n }\r\n const firstNode = expr.getFirstChild();\r\n const firstToken = firstNode.getFirstToken();\r\n const firstName = firstToken.getStr();\r\n if (firstNode.get() instanceof Expressions.Field) {\r\n const found = this.scope.findVariable(firstName);\r\n const val = found === null || found === void 0 ? void 0 : found.getValue();\r\n if (typeof val === \"string\") {\r\n this.scope.addReference(firstToken, found, _reference_1.ReferenceType.DataReadReference, this.filename);\r\n return val;\r\n }\r\n return undefined;\r\n }\r\n else if (firstNode.get() instanceof Expressions.ClassName\r\n && firstName.toLowerCase() === this.scope.getName().toLowerCase()\r\n && (this.scope.getType() === _scope_type_1.ScopeType.Interface\r\n || this.scope.getType() === _scope_type_1.ScopeType.ClassDefinition)) {\r\n const children = expr.getChildren();\r\n const token = (_a = children[2]) === null || _a === void 0 ? void 0 : _a.getFirstToken();\r\n const found = this.scope.findVariable(token.getStr());\r\n const val = found === null || found === void 0 ? void 0 : found.getValue();\r\n if (typeof val === \"string\") {\r\n this.scope.addReference(firstToken, found, _reference_1.ReferenceType.DataReadReference, this.filename);\r\n return val;\r\n }\r\n return undefined;\r\n }\r\n else if (firstNode.get() instanceof Expressions.ClassName) {\r\n const obj = this.scope.findObjectDefinition(firstName);\r\n if (obj === undefined) {\r\n if (this.scope.existsObject(firstName).found === true) {\r\n return undefined;\r\n }\r\n else if (this.scope.getDDIC().inErrorNamespace(firstName) === true) {\r\n throw new Error(\"resolveConstantValue, not found: \" + firstName);\r\n }\r\n else {\r\n this.scope.addReference(firstNode.getFirstToken(), undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, this.filename, { ooName: firstName.toUpperCase() });\r\n return undefined;\r\n }\r\n }\r\n const children = expr.getChildren();\r\n const token = (_b = children[2]) === null || _b === void 0 ? void 0 : _b.getFirstToken();\r\n const attr = token.getStr();\r\n const c = new _object_oriented_1.ObjectOriented(this.scope).searchConstantName(obj, attr);\r\n if (c instanceof class_constant_1.ClassConstant) {\r\n this.scope.addReference(token, c, _reference_1.ReferenceType.DataReadReference, this.filename);\r\n const val = c.getValue();\r\n if (typeof val === \"string\") {\r\n return val;\r\n }\r\n else if (typeof val === \"object\" && children[4]) {\r\n const name = children[4].getFirstToken().getStr();\r\n if (val[name] !== undefined) {\r\n return val[name];\r\n }\r\n }\r\n return undefined;\r\n }\r\n throw new Error(\"resolveConstantValue, constant not found \" + attr);\r\n }\r\n else {\r\n throw new Error(\"resolveConstantValue, unexpected structure\");\r\n }\r\n }\r\n resolveTypeRef(chain) {\r\n var _a;\r\n if (chain === undefined) {\r\n return undefined;\r\n }\r\n const name = chain.getFirstToken().getStr();\r\n if (chain.getAllTokens().length === 1) {\r\n if (name.toUpperCase() === \"OBJECT\") {\r\n return new Types.GenericObjectReferenceType();\r\n }\r\n const search = this.scope.existsObject(name);\r\n if (search.found === true && search.id) {\r\n this.scope.addReference(chain.getFirstToken(), search.id, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: search.ooType, ooName: name });\r\n return new Types.ObjectReferenceType(search.id, name);\r\n }\r\n }\r\n const found = this.resolveTypeName(chain);\r\n if (found && !(found instanceof Types.UnknownType) && !(found instanceof Types.VoidType)) {\r\n return new Types.DataReference(found);\r\n }\r\n else if (chain.concatTokens().toUpperCase() === \"DATA\") {\r\n return new Types.DataReference(new Types.AnyType());\r\n }\r\n if (this.scope.isBadiDef(name) === true) {\r\n return new Types.VoidType(name);\r\n }\r\n if (((_a = this.scope.getDDIC()) === null || _a === void 0 ? void 0 : _a.inErrorNamespace(name)) === false) {\r\n // this.scope.addReference(chain.getFirstToken(), undefined, ReferenceType.VoidType, this.filename);\r\n return new Types.VoidType(name);\r\n }\r\n return new Types.UnknownType(\"REF, unable to resolve \" + name);\r\n }\r\n findValue(node) {\r\n const val = node.findFirstExpression(Expressions.Value);\r\n if (val === undefined) {\r\n throw new Error(\"VALUE missing in expression\");\r\n }\r\n if (val.concatTokens().toUpperCase() === \"VALUE IS INITIAL\") {\r\n return undefined;\r\n }\r\n const constant = val.findFirstExpression(Expressions.Constant);\r\n if (constant) {\r\n return constant.concatTokens();\r\n }\r\n const chain = val.findFirstExpression(Expressions.SimpleFieldChain);\r\n if (chain) {\r\n return this.resolveConstantValue(chain);\r\n }\r\n throw new Error(\"findValue, unexpected\");\r\n }\r\n findDecimals(node) {\r\n var _a, _b;\r\n const dec = (_b = (_a = node.findDirectExpression(Expressions.Decimals)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Integer)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n if (dec) {\r\n return parseInt(dec, 10);\r\n }\r\n return undefined;\r\n }\r\n findLength(node) {\r\n const val = node.findFirstExpression(Expressions.Length);\r\n const flen = node.findFirstExpression(Expressions.ConstantFieldLength);\r\n if (val && flen) {\r\n throw new Error(\"Only specify length once\");\r\n }\r\n if (flen) {\r\n const cintExpr = flen.findFirstExpression(Expressions.Integer);\r\n if (cintExpr) {\r\n return this.parseInt(cintExpr.concatTokens());\r\n }\r\n const cchain = flen.findFirstExpression(Expressions.SimpleFieldChain);\r\n if (cchain) {\r\n const val = this.resolveConstantValue(cchain);\r\n return this.parseInt(val);\r\n }\r\n }\r\n if (val === undefined) {\r\n return 1;\r\n }\r\n const intExpr = val.findFirstExpression(Expressions.Integer);\r\n if (intExpr) {\r\n return this.parseInt(intExpr.concatTokens());\r\n }\r\n const strExpr = val.findFirstExpression(Expressions.ConstantString);\r\n if (strExpr) {\r\n return this.parseInt(strExpr.concatTokens());\r\n }\r\n const chain = val.findFirstExpression(Expressions.SimpleFieldChain);\r\n if (chain) {\r\n const val = this.resolveConstantValue(chain);\r\n return this.parseInt(val);\r\n }\r\n throw new Error(\"Unexpected, findLength\");\r\n }\r\n parseInt(text) {\r\n if (text === undefined) {\r\n return undefined;\r\n }\r\n if (text.startsWith(\"'\")) {\r\n text = text.split(\"'\")[1];\r\n }\r\n else if (text.startsWith(\"`\")) {\r\n text = text.split(\"`\")[1];\r\n }\r\n return parseInt(text, 10);\r\n }\r\n}\r\nexports.BasicTypes = BasicTypes;\r\n//# sourceMappingURL=basic_types.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/basic_types.js?");
|
|
6718
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.BasicTypes = void 0;\r\n/* eslint-disable default-case */\r\nconst _typed_identifier_1 = __webpack_require__(/*! ../types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\r\nconst Expressions = __webpack_require__(/*! ../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst Statements = __webpack_require__(/*! ../2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Types = __webpack_require__(/*! ../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst _scope_type_1 = __webpack_require__(/*! ./_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\r\nconst _object_oriented_1 = __webpack_require__(/*! ./_object_oriented */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js\");\r\nconst class_constant_1 = __webpack_require__(/*! ../types/class_constant */ \"./node_modules/@abaplint/core/build/src/abap/types/class_constant.js\");\r\nconst identifier_1 = __webpack_require__(/*! ../1_lexer/tokens/identifier */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/identifier.js\");\r\nconst _reference_1 = __webpack_require__(/*! ./_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nconst basic_1 = __webpack_require__(/*! ../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst field_chain_1 = __webpack_require__(/*! ./expressions/field_chain */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/field_chain.js\");\r\nconst types_1 = __webpack_require__(/*! ../types */ \"./node_modules/@abaplint/core/build/src/abap/types/index.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _builtin_1 = __webpack_require__(/*! ./_builtin */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_builtin.js\");\r\nconst position_1 = __webpack_require__(/*! ../../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nclass BasicTypes {\r\n constructor(filename, scope) {\r\n this.filename = filename;\r\n this.scope = scope;\r\n }\r\n lookupQualifiedName(name) {\r\n var _a;\r\n // argh, todo, rewrite this entire method, more argh\r\n if (name === undefined) {\r\n return undefined;\r\n }\r\n const found = this.scope.findType(name);\r\n if (found) {\r\n return found;\r\n }\r\n if (name.includes(\"=>\")) {\r\n const split = name.split(\"=>\");\r\n const ooName = split[0];\r\n const typeName = split[1];\r\n const oo = this.scope.findObjectDefinition(ooName);\r\n if (oo) {\r\n if (typeName.includes(\"-\")) {\r\n const split = typeName.split(\"-\");\r\n const subTypeName = split[0];\r\n const fieldName = split[1];\r\n const stru = oo.getTypeDefinitions().getByName(subTypeName);\r\n const struType = stru === null || stru === void 0 ? void 0 : stru.getType();\r\n if (stru && struType instanceof basic_1.StructureType) {\r\n const f = struType.getComponentByName(fieldName);\r\n if (f) {\r\n return new _typed_identifier_1.TypedIdentifier(stru.getToken(), stru.getFilename(), f);\r\n }\r\n }\r\n }\r\n else {\r\n const f = oo.getTypeDefinitions().getByName(typeName);\r\n if (f) {\r\n return f;\r\n }\r\n }\r\n }\r\n }\r\n else if (name.includes(\"-\")) {\r\n const split = name.split(\"-\");\r\n const typeName = split[0];\r\n const fieldName = split[1];\r\n const type = this.scope.findType(typeName);\r\n if (type) {\r\n const stru = type.getType();\r\n if (stru instanceof basic_1.StructureType) {\r\n const f = stru.getComponentByName(fieldName);\r\n if (f) {\r\n return new _typed_identifier_1.TypedIdentifier(type.getToken(), type.getFilename(), f);\r\n }\r\n }\r\n }\r\n }\r\n const lookup = this.scope.getDDIC().lookupNoVoid(name);\r\n const id = (_a = lookup === null || lookup === void 0 ? void 0 : lookup.object) === null || _a === void 0 ? void 0 : _a.getIdentifier();\r\n if (id && (lookup === null || lookup === void 0 ? void 0 : lookup.type)) {\r\n return new _typed_identifier_1.TypedIdentifier(id.getToken(), id.getFilename(), lookup.type);\r\n }\r\n const builtin = this.scope.getDDIC().lookupBuiltinType(name);\r\n if (builtin) {\r\n return new _typed_identifier_1.TypedIdentifier(new identifier_1.Identifier(new position_1.Position(1, 1), name), _builtin_1.BuiltIn.filename, builtin);\r\n }\r\n const type = this.scope.findTypePoolType(name);\r\n if (type) {\r\n return type;\r\n }\r\n return undefined;\r\n }\r\n resolveLikeName(node, headerLogic = true) {\r\n var _a;\r\n if (node === undefined) {\r\n return undefined;\r\n }\r\n let chain = node.findFirstExpression(Expressions.FieldChain);\r\n if (chain === undefined) {\r\n chain = node.findFirstExpression(Expressions.TypeName);\r\n }\r\n if (chain === undefined) {\r\n chain = node.findFirstExpression(Expressions.FieldSub);\r\n }\r\n if (chain === undefined) {\r\n chain = node.findFirstExpression(Expressions.SimpleFieldChain);\r\n }\r\n if (chain === undefined) {\r\n throw new Error(\"resolveLikeName, chain undefined\");\r\n }\r\n const fullName = chain.concatTokens();\r\n const children = [...chain.getChildren()];\r\n if (children.length === 0) {\r\n return new Types.UnknownType(\"Type error, could not resolve \\\"\" + fullName + \"\\\", resolveLikeName1\");\r\n }\r\n let type = undefined;\r\n if (children[1] && (children[1].getFirstToken().getStr() === \"=>\" || children[1].getFirstToken().getStr() === \"->\")) {\r\n type = new field_chain_1.FieldChain().runSyntax(chain, this.scope, this.filename, _reference_1.ReferenceType.TypeReference);\r\n }\r\n else {\r\n const name = children.shift().getFirstToken().getStr();\r\n let found = this.scope.findVariable(name);\r\n type = found === null || found === void 0 ? void 0 : found.getType();\r\n if (found === undefined) {\r\n found = this.scope.findExtraLikeType(name);\r\n type = found === null || found === void 0 ? void 0 : found.getType();\r\n }\r\n if (found) {\r\n this.scope.addReference(chain === null || chain === void 0 ? void 0 : chain.getFirstToken(), found, _reference_1.ReferenceType.TypeReference, this.filename);\r\n }\r\n if (type === undefined) {\r\n type = (_a = this.scope.getDDIC().lookupNoVoid(name)) === null || _a === void 0 ? void 0 : _a.type;\r\n }\r\n if (type === undefined && this.scope.isOO() === false && this.scope.getDDIC().inErrorNamespace(name) === false) {\r\n this.scope.addReference(chain.getChildren()[0].getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.filename);\r\n return new Types.VoidType(name);\r\n }\r\n while (children.length > 0) {\r\n const child = children.shift();\r\n if (child.getFirstToken().getStr() === \"-\") {\r\n if (type instanceof Types.VoidType) {\r\n return type;\r\n }\r\n }\r\n else if (child.concatTokens() === \"[]\") {\r\n if (type instanceof Types.TableType) {\r\n type = new basic_1.TableType(type.getRowType(), { withHeader: false });\r\n }\r\n }\r\n else { // field name\r\n let sub = undefined;\r\n if (type instanceof Types.TableType) {\r\n type = type.getRowType();\r\n }\r\n if (type instanceof Types.StructureType) {\r\n sub = type.getComponentByName(child.getFirstToken().getStr());\r\n }\r\n if (sub === undefined) {\r\n return new Types.UnknownType(\"Type error, field not part of structure \" + fullName);\r\n }\r\n type = sub;\r\n }\r\n }\r\n if (type instanceof Types.VoidType) {\r\n return type;\r\n }\r\n else if (type instanceof basic_1.TableType\r\n && type.isWithHeader()\r\n && headerLogic === true) {\r\n type = type.getRowType();\r\n }\r\n else if (type instanceof Types.TableType\r\n && type.isWithHeader() === true\r\n && type.getRowType() instanceof Types.VoidType) {\r\n return type.getRowType();\r\n }\r\n }\r\n if (!type) {\r\n return new Types.UnknownType(\"Type error, could not resolve \\\"\" + fullName + \"\\\", resolveLikeName2\");\r\n }\r\n return type;\r\n }\r\n resolveTypeName(typeName, length, decimals, qualifiedName) {\r\n var _a;\r\n if (typeName === undefined) {\r\n return undefined;\r\n }\r\n let chain = this.resolveTypeChain(typeName);\r\n if (chain) {\r\n if (chain instanceof basic_1.CharacterType && qualifiedName) {\r\n chain = chain.cloneType(qualifiedName);\r\n }\r\n return chain;\r\n }\r\n const chainText = typeName.concatTokens().toUpperCase();\r\n const f = this.scope.getDDIC().lookupBuiltinType(chainText, length, decimals, qualifiedName);\r\n if (f !== undefined) {\r\n return f;\r\n }\r\n const typ = this.scope.findType(chainText);\r\n if (typ) {\r\n const token = typeName.getFirstToken();\r\n if (chainText.includes(\"~\")) {\r\n const name = chainText.split(\"~\")[0];\r\n const idef = this.scope.findInterfaceDefinition(name);\r\n if (idef) {\r\n this.scope.addReference(token, idef, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: \"INTF\", ooName: name });\r\n }\r\n }\r\n this.scope.addReference(token, typ, _reference_1.ReferenceType.TypeReference, this.filename);\r\n return typ.getType();\r\n }\r\n const type = (_a = this.scope.findTypePoolType(chainText)) === null || _a === void 0 ? void 0 : _a.getType();\r\n if (type) {\r\n // this.scope.addReference(typeName.getFirstToken(), type, ReferenceType.TypeReference, this.filename);\r\n return type;\r\n }\r\n const ddic = this.scope.getDDIC().lookup(chainText);\r\n if (ddic) {\r\n this.scope.getDDICReferences().addUsing(this.scope.getParentObj(), { object: ddic.object, token: typeName.getFirstToken(), filename: this.filename });\r\n if (ddic.type instanceof _typed_identifier_1.TypedIdentifier) {\r\n this.scope.addReference(typeName.getFirstToken(), ddic.type, _reference_1.ReferenceType.TypeReference, this.filename);\r\n }\r\n else if (ddic.type instanceof basic_1.VoidType) {\r\n this.scope.addReference(typeName.getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.filename);\r\n }\r\n return ddic.type;\r\n }\r\n return undefined;\r\n }\r\n simpleType(node, qualifiedNamePrefix) {\r\n let nameExpr = node.findFirstExpression(Expressions.NamespaceSimpleName);\r\n if (nameExpr === undefined) {\r\n nameExpr = node.findFirstExpression(Expressions.DefinitionName);\r\n }\r\n if (nameExpr === undefined) {\r\n return undefined;\r\n }\r\n let name = nameExpr.getFirstToken();\r\n if (nameExpr.countTokens() > 1) { // workaround for names with dashes\r\n name = new identifier_1.Identifier(name.getStart(), nameExpr.concatTokens());\r\n }\r\n let qualifiedName = undefined;\r\n if (node.get() instanceof Statements.Type) {\r\n if (this.scope.isTypePool() === true) {\r\n qualifiedName = name.getStr();\r\n }\r\n else {\r\n qualifiedName = (qualifiedNamePrefix || \"\") + name.getStr();\r\n if (this.scope.getType() === _scope_type_1.ScopeType.ClassDefinition\r\n || this.scope.getType() === _scope_type_1.ScopeType.Interface) {\r\n qualifiedName = this.scope.getName() + \"=>\" + qualifiedName;\r\n }\r\n }\r\n }\r\n else if (qualifiedNamePrefix) {\r\n qualifiedName = qualifiedNamePrefix + qualifiedName;\r\n }\r\n const found = this.parseType(node, qualifiedName);\r\n if (found) {\r\n return new _typed_identifier_1.TypedIdentifier(name, this.filename, found);\r\n }\r\n return undefined;\r\n }\r\n parseTable(node, name) {\r\n var _a, _b;\r\n const typename = node.findFirstExpression(Expressions.TypeName);\r\n const text = (_a = node.findFirstExpression(Expressions.TypeTable)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();\r\n if (text === undefined) {\r\n return undefined;\r\n }\r\n let type = undefined;\r\n if (text.includes(\" STANDARD TABLE \")) {\r\n type = basic_1.TableAccessType.standard;\r\n }\r\n else if (text.includes(\" SORTED TABLE \")) {\r\n type = basic_1.TableAccessType.sorted;\r\n }\r\n else if (text.includes(\" HASHED TABLE \")) {\r\n type = basic_1.TableAccessType.hashed;\r\n }\r\n const keyFields = [];\r\n if (type) {\r\n const keys = node.findFirstExpression(expressions_1.TypeTableKey);\r\n for (const k of (keys === null || keys === void 0 ? void 0 : keys.findDirectExpressions(expressions_1.FieldSub)) || []) {\r\n keyFields.push(k.concatTokens().toUpperCase());\r\n }\r\n }\r\n const options = {\r\n withHeader: text.includes(\" WITH HEADER LINE\"),\r\n type: type,\r\n isUnique: text.includes(\" WITH UNIQUE\"),\r\n keyFields: keyFields,\r\n };\r\n let found = undefined;\r\n if (text.startsWith(\"TYPE TABLE OF REF TO \")\r\n || text.startsWith(\"TYPE STANDARD TABLE OF REF TO \")\r\n || text.startsWith(\"TYPE SORTED TABLE OF REF TO \")\r\n || text.startsWith(\"TYPE HASHED TABLE OF REF TO \")) {\r\n found = this.resolveTypeRef(typename);\r\n if (found) {\r\n return new Types.TableType(found, options, name);\r\n }\r\n }\r\n else if (text.startsWith(\"TYPE TABLE OF \")\r\n || text.startsWith(\"TYPE STANDARD TABLE OF \")\r\n || text.startsWith(\"TYPE SORTED TABLE OF \")\r\n || text.startsWith(\"TYPE HASHED TABLE OF \")) {\r\n found = this.resolveTypeName(typename);\r\n if (found) {\r\n return new Types.TableType(found, options, name);\r\n }\r\n }\r\n else if (text.startsWith(\"LIKE TABLE OF \")\r\n || text.startsWith(\"LIKE STANDARD TABLE OF \")\r\n || text.startsWith(\"LIKE SORTED TABLE OF \")\r\n || text.startsWith(\"LIKE HASHED TABLE OF \")) {\r\n found = this.resolveLikeName(node);\r\n if (found) {\r\n return new Types.TableType(found, options, name);\r\n }\r\n }\r\n else if (text === \"TYPE STANDARD TABLE\"\r\n || text === \"TYPE SORTED TABLE\"\r\n || text === \"TYPE HASHED TABLE\"\r\n || text === \"TYPE INDEX TABLE\"\r\n || text === \"TYPE ANY TABLE\") {\r\n return new Types.TableType(new Types.AnyType(), options);\r\n }\r\n else if (text.startsWith(\"TYPE RANGE OF \")) {\r\n const sub = node.findFirstExpression(Expressions.TypeName);\r\n found = this.resolveTypeName(sub);\r\n if (found === undefined) {\r\n return new Types.UnknownType(\"TYPE RANGE OF, could not resolve type\");\r\n }\r\n const structure = new Types.StructureType([\r\n { name: \"sign\", type: new Types.CharacterType(1) },\r\n { name: \"option\", type: new Types.CharacterType(2) },\r\n { name: \"low\", type: found },\r\n { name: \"high\", type: found },\r\n ]);\r\n return new Types.TableType(structure, options, name);\r\n }\r\n else if (text.startsWith(\"LIKE RANGE OF \")) {\r\n const sub = node.findFirstExpression(Expressions.SimpleFieldChain);\r\n found = this.resolveLikeName(sub);\r\n if (found === undefined) {\r\n return new Types.UnknownType(\"LIKE RANGE OF, could not resolve type\");\r\n }\r\n const structure = new Types.StructureType([\r\n { name: \"sign\", type: new Types.CharacterType(1) },\r\n { name: \"option\", type: new Types.CharacterType(2) },\r\n { name: \"low\", type: found },\r\n { name: \"high\", type: found },\r\n ], name);\r\n return new Types.TableType(structure, options);\r\n }\r\n else if (typename && (text.startsWith(\"TYPE TABLE FOR CREATE \")\r\n || text.startsWith(\"TYPE TABLE FOR UPDATE \"))) {\r\n const name = typename.concatTokens();\r\n const type = (_b = this.scope.getDDIC().lookupDDLS(name)) === null || _b === void 0 ? void 0 : _b.type;\r\n if (type) {\r\n return new Types.TableType(type, options);\r\n }\r\n else if (this.scope.getDDIC().inErrorNamespace(name)) {\r\n return new Types.UnknownType(`DDLS ${name} not found`);\r\n }\r\n else {\r\n return new Types.VoidType(name);\r\n }\r\n }\r\n // fallback to old style syntax, OCCURS etc\r\n return this.parseType(node, name);\r\n }\r\n parseType(node, qualifiedName) {\r\n var _a, _b, _c, _d, _e, _f;\r\n const typeName = node.findFirstExpression(Expressions.TypeName);\r\n let text = (_a = node.findFirstExpression(Expressions.Type)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();\r\n if (text === undefined) {\r\n text = (_b = node.findFirstExpression(Expressions.TypeParam)) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase();\r\n }\r\n if (text === undefined) {\r\n text = (_c = node.findFirstExpression(Expressions.TypeTable)) === null || _c === void 0 ? void 0 : _c.concatTokens().toUpperCase();\r\n if ((text === null || text === void 0 ? void 0 : text.startsWith(\"TYPE\")) === false && (text === null || text === void 0 ? void 0 : text.startsWith(\"LIKE\")) === false) {\r\n text = \"TYPE\";\r\n }\r\n }\r\n if (text === undefined) {\r\n text = (_d = node.findFirstExpression(Expressions.FormParamType)) === null || _d === void 0 ? void 0 : _d.concatTokens().toUpperCase();\r\n }\r\n if (text === undefined) {\r\n text = \"TYPE\";\r\n }\r\n let found = undefined;\r\n if (text.startsWith(\"LIKE LINE OF \")) {\r\n const name = (_e = node.findFirstExpression(Expressions.FieldChain)) === null || _e === void 0 ? void 0 : _e.concatTokens();\r\n let e = node.findFirstExpression(Expressions.Type);\r\n if (e === undefined) {\r\n e = node.findFirstExpression(Expressions.FormParamType);\r\n }\r\n const type = this.resolveLikeName(e, false);\r\n if (type === undefined) {\r\n return new Types.UnknownType(\"Type error, could not resolve \\\"\" + name + \"\\\", parseType\");\r\n }\r\n else if (type instanceof Types.TableType) {\r\n return type.getRowType();\r\n }\r\n else if (type instanceof Types.VoidType) {\r\n return type;\r\n }\r\n else {\r\n return new Types.UnknownType(\"Type error, not a table type \" + name);\r\n }\r\n }\r\n else if (text.startsWith(\"LIKE REF TO \")) {\r\n const name = (_f = node.findFirstExpression(Expressions.FieldChain)) === null || _f === void 0 ? void 0 : _f.concatTokens();\r\n const type = this.resolveLikeName(node.findFirstExpression(Expressions.Type), false);\r\n if (type === undefined) {\r\n return new Types.UnknownType(\"Type error, could not resolve \\\"\" + name + \"\\\", parseType\");\r\n }\r\n return new Types.DataReference(type, name);\r\n }\r\n else if (text === \"TYPE STANDARD TABLE\"\r\n || text === \"TYPE SORTED TABLE\"\r\n || text === \"TYPE HASHED TABLE\"\r\n || text === \"TYPE INDEX TABLE\"\r\n || text === \"TYPE ANY TABLE\") {\r\n return new Types.TableType(new Types.AnyType(), { withHeader: node.concatTokens().toUpperCase().includes(\"WITH HEADER LINE\") });\r\n }\r\n else if (text.startsWith(\"LIKE \")) {\r\n let sub = node.findFirstExpression(Expressions.Type);\r\n if (sub === undefined) {\r\n sub = node.findFirstExpression(Expressions.FormParamType);\r\n }\r\n if (sub === undefined) {\r\n sub = node.findFirstExpression(Expressions.TypeParam);\r\n }\r\n if (sub === undefined) {\r\n sub = node.findFirstExpression(Expressions.FieldChain);\r\n }\r\n found = this.resolveLikeName(sub);\r\n if (found && this.isOccurs(node)) {\r\n found = new Types.TableType(found, { withHeader: text.includes(\"WITH HEADER LINE\") }, qualifiedName);\r\n }\r\n }\r\n else if (text.startsWith(\"TYPE LINE OF \")) {\r\n const sub = node.findFirstExpression(Expressions.TypeName);\r\n found = this.resolveTypeName(sub);\r\n if (found instanceof _typed_identifier_1.TypedIdentifier) {\r\n found = found.getType();\r\n }\r\n if (found instanceof Types.TableType) {\r\n return found.getRowType();\r\n }\r\n else if (found instanceof Types.VoidType) {\r\n return found;\r\n }\r\n else if (found instanceof Types.UnknownType) {\r\n return new Types.UnknownType(\"TYPE LINE OF, unknown type, \" + found.getError());\r\n }\r\n else {\r\n return new Types.UnknownType(\"TYPE LINE OF, unexpected type, \" + (found === null || found === void 0 ? void 0 : found.constructor.name));\r\n }\r\n }\r\n else if (text.startsWith(\"TYPE REF TO \")) {\r\n found = this.resolveTypeRef(typeName);\r\n }\r\n else if (text.startsWith(\"TYPE\")) {\r\n found = this.resolveTypeName(typeName, this.findLength(node), this.findDecimals(node), qualifiedName);\r\n const concat = node.concatTokens().toUpperCase();\r\n if (found && this.isOccurs(node)) {\r\n found = new Types.TableType(found, { withHeader: concat.includes(\" WITH HEADER LINE\") }, qualifiedName);\r\n }\r\n else if (found && concat.includes(\" WITH HEADER LINE\")) {\r\n if (found instanceof Types.VoidType) {\r\n found = new Types.TableType(found, { withHeader: true });\r\n }\r\n else if (!(found instanceof Types.TableType)) {\r\n throw new Error(\"WITH HEADER LINE can only be used with internal table\");\r\n }\r\n else {\r\n found = new Types.TableType(found.getRowType(), { withHeader: true });\r\n }\r\n }\r\n if (found === undefined && typeName === undefined) {\r\n let length = 1;\r\n const len = node.findDirectExpression(Expressions.ConstantFieldLength);\r\n if (len) {\r\n const int = len.findDirectExpression(Expressions.Integer);\r\n if (int) {\r\n length = parseInt(int.concatTokens(), 10);\r\n }\r\n }\r\n found = new Types.CharacterType(length, qualifiedName); // fallback\r\n if (this.isOccurs(node)) {\r\n found = new Types.TableType(found, { withHeader: concat.includes(\" WITH HEADER LINE\") }, qualifiedName);\r\n }\r\n }\r\n }\r\n return found;\r\n }\r\n /////////////////////\r\n isOccurs(node) {\r\n var _a;\r\n if (node.findDirectTokenByText(\"OCCURS\")) {\r\n return true;\r\n }\r\n else if ((_a = node.findFirstExpression(Expressions.TypeTable)) === null || _a === void 0 ? void 0 : _a.findDirectTokenByText(\"OCCURS\")) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n // todo, rewrite this method\r\n resolveTypeChain(expr) {\r\n var _a;\r\n const chainText = expr.concatTokens().toUpperCase();\r\n if (chainText.includes(\"=>\") === false && chainText.includes(\"-\") === false) {\r\n return undefined;\r\n }\r\n let className;\r\n let rest = chainText;\r\n if (chainText.includes(\"=>\")) {\r\n const split = chainText.split(\"=>\");\r\n className = split[0];\r\n rest = split[1];\r\n }\r\n else if (chainText.includes(\"->\")) {\r\n const split = chainText.split(\"->\");\r\n className = split[0];\r\n rest = split[1];\r\n }\r\n const subs = rest.split(\"-\");\r\n let foundType = undefined;\r\n if (className && chainText.includes(\"=>\")) {\r\n const split = chainText.split(\"=>\");\r\n const className = split[0];\r\n // the prefix might be itself\r\n if ((this.scope.getType() === _scope_type_1.ScopeType.Interface\r\n || this.scope.getType() === _scope_type_1.ScopeType.ClassDefinition)\r\n && this.scope.getName().toUpperCase() === className.toUpperCase()) {\r\n const foundId = this.scope.findType(subs[0]);\r\n foundType = foundId === null || foundId === void 0 ? void 0 : foundId.getType();\r\n if (foundType === undefined) {\r\n return new Types.UnknownType(\"Could not resolve type \" + chainText);\r\n }\r\n this.scope.addReference(expr.getTokens()[2], foundId, _reference_1.ReferenceType.TypeReference, this.filename);\r\n }\r\n else {\r\n // lookup in local and global scope\r\n const obj = this.scope.findObjectDefinition(className);\r\n if (obj === undefined && this.scope.getDDIC().inErrorNamespace(className) === false) {\r\n this.scope.addReference(expr.getFirstToken(), undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, this.filename, { ooName: className.toUpperCase() });\r\n return new Types.VoidType(className);\r\n }\r\n else if (obj === undefined) {\r\n return new Types.UnknownType(\"Could not resolve top \" + className + \", resolveTypeChain\");\r\n }\r\n const type = obj instanceof types_1.ClassDefinition ? \"CLAS\" : \"INTF\";\r\n this.scope.addReference(expr.getFirstToken(), obj, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: type, ooName: className });\r\n const byName = new _object_oriented_1.ObjectOriented(this.scope).searchTypeName(obj, subs[0]);\r\n foundType = byName === null || byName === void 0 ? void 0 : byName.getType();\r\n if (byName === undefined || foundType === undefined) {\r\n return new Types.UnknownType(subs[0] + \" not found in class or interface\");\r\n }\r\n this.scope.addReference(expr.getTokens()[2], byName, _reference_1.ReferenceType.TypeReference, this.filename);\r\n }\r\n }\r\n else if (className && chainText.includes(\"->\")) {\r\n const varVar = this.scope.findVariable(className);\r\n const foo = varVar === null || varVar === void 0 ? void 0 : varVar.getType();\r\n if (foo instanceof basic_1.ObjectReferenceType) {\r\n const typeName = subs[0];\r\n let id = foo.getIdentifier();\r\n if (!(id instanceof types_1.ClassDefinition || id instanceof types_1.InterfaceDefinition)) {\r\n const found = this.scope.findObjectDefinition(foo.getIdentifierName());\r\n if (found) {\r\n id = found;\r\n }\r\n else {\r\n return new Types.UnknownType(foo.getIdentifierName() + \" not found in scope\");\r\n }\r\n }\r\n if (id instanceof types_1.ClassDefinition || id instanceof types_1.InterfaceDefinition) {\r\n const type = id instanceof types_1.ClassDefinition ? \"CLAS\" : \"INTF\";\r\n this.scope.addReference(expr.getFirstToken(), id, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: type, ooName: id.getName() });\r\n const byName = new _object_oriented_1.ObjectOriented(this.scope).searchTypeName(id, typeName);\r\n foundType = byName === null || byName === void 0 ? void 0 : byName.getType();\r\n if (byName === undefined || foundType === undefined) {\r\n return new Types.UnknownType(typeName + \" not found in class or interface\");\r\n }\r\n this.scope.addReference(expr.getTokens()[2], byName, _reference_1.ReferenceType.TypeReference, this.filename);\r\n }\r\n else {\r\n return new Types.UnknownType(\"Not a object reference, \" + className + \", \" + id.constructor.name);\r\n }\r\n }\r\n else if (foo === undefined) {\r\n return new Types.UnknownType(className + \" not found in scope\");\r\n }\r\n else {\r\n return new Types.UnknownType(\"Not a object reference, \" + className + \", \" + foo.constructor.name);\r\n }\r\n }\r\n else {\r\n const found = this.scope.findType(subs[0]);\r\n foundType = found === null || found === void 0 ? void 0 : found.getType();\r\n if (foundType === undefined) {\r\n const typePoolType = (_a = this.scope.findTypePoolType(subs[0])) === null || _a === void 0 ? void 0 : _a.getType();\r\n if (typePoolType) {\r\n // this.scope.addReference(typeName.getFirstToken(), typePoolType, ReferenceType.TypeReference, this.filename);\r\n foundType = typePoolType;\r\n }\r\n if (foundType === undefined) {\r\n const f = this.scope.getDDIC().lookupTableOrView(subs[0]);\r\n this.scope.getDDICReferences().addUsing(this.scope.getParentObj(), { object: f.object, filename: this.filename, token: expr.getFirstToken() });\r\n if (f.type instanceof _typed_identifier_1.TypedIdentifier) {\r\n foundType = f.type.getType();\r\n }\r\n else {\r\n foundType = f.type;\r\n }\r\n }\r\n }\r\n else {\r\n this.scope.addReference(expr.getFirstToken(), found, _reference_1.ReferenceType.TypeReference, this.filename);\r\n }\r\n if (foundType === undefined && this.scope.getDDIC().inErrorNamespace(subs[0]) === false) {\r\n this.scope.addReference(expr.getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.filename);\r\n return new Types.VoidType(subs[0]);\r\n }\r\n else if (foundType instanceof Types.VoidType) {\r\n this.scope.addReference(expr.getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.filename);\r\n return foundType;\r\n }\r\n else if (foundType === undefined) {\r\n return new Types.UnknownType(\"Unknown type \" + subs[0]);\r\n }\r\n }\r\n subs.shift();\r\n while (subs.length > 0) {\r\n if (foundType instanceof Types.UnknownType\r\n || foundType instanceof Types.VoidType) {\r\n return foundType;\r\n }\r\n else if (!(foundType instanceof Types.StructureType)) {\r\n return new Types.UnknownType(\"Not a structured type\");\r\n }\r\n foundType = foundType.getComponentByName(subs[0]);\r\n subs.shift();\r\n }\r\n return foundType;\r\n }\r\n resolveConstantValue(expr) {\r\n var _a, _b;\r\n if (!(expr.get() instanceof Expressions.SimpleFieldChain)) {\r\n throw new Error(\"resolveConstantValue\");\r\n }\r\n const firstNode = expr.getFirstChild();\r\n const firstToken = firstNode.getFirstToken();\r\n const firstName = firstToken.getStr();\r\n if (firstNode.get() instanceof Expressions.Field) {\r\n const found = this.scope.findVariable(firstName);\r\n const val = found === null || found === void 0 ? void 0 : found.getValue();\r\n if (typeof val === \"string\") {\r\n this.scope.addReference(firstToken, found, _reference_1.ReferenceType.DataReadReference, this.filename);\r\n return val;\r\n }\r\n return undefined;\r\n }\r\n else if (firstNode.get() instanceof Expressions.ClassName\r\n && firstName.toLowerCase() === this.scope.getName().toLowerCase()\r\n && (this.scope.getType() === _scope_type_1.ScopeType.Interface\r\n || this.scope.getType() === _scope_type_1.ScopeType.ClassDefinition)) {\r\n const children = expr.getChildren();\r\n const token = (_a = children[2]) === null || _a === void 0 ? void 0 : _a.getFirstToken();\r\n const found = this.scope.findVariable(token.getStr());\r\n const val = found === null || found === void 0 ? void 0 : found.getValue();\r\n if (typeof val === \"string\") {\r\n this.scope.addReference(firstToken, found, _reference_1.ReferenceType.DataReadReference, this.filename);\r\n return val;\r\n }\r\n return undefined;\r\n }\r\n else if (firstNode.get() instanceof Expressions.ClassName) {\r\n const obj = this.scope.findObjectDefinition(firstName);\r\n if (obj === undefined) {\r\n if (this.scope.existsObject(firstName).found === true) {\r\n return undefined;\r\n }\r\n else if (this.scope.getDDIC().inErrorNamespace(firstName) === true) {\r\n throw new Error(\"resolveConstantValue, not found: \" + firstName);\r\n }\r\n else {\r\n this.scope.addReference(firstNode.getFirstToken(), undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, this.filename, { ooName: firstName.toUpperCase() });\r\n return undefined;\r\n }\r\n }\r\n const children = expr.getChildren();\r\n const token = (_b = children[2]) === null || _b === void 0 ? void 0 : _b.getFirstToken();\r\n const attr = token.getStr();\r\n const c = new _object_oriented_1.ObjectOriented(this.scope).searchConstantName(obj, attr);\r\n if (c instanceof class_constant_1.ClassConstant) {\r\n this.scope.addReference(token, c, _reference_1.ReferenceType.DataReadReference, this.filename);\r\n const val = c.getValue();\r\n if (typeof val === \"string\") {\r\n return val;\r\n }\r\n else if (typeof val === \"object\" && children[4]) {\r\n const name = children[4].getFirstToken().getStr();\r\n if (val[name] !== undefined) {\r\n return val[name];\r\n }\r\n }\r\n return undefined;\r\n }\r\n throw new Error(\"resolveConstantValue, constant not found \" + attr);\r\n }\r\n else {\r\n throw new Error(\"resolveConstantValue, unexpected structure\");\r\n }\r\n }\r\n resolveTypeRef(chain) {\r\n var _a;\r\n if (chain === undefined) {\r\n return undefined;\r\n }\r\n const name = chain.getFirstToken().getStr();\r\n if (chain.getAllTokens().length === 1) {\r\n if (name.toUpperCase() === \"OBJECT\") {\r\n return new Types.GenericObjectReferenceType();\r\n }\r\n const search = this.scope.existsObject(name);\r\n if (search.found === true && search.id) {\r\n this.scope.addReference(chain.getFirstToken(), search.id, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: search.ooType, ooName: name });\r\n return new Types.ObjectReferenceType(search.id, name);\r\n }\r\n }\r\n const found = this.resolveTypeName(chain);\r\n if (found && !(found instanceof Types.UnknownType) && !(found instanceof Types.VoidType)) {\r\n return new Types.DataReference(found);\r\n }\r\n else if (chain.concatTokens().toUpperCase() === \"DATA\") {\r\n return new Types.DataReference(new Types.AnyType());\r\n }\r\n if (this.scope.isBadiDef(name) === true) {\r\n return new Types.VoidType(name);\r\n }\r\n if (((_a = this.scope.getDDIC()) === null || _a === void 0 ? void 0 : _a.inErrorNamespace(name)) === false) {\r\n // this.scope.addReference(chain.getFirstToken(), undefined, ReferenceType.VoidType, this.filename);\r\n return new Types.VoidType(name);\r\n }\r\n return new Types.UnknownType(\"REF, unable to resolve \" + name);\r\n }\r\n findValue(node) {\r\n const val = node.findFirstExpression(Expressions.Value);\r\n if (val === undefined) {\r\n throw new Error(\"VALUE missing in expression\");\r\n }\r\n if (val.concatTokens().toUpperCase() === \"VALUE IS INITIAL\") {\r\n return undefined;\r\n }\r\n const constant = val.findFirstExpression(Expressions.Constant);\r\n if (constant) {\r\n return constant.concatTokens();\r\n }\r\n const chain = val.findFirstExpression(Expressions.SimpleFieldChain);\r\n if (chain) {\r\n return this.resolveConstantValue(chain);\r\n }\r\n throw new Error(\"findValue, unexpected\");\r\n }\r\n findDecimals(node) {\r\n var _a, _b;\r\n const dec = (_b = (_a = node.findDirectExpression(Expressions.Decimals)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Integer)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n if (dec) {\r\n return parseInt(dec, 10);\r\n }\r\n return undefined;\r\n }\r\n findLength(node) {\r\n const val = node.findFirstExpression(Expressions.Length);\r\n const flen = node.findFirstExpression(Expressions.ConstantFieldLength);\r\n if (val && flen) {\r\n throw new Error(\"Only specify length once\");\r\n }\r\n if (flen) {\r\n const cintExpr = flen.findFirstExpression(Expressions.Integer);\r\n if (cintExpr) {\r\n return this.parseInt(cintExpr.concatTokens());\r\n }\r\n const cchain = flen.findFirstExpression(Expressions.SimpleFieldChain);\r\n if (cchain) {\r\n const val = this.resolveConstantValue(cchain);\r\n return this.parseInt(val);\r\n }\r\n }\r\n if (val === undefined) {\r\n return 1;\r\n }\r\n const intExpr = val.findFirstExpression(Expressions.Integer);\r\n if (intExpr) {\r\n return this.parseInt(intExpr.concatTokens());\r\n }\r\n const strExpr = val.findFirstExpression(Expressions.ConstantString);\r\n if (strExpr) {\r\n return this.parseInt(strExpr.concatTokens());\r\n }\r\n const chain = val.findFirstExpression(Expressions.SimpleFieldChain);\r\n if (chain) {\r\n const val = this.resolveConstantValue(chain);\r\n return this.parseInt(val);\r\n }\r\n throw new Error(\"Unexpected, findLength\");\r\n }\r\n parseInt(text) {\r\n if (text === undefined) {\r\n return undefined;\r\n }\r\n if (text.startsWith(\"'\")) {\r\n text = text.split(\"'\")[1];\r\n }\r\n else if (text.startsWith(\"`\")) {\r\n text = text.split(\"`\")[1];\r\n }\r\n return parseInt(text, 10);\r\n }\r\n}\r\nexports.BasicTypes = BasicTypes;\r\n//# sourceMappingURL=basic_types.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/basic_types.js?");
|
|
6719
6719
|
|
|
6720
6720
|
/***/ }),
|
|
6721
6721
|
|
|
@@ -9872,7 +9872,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
9872
9872
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
9873
9873
|
|
|
9874
9874
|
"use strict";
|
|
9875
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DDIC = void 0;\r\nconst Types = __webpack_require__(/*! ./abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst basic_1 = __webpack_require__(/*! ./abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nclass DDIC {\r\n constructor(reg) {\r\n this.reg = reg;\r\n }\r\n // the class might be local with a local super class with a global exception class as super\r\n // todo: returns true for both local and global exception classes\r\n isException(def, _obj) {\r\n var _a;\r\n if (def === undefined) {\r\n return false;\r\n }\r\n if (def.name.toUpperCase() === \"CX_ROOT\") {\r\n return true;\r\n }\r\n let superClassName = def.superClassName;\r\n if (superClassName === undefined) {\r\n return false;\r\n }\r\n let i = 0;\r\n // max depth, make sure not to hit cyclic super class defintions\r\n while (i++ < 10 && superClassName !== undefined) {\r\n const found = this.reg.getObject(\"CLAS\", superClassName);\r\n if (found === undefined) {\r\n break;\r\n }\r\n const superDef = (_a = found.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getInfo().getClassDefinitionByName(superClassName);\r\n if (superDef === undefined) {\r\n break;\r\n }\r\n if (superDef.superClassName) {\r\n superClassName = superDef.superClassName;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n // todo, this should check for \"CX_ROOT\"\r\n const isException = ((superClassName === null || superClassName === void 0 ? void 0 : superClassName.match(/^.?cx_.*$/i)) || (superClassName === null || superClassName === void 0 ? void 0 : superClassName.match(/^\\/.+\\/cx_.*$/i))) ? true : false;\r\n return isException;\r\n }\r\n lookupBuiltinType(name, length, decimals, qualifiedName) {\r\n switch (name) {\r\n case \"STRING\":\r\n return new Types.StringType(qualifiedName || name);\r\n case \"XSTRING\":\r\n return new Types.XStringType(qualifiedName || name);\r\n case \"D\":\r\n return new Types.DateType(qualifiedName || name);\r\n case \"T\":\r\n return new Types.TimeType(qualifiedName || name);\r\n case \"XSEQUENCE\":\r\n return new Types.XSequenceType(qualifiedName);\r\n case \"CLIKE\":\r\n return new Types.CLikeType(qualifiedName);\r\n case \"DECFLOAT\":\r\n return new Types.DecFloatType(qualifiedName);\r\n case \"ANY\":\r\n return new Types.AnyType(qualifiedName);\r\n case \"SIMPLE\":\r\n return new Types.SimpleType(qualifiedName);\r\n case \"%_C_POINTER\":\r\n return new Types.HexType(8, qualifiedName);\r\n case \"TABLE\":\r\n return new Types.TableType(new Types.AnyType(), { withHeader: false });\r\n case \"DATA\":\r\n return new Types.AnyType(qualifiedName);\r\n case \"NUMERIC\":\r\n return new Types.NumericGenericType(qualifiedName);\r\n case \"UTCLONG\": // todo, take version into account\r\n return new Types.UTCLongType(qualifiedName);\r\n case \"DECFLOAT16\":\r\n return new Types.DecFloat16Type(qualifiedName);\r\n case \"DECFLOAT34\":\r\n return new Types.DecFloat34Type(qualifiedName);\r\n case \"CSEQUENCE\":\r\n return new Types.CSequenceType(qualifiedName);\r\n case \"I\":\r\n case \"INT8\": // todo, take version into account\r\n return new Types.IntegerType(qualifiedName || name);\r\n case \"F\":\r\n return new Types.FloatType(qualifiedName || name);\r\n case \"P\":\r\n if (length && decimals) {\r\n return new Types.PackedType(length, decimals, qualifiedName);\r\n }\r\n else if (length) {\r\n return new Types.PackedType(length, 0, qualifiedName);\r\n }\r\n else {\r\n return new Types.PackedType(1, 0, qualifiedName);\r\n }\r\n case \"C\":\r\n if (length) {\r\n return new Types.CharacterType(length, qualifiedName);\r\n }\r\n else {\r\n return new Types.CharacterType(1, qualifiedName);\r\n }\r\n case \"X\":\r\n if (length) {\r\n return new Types.HexType(length, qualifiedName);\r\n }\r\n else {\r\n return new Types.HexType(1, qualifiedName);\r\n }\r\n case \"N\":\r\n if (length) {\r\n return new Types.NumericType(length, qualifiedName);\r\n }\r\n else {\r\n return new Types.NumericType(1, qualifiedName);\r\n }\r\n }\r\n return undefined;\r\n }\r\n inErrorNamespace(name) {\r\n if (name === undefined) {\r\n return true;\r\n }\r\n return this.reg.inErrorNamespace(name);\r\n }\r\n lookupObject(name) {\r\n const clas = this.reg.getObject(\"CLAS\", name);\r\n const globalClas = clas === null || clas === void 0 ? void 0 : clas.getIdentifier();\r\n if (globalClas) {\r\n return { type: new basic_1.ObjectReferenceType(globalClas, name), object: clas };\r\n }\r\n const intf = this.reg.getObject(\"INTF\", name);\r\n const globalIntf = intf === null || intf === void 0 ? void 0 : intf.getIdentifier();\r\n if (globalIntf) {\r\n return { type: new basic_1.ObjectReferenceType(globalIntf, name), object: intf };\r\n }\r\n if (this.inErrorNamespace(name) === true) {\r\n return { type: new basic_1.UnknownType(name) };\r\n }\r\n else {\r\n return { type: new basic_1.VoidType(name) };\r\n }\r\n }\r\n lookupNoVoid(name) {\r\n var _a;\r\n const foundTABL = this.reg.getObject(\"TABL\", name);\r\n if (foundTABL) {\r\n return { type: foundTABL.parseType(this.reg), object: foundTABL };\r\n }\r\n const foundVIEW = this.reg.getObject(\"VIEW\", name);\r\n if (foundVIEW) {\r\n return { type: foundVIEW.parseType(this.reg), object: foundVIEW };\r\n }\r\n const foundTTYP = this.reg.getObject(\"TTYP\", name);\r\n if (foundTTYP) {\r\n return { type: foundTTYP.parseType(this.reg), object: foundTTYP };\r\n }\r\n const foundDTEL = this.reg.getObject(\"DTEL\", name);\r\n if (foundDTEL) {\r\n return { type: foundDTEL.parseType(this.reg), object: foundDTEL };\r\n }\r\n const upper = name.toUpperCase();\r\n for (const obj of this.reg.getObjectsByType(\"DDLS\")) {\r\n const ddls = obj;\r\n if (ddls.getSQLViewName() === upper || ((_a = ddls.getDefinitionName()) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === upper) {\r\n return { type: ddls.parseType(this.reg), object: obj };\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** lookup with voiding and unknown types */\r\n lookup(name) {\r\n const found = this.lookupNoVoid(name);\r\n if (found) {\r\n return found;\r\n }\r\n if (this.reg.inErrorNamespace(name)) {\r\n return { type: new Types.UnknownType(name + \" not found, lookup\") };\r\n }\r\n else {\r\n return { type: new Types.VoidType(name) };\r\n }\r\n }\r\n lookupDomain(name, parent) {\r\n const found = this.reg.getObject(\"DOMA\", name);\r\n if (found) {\r\n return { type: found.parseType(this.reg, parent), object: found };\r\n }\r\n else if (this.reg.inErrorNamespace(name)) {\r\n return { type: new Types.UnknownType(name + \", lookupDomain\"), object: undefined };\r\n }\r\n else {\r\n return { type: new Types.VoidType(name), object: undefined };\r\n }\r\n }\r\n lookupDataElement(name) {\r\n if (name === undefined) {\r\n return { type: new Types.UnknownType(\"undefined, lookupDataElement\") };\r\n }\r\n const found = this.reg.getObject(\"DTEL\", name);\r\n if (found) {\r\n return { type: found.parseType(this.reg), object: found };\r\n }\r\n else if (this.reg.inErrorNamespace(name)) {\r\n return { type: new Types.UnknownType(name + \" not found, lookupDataElement\") };\r\n }\r\n else {\r\n return { type: new Types.VoidType(name) };\r\n }\r\n }\r\n lookupTableOrView(name) {\r\n var _a;\r\n if (name === undefined) {\r\n return { type: new Types.UnknownType(\"undefined, lookupTableOrView\") };\r\n }\r\n const foundTABL = this.reg.getObject(\"TABL\", name);\r\n if (foundTABL) {\r\n return { type: foundTABL.parseType(this.reg), object: foundTABL };\r\n }\r\n const upper = name.toUpperCase();\r\n for (const obj of this.reg.getObjectsByType(\"DDLS\")) {\r\n const ddls = obj;\r\n if (ddls.getSQLViewName() === upper || ((_a = ddls.getDefinitionName()) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === upper) {\r\n return { type: ddls.parseType(this.reg), object: ddls };\r\n }\r\n }\r\n return this.lookupView(name);\r\n }\r\n /** this method only looks up the object, does not parse the type */\r\n lookupTableOrView2(name) {\r\n var _a;\r\n if (name === undefined) {\r\n return undefined;\r\n }\r\n const foundTABL = this.reg.getObject(\"TABL\", name);\r\n if (foundTABL) {\r\n return foundTABL;\r\n }\r\n const foundVIEW = this.reg.getObject(\"VIEW\", name);\r\n if (foundVIEW) {\r\n return foundVIEW;\r\n }\r\n const upper = name.toUpperCase();\r\n for (const obj of this.reg.getObjectsByType(\"DDLS\")) {\r\n const ddls = obj;\r\n if (ddls.getSQLViewName() === upper || ((_a = ddls.getDefinitionName()) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === upper) {\r\n return ddls;\r\n }\r\n }\r\n return undefined;\r\n }\r\n lookupTable(name) {\r\n if (name === undefined) {\r\n return new Types.UnknownType(\"undefined, lookupTable\");\r\n }\r\n const found = this.reg.getObject(\"TABL\", name);\r\n if (found) {\r\n return found.parseType(this.reg);\r\n }\r\n else if (this.reg.inErrorNamespace(name)) {\r\n return new Types.UnknownType(name + \" not found, lookupTable\");\r\n }\r\n else {\r\n return new Types.VoidType(name);\r\n }\r\n }\r\n lookupView(name) {\r\n if (name === undefined) {\r\n return { type: new Types.UnknownType(\"undefined, lookupView\") };\r\n }\r\n const found = this.reg.getObject(\"VIEW\", name);\r\n if (found) {\r\n return { type: found.parseType(this.reg), object: found };\r\n }\r\n else if (this.reg.inErrorNamespace(name)) {\r\n return { type: new Types.UnknownType(name + \" not found, lookupView\") };\r\n }\r\n else {\r\n return { type: new Types.VoidType(name) };\r\n }\r\n }\r\n lookupTableType(name) {\r\n if (name === undefined) {\r\n return { type: new Types.UnknownType(\"undefined, lookupTableType\") };\r\n }\r\n const found = this.reg.getObject(\"TTYP\", name);\r\n if (found) {\r\n return { type: found.parseType(this.reg), object: found };\r\n }\r\n else if (this.reg.inErrorNamespace(name)) {\r\n return { type: new Types.UnknownType(name + \" not found, lookupTableType\") };\r\n }\r\n else {\r\n return { type: new Types.VoidType(name) };\r\n }\r\n }\r\n textToType(text, length, decimals, parent, qualify = true) {\r\n // todo, support short strings, and length of different integers, NUMC vs CHAR, min/max length\r\n const qualified = qualify ? parent : undefined;\r\n switch (text) {\r\n case \"DEC\": // 1 <= len <= 31\r\n case \"D16F\": // 1 <= len <= 31\r\n case \"D34F\": // 1 <= len <= 31\r\n case \"DF16_DEC\": // 1 <= len <= 31\r\n case \"DF34_DEC\": // 1 <= len <= 31\r\n case \"CURR\": // 1 <= len <= 31\r\n case \"QUAN\": // 1 <= len <= 31\r\n if (length === undefined) {\r\n return new Types.UnknownType(text + \" unknown length, \" + parent, parent);\r\n }\r\n else if (decimals === undefined) {\r\n return new Types.PackedType(parseInt(length, 10), 0, qualified);\r\n }\r\n return new Types.PackedType(parseInt(length, 10), parseInt(decimals, 10), qualified);\r\n case \"ACCP\":\r\n return new Types.CharacterType(6, qualified); // YYYYMM\r\n case \"LANG\":\r\n return new Types.CharacterType(1, qualified);\r\n case \"CLNT\":\r\n return new Types.CharacterType(3, qualified);\r\n case \"CUKY\":\r\n return new Types.CharacterType(5, qualified);\r\n case \"UNIT\": // 2 <= len <= 3\r\n return new Types.CharacterType(3, qualified);\r\n case \"UTCLONG\":\r\n return new Types.CharacterType(27, qualified);\r\n case \"NUMC\": // 1 <= len <= 255\r\n if (length === undefined) {\r\n return new Types.UnknownType(text + \" unknown length\", parent);\r\n }\r\n return new Types.NumericType(parseInt(length, 10), qualified);\r\n case \"CHAR\": // 1 <= len <= 30000 (1333 for table fields)\r\n case \"LCHR\": // 256 <= len <= 32000\r\n if (length === undefined) {\r\n return new Types.UnknownType(text + \" unknown length\", parent);\r\n }\r\n return new Types.CharacterType(parseInt(length, 10), qualified);\r\n case \"RAW\": // 1 <= len <= 32000\r\n case \"LRAW\": // 256 <= len <= 32000\r\n if (length === undefined) {\r\n return new Types.UnknownType(text + \" unknown length\", parent);\r\n }\r\n return new Types.HexType(parseInt(length, 10), qualified);\r\n case \"TIMN\": // Native HANA\r\n case \"TIMS\":\r\n return new Types.TimeType(qualified); //HHMMSS\r\n case \"DECFLOAT16\": // len = 16\r\n case \"DECFLOAT34\": // len = 34\r\n case \"D16R\": // len = 16\r\n case \"D34R\": // len = 34\r\n case \"DF16_RAW\": // len = 16\r\n case \"DF34_RAW\": // len = 34\r\n case \"FLTP\": // len = 16\r\n if (length === undefined) {\r\n return new Types.UnknownType(text + \" unknown length\", parent);\r\n }\r\n return new Types.FloatingPointType(parseInt(length, 10), qualified);\r\n case \"DATN\": // Native HANA\r\n case \"DATS\":\r\n return new Types.DateType(qualified); //YYYYMMDD\r\n case \"INT1\":\r\n case \"INT2\":\r\n case \"INT4\":\r\n case \"INT8\":\r\n return new Types.IntegerType(qualified);\r\n case \"SSTR\": // 1 <= len <= 1333\r\n case \"SSTRING\": // 1 <= len <= 1333\r\n case \"STRG\": // 256 <= len\r\n case \"STRING\": // 256 <= len\r\n return new Types.StringType(qualified);\r\n case \"RSTR\": // 256 <= len\r\n case \"RAWSTRING\": // 256 <= len\r\n case \"GEOM_EWKB\":\r\n return new Types.XStringType(qualified);\r\n case \"D16S\":\r\n case \"D34S\":\r\n case \"DF16_SCL\":\r\n case \"DF34_SCL\":\r\n case \"PREC\":\r\n case \"VARC\":\r\n return new Types.UnknownType(text + \" is an obsolete data type\", parent);\r\n default:\r\n return new Types.UnknownType(text + \" unknown\", parent);\r\n }\r\n }\r\n}\r\nexports.DDIC = DDIC;\r\n//# sourceMappingURL=ddic.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/ddic.js?");
|
|
9875
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DDIC = void 0;\r\nconst Types = __webpack_require__(/*! ./abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst basic_1 = __webpack_require__(/*! ./abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nclass DDIC {\r\n constructor(reg) {\r\n this.reg = reg;\r\n }\r\n // the class might be local with a local super class with a global exception class as super\r\n // todo: returns true for both local and global exception classes\r\n isException(def, _obj) {\r\n var _a;\r\n if (def === undefined) {\r\n return false;\r\n }\r\n if (def.name.toUpperCase() === \"CX_ROOT\") {\r\n return true;\r\n }\r\n let superClassName = def.superClassName;\r\n if (superClassName === undefined) {\r\n return false;\r\n }\r\n let i = 0;\r\n // max depth, make sure not to hit cyclic super class defintions\r\n while (i++ < 10 && superClassName !== undefined) {\r\n const found = this.reg.getObject(\"CLAS\", superClassName);\r\n if (found === undefined) {\r\n break;\r\n }\r\n const superDef = (_a = found.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getInfo().getClassDefinitionByName(superClassName);\r\n if (superDef === undefined) {\r\n break;\r\n }\r\n if (superDef.superClassName) {\r\n superClassName = superDef.superClassName;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n // todo, this should check for \"CX_ROOT\"\r\n const isException = ((superClassName === null || superClassName === void 0 ? void 0 : superClassName.match(/^.?cx_.*$/i)) || (superClassName === null || superClassName === void 0 ? void 0 : superClassName.match(/^\\/.+\\/cx_.*$/i))) ? true : false;\r\n return isException;\r\n }\r\n lookupBuiltinType(name, length, decimals, qualifiedName) {\r\n switch (name) {\r\n case \"STRING\":\r\n return new Types.StringType(qualifiedName || name);\r\n case \"XSTRING\":\r\n return new Types.XStringType(qualifiedName || name);\r\n case \"D\":\r\n return new Types.DateType(qualifiedName || name);\r\n case \"T\":\r\n return new Types.TimeType(qualifiedName || name);\r\n case \"XSEQUENCE\":\r\n return new Types.XSequenceType(qualifiedName);\r\n case \"CLIKE\":\r\n return new Types.CLikeType(qualifiedName);\r\n case \"DECFLOAT\":\r\n return new Types.DecFloatType(qualifiedName);\r\n case \"ANY\":\r\n return new Types.AnyType(qualifiedName);\r\n case \"SIMPLE\":\r\n return new Types.SimpleType(qualifiedName);\r\n case \"%_C_POINTER\":\r\n return new Types.HexType(8, qualifiedName);\r\n case \"TABLE\":\r\n return new Types.TableType(new Types.AnyType(), { withHeader: false });\r\n case \"DATA\":\r\n return new Types.AnyType(qualifiedName);\r\n case \"NUMERIC\":\r\n return new Types.NumericGenericType(qualifiedName);\r\n case \"UTCLONG\": // todo, take version into account\r\n return new Types.UTCLongType(qualifiedName);\r\n case \"DECFLOAT16\":\r\n return new Types.DecFloat16Type(qualifiedName);\r\n case \"DECFLOAT34\":\r\n return new Types.DecFloat34Type(qualifiedName);\r\n case \"CSEQUENCE\":\r\n return new Types.CSequenceType(qualifiedName);\r\n case \"I\":\r\n case \"INT8\": // todo, take version into account\r\n return new Types.IntegerType(qualifiedName || name);\r\n case \"F\":\r\n return new Types.FloatType(qualifiedName || name);\r\n case \"P\":\r\n if (length && decimals) {\r\n return new Types.PackedType(length, decimals, qualifiedName);\r\n }\r\n else if (length) {\r\n return new Types.PackedType(length, 0, qualifiedName);\r\n }\r\n else {\r\n return new Types.PackedType(1, 0, qualifiedName);\r\n }\r\n case \"C\":\r\n if (length) {\r\n return new Types.CharacterType(length, qualifiedName);\r\n }\r\n else {\r\n return new Types.CharacterType(1, qualifiedName);\r\n }\r\n case \"X\":\r\n if (length) {\r\n return new Types.HexType(length, qualifiedName);\r\n }\r\n else {\r\n return new Types.HexType(1, qualifiedName);\r\n }\r\n case \"N\":\r\n if (length) {\r\n return new Types.NumericType(length, qualifiedName);\r\n }\r\n else {\r\n return new Types.NumericType(1, qualifiedName);\r\n }\r\n }\r\n return undefined;\r\n }\r\n inErrorNamespace(name) {\r\n if (name === undefined) {\r\n return true;\r\n }\r\n return this.reg.inErrorNamespace(name);\r\n }\r\n lookupObject(name) {\r\n const clas = this.reg.getObject(\"CLAS\", name);\r\n const globalClas = clas === null || clas === void 0 ? void 0 : clas.getIdentifier();\r\n if (globalClas) {\r\n return { type: new basic_1.ObjectReferenceType(globalClas, name), object: clas };\r\n }\r\n const intf = this.reg.getObject(\"INTF\", name);\r\n const globalIntf = intf === null || intf === void 0 ? void 0 : intf.getIdentifier();\r\n if (globalIntf) {\r\n return { type: new basic_1.ObjectReferenceType(globalIntf, name), object: intf };\r\n }\r\n if (this.inErrorNamespace(name) === true) {\r\n return { type: new basic_1.UnknownType(name) };\r\n }\r\n else {\r\n return { type: new basic_1.VoidType(name) };\r\n }\r\n }\r\n lookupNoVoid(name) {\r\n const foundTABL = this.reg.getObject(\"TABL\", name);\r\n if (foundTABL) {\r\n return { type: foundTABL.parseType(this.reg), object: foundTABL };\r\n }\r\n const foundVIEW = this.reg.getObject(\"VIEW\", name);\r\n if (foundVIEW) {\r\n return { type: foundVIEW.parseType(this.reg), object: foundVIEW };\r\n }\r\n const foundTTYP = this.reg.getObject(\"TTYP\", name);\r\n if (foundTTYP) {\r\n return { type: foundTTYP.parseType(this.reg), object: foundTTYP };\r\n }\r\n const foundDTEL = this.reg.getObject(\"DTEL\", name);\r\n if (foundDTEL) {\r\n return { type: foundDTEL.parseType(this.reg), object: foundDTEL };\r\n }\r\n const foundDDLS = this.lookupDDLS(name);\r\n if (foundDDLS) {\r\n return foundDDLS;\r\n }\r\n return undefined;\r\n }\r\n lookupDDLS(name) {\r\n var _a;\r\n if (name === undefined) {\r\n return undefined;\r\n }\r\n const upper = name.toUpperCase();\r\n for (const obj of this.reg.getObjectsByType(\"DDLS\")) {\r\n const ddls = obj;\r\n if (ddls.getSQLViewName() === upper || ((_a = ddls.getDefinitionName()) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === upper) {\r\n return { type: ddls.parseType(this.reg), object: ddls };\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** lookup with voiding and unknown types */\r\n lookup(name) {\r\n const found = this.lookupNoVoid(name);\r\n if (found) {\r\n return found;\r\n }\r\n if (this.reg.inErrorNamespace(name)) {\r\n return { type: new Types.UnknownType(name + \" not found, lookup\") };\r\n }\r\n else {\r\n return { type: new Types.VoidType(name) };\r\n }\r\n }\r\n lookupDomain(name, parent) {\r\n const found = this.reg.getObject(\"DOMA\", name);\r\n if (found) {\r\n return { type: found.parseType(this.reg, parent), object: found };\r\n }\r\n else if (this.reg.inErrorNamespace(name)) {\r\n return { type: new Types.UnknownType(name + \", lookupDomain\"), object: undefined };\r\n }\r\n else {\r\n return { type: new Types.VoidType(name), object: undefined };\r\n }\r\n }\r\n lookupDataElement(name) {\r\n if (name === undefined) {\r\n return { type: new Types.UnknownType(\"undefined, lookupDataElement\") };\r\n }\r\n const found = this.reg.getObject(\"DTEL\", name);\r\n if (found) {\r\n return { type: found.parseType(this.reg), object: found };\r\n }\r\n else if (this.reg.inErrorNamespace(name)) {\r\n return { type: new Types.UnknownType(name + \" not found, lookupDataElement\") };\r\n }\r\n else {\r\n return { type: new Types.VoidType(name) };\r\n }\r\n }\r\n lookupTableOrView(name) {\r\n if (name === undefined) {\r\n return { type: new Types.UnknownType(\"undefined, lookupTableOrView\") };\r\n }\r\n const foundTABL = this.reg.getObject(\"TABL\", name);\r\n if (foundTABL) {\r\n return { type: foundTABL.parseType(this.reg), object: foundTABL };\r\n }\r\n const foundDDLS = this.lookupDDLS(name);\r\n if (foundDDLS) {\r\n return foundDDLS;\r\n }\r\n return this.lookupView(name);\r\n }\r\n /** this method only looks up the object, does not parse the type */\r\n lookupTableOrView2(name) {\r\n if (name === undefined) {\r\n return undefined;\r\n }\r\n const foundTABL = this.reg.getObject(\"TABL\", name);\r\n if (foundTABL) {\r\n return foundTABL;\r\n }\r\n const foundVIEW = this.reg.getObject(\"VIEW\", name);\r\n if (foundVIEW) {\r\n return foundVIEW;\r\n }\r\n const foundDDLS = this.lookupDDLS(name);\r\n if (foundDDLS) {\r\n return foundDDLS.object;\r\n }\r\n return undefined;\r\n }\r\n lookupTable(name) {\r\n if (name === undefined) {\r\n return new Types.UnknownType(\"undefined, lookupTable\");\r\n }\r\n const found = this.reg.getObject(\"TABL\", name);\r\n if (found) {\r\n return found.parseType(this.reg);\r\n }\r\n else if (this.reg.inErrorNamespace(name)) {\r\n return new Types.UnknownType(name + \" not found, lookupTable\");\r\n }\r\n else {\r\n return new Types.VoidType(name);\r\n }\r\n }\r\n lookupView(name) {\r\n if (name === undefined) {\r\n return { type: new Types.UnknownType(\"undefined, lookupView\") };\r\n }\r\n const found = this.reg.getObject(\"VIEW\", name);\r\n if (found) {\r\n return { type: found.parseType(this.reg), object: found };\r\n }\r\n else if (this.reg.inErrorNamespace(name)) {\r\n return { type: new Types.UnknownType(name + \" not found, lookupView\") };\r\n }\r\n else {\r\n return { type: new Types.VoidType(name) };\r\n }\r\n }\r\n lookupTableType(name) {\r\n if (name === undefined) {\r\n return { type: new Types.UnknownType(\"undefined, lookupTableType\") };\r\n }\r\n const found = this.reg.getObject(\"TTYP\", name);\r\n if (found) {\r\n return { type: found.parseType(this.reg), object: found };\r\n }\r\n else if (this.reg.inErrorNamespace(name)) {\r\n return { type: new Types.UnknownType(name + \" not found, lookupTableType\") };\r\n }\r\n else {\r\n return { type: new Types.VoidType(name) };\r\n }\r\n }\r\n textToType(text, length, decimals, parent, qualify = true) {\r\n // todo, support short strings, and length of different integers, NUMC vs CHAR, min/max length\r\n const qualified = qualify ? parent : undefined;\r\n switch (text) {\r\n case \"DEC\": // 1 <= len <= 31\r\n case \"D16F\": // 1 <= len <= 31\r\n case \"D34F\": // 1 <= len <= 31\r\n case \"DF16_DEC\": // 1 <= len <= 31\r\n case \"DF34_DEC\": // 1 <= len <= 31\r\n case \"CURR\": // 1 <= len <= 31\r\n case \"QUAN\": // 1 <= len <= 31\r\n if (length === undefined) {\r\n return new Types.UnknownType(text + \" unknown length, \" + parent, parent);\r\n }\r\n else if (decimals === undefined) {\r\n return new Types.PackedType(parseInt(length, 10), 0, qualified);\r\n }\r\n return new Types.PackedType(parseInt(length, 10), parseInt(decimals, 10), qualified);\r\n case \"ACCP\":\r\n return new Types.CharacterType(6, qualified); // YYYYMM\r\n case \"LANG\":\r\n return new Types.CharacterType(1, qualified);\r\n case \"CLNT\":\r\n return new Types.CharacterType(3, qualified);\r\n case \"CUKY\":\r\n return new Types.CharacterType(5, qualified);\r\n case \"UNIT\": // 2 <= len <= 3\r\n return new Types.CharacterType(3, qualified);\r\n case \"UTCLONG\":\r\n return new Types.CharacterType(27, qualified);\r\n case \"NUMC\": // 1 <= len <= 255\r\n if (length === undefined) {\r\n return new Types.UnknownType(text + \" unknown length\", parent);\r\n }\r\n return new Types.NumericType(parseInt(length, 10), qualified);\r\n case \"CHAR\": // 1 <= len <= 30000 (1333 for table fields)\r\n case \"LCHR\": // 256 <= len <= 32000\r\n if (length === undefined) {\r\n return new Types.UnknownType(text + \" unknown length\", parent);\r\n }\r\n return new Types.CharacterType(parseInt(length, 10), qualified);\r\n case \"RAW\": // 1 <= len <= 32000\r\n case \"LRAW\": // 256 <= len <= 32000\r\n if (length === undefined) {\r\n return new Types.UnknownType(text + \" unknown length\", parent);\r\n }\r\n return new Types.HexType(parseInt(length, 10), qualified);\r\n case \"TIMN\": // Native HANA\r\n case \"TIMS\":\r\n return new Types.TimeType(qualified); //HHMMSS\r\n case \"DECFLOAT16\": // len = 16\r\n case \"DECFLOAT34\": // len = 34\r\n case \"D16R\": // len = 16\r\n case \"D34R\": // len = 34\r\n case \"DF16_RAW\": // len = 16\r\n case \"DF34_RAW\": // len = 34\r\n case \"FLTP\": // len = 16\r\n if (length === undefined) {\r\n return new Types.UnknownType(text + \" unknown length\", parent);\r\n }\r\n return new Types.FloatingPointType(parseInt(length, 10), qualified);\r\n case \"DATN\": // Native HANA\r\n case \"DATS\":\r\n return new Types.DateType(qualified); //YYYYMMDD\r\n case \"INT1\":\r\n case \"INT2\":\r\n case \"INT4\":\r\n case \"INT8\":\r\n return new Types.IntegerType(qualified);\r\n case \"SSTR\": // 1 <= len <= 1333\r\n case \"SSTRING\": // 1 <= len <= 1333\r\n case \"STRG\": // 256 <= len\r\n case \"STRING\": // 256 <= len\r\n return new Types.StringType(qualified);\r\n case \"RSTR\": // 256 <= len\r\n case \"RAWSTRING\": // 256 <= len\r\n case \"GEOM_EWKB\":\r\n return new Types.XStringType(qualified);\r\n case \"D16S\":\r\n case \"D34S\":\r\n case \"DF16_SCL\":\r\n case \"DF34_SCL\":\r\n case \"PREC\":\r\n case \"VARC\":\r\n return new Types.UnknownType(text + \" is an obsolete data type\", parent);\r\n default:\r\n return new Types.UnknownType(text + \" unknown\", parent);\r\n }\r\n }\r\n}\r\nexports.DDIC = DDIC;\r\n//# sourceMappingURL=ddic.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/ddic.js?");
|
|
9876
9876
|
|
|
9877
9877
|
/***/ }),
|
|
9878
9878
|
|
|
@@ -11654,7 +11654,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11654
11654
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11655
11655
|
|
|
11656
11656
|
"use strict";
|
|
11657
|
-
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 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 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\");\nconst rules_runner_1 = __webpack_require__(/*! ./rules_runner */ \"./node_modules/@abaplint/core/build/src/rules_runner.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 this.dependencies = {};\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.93.72\";\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 // todo: performance? cache regexp?\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, dependency) {\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 let found = this.findOrCreate(f.getObjectName(), f.getObjectType());\n if (dependency === false && found && this.isDependency(found)) {\n this.removeDependency(found);\n found = this.findOrCreate(f.getObjectName(), f.getObjectType());\n }\n found.addFile(f);\n }\n return this;\n }\n addFiles(files) {\n this._addFiles(files, false);\n return this;\n }\n addDependencies(files) {\n for (const f of files) {\n this.addDependency(f);\n }\n return this;\n }\n addDependency(file) {\n var _a;\n const type = (_a = file.getObjectType()) === null || _a === void 0 ? void 0 : _a.toUpperCase();\n if (type === undefined) {\n return this;\n }\n const name = file.getObjectName().toUpperCase();\n if (this.dependencies[type] === undefined) {\n this.dependencies[type] = {};\n }\n this.dependencies[type][name] = true;\n this._addFiles([file], true);\n return this;\n }\n removeDependency(obj) {\n var _a;\n (_a = this.dependencies[obj.getType()]) === null || _a === void 0 ? true : delete _a[obj.getName()];\n this.removeObject(obj);\n }\n isDependency(obj) {\n var _a;\n return ((_a = this.dependencies[obj.getType()]) === null || _a === void 0 ? void 0 : _a[obj.getName()]) === true;\n }\n isFileDependency(filename) {\n var _a, _b;\n const f = this.getFileByName(filename);\n if (f === undefined) {\n return false;\n }\n const type = (_a = f.getObjectType()) === null || _a === void 0 ? void 0 : _a.toUpperCase();\n if (type === undefined) {\n return false;\n }\n const name = f.getObjectName().toUpperCase();\n return ((_b = this.dependencies[type]) === null || _b === void 0 ? void 0 : _b[name]) === 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 new rules_runner_1.RulesRunner(this).runRules(this.getObjects(), 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 new rules_runner_1.RulesRunner(this).runRules([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 for (const o of this.getObjects()) {\n this.parsePrivate(o);\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 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 }\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 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?");
|
|
11657
|
+
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 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 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\");\nconst rules_runner_1 = __webpack_require__(/*! ./rules_runner */ \"./node_modules/@abaplint/core/build/src/rules_runner.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 this.dependencies = {};\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.93.73\";\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 // todo: performance? cache regexp?\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, dependency) {\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 let found = this.findOrCreate(f.getObjectName(), f.getObjectType());\n if (dependency === false && found && this.isDependency(found)) {\n this.removeDependency(found);\n found = this.findOrCreate(f.getObjectName(), f.getObjectType());\n }\n found.addFile(f);\n }\n return this;\n }\n addFiles(files) {\n this._addFiles(files, false);\n return this;\n }\n addDependencies(files) {\n for (const f of files) {\n this.addDependency(f);\n }\n return this;\n }\n addDependency(file) {\n var _a;\n const type = (_a = file.getObjectType()) === null || _a === void 0 ? void 0 : _a.toUpperCase();\n if (type === undefined) {\n return this;\n }\n const name = file.getObjectName().toUpperCase();\n if (this.dependencies[type] === undefined) {\n this.dependencies[type] = {};\n }\n this.dependencies[type][name] = true;\n this._addFiles([file], true);\n return this;\n }\n removeDependency(obj) {\n var _a;\n (_a = this.dependencies[obj.getType()]) === null || _a === void 0 ? true : delete _a[obj.getName()];\n this.removeObject(obj);\n }\n isDependency(obj) {\n var _a;\n return ((_a = this.dependencies[obj.getType()]) === null || _a === void 0 ? void 0 : _a[obj.getName()]) === true;\n }\n isFileDependency(filename) {\n var _a, _b;\n const f = this.getFileByName(filename);\n if (f === undefined) {\n return false;\n }\n const type = (_a = f.getObjectType()) === null || _a === void 0 ? void 0 : _a.toUpperCase();\n if (type === undefined) {\n return false;\n }\n const name = f.getObjectName().toUpperCase();\n return ((_b = this.dependencies[type]) === null || _b === void 0 ? void 0 : _b[name]) === 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 new rules_runner_1.RulesRunner(this).runRules(this.getObjects(), 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 new rules_runner_1.RulesRunner(this).runRules([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 for (const o of this.getObjects()) {\n this.parsePrivate(o);\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 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 }\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 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?");
|
|
11658
11658
|
|
|
11659
11659
|
/***/ }),
|
|
11660
11660
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/cli",
|
|
3
|
-
"version": "2.93.
|
|
3
|
+
"version": "2.93.73",
|
|
4
4
|
"description": "abaplint - Command Line Interface",
|
|
5
5
|
"bin": {
|
|
6
6
|
"abaplint": "./abaplint"
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"homepage": "https://abaplint.org",
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@abaplint/core": "^2.93.
|
|
42
|
+
"@abaplint/core": "^2.93.73",
|
|
43
43
|
"@types/chai": "^4.3.3",
|
|
44
44
|
"@types/glob": "^7.2.0",
|
|
45
45
|
"@types/minimist": "^1.2.2",
|