@abaplint/cli 2.97.0 → 2.97.2
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 +30 -19
- package/package.json +2 -2
package/build/cli.js
CHANGED
|
@@ -6715,7 +6715,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
6715
6715
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
6716
6716
|
|
|
6717
6717
|
"use strict";
|
|
6718
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.BuiltIn = exports.BuiltInMethod = void 0;\n/* eslint-disable max-len */\nconst _typed_identifier_1 = __webpack_require__(/*! ../types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\nconst basic_1 = __webpack_require__(/*! ../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nconst tokens_1 = __webpack_require__(/*! ../1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\nconst position_1 = __webpack_require__(/*! ../../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\nconst visibility_1 = __webpack_require__(/*! ../4_file_information/visibility */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js\");\nconst _identifier_1 = __webpack_require__(/*! ../4_file_information/_identifier */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/_identifier.js\");\nconst version_1 = __webpack_require__(/*! ../../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\nclass BuiltInMethod extends _identifier_1.Identifier {\n constructor(token, filename, method, row) {\n super(token, filename);\n this.method = method;\n this.row = row;\n }\n getRequiredParameters() {\n return [];\n }\n getOptional() {\n throw new Error(\"BuiltInMethod->Method not implemented.\");\n }\n getAll() {\n throw new Error(\"BuiltInMethod->getAll, Method not implemented.\");\n }\n getImporting() {\n const ret = [];\n for (const i in this.method.mandatory) {\n const id = new tokens_1.Identifier(new position_1.Position(this.row, 1), i);\n ret.push(new _typed_identifier_1.TypedIdentifier(id, BuiltIn.filename, this.method.mandatory[i]));\n }\n for (const i in this.method.optional) {\n const id = new tokens_1.Identifier(new position_1.Position(this.row, 1), i);\n ret.push(new _typed_identifier_1.TypedIdentifier(id, BuiltIn.filename, this.method.optional[i]));\n }\n return ret;\n }\n getDefaultImporting() {\n if (this.method.mandatory === undefined) {\n return undefined;\n }\n const keys = Object.keys(this.method.mandatory);\n if (keys.length === 1) {\n return keys[0].toUpperCase();\n }\n return undefined;\n }\n getExporting() {\n return [];\n }\n getRaising() {\n return [];\n }\n getChanging() {\n return [];\n }\n getReturning() {\n const id = new tokens_1.Identifier(new position_1.Position(this.row, 1), \"ret\");\n return new _typed_identifier_1.TypedIdentifier(id, BuiltIn.filename, this.method.return);\n }\n getExceptions() {\n return [];\n }\n getVisibility() {\n return visibility_1.Visibility.Public;\n }\n isRedefinition() {\n return false;\n }\n isAbstract() {\n return false;\n }\n isStatic() {\n return false;\n }\n isEventHandler() {\n return false;\n }\n getParameters() {\n return this;\n }\n getParameterDefault(_parameter) {\n return undefined;\n }\n}\nexports.BuiltInMethod = BuiltInMethod;\nclass BuiltIn {\n constructor() {\n this.row = 1;\n }\n buildDefinition(method, row) {\n const token = new tokens_1.Identifier(new position_1.Position(row, 1), method.name);\n return new BuiltInMethod(token, BuiltIn.filename, method, row);\n }\n searchBuiltin(name) {\n if (name === undefined) {\n return undefined;\n }\n // todo, optimize, use hash map\n const index = BuiltIn.methods.findIndex(a => a.name === name.toUpperCase());\n if (index < 0) {\n return undefined;\n }\n return this.buildDefinition(BuiltIn.methods[index], index);\n }\n isPredicate(name) {\n if (name === undefined) {\n return undefined;\n }\n // todo, optimize, use hash map\n const index = BuiltIn.methods.findIndex(a => a.name === name.toUpperCase());\n if (index < 0) {\n return undefined;\n }\n return BuiltIn.methods[index].predicate;\n }\n getTypes() {\n const ret = this.buildSY();\n const id = new tokens_1.Identifier(new position_1.Position(1, 1), \"abap_bool\");\n ret.push(new _typed_identifier_1.TypedIdentifier(id, BuiltIn.filename, new basic_1.CharacterType(1, { qualifiedName: \"ABAP_BOOL\", ddicName: \"ABAP_BOOL\" })));\n return ret;\n }\n get(extras) {\n const ret = this.buildSY();\n ret.push(this.buildVariable(\"screen\")); // todo, add structure, or alternatively make native Statements\n ret.push(this.buildConstant(\"%_BACKSPACE\"));\n ret.push(this.buildConstant(\"%_CHARSIZE\"));\n ret.push(this.buildConstant(\"%_CR_LF\"));\n ret.push(this.buildConstant(\"%_ENDIAN\"));\n ret.push(this.buildConstant(\"%_FORMFEED\"));\n ret.push(this.buildConstant(\"%_HORIZONTAL_TAB\"));\n ret.push(this.buildConstant(\"%_MAXCHAR\"));\n ret.push(this.buildConstant(\"%_MINCHAR\"));\n ret.push(this.buildConstant(\"%_NEWLINE\"));\n ret.push(this.buildConstant(\"%_VERTICAL_TAB\"));\n ret.push(this.buildConstant(\"abap_false\", new basic_1.CharacterType(1, { qualifiedName: \"ABAP_BOOL\", ddicName: \"ABAP_BOOL\" }), \"' '\"));\n ret.push(this.buildConstant(\"abap_true\", new basic_1.CharacterType(1, { qualifiedName: \"ABAP_BOOL\", ddicName: \"ABAP_BOOL\" }), \"'X'\"));\n ret.push(this.buildConstant(\"abap_undefined\", new basic_1.CharacterType(1, { qualifiedName: \"ABAP_BOOL\", ddicName: \"ABAP_BOOL\" }), \"'-'\"));\n ret.push(this.buildConstant(\"abap_off\", new basic_1.CharacterType(1, { qualifiedName: \"ABAP_BOOL\", ddicName: \"ABAP_BOOL\" }), \"' '\"));\n ret.push(this.buildConstant(\"abap_on\", new basic_1.CharacterType(1, { qualifiedName: \"ABAP_BOOL\", ddicName: \"ABAP_BOOL\" }), \"'X'\"));\n ret.push(this.buildConstant(\"col_background\", new basic_1.IntegerType(), \"0\"));\n ret.push(this.buildConstant(\"col_heading\", new basic_1.IntegerType(), \"1\"));\n ret.push(this.buildConstant(\"col_key\", new basic_1.IntegerType(), \"4\"));\n ret.push(this.buildConstant(\"col_negative\", new basic_1.IntegerType(), \"6\"));\n ret.push(this.buildConstant(\"col_group\", new basic_1.IntegerType(), \"7\"));\n ret.push(this.buildConstant(\"col_normal\", new basic_1.IntegerType(), \"2\"));\n ret.push(this.buildConstant(\"col_positive\", new basic_1.IntegerType(), \"5\"));\n ret.push(this.buildConstant(\"col_total\", new basic_1.IntegerType(), \"3\"));\n ret.push(this.buildConstant(\"space\", new basic_1.CharacterType(1), \"' '\"));\n for (const e of extras) {\n const id = new tokens_1.Identifier(new position_1.Position(this.row++, 1), e);\n ret.push(new _typed_identifier_1.TypedIdentifier(id, BuiltIn.filename, new basic_1.VoidType(e), [\"read_only\" /* IdentifierMeta.ReadOnly */, \"built-in\" /* IdentifierMeta.BuiltIn */], \"'?'\"));\n }\n return ret;\n }\n /////////////////////////////\n buildSY() {\n const components = [];\n components.push({ name: \"abcde\", type: new basic_1.CharacterType(26, { qualifiedName: \"sy-abcde\" }) });\n components.push({ name: \"batch\", type: new basic_1.CharacterType(1, { qualifiedName: \"sy-batch\" }) });\n components.push({ name: \"binpt\", type: new basic_1.CharacterType(1, { qualifiedName: \"sy-binpt\" }) });\n components.push({ name: \"calld\", type: new basic_1.CharacterType(1, { qualifiedName: \"sy-calld\" }) });\n components.push({ name: \"callr\", type: new basic_1.CharacterType(8, { qualifiedName: \"sy-callr\" }) });\n components.push({ name: \"colno\", type: new basic_1.IntegerType() });\n components.push({ name: \"cpage\", type: new basic_1.IntegerType() });\n components.push({ name: \"cprog\", type: new basic_1.CharacterType(40, { qualifiedName: \"sy-cprog\" }) });\n components.push({ name: \"cucol\", type: new basic_1.IntegerType() });\n components.push({ name: \"curow\", type: new basic_1.IntegerType() });\n components.push({ name: \"datar\", type: new basic_1.CharacterType(1, { qualifiedName: \"sy-datar\" }) });\n components.push({ name: \"datlo\", type: new basic_1.DateType() });\n components.push({ name: \"datum\", type: new basic_1.DateType() });\n components.push({ name: \"dayst\", type: new basic_1.CharacterType(1) });\n components.push({ name: \"dbcnt\", type: new basic_1.IntegerType() });\n components.push({ name: \"dbnam\", type: new basic_1.CharacterType(20, { qualifiedName: \"sy-dbnam\" }) });\n components.push({ name: \"dbsys\", type: new basic_1.CharacterType(10, { qualifiedName: \"sy-dbsys\" }) });\n components.push({ name: \"dyngr\", type: new basic_1.CharacterType(4, { qualifiedName: \"sy-dyngr\" }) });\n components.push({ name: \"dynnr\", type: new basic_1.CharacterType(4, { qualifiedName: \"sy-dynnr\" }) });\n components.push({ name: \"fdayw\", type: new basic_1.IntegerType() });\n components.push({ name: \"fdpos\", type: new basic_1.IntegerType() });\n components.push({ name: \"fleng\", type: new basic_1.IntegerType() });\n components.push({ name: \"folen\", type: new basic_1.IntegerType() });\n components.push({ name: \"host\", type: new basic_1.CharacterType(32, { qualifiedName: \"sy-host\" }) });\n components.push({ name: \"index\", type: new basic_1.IntegerType() });\n components.push({ name: \"input\", type: new basic_1.CharacterType(1, { qualifiedName: \"sy-input\" }) });\n components.push({ name: \"langu\", type: new basic_1.CharacterType(1, { qualifiedName: \"sy-langu\", conversionExit: \"ISOLA\" }) });\n components.push({ name: \"ldbpg\", type: new basic_1.CharacterType(40, { qualifiedName: \"sy-ldbpg\" }) });\n components.push({ name: \"lilli\", type: new basic_1.IntegerType() });\n components.push({ name: \"linct\", type: new basic_1.IntegerType() });\n components.push({ name: \"linno\", type: new basic_1.IntegerType() });\n components.push({ name: \"linsz\", type: new basic_1.IntegerType() });\n components.push({ name: \"lisel\", type: new basic_1.CharacterType(255, { qualifiedName: \"sy-lisel\" }) });\n components.push({ name: \"listi\", type: new basic_1.IntegerType() });\n components.push({ name: \"loopc\", type: new basic_1.IntegerType() });\n components.push({ name: \"lsind\", type: new basic_1.IntegerType() });\n components.push({ name: \"macol\", type: new basic_1.IntegerType() });\n components.push({ name: \"mandt\", type: new basic_1.CharacterType(3, { qualifiedName: \"sy-mandt\" }) });\n components.push({ name: \"marow\", type: new basic_1.IntegerType() });\n components.push({ name: \"modno\", type: new basic_1.IntegerType() });\n components.push({ name: \"msgid\", type: new basic_1.CharacterType(20, { qualifiedName: \"sy-msgid\" }) });\n components.push({ name: \"msgli\", type: new basic_1.CharacterType(60, { qualifiedName: \"sy-msgli\" }) });\n components.push({ name: \"msgno\", type: new basic_1.NumericType(3, \"sy-msgno\") });\n components.push({ name: \"msgty\", type: new basic_1.CharacterType(1, { qualifiedName: \"sy-msgty\" }) });\n components.push({ name: \"msgv1\", type: new basic_1.CharacterType(50, { qualifiedName: \"sy-msgv1\" }) });\n components.push({ name: \"msgv2\", type: new basic_1.CharacterType(50, { qualifiedName: \"sy-msgv2\" }) });\n components.push({ name: \"msgv3\", type: new basic_1.CharacterType(50, { qualifiedName: \"sy-msgv3\" }) });\n components.push({ name: \"msgv4\", type: new basic_1.CharacterType(50, { qualifiedName: \"sy-msgv4\" }) });\n components.push({ name: \"opsys\", type: new basic_1.CharacterType(10, { qualifiedName: \"sy-opsys\" }) });\n components.push({ name: \"pagno\", type: new basic_1.IntegerType() });\n components.push({ name: \"pdest\", type: new basic_1.CharacterType(4, { qualifiedName: \"sy-pdest\" }) });\n components.push({ name: \"pfkey\", type: new basic_1.CharacterType(20, { qualifiedName: \"sy-pfkey\" }) });\n components.push({ name: \"repid\", type: new basic_1.CharacterType(40, { qualifiedName: \"sy-repid\" }) });\n components.push({ name: \"saprl\", type: new basic_1.CharacterType(4, { qualifiedName: \"sy-saprl\" }) });\n components.push({ name: \"scols\", type: new basic_1.IntegerType() });\n components.push({ name: \"slset\", type: new basic_1.CharacterType(14, { qualifiedName: \"sy-slset\" }) });\n components.push({ name: \"spono\", type: new basic_1.CharacterType(10, { qualifiedName: \"sy-spono\" }) });\n components.push({ name: \"srows\", type: new basic_1.IntegerType() });\n components.push({ name: \"staco\", type: new basic_1.IntegerType() });\n components.push({ name: \"staro\", type: new basic_1.IntegerType() });\n components.push({ name: \"stepl\", type: new basic_1.IntegerType() });\n components.push({ name: \"subrc\", type: new basic_1.IntegerType() });\n components.push({ name: \"sysid\", type: new basic_1.CharacterType(3, { qualifiedName: \"sy-sysid\" }) });\n components.push({ name: \"tabix\", type: new basic_1.IntegerType() });\n components.push({ name: \"tcode\", type: new basic_1.CharacterType(20, { qualifiedName: \"sy-tcode\" }) });\n components.push({ name: \"tfill\", type: new basic_1.IntegerType() });\n components.push({ name: \"timlo\", type: new basic_1.TimeType() });\n components.push({ name: \"title\", type: new basic_1.CharacterType(70, { qualifiedName: \"sy-title\" }) });\n components.push({ name: \"tleng\", type: new basic_1.IntegerType() });\n components.push({ name: \"tvar0\", type: new basic_1.CharacterType(20, { qualifiedName: \"sy-tvar0\" }) });\n components.push({ name: \"tvar1\", type: new basic_1.CharacterType(20, { qualifiedName: \"sy-tvar1\" }) });\n components.push({ name: \"tvar2\", type: new basic_1.CharacterType(20, { qualifiedName: \"sy-tvar2\" }) });\n components.push({ name: \"tvar3\", type: new basic_1.CharacterType(20, { qualifiedName: \"sy-tvar3\" }) });\n components.push({ name: \"tvar4\", type: new basic_1.CharacterType(20, { qualifiedName: \"sy-tvar4\" }) });\n components.push({ name: \"tvar5\", type: new basic_1.CharacterType(20, { qualifiedName: \"sy-tvar5\" }) });\n components.push({ name: \"tvar6\", type: new basic_1.CharacterType(20, { qualifiedName: \"sy-tvar6\" }) });\n components.push({ name: \"tvar7\", type: new basic_1.CharacterType(20, { qualifiedName: \"sy-tvar7\" }) });\n components.push({ name: \"tvar8\", type: new basic_1.CharacterType(20, { qualifiedName: \"sy-tvar8\" }) });\n components.push({ name: \"tvar9\", type: new basic_1.CharacterType(20, { qualifiedName: \"sy-tvar9\" }) });\n components.push({ name: \"tzone\", type: new basic_1.IntegerType() });\n components.push({ name: \"ucomm\", type: new basic_1.CharacterType(70, { qualifiedName: \"sy-ucomm\" }) });\n components.push({ name: \"uline\", type: new basic_1.CharacterType(255, { qualifiedName: \"sy-uline\" }) });\n components.push({ name: \"uname\", type: new basic_1.CharacterType(12, { qualifiedName: \"sy-uname\" }) });\n components.push({ name: \"uzeit\", type: new basic_1.TimeType() });\n components.push({ name: \"vline\", type: new basic_1.CharacterType(1, { qualifiedName: \"sy-vline\" }) });\n components.push({ name: \"wtitl\", type: new basic_1.CharacterType(1, { qualifiedName: \"sy-wtitl\" }) });\n components.push({ name: \"zonlo\", type: new basic_1.CharacterType(6, { qualifiedName: \"sy-zonlo\" }) });\n const type = new basic_1.StructureType(components);\n const id1 = new tokens_1.Identifier(new position_1.Position(this.row++, 1), \"sy\");\n const sy = new _typed_identifier_1.TypedIdentifier(id1, BuiltIn.filename, type, [\"read_only\" /* IdentifierMeta.ReadOnly */, \"built-in\" /* IdentifierMeta.BuiltIn */]);\n const id2 = new tokens_1.Identifier(new position_1.Position(this.row++, 1), \"syst\");\n const syst = new _typed_identifier_1.TypedIdentifier(id2, BuiltIn.filename, type, [\"read_only\" /* IdentifierMeta.ReadOnly */, \"built-in\" /* IdentifierMeta.BuiltIn */]);\n return [sy, syst];\n }\n buildConstant(name, type, value) {\n const id = new tokens_1.Identifier(new position_1.Position(this.row++, 1), name);\n if (type === undefined) {\n type = new basic_1.VoidType(name);\n }\n if (value === undefined) {\n value = \"'?'\";\n }\n return new _typed_identifier_1.TypedIdentifier(id, BuiltIn.filename, type, [\"read_only\" /* IdentifierMeta.ReadOnly */, \"built-in\" /* IdentifierMeta.BuiltIn */], value);\n }\n buildVariable(name) {\n const id = new tokens_1.Identifier(new position_1.Position(this.row++, 1), name);\n return new _typed_identifier_1.TypedIdentifier(id, BuiltIn.filename, new basic_1.VoidType(name), [\"built-in\" /* IdentifierMeta.BuiltIn */]);\n }\n}\nBuiltIn.filename = \"_builtin.prog.abap\";\n// todo: \"pcre\" vs \"regex\", only one of these parameters are allowed\n// todo: \"pcre\", only possible from 755\nBuiltIn.methods = [\n {\n name: \"ABS\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.IntegerType(),\n },\n {\n name: \"ACOS\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.FloatType(),\n },\n {\n name: \"ASIN\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.FloatType(),\n },\n {\n name: \"ATAN\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.FloatType(),\n },\n {\n name: \"BIT-SET\",\n mandatory: {\n \"val\": new basic_1.IntegerType(),\n },\n return: new basic_1.XStringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"BOOLC\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"BOOLX\",\n mandatory: {\n \"bool\": new basic_1.StringType(),\n },\n optional: {\n \"bit\": new basic_1.IntegerType(),\n },\n return: new basic_1.XStringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"CEIL\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.IntegerType(),\n },\n {\n name: \"CHAR_OFF\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n \"add\": new basic_1.IntegerType(),\n },\n optional: {\n \"off\": new basic_1.IntegerType(),\n },\n return: new basic_1.IntegerType(),\n version: version_1.Version.v702,\n },\n {\n name: \"CHARLEN\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n return: new basic_1.IntegerType(),\n },\n {\n name: \"CMAX\",\n mandatory: {\n \"val1\": new basic_1.StringType(),\n \"val2\": new basic_1.StringType(),\n },\n optional: {\n \"val3\": new basic_1.StringType(),\n \"val4\": new basic_1.StringType(),\n \"val5\": new basic_1.StringType(),\n \"val6\": new basic_1.StringType(),\n \"val7\": new basic_1.StringType(),\n \"val9\": new basic_1.StringType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"CMIN\",\n mandatory: {\n \"val1\": new basic_1.StringType(),\n \"val2\": new basic_1.StringType(),\n },\n optional: {\n \"val3\": new basic_1.StringType(),\n \"val4\": new basic_1.StringType(),\n \"val5\": new basic_1.StringType(),\n \"val6\": new basic_1.StringType(),\n \"val7\": new basic_1.StringType(),\n \"val9\": new basic_1.StringType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"CONCAT_LINES_OF\",\n mandatory: {\n \"table\": new basic_1.TableType(new basic_1.AnyType(), { withHeader: false }),\n },\n optional: {\n \"sep\": new basic_1.StringType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"CONDENSE\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"del\": new basic_1.StringType(),\n \"from\": new basic_1.StringType(),\n \"to\": new basic_1.StringType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"CONTAINS\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"start\": new basic_1.StringType(),\n \"end\": new basic_1.StringType(),\n \"regex\": new basic_1.StringType(),\n \"pcre\": new basic_1.StringType(),\n \"case\": new basic_1.CharacterType(1),\n \"off\": new basic_1.IntegerType(),\n \"len\": new basic_1.IntegerType(),\n \"occ\": new basic_1.IntegerType(),\n },\n return: new basic_1.CharacterType(1),\n predicate: true,\n version: version_1.Version.v702,\n },\n {\n name: \"CONTAINS_ANY_NOT_OF\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"start\": new basic_1.StringType(),\n \"end\": new basic_1.StringType(),\n \"off\": new basic_1.IntegerType(),\n \"len\": new basic_1.IntegerType(),\n \"occ\": new basic_1.IntegerType(),\n },\n predicate: true,\n return: new basic_1.CharacterType(1), version: version_1.Version.v702,\n },\n {\n name: \"CONTAINS_ANY_OF\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"start\": new basic_1.StringType(),\n \"end\": new basic_1.StringType(),\n \"off\": new basic_1.IntegerType(),\n \"len\": new basic_1.IntegerType(),\n \"occ\": new basic_1.IntegerType(),\n },\n return: new basic_1.CharacterType(1),\n predicate: true,\n version: version_1.Version.v702,\n },\n {\n name: \"COS\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.FloatType(),\n },\n {\n name: \"COSH\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.FloatType(),\n },\n {\n name: \"COUNT\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"regex\": new basic_1.StringType(),\n \"pcre\": new basic_1.StringType(),\n \"case\": new basic_1.CharacterType(1),\n \"off\": new basic_1.IntegerType(),\n \"len\": new basic_1.IntegerType(),\n },\n return: new basic_1.IntegerType(),\n version: version_1.Version.v702,\n },\n {\n name: \"COUNT_ANY_NOT_OF\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"regex\": new basic_1.StringType(),\n \"pcre\": new basic_1.StringType(),\n \"case\": new basic_1.CharacterType(1),\n \"off\": new basic_1.IntegerType(),\n \"len\": new basic_1.IntegerType(),\n },\n return: new basic_1.IntegerType(),\n version: version_1.Version.v702,\n },\n {\n name: \"COUNT_ANY_OF\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"regex\": new basic_1.StringType(),\n \"pcre\": new basic_1.StringType(),\n \"case\": new basic_1.CharacterType(1),\n \"off\": new basic_1.IntegerType(),\n \"len\": new basic_1.IntegerType(),\n },\n return: new basic_1.IntegerType(),\n version: version_1.Version.v702,\n },\n {\n name: \"DBMAXLEN\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n return: new basic_1.IntegerType(),\n },\n {\n name: \"DISTANCE\",\n mandatory: {\n \"val1\": new basic_1.StringType(),\n \"val2\": new basic_1.StringType(),\n },\n return: new basic_1.IntegerType(),\n version: version_1.Version.v702,\n },\n {\n name: \"ESCAPE\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n \"format\": new basic_1.StringType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"EXP\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.FloatType(),\n },\n {\n name: \"FIND\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"regex\": new basic_1.StringType(),\n \"pcre\": new basic_1.StringType(),\n \"case\": new basic_1.CharacterType(1),\n \"off\": new basic_1.IntegerType(),\n \"len\": new basic_1.IntegerType(),\n \"occ\": new basic_1.IntegerType(),\n },\n return: new basic_1.IntegerType(),\n version: version_1.Version.v702,\n },\n {\n name: \"FIND_ANY_NOT_OF\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"off\": new basic_1.IntegerType(),\n \"len\": new basic_1.IntegerType(),\n \"occ\": new basic_1.IntegerType(),\n },\n return: new basic_1.IntegerType(),\n version: version_1.Version.v702,\n },\n {\n name: \"FIND_ANY_OF\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"off\": new basic_1.IntegerType(),\n \"len\": new basic_1.IntegerType(),\n \"occ\": new basic_1.IntegerType(),\n },\n return: new basic_1.IntegerType(),\n version: version_1.Version.v702,\n },\n {\n name: \"FIND_END\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"regex\": new basic_1.StringType(),\n \"pcre\": new basic_1.StringType(),\n \"case\": new basic_1.CharacterType(1),\n \"off\": new basic_1.IntegerType(),\n \"len\": new basic_1.IntegerType(),\n \"occ\": new basic_1.IntegerType(),\n },\n return: new basic_1.IntegerType(),\n version: version_1.Version.v702,\n },\n {\n name: \"FLOOR\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.IntegerType(),\n },\n {\n name: \"FRAC\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.IntegerType(),\n },\n {\n name: \"FROM_MIXED\",\n mandatory: { \"val\": new basic_1.StringType() },\n optional: {\n \"case\": new basic_1.CharacterType(1),\n \"sep\": new basic_1.IntegerType(),\n \"min\": new basic_1.IntegerType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"INSERT\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n \"sub\": new basic_1.StringType(),\n },\n optional: {\n \"off\": new basic_1.IntegerType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"IPOW\",\n mandatory: {\n \"base\": new basic_1.FloatType(),\n \"exp\": new basic_1.FloatType(),\n },\n return: new basic_1.IntegerType(),\n version: version_1.Version.v740sp02,\n },\n {\n name: \"LINE_EXISTS\",\n mandatory: {\n \"val\": new basic_1.AnyType(),\n },\n return: new basic_1.CharacterType(1),\n predicate: true,\n version: version_1.Version.v740sp02,\n },\n {\n name: \"LINE_INDEX\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n return: new basic_1.IntegerType(),\n version: version_1.Version.v740sp02,\n },\n {\n name: \"LINES\",\n mandatory: {\n \"val\": new basic_1.TableType(new basic_1.AnyType(), { withHeader: false }),\n },\n return: new basic_1.IntegerType(),\n },\n {\n name: \"LOG\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.FloatType(),\n },\n {\n name: \"LOG10\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.FloatType(),\n },\n {\n name: \"MATCH\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n }, optional: {\n \"case\": new basic_1.CharacterType(1),\n \"regex\": new basic_1.StringType(),\n \"pcre\": new basic_1.StringType(),\n \"occ\": new basic_1.IntegerType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"MATCHES\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"case\": new basic_1.CharacterType(1),\n \"regex\": new basic_1.StringType(),\n \"pcre\": new basic_1.StringType(),\n \"off\": new basic_1.IntegerType(),\n \"len\": new basic_1.IntegerType(),\n },\n return: new basic_1.CharacterType(1),\n predicate: true,\n version: version_1.Version.v702,\n },\n {\n name: \"NMAX\",\n mandatory: {\n \"val1\": new basic_1.StringType(),\n \"val2\": new basic_1.StringType(),\n },\n optional: {\n \"val3\": new basic_1.StringType(),\n \"val4\": new basic_1.StringType(),\n \"val5\": new basic_1.StringType(),\n \"val6\": new basic_1.StringType(),\n \"val7\": new basic_1.StringType(),\n \"val8\": new basic_1.StringType(),\n \"val9\": new basic_1.StringType(),\n },\n return: new basic_1.IntegerType(),\n version: version_1.Version.v702,\n },\n {\n name: \"NMIN\",\n mandatory: {\n \"val1\": new basic_1.StringType(),\n \"val2\": new basic_1.StringType(),\n },\n optional: {\n \"val3\": new basic_1.StringType(),\n \"val4\": new basic_1.StringType(),\n \"val5\": new basic_1.StringType(),\n \"val6\": new basic_1.StringType(),\n \"val7\": new basic_1.StringType(),\n \"val8\": new basic_1.StringType(),\n \"val9\": new basic_1.StringType(),\n },\n return: new basic_1.IntegerType(),\n version: version_1.Version.v702,\n },\n {\n name: \"NUMOFCHAR\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n return: new basic_1.IntegerType(),\n },\n {\n name: \"REPEAT\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n \"occ\": new basic_1.IntegerType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"REPLACE\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n \"with\": new basic_1.StringType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"regex\": new basic_1.StringType(),\n \"pcre\": new basic_1.StringType(),\n \"case\": new basic_1.CharacterType(1),\n \"off\": new basic_1.IntegerType(),\n \"len\": new basic_1.IntegerType(),\n \"occ\": new basic_1.IntegerType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"RESCALE\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n optional: {\n \"dec\": new basic_1.IntegerType(),\n \"prec\": new basic_1.IntegerType(),\n \"mode\": new basic_1.IntegerType(),\n },\n return: new basic_1.FloatType(),\n version: version_1.Version.v702,\n },\n {\n name: \"REVERSE\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"ROUND\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n optional: {\n \"dec\": new basic_1.IntegerType(),\n \"prec\": new basic_1.IntegerType(),\n \"mode\": new basic_1.IntegerType(),\n },\n return: new basic_1.IntegerType(),\n version: version_1.Version.v702,\n },\n {\n name: \"SEGMENT\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n \"index\": new basic_1.IntegerType(),\n },\n optional: {\n \"sep\": new basic_1.StringType(),\n \"space\": new basic_1.StringType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"SHIFT_LEFT\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"places\": new basic_1.IntegerType(),\n \"circular\": new basic_1.IntegerType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"SHIFT_RIGHT\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"places\": new basic_1.IntegerType(),\n \"circular\": new basic_1.IntegerType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"SIGN\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.IntegerType(),\n },\n {\n name: \"SIN\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.FloatType(),\n },\n {\n name: \"SINH\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.FloatType(),\n },\n {\n name: \"SQRT\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.FloatType(),\n },\n {\n name: \"STRLEN\",\n mandatory: {\n \"val\": new basic_1.CLikeType(),\n },\n return: new basic_1.IntegerType(),\n },\n {\n name: \"SUBSTRING\",\n mandatory: {\n \"val\": new basic_1.CLikeType(),\n },\n optional: {\n \"off\": new basic_1.IntegerType(),\n \"len\": new basic_1.IntegerType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"SUBSTRING_AFTER\",\n mandatory: {\n \"val\": new basic_1.CLikeType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"regex\": new basic_1.StringType(),\n \"pcre\": new basic_1.StringType(),\n \"case\": new basic_1.CharacterType(1),\n \"len\": new basic_1.IntegerType(),\n \"occ\": new basic_1.IntegerType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"SUBSTRING_BEFORE\",\n mandatory: {\n \"val\": new basic_1.CLikeType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"regex\": new basic_1.StringType(),\n \"pcre\": new basic_1.StringType(),\n \"case\": new basic_1.CharacterType(1),\n \"len\": new basic_1.IntegerType(),\n \"occ\": new basic_1.IntegerType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"SUBSTRING_FROM\",\n mandatory: {\n \"val\": new basic_1.CLikeType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"regex\": new basic_1.StringType(),\n \"pcre\": new basic_1.StringType(),\n \"case\": new basic_1.CharacterType(1),\n \"len\": new basic_1.IntegerType(),\n \"occ\": new basic_1.IntegerType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"SUBSTRING_TO\",\n mandatory: {\n \"val\": new basic_1.CLikeType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"regex\": new basic_1.StringType(),\n \"pcre\": new basic_1.StringType(),\n \"case\": new basic_1.CharacterType(1),\n \"len\": new basic_1.IntegerType(),\n \"occ\": new basic_1.IntegerType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"TAN\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.FloatType(),\n },\n {\n name: \"TANH\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.FloatType(),\n },\n {\n name: \"TO_LOWER\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"TO_MIXED\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"case\": new basic_1.CharacterType(1),\n \"sep\": new basic_1.IntegerType(),\n \"min\": new basic_1.IntegerType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"TO_UPPER\",\n mandatory: { \"val\": new basic_1.StringType() },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"TRANSLATE\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n \"from\": new basic_1.StringType(),\n \"to\": new basic_1.StringType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"TRUNC\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.IntegerType(),\n },\n {\n name: \"UTCLONG_ADD\",\n mandatory: {\n \"val\": new basic_1.UTCLongType(),\n },\n optional: {\n \"days\": new basic_1.IntegerType(),\n \"hour\": new basic_1.IntegerType(),\n \"minutes\": new basic_1.IntegerType(),\n \"seconds\": new basic_1.FloatType(),\n },\n return: new basic_1.UTCLongType(),\n version: version_1.Version.v754,\n },\n {\n name: \"UTCLONG_CURRENT\",\n return: new basic_1.UTCLongType(),\n version: version_1.Version.v754,\n },\n {\n name: \"UTCLONG_DIFF\",\n mandatory: {\n \"high\": new basic_1.UTCLongType(),\n \"low\": new basic_1.UTCLongType(),\n },\n return: new basic_1.FloatType(),\n version: version_1.Version.v754,\n },\n {\n name: \"XSDBOOL\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n return: new basic_1.CharacterType(1),\n version: version_1.Version.v740sp08,\n },\n {\n name: \"XSTRLEN\",\n mandatory: {\n \"val\": new basic_1.XStringType(),\n },\n return: new basic_1.IntegerType(),\n },\n];\nexports.BuiltIn = BuiltIn;\n//# sourceMappingURL=_builtin.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/_builtin.js?");
|
|
6718
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.BuiltIn = exports.BuiltInMethod = void 0;\n/* eslint-disable max-len */\nconst _typed_identifier_1 = __webpack_require__(/*! ../types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\nconst basic_1 = __webpack_require__(/*! ../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nconst tokens_1 = __webpack_require__(/*! ../1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\nconst position_1 = __webpack_require__(/*! ../../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\nconst visibility_1 = __webpack_require__(/*! ../4_file_information/visibility */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js\");\nconst _identifier_1 = __webpack_require__(/*! ../4_file_information/_identifier */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/_identifier.js\");\nconst version_1 = __webpack_require__(/*! ../../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\nclass BuiltInMethod extends _identifier_1.Identifier {\n constructor(token, filename, method, row) {\n super(token, filename);\n this.method = method;\n this.row = row;\n }\n getRequiredParameters() {\n return [];\n }\n getOptional() {\n throw new Error(\"BuiltInMethod->Method not implemented.\");\n }\n getAll() {\n throw new Error(\"BuiltInMethod->getAll, Method not implemented.\");\n }\n getImporting() {\n const ret = [];\n for (const i in this.method.mandatory) {\n const id = new tokens_1.Identifier(new position_1.Position(this.row, 1), i);\n ret.push(new _typed_identifier_1.TypedIdentifier(id, BuiltIn.filename, this.method.mandatory[i]));\n }\n for (const i in this.method.optional) {\n const id = new tokens_1.Identifier(new position_1.Position(this.row, 1), i);\n ret.push(new _typed_identifier_1.TypedIdentifier(id, BuiltIn.filename, this.method.optional[i]));\n }\n return ret;\n }\n getDefaultImporting() {\n if (this.method.mandatory === undefined) {\n return undefined;\n }\n const keys = Object.keys(this.method.mandatory);\n if (keys.length === 1) {\n return keys[0].toUpperCase();\n }\n return undefined;\n }\n getExporting() {\n return [];\n }\n getRaising() {\n return [];\n }\n getChanging() {\n return [];\n }\n getReturning() {\n const id = new tokens_1.Identifier(new position_1.Position(this.row, 1), \"ret\");\n return new _typed_identifier_1.TypedIdentifier(id, BuiltIn.filename, this.method.return);\n }\n getExceptions() {\n return [];\n }\n getVisibility() {\n return visibility_1.Visibility.Public;\n }\n isRedefinition() {\n return false;\n }\n isAbstract() {\n return false;\n }\n isStatic() {\n return false;\n }\n isEventHandler() {\n return false;\n }\n getParameters() {\n return this;\n }\n getParameterDefault(_parameter) {\n return undefined;\n }\n}\nexports.BuiltInMethod = BuiltInMethod;\nclass BuiltIn {\n constructor() {\n this.row = 1;\n }\n buildDefinition(method, row) {\n const token = new tokens_1.Identifier(new position_1.Position(row, 1), method.name);\n return new BuiltInMethod(token, BuiltIn.filename, method, row);\n }\n searchBuiltin(name) {\n if (name === undefined) {\n return undefined;\n }\n // todo, optimize, use hash map\n const index = BuiltIn.methods.findIndex(a => a.name === name.toUpperCase());\n if (index < 0) {\n return undefined;\n }\n return this.buildDefinition(BuiltIn.methods[index], index);\n }\n isPredicate(name) {\n if (name === undefined) {\n return undefined;\n }\n // todo, optimize, use hash map\n const index = BuiltIn.methods.findIndex(a => a.name === name.toUpperCase());\n if (index < 0) {\n return undefined;\n }\n return BuiltIn.methods[index].predicate;\n }\n getTypes() {\n const ret = this.buildSY();\n const id = new tokens_1.Identifier(new position_1.Position(1, 1), \"abap_bool\");\n ret.push(new _typed_identifier_1.TypedIdentifier(id, BuiltIn.filename, new basic_1.CharacterType(1, { qualifiedName: \"ABAP_BOOL\", ddicName: \"ABAP_BOOL\" })));\n return ret;\n }\n get(extras) {\n const ret = this.buildSY();\n ret.push(this.buildVariable(\"screen\")); // todo, add structure, or alternatively make native Statements\n ret.push(this.buildConstant(\"%_BACKSPACE\"));\n ret.push(this.buildConstant(\"%_CHARSIZE\"));\n ret.push(this.buildConstant(\"%_CR_LF\"));\n ret.push(this.buildConstant(\"%_ENDIAN\"));\n ret.push(this.buildConstant(\"%_FORMFEED\"));\n ret.push(this.buildConstant(\"%_HORIZONTAL_TAB\"));\n ret.push(this.buildConstant(\"%_MAXCHAR\"));\n ret.push(this.buildConstant(\"%_MINCHAR\"));\n ret.push(this.buildConstant(\"%_NEWLINE\"));\n ret.push(this.buildConstant(\"%_VERTICAL_TAB\"));\n ret.push(this.buildConstant(\"abap_false\", new basic_1.CharacterType(1, { qualifiedName: \"ABAP_BOOL\", ddicName: \"ABAP_BOOL\" }), \"' '\"));\n ret.push(this.buildConstant(\"abap_true\", new basic_1.CharacterType(1, { qualifiedName: \"ABAP_BOOL\", ddicName: \"ABAP_BOOL\" }), \"'X'\"));\n ret.push(this.buildConstant(\"abap_undefined\", new basic_1.CharacterType(1, { qualifiedName: \"ABAP_BOOL\", ddicName: \"ABAP_BOOL\" }), \"'-'\"));\n ret.push(this.buildConstant(\"abap_off\", new basic_1.CharacterType(1, { qualifiedName: \"ABAP_BOOL\", ddicName: \"ABAP_BOOL\" }), \"' '\"));\n ret.push(this.buildConstant(\"abap_on\", new basic_1.CharacterType(1, { qualifiedName: \"ABAP_BOOL\", ddicName: \"ABAP_BOOL\" }), \"'X'\"));\n ret.push(this.buildConstant(\"col_background\", new basic_1.IntegerType(), \"0\"));\n ret.push(this.buildConstant(\"col_heading\", new basic_1.IntegerType(), \"1\"));\n ret.push(this.buildConstant(\"col_key\", new basic_1.IntegerType(), \"4\"));\n ret.push(this.buildConstant(\"col_negative\", new basic_1.IntegerType(), \"6\"));\n ret.push(this.buildConstant(\"col_group\", new basic_1.IntegerType(), \"7\"));\n ret.push(this.buildConstant(\"col_normal\", new basic_1.IntegerType(), \"2\"));\n ret.push(this.buildConstant(\"col_positive\", new basic_1.IntegerType(), \"5\"));\n ret.push(this.buildConstant(\"col_total\", new basic_1.IntegerType(), \"3\"));\n ret.push(this.buildConstant(\"space\", new basic_1.CharacterType(1), \"' '\"));\n for (const e of extras) {\n const id = new tokens_1.Identifier(new position_1.Position(this.row++, 1), e);\n ret.push(new _typed_identifier_1.TypedIdentifier(id, BuiltIn.filename, new basic_1.VoidType(e), [\"read_only\" /* IdentifierMeta.ReadOnly */, \"built-in\" /* IdentifierMeta.BuiltIn */], \"'?'\"));\n }\n return ret;\n }\n /////////////////////////////\n buildSY() {\n const components = [];\n components.push({ name: \"abcde\", type: new basic_1.CharacterType(26, { qualifiedName: \"sy-abcde\" }) });\n components.push({ name: \"batch\", type: new basic_1.CharacterType(1, { qualifiedName: \"sy-batch\" }) });\n components.push({ name: \"binpt\", type: new basic_1.CharacterType(1, { qualifiedName: \"sy-binpt\" }) });\n components.push({ name: \"calld\", type: new basic_1.CharacterType(1, { qualifiedName: \"sy-calld\" }) });\n components.push({ name: \"callr\", type: new basic_1.CharacterType(8, { qualifiedName: \"sy-callr\" }) });\n components.push({ name: \"colno\", type: new basic_1.IntegerType() });\n components.push({ name: \"cpage\", type: new basic_1.IntegerType() });\n components.push({ name: \"cprog\", type: new basic_1.CharacterType(40, { qualifiedName: \"sy-cprog\" }) });\n components.push({ name: \"cucol\", type: new basic_1.IntegerType() });\n components.push({ name: \"curow\", type: new basic_1.IntegerType() });\n components.push({ name: \"datar\", type: new basic_1.CharacterType(1, { qualifiedName: \"sy-datar\" }) });\n components.push({ name: \"datlo\", type: new basic_1.DateType() });\n components.push({ name: \"datum\", type: new basic_1.DateType() });\n components.push({ name: \"dayst\", type: new basic_1.CharacterType(1) });\n components.push({ name: \"dbcnt\", type: new basic_1.IntegerType() });\n components.push({ name: \"dbnam\", type: new basic_1.CharacterType(20, { qualifiedName: \"sy-dbnam\" }) });\n components.push({ name: \"dbsys\", type: new basic_1.CharacterType(10, { qualifiedName: \"sy-dbsys\" }) });\n components.push({ name: \"dyngr\", type: new basic_1.CharacterType(4, { qualifiedName: \"sy-dyngr\" }) });\n components.push({ name: \"dynnr\", type: new basic_1.CharacterType(4, { qualifiedName: \"sy-dynnr\" }) });\n components.push({ name: \"fdayw\", type: new basic_1.IntegerType() });\n components.push({ name: \"fdpos\", type: new basic_1.IntegerType() });\n components.push({ name: \"fleng\", type: new basic_1.IntegerType() });\n components.push({ name: \"folen\", type: new basic_1.IntegerType() });\n components.push({ name: \"host\", type: new basic_1.CharacterType(32, { qualifiedName: \"sy-host\" }) });\n components.push({ name: \"index\", type: new basic_1.IntegerType() });\n components.push({ name: \"input\", type: new basic_1.CharacterType(1, { qualifiedName: \"sy-input\" }) });\n components.push({ name: \"langu\", type: new basic_1.CharacterType(1, { qualifiedName: \"sy-langu\", conversionExit: \"ISOLA\" }) });\n components.push({ name: \"ldbpg\", type: new basic_1.CharacterType(40, { qualifiedName: \"sy-ldbpg\" }) });\n components.push({ name: \"lilli\", type: new basic_1.IntegerType() });\n components.push({ name: \"linct\", type: new basic_1.IntegerType() });\n components.push({ name: \"linno\", type: new basic_1.IntegerType() });\n components.push({ name: \"linsz\", type: new basic_1.IntegerType() });\n components.push({ name: \"lisel\", type: new basic_1.CharacterType(255, { qualifiedName: \"sy-lisel\" }) });\n components.push({ name: \"listi\", type: new basic_1.IntegerType() });\n components.push({ name: \"loopc\", type: new basic_1.IntegerType() });\n components.push({ name: \"lsind\", type: new basic_1.IntegerType() });\n components.push({ name: \"macol\", type: new basic_1.IntegerType() });\n components.push({ name: \"mandt\", type: new basic_1.CharacterType(3, { qualifiedName: \"sy-mandt\" }) });\n components.push({ name: \"marow\", type: new basic_1.IntegerType() });\n components.push({ name: \"modno\", type: new basic_1.IntegerType() });\n components.push({ name: \"msgid\", type: new basic_1.CharacterType(20, { qualifiedName: \"sy-msgid\" }) });\n components.push({ name: \"msgli\", type: new basic_1.CharacterType(60, { qualifiedName: \"sy-msgli\" }) });\n components.push({ name: \"msgno\", type: new basic_1.NumericType(3, \"sy-msgno\") });\n components.push({ name: \"msgty\", type: new basic_1.CharacterType(1, { qualifiedName: \"sy-msgty\" }) });\n components.push({ name: \"msgv1\", type: new basic_1.CharacterType(50, { qualifiedName: \"sy-msgv1\" }) });\n components.push({ name: \"msgv2\", type: new basic_1.CharacterType(50, { qualifiedName: \"sy-msgv2\" }) });\n components.push({ name: \"msgv3\", type: new basic_1.CharacterType(50, { qualifiedName: \"sy-msgv3\" }) });\n components.push({ name: \"msgv4\", type: new basic_1.CharacterType(50, { qualifiedName: \"sy-msgv4\" }) });\n components.push({ name: \"opsys\", type: new basic_1.CharacterType(10, { qualifiedName: \"sy-opsys\" }) });\n components.push({ name: \"pagno\", type: new basic_1.IntegerType() });\n components.push({ name: \"pdest\", type: new basic_1.CharacterType(4, { qualifiedName: \"sy-pdest\" }) });\n components.push({ name: \"pfkey\", type: new basic_1.CharacterType(20, { qualifiedName: \"sy-pfkey\" }) });\n components.push({ name: \"repid\", type: new basic_1.CharacterType(40, { qualifiedName: \"sy-repid\" }) });\n components.push({ name: \"saprl\", type: new basic_1.CharacterType(4, { qualifiedName: \"sy-saprl\" }) });\n components.push({ name: \"scols\", type: new basic_1.IntegerType() });\n components.push({ name: \"slset\", type: new basic_1.CharacterType(14, { qualifiedName: \"sy-slset\" }) });\n components.push({ name: \"spono\", type: new basic_1.CharacterType(10, { qualifiedName: \"sy-spono\" }) });\n components.push({ name: \"srows\", type: new basic_1.IntegerType() });\n components.push({ name: \"staco\", type: new basic_1.IntegerType() });\n components.push({ name: \"staro\", type: new basic_1.IntegerType() });\n components.push({ name: \"stepl\", type: new basic_1.IntegerType() });\n components.push({ name: \"subrc\", type: new basic_1.IntegerType() });\n components.push({ name: \"sysid\", type: new basic_1.CharacterType(3, { qualifiedName: \"sy-sysid\" }) });\n components.push({ name: \"tabix\", type: new basic_1.IntegerType() });\n components.push({ name: \"tcode\", type: new basic_1.CharacterType(20, { qualifiedName: \"sy-tcode\" }) });\n components.push({ name: \"tfill\", type: new basic_1.IntegerType() });\n components.push({ name: \"timlo\", type: new basic_1.TimeType() });\n components.push({ name: \"title\", type: new basic_1.CharacterType(70, { qualifiedName: \"sy-title\" }) });\n components.push({ name: \"tleng\", type: new basic_1.IntegerType() });\n components.push({ name: \"tvar0\", type: new basic_1.CharacterType(20, { qualifiedName: \"sy-tvar0\" }) });\n components.push({ name: \"tvar1\", type: new basic_1.CharacterType(20, { qualifiedName: \"sy-tvar1\" }) });\n components.push({ name: \"tvar2\", type: new basic_1.CharacterType(20, { qualifiedName: \"sy-tvar2\" }) });\n components.push({ name: \"tvar3\", type: new basic_1.CharacterType(20, { qualifiedName: \"sy-tvar3\" }) });\n components.push({ name: \"tvar4\", type: new basic_1.CharacterType(20, { qualifiedName: \"sy-tvar4\" }) });\n components.push({ name: \"tvar5\", type: new basic_1.CharacterType(20, { qualifiedName: \"sy-tvar5\" }) });\n components.push({ name: \"tvar6\", type: new basic_1.CharacterType(20, { qualifiedName: \"sy-tvar6\" }) });\n components.push({ name: \"tvar7\", type: new basic_1.CharacterType(20, { qualifiedName: \"sy-tvar7\" }) });\n components.push({ name: \"tvar8\", type: new basic_1.CharacterType(20, { qualifiedName: \"sy-tvar8\" }) });\n components.push({ name: \"tvar9\", type: new basic_1.CharacterType(20, { qualifiedName: \"sy-tvar9\" }) });\n components.push({ name: \"tzone\", type: new basic_1.IntegerType() });\n components.push({ name: \"ucomm\", type: new basic_1.CharacterType(70, { qualifiedName: \"sy-ucomm\" }) });\n components.push({ name: \"uline\", type: new basic_1.CharacterType(255, { qualifiedName: \"sy-uline\" }) });\n components.push({ name: \"uname\", type: new basic_1.CharacterType(12, { qualifiedName: \"sy-uname\" }) });\n components.push({ name: \"uzeit\", type: new basic_1.TimeType() });\n components.push({ name: \"vline\", type: new basic_1.CharacterType(1, { qualifiedName: \"sy-vline\" }) });\n components.push({ name: \"wtitl\", type: new basic_1.CharacterType(1, { qualifiedName: \"sy-wtitl\" }) });\n components.push({ name: \"zonlo\", type: new basic_1.CharacterType(6, { qualifiedName: \"sy-zonlo\" }) });\n const type = new basic_1.StructureType(components);\n const id1 = new tokens_1.Identifier(new position_1.Position(this.row++, 1), \"sy\");\n const sy = new _typed_identifier_1.TypedIdentifier(id1, BuiltIn.filename, type, [\"read_only\" /* IdentifierMeta.ReadOnly */, \"built-in\" /* IdentifierMeta.BuiltIn */]);\n const id2 = new tokens_1.Identifier(new position_1.Position(this.row++, 1), \"syst\");\n const syst = new _typed_identifier_1.TypedIdentifier(id2, BuiltIn.filename, type, [\"read_only\" /* IdentifierMeta.ReadOnly */, \"built-in\" /* IdentifierMeta.BuiltIn */]);\n return [sy, syst];\n }\n buildConstant(name, type, value) {\n const id = new tokens_1.Identifier(new position_1.Position(this.row++, 1), name);\n if (type === undefined) {\n type = new basic_1.VoidType(name);\n }\n if (value === undefined) {\n value = \"'?'\";\n }\n return new _typed_identifier_1.TypedIdentifier(id, BuiltIn.filename, type, [\"read_only\" /* IdentifierMeta.ReadOnly */, \"built-in\" /* IdentifierMeta.BuiltIn */], value);\n }\n buildVariable(name) {\n const id = new tokens_1.Identifier(new position_1.Position(this.row++, 1), name);\n return new _typed_identifier_1.TypedIdentifier(id, BuiltIn.filename, new basic_1.VoidType(name), [\"built-in\" /* IdentifierMeta.BuiltIn */]);\n }\n}\nBuiltIn.filename = \"_builtin.prog.abap\";\n// todo: \"pcre\" vs \"regex\", only one of these parameters are allowed\n// todo: \"pcre\", only possible from 755\nBuiltIn.methods = [\n {\n name: \"ABS\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.IntegerType(),\n },\n {\n name: \"ACOS\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.FloatType(),\n },\n {\n name: \"ASIN\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.FloatType(),\n },\n {\n name: \"ATAN\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.FloatType(),\n },\n {\n name: \"BIT-SET\",\n mandatory: {\n \"val\": new basic_1.IntegerType(),\n },\n return: new basic_1.XStringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"BOOLC\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"BOOLX\",\n mandatory: {\n \"bool\": new basic_1.StringType(),\n },\n optional: {\n \"bit\": new basic_1.IntegerType(),\n },\n return: new basic_1.XStringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"CEIL\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.IntegerType(),\n },\n {\n name: \"CHAR_OFF\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n \"add\": new basic_1.IntegerType(),\n },\n optional: {\n \"off\": new basic_1.IntegerType(),\n },\n return: new basic_1.IntegerType(),\n version: version_1.Version.v702,\n },\n {\n name: \"CHARLEN\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n return: new basic_1.IntegerType(),\n },\n {\n name: \"CMAX\",\n mandatory: {\n \"val1\": new basic_1.StringType(),\n \"val2\": new basic_1.StringType(),\n },\n optional: {\n \"val3\": new basic_1.StringType(),\n \"val4\": new basic_1.StringType(),\n \"val5\": new basic_1.StringType(),\n \"val6\": new basic_1.StringType(),\n \"val7\": new basic_1.StringType(),\n \"val9\": new basic_1.StringType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"CMIN\",\n mandatory: {\n \"val1\": new basic_1.StringType(),\n \"val2\": new basic_1.StringType(),\n },\n optional: {\n \"val3\": new basic_1.StringType(),\n \"val4\": new basic_1.StringType(),\n \"val5\": new basic_1.StringType(),\n \"val6\": new basic_1.StringType(),\n \"val7\": new basic_1.StringType(),\n \"val9\": new basic_1.StringType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"CONCAT_LINES_OF\",\n mandatory: {\n \"table\": new basic_1.TableType(new basic_1.AnyType(), { withHeader: false, keyType: basic_1.TableKeyType.default }),\n },\n optional: {\n \"sep\": new basic_1.StringType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"CONDENSE\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"del\": new basic_1.StringType(),\n \"from\": new basic_1.StringType(),\n \"to\": new basic_1.StringType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"CONTAINS\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"start\": new basic_1.StringType(),\n \"end\": new basic_1.StringType(),\n \"regex\": new basic_1.StringType(),\n \"pcre\": new basic_1.StringType(),\n \"case\": new basic_1.CharacterType(1),\n \"off\": new basic_1.IntegerType(),\n \"len\": new basic_1.IntegerType(),\n \"occ\": new basic_1.IntegerType(),\n },\n return: new basic_1.CharacterType(1),\n predicate: true,\n version: version_1.Version.v702,\n },\n {\n name: \"CONTAINS_ANY_NOT_OF\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"start\": new basic_1.StringType(),\n \"end\": new basic_1.StringType(),\n \"off\": new basic_1.IntegerType(),\n \"len\": new basic_1.IntegerType(),\n \"occ\": new basic_1.IntegerType(),\n },\n predicate: true,\n return: new basic_1.CharacterType(1), version: version_1.Version.v702,\n },\n {\n name: \"CONTAINS_ANY_OF\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"start\": new basic_1.StringType(),\n \"end\": new basic_1.StringType(),\n \"off\": new basic_1.IntegerType(),\n \"len\": new basic_1.IntegerType(),\n \"occ\": new basic_1.IntegerType(),\n },\n return: new basic_1.CharacterType(1),\n predicate: true,\n version: version_1.Version.v702,\n },\n {\n name: \"COS\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.FloatType(),\n },\n {\n name: \"COSH\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.FloatType(),\n },\n {\n name: \"COUNT\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"regex\": new basic_1.StringType(),\n \"pcre\": new basic_1.StringType(),\n \"case\": new basic_1.CharacterType(1),\n \"off\": new basic_1.IntegerType(),\n \"len\": new basic_1.IntegerType(),\n },\n return: new basic_1.IntegerType(),\n version: version_1.Version.v702,\n },\n {\n name: \"COUNT_ANY_NOT_OF\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"regex\": new basic_1.StringType(),\n \"pcre\": new basic_1.StringType(),\n \"case\": new basic_1.CharacterType(1),\n \"off\": new basic_1.IntegerType(),\n \"len\": new basic_1.IntegerType(),\n },\n return: new basic_1.IntegerType(),\n version: version_1.Version.v702,\n },\n {\n name: \"COUNT_ANY_OF\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"regex\": new basic_1.StringType(),\n \"pcre\": new basic_1.StringType(),\n \"case\": new basic_1.CharacterType(1),\n \"off\": new basic_1.IntegerType(),\n \"len\": new basic_1.IntegerType(),\n },\n return: new basic_1.IntegerType(),\n version: version_1.Version.v702,\n },\n {\n name: \"DBMAXLEN\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n return: new basic_1.IntegerType(),\n },\n {\n name: \"DISTANCE\",\n mandatory: {\n \"val1\": new basic_1.StringType(),\n \"val2\": new basic_1.StringType(),\n },\n return: new basic_1.IntegerType(),\n version: version_1.Version.v702,\n },\n {\n name: \"ESCAPE\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n \"format\": new basic_1.StringType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"EXP\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.FloatType(),\n },\n {\n name: \"FIND\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"regex\": new basic_1.StringType(),\n \"pcre\": new basic_1.StringType(),\n \"case\": new basic_1.CharacterType(1),\n \"off\": new basic_1.IntegerType(),\n \"len\": new basic_1.IntegerType(),\n \"occ\": new basic_1.IntegerType(),\n },\n return: new basic_1.IntegerType(),\n version: version_1.Version.v702,\n },\n {\n name: \"FIND_ANY_NOT_OF\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"off\": new basic_1.IntegerType(),\n \"len\": new basic_1.IntegerType(),\n \"occ\": new basic_1.IntegerType(),\n },\n return: new basic_1.IntegerType(),\n version: version_1.Version.v702,\n },\n {\n name: \"FIND_ANY_OF\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"off\": new basic_1.IntegerType(),\n \"len\": new basic_1.IntegerType(),\n \"occ\": new basic_1.IntegerType(),\n },\n return: new basic_1.IntegerType(),\n version: version_1.Version.v702,\n },\n {\n name: \"FIND_END\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"regex\": new basic_1.StringType(),\n \"pcre\": new basic_1.StringType(),\n \"case\": new basic_1.CharacterType(1),\n \"off\": new basic_1.IntegerType(),\n \"len\": new basic_1.IntegerType(),\n \"occ\": new basic_1.IntegerType(),\n },\n return: new basic_1.IntegerType(),\n version: version_1.Version.v702,\n },\n {\n name: \"FLOOR\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.IntegerType(),\n },\n {\n name: \"FRAC\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.IntegerType(),\n },\n {\n name: \"FROM_MIXED\",\n mandatory: { \"val\": new basic_1.StringType() },\n optional: {\n \"case\": new basic_1.CharacterType(1),\n \"sep\": new basic_1.IntegerType(),\n \"min\": new basic_1.IntegerType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"INSERT\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n \"sub\": new basic_1.StringType(),\n },\n optional: {\n \"off\": new basic_1.IntegerType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"IPOW\",\n mandatory: {\n \"base\": new basic_1.FloatType(),\n \"exp\": new basic_1.FloatType(),\n },\n return: new basic_1.IntegerType(),\n version: version_1.Version.v740sp02,\n },\n {\n name: \"LINE_EXISTS\",\n mandatory: {\n \"val\": new basic_1.AnyType(),\n },\n return: new basic_1.CharacterType(1),\n predicate: true,\n version: version_1.Version.v740sp02,\n },\n {\n name: \"LINE_INDEX\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n return: new basic_1.IntegerType(),\n version: version_1.Version.v740sp02,\n },\n {\n name: \"LINES\",\n mandatory: {\n \"val\": new basic_1.TableType(new basic_1.AnyType(), { withHeader: false, keyType: basic_1.TableKeyType.default }),\n },\n return: new basic_1.IntegerType(),\n },\n {\n name: \"LOG\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.FloatType(),\n },\n {\n name: \"LOG10\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.FloatType(),\n },\n {\n name: \"MATCH\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n }, optional: {\n \"case\": new basic_1.CharacterType(1),\n \"regex\": new basic_1.StringType(),\n \"pcre\": new basic_1.StringType(),\n \"occ\": new basic_1.IntegerType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"MATCHES\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"case\": new basic_1.CharacterType(1),\n \"regex\": new basic_1.StringType(),\n \"pcre\": new basic_1.StringType(),\n \"off\": new basic_1.IntegerType(),\n \"len\": new basic_1.IntegerType(),\n },\n return: new basic_1.CharacterType(1),\n predicate: true,\n version: version_1.Version.v702,\n },\n {\n name: \"NMAX\",\n mandatory: {\n \"val1\": new basic_1.StringType(),\n \"val2\": new basic_1.StringType(),\n },\n optional: {\n \"val3\": new basic_1.StringType(),\n \"val4\": new basic_1.StringType(),\n \"val5\": new basic_1.StringType(),\n \"val6\": new basic_1.StringType(),\n \"val7\": new basic_1.StringType(),\n \"val8\": new basic_1.StringType(),\n \"val9\": new basic_1.StringType(),\n },\n return: new basic_1.IntegerType(),\n version: version_1.Version.v702,\n },\n {\n name: \"NMIN\",\n mandatory: {\n \"val1\": new basic_1.StringType(),\n \"val2\": new basic_1.StringType(),\n },\n optional: {\n \"val3\": new basic_1.StringType(),\n \"val4\": new basic_1.StringType(),\n \"val5\": new basic_1.StringType(),\n \"val6\": new basic_1.StringType(),\n \"val7\": new basic_1.StringType(),\n \"val8\": new basic_1.StringType(),\n \"val9\": new basic_1.StringType(),\n },\n return: new basic_1.IntegerType(),\n version: version_1.Version.v702,\n },\n {\n name: \"NUMOFCHAR\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n return: new basic_1.IntegerType(),\n },\n {\n name: \"REPEAT\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n \"occ\": new basic_1.IntegerType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"REPLACE\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n \"with\": new basic_1.StringType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"regex\": new basic_1.StringType(),\n \"pcre\": new basic_1.StringType(),\n \"case\": new basic_1.CharacterType(1),\n \"off\": new basic_1.IntegerType(),\n \"len\": new basic_1.IntegerType(),\n \"occ\": new basic_1.IntegerType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"RESCALE\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n optional: {\n \"dec\": new basic_1.IntegerType(),\n \"prec\": new basic_1.IntegerType(),\n \"mode\": new basic_1.IntegerType(),\n },\n return: new basic_1.FloatType(),\n version: version_1.Version.v702,\n },\n {\n name: \"REVERSE\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"ROUND\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n optional: {\n \"dec\": new basic_1.IntegerType(),\n \"prec\": new basic_1.IntegerType(),\n \"mode\": new basic_1.IntegerType(),\n },\n return: new basic_1.IntegerType(),\n version: version_1.Version.v702,\n },\n {\n name: \"SEGMENT\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n \"index\": new basic_1.IntegerType(),\n },\n optional: {\n \"sep\": new basic_1.StringType(),\n \"space\": new basic_1.StringType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"SHIFT_LEFT\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"places\": new basic_1.IntegerType(),\n \"circular\": new basic_1.IntegerType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"SHIFT_RIGHT\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"places\": new basic_1.IntegerType(),\n \"circular\": new basic_1.IntegerType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"SIGN\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.IntegerType(),\n },\n {\n name: \"SIN\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.FloatType(),\n },\n {\n name: \"SINH\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.FloatType(),\n },\n {\n name: \"SQRT\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.FloatType(),\n },\n {\n name: \"STRLEN\",\n mandatory: {\n \"val\": new basic_1.CLikeType(),\n },\n return: new basic_1.IntegerType(),\n },\n {\n name: \"SUBSTRING\",\n mandatory: {\n \"val\": new basic_1.CLikeType(),\n },\n optional: {\n \"off\": new basic_1.IntegerType(),\n \"len\": new basic_1.IntegerType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"SUBSTRING_AFTER\",\n mandatory: {\n \"val\": new basic_1.CLikeType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"regex\": new basic_1.StringType(),\n \"pcre\": new basic_1.StringType(),\n \"case\": new basic_1.CharacterType(1),\n \"len\": new basic_1.IntegerType(),\n \"occ\": new basic_1.IntegerType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"SUBSTRING_BEFORE\",\n mandatory: {\n \"val\": new basic_1.CLikeType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"regex\": new basic_1.StringType(),\n \"pcre\": new basic_1.StringType(),\n \"case\": new basic_1.CharacterType(1),\n \"len\": new basic_1.IntegerType(),\n \"occ\": new basic_1.IntegerType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"SUBSTRING_FROM\",\n mandatory: {\n \"val\": new basic_1.CLikeType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"regex\": new basic_1.StringType(),\n \"pcre\": new basic_1.StringType(),\n \"case\": new basic_1.CharacterType(1),\n \"len\": new basic_1.IntegerType(),\n \"occ\": new basic_1.IntegerType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"SUBSTRING_TO\",\n mandatory: {\n \"val\": new basic_1.CLikeType(),\n },\n optional: {\n \"sub\": new basic_1.StringType(),\n \"regex\": new basic_1.StringType(),\n \"pcre\": new basic_1.StringType(),\n \"case\": new basic_1.CharacterType(1),\n \"len\": new basic_1.IntegerType(),\n \"occ\": new basic_1.IntegerType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"TAN\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.FloatType(),\n },\n {\n name: \"TANH\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.FloatType(),\n },\n {\n name: \"TO_LOWER\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"TO_MIXED\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n optional: {\n \"case\": new basic_1.CharacterType(1),\n \"sep\": new basic_1.IntegerType(),\n \"min\": new basic_1.IntegerType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"TO_UPPER\",\n mandatory: { \"val\": new basic_1.StringType() },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"TRANSLATE\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n \"from\": new basic_1.StringType(),\n \"to\": new basic_1.StringType(),\n },\n return: new basic_1.StringType(),\n version: version_1.Version.v702,\n },\n {\n name: \"TRUNC\",\n mandatory: {\n \"val\": new basic_1.FloatType(),\n },\n return: new basic_1.IntegerType(),\n },\n {\n name: \"UTCLONG_ADD\",\n mandatory: {\n \"val\": new basic_1.UTCLongType(),\n },\n optional: {\n \"days\": new basic_1.IntegerType(),\n \"hour\": new basic_1.IntegerType(),\n \"minutes\": new basic_1.IntegerType(),\n \"seconds\": new basic_1.FloatType(),\n },\n return: new basic_1.UTCLongType(),\n version: version_1.Version.v754,\n },\n {\n name: \"UTCLONG_CURRENT\",\n return: new basic_1.UTCLongType(),\n version: version_1.Version.v754,\n },\n {\n name: \"UTCLONG_DIFF\",\n mandatory: {\n \"high\": new basic_1.UTCLongType(),\n \"low\": new basic_1.UTCLongType(),\n },\n return: new basic_1.FloatType(),\n version: version_1.Version.v754,\n },\n {\n name: \"XSDBOOL\",\n mandatory: {\n \"val\": new basic_1.StringType(),\n },\n return: new basic_1.CharacterType(1),\n version: version_1.Version.v740sp08,\n },\n {\n name: \"XSTRLEN\",\n mandatory: {\n \"val\": new basic_1.XStringType(),\n },\n return: new basic_1.IntegerType(),\n },\n];\nexports.BuiltIn = BuiltIn;\n//# sourceMappingURL=_builtin.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/_builtin.js?");
|
|
6719
6719
|
|
|
6720
6720
|
/***/ }),
|
|
6721
6721
|
|
|
@@ -6748,7 +6748,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
6748
6748
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
6749
6749
|
|
|
6750
6750
|
"use strict";
|
|
6751
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Procedural = void 0;\nconst Expressions = __webpack_require__(/*! ../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\nconst Statements = __webpack_require__(/*! ../2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\nconst Structures = __webpack_require__(/*! ../3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\nconst types_1 = __webpack_require__(/*! ../types */ \"./node_modules/@abaplint/core/build/src/abap/types/index.js\");\nconst _current_scope_1 = __webpack_require__(/*! ./_current_scope */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_current_scope.js\");\nconst _scope_type_1 = __webpack_require__(/*! ./_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\nconst objects_1 = __webpack_require__(/*! ../../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\nconst _typed_identifier_1 = __webpack_require__(/*! ../types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\nconst basic_1 = __webpack_require__(/*! ../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nconst ddic_1 = __webpack_require__(/*! ../../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\nconst _object_oriented_1 = __webpack_require__(/*! ./_object_oriented */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js\");\nclass Procedural {\n constructor(reg, scope) {\n this.scope = scope;\n this.reg = reg;\n }\n addAllFormDefinitions(file, obj) {\n const structure = file.getStructure();\n if (structure) {\n const dummy = _current_scope_1.CurrentScope.buildDefault(this.reg, obj);\n for (const found of structure.findAllStructures(Structures.Form)) {\n this.scope.addFormDefinitions([new types_1.FormDefinition(found, file.getFilename(), dummy)]);\n }\n }\n const stru = file.getStructure();\n if (stru === undefined) {\n return;\n }\n const includes = stru.findAllStatements(Statements.Include);\n for (const node of includes) {\n const found = this.findInclude(node, obj);\n if (found) {\n this.addAllFormDefinitions(found, obj);\n }\n }\n }\n findInclude(node, obj) {\n // assumption: no cyclic includes, includes not found are reported by rule \"check_include\"\n // todo: how to make sure code is not duplicated here and in rule \"check_include\" / include graph?\n const expr = node.findFirstExpression(Expressions.IncludeName);\n if (expr === undefined) {\n return undefined;\n }\n const name = expr.getFirstToken().getStr();\n // look in the current function group\n if (obj instanceof objects_1.FunctionGroup) {\n const incl = obj.getInclude(name);\n if (incl !== undefined) {\n return incl;\n }\n }\n const prog = this.reg.getObject(\"PROG\", name);\n if (prog !== undefined) {\n return prog.getABAPFiles()[0];\n }\n // todo, this is slow, try determining the FUGR name from the include name\n for (const fugr of this.reg.getObjectsByType(\"FUGR\")) {\n if (fugr instanceof objects_1.FunctionGroup) {\n const found = fugr.getInclude(name);\n if (found) {\n return found;\n }\n }\n }\n return undefined;\n }\n findFunctionScope(obj, node, filename) {\n var _a, _b, _c, _d, _e;\n if (!(obj instanceof objects_1.FunctionGroup)) {\n throw new Error(\"findFunctionScope, expected function group input\");\n }\n const nameToken = node.findFirstExpression(Expressions.Field).getFirstToken();\n const name = nameToken.getStr();\n this.scope.push(_scope_type_1.ScopeType.FunctionModule, name, node.getFirstToken().getStart(), filename);\n const definition = obj.getModule(name);\n if (definition === undefined) {\n throw new Error(\"Function module definition \\\"\" + name + \"\\\" not found\");\n }\n const ddic = new ddic_1.DDIC(this.reg);\n for (const param of definition.getParameters()) {\n let found = undefined;\n if (param.type === undefined || param.type === \"\") {\n found = new basic_1.AnyType();\n }\n else {\n found = ddic.lookup(param.type).type;\n }\n if (param.direction === types_1.FunctionModuleParameterDirection.tables) {\n if (found instanceof basic_1.TableType) {\n found = new basic_1.TableType(found.getRowType(), { withHeader: true });\n }\n else {\n found = new basic_1.TableType(found, { withHeader: true });\n }\n }\n if ((found instanceof basic_1.UnknownType || found instanceof basic_1.VoidType) && ((_a = param.type) === null || _a === void 0 ? void 0 : _a.includes(\"-\"))) {\n const [name, field] = param.type.split(\"-\");\n const f = ddic.lookupTableOrView(name).type;\n if (f && f instanceof basic_1.StructureType) {\n const c = f.getComponentByName(field);\n if (c) {\n found = c;\n }\n }\n if (found === undefined || found instanceof basic_1.UnknownType || found instanceof basic_1.VoidType) {\n const f = (_b = this.scope.findType(name)) === null || _b === void 0 ? void 0 : _b.getType();\n if (f && f instanceof basic_1.StructureType) {\n const c = f.getComponentByName(field);\n if (c) {\n found = c;\n }\n }\n }\n }\n else if ((found instanceof basic_1.UnknownType || found instanceof basic_1.VoidType) && ((_c = param.type) === null || _c === void 0 ? void 0 : _c.includes(\"=>\"))) {\n const [name, field] = param.type.split(\"=>\");\n const def = this.scope.findObjectDefinition(name);\n const c = new _object_oriented_1.ObjectOriented(this.scope).searchTypeName(def, field);\n if (c) {\n found = c.getType();\n }\n }\n if ((found instanceof basic_1.UnknownType || found instanceof basic_1.VoidType) && param.type) {\n const f = ddic.lookupBuiltinType(param.type);\n if (f) {\n found = f;\n }\n if (found === undefined || found instanceof basic_1.UnknownType || found instanceof basic_1.VoidType) {\n const f = (_d = this.scope.findType(param.type)) === null || _d === void 0 ? void 0 : _d.getType();\n if (f) {\n found = f;\n }\n }\n if (found === undefined || found instanceof basic_1.UnknownType || found instanceof basic_1.VoidType) {\n const f = (_e = this.scope.findTypePoolType(param.type)) === null || _e === void 0 ? void 0 : _e.getType();\n if (f) {\n found = f;\n }\n }\n }\n if (found instanceof basic_1.UnknownType && new ddic_1.DDIC(this.reg).inErrorNamespace(param.type) === false) {\n found = new basic_1.VoidType(param.type);\n }\n const type = new _typed_identifier_1.TypedIdentifier(nameToken, filename, found);\n this.scope.addNamedIdentifier(param.name, type);\n }\n }\n}\nexports.Procedural = Procedural;\n//# sourceMappingURL=_procedural.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/_procedural.js?");
|
|
6751
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Procedural = void 0;\nconst Expressions = __webpack_require__(/*! ../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\nconst Statements = __webpack_require__(/*! ../2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\nconst Structures = __webpack_require__(/*! ../3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\nconst types_1 = __webpack_require__(/*! ../types */ \"./node_modules/@abaplint/core/build/src/abap/types/index.js\");\nconst _current_scope_1 = __webpack_require__(/*! ./_current_scope */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_current_scope.js\");\nconst _scope_type_1 = __webpack_require__(/*! ./_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\nconst objects_1 = __webpack_require__(/*! ../../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\nconst _typed_identifier_1 = __webpack_require__(/*! ../types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\nconst basic_1 = __webpack_require__(/*! ../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nconst ddic_1 = __webpack_require__(/*! ../../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\nconst _object_oriented_1 = __webpack_require__(/*! ./_object_oriented */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js\");\nclass Procedural {\n constructor(reg, scope) {\n this.scope = scope;\n this.reg = reg;\n }\n addAllFormDefinitions(file, obj) {\n const structure = file.getStructure();\n if (structure) {\n const dummy = _current_scope_1.CurrentScope.buildDefault(this.reg, obj);\n for (const found of structure.findAllStructures(Structures.Form)) {\n this.scope.addFormDefinitions([new types_1.FormDefinition(found, file.getFilename(), dummy)]);\n }\n }\n const stru = file.getStructure();\n if (stru === undefined) {\n return;\n }\n const includes = stru.findAllStatements(Statements.Include);\n for (const node of includes) {\n const found = this.findInclude(node, obj);\n if (found) {\n this.addAllFormDefinitions(found, obj);\n }\n }\n }\n findInclude(node, obj) {\n // assumption: no cyclic includes, includes not found are reported by rule \"check_include\"\n // todo: how to make sure code is not duplicated here and in rule \"check_include\" / include graph?\n const expr = node.findFirstExpression(Expressions.IncludeName);\n if (expr === undefined) {\n return undefined;\n }\n const name = expr.getFirstToken().getStr();\n // look in the current function group\n if (obj instanceof objects_1.FunctionGroup) {\n const incl = obj.getInclude(name);\n if (incl !== undefined) {\n return incl;\n }\n }\n const prog = this.reg.getObject(\"PROG\", name);\n if (prog !== undefined) {\n return prog.getABAPFiles()[0];\n }\n // todo, this is slow, try determining the FUGR name from the include name\n for (const fugr of this.reg.getObjectsByType(\"FUGR\")) {\n if (fugr instanceof objects_1.FunctionGroup) {\n const found = fugr.getInclude(name);\n if (found) {\n return found;\n }\n }\n }\n return undefined;\n }\n findFunctionScope(obj, node, filename) {\n var _a, _b, _c, _d, _e;\n if (!(obj instanceof objects_1.FunctionGroup)) {\n throw new Error(\"findFunctionScope, expected function group input\");\n }\n const nameToken = node.findFirstExpression(Expressions.Field).getFirstToken();\n const name = nameToken.getStr();\n this.scope.push(_scope_type_1.ScopeType.FunctionModule, name, node.getFirstToken().getStart(), filename);\n const definition = obj.getModule(name);\n if (definition === undefined) {\n throw new Error(\"Function module definition \\\"\" + name + \"\\\" not found\");\n }\n const ddic = new ddic_1.DDIC(this.reg);\n for (const param of definition.getParameters()) {\n let found = undefined;\n if (param.type === undefined || param.type === \"\") {\n found = new basic_1.AnyType();\n }\n else {\n found = ddic.lookup(param.type).type;\n }\n if (param.direction === types_1.FunctionModuleParameterDirection.tables) {\n if (found instanceof basic_1.TableType) {\n found = new basic_1.TableType(found.getRowType(), { withHeader: true, keyType: basic_1.TableKeyType.default });\n }\n else {\n found = new basic_1.TableType(found, { withHeader: true, keyType: basic_1.TableKeyType.default });\n }\n }\n if ((found instanceof basic_1.UnknownType || found instanceof basic_1.VoidType) && ((_a = param.type) === null || _a === void 0 ? void 0 : _a.includes(\"-\"))) {\n const [name, field] = param.type.split(\"-\");\n const f = ddic.lookupTableOrView(name).type;\n if (f && f instanceof basic_1.StructureType) {\n const c = f.getComponentByName(field);\n if (c) {\n found = c;\n }\n }\n if (found === undefined || found instanceof basic_1.UnknownType || found instanceof basic_1.VoidType) {\n const f = (_b = this.scope.findType(name)) === null || _b === void 0 ? void 0 : _b.getType();\n if (f && f instanceof basic_1.StructureType) {\n const c = f.getComponentByName(field);\n if (c) {\n found = c;\n }\n }\n }\n }\n else if ((found instanceof basic_1.UnknownType || found instanceof basic_1.VoidType) && ((_c = param.type) === null || _c === void 0 ? void 0 : _c.includes(\"=>\"))) {\n const [name, field] = param.type.split(\"=>\");\n const def = this.scope.findObjectDefinition(name);\n const c = new _object_oriented_1.ObjectOriented(this.scope).searchTypeName(def, field);\n if (c) {\n found = c.getType();\n }\n }\n if ((found instanceof basic_1.UnknownType || found instanceof basic_1.VoidType) && param.type) {\n const f = ddic.lookupBuiltinType(param.type);\n if (f) {\n found = f;\n }\n if (found === undefined || found instanceof basic_1.UnknownType || found instanceof basic_1.VoidType) {\n const f = (_d = this.scope.findType(param.type)) === null || _d === void 0 ? void 0 : _d.getType();\n if (f) {\n found = f;\n }\n }\n if (found === undefined || found instanceof basic_1.UnknownType || found instanceof basic_1.VoidType) {\n const f = (_e = this.scope.findTypePoolType(param.type)) === null || _e === void 0 ? void 0 : _e.getType();\n if (f) {\n found = f;\n }\n }\n }\n if (found instanceof basic_1.UnknownType && new ddic_1.DDIC(this.reg).inErrorNamespace(param.type) === false) {\n found = new basic_1.VoidType(param.type);\n }\n const type = new _typed_identifier_1.TypedIdentifier(nameToken, filename, found);\n this.scope.addNamedIdentifier(param.name, type);\n }\n }\n}\nexports.Procedural = Procedural;\n//# sourceMappingURL=_procedural.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/_procedural.js?");
|
|
6752
6752
|
|
|
6753
6753
|
/***/ }),
|
|
6754
6754
|
|
|
@@ -6792,7 +6792,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
6792
6792
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
6793
6793
|
|
|
6794
6794
|
"use strict";
|
|
6795
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.BasicTypes = void 0;\n/* eslint-disable default-case */\nconst _typed_identifier_1 = __webpack_require__(/*! ../types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\nconst Expressions = __webpack_require__(/*! ../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\nconst Statements = __webpack_require__(/*! ../2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\nconst Types = __webpack_require__(/*! ../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nconst _scope_type_1 = __webpack_require__(/*! ./_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\nconst _object_oriented_1 = __webpack_require__(/*! ./_object_oriented */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js\");\nconst class_constant_1 = __webpack_require__(/*! ../types/class_constant */ \"./node_modules/@abaplint/core/build/src/abap/types/class_constant.js\");\nconst identifier_1 = __webpack_require__(/*! ../1_lexer/tokens/identifier */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/identifier.js\");\nconst _reference_1 = __webpack_require__(/*! ./_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\nconst basic_1 = __webpack_require__(/*! ../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nconst field_chain_1 = __webpack_require__(/*! ./expressions/field_chain */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/field_chain.js\");\nconst types_1 = __webpack_require__(/*! ../types */ \"./node_modules/@abaplint/core/build/src/abap/types/index.js\");\nconst expressions_1 = __webpack_require__(/*! ../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\nconst _builtin_1 = __webpack_require__(/*! ./_builtin */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_builtin.js\");\nconst position_1 = __webpack_require__(/*! ../../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\nclass BasicTypes {\n constructor(filename, scope) {\n this.filename = filename;\n this.scope = scope;\n }\n lookupQualifiedName(name) {\n var _a;\n // argh, todo, rewrite this entire method, more argh\n if (name === undefined) {\n return undefined;\n }\n const found = this.scope.findType(name);\n if (found) {\n return found;\n }\n if (name.includes(\"=>\")) {\n const split = name.split(\"=>\");\n const ooName = split[0];\n const typeName = split[1];\n const oo = this.scope.findObjectDefinition(ooName);\n if (oo) {\n if (typeName.includes(\"-\")) {\n const split = typeName.split(\"-\");\n const subTypeName = split[0];\n const fieldName = split[1];\n const stru = oo.getTypeDefinitions().getByName(subTypeName);\n const struType = stru === null || stru === void 0 ? void 0 : stru.getType();\n if (stru && struType instanceof basic_1.StructureType) {\n const f = struType.getComponentByName(fieldName);\n if (f) {\n return new _typed_identifier_1.TypedIdentifier(stru.getToken(), stru.getFilename(), f);\n }\n }\n }\n else {\n const f = oo.getTypeDefinitions().getByName(typeName);\n if (f) {\n return f;\n }\n }\n }\n }\n else if (name.includes(\"-\")) {\n const split = name.split(\"-\");\n const typeName = split[0];\n const fieldName = split[1];\n const type = this.scope.findType(typeName);\n if (type) {\n const stru = type.getType();\n if (stru instanceof basic_1.StructureType) {\n const f = stru.getComponentByName(fieldName);\n if (f) {\n return new _typed_identifier_1.TypedIdentifier(type.getToken(), type.getFilename(), f);\n }\n }\n }\n }\n const lookup = this.scope.getDDIC().lookupNoVoid(name);\n const id = (_a = lookup === null || lookup === void 0 ? void 0 : lookup.object) === null || _a === void 0 ? void 0 : _a.getIdentifier();\n if (id && (lookup === null || lookup === void 0 ? void 0 : lookup.type)) {\n return new _typed_identifier_1.TypedIdentifier(id.getToken(), id.getFilename(), lookup.type);\n }\n const builtin = this.scope.getDDIC().lookupBuiltinType(name);\n if (builtin) {\n return new _typed_identifier_1.TypedIdentifier(new identifier_1.Identifier(new position_1.Position(1, 1), name), _builtin_1.BuiltIn.filename, builtin);\n }\n const type = this.scope.findTypePoolType(name);\n if (type) {\n return type;\n }\n return undefined;\n }\n resolveLikeName(node, headerLogic = true) {\n var _a;\n if (node === undefined) {\n return undefined;\n }\n let chain = node.findFirstExpression(Expressions.FieldChain);\n if (chain === undefined) {\n chain = node.findFirstExpression(Expressions.TypeName);\n }\n if (chain === undefined) {\n chain = node.findFirstExpression(Expressions.FieldSub);\n }\n if (chain === undefined) {\n chain = node.findFirstExpression(Expressions.SimpleFieldChain);\n }\n if (chain === undefined) {\n throw new Error(\"resolveLikeName, chain undefined\");\n }\n const fullName = chain.concatTokens();\n const children = [...chain.getChildren()];\n if (children.length === 0) {\n return new Types.UnknownType(\"Type error, could not resolve \\\"\" + fullName + \"\\\", resolveLikeName1\");\n }\n let type = undefined;\n if (children[1] && (children[1].getFirstToken().getStr() === \"=>\" || children[1].getFirstToken().getStr() === \"->\")) {\n type = new field_chain_1.FieldChain().runSyntax(chain, this.scope, this.filename, _reference_1.ReferenceType.TypeReference);\n }\n else {\n const name = children.shift().getFirstToken().getStr();\n let found = this.scope.findVariable(name);\n type = found === null || found === void 0 ? void 0 : found.getType();\n if (found === undefined) {\n found = this.scope.findExtraLikeType(name);\n type = found === null || found === void 0 ? void 0 : found.getType();\n }\n if (found) {\n this.scope.addReference(chain === null || chain === void 0 ? void 0 : chain.getFirstToken(), found, _reference_1.ReferenceType.TypeReference, this.filename);\n }\n if (type === undefined) {\n type = (_a = this.scope.getDDIC().lookupNoVoid(name)) === null || _a === void 0 ? void 0 : _a.type;\n }\n if (type === undefined && this.scope.isOO() === false && this.scope.getDDIC().inErrorNamespace(name) === false) {\n this.scope.addReference(chain.getChildren()[0].getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.filename);\n return new Types.VoidType(name);\n }\n while (children.length > 0) {\n const child = children.shift();\n if (child.getFirstToken().getStr() === \"-\") {\n if (type instanceof Types.VoidType) {\n return type;\n }\n }\n else if (child.concatTokens() === \"[]\") {\n if (type instanceof Types.TableType) {\n type = new basic_1.TableType(type.getRowType(), { withHeader: false });\n }\n }\n else { // field name\n let sub = undefined;\n if (type instanceof Types.TableType) {\n type = type.getRowType();\n }\n if (type instanceof Types.StructureType) {\n sub = type.getComponentByName(child.getFirstToken().getStr());\n }\n if (sub === undefined) {\n return new Types.UnknownType(\"Type error, field not part of structure \" + fullName);\n }\n type = sub;\n }\n }\n if (type instanceof Types.VoidType) {\n return type;\n }\n else if (type instanceof basic_1.TableType\n && type.isWithHeader()\n && headerLogic === true) {\n type = type.getRowType();\n }\n else if (type instanceof Types.TableType\n && type.isWithHeader() === true\n && type.getRowType() instanceof Types.VoidType) {\n return type.getRowType();\n }\n }\n if (!type) {\n return new Types.UnknownType(\"Type error, could not resolve \\\"\" + fullName + \"\\\", resolveLikeName2\");\n }\n return type;\n }\n cloneType(type, qualifiedName) {\n // nested types(containing \"-\") will inherit the qualified names if possible\n // todo, this needs to be extended to all AbstractTypes instead of just CharacterType\n if (type instanceof basic_1.CharacterType\n && qualifiedName\n && qualifiedName.includes(\"-\") === false) {\n type = type.cloneType(qualifiedName);\n }\n return type;\n }\n resolveTypeName(typeName, length, decimals, qualifiedName) {\n var _a;\n if (typeName === undefined) {\n return undefined;\n }\n const chain = this.resolveTypeChain(typeName);\n if (chain) {\n return this.cloneType(chain, qualifiedName);\n }\n const chainText = typeName.concatTokens().toUpperCase();\n const f = this.scope.getDDIC().lookupBuiltinType(chainText, length, decimals, qualifiedName);\n if (f !== undefined) {\n return f;\n }\n const typ = this.scope.findType(chainText);\n if (typ) {\n const token = typeName.getFirstToken();\n if (chainText.includes(\"~\")) {\n const name = chainText.split(\"~\")[0];\n const idef = this.scope.findInterfaceDefinition(name);\n if (idef) {\n this.scope.addReference(token, idef, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: \"INTF\", ooName: name });\n }\n }\n this.scope.addReference(token, typ, _reference_1.ReferenceType.TypeReference, this.filename);\n return typ.getType();\n }\n const type = (_a = this.scope.findTypePoolType(chainText)) === null || _a === void 0 ? void 0 : _a.getType();\n if (type) {\n // this.scope.addReference(typeName.getFirstToken(), type, ReferenceType.TypeReference, this.filename);\n return type;\n }\n const ddic = this.scope.getDDIC().lookup(chainText);\n if (ddic) {\n this.scope.getDDICReferences().addUsing(this.scope.getParentObj(), { object: ddic.object, token: typeName.getFirstToken(), filename: this.filename });\n if (ddic.type instanceof _typed_identifier_1.TypedIdentifier) {\n this.scope.addReference(typeName.getFirstToken(), ddic.type, _reference_1.ReferenceType.TypeReference, this.filename);\n }\n else if (ddic.type instanceof basic_1.VoidType) {\n this.scope.addReference(typeName.getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.filename);\n }\n return this.cloneType(ddic.type, qualifiedName);\n }\n return undefined;\n }\n simpleType(node, qualifiedNamePrefix) {\n let nameExpr = node.findFirstExpression(Expressions.NamespaceSimpleName);\n if (nameExpr === undefined) {\n nameExpr = node.findFirstExpression(Expressions.DefinitionName);\n }\n if (nameExpr === undefined) {\n return undefined;\n }\n let name = nameExpr.getFirstToken();\n if (nameExpr.countTokens() > 1) { // workaround for names with dashes\n name = new identifier_1.Identifier(name.getStart(), nameExpr.concatTokens());\n }\n let qualifiedName = undefined;\n if (node.get() instanceof Statements.Type) {\n if (this.scope.isTypePool() === true) {\n qualifiedName = name.getStr();\n }\n else {\n qualifiedName = (qualifiedNamePrefix || \"\") + name.getStr();\n if (this.scope.getType() === _scope_type_1.ScopeType.ClassDefinition\n || this.scope.getType() === _scope_type_1.ScopeType.Interface) {\n qualifiedName = this.scope.getName() + \"=>\" + qualifiedName;\n }\n }\n }\n else if (qualifiedNamePrefix) {\n qualifiedName = qualifiedNamePrefix + qualifiedName;\n }\n const found = this.parseType(node, qualifiedName);\n if (found) {\n return new _typed_identifier_1.TypedIdentifier(name, this.filename, found);\n }\n return undefined;\n }\n parseTable(node, name) {\n var _a, _b, _c;\n const typename = node.findFirstExpression(Expressions.TypeName);\n const text = (_a = node.findFirstExpression(Expressions.TypeTable)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();\n if (text === undefined) {\n return undefined;\n }\n let type = undefined;\n if (text.startsWith(\"TYPE STANDARD TABLE \")\n || text.startsWith(\"TYPE TABLE \")\n || text.startsWith(\"LIKE TABLE \")\n || text.startsWith(\"LIKE STANDARD TABLE \")) {\n type = basic_1.TableAccessType.standard;\n }\n else if (text.startsWith(\"TYPE SORTED TABLE \")\n || text.startsWith(\"LIKE SORTED TABLE \")) {\n type = basic_1.TableAccessType.sorted;\n }\n else if (text.startsWith(\"TYPE HASHED TABLE \")\n || text.startsWith(\"LIKE HASHED TABLE \")) {\n type = basic_1.TableAccessType.hashed;\n }\n const typeTableKeys = node.findAllExpressions(expressions_1.TypeTableKey);\n const firstKey = typeTableKeys[0];\n const isNamed = (firstKey === null || firstKey === void 0 ? void 0 : firstKey.findDirectExpression(expressions_1.Field)) !== undefined;\n const primaryKey = {\n name: \"primary_key\",\n type: type,\n isUnique: isNamed ? false : (firstKey === null || firstKey === void 0 ? void 0 : firstKey.concatTokens().toUpperCase().includes(\"WITH UNIQUE \")) === true,\n keyFields: [],\n };\n let start = 1;\n if (isNamed === false) {\n for (const k of (firstKey === null || firstKey === void 0 ? void 0 : firstKey.findDirectExpressions(expressions_1.FieldSub)) || []) {\n primaryKey.keyFields.push(k.concatTokens().toUpperCase());\n }\n if (primaryKey.keyFields.length === 0 && text.includes(\" DEFAULT KEY\")) {\n primaryKey.keyFields.push(\"TABLE_LINE\");\n }\n }\n else {\n start = 0;\n }\n const secondaryKeys = [];\n for (let i = start; i < typeTableKeys.length; i++) {\n const row = typeTableKeys[i];\n const name = (_b = row.findDirectExpression(expressions_1.Field)) === null || _b === void 0 ? void 0 : _b.concatTokens();\n if (name === undefined) {\n continue;\n }\n const secondary = {\n name: name,\n type: row.findDirectTokenByText(\"SORTED\") ? basic_1.TableAccessType.sorted : basic_1.TableAccessType.hashed,\n isUnique: (row === null || row === void 0 ? void 0 : row.concatTokens().toUpperCase().includes(\"WITH UNIQUE \")) === true,\n keyFields: [],\n };\n for (const k of (row === null || row === void 0 ? void 0 : row.findDirectExpressions(expressions_1.FieldSub)) || []) {\n secondary.keyFields.push(k.concatTokens().toUpperCase());\n }\n secondaryKeys.push(secondary);\n }\n const options = {\n withHeader: text.includes(\" WITH HEADER LINE\"),\n primaryKey: primaryKey,\n secondary: secondaryKeys,\n };\n let found = undefined;\n if (text.startsWith(\"TYPE TABLE OF REF TO \")\n || text.startsWith(\"TYPE STANDARD TABLE OF REF TO \")\n || text.startsWith(\"TYPE SORTED TABLE OF REF TO \")\n || text.startsWith(\"TYPE HASHED TABLE OF REF TO \")) {\n found = this.resolveTypeRef(typename);\n if (found) {\n return new Types.TableType(found, options, name);\n }\n }\n else if (text.startsWith(\"TYPE TABLE OF \")\n || text.startsWith(\"TYPE STANDARD TABLE OF \")\n || text.startsWith(\"TYPE SORTED TABLE OF \")\n || text.startsWith(\"TYPE HASHED TABLE OF \")) {\n found = this.resolveTypeName(typename);\n if (found) {\n return new Types.TableType(found, options, name);\n }\n }\n else if (text.startsWith(\"LIKE TABLE OF \")\n || text.startsWith(\"LIKE STANDARD TABLE OF \")\n || text.startsWith(\"LIKE SORTED TABLE OF \")\n || text.startsWith(\"LIKE HASHED TABLE OF \")) {\n found = this.resolveLikeName(node);\n if (found) {\n return new Types.TableType(found, options, name);\n }\n }\n else if (text === \"TYPE STANDARD TABLE\"\n || text === \"TYPE SORTED TABLE\"\n || text === \"TYPE HASHED TABLE\"\n || text === \"TYPE INDEX TABLE\"\n || text === \"TYPE ANY TABLE\") {\n return new Types.TableType(new Types.AnyType(), options);\n }\n else if (text.startsWith(\"TYPE RANGE OF \")) {\n const sub = node.findFirstExpression(Expressions.TypeName);\n found = this.resolveTypeName(sub);\n if (found === undefined) {\n return new Types.UnknownType(\"TYPE RANGE OF, could not resolve type\");\n }\n const structure = new Types.StructureType([\n { name: \"sign\", type: new Types.CharacterType(1) },\n { name: \"option\", type: new Types.CharacterType(2) },\n { name: \"low\", type: found },\n { name: \"high\", type: found },\n ]);\n options.primaryKey.type = basic_1.TableAccessType.standard;\n return new Types.TableType(structure, options, name);\n }\n else if (text.startsWith(\"LIKE RANGE OF \")) {\n const sub = node.findFirstExpression(Expressions.SimpleFieldChain);\n found = this.resolveLikeName(sub);\n if (found === undefined) {\n return new Types.UnknownType(\"LIKE RANGE OF, could not resolve type\");\n }\n const structure = new Types.StructureType([\n { name: \"sign\", type: new Types.CharacterType(1) },\n { name: \"option\", type: new Types.CharacterType(2) },\n { name: \"low\", type: found },\n { name: \"high\", type: found },\n ], name);\n options.primaryKey.type = basic_1.TableAccessType.standard;\n return new Types.TableType(structure, options);\n }\n else if (typename && (text.startsWith(\"TYPE TABLE FOR CREATE \")\n || text.startsWith(\"TYPE TABLE FOR UPDATE \"))) {\n const name = typename.concatTokens();\n const type = (_c = this.scope.getDDIC().lookupDDLS(name)) === null || _c === void 0 ? void 0 : _c.type;\n if (type) {\n return new Types.TableType(new basic_1.VoidType(\"RapTodo\"), options);\n }\n else if (this.scope.getDDIC().inErrorNamespace(name)) {\n return new Types.UnknownType(`DDLS ${name} not found`);\n }\n else {\n return new Types.VoidType(name);\n }\n }\n // fallback to old style syntax, OCCURS etc\n return this.parseType(node, name);\n }\n parseType(node, qualifiedName) {\n var _a, _b, _c, _d, _e, _f;\n const typeName = node.findFirstExpression(Expressions.TypeName);\n let text = (_a = node.findFirstExpression(Expressions.Type)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();\n if (text === undefined) {\n text = (_b = node.findFirstExpression(Expressions.TypeParam)) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase();\n }\n if (text === undefined) {\n text = (_c = node.findFirstExpression(Expressions.TypeTable)) === null || _c === void 0 ? void 0 : _c.concatTokens().toUpperCase();\n if ((text === null || text === void 0 ? void 0 : text.startsWith(\"TYPE\")) === false && (text === null || text === void 0 ? void 0 : text.startsWith(\"LIKE\")) === false) {\n text = \"TYPE\";\n }\n }\n if (text === undefined) {\n text = (_d = node.findFirstExpression(Expressions.FormParamType)) === null || _d === void 0 ? void 0 : _d.concatTokens().toUpperCase();\n }\n if (text === undefined\n && node.get() instanceof Statements.Parameter\n && node.findDirectTokenByText(\"LIKE\")) {\n text = \"LIKE \" + (typeName === null || typeName === void 0 ? void 0 : typeName.concatTokens());\n }\n if (text === undefined) {\n text = \"TYPE\";\n }\n let found = undefined;\n if (text.startsWith(\"LIKE LINE OF \")) {\n const name = (_e = node.findFirstExpression(Expressions.FieldChain)) === null || _e === void 0 ? void 0 : _e.concatTokens();\n let e = node.findFirstExpression(Expressions.Type);\n if (e === undefined) {\n e = node.findFirstExpression(Expressions.FormParamType);\n }\n if (e === undefined) {\n e = node.findFirstExpression(Expressions.FieldChain);\n }\n const type = this.resolveLikeName(e, false);\n if (type === undefined) {\n return new Types.UnknownType(\"Type error, could not resolve \\\"\" + name + \"\\\", parseType\");\n }\n else if (type instanceof Types.TableType) {\n return type.getRowType();\n }\n else if (type instanceof Types.VoidType) {\n return type;\n }\n else {\n return new Types.UnknownType(\"Type error, not a table type \" + name);\n }\n }\n else if (text.startsWith(\"LIKE REF TO \")) {\n const name = (_f = node.findFirstExpression(Expressions.FieldChain)) === null || _f === void 0 ? void 0 : _f.concatTokens();\n const type = this.resolveLikeName(node.findFirstExpression(Expressions.Type), false);\n if (type === undefined) {\n return new Types.UnknownType(\"Type error, could not resolve \\\"\" + name + \"\\\", parseType\");\n }\n return new Types.DataReference(type, name);\n }\n else if (text === \"TYPE STANDARD TABLE\"\n || text === \"TYPE SORTED TABLE\"\n || text === \"TYPE HASHED TABLE\"\n || text === \"TYPE INDEX TABLE\"\n || text === \"TYPE ANY TABLE\") {\n return new Types.TableType(new Types.AnyType(), { withHeader: node.concatTokens().toUpperCase().includes(\"WITH HEADER LINE\") });\n }\n else if (text.startsWith(\"LIKE \")) {\n let sub = node.findFirstExpression(Expressions.Type);\n if (sub === undefined) {\n sub = node.findFirstExpression(Expressions.FormParamType);\n }\n if (sub === undefined) {\n sub = node.findFirstExpression(Expressions.TypeParam);\n }\n if (sub === undefined) {\n sub = node.findFirstExpression(Expressions.FieldChain);\n }\n if (sub === undefined) {\n sub = node.findFirstExpression(Expressions.TypeName);\n }\n found = this.resolveLikeName(sub);\n if (found && this.isOccurs(node)) {\n found = new Types.TableType(found, { withHeader: text.includes(\"WITH HEADER LINE\") }, qualifiedName);\n }\n }\n else if (text.startsWith(\"TYPE LINE OF \")) {\n const sub = node.findFirstExpression(Expressions.TypeName);\n found = this.resolveTypeName(sub);\n if (found instanceof _typed_identifier_1.TypedIdentifier) {\n found = found.getType();\n }\n if (found instanceof Types.TableType) {\n return found.getRowType();\n }\n else if (found instanceof Types.VoidType) {\n return found;\n }\n else if (found instanceof Types.UnknownType) {\n return new Types.UnknownType(\"TYPE LINE OF, unknown type, \" + found.getError());\n }\n else {\n return new Types.UnknownType(\"TYPE LINE OF, unexpected type, \" + (found === null || found === void 0 ? void 0 : found.constructor.name));\n }\n }\n else if (text.startsWith(\"TYPE REF TO \")) {\n found = this.resolveTypeRef(typeName);\n }\n else if (text.startsWith(\"TYPE\")) {\n found = this.resolveTypeName(typeName, this.findLength(node), this.findDecimals(node), qualifiedName);\n const concat = node.concatTokens().toUpperCase();\n if (found && this.isOccurs(node)) {\n found = new Types.TableType(found, { withHeader: concat.includes(\" WITH HEADER LINE\") }, qualifiedName);\n }\n else if (found && concat.includes(\" WITH HEADER LINE\")) {\n if (found instanceof Types.VoidType) {\n found = new Types.TableType(found, { withHeader: true });\n }\n else if (!(found instanceof Types.TableType)) {\n throw new Error(\"WITH HEADER LINE can only be used with internal table\");\n }\n else {\n found = new Types.TableType(found.getRowType(), { withHeader: true });\n }\n }\n if (found === undefined && typeName === undefined) {\n let length = 1;\n const len = node.findDirectExpression(Expressions.ConstantFieldLength);\n if (len) {\n const int = len.findDirectExpression(Expressions.Integer);\n if (int) {\n length = parseInt(int.concatTokens(), 10);\n }\n }\n found = new Types.CharacterType(length, { qualifiedName: qualifiedName }); // fallback\n if (this.isOccurs(node)) {\n found = new Types.TableType(found, { withHeader: concat.includes(\" WITH HEADER LINE\") }, qualifiedName);\n }\n }\n }\n return found;\n }\n /////////////////////\n isOccurs(node) {\n var _a;\n if (node.findDirectTokenByText(\"OCCURS\")) {\n return true;\n }\n else if ((_a = node.findFirstExpression(Expressions.TypeTable)) === null || _a === void 0 ? void 0 : _a.findDirectTokenByText(\"OCCURS\")) {\n return true;\n }\n return false;\n }\n // todo, rewrite this method\n resolveTypeChain(expr) {\n var _a;\n const chainText = expr.concatTokens().toUpperCase();\n if (chainText.includes(\"=>\") === false && chainText.includes(\"-\") === false) {\n return undefined;\n }\n let className;\n let rest = chainText;\n if (chainText.includes(\"=>\")) {\n const split = chainText.split(\"=>\");\n className = split[0];\n rest = split[1];\n }\n else if (chainText.includes(\"->\")) {\n const split = chainText.split(\"->\");\n className = split[0];\n rest = split[1];\n }\n const subs = rest.split(\"-\");\n let foundType = undefined;\n if (className && chainText.includes(\"=>\")) {\n const split = chainText.split(\"=>\");\n const className = split[0];\n // the prefix might be itself\n if ((this.scope.getType() === _scope_type_1.ScopeType.Interface\n || this.scope.getType() === _scope_type_1.ScopeType.ClassDefinition)\n && this.scope.getName().toUpperCase() === className.toUpperCase()) {\n const foundId = this.scope.findType(subs[0]);\n foundType = foundId === null || foundId === void 0 ? void 0 : foundId.getType();\n if (foundType === undefined) {\n return new Types.UnknownType(\"Could not resolve type \" + chainText);\n }\n this.scope.addReference(expr.getTokens()[2], foundId, _reference_1.ReferenceType.TypeReference, this.filename);\n }\n else {\n // lookup in local and global scope\n const obj = this.scope.findObjectDefinition(className);\n if (obj === undefined && this.scope.getDDIC().inErrorNamespace(className) === false) {\n this.scope.addReference(expr.getFirstToken(), undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, this.filename, { ooName: className.toUpperCase() });\n return new Types.VoidType(className);\n }\n else if (obj === undefined) {\n return new Types.UnknownType(\"Could not resolve top \" + className + \", resolveTypeChain\");\n }\n const type = obj instanceof types_1.ClassDefinition ? \"CLAS\" : \"INTF\";\n this.scope.addReference(expr.getFirstToken(), obj, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: type, ooName: className });\n const byName = new _object_oriented_1.ObjectOriented(this.scope).searchTypeName(obj, subs[0]);\n foundType = byName === null || byName === void 0 ? void 0 : byName.getType();\n if (byName === undefined || foundType === undefined) {\n return new Types.UnknownType(subs[0] + \" not found in class or interface\");\n }\n this.scope.addReference(expr.getTokens()[2], byName, _reference_1.ReferenceType.TypeReference, this.filename);\n }\n }\n else if (className && chainText.includes(\"->\")) {\n const varVar = this.scope.findVariable(className);\n const foo = varVar === null || varVar === void 0 ? void 0 : varVar.getType();\n if (foo instanceof basic_1.ObjectReferenceType) {\n const typeName = subs[0];\n let id = foo.getIdentifier();\n if (!(id instanceof types_1.ClassDefinition || id instanceof types_1.InterfaceDefinition)) {\n const found = this.scope.findObjectDefinition(foo.getIdentifierName());\n if (found) {\n id = found;\n }\n else {\n return new Types.UnknownType(foo.getIdentifierName() + \" not found in scope\");\n }\n }\n if (id instanceof types_1.ClassDefinition || id instanceof types_1.InterfaceDefinition) {\n const type = id instanceof types_1.ClassDefinition ? \"CLAS\" : \"INTF\";\n this.scope.addReference(expr.getFirstToken(), id, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: type, ooName: id.getName() });\n const byName = new _object_oriented_1.ObjectOriented(this.scope).searchTypeName(id, typeName);\n foundType = byName === null || byName === void 0 ? void 0 : byName.getType();\n if (byName === undefined || foundType === undefined) {\n return new Types.UnknownType(typeName + \" not found in class or interface\");\n }\n this.scope.addReference(expr.getTokens()[2], byName, _reference_1.ReferenceType.TypeReference, this.filename);\n }\n else {\n return new Types.UnknownType(\"Not an object reference, \" + className + \", \" + id.constructor.name);\n }\n }\n else if (foo === undefined) {\n return new Types.UnknownType(className + \" not found in scope\");\n }\n else {\n return new Types.UnknownType(\"Not an object reference, \" + className + \", \" + foo.constructor.name);\n }\n }\n else {\n const found = this.scope.findType(subs[0]);\n foundType = found === null || found === void 0 ? void 0 : found.getType();\n if (foundType === undefined) {\n const typePoolType = (_a = this.scope.findTypePoolType(subs[0])) === null || _a === void 0 ? void 0 : _a.getType();\n if (typePoolType) {\n // this.scope.addReference(typeName.getFirstToken(), typePoolType, ReferenceType.TypeReference, this.filename);\n foundType = typePoolType;\n }\n if (foundType === undefined) {\n const f = this.scope.getDDIC().lookupTableOrView(subs[0]);\n this.scope.getDDICReferences().addUsing(this.scope.getParentObj(), { object: f.object, filename: this.filename, token: expr.getFirstToken() });\n if (f.type instanceof _typed_identifier_1.TypedIdentifier) {\n foundType = f.type.getType();\n }\n else {\n foundType = f.type;\n }\n }\n }\n else {\n this.scope.addReference(expr.getFirstToken(), found, _reference_1.ReferenceType.TypeReference, this.filename);\n }\n if (foundType === undefined && this.scope.getDDIC().inErrorNamespace(subs[0]) === false) {\n this.scope.addReference(expr.getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.filename);\n return new Types.VoidType(subs[0]);\n }\n else if (foundType instanceof Types.VoidType) {\n this.scope.addReference(expr.getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.filename);\n return foundType;\n }\n else if (foundType === undefined) {\n return new Types.UnknownType(\"Unknown type \" + subs[0]);\n }\n }\n subs.shift();\n while (subs.length > 0) {\n if (foundType instanceof Types.UnknownType\n || foundType instanceof Types.VoidType) {\n return foundType;\n }\n else if (!(foundType instanceof Types.StructureType)) {\n return new Types.UnknownType(\"Not a structured type\");\n }\n foundType = foundType.getComponentByName(subs[0]);\n if (foundType === undefined) {\n return new Types.UnknownType(`Field \"${subs[0]}\" not found in structure`);\n }\n subs.shift();\n }\n return foundType;\n }\n resolveConstantValue(expr) {\n var _a, _b;\n // todo: rewrite this method\n if (!(expr.get() instanceof Expressions.SimpleFieldChain)) {\n throw new Error(\"resolveConstantValue\");\n }\n const firstNode = expr.getFirstChild();\n const firstToken = firstNode.getFirstToken();\n const firstName = firstToken.getStr();\n if (firstNode.get() instanceof Expressions.Field) {\n const found = this.scope.findVariable(firstName);\n const val = found === null || found === void 0 ? void 0 : found.getValue();\n if (typeof val === \"string\") {\n this.scope.addReference(firstToken, found, _reference_1.ReferenceType.DataReadReference, this.filename);\n return val;\n }\n else if ((found === null || found === void 0 ? void 0 : found.getType()) instanceof basic_1.StructureType) {\n this.scope.addReference(firstToken, found, _reference_1.ReferenceType.DataReadReference, this.filename);\n }\n return undefined;\n }\n else if (firstNode.get() instanceof Expressions.ClassName\n && firstName.toLowerCase() === this.scope.getName().toLowerCase()\n && (this.scope.getType() === _scope_type_1.ScopeType.Interface\n || this.scope.getType() === _scope_type_1.ScopeType.ClassDefinition)) {\n const children = expr.getChildren();\n const token = (_a = children[2]) === null || _a === void 0 ? void 0 : _a.getFirstToken();\n const found = this.scope.findVariable(token.getStr());\n const val = found === null || found === void 0 ? void 0 : found.getValue();\n if (typeof val === \"string\") {\n this.scope.addReference(firstToken, found, _reference_1.ReferenceType.DataReadReference, this.filename);\n return val;\n }\n return undefined;\n }\n else if (firstNode.get() instanceof Expressions.ClassName) {\n const obj = this.scope.findObjectDefinition(firstName);\n if (obj === undefined) {\n if (this.scope.existsObject(firstName).found === true) {\n return undefined;\n }\n else if (this.scope.getDDIC().inErrorNamespace(firstName) === true) {\n throw new Error(\"resolveConstantValue, not found: \" + firstName);\n }\n else {\n this.scope.addReference(firstNode.getFirstToken(), undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, this.filename, { ooName: firstName.toUpperCase() });\n return undefined;\n }\n }\n const children = expr.getChildren();\n const token = (_b = children[2]) === null || _b === void 0 ? void 0 : _b.getFirstToken();\n const attr = token.getStr();\n const c = new _object_oriented_1.ObjectOriented(this.scope).searchConstantName(obj, attr);\n if (c instanceof class_constant_1.ClassConstant) {\n this.scope.addReference(token, c, _reference_1.ReferenceType.DataReadReference, this.filename);\n const val = c.getValue();\n if (typeof val === \"string\") {\n return val;\n }\n else if (typeof val === \"object\" && children[4]) {\n const name = children[4].getFirstToken().getStr();\n if (val[name] !== undefined) {\n return val[name];\n }\n }\n return undefined;\n }\n throw new Error(\"resolveConstantValue, constant not found \" + attr);\n }\n else {\n throw new Error(\"resolveConstantValue, unexpected structure\");\n }\n }\n resolveTypeRef(chain) {\n var _a;\n if (chain === undefined) {\n return undefined;\n }\n const name = chain.getFirstToken().getStr();\n if (chain.getAllTokens().length === 1) {\n if (name.toUpperCase() === \"OBJECT\") {\n return new Types.GenericObjectReferenceType();\n }\n const search = this.scope.existsObject(name);\n if (search.found === true && search.id) {\n this.scope.addReference(chain.getFirstToken(), search.id, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: search.ooType, ooName: name });\n return new Types.ObjectReferenceType(search.id, name);\n }\n }\n const found = this.resolveTypeName(chain);\n if (found && !(found instanceof Types.UnknownType) && !(found instanceof Types.VoidType)) {\n return new Types.DataReference(found);\n }\n else if (chain.concatTokens().toUpperCase() === \"DATA\") {\n return new Types.DataReference(new Types.AnyType());\n }\n if (this.scope.isBadiDef(name) === true) {\n return new Types.VoidType(name);\n }\n if (((_a = this.scope.getDDIC()) === null || _a === void 0 ? void 0 : _a.inErrorNamespace(name)) === false) {\n // this.scope.addReference(chain.getFirstToken(), undefined, ReferenceType.VoidType, this.filename);\n return new Types.VoidType(name);\n }\n return new Types.UnknownType(\"REF, unable to resolve \" + name);\n }\n findValue(node) {\n const val = node.findFirstExpression(Expressions.Value);\n if (val === undefined) {\n throw new Error(\"VALUE missing in expression\");\n }\n if (val.concatTokens().toUpperCase() === \"VALUE IS INITIAL\") {\n return undefined;\n }\n const constant = val.findFirstExpression(Expressions.Constant);\n if (constant) {\n return constant.concatTokens();\n }\n const chain = val.findFirstExpression(Expressions.SimpleFieldChain);\n if (chain) {\n return this.resolveConstantValue(chain);\n }\n throw new Error(\"findValue, unexpected\");\n }\n findDecimals(node) {\n var _a, _b;\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();\n if (dec) {\n return parseInt(dec, 10);\n }\n return undefined;\n }\n findLength(node) {\n const val = node.findFirstExpression(Expressions.Length);\n const flen = node.findFirstExpression(Expressions.ConstantFieldLength);\n if (val && flen) {\n throw new Error(\"Only specify length once\");\n }\n if (flen) {\n const cintExpr = flen.findFirstExpression(Expressions.Integer);\n if (cintExpr) {\n return this.parseInt(cintExpr.concatTokens());\n }\n const cchain = flen.findFirstExpression(Expressions.SimpleFieldChain);\n if (cchain) {\n const val = this.resolveConstantValue(cchain);\n return this.parseInt(val);\n }\n }\n if (val === undefined) {\n return 1;\n }\n const intExpr = val.findFirstExpression(Expressions.Integer);\n if (intExpr) {\n return this.parseInt(intExpr.concatTokens());\n }\n const strExpr = val.findFirstExpression(Expressions.ConstantString);\n if (strExpr) {\n return this.parseInt(strExpr.concatTokens());\n }\n const chain = val.findFirstExpression(Expressions.SimpleFieldChain);\n if (chain) {\n const val = this.resolveConstantValue(chain);\n return this.parseInt(val);\n }\n throw new Error(\"Unexpected, findLength\");\n }\n parseInt(text) {\n if (text === undefined) {\n return undefined;\n }\n if (text.startsWith(\"'\")) {\n text = text.split(\"'\")[1];\n }\n else if (text.startsWith(\"`\")) {\n text = text.split(\"`\")[1];\n }\n return parseInt(text, 10);\n }\n}\nexports.BasicTypes = BasicTypes;\n//# sourceMappingURL=basic_types.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/basic_types.js?");
|
|
6795
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.BasicTypes = void 0;\n/* eslint-disable default-case */\nconst _typed_identifier_1 = __webpack_require__(/*! ../types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\nconst Expressions = __webpack_require__(/*! ../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\nconst Statements = __webpack_require__(/*! ../2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\nconst Types = __webpack_require__(/*! ../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nconst _scope_type_1 = __webpack_require__(/*! ./_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\nconst _object_oriented_1 = __webpack_require__(/*! ./_object_oriented */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js\");\nconst class_constant_1 = __webpack_require__(/*! ../types/class_constant */ \"./node_modules/@abaplint/core/build/src/abap/types/class_constant.js\");\nconst identifier_1 = __webpack_require__(/*! ../1_lexer/tokens/identifier */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/identifier.js\");\nconst _reference_1 = __webpack_require__(/*! ./_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\nconst basic_1 = __webpack_require__(/*! ../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nconst field_chain_1 = __webpack_require__(/*! ./expressions/field_chain */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/field_chain.js\");\nconst types_1 = __webpack_require__(/*! ../types */ \"./node_modules/@abaplint/core/build/src/abap/types/index.js\");\nconst expressions_1 = __webpack_require__(/*! ../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\nconst _builtin_1 = __webpack_require__(/*! ./_builtin */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_builtin.js\");\nconst position_1 = __webpack_require__(/*! ../../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\nclass BasicTypes {\n constructor(filename, scope) {\n this.filename = filename;\n this.scope = scope;\n }\n lookupQualifiedName(name) {\n var _a;\n // argh, todo, rewrite this entire method, more argh\n if (name === undefined) {\n return undefined;\n }\n const found = this.scope.findType(name);\n if (found) {\n return found;\n }\n if (name.includes(\"=>\")) {\n const split = name.split(\"=>\");\n const ooName = split[0];\n const typeName = split[1];\n const oo = this.scope.findObjectDefinition(ooName);\n if (oo) {\n if (typeName.includes(\"-\")) {\n const split = typeName.split(\"-\");\n const subTypeName = split[0];\n const fieldName = split[1];\n const stru = oo.getTypeDefinitions().getByName(subTypeName);\n const struType = stru === null || stru === void 0 ? void 0 : stru.getType();\n if (stru && struType instanceof basic_1.StructureType) {\n const f = struType.getComponentByName(fieldName);\n if (f) {\n return new _typed_identifier_1.TypedIdentifier(stru.getToken(), stru.getFilename(), f);\n }\n }\n }\n else {\n const f = oo.getTypeDefinitions().getByName(typeName);\n if (f) {\n return f;\n }\n }\n }\n }\n else if (name.includes(\"-\")) {\n const split = name.split(\"-\");\n const typeName = split[0];\n const fieldName = split[1];\n const type = this.scope.findType(typeName);\n if (type) {\n const stru = type.getType();\n if (stru instanceof basic_1.StructureType) {\n const f = stru.getComponentByName(fieldName);\n if (f) {\n return new _typed_identifier_1.TypedIdentifier(type.getToken(), type.getFilename(), f);\n }\n }\n }\n }\n const lookup = this.scope.getDDIC().lookupNoVoid(name);\n const id = (_a = lookup === null || lookup === void 0 ? void 0 : lookup.object) === null || _a === void 0 ? void 0 : _a.getIdentifier();\n if (id && (lookup === null || lookup === void 0 ? void 0 : lookup.type)) {\n return new _typed_identifier_1.TypedIdentifier(id.getToken(), id.getFilename(), lookup.type);\n }\n const builtin = this.scope.getDDIC().lookupBuiltinType(name);\n if (builtin) {\n return new _typed_identifier_1.TypedIdentifier(new identifier_1.Identifier(new position_1.Position(1, 1), name), _builtin_1.BuiltIn.filename, builtin);\n }\n const type = this.scope.findTypePoolType(name);\n if (type) {\n return type;\n }\n return undefined;\n }\n resolveLikeName(node, headerLogic = true) {\n var _a;\n if (node === undefined) {\n return undefined;\n }\n let chain = node.findFirstExpression(Expressions.FieldChain);\n if (chain === undefined) {\n chain = node.findFirstExpression(Expressions.TypeName);\n }\n if (chain === undefined) {\n chain = node.findFirstExpression(Expressions.FieldSub);\n }\n if (chain === undefined) {\n chain = node.findFirstExpression(Expressions.SimpleFieldChain);\n }\n if (chain === undefined) {\n throw new Error(\"resolveLikeName, chain undefined\");\n }\n const fullName = chain.concatTokens();\n const children = [...chain.getChildren()];\n if (children.length === 0) {\n return new Types.UnknownType(\"Type error, could not resolve \\\"\" + fullName + \"\\\", resolveLikeName1\");\n }\n let type = undefined;\n if (children[1] && (children[1].getFirstToken().getStr() === \"=>\" || children[1].getFirstToken().getStr() === \"->\")) {\n type = new field_chain_1.FieldChain().runSyntax(chain, this.scope, this.filename, _reference_1.ReferenceType.TypeReference);\n }\n else {\n const name = children.shift().getFirstToken().getStr();\n let found = this.scope.findVariable(name);\n type = found === null || found === void 0 ? void 0 : found.getType();\n if (found === undefined) {\n found = this.scope.findExtraLikeType(name);\n type = found === null || found === void 0 ? void 0 : found.getType();\n }\n if (found) {\n this.scope.addReference(chain === null || chain === void 0 ? void 0 : chain.getFirstToken(), found, _reference_1.ReferenceType.TypeReference, this.filename);\n }\n if (type === undefined) {\n type = (_a = this.scope.getDDIC().lookupNoVoid(name)) === null || _a === void 0 ? void 0 : _a.type;\n }\n if (type === undefined && this.scope.isOO() === false && this.scope.getDDIC().inErrorNamespace(name) === false) {\n this.scope.addReference(chain.getChildren()[0].getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.filename);\n return new Types.VoidType(name);\n }\n while (children.length > 0) {\n const child = children.shift();\n if (child.getFirstToken().getStr() === \"-\") {\n if (type instanceof Types.VoidType) {\n return type;\n }\n }\n else if (child.concatTokens() === \"[]\") {\n if (type instanceof Types.TableType) {\n type = new basic_1.TableType(type.getRowType(), { withHeader: false, keyType: Types.TableKeyType.default });\n }\n }\n else { // field name\n let sub = undefined;\n if (type instanceof Types.TableType) {\n type = type.getRowType();\n }\n if (type instanceof Types.StructureType) {\n sub = type.getComponentByName(child.getFirstToken().getStr());\n }\n if (sub === undefined) {\n return new Types.UnknownType(\"Type error, field not part of structure \" + fullName);\n }\n type = sub;\n }\n }\n if (type instanceof Types.VoidType) {\n return type;\n }\n else if (type instanceof basic_1.TableType\n && type.isWithHeader()\n && headerLogic === true) {\n type = type.getRowType();\n }\n else if (type instanceof Types.TableType\n && type.isWithHeader() === true\n && type.getRowType() instanceof Types.VoidType) {\n return type.getRowType();\n }\n }\n if (!type) {\n return new Types.UnknownType(\"Type error, could not resolve \\\"\" + fullName + \"\\\", resolveLikeName2\");\n }\n return type;\n }\n cloneType(type, qualifiedName) {\n // nested types(containing \"-\") will inherit the qualified names if possible\n // todo, this needs to be extended to all AbstractTypes instead of just CharacterType\n if (type instanceof basic_1.CharacterType\n && qualifiedName\n && qualifiedName.includes(\"-\") === false) {\n type = type.cloneType(qualifiedName);\n }\n return type;\n }\n resolveTypeName(typeName, length, decimals, qualifiedName) {\n var _a;\n if (typeName === undefined) {\n return undefined;\n }\n const chain = this.resolveTypeChain(typeName);\n if (chain) {\n return this.cloneType(chain, qualifiedName);\n }\n const chainText = typeName.concatTokens().toUpperCase();\n const f = this.scope.getDDIC().lookupBuiltinType(chainText, length, decimals, qualifiedName);\n if (f !== undefined) {\n return f;\n }\n const typ = this.scope.findType(chainText);\n if (typ) {\n const token = typeName.getFirstToken();\n if (chainText.includes(\"~\")) {\n const name = chainText.split(\"~\")[0];\n const idef = this.scope.findInterfaceDefinition(name);\n if (idef) {\n this.scope.addReference(token, idef, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: \"INTF\", ooName: name });\n }\n }\n this.scope.addReference(token, typ, _reference_1.ReferenceType.TypeReference, this.filename);\n return typ.getType();\n }\n const type = (_a = this.scope.findTypePoolType(chainText)) === null || _a === void 0 ? void 0 : _a.getType();\n if (type) {\n // this.scope.addReference(typeName.getFirstToken(), type, ReferenceType.TypeReference, this.filename);\n return type;\n }\n const ddic = this.scope.getDDIC().lookup(chainText);\n if (ddic) {\n this.scope.getDDICReferences().addUsing(this.scope.getParentObj(), { object: ddic.object, token: typeName.getFirstToken(), filename: this.filename });\n if (ddic.type instanceof _typed_identifier_1.TypedIdentifier) {\n this.scope.addReference(typeName.getFirstToken(), ddic.type, _reference_1.ReferenceType.TypeReference, this.filename);\n }\n else if (ddic.type instanceof basic_1.VoidType) {\n this.scope.addReference(typeName.getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.filename);\n }\n return this.cloneType(ddic.type, qualifiedName);\n }\n return undefined;\n }\n simpleType(node, qualifiedNamePrefix) {\n let nameExpr = node.findFirstExpression(Expressions.NamespaceSimpleName);\n if (nameExpr === undefined) {\n nameExpr = node.findFirstExpression(Expressions.DefinitionName);\n }\n if (nameExpr === undefined) {\n return undefined;\n }\n let name = nameExpr.getFirstToken();\n if (nameExpr.countTokens() > 1) { // workaround for names with dashes\n name = new identifier_1.Identifier(name.getStart(), nameExpr.concatTokens());\n }\n let qualifiedName = undefined;\n if (node.get() instanceof Statements.Type) {\n if (this.scope.isTypePool() === true) {\n qualifiedName = name.getStr();\n }\n else {\n qualifiedName = (qualifiedNamePrefix || \"\") + name.getStr();\n if (this.scope.getType() === _scope_type_1.ScopeType.ClassDefinition\n || this.scope.getType() === _scope_type_1.ScopeType.Interface) {\n qualifiedName = this.scope.getName() + \"=>\" + qualifiedName;\n }\n }\n }\n else if (qualifiedNamePrefix) {\n qualifiedName = qualifiedNamePrefix + qualifiedName;\n }\n const found = this.parseType(node, qualifiedName);\n if (found) {\n return new _typed_identifier_1.TypedIdentifier(name, this.filename, found);\n }\n return undefined;\n }\n parseTable(node, name) {\n var _a, _b, _c, _d;\n const typename = node.findFirstExpression(Expressions.TypeName);\n const text = (_a = node.findFirstExpression(Expressions.TypeTable)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();\n if (text === undefined) {\n return undefined;\n }\n let type = undefined;\n if (text.startsWith(\"TYPE STANDARD TABLE \")\n || text.startsWith(\"TYPE TABLE \")\n || text.startsWith(\"LIKE TABLE \")\n || text.startsWith(\"LIKE STANDARD TABLE \")) {\n type = basic_1.TableAccessType.standard;\n }\n else if (text.startsWith(\"TYPE SORTED TABLE \")\n || text.startsWith(\"LIKE SORTED TABLE \")) {\n type = basic_1.TableAccessType.sorted;\n }\n else if (text.startsWith(\"TYPE HASHED TABLE \")\n || text.startsWith(\"LIKE HASHED TABLE \")) {\n type = basic_1.TableAccessType.hashed;\n }\n const typeTableKeys = node.findAllExpressions(expressions_1.TypeTableKey);\n const firstKey = typeTableKeys[0];\n const isNamed = (firstKey === null || firstKey === void 0 ? void 0 : firstKey.findDirectExpression(expressions_1.Field)) !== undefined\n && ((_b = firstKey === null || firstKey === void 0 ? void 0 : firstKey.findDirectExpression(expressions_1.Field)) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase()) !== \"PRIMARY_KEY\";\n const primaryKey = {\n name: \"primary_key\",\n type: type || basic_1.TableAccessType.standard,\n isUnique: isNamed ? false : (firstKey === null || firstKey === void 0 ? void 0 : firstKey.concatTokens().toUpperCase().includes(\"WITH UNIQUE \")) === true,\n keyFields: [],\n };\n let start = 1;\n if (isNamed === false) {\n for (const k of (firstKey === null || firstKey === void 0 ? void 0 : firstKey.findDirectExpressions(expressions_1.FieldSub)) || []) {\n primaryKey.keyFields.push(k.concatTokens().toUpperCase());\n }\n }\n else {\n start = 0;\n }\n const secondaryKeys = [];\n for (let i = start; i < typeTableKeys.length; i++) {\n const row = typeTableKeys[i];\n const name = (_c = row.findDirectExpression(expressions_1.Field)) === null || _c === void 0 ? void 0 : _c.concatTokens();\n if (name === undefined) {\n continue;\n }\n const secondary = {\n name: name,\n type: row.findDirectTokenByText(\"SORTED\") ? basic_1.TableAccessType.sorted : basic_1.TableAccessType.hashed,\n isUnique: (row === null || row === void 0 ? void 0 : row.concatTokens().toUpperCase().includes(\"WITH UNIQUE \")) === true,\n keyFields: [],\n };\n for (const k of (row === null || row === void 0 ? void 0 : row.findDirectExpressions(expressions_1.FieldSub)) || []) {\n secondary.keyFields.push(k.concatTokens().toUpperCase());\n }\n secondaryKeys.push(secondary);\n }\n let keyType = Types.TableKeyType.user;\n if (text.includes(\" EMPTY KEY\")) {\n keyType = Types.TableKeyType.empty;\n }\n else if (text.includes(\" DEFAULT KEY\")) {\n keyType = Types.TableKeyType.default;\n }\n const options = {\n withHeader: text.includes(\" WITH HEADER LINE\"),\n keyType: keyType,\n primaryKey: primaryKey,\n secondary: secondaryKeys,\n };\n let found = undefined;\n if (text.startsWith(\"TYPE TABLE OF REF TO \")\n || text.startsWith(\"TYPE STANDARD TABLE OF REF TO \")\n || text.startsWith(\"TYPE SORTED TABLE OF REF TO \")\n || text.startsWith(\"TYPE HASHED TABLE OF REF TO \")) {\n found = this.resolveTypeRef(typename);\n if (found) {\n return new Types.TableType(found, options, name);\n }\n }\n else if (text.startsWith(\"TYPE TABLE OF \")\n || text.startsWith(\"TYPE STANDARD TABLE OF \")\n || text.startsWith(\"TYPE SORTED TABLE OF \")\n || text.startsWith(\"TYPE HASHED TABLE OF \")) {\n found = this.resolveTypeName(typename);\n if (found) {\n return new Types.TableType(found, options, name);\n }\n }\n else if (text.startsWith(\"LIKE TABLE OF \")\n || text.startsWith(\"LIKE STANDARD TABLE OF \")\n || text.startsWith(\"LIKE SORTED TABLE OF \")\n || text.startsWith(\"LIKE HASHED TABLE OF \")) {\n found = this.resolveLikeName(node);\n if (found) {\n return new Types.TableType(found, options, name);\n }\n }\n else if (text === \"TYPE STANDARD TABLE\"\n || text === \"TYPE SORTED TABLE\"\n || text === \"TYPE HASHED TABLE\"\n || text === \"TYPE INDEX TABLE\"\n || text === \"TYPE ANY TABLE\") {\n return new Types.TableType(new Types.AnyType(), options);\n }\n else if (text.startsWith(\"TYPE RANGE OF \")) {\n const sub = node.findFirstExpression(Expressions.TypeName);\n found = this.resolveTypeName(sub);\n if (found === undefined) {\n return new Types.UnknownType(\"TYPE RANGE OF, could not resolve type\");\n }\n const structure = new Types.StructureType([\n { name: \"sign\", type: new Types.CharacterType(1) },\n { name: \"option\", type: new Types.CharacterType(2) },\n { name: \"low\", type: found },\n { name: \"high\", type: found },\n ]);\n options.primaryKey.type = basic_1.TableAccessType.standard;\n return new Types.TableType(structure, options, name);\n }\n else if (text.startsWith(\"LIKE RANGE OF \")) {\n const sub = node.findFirstExpression(Expressions.SimpleFieldChain);\n found = this.resolveLikeName(sub);\n if (found === undefined) {\n return new Types.UnknownType(\"LIKE RANGE OF, could not resolve type\");\n }\n const structure = new Types.StructureType([\n { name: \"sign\", type: new Types.CharacterType(1) },\n { name: \"option\", type: new Types.CharacterType(2) },\n { name: \"low\", type: found },\n { name: \"high\", type: found },\n ], name);\n options.primaryKey.type = basic_1.TableAccessType.standard;\n return new Types.TableType(structure, options);\n }\n else if (typename && (text.startsWith(\"TYPE TABLE FOR CREATE \")\n || text.startsWith(\"TYPE TABLE FOR UPDATE \"))) {\n const name = typename.concatTokens();\n const type = (_d = this.scope.getDDIC().lookupDDLS(name)) === null || _d === void 0 ? void 0 : _d.type;\n if (type) {\n return new Types.TableType(new basic_1.VoidType(\"RapTodo\"), options);\n }\n else if (this.scope.getDDIC().inErrorNamespace(name)) {\n return new Types.UnknownType(`DDLS ${name} not found`);\n }\n else {\n return new Types.VoidType(name);\n }\n }\n // fallback to old style syntax, OCCURS etc\n return this.parseType(node, name);\n }\n parseType(node, qualifiedName) {\n var _a, _b, _c, _d, _e, _f;\n const typeName = node.findFirstExpression(Expressions.TypeName);\n let text = (_a = node.findFirstExpression(Expressions.Type)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();\n if (text === undefined) {\n text = (_b = node.findFirstExpression(Expressions.TypeParam)) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase();\n }\n if (text === undefined) {\n text = (_c = node.findFirstExpression(Expressions.TypeTable)) === null || _c === void 0 ? void 0 : _c.concatTokens().toUpperCase();\n if ((text === null || text === void 0 ? void 0 : text.startsWith(\"TYPE\")) === false && (text === null || text === void 0 ? void 0 : text.startsWith(\"LIKE\")) === false) {\n text = \"TYPE\";\n }\n }\n if (text === undefined) {\n text = (_d = node.findFirstExpression(Expressions.FormParamType)) === null || _d === void 0 ? void 0 : _d.concatTokens().toUpperCase();\n }\n if (text === undefined\n && node.get() instanceof Statements.Parameter\n && node.findDirectTokenByText(\"LIKE\")) {\n text = \"LIKE \" + (typeName === null || typeName === void 0 ? void 0 : typeName.concatTokens());\n }\n if (text === undefined) {\n text = \"TYPE\";\n }\n let found = undefined;\n if (text.startsWith(\"LIKE LINE OF \")) {\n const name = (_e = node.findFirstExpression(Expressions.FieldChain)) === null || _e === void 0 ? void 0 : _e.concatTokens();\n let e = node.findFirstExpression(Expressions.Type);\n if (e === undefined) {\n e = node.findFirstExpression(Expressions.FormParamType);\n }\n if (e === undefined) {\n e = node.findFirstExpression(Expressions.FieldChain);\n }\n const type = this.resolveLikeName(e, false);\n if (type === undefined) {\n return new Types.UnknownType(\"Type error, could not resolve \\\"\" + name + \"\\\", parseType\");\n }\n else if (type instanceof Types.TableType) {\n return type.getRowType();\n }\n else if (type instanceof Types.VoidType) {\n return type;\n }\n else {\n return new Types.UnknownType(\"Type error, not a table type \" + name);\n }\n }\n else if (text.startsWith(\"LIKE REF TO \")) {\n const name = (_f = node.findFirstExpression(Expressions.FieldChain)) === null || _f === void 0 ? void 0 : _f.concatTokens();\n const type = this.resolveLikeName(node.findFirstExpression(Expressions.Type), false);\n if (type === undefined) {\n return new Types.UnknownType(\"Type error, could not resolve \\\"\" + name + \"\\\", parseType\");\n }\n return new Types.DataReference(type, name);\n }\n else if (text === \"TYPE STANDARD TABLE\"\n || text === \"TYPE SORTED TABLE\"\n || text === \"TYPE HASHED TABLE\"\n || text === \"TYPE INDEX TABLE\"\n || text === \"TYPE ANY TABLE\") {\n return new Types.TableType(new Types.AnyType(), { withHeader: node.concatTokens().toUpperCase().includes(\"WITH HEADER LINE\"), keyType: Types.TableKeyType.default });\n }\n else if (text.startsWith(\"LIKE \")) {\n let sub = node.findFirstExpression(Expressions.Type);\n if (sub === undefined) {\n sub = node.findFirstExpression(Expressions.FormParamType);\n }\n if (sub === undefined) {\n sub = node.findFirstExpression(Expressions.TypeParam);\n }\n if (sub === undefined) {\n sub = node.findFirstExpression(Expressions.FieldChain);\n }\n if (sub === undefined) {\n sub = node.findFirstExpression(Expressions.TypeName);\n }\n found = this.resolveLikeName(sub);\n if (found && this.isOccurs(node)) {\n found = new Types.TableType(found, { withHeader: text.includes(\"WITH HEADER LINE\"), keyType: Types.TableKeyType.default }, qualifiedName);\n }\n }\n else if (text.startsWith(\"TYPE LINE OF \")) {\n const sub = node.findFirstExpression(Expressions.TypeName);\n found = this.resolveTypeName(sub);\n if (found instanceof _typed_identifier_1.TypedIdentifier) {\n found = found.getType();\n }\n if (found instanceof Types.TableType) {\n return found.getRowType();\n }\n else if (found instanceof Types.VoidType) {\n return found;\n }\n else if (found instanceof Types.UnknownType) {\n return new Types.UnknownType(\"TYPE LINE OF, unknown type, \" + found.getError());\n }\n else {\n return new Types.UnknownType(\"TYPE LINE OF, unexpected type, \" + (found === null || found === void 0 ? void 0 : found.constructor.name));\n }\n }\n else if (text.startsWith(\"TYPE REF TO \")) {\n found = this.resolveTypeRef(typeName);\n }\n else if (text.startsWith(\"TYPE\")) {\n found = this.resolveTypeName(typeName, this.findLength(node), this.findDecimals(node), qualifiedName);\n const concat = node.concatTokens().toUpperCase();\n if (found && this.isOccurs(node)) {\n found = new Types.TableType(found, { withHeader: concat.includes(\" WITH HEADER LINE\"), keyType: Types.TableKeyType.default }, qualifiedName);\n }\n else if (found && concat.includes(\" WITH HEADER LINE\")) {\n if (found instanceof Types.VoidType) {\n found = new Types.TableType(found, { withHeader: true, keyType: Types.TableKeyType.default });\n }\n else if (!(found instanceof Types.TableType)) {\n throw new Error(\"WITH HEADER LINE can only be used with internal table\");\n }\n else {\n found = new Types.TableType(found.getRowType(), { withHeader: true, keyType: Types.TableKeyType.default });\n }\n }\n if (found === undefined && typeName === undefined) {\n let length = 1;\n const len = node.findDirectExpression(Expressions.ConstantFieldLength);\n if (len) {\n const int = len.findDirectExpression(Expressions.Integer);\n if (int) {\n length = parseInt(int.concatTokens(), 10);\n }\n }\n found = new Types.CharacterType(length, { qualifiedName: qualifiedName }); // fallback\n if (this.isOccurs(node)) {\n found = new Types.TableType(found, { withHeader: concat.includes(\" WITH HEADER LINE\"), keyType: Types.TableKeyType.default }, qualifiedName);\n }\n }\n }\n return found;\n }\n /////////////////////\n isOccurs(node) {\n var _a;\n if (node.findDirectTokenByText(\"OCCURS\")) {\n return true;\n }\n else if ((_a = node.findFirstExpression(Expressions.TypeTable)) === null || _a === void 0 ? void 0 : _a.findDirectTokenByText(\"OCCURS\")) {\n return true;\n }\n return false;\n }\n // todo, rewrite this method\n resolveTypeChain(expr) {\n var _a;\n const chainText = expr.concatTokens().toUpperCase();\n if (chainText.includes(\"=>\") === false && chainText.includes(\"-\") === false) {\n return undefined;\n }\n let className;\n let rest = chainText;\n if (chainText.includes(\"=>\")) {\n const split = chainText.split(\"=>\");\n className = split[0];\n rest = split[1];\n }\n else if (chainText.includes(\"->\")) {\n const split = chainText.split(\"->\");\n className = split[0];\n rest = split[1];\n }\n const subs = rest.split(\"-\");\n let foundType = undefined;\n if (className && chainText.includes(\"=>\")) {\n const split = chainText.split(\"=>\");\n const className = split[0];\n // the prefix might be itself\n if ((this.scope.getType() === _scope_type_1.ScopeType.Interface\n || this.scope.getType() === _scope_type_1.ScopeType.ClassDefinition)\n && this.scope.getName().toUpperCase() === className.toUpperCase()) {\n const foundId = this.scope.findType(subs[0]);\n foundType = foundId === null || foundId === void 0 ? void 0 : foundId.getType();\n if (foundType === undefined) {\n return new Types.UnknownType(\"Could not resolve type \" + chainText);\n }\n this.scope.addReference(expr.getTokens()[2], foundId, _reference_1.ReferenceType.TypeReference, this.filename);\n }\n else {\n // lookup in local and global scope\n const obj = this.scope.findObjectDefinition(className);\n if (obj === undefined && this.scope.getDDIC().inErrorNamespace(className) === false) {\n this.scope.addReference(expr.getFirstToken(), undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, this.filename, { ooName: className.toUpperCase() });\n return new Types.VoidType(className);\n }\n else if (obj === undefined) {\n return new Types.UnknownType(\"Could not resolve top \" + className + \", resolveTypeChain\");\n }\n const type = obj instanceof types_1.ClassDefinition ? \"CLAS\" : \"INTF\";\n this.scope.addReference(expr.getFirstToken(), obj, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: type, ooName: className });\n const byName = new _object_oriented_1.ObjectOriented(this.scope).searchTypeName(obj, subs[0]);\n foundType = byName === null || byName === void 0 ? void 0 : byName.getType();\n if (byName === undefined || foundType === undefined) {\n return new Types.UnknownType(subs[0] + \" not found in class or interface\");\n }\n this.scope.addReference(expr.getTokens()[2], byName, _reference_1.ReferenceType.TypeReference, this.filename);\n }\n }\n else if (className && chainText.includes(\"->\")) {\n const varVar = this.scope.findVariable(className);\n const foo = varVar === null || varVar === void 0 ? void 0 : varVar.getType();\n if (foo instanceof basic_1.ObjectReferenceType) {\n const typeName = subs[0];\n let id = foo.getIdentifier();\n if (!(id instanceof types_1.ClassDefinition || id instanceof types_1.InterfaceDefinition)) {\n const found = this.scope.findObjectDefinition(foo.getIdentifierName());\n if (found) {\n id = found;\n }\n else {\n return new Types.UnknownType(foo.getIdentifierName() + \" not found in scope\");\n }\n }\n if (id instanceof types_1.ClassDefinition || id instanceof types_1.InterfaceDefinition) {\n const type = id instanceof types_1.ClassDefinition ? \"CLAS\" : \"INTF\";\n this.scope.addReference(expr.getFirstToken(), id, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: type, ooName: id.getName() });\n const byName = new _object_oriented_1.ObjectOriented(this.scope).searchTypeName(id, typeName);\n foundType = byName === null || byName === void 0 ? void 0 : byName.getType();\n if (byName === undefined || foundType === undefined) {\n return new Types.UnknownType(typeName + \" not found in class or interface\");\n }\n this.scope.addReference(expr.getTokens()[2], byName, _reference_1.ReferenceType.TypeReference, this.filename);\n }\n else {\n return new Types.UnknownType(\"Not an object reference, \" + className + \", \" + id.constructor.name);\n }\n }\n else if (foo === undefined) {\n return new Types.UnknownType(className + \" not found in scope\");\n }\n else {\n return new Types.UnknownType(\"Not an object reference, \" + className + \", \" + foo.constructor.name);\n }\n }\n else {\n const found = this.scope.findType(subs[0]);\n foundType = found === null || found === void 0 ? void 0 : found.getType();\n if (foundType === undefined) {\n const typePoolType = (_a = this.scope.findTypePoolType(subs[0])) === null || _a === void 0 ? void 0 : _a.getType();\n if (typePoolType) {\n // this.scope.addReference(typeName.getFirstToken(), typePoolType, ReferenceType.TypeReference, this.filename);\n foundType = typePoolType;\n }\n if (foundType === undefined) {\n const f = this.scope.getDDIC().lookupTableOrView(subs[0]);\n this.scope.getDDICReferences().addUsing(this.scope.getParentObj(), { object: f.object, filename: this.filename, token: expr.getFirstToken() });\n if (f.type instanceof _typed_identifier_1.TypedIdentifier) {\n foundType = f.type.getType();\n }\n else {\n foundType = f.type;\n }\n }\n }\n else {\n this.scope.addReference(expr.getFirstToken(), found, _reference_1.ReferenceType.TypeReference, this.filename);\n }\n if (foundType === undefined && this.scope.getDDIC().inErrorNamespace(subs[0]) === false) {\n this.scope.addReference(expr.getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.filename);\n return new Types.VoidType(subs[0]);\n }\n else if (foundType instanceof Types.VoidType) {\n this.scope.addReference(expr.getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.filename);\n return foundType;\n }\n else if (foundType === undefined) {\n return new Types.UnknownType(\"Unknown type \" + subs[0]);\n }\n }\n subs.shift();\n while (subs.length > 0) {\n if (foundType instanceof Types.UnknownType\n || foundType instanceof Types.VoidType) {\n return foundType;\n }\n else if (!(foundType instanceof Types.StructureType)) {\n return new Types.UnknownType(\"Not a structured type\");\n }\n foundType = foundType.getComponentByName(subs[0]);\n if (foundType === undefined) {\n return new Types.UnknownType(`Field \"${subs[0]}\" not found in structure`);\n }\n subs.shift();\n }\n return foundType;\n }\n resolveConstantValue(expr) {\n var _a, _b;\n // todo: rewrite this method\n if (!(expr.get() instanceof Expressions.SimpleFieldChain)) {\n throw new Error(\"resolveConstantValue\");\n }\n const firstNode = expr.getFirstChild();\n const firstToken = firstNode.getFirstToken();\n const firstName = firstToken.getStr();\n if (firstNode.get() instanceof Expressions.Field) {\n const found = this.scope.findVariable(firstName);\n const val = found === null || found === void 0 ? void 0 : found.getValue();\n if (typeof val === \"string\") {\n this.scope.addReference(firstToken, found, _reference_1.ReferenceType.DataReadReference, this.filename);\n return val;\n }\n else if ((found === null || found === void 0 ? void 0 : found.getType()) instanceof basic_1.StructureType) {\n this.scope.addReference(firstToken, found, _reference_1.ReferenceType.DataReadReference, this.filename);\n }\n return undefined;\n }\n else if (firstNode.get() instanceof Expressions.ClassName\n && firstName.toLowerCase() === this.scope.getName().toLowerCase()\n && (this.scope.getType() === _scope_type_1.ScopeType.Interface\n || this.scope.getType() === _scope_type_1.ScopeType.ClassDefinition)) {\n const children = expr.getChildren();\n const token = (_a = children[2]) === null || _a === void 0 ? void 0 : _a.getFirstToken();\n const found = this.scope.findVariable(token.getStr());\n const val = found === null || found === void 0 ? void 0 : found.getValue();\n if (typeof val === \"string\") {\n this.scope.addReference(firstToken, found, _reference_1.ReferenceType.DataReadReference, this.filename);\n return val;\n }\n return undefined;\n }\n else if (firstNode.get() instanceof Expressions.ClassName) {\n const obj = this.scope.findObjectDefinition(firstName);\n if (obj === undefined) {\n if (this.scope.existsObject(firstName).found === true) {\n return undefined;\n }\n else if (this.scope.getDDIC().inErrorNamespace(firstName) === true) {\n throw new Error(\"resolveConstantValue, not found: \" + firstName);\n }\n else {\n this.scope.addReference(firstNode.getFirstToken(), undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, this.filename, { ooName: firstName.toUpperCase() });\n return undefined;\n }\n }\n const children = expr.getChildren();\n const token = (_b = children[2]) === null || _b === void 0 ? void 0 : _b.getFirstToken();\n const attr = token.getStr();\n const c = new _object_oriented_1.ObjectOriented(this.scope).searchConstantName(obj, attr);\n if (c instanceof class_constant_1.ClassConstant) {\n this.scope.addReference(token, c, _reference_1.ReferenceType.DataReadReference, this.filename);\n const val = c.getValue();\n if (typeof val === \"string\") {\n return val;\n }\n else if (typeof val === \"object\" && children[4]) {\n const name = children[4].getFirstToken().getStr();\n if (val[name] !== undefined) {\n return val[name];\n }\n }\n return undefined;\n }\n throw new Error(\"resolveConstantValue, constant not found \" + attr);\n }\n else {\n throw new Error(\"resolveConstantValue, unexpected structure\");\n }\n }\n resolveTypeRef(chain) {\n var _a;\n if (chain === undefined) {\n return undefined;\n }\n const name = chain.getFirstToken().getStr();\n if (chain.getAllTokens().length === 1) {\n if (name.toUpperCase() === \"OBJECT\") {\n return new Types.GenericObjectReferenceType();\n }\n const search = this.scope.existsObject(name);\n if (search.found === true && search.id) {\n this.scope.addReference(chain.getFirstToken(), search.id, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: search.ooType, ooName: name });\n return new Types.ObjectReferenceType(search.id, name);\n }\n }\n const found = this.resolveTypeName(chain);\n if (found && !(found instanceof Types.UnknownType) && !(found instanceof Types.VoidType)) {\n return new Types.DataReference(found);\n }\n else if (chain.concatTokens().toUpperCase() === \"DATA\") {\n return new Types.DataReference(new Types.AnyType());\n }\n if (this.scope.isBadiDef(name) === true) {\n return new Types.VoidType(name);\n }\n if (((_a = this.scope.getDDIC()) === null || _a === void 0 ? void 0 : _a.inErrorNamespace(name)) === false) {\n // this.scope.addReference(chain.getFirstToken(), undefined, ReferenceType.VoidType, this.filename);\n return new Types.VoidType(name);\n }\n return new Types.UnknownType(\"REF, unable to resolve \" + name);\n }\n findValue(node) {\n const val = node.findFirstExpression(Expressions.Value);\n if (val === undefined) {\n throw new Error(\"VALUE missing in expression\");\n }\n if (val.concatTokens().toUpperCase() === \"VALUE IS INITIAL\") {\n return undefined;\n }\n const constant = val.findFirstExpression(Expressions.Constant);\n if (constant) {\n return constant.concatTokens();\n }\n const chain = val.findFirstExpression(Expressions.SimpleFieldChain);\n if (chain) {\n return this.resolveConstantValue(chain);\n }\n throw new Error(\"findValue, unexpected\");\n }\n findDecimals(node) {\n var _a, _b;\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();\n if (dec) {\n return parseInt(dec, 10);\n }\n return undefined;\n }\n findLength(node) {\n const val = node.findFirstExpression(Expressions.Length);\n const flen = node.findFirstExpression(Expressions.ConstantFieldLength);\n if (val && flen) {\n throw new Error(\"Only specify length once\");\n }\n if (flen) {\n const cintExpr = flen.findFirstExpression(Expressions.Integer);\n if (cintExpr) {\n return this.parseInt(cintExpr.concatTokens());\n }\n const cchain = flen.findFirstExpression(Expressions.SimpleFieldChain);\n if (cchain) {\n const val = this.resolveConstantValue(cchain);\n return this.parseInt(val);\n }\n }\n if (val === undefined) {\n return 1;\n }\n const intExpr = val.findFirstExpression(Expressions.Integer);\n if (intExpr) {\n return this.parseInt(intExpr.concatTokens());\n }\n const strExpr = val.findFirstExpression(Expressions.ConstantString);\n if (strExpr) {\n return this.parseInt(strExpr.concatTokens());\n }\n const chain = val.findFirstExpression(Expressions.SimpleFieldChain);\n if (chain) {\n const val = this.resolveConstantValue(chain);\n return this.parseInt(val);\n }\n throw new Error(\"Unexpected, findLength\");\n }\n parseInt(text) {\n if (text === undefined) {\n return undefined;\n }\n if (text.startsWith(\"'\")) {\n text = text.split(\"'\")[1];\n }\n else if (text.startsWith(\"`\")) {\n text = text.split(\"`\")[1];\n }\n return parseInt(text, 10);\n }\n}\nexports.BasicTypes = BasicTypes;\n//# sourceMappingURL=basic_types.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/basic_types.js?");
|
|
6796
6796
|
|
|
6797
6797
|
/***/ }),
|
|
6798
6798
|
|
|
@@ -7760,7 +7760,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
7760
7760
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
7761
7761
|
|
|
7762
7762
|
"use strict";
|
|
7763
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Controls = void 0;\nconst Expressions = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\nconst _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\nconst basic_1 = __webpack_require__(/*! ../../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nclass Controls {\n runSyntax(node, scope, filename) {\n const name = node.findDirectExpression(Expressions.NamespaceSimpleName);\n const token = name === null || name === void 0 ? void 0 : name.getFirstToken();\n if (node.findDirectTokenByText(\"TABSTRIP\") && token) {\n const type = new basic_1.StructureType([{ name: \"ACTIVETAB\", type: new basic_1.CharacterType(132) }]);\n const id = new _typed_identifier_1.TypedIdentifier(token, filename, type);\n scope.addIdentifier(id);\n }\n if (node.findDirectTokenByText(\"TABLEVIEW\") && token) {\n const cols = new basic_1.StructureType([\n { name: \"SCREEN\", type: new basic_1.CharacterType(1) },\n { name: \"INDEX\", type: new basic_1.IntegerType() },\n { name: \"SELECTED\", type: new basic_1.CharacterType(1) },\n { name: \"VISLENGTH\", type: new basic_1.IntegerType() },\n { name: \"INVISIBLE\", type: new basic_1.CharacterType(1) },\n ]);\n const type = new basic_1.StructureType([\n { name: \"FIXED_COLS\", type: new basic_1.CharacterType(132) },\n { name: \"LINES\", type: new basic_1.IntegerType() },\n { name: \"TOP_LINE\", type: new basic_1.IntegerType() },\n { name: \"CURRENT_LINE\", type: new basic_1.IntegerType() },\n { name: \"LEFT_COL\", type: new basic_1.IntegerType() },\n { name: \"LINE_SEL_MODE\", type: new basic_1.CharacterType(1) },\n { name: \"COL_SEL_MODE\", type: new basic_1.CharacterType(1) },\n { name: \"LINE_SELECTOR\", type: new basic_1.CharacterType(1) },\n { name: \"H_GRID\", type: new basic_1.CharacterType(1) },\n { name: \"V_GRID\", type: new basic_1.CharacterType(1) },\n { name: \"COLS\", type: new basic_1.TableType(cols, { withHeader: false }) },\n { name: \"INVISIBLE\", type: new basic_1.CharacterType(1) },\n ]);\n const id = new _typed_identifier_1.TypedIdentifier(token, filename, type);\n scope.addIdentifier(id);\n }\n }\n}\nexports.Controls = Controls;\n//# sourceMappingURL=controls.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/controls.js?");
|
|
7763
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Controls = void 0;\nconst Expressions = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\nconst _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\nconst basic_1 = __webpack_require__(/*! ../../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nclass Controls {\n runSyntax(node, scope, filename) {\n const name = node.findDirectExpression(Expressions.NamespaceSimpleName);\n const token = name === null || name === void 0 ? void 0 : name.getFirstToken();\n if (node.findDirectTokenByText(\"TABSTRIP\") && token) {\n const type = new basic_1.StructureType([{ name: \"ACTIVETAB\", type: new basic_1.CharacterType(132) }]);\n const id = new _typed_identifier_1.TypedIdentifier(token, filename, type);\n scope.addIdentifier(id);\n }\n if (node.findDirectTokenByText(\"TABLEVIEW\") && token) {\n const cols = new basic_1.StructureType([\n { name: \"SCREEN\", type: new basic_1.CharacterType(1) },\n { name: \"INDEX\", type: new basic_1.IntegerType() },\n { name: \"SELECTED\", type: new basic_1.CharacterType(1) },\n { name: \"VISLENGTH\", type: new basic_1.IntegerType() },\n { name: \"INVISIBLE\", type: new basic_1.CharacterType(1) },\n ]);\n const type = new basic_1.StructureType([\n { name: \"FIXED_COLS\", type: new basic_1.CharacterType(132) },\n { name: \"LINES\", type: new basic_1.IntegerType() },\n { name: \"TOP_LINE\", type: new basic_1.IntegerType() },\n { name: \"CURRENT_LINE\", type: new basic_1.IntegerType() },\n { name: \"LEFT_COL\", type: new basic_1.IntegerType() },\n { name: \"LINE_SEL_MODE\", type: new basic_1.CharacterType(1) },\n { name: \"COL_SEL_MODE\", type: new basic_1.CharacterType(1) },\n { name: \"LINE_SELECTOR\", type: new basic_1.CharacterType(1) },\n { name: \"H_GRID\", type: new basic_1.CharacterType(1) },\n { name: \"V_GRID\", type: new basic_1.CharacterType(1) },\n { name: \"COLS\", type: new basic_1.TableType(cols, { withHeader: false, keyType: basic_1.TableKeyType.default }) },\n { name: \"INVISIBLE\", type: new basic_1.CharacterType(1) },\n ]);\n const id = new _typed_identifier_1.TypedIdentifier(token, filename, type);\n scope.addIdentifier(id);\n }\n }\n}\nexports.Controls = Controls;\n//# sourceMappingURL=controls.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/controls.js?");
|
|
7764
7764
|
|
|
7765
7765
|
/***/ }),
|
|
7766
7766
|
|
|
@@ -7925,7 +7925,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
7925
7925
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
7926
7926
|
|
|
7927
7927
|
"use strict";
|
|
7928
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Find = void 0;\nconst Expressions = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\nconst inline_data_1 = __webpack_require__(/*! ../expressions/inline_data */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/inline_data.js\");\nconst basic_1 = __webpack_require__(/*! ../../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nconst source_1 = __webpack_require__(/*! ../expressions/source */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js\");\nconst target_1 = __webpack_require__(/*! ../expressions/target */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js\");\nclass Find {\n runSyntax(node, scope, filename) {\n for (const s of node.findDirectExpressions(Expressions.Source)) {\n new source_1.Source().runSyntax(s, scope, filename);\n }\n const rfound = node.findExpressionAfterToken(\"RESULTS\");\n if (rfound && rfound.get() instanceof Expressions.Target) {\n const sub = new basic_1.StructureType([\n { name: \"OFFSET\", type: new basic_1.IntegerType() },\n { name: \"LENGTH\", type: new basic_1.IntegerType() }\n ], \"SUBMATCH_RESULT\", \"SUBMATCH_RESULT\");\n const type = new basic_1.StructureType([\n { name: \"LINE\", type: new basic_1.IntegerType() },\n { name: \"OFFSET\", type: new basic_1.IntegerType() },\n { name: \"LENGTH\", type: new basic_1.IntegerType() },\n { name: \"SUBMATCHES\", type: new basic_1.TableType(sub, { withHeader: false }) },\n ], \"MATCH_RESULT\", \"MATCH_RESULT\");\n if (node.concatTokens().toUpperCase().startsWith(\"FIND FIRST\")) {\n this.inline(rfound, scope, filename, type);\n }\n else {\n this.inline(rfound, scope, filename, new basic_1.TableType(type, { withHeader: false }, \"MATCH_RESULT_TAB\"));\n }\n }\n const ofound = node.findExpressionsAfterToken(\"OFFSET\");\n for (const o of ofound) {\n if (o.get() instanceof Expressions.Target) {\n this.inline(o, scope, filename, new basic_1.IntegerType());\n }\n }\n const lfound = node.findExpressionAfterToken(\"LINE\");\n if (lfound && lfound.get() instanceof Expressions.Target) {\n this.inline(lfound, scope, filename, new basic_1.IntegerType());\n }\n const cfound = node.findExpressionAfterToken(\"COUNT\");\n if (cfound && cfound.get() instanceof Expressions.Target) {\n this.inline(cfound, scope, filename, new basic_1.IntegerType());\n }\n const lnfound = node.findExpressionAfterToken(\"LENGTH\");\n if (lnfound && lnfound.get() instanceof Expressions.Target) {\n this.inline(lnfound, scope, filename, new basic_1.IntegerType());\n }\n if (node.findDirectTokenByText(\"SUBMATCHES\")) {\n for (const t of node.findDirectExpressions(Expressions.Target)) {\n if (t === rfound || t === lfound || t === cfound || t === lnfound) {\n continue;\n }\n else if (ofound.indexOf(t) >= 0) {\n continue;\n }\n const inline = t === null || t === void 0 ? void 0 : t.findDirectExpression(Expressions.InlineData);\n if (inline) {\n new inline_data_1.InlineData().runSyntax(inline, scope, filename, new basic_1.StringType());\n }\n else {\n new target_1.Target().runSyntax(t, scope, filename);\n }\n }\n }\n }\n /////////////////////\n inline(node, scope, filename, type) {\n const inline = node.findDirectExpression(Expressions.InlineData);\n if (inline) {\n new inline_data_1.InlineData().runSyntax(inline, scope, filename, type);\n }\n else {\n new target_1.Target().runSyntax(node, scope, filename);\n }\n }\n}\nexports.Find = Find;\n//# sourceMappingURL=find.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/find.js?");
|
|
7928
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Find = void 0;\nconst Expressions = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\nconst inline_data_1 = __webpack_require__(/*! ../expressions/inline_data */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/inline_data.js\");\nconst basic_1 = __webpack_require__(/*! ../../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nconst source_1 = __webpack_require__(/*! ../expressions/source */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js\");\nconst target_1 = __webpack_require__(/*! ../expressions/target */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js\");\nclass Find {\n runSyntax(node, scope, filename) {\n for (const s of node.findDirectExpressions(Expressions.Source)) {\n new source_1.Source().runSyntax(s, scope, filename);\n }\n const rfound = node.findExpressionAfterToken(\"RESULTS\");\n if (rfound && rfound.get() instanceof Expressions.Target) {\n const sub = new basic_1.StructureType([\n { name: \"OFFSET\", type: new basic_1.IntegerType() },\n { name: \"LENGTH\", type: new basic_1.IntegerType() }\n ], \"SUBMATCH_RESULT\", \"SUBMATCH_RESULT\");\n const type = new basic_1.StructureType([\n { name: \"LINE\", type: new basic_1.IntegerType() },\n { name: \"OFFSET\", type: new basic_1.IntegerType() },\n { name: \"LENGTH\", type: new basic_1.IntegerType() },\n { name: \"SUBMATCHES\", type: new basic_1.TableType(sub, { withHeader: false, keyType: basic_1.TableKeyType.default }) },\n ], \"MATCH_RESULT\", \"MATCH_RESULT\");\n if (node.concatTokens().toUpperCase().startsWith(\"FIND FIRST\")) {\n this.inline(rfound, scope, filename, type);\n }\n else {\n this.inline(rfound, scope, filename, new basic_1.TableType(type, { withHeader: false, keyType: basic_1.TableKeyType.default }, \"MATCH_RESULT_TAB\"));\n }\n }\n const ofound = node.findExpressionsAfterToken(\"OFFSET\");\n for (const o of ofound) {\n if (o.get() instanceof Expressions.Target) {\n this.inline(o, scope, filename, new basic_1.IntegerType());\n }\n }\n const lfound = node.findExpressionAfterToken(\"LINE\");\n if (lfound && lfound.get() instanceof Expressions.Target) {\n this.inline(lfound, scope, filename, new basic_1.IntegerType());\n }\n const cfound = node.findExpressionAfterToken(\"COUNT\");\n if (cfound && cfound.get() instanceof Expressions.Target) {\n this.inline(cfound, scope, filename, new basic_1.IntegerType());\n }\n const lnfound = node.findExpressionAfterToken(\"LENGTH\");\n if (lnfound && lnfound.get() instanceof Expressions.Target) {\n this.inline(lnfound, scope, filename, new basic_1.IntegerType());\n }\n if (node.findDirectTokenByText(\"SUBMATCHES\")) {\n for (const t of node.findDirectExpressions(Expressions.Target)) {\n if (t === rfound || t === lfound || t === cfound || t === lnfound) {\n continue;\n }\n else if (ofound.indexOf(t) >= 0) {\n continue;\n }\n const inline = t === null || t === void 0 ? void 0 : t.findDirectExpression(Expressions.InlineData);\n if (inline) {\n new inline_data_1.InlineData().runSyntax(inline, scope, filename, new basic_1.StringType());\n }\n else {\n new target_1.Target().runSyntax(t, scope, filename);\n }\n }\n }\n }\n /////////////////////\n inline(node, scope, filename, type) {\n const inline = node.findDirectExpression(Expressions.InlineData);\n if (inline) {\n new inline_data_1.InlineData().runSyntax(inline, scope, filename, type);\n }\n else {\n new target_1.Target().runSyntax(node, scope, filename);\n }\n }\n}\nexports.Find = Find;\n//# sourceMappingURL=find.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/find.js?");
|
|
7929
7929
|
|
|
7930
7930
|
/***/ }),
|
|
7931
7931
|
|
|
@@ -8354,7 +8354,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
8354
8354
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
8355
8355
|
|
|
8356
8356
|
"use strict";
|
|
8357
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Ranges = void 0;\nconst Expressions = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\nconst _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\nconst basic_1 = __webpack_require__(/*! ../../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nconst basic_types_1 = __webpack_require__(/*! ../basic_types */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/basic_types.js\");\nclass Ranges {\n runSyntax(node, scope, filename) {\n var _a;\n const nameToken = (_a = node.findFirstExpression(Expressions.SimpleName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\n const typeExpression = node.findFirstExpression(Expressions.FieldSub);\n if (typeExpression === undefined) {\n throw new Error(\"Ranges, unexpected node\");\n }\n const found = new basic_types_1.BasicTypes(filename, scope).parseType(typeExpression);\n if (found && nameToken) {\n const structure = new basic_1.StructureType([\n { name: \"sign\", type: new basic_1.CharacterType(1) },\n { name: \"option\", type: new basic_1.CharacterType(2) },\n { name: \"low\", type: found },\n { name: \"high\", type: found },\n ]);\n const type = new basic_1.TableType(structure, { withHeader: true });\n const id = new _typed_identifier_1.TypedIdentifier(nameToken, filename, type);\n scope.addIdentifier(id);\n }\n }\n}\nexports.Ranges = Ranges;\n//# sourceMappingURL=ranges.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/ranges.js?");
|
|
8357
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Ranges = void 0;\nconst Expressions = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\nconst _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\nconst basic_1 = __webpack_require__(/*! ../../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nconst basic_types_1 = __webpack_require__(/*! ../basic_types */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/basic_types.js\");\nclass Ranges {\n runSyntax(node, scope, filename) {\n var _a;\n const nameToken = (_a = node.findFirstExpression(Expressions.SimpleName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\n const typeExpression = node.findFirstExpression(Expressions.FieldSub);\n if (typeExpression === undefined) {\n throw new Error(\"Ranges, unexpected node\");\n }\n const found = new basic_types_1.BasicTypes(filename, scope).parseType(typeExpression);\n if (found && nameToken) {\n const structure = new basic_1.StructureType([\n { name: \"sign\", type: new basic_1.CharacterType(1) },\n { name: \"option\", type: new basic_1.CharacterType(2) },\n { name: \"low\", type: found },\n { name: \"high\", type: found },\n ]);\n const type = new basic_1.TableType(structure, { withHeader: true, keyType: basic_1.TableKeyType.default });\n const id = new _typed_identifier_1.TypedIdentifier(nameToken, filename, type);\n scope.addIdentifier(id);\n }\n }\n}\nexports.Ranges = Ranges;\n//# sourceMappingURL=ranges.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/ranges.js?");
|
|
8358
8358
|
|
|
8359
8359
|
/***/ }),
|
|
8360
8360
|
|
|
@@ -8486,7 +8486,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
8486
8486
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
8487
8487
|
|
|
8488
8488
|
"use strict";
|
|
8489
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.SelectOption = void 0;\nconst Expressions = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\nconst _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\nconst basic_1 = __webpack_require__(/*! ../../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nconst basic_types_1 = __webpack_require__(/*! ../basic_types */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/basic_types.js\");\nconst dynamic_1 = __webpack_require__(/*! ../expressions/dynamic */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/dynamic.js\");\nclass SelectOption {\n runSyntax(node, scope, filename) {\n var _a;\n const nameToken = (_a = node.findFirstExpression(Expressions.FieldSub)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\n if (nameToken && nameToken.getStr().length > 8) {\n throw new Error(\"Select-option name too long, \" + nameToken.getStr());\n }\n for (const d of node.findDirectExpressions(Expressions.Dynamic)) {\n new dynamic_1.Dynamic().runSyntax(d, scope, filename);\n }\n const nameExpression = node.findFirstExpression(Expressions.FieldChain);\n let found = new basic_types_1.BasicTypes(filename, scope).resolveLikeName(nameExpression);\n if (found && nameToken) {\n if (found instanceof basic_1.StructureType) {\n let length = 0;\n for (const c of found.getComponents()) {\n if (c.type instanceof basic_1.CharacterType) {\n length += c.type.getLength();\n }\n }\n if (length === 0) {\n found = new basic_1.VoidType(\"Selectoption, fallback\");\n }\n else {\n found = new basic_1.CharacterType(length);\n }\n }\n const stru = new basic_1.StructureType([\n { name: \"SIGN\", type: new basic_1.CharacterType(1) },\n { name: \"OPTION\", type: new basic_1.CharacterType(2) },\n { name: \"LOW\", type: found },\n { name: \"HIGH\", type: found },\n ]);\n scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(nameToken, filename, new basic_1.TableType(stru, { withHeader: true })));\n return;\n }\n if (nameToken) {\n scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(nameToken, filename, new basic_1.UnknownType(\"Select option, fallback\")));\n }\n }\n}\nexports.SelectOption = SelectOption;\n//# sourceMappingURL=selectoption.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/selectoption.js?");
|
|
8489
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.SelectOption = void 0;\nconst Expressions = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\nconst _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\nconst basic_1 = __webpack_require__(/*! ../../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nconst basic_types_1 = __webpack_require__(/*! ../basic_types */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/basic_types.js\");\nconst dynamic_1 = __webpack_require__(/*! ../expressions/dynamic */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/dynamic.js\");\nclass SelectOption {\n runSyntax(node, scope, filename) {\n var _a;\n const nameToken = (_a = node.findFirstExpression(Expressions.FieldSub)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\n if (nameToken && nameToken.getStr().length > 8) {\n throw new Error(\"Select-option name too long, \" + nameToken.getStr());\n }\n for (const d of node.findDirectExpressions(Expressions.Dynamic)) {\n new dynamic_1.Dynamic().runSyntax(d, scope, filename);\n }\n const nameExpression = node.findFirstExpression(Expressions.FieldChain);\n let found = new basic_types_1.BasicTypes(filename, scope).resolveLikeName(nameExpression);\n if (found && nameToken) {\n if (found instanceof basic_1.StructureType) {\n let length = 0;\n for (const c of found.getComponents()) {\n if (c.type instanceof basic_1.CharacterType) {\n length += c.type.getLength();\n }\n }\n if (length === 0) {\n found = new basic_1.VoidType(\"Selectoption, fallback\");\n }\n else {\n found = new basic_1.CharacterType(length);\n }\n }\n const stru = new basic_1.StructureType([\n { name: \"SIGN\", type: new basic_1.CharacterType(1) },\n { name: \"OPTION\", type: new basic_1.CharacterType(2) },\n { name: \"LOW\", type: found },\n { name: \"HIGH\", type: found },\n ]);\n scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(nameToken, filename, new basic_1.TableType(stru, { withHeader: true, keyType: basic_1.TableKeyType.default })));\n return;\n }\n if (nameToken) {\n scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(nameToken, filename, new basic_1.UnknownType(\"Select option, fallback\")));\n }\n }\n}\nexports.SelectOption = SelectOption;\n//# sourceMappingURL=selectoption.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/selectoption.js?");
|
|
8490
8490
|
|
|
8491
8491
|
/***/ }),
|
|
8492
8492
|
|
|
@@ -8585,7 +8585,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
8585
8585
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
8586
8586
|
|
|
8587
8587
|
"use strict";
|
|
8588
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Split = void 0;\nconst Expressions = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\nconst basic_1 = __webpack_require__(/*! ../../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nconst inline_data_1 = __webpack_require__(/*! ../expressions/inline_data */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/inline_data.js\");\nconst source_1 = __webpack_require__(/*! ../expressions/source */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js\");\nconst target_1 = __webpack_require__(/*! ../expressions/target */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js\");\nconst _type_utils_1 = __webpack_require__(/*! ../_type_utils */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js\");\nclass Split {\n runSyntax(node, scope, filename) {\n const intoTable = node.findTokenSequencePosition(\"INTO\", \"TABLE\") !== undefined;\n const type = intoTable ? new basic_1.TableType(new basic_1.StringType(), { withHeader: false }) : new basic_1.StringType();\n for (const target of node.findAllExpressions(Expressions.Target)) {\n const inline = target.findDirectExpression(Expressions.InlineData);\n if (inline) {\n new inline_data_1.InlineData().runSyntax(inline, scope, filename, type);\n }\n else {\n let targetType = new target_1.Target().runSyntax(target, scope, filename);\n if (intoTable) {\n if (!(targetType instanceof basic_1.TableType)\n && !(targetType instanceof basic_1.UnknownType)\n && !(targetType instanceof basic_1.VoidType)) {\n throw new Error(\"Into must be table typed\");\n }\n if (targetType instanceof basic_1.TableType) {\n targetType = targetType.getRowType();\n }\n }\n if (new _type_utils_1.TypeUtils(scope).isCharLikeStrict(targetType) === false) {\n throw new Error(\"Incompatible, target not character like\");\n }\n }\n }\n for (const s of node.findDirectExpressions(Expressions.Source)) {\n new source_1.Source().runSyntax(s, scope, filename);\n }\n }\n}\nexports.Split = Split;\n//# sourceMappingURL=split.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/split.js?");
|
|
8588
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Split = void 0;\nconst Expressions = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\nconst basic_1 = __webpack_require__(/*! ../../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nconst inline_data_1 = __webpack_require__(/*! ../expressions/inline_data */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/inline_data.js\");\nconst source_1 = __webpack_require__(/*! ../expressions/source */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js\");\nconst target_1 = __webpack_require__(/*! ../expressions/target */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js\");\nconst _type_utils_1 = __webpack_require__(/*! ../_type_utils */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js\");\nclass Split {\n runSyntax(node, scope, filename) {\n const intoTable = node.findTokenSequencePosition(\"INTO\", \"TABLE\") !== undefined;\n const type = intoTable ? new basic_1.TableType(new basic_1.StringType(), { withHeader: false, keyType: basic_1.TableKeyType.default }) : new basic_1.StringType();\n for (const target of node.findAllExpressions(Expressions.Target)) {\n const inline = target.findDirectExpression(Expressions.InlineData);\n if (inline) {\n new inline_data_1.InlineData().runSyntax(inline, scope, filename, type);\n }\n else {\n let targetType = new target_1.Target().runSyntax(target, scope, filename);\n if (intoTable) {\n if (!(targetType instanceof basic_1.TableType)\n && !(targetType instanceof basic_1.UnknownType)\n && !(targetType instanceof basic_1.VoidType)) {\n throw new Error(\"Into must be table typed\");\n }\n if (targetType instanceof basic_1.TableType) {\n targetType = targetType.getRowType();\n }\n }\n if (new _type_utils_1.TypeUtils(scope).isCharLikeStrict(targetType) === false) {\n throw new Error(\"Incompatible, target not character like\");\n }\n }\n }\n for (const s of node.findDirectExpressions(Expressions.Source)) {\n new source_1.Source().runSyntax(s, scope, filename);\n }\n }\n}\nexports.Split = Split;\n//# sourceMappingURL=split.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/split.js?");
|
|
8589
8589
|
|
|
8590
8590
|
/***/ }),
|
|
8591
8591
|
|
|
@@ -8849,7 +8849,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
8849
8849
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
8850
8850
|
|
|
8851
8851
|
"use strict";
|
|
8852
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Data = void 0;\nconst Expressions = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\nconst Statements = __webpack_require__(/*! ../../2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\nconst Structures = __webpack_require__(/*! ../../3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\nconst nodes_1 = __webpack_require__(/*! ../../nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\nconst _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\nconst Basic = __webpack_require__(/*! ../../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nconst data_1 = __webpack_require__(/*! ../statements/data */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/data.js\");\nconst _reference_1 = __webpack_require__(/*! ../_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\nclass Data {\n runSyntax(node, scope, filename) {\n var _a;\n const name = node.findFirstExpression(Expressions.DefinitionName).getFirstToken();\n let table = false;\n const values = {};\n const components = [];\n for (const c of node.getChildren()) {\n const ctyp = c.get();\n if (c instanceof nodes_1.StatementNode && ctyp instanceof Statements.Data) {\n const found = new data_1.Data().runSyntax(c, scope, filename);\n if (found) {\n components.push({ name: found.getName(), type: found.getType() });\n if (found.getValue() !== undefined) {\n values[found.getName()] = found.getValue();\n }\n }\n }\n else if (c instanceof nodes_1.StructureNode && ctyp instanceof Structures.Data) {\n const found = new Data().runSyntax(c, scope, filename);\n if (found) {\n components.push({ name: found.getName(), type: found.getType() });\n }\n }\n else if (c instanceof nodes_1.StatementNode && ctyp instanceof Statements.DataBegin) {\n if (c.findDirectTokenByText(\"OCCURS\")) {\n table = true;\n }\n }\n else if (c instanceof nodes_1.StatementNode && ctyp instanceof Statements.IncludeType) {\n // INCLUDES\n const typeToken = (_a = c.findFirstExpression(Expressions.TypeName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\n const typeName = typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStr();\n const foundId = scope.findType(typeName);\n let found = foundId === null || foundId === void 0 ? void 0 : foundId.getType();\n if (found === undefined) {\n const f = scope.getDDIC().lookupTableOrView(typeName).type;\n if (f instanceof _typed_identifier_1.TypedIdentifier) {\n found = f.getType();\n }\n else {\n found = f;\n }\n }\n else {\n scope.addReference(typeToken, foundId, _reference_1.ReferenceType.TypeReference, filename);\n }\n if (found instanceof Basic.VoidType) {\n if (table === true) {\n return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.TableType(found, { withHeader: true }));\n }\n else {\n return new _typed_identifier_1.TypedIdentifier(name, filename, found);\n }\n }\n if (found instanceof Basic.UnknownType) {\n return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.UnknownType(\"unknown type, \" + typeName));\n }\n if (!(found instanceof Basic.StructureType)) {\n throw new Error(\"not structured, \" + typeName);\n }\n for (const c of found.getComponents()) {\n components.push(c);\n }\n }\n }\n if (table === true) {\n return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.TableType(new Basic.StructureType(components), { withHeader: true }));\n }\n else {\n const val = Object.keys(values).length > 0 ? values : undefined;\n return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.StructureType(components), undefined, val);\n }\n }\n}\nexports.Data = Data;\n//# sourceMappingURL=data.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/structures/data.js?");
|
|
8852
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Data = void 0;\nconst Expressions = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\nconst Statements = __webpack_require__(/*! ../../2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\nconst Structures = __webpack_require__(/*! ../../3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\nconst nodes_1 = __webpack_require__(/*! ../../nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\nconst _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\nconst Basic = __webpack_require__(/*! ../../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nconst data_1 = __webpack_require__(/*! ../statements/data */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/data.js\");\nconst _reference_1 = __webpack_require__(/*! ../_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\nclass Data {\n runSyntax(node, scope, filename) {\n var _a;\n const name = node.findFirstExpression(Expressions.DefinitionName).getFirstToken();\n let table = false;\n const values = {};\n const components = [];\n for (const c of node.getChildren()) {\n const ctyp = c.get();\n if (c instanceof nodes_1.StatementNode && ctyp instanceof Statements.Data) {\n const found = new data_1.Data().runSyntax(c, scope, filename);\n if (found) {\n components.push({ name: found.getName(), type: found.getType() });\n if (found.getValue() !== undefined) {\n values[found.getName()] = found.getValue();\n }\n }\n }\n else if (c instanceof nodes_1.StructureNode && ctyp instanceof Structures.Data) {\n const found = new Data().runSyntax(c, scope, filename);\n if (found) {\n components.push({ name: found.getName(), type: found.getType() });\n }\n }\n else if (c instanceof nodes_1.StatementNode && ctyp instanceof Statements.DataBegin) {\n if (c.findDirectTokenByText(\"OCCURS\")) {\n table = true;\n }\n }\n else if (c instanceof nodes_1.StatementNode && ctyp instanceof Statements.IncludeType) {\n // INCLUDES\n const typeToken = (_a = c.findFirstExpression(Expressions.TypeName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\n const typeName = typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStr();\n const foundId = scope.findType(typeName);\n let found = foundId === null || foundId === void 0 ? void 0 : foundId.getType();\n if (found === undefined) {\n const f = scope.getDDIC().lookupTableOrView(typeName).type;\n if (f instanceof _typed_identifier_1.TypedIdentifier) {\n found = f.getType();\n }\n else {\n found = f;\n }\n }\n else {\n scope.addReference(typeToken, foundId, _reference_1.ReferenceType.TypeReference, filename);\n }\n if (found instanceof Basic.VoidType) {\n if (table === true) {\n return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.TableType(found, { withHeader: true, keyType: Basic.TableKeyType.default }));\n }\n else {\n return new _typed_identifier_1.TypedIdentifier(name, filename, found);\n }\n }\n if (found instanceof Basic.UnknownType) {\n return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.UnknownType(\"unknown type, \" + typeName));\n }\n if (!(found instanceof Basic.StructureType)) {\n throw new Error(\"not structured, \" + typeName);\n }\n for (const c of found.getComponents()) {\n components.push(c);\n }\n }\n }\n if (table === true) {\n return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.TableType(new Basic.StructureType(components), { withHeader: true, keyType: Basic.TableKeyType.default }));\n }\n else {\n const val = Object.keys(values).length > 0 ? values : undefined;\n return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.StructureType(components), undefined, val);\n }\n }\n}\nexports.Data = Data;\n//# sourceMappingURL=data.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/structures/data.js?");
|
|
8853
8853
|
|
|
8854
8854
|
/***/ }),
|
|
8855
8855
|
|
|
@@ -8860,7 +8860,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
8860
8860
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
8861
8861
|
|
|
8862
8862
|
"use strict";
|
|
8863
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Statics = void 0;\nconst Expressions = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\nconst Statements = __webpack_require__(/*! ../../2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\nconst Structures = __webpack_require__(/*! ../../3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\nconst nodes_1 = __webpack_require__(/*! ../../nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\nconst _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\nconst Basic = __webpack_require__(/*! ../../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nconst static_1 = __webpack_require__(/*! ../statements/static */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/static.js\");\n// todo, this is much like DATA, refactor?\nclass Statics {\n runSyntax(node, scope, filename) {\n var _a, _b;\n const name = node.findFirstExpression(Expressions.DefinitionName).getFirstToken();\n let table = false;\n const components = [];\n for (const c of node.getChildren()) {\n const ctyp = c.get();\n if (c instanceof nodes_1.StatementNode && ctyp instanceof Statements.Static) {\n const found = new static_1.Static().runSyntax(c, scope, filename);\n if (found) {\n components.push({ name: found.getName(), type: found.getType() });\n }\n }\n else if (c instanceof nodes_1.StructureNode && ctyp instanceof Structures.Statics) {\n const found = new Statics().runSyntax(c, scope, filename);\n if (found) {\n components.push({ name: found.getName(), type: found.getType() });\n }\n }\n else if (c instanceof nodes_1.StatementNode && ctyp instanceof Statements.StaticBegin) {\n if (c.findDirectTokenByText(\"OCCURS\")) {\n table = true;\n }\n }\n else if (c instanceof nodes_1.StatementNode && ctyp instanceof Statements.IncludeType) {\n // INCLUDES\n const typeName = (_a = c.findFirstExpression(Expressions.TypeName)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr();\n let found = (_b = scope.findType(typeName)) === null || _b === void 0 ? void 0 : _b.getType();\n if (found === undefined) {\n const f = scope.getDDIC().lookupTableOrView(typeName).type;\n if (f instanceof _typed_identifier_1.TypedIdentifier) {\n found = f.getType();\n }\n else {\n found = f;\n }\n }\n if (found instanceof Basic.VoidType) {\n if (table === true) {\n return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.TableType(found, { withHeader: true }));\n }\n else {\n return new _typed_identifier_1.TypedIdentifier(name, filename, found);\n }\n }\n if (found instanceof Basic.UnknownType) {\n return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.UnknownType(\"unknown type, \" + typeName));\n }\n if (!(found instanceof Basic.StructureType)) {\n throw new Error(\"not structured, \" + typeName);\n }\n for (const c of found.getComponents()) {\n components.push(c);\n }\n }\n }\n if (table === true) {\n return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.TableType(new Basic.StructureType(components), { withHeader: true }));\n }\n else {\n return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.StructureType(components));\n }\n }\n}\nexports.Statics = Statics;\n//# sourceMappingURL=statics.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/structures/statics.js?");
|
|
8863
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Statics = void 0;\nconst Expressions = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\nconst Statements = __webpack_require__(/*! ../../2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\nconst Structures = __webpack_require__(/*! ../../3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\nconst nodes_1 = __webpack_require__(/*! ../../nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\nconst _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\nconst Basic = __webpack_require__(/*! ../../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nconst static_1 = __webpack_require__(/*! ../statements/static */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/static.js\");\n// todo, this is much like DATA, refactor?\nclass Statics {\n runSyntax(node, scope, filename) {\n var _a, _b;\n const name = node.findFirstExpression(Expressions.DefinitionName).getFirstToken();\n let table = false;\n const components = [];\n for (const c of node.getChildren()) {\n const ctyp = c.get();\n if (c instanceof nodes_1.StatementNode && ctyp instanceof Statements.Static) {\n const found = new static_1.Static().runSyntax(c, scope, filename);\n if (found) {\n components.push({ name: found.getName(), type: found.getType() });\n }\n }\n else if (c instanceof nodes_1.StructureNode && ctyp instanceof Structures.Statics) {\n const found = new Statics().runSyntax(c, scope, filename);\n if (found) {\n components.push({ name: found.getName(), type: found.getType() });\n }\n }\n else if (c instanceof nodes_1.StatementNode && ctyp instanceof Statements.StaticBegin) {\n if (c.findDirectTokenByText(\"OCCURS\")) {\n table = true;\n }\n }\n else if (c instanceof nodes_1.StatementNode && ctyp instanceof Statements.IncludeType) {\n // INCLUDES\n const typeName = (_a = c.findFirstExpression(Expressions.TypeName)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr();\n let found = (_b = scope.findType(typeName)) === null || _b === void 0 ? void 0 : _b.getType();\n if (found === undefined) {\n const f = scope.getDDIC().lookupTableOrView(typeName).type;\n if (f instanceof _typed_identifier_1.TypedIdentifier) {\n found = f.getType();\n }\n else {\n found = f;\n }\n }\n if (found instanceof Basic.VoidType) {\n if (table === true) {\n return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.TableType(found, { withHeader: true, keyType: Basic.TableKeyType.default }));\n }\n else {\n return new _typed_identifier_1.TypedIdentifier(name, filename, found);\n }\n }\n if (found instanceof Basic.UnknownType) {\n return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.UnknownType(\"unknown type, \" + typeName));\n }\n if (!(found instanceof Basic.StructureType)) {\n throw new Error(\"not structured, \" + typeName);\n }\n for (const c of found.getComponents()) {\n components.push(c);\n }\n }\n }\n if (table === true) {\n return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.TableType(new Basic.StructureType(components), { withHeader: true, keyType: Basic.TableKeyType.default }));\n }\n else {\n return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.StructureType(components));\n }\n }\n}\nexports.Statics = Statics;\n//# sourceMappingURL=statics.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/structures/statics.js?");
|
|
8864
8864
|
|
|
8865
8865
|
/***/ }),
|
|
8866
8866
|
|
|
@@ -9322,7 +9322,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
9322
9322
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
9323
9323
|
|
|
9324
9324
|
"use strict";
|
|
9325
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.TableType = exports.TableAccessType = void 0;\nconst _abstract_type_1 = __webpack_require__(/*! ./_abstract_type */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/_abstract_type.js\");\nvar TableAccessType;\n(function (TableAccessType) {\n TableAccessType[\"standard\"] = \"STANDARD\";\n TableAccessType[\"sorted\"] = \"SORTED\";\n TableAccessType[\"hashed\"] = \"HASHED\";\n TableAccessType[\"index\"] = \"INDEX\";\n TableAccessType[\"any\"] = \"ANY\";\n})(TableAccessType = exports.TableAccessType || (exports.TableAccessType = {}));\nclass TableType extends _abstract_type_1.AbstractType {\n constructor(rowType, options, qualifiedName) {\n var _a;\n super({ qualifiedName: qualifiedName });\n this.rowType = rowType;\n this.options = options;\n if (((_a = options.primaryKey) === null || _a === void 0 ? void 0 : _a.type) === TableAccessType.standard && options.primaryKey.isUnique === true) {\n throw new Error(\"STANDARD tables cannot have UNIQUE key\");\n }\n }\n getOptions() {\n return this.options;\n }\n isWithHeader() {\n return this.options.withHeader;\n }\n getAccessType() {\n var _a;\n return (_a = this.options.primaryKey) === null || _a === void 0 ? void 0 : _a.type;\n }\n getRowType() {\n return this.rowType;\n }\n toABAP() {\n // todo, this is used for downport, so use default key for now\n return \"STANDARD TABLE OF \" + this.rowType.toABAP() + \" WITH DEFAULT KEY\";\n }\n toText(level) {\n const type = this.rowType;\n if (this.options.withHeader === true) {\n return \"Table with header of \" + type.toText(level + 1);\n }\n else {\n return \"Table of \" + type.toText(level + 1);\n }\n }\n isGeneric() {\n var _a, _b;\n if (((_a = this.options.primaryKey) === null || _a === void 0 ? void 0 : _a.type) !== TableAccessType.standard\n && ((_b = this.options.primaryKey) === null || _b === void 0 ? void 0 : _b.keyFields.length) === 0) {\n return true;\n }\n return this.rowType.isGeneric();\n }\n containsVoid() {\n return this.rowType.containsVoid();\n }\n toCDS() {\n return \"abap.TODO_TABLE\";\n }\n}\nexports.TableType = TableType;\n//# sourceMappingURL=table_type.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/types/basic/table_type.js?");
|
|
9325
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.TableType = exports.TableKeyType = exports.TableAccessType = void 0;\nconst _abstract_type_1 = __webpack_require__(/*! ./_abstract_type */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/_abstract_type.js\");\nvar TableAccessType;\n(function (TableAccessType) {\n TableAccessType[\"standard\"] = \"STANDARD\";\n TableAccessType[\"sorted\"] = \"SORTED\";\n TableAccessType[\"hashed\"] = \"HASHED\";\n TableAccessType[\"index\"] = \"INDEX\";\n TableAccessType[\"any\"] = \"ANY\";\n})(TableAccessType = exports.TableAccessType || (exports.TableAccessType = {}));\nvar TableKeyType;\n(function (TableKeyType) {\n TableKeyType[\"default\"] = \"DEFAULT\";\n TableKeyType[\"user\"] = \"USER\";\n TableKeyType[\"empty\"] = \"EMPTY\";\n})(TableKeyType = exports.TableKeyType || (exports.TableKeyType = {}));\nclass TableType extends _abstract_type_1.AbstractType {\n constructor(rowType, options, qualifiedName) {\n var _a;\n super({ qualifiedName: qualifiedName });\n this.rowType = rowType;\n this.options = options;\n if (((_a = options.primaryKey) === null || _a === void 0 ? void 0 : _a.type) === TableAccessType.standard && options.primaryKey.isUnique === true) {\n throw new Error(\"STANDARD tables cannot have UNIQUE key\");\n }\n }\n getOptions() {\n return this.options;\n }\n isWithHeader() {\n return this.options.withHeader;\n }\n getAccessType() {\n var _a;\n return (_a = this.options.primaryKey) === null || _a === void 0 ? void 0 : _a.type;\n }\n getRowType() {\n return this.rowType;\n }\n toABAP() {\n // todo, this is used for downport, so use default key for now\n return \"STANDARD TABLE OF \" + this.rowType.toABAP() + \" WITH DEFAULT KEY\";\n }\n toText(level) {\n const type = this.rowType;\n if (this.options.withHeader === true) {\n return \"Table with header of \" + type.toText(level + 1);\n }\n else {\n return \"Table of \" + type.toText(level + 1);\n }\n }\n isGeneric() {\n var _a, _b;\n if (((_a = this.options.primaryKey) === null || _a === void 0 ? void 0 : _a.type) !== TableAccessType.standard\n && this.options.keyType === TableKeyType.user\n && ((_b = this.options.primaryKey) === null || _b === void 0 ? void 0 : _b.keyFields.length) === 0) {\n return true;\n }\n return this.rowType.isGeneric();\n }\n containsVoid() {\n return this.rowType.containsVoid();\n }\n toCDS() {\n return \"abap.TODO_TABLE\";\n }\n}\nexports.TableType = TableType;\n//# sourceMappingURL=table_type.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/types/basic/table_type.js?");
|
|
9326
9326
|
|
|
9327
9327
|
/***/ }),
|
|
9328
9328
|
|
|
@@ -9465,7 +9465,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
9465
9465
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
9466
9466
|
|
|
9467
9467
|
"use strict";
|
|
9468
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.FormDefinition = void 0;\nconst Statements = __webpack_require__(/*! ../2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\nconst Expressions = __webpack_require__(/*! ../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\nconst Tokens = __webpack_require__(/*! ../1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\nconst _identifier_1 = __webpack_require__(/*! ../4_file_information/_identifier */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/_identifier.js\");\nconst nodes_1 = __webpack_require__(/*! ../nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\nconst _typed_identifier_1 = __webpack_require__(/*! ./_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\nconst form_param_1 = __webpack_require__(/*! ../5_syntax/expressions/form_param */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/form_param.js\");\nconst basic_1 = __webpack_require__(/*! ./basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nclass FormDefinition extends _identifier_1.Identifier {\n constructor(node, filename, scope) {\n const st = node instanceof nodes_1.StructureNode ? node.findFirstStatement(Statements.Form) : node;\n // FORMs can contain a dash in the name\n const formName = st.findFirstExpression(Expressions.FormName);\n const pos = formName.getFirstToken().getStart();\n const name = formName.concatTokens();\n const nameToken = new Tokens.Identifier(pos, name);\n super(nameToken, filename);\n this.node = st;\n this.tableParameters = this.findTables(scope, filename);\n this.usingParameters = this.findType(Expressions.FormUsing, scope);\n this.changingParameters = this.findType(Expressions.FormChanging, scope);\n }\n getTablesParameters() {\n return this.tableParameters;\n }\n getUsingParameters() {\n return this.usingParameters;\n }\n getChangingParameters() {\n return this.changingParameters;\n }\n ///////////////\n findTables(scope, filename) {\n const ret = [];\n const tables = this.node.findFirstExpression(Expressions.FormTables);\n if (tables === undefined) {\n return [];\n }\n for (const param of tables.findAllExpressions(Expressions.FormParam)) {\n if (param.getChildren().length === 1) {\n // untyped TABLES parameter\n ret.push(new _typed_identifier_1.TypedIdentifier(param.getFirstToken(), filename, new basic_1.VoidType(\"FORM:UNTYPED\"), [\"form_parameter\" /* IdentifierMeta.FormParameter */]));\n }\n else {\n const p = new form_param_1.FormParam().runSyntax(param, scope, this.filename);\n let type = p.getType();\n const isStructure = param.findDirectTokenByText(\"STRUCTURE\") !== undefined;\n if (isStructure) {\n type = new basic_1.TableType(type, { withHeader: true });\n }\n if (type instanceof basic_1.TableType) {\n type = new basic_1.TableType(type.getRowType(), { withHeader: true });\n }\n else if (!(type instanceof basic_1.UnknownType) && !(type instanceof basic_1.VoidType)) {\n type = new basic_1.UnknownType(\"FORM TABLES type must be table type\");\n }\n ret.push(new _typed_identifier_1.TypedIdentifier(p.getToken(), filename, type, [\"form_parameter\" /* IdentifierMeta.FormParameter */]));\n }\n }\n return ret;\n }\n findType(type, scope) {\n const found = this.node.findFirstExpression(type);\n if (found === undefined) {\n return [];\n }\n return this.findParams(found, scope);\n }\n findParams(node, scope) {\n const res = [];\n for (const param of node.findAllExpressions(Expressions.FormParam)) {\n const p = new form_param_1.FormParam().runSyntax(param, scope, this.filename);\n res.push(p);\n }\n return res;\n }\n}\nexports.FormDefinition = FormDefinition;\n//# sourceMappingURL=form_definition.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/types/form_definition.js?");
|
|
9468
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.FormDefinition = void 0;\nconst Statements = __webpack_require__(/*! ../2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\nconst Expressions = __webpack_require__(/*! ../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\nconst Tokens = __webpack_require__(/*! ../1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\nconst _identifier_1 = __webpack_require__(/*! ../4_file_information/_identifier */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/_identifier.js\");\nconst nodes_1 = __webpack_require__(/*! ../nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\nconst _typed_identifier_1 = __webpack_require__(/*! ./_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\nconst form_param_1 = __webpack_require__(/*! ../5_syntax/expressions/form_param */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/form_param.js\");\nconst basic_1 = __webpack_require__(/*! ./basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nclass FormDefinition extends _identifier_1.Identifier {\n constructor(node, filename, scope) {\n const st = node instanceof nodes_1.StructureNode ? node.findFirstStatement(Statements.Form) : node;\n // FORMs can contain a dash in the name\n const formName = st.findFirstExpression(Expressions.FormName);\n const pos = formName.getFirstToken().getStart();\n const name = formName.concatTokens();\n const nameToken = new Tokens.Identifier(pos, name);\n super(nameToken, filename);\n this.node = st;\n this.tableParameters = this.findTables(scope, filename);\n this.usingParameters = this.findType(Expressions.FormUsing, scope);\n this.changingParameters = this.findType(Expressions.FormChanging, scope);\n }\n getTablesParameters() {\n return this.tableParameters;\n }\n getUsingParameters() {\n return this.usingParameters;\n }\n getChangingParameters() {\n return this.changingParameters;\n }\n ///////////////\n findTables(scope, filename) {\n const ret = [];\n const tables = this.node.findFirstExpression(Expressions.FormTables);\n if (tables === undefined) {\n return [];\n }\n for (const param of tables.findAllExpressions(Expressions.FormParam)) {\n if (param.getChildren().length === 1) {\n // untyped TABLES parameter\n ret.push(new _typed_identifier_1.TypedIdentifier(param.getFirstToken(), filename, new basic_1.VoidType(\"FORM:UNTYPED\"), [\"form_parameter\" /* IdentifierMeta.FormParameter */]));\n }\n else {\n const p = new form_param_1.FormParam().runSyntax(param, scope, this.filename);\n let type = p.getType();\n const isStructure = param.findDirectTokenByText(\"STRUCTURE\") !== undefined;\n if (isStructure) {\n type = new basic_1.TableType(type, { withHeader: true, keyType: basic_1.TableKeyType.default });\n }\n if (type instanceof basic_1.TableType) {\n type = new basic_1.TableType(type.getRowType(), { withHeader: true, keyType: basic_1.TableKeyType.default });\n }\n else if (!(type instanceof basic_1.UnknownType) && !(type instanceof basic_1.VoidType)) {\n type = new basic_1.UnknownType(\"FORM TABLES type must be table type\");\n }\n ret.push(new _typed_identifier_1.TypedIdentifier(p.getToken(), filename, type, [\"form_parameter\" /* IdentifierMeta.FormParameter */]));\n }\n }\n return ret;\n }\n findType(type, scope) {\n const found = this.node.findFirstExpression(type);\n if (found === undefined) {\n return [];\n }\n return this.findParams(found, scope);\n }\n findParams(node, scope) {\n const res = [];\n for (const param of node.findAllExpressions(Expressions.FormParam)) {\n const p = new form_param_1.FormParam().runSyntax(param, scope, this.filename);\n res.push(p);\n }\n return res;\n }\n}\nexports.FormDefinition = FormDefinition;\n//# sourceMappingURL=form_definition.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/types/form_definition.js?");
|
|
9469
9469
|
|
|
9470
9470
|
/***/ }),
|
|
9471
9471
|
|
|
@@ -10026,7 +10026,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
10026
10026
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
10027
10027
|
|
|
10028
10028
|
"use strict";
|
|
10029
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.DDIC = void 0;\nconst Types = __webpack_require__(/*! ./abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nconst basic_1 = __webpack_require__(/*! ./abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nclass DDIC {\n constructor(reg) {\n this.reg = reg;\n }\n // the class might be local with a local super class with a global exception class as super\n // todo: returns true for both local and global exception classes\n isException(def, _obj) {\n var _a;\n if (def === undefined) {\n return false;\n }\n if (def.name.toUpperCase() === \"CX_ROOT\") {\n return true;\n }\n let superClassName = def.superClassName;\n if (superClassName === undefined) {\n return false;\n }\n let i = 0;\n // max depth, make sure not to hit cyclic super class defintions\n while (i++ < 10 && superClassName !== undefined) {\n const found = this.reg.getObject(\"CLAS\", superClassName);\n if (found === undefined) {\n break;\n }\n const superDef = (_a = found.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getInfo().getClassDefinitionByName(superClassName);\n if (superDef === undefined) {\n break;\n }\n if (superDef.superClassName) {\n superClassName = superDef.superClassName;\n }\n else {\n break;\n }\n }\n // todo, this should check for \"CX_ROOT\"\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;\n return isException;\n }\n lookupBuiltinType(name, length, decimals, qualifiedName) {\n switch (name) {\n case \"STRING\":\n return new Types.StringType({ qualifiedName: qualifiedName || name });\n case \"XSTRING\":\n return new Types.XStringType({ qualifiedName: qualifiedName || name });\n case \"D\":\n return new Types.DateType({ qualifiedName: qualifiedName || name });\n case \"T\":\n return new Types.TimeType({ qualifiedName: qualifiedName || name });\n case \"XSEQUENCE\":\n return new Types.XSequenceType({ qualifiedName: qualifiedName });\n case \"CLIKE\":\n return new Types.CLikeType({ qualifiedName: qualifiedName });\n case \"DECFLOAT\":\n return new Types.DecFloatType({ qualifiedName: qualifiedName });\n case \"ANY\":\n return new Types.AnyType({ qualifiedName: qualifiedName });\n case \"SIMPLE\":\n return new Types.SimpleType({ qualifiedName: qualifiedName });\n case \"%_C_POINTER\":\n return new Types.HexType(8, qualifiedName);\n case \"TABLE\":\n return new Types.TableType(new Types.AnyType(), { withHeader: false });\n case \"DATA\":\n return new Types.AnyType({ qualifiedName: qualifiedName });\n case \"NUMERIC\":\n return new Types.NumericGenericType({ qualifiedName: qualifiedName });\n case \"UTCLONG\": // todo, take version into account\n return new Types.UTCLongType({ qualifiedName: qualifiedName });\n case \"DECFLOAT16\":\n return new Types.DecFloat16Type({ qualifiedName: qualifiedName });\n case \"DECFLOAT34\":\n return new Types.DecFloat34Type({ qualifiedName: qualifiedName });\n case \"CSEQUENCE\":\n return new Types.CSequenceType({ qualifiedName: qualifiedName });\n case \"I\":\n case \"INT8\": // todo, take version into account\n return new Types.IntegerType({ qualifiedName: qualifiedName || name });\n case \"F\":\n return new Types.FloatType({ qualifiedName: qualifiedName || name });\n case \"P\":\n if (length && decimals) {\n return new Types.PackedType(length, decimals, { qualifiedName: qualifiedName });\n }\n else if (length) {\n return new Types.PackedType(length, 0, { qualifiedName: qualifiedName });\n }\n else {\n return new Types.PackedType(1, 0, { qualifiedName: qualifiedName });\n }\n case \"C\":\n if (length) {\n return new Types.CharacterType(length, { qualifiedName: qualifiedName });\n }\n else {\n return new Types.CharacterType(1, { qualifiedName: qualifiedName });\n }\n case \"X\":\n if (length) {\n return new Types.HexType(length, qualifiedName);\n }\n else {\n return new Types.HexType(1, qualifiedName);\n }\n case \"N\":\n if (length) {\n return new Types.NumericType(length, qualifiedName);\n }\n else {\n return new Types.NumericType(1, qualifiedName);\n }\n }\n return undefined;\n }\n inErrorNamespace(name) {\n if (name === undefined) {\n return true;\n }\n return this.reg.inErrorNamespace(name);\n }\n lookupObject(name) {\n const clas = this.reg.getObject(\"CLAS\", name);\n const globalClas = clas === null || clas === void 0 ? void 0 : clas.getIdentifier();\n if (globalClas) {\n return { type: new basic_1.ObjectReferenceType(globalClas, name), object: clas };\n }\n const intf = this.reg.getObject(\"INTF\", name);\n const globalIntf = intf === null || intf === void 0 ? void 0 : intf.getIdentifier();\n if (globalIntf) {\n return { type: new basic_1.ObjectReferenceType(globalIntf, name), object: intf };\n }\n if (this.inErrorNamespace(name) === true) {\n return { type: new basic_1.UnknownType(name) };\n }\n else {\n return { type: new basic_1.VoidType(name) };\n }\n }\n lookupNoVoid(name) {\n const foundTABL = this.reg.getObject(\"TABL\", name);\n if (foundTABL) {\n return { type: foundTABL.parseType(this.reg), object: foundTABL };\n }\n const foundVIEW = this.reg.getObject(\"VIEW\", name);\n if (foundVIEW) {\n return { type: foundVIEW.parseType(this.reg), object: foundVIEW };\n }\n const foundTTYP = this.reg.getObject(\"TTYP\", name);\n if (foundTTYP) {\n return { type: foundTTYP.parseType(this.reg), object: foundTTYP };\n }\n const foundDTEL = this.reg.getObject(\"DTEL\", name);\n if (foundDTEL) {\n return { type: foundDTEL.parseType(this.reg), object: foundDTEL };\n }\n const foundDDLS = this.lookupDDLS(name);\n if (foundDDLS) {\n return foundDDLS;\n }\n return undefined;\n }\n lookupDDLS(name) {\n var _a;\n if (name === undefined) {\n return undefined;\n }\n const upper = name.toUpperCase();\n for (const obj of this.reg.getObjectsByType(\"DDLS\")) {\n const ddls = obj;\n if (ddls.getSQLViewName() === upper || ((_a = ddls.getDefinitionName()) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === upper) {\n return { type: ddls.parseType(this.reg), object: ddls };\n }\n }\n return undefined;\n }\n /** lookup with voiding and unknown types */\n lookup(name) {\n const found = this.lookupNoVoid(name);\n if (found) {\n return found;\n }\n if (this.reg.inErrorNamespace(name)) {\n return { type: new Types.UnknownType(name + \" not found, lookup\") };\n }\n else {\n return { type: new Types.VoidType(name) };\n }\n }\n lookupDomain(name, dataElement) {\n const found = this.reg.getObject(\"DOMA\", name);\n if (found) {\n return { type: found.parseType(this.reg, dataElement), object: found };\n }\n else if (this.reg.inErrorNamespace(name)) {\n return { type: new Types.UnknownType(name + \", lookupDomain\"), object: undefined };\n }\n else {\n return { type: new Types.VoidType(name), object: undefined };\n }\n }\n lookupDataElement(name) {\n if (name === undefined) {\n return { type: new Types.UnknownType(\"undefined, lookupDataElement\") };\n }\n const found = this.reg.getObject(\"DTEL\", name);\n if (found) {\n return { type: found.parseType(this.reg), object: found };\n }\n else if (this.reg.inErrorNamespace(name)) {\n return { type: new Types.UnknownType(name + \" not found, lookupDataElement\") };\n }\n else {\n return { type: new Types.VoidType(name) };\n }\n }\n lookupTableOrView(name) {\n if (name === undefined) {\n return { type: new Types.UnknownType(\"undefined, lookupTableOrView\") };\n }\n const foundTABL = this.reg.getObject(\"TABL\", name);\n if (foundTABL) {\n return { type: foundTABL.parseType(this.reg), object: foundTABL };\n }\n const foundDDLS = this.lookupDDLS(name);\n if (foundDDLS) {\n return foundDDLS;\n }\n return this.lookupView(name);\n }\n /** this method only looks up the object, does not parse the type */\n lookupTableOrView2(name) {\n if (name === undefined) {\n return undefined;\n }\n const foundTABL = this.reg.getObject(\"TABL\", name);\n if (foundTABL) {\n return foundTABL;\n }\n const foundVIEW = this.reg.getObject(\"VIEW\", name);\n if (foundVIEW) {\n return foundVIEW;\n }\n const foundDDLS = this.lookupDDLS(name);\n if (foundDDLS) {\n return foundDDLS.object;\n }\n return undefined;\n }\n lookupTable(name) {\n if (name === undefined) {\n return new Types.UnknownType(\"undefined, lookupTable\");\n }\n const found = this.reg.getObject(\"TABL\", name);\n if (found) {\n return found.parseType(this.reg);\n }\n else if (this.reg.inErrorNamespace(name)) {\n return new Types.UnknownType(name + \" not found, lookupTable\");\n }\n else {\n return new Types.VoidType(name);\n }\n }\n lookupView(name) {\n if (name === undefined) {\n return { type: new Types.UnknownType(\"undefined, lookupView\") };\n }\n const found = this.reg.getObject(\"VIEW\", name);\n if (found) {\n return { type: found.parseType(this.reg), object: found };\n }\n else if (this.reg.inErrorNamespace(name)) {\n return { type: new Types.UnknownType(name + \" not found, lookupView\") };\n }\n else {\n return { type: new Types.VoidType(name) };\n }\n }\n lookupTableType(name) {\n if (name === undefined) {\n return { type: new Types.UnknownType(\"undefined, lookupTableType\") };\n }\n const found = this.reg.getObject(\"TTYP\", name);\n if (found) {\n return { type: found.parseType(this.reg), object: found };\n }\n else if (this.reg.inErrorNamespace(name)) {\n return { type: new Types.UnknownType(name + \" not found, lookupTableType\") };\n }\n else {\n return { type: new Types.VoidType(name) };\n }\n }\n textToType(text, length, decimals, infoText, qualifiedName, conversionExit, ddicName) {\n // todo: support short strings, and length of different integers, NUMC vs CHAR, min/max length\n switch (text) {\n case \"DEC\": // 1 <= len <= 31\n case \"D16F\": // 1 <= len <= 31\n case \"D34F\": // 1 <= len <= 31\n case \"DF16_DEC\": // 1 <= len <= 31\n case \"DF34_DEC\": // 1 <= len <= 31\n case \"CURR\": // 1 <= len <= 31\n case \"QUAN\": // 1 <= len <= 31\n if (length === undefined) {\n return new Types.UnknownType(text + \" unknown length, \" + infoText, infoText);\n }\n else if (decimals === undefined) {\n return new Types.PackedType(parseInt(length, 10), 0, { qualifiedName, conversionExit, ddicName });\n }\n return new Types.PackedType(parseInt(length, 10), parseInt(decimals, 10), { qualifiedName, conversionExit, ddicName });\n case \"ACCP\":\n return new Types.CharacterType(6, { qualifiedName, conversionExit, ddicName }); // YYYYMM\n case \"LANG\":\n return new Types.CharacterType(1, { qualifiedName, conversionExit, ddicName });\n case \"CLNT\":\n return new Types.CharacterType(3, { qualifiedName, conversionExit, ddicName });\n case \"CUKY\":\n return new Types.CharacterType(5, { qualifiedName, conversionExit, ddicName });\n case \"UNIT\": // 2 <= len <= 3\n return new Types.CharacterType(3, { qualifiedName, conversionExit, ddicName });\n case \"UTCLONG\":\n return new Types.CharacterType(27, { qualifiedName, conversionExit, ddicName });\n case \"NUMC\": // 1 <= len <= 255\n if (length === undefined) {\n return new Types.UnknownType(text + \" unknown length\", infoText);\n }\n return new Types.NumericType(parseInt(length, 10), qualifiedName);\n case \"CHAR\": // 1 <= len <= 30000 (1333 for table fields)\n case \"LCHR\": // 256 <= len <= 32000\n if (length === undefined) {\n return new Types.UnknownType(text + \" unknown length\", infoText);\n }\n return new Types.CharacterType(parseInt(length, 10), { qualifiedName, conversionExit, ddicName });\n case \"RAW\": // 1 <= len <= 32000\n case \"LRAW\": // 256 <= len <= 32000\n if (length === undefined) {\n return new Types.UnknownType(text + \" unknown length\", infoText);\n }\n return new Types.HexType(parseInt(length, 10), qualifiedName);\n case \"TIMN\": // Native HANA\n case \"TIMS\":\n return new Types.TimeType({ qualifiedName: qualifiedName }); //HHMMSS\n case \"DECFLOAT16\": // len = 16\n case \"DECFLOAT34\": // len = 34\n case \"D16R\": // len = 16\n case \"D34R\": // len = 34\n case \"DF16_RAW\": // len = 16\n case \"DF34_RAW\": // len = 34\n case \"FLTP\": // len = 16\n if (length === undefined) {\n return new Types.UnknownType(text + \" unknown length\", infoText);\n }\n return new Types.FloatingPointType(parseInt(length, 10), qualifiedName);\n case \"DATN\": // Native HANA\n case \"DATS\":\n return new Types.DateType({ qualifiedName: qualifiedName }); //YYYYMMDD\n case \"INT1\":\n case \"INT2\":\n case \"INT4\":\n case \"INT8\":\n return new Types.IntegerType({ qualifiedName: qualifiedName });\n case \"SSTR\": // 1 <= len <= 1333\n case \"SSTRING\": // 1 <= len <= 1333\n case \"STRG\": // 256 <= len\n case \"STRING\": // 256 <= len\n return new Types.StringType({ qualifiedName: qualifiedName });\n case \"RSTR\": // 256 <= len\n case \"RAWSTRING\": // 256 <= len\n case \"GEOM_EWKB\":\n return new Types.XStringType({ qualifiedName: qualifiedName });\n case \"D16S\":\n case \"D34S\":\n case \"DF16_SCL\":\n case \"DF34_SCL\":\n case \"PREC\":\n case \"VARC\":\n return new Types.UnknownType(text + \" is an obsolete data type\", infoText);\n default:\n return new Types.UnknownType(text + \" unknown\", infoText);\n }\n }\n}\nexports.DDIC = DDIC;\n//# sourceMappingURL=ddic.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/ddic.js?");
|
|
10029
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.DDIC = void 0;\nconst Types = __webpack_require__(/*! ./abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nconst basic_1 = __webpack_require__(/*! ./abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nclass DDIC {\n constructor(reg) {\n this.reg = reg;\n }\n // the class might be local with a local super class with a global exception class as super\n // todo: returns true for both local and global exception classes\n isException(def, _obj) {\n var _a;\n if (def === undefined) {\n return false;\n }\n if (def.name.toUpperCase() === \"CX_ROOT\") {\n return true;\n }\n let superClassName = def.superClassName;\n if (superClassName === undefined) {\n return false;\n }\n let i = 0;\n // max depth, make sure not to hit cyclic super class defintions\n while (i++ < 10 && superClassName !== undefined) {\n const found = this.reg.getObject(\"CLAS\", superClassName);\n if (found === undefined) {\n break;\n }\n const superDef = (_a = found.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getInfo().getClassDefinitionByName(superClassName);\n if (superDef === undefined) {\n break;\n }\n if (superDef.superClassName) {\n superClassName = superDef.superClassName;\n }\n else {\n break;\n }\n }\n // todo, this should check for \"CX_ROOT\"\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;\n return isException;\n }\n lookupBuiltinType(name, length, decimals, qualifiedName) {\n switch (name) {\n case \"STRING\":\n return new Types.StringType({ qualifiedName: qualifiedName || name });\n case \"XSTRING\":\n return new Types.XStringType({ qualifiedName: qualifiedName || name });\n case \"D\":\n return new Types.DateType({ qualifiedName: qualifiedName || name });\n case \"T\":\n return new Types.TimeType({ qualifiedName: qualifiedName || name });\n case \"XSEQUENCE\":\n return new Types.XSequenceType({ qualifiedName: qualifiedName });\n case \"CLIKE\":\n return new Types.CLikeType({ qualifiedName: qualifiedName });\n case \"DECFLOAT\":\n return new Types.DecFloatType({ qualifiedName: qualifiedName });\n case \"ANY\":\n return new Types.AnyType({ qualifiedName: qualifiedName });\n case \"SIMPLE\":\n return new Types.SimpleType({ qualifiedName: qualifiedName });\n case \"%_C_POINTER\":\n return new Types.HexType(8, qualifiedName);\n case \"TABLE\":\n return new Types.TableType(new Types.AnyType(), { withHeader: false, keyType: Types.TableKeyType.default });\n case \"DATA\":\n return new Types.AnyType({ qualifiedName: qualifiedName });\n case \"NUMERIC\":\n return new Types.NumericGenericType({ qualifiedName: qualifiedName });\n case \"UTCLONG\": // todo, take version into account\n return new Types.UTCLongType({ qualifiedName: qualifiedName });\n case \"DECFLOAT16\":\n return new Types.DecFloat16Type({ qualifiedName: qualifiedName });\n case \"DECFLOAT34\":\n return new Types.DecFloat34Type({ qualifiedName: qualifiedName });\n case \"CSEQUENCE\":\n return new Types.CSequenceType({ qualifiedName: qualifiedName });\n case \"I\":\n case \"INT8\": // todo, take version into account\n return new Types.IntegerType({ qualifiedName: qualifiedName || name });\n case \"F\":\n return new Types.FloatType({ qualifiedName: qualifiedName || name });\n case \"P\":\n if (length && decimals) {\n return new Types.PackedType(length, decimals, { qualifiedName: qualifiedName });\n }\n else if (length) {\n return new Types.PackedType(length, 0, { qualifiedName: qualifiedName });\n }\n else {\n return new Types.PackedType(1, 0, { qualifiedName: qualifiedName });\n }\n case \"C\":\n if (length) {\n return new Types.CharacterType(length, { qualifiedName: qualifiedName });\n }\n else {\n return new Types.CharacterType(1, { qualifiedName: qualifiedName });\n }\n case \"X\":\n if (length) {\n return new Types.HexType(length, qualifiedName);\n }\n else {\n return new Types.HexType(1, qualifiedName);\n }\n case \"N\":\n if (length) {\n return new Types.NumericType(length, qualifiedName);\n }\n else {\n return new Types.NumericType(1, qualifiedName);\n }\n }\n return undefined;\n }\n inErrorNamespace(name) {\n if (name === undefined) {\n return true;\n }\n return this.reg.inErrorNamespace(name);\n }\n lookupObject(name) {\n const clas = this.reg.getObject(\"CLAS\", name);\n const globalClas = clas === null || clas === void 0 ? void 0 : clas.getIdentifier();\n if (globalClas) {\n return { type: new basic_1.ObjectReferenceType(globalClas, name), object: clas };\n }\n const intf = this.reg.getObject(\"INTF\", name);\n const globalIntf = intf === null || intf === void 0 ? void 0 : intf.getIdentifier();\n if (globalIntf) {\n return { type: new basic_1.ObjectReferenceType(globalIntf, name), object: intf };\n }\n if (this.inErrorNamespace(name) === true) {\n return { type: new basic_1.UnknownType(name) };\n }\n else {\n return { type: new basic_1.VoidType(name) };\n }\n }\n lookupNoVoid(name) {\n const foundTABL = this.reg.getObject(\"TABL\", name);\n if (foundTABL) {\n return { type: foundTABL.parseType(this.reg), object: foundTABL };\n }\n const foundVIEW = this.reg.getObject(\"VIEW\", name);\n if (foundVIEW) {\n return { type: foundVIEW.parseType(this.reg), object: foundVIEW };\n }\n const foundTTYP = this.reg.getObject(\"TTYP\", name);\n if (foundTTYP) {\n return { type: foundTTYP.parseType(this.reg), object: foundTTYP };\n }\n const foundDTEL = this.reg.getObject(\"DTEL\", name);\n if (foundDTEL) {\n return { type: foundDTEL.parseType(this.reg), object: foundDTEL };\n }\n const foundDDLS = this.lookupDDLS(name);\n if (foundDDLS) {\n return foundDDLS;\n }\n return undefined;\n }\n lookupDDLS(name) {\n var _a;\n if (name === undefined) {\n return undefined;\n }\n const upper = name.toUpperCase();\n for (const obj of this.reg.getObjectsByType(\"DDLS\")) {\n const ddls = obj;\n if (ddls.getSQLViewName() === upper || ((_a = ddls.getDefinitionName()) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === upper) {\n return { type: ddls.parseType(this.reg), object: ddls };\n }\n }\n return undefined;\n }\n /** lookup with voiding and unknown types */\n lookup(name) {\n const found = this.lookupNoVoid(name);\n if (found) {\n return found;\n }\n if (this.reg.inErrorNamespace(name)) {\n return { type: new Types.UnknownType(name + \" not found, lookup\") };\n }\n else {\n return { type: new Types.VoidType(name) };\n }\n }\n lookupDomain(name, dataElement) {\n const found = this.reg.getObject(\"DOMA\", name);\n if (found) {\n return { type: found.parseType(this.reg, dataElement), object: found };\n }\n else if (this.reg.inErrorNamespace(name)) {\n return { type: new Types.UnknownType(name + \", lookupDomain\"), object: undefined };\n }\n else {\n return { type: new Types.VoidType(name), object: undefined };\n }\n }\n lookupDataElement(name) {\n if (name === undefined) {\n return { type: new Types.UnknownType(\"undefined, lookupDataElement\") };\n }\n const found = this.reg.getObject(\"DTEL\", name);\n if (found) {\n return { type: found.parseType(this.reg), object: found };\n }\n else if (this.reg.inErrorNamespace(name)) {\n return { type: new Types.UnknownType(name + \" not found, lookupDataElement\") };\n }\n else {\n return { type: new Types.VoidType(name) };\n }\n }\n lookupTableOrView(name) {\n if (name === undefined) {\n return { type: new Types.UnknownType(\"undefined, lookupTableOrView\") };\n }\n const foundTABL = this.reg.getObject(\"TABL\", name);\n if (foundTABL) {\n return { type: foundTABL.parseType(this.reg), object: foundTABL };\n }\n const foundDDLS = this.lookupDDLS(name);\n if (foundDDLS) {\n return foundDDLS;\n }\n return this.lookupView(name);\n }\n /** this method only looks up the object, does not parse the type */\n lookupTableOrView2(name) {\n if (name === undefined) {\n return undefined;\n }\n const foundTABL = this.reg.getObject(\"TABL\", name);\n if (foundTABL) {\n return foundTABL;\n }\n const foundVIEW = this.reg.getObject(\"VIEW\", name);\n if (foundVIEW) {\n return foundVIEW;\n }\n const foundDDLS = this.lookupDDLS(name);\n if (foundDDLS) {\n return foundDDLS.object;\n }\n return undefined;\n }\n lookupTable(name) {\n if (name === undefined) {\n return new Types.UnknownType(\"undefined, lookupTable\");\n }\n const found = this.reg.getObject(\"TABL\", name);\n if (found) {\n return found.parseType(this.reg);\n }\n else if (this.reg.inErrorNamespace(name)) {\n return new Types.UnknownType(name + \" not found, lookupTable\");\n }\n else {\n return new Types.VoidType(name);\n }\n }\n lookupView(name) {\n if (name === undefined) {\n return { type: new Types.UnknownType(\"undefined, lookupView\") };\n }\n const found = this.reg.getObject(\"VIEW\", name);\n if (found) {\n return { type: found.parseType(this.reg), object: found };\n }\n else if (this.reg.inErrorNamespace(name)) {\n return { type: new Types.UnknownType(name + \" not found, lookupView\") };\n }\n else {\n return { type: new Types.VoidType(name) };\n }\n }\n lookupTableType(name) {\n if (name === undefined) {\n return { type: new Types.UnknownType(\"undefined, lookupTableType\") };\n }\n const found = this.reg.getObject(\"TTYP\", name);\n if (found) {\n return { type: found.parseType(this.reg), object: found };\n }\n else if (this.reg.inErrorNamespace(name)) {\n return { type: new Types.UnknownType(name + \" not found, lookupTableType\") };\n }\n else {\n return { type: new Types.VoidType(name) };\n }\n }\n textToType(text, length, decimals, infoText, qualifiedName, conversionExit, ddicName) {\n // todo: support short strings, and length of different integers, NUMC vs CHAR, min/max length\n switch (text) {\n case \"DEC\": // 1 <= len <= 31\n case \"D16F\": // 1 <= len <= 31\n case \"D34F\": // 1 <= len <= 31\n case \"DF16_DEC\": // 1 <= len <= 31\n case \"DF34_DEC\": // 1 <= len <= 31\n case \"CURR\": // 1 <= len <= 31\n case \"QUAN\": // 1 <= len <= 31\n if (length === undefined) {\n return new Types.UnknownType(text + \" unknown length, \" + infoText, infoText);\n }\n else if (decimals === undefined) {\n return new Types.PackedType(parseInt(length, 10), 0, { qualifiedName, conversionExit, ddicName });\n }\n return new Types.PackedType(parseInt(length, 10), parseInt(decimals, 10), { qualifiedName, conversionExit, ddicName });\n case \"ACCP\":\n return new Types.CharacterType(6, { qualifiedName, conversionExit, ddicName }); // YYYYMM\n case \"LANG\":\n return new Types.CharacterType(1, { qualifiedName, conversionExit, ddicName });\n case \"CLNT\":\n return new Types.CharacterType(3, { qualifiedName, conversionExit, ddicName });\n case \"CUKY\":\n return new Types.CharacterType(5, { qualifiedName, conversionExit, ddicName });\n case \"UNIT\": // 2 <= len <= 3\n return new Types.CharacterType(3, { qualifiedName, conversionExit, ddicName });\n case \"UTCLONG\":\n return new Types.CharacterType(27, { qualifiedName, conversionExit, ddicName });\n case \"NUMC\": // 1 <= len <= 255\n if (length === undefined) {\n return new Types.UnknownType(text + \" unknown length\", infoText);\n }\n return new Types.NumericType(parseInt(length, 10), qualifiedName);\n case \"CHAR\": // 1 <= len <= 30000 (1333 for table fields)\n case \"LCHR\": // 256 <= len <= 32000\n if (length === undefined) {\n return new Types.UnknownType(text + \" unknown length\", infoText);\n }\n return new Types.CharacterType(parseInt(length, 10), { qualifiedName, conversionExit, ddicName });\n case \"RAW\": // 1 <= len <= 32000\n case \"LRAW\": // 256 <= len <= 32000\n if (length === undefined) {\n return new Types.UnknownType(text + \" unknown length\", infoText);\n }\n return new Types.HexType(parseInt(length, 10), qualifiedName);\n case \"TIMN\": // Native HANA\n case \"TIMS\":\n return new Types.TimeType({ qualifiedName: qualifiedName }); //HHMMSS\n case \"DECFLOAT16\": // len = 16\n case \"DECFLOAT34\": // len = 34\n case \"D16R\": // len = 16\n case \"D34R\": // len = 34\n case \"DF16_RAW\": // len = 16\n case \"DF34_RAW\": // len = 34\n case \"FLTP\": // len = 16\n if (length === undefined) {\n return new Types.UnknownType(text + \" unknown length\", infoText);\n }\n return new Types.FloatingPointType(parseInt(length, 10), qualifiedName);\n case \"DATN\": // Native HANA\n case \"DATS\":\n return new Types.DateType({ qualifiedName: qualifiedName }); //YYYYMMDD\n case \"INT1\":\n case \"INT2\":\n case \"INT4\":\n case \"INT8\":\n return new Types.IntegerType({ qualifiedName: qualifiedName });\n case \"SSTR\": // 1 <= len <= 1333\n case \"SSTRING\": // 1 <= len <= 1333\n case \"STRG\": // 256 <= len\n case \"STRING\": // 256 <= len\n return new Types.StringType({ qualifiedName: qualifiedName });\n case \"RSTR\": // 256 <= len\n case \"RAWSTRING\": // 256 <= len\n case \"GEOM_EWKB\":\n return new Types.XStringType({ qualifiedName: qualifiedName });\n case \"D16S\":\n case \"D34S\":\n case \"DF16_SCL\":\n case \"DF34_SCL\":\n case \"PREC\":\n case \"VARC\":\n return new Types.UnknownType(text + \" is an obsolete data type\", infoText);\n default:\n return new Types.UnknownType(text + \" unknown\", infoText);\n }\n }\n}\nexports.DDIC = DDIC;\n//# sourceMappingURL=ddic.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/ddic.js?");
|
|
10030
10030
|
|
|
10031
10031
|
/***/ }),
|
|
10032
10032
|
|
|
@@ -11632,7 +11632,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
11632
11632
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11633
11633
|
|
|
11634
11634
|
"use strict";
|
|
11635
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.TableType = void 0;\nconst _abstract_object_1 = __webpack_require__(/*! ./_abstract_object */ \"./node_modules/@abaplint/core/build/src/objects/_abstract_object.js\");\nconst Types = __webpack_require__(/*! ../abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\nconst basic_1 = __webpack_require__(/*! ../abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nconst xml_utils_1 = __webpack_require__(/*! ../xml_utils */ \"./node_modules/@abaplint/core/build/src/xml_utils.js\");\nclass TableType extends _abstract_object_1.AbstractObject {\n constructor() {\n super(...arguments);\n this.parsedXML = undefined;\n }\n getType() {\n return \"TTYP\";\n }\n getAllowedNaming() {\n return {\n maxLength: 30,\n allowNamespace: true,\n };\n }\n getDescription() {\n // todo\n return undefined;\n }\n setDirty() {\n this.parsedXML = undefined;\n super.setDirty();\n }\n buildTableOptions() {\n var _a, _b, _c;\n const tableOptions = {\n withHeader: false,\n secondary: [],\n };\n for (const k of ((_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.dd43v) || []) {\n const fields = [];\n for (const f of ((_b = this.parsedXML) === null || _b === void 0 ? void 0 : _b.dd42v) || []) {\n if (f.keyname === k.keyname) {\n fields.push(f.keyfield);\n }\n }\n let accessType = basic_1.TableAccessType.standard;\n switch (k.accessmode) {\n case \"S\":\n accessType = basic_1.TableAccessType.sorted;\n break;\n case \"H\":\n accessType = basic_1.TableAccessType.hashed;\n break;\n default:\n break;\n }\n (_c = tableOptions.secondary) === null || _c === void 0 ? void 0 : _c.push({\n name: k.keyname,\n type: accessType,\n keyFields: fields,\n isUnique: k.unique,\n });\n }\n return tableOptions;\n }\n parseType(reg) {\n this.parseXML();\n const ddic = new ddic_1.DDIC(reg);\n const references = [];\n let type;\n const tableOptions = this.buildTableOptions();\n if (this.parsedXML === undefined) {\n type = new Types.UnknownType(\"Table Type, parser error\", this.getName());\n }\n else if (this.parsedXML.rowkind === \"S\") {\n const lookup = ddic.lookupTableOrView(this.parsedXML.rowtype);\n type = new Types.TableType(lookup.type, tableOptions, this.getName());\n if (lookup.object) {\n references.push({ object: lookup.object });\n }\n }\n else if (this.parsedXML.rowkind === \"E\") {\n const lookup = ddic.lookupDataElement(this.parsedXML.rowtype);\n type = new Types.TableType(lookup.type, tableOptions, this.getName());\n if (lookup.object) {\n references.push({ object: lookup.object });\n }\n }\n else if (this.parsedXML.rowkind === \"L\") {\n const lookup = ddic.lookupTableType(this.parsedXML.rowtype);\n type = new Types.TableType(lookup.type, tableOptions, this.getName());\n if (lookup.object) {\n references.push({ object: lookup.object });\n }\n }\n else if (this.parsedXML.rowkind === \"R\" && this.parsedXML.rowtype === \"OBJECT\") {\n type = new Types.TableType(new basic_1.GenericObjectReferenceType(), tableOptions, this.getName());\n }\n else if (this.parsedXML.rowkind === \"R\" && this.parsedXML.rowtype === \"DATA\") {\n type = new Types.TableType(new basic_1.DataReference(new basic_1.AnyType()), tableOptions, this.getName());\n }\n else if (this.parsedXML.rowkind === \"R\" && this.parsedXML.rowtype !== undefined) {\n const lookup = ddic.lookupObject(this.parsedXML.rowtype);\n type = new Types.TableType(lookup.type, tableOptions, this.getName());\n if (lookup.object) {\n references.push({ object: lookup.object });\n }\n }\n else if (this.parsedXML.rowkind === \"\") {\n if (this.parsedXML.datatype === undefined) {\n type = new Types.UnknownType(\"Table Type, empty DATATYPE\" + this.getName(), this.getName());\n }\n else {\n const row = ddic.textToType(this.parsedXML.datatype, this.parsedXML.leng, this.parsedXML.decimals, this.getName());\n type = new Types.TableType(row, tableOptions, this.getName());\n }\n }\n else {\n type = new Types.UnknownType(\"Table Type, unknown kind \\\"\" + this.parsedXML.rowkind + \"\\\"\" + this.getName(), this.getName());\n }\n reg.getDDICReferences().setUsing(this, references);\n return type;\n }\n ////////////////////\n parseXML() {\n var _a, _b;\n if (this.parsedXML !== undefined) {\n return;\n }\n this.parsedXML = {\n dd42v: [],\n dd43v: [],\n };\n const parsed = super.parseRaw2();\n if (parsed === undefined || parsed.abapGit === undefined) {\n return;\n }\n const values = parsed.abapGit[\"asx:abap\"][\"asx:values\"];\n const dd40v = values.DD40V;\n this.parsedXML.rowtype = dd40v.ROWTYPE ? dd40v.ROWTYPE : \"\";\n this.parsedXML.rowkind = dd40v.ROWKIND ? dd40v.ROWKIND : \"\";\n this.parsedXML.datatype = dd40v.DATATYPE;\n this.parsedXML.leng = dd40v.LENG;\n this.parsedXML.decimals = dd40v.DECIMALS;\n for (const x of (0, xml_utils_1.xmlToArray)((_a = values.DD42V) === null || _a === void 0 ? void 0 : _a.DD42V)) {\n this.parsedXML.dd42v.push({\n keyname: x.SECKEYNAME || \"\",\n keyfield: x.KEYFIELD || \"\",\n });\n }\n for (const x of (0, xml_utils_1.xmlToArray)((_b = values.DD43V) === null || _b === void 0 ? void 0 : _b.DD43V)) {\n this.parsedXML.dd43v.push({\n keyname: x.SECKEYNAME || \"\",\n accessmode: x.ACCESSMODE || \"\",\n kind: x.KIND || \"\",\n unique: x.SECKEYUNIQUE === \"X\",\n });\n }\n }\n}\nexports.TableType = TableType;\n//# sourceMappingURL=table_type.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/objects/table_type.js?");
|
|
11635
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.TableType = void 0;\nconst _abstract_object_1 = __webpack_require__(/*! ./_abstract_object */ \"./node_modules/@abaplint/core/build/src/objects/_abstract_object.js\");\nconst Types = __webpack_require__(/*! ../abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\nconst basic_1 = __webpack_require__(/*! ../abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nconst xml_utils_1 = __webpack_require__(/*! ../xml_utils */ \"./node_modules/@abaplint/core/build/src/xml_utils.js\");\nclass TableType extends _abstract_object_1.AbstractObject {\n constructor() {\n super(...arguments);\n this.parsedXML = undefined;\n }\n getType() {\n return \"TTYP\";\n }\n getAllowedNaming() {\n return {\n maxLength: 30,\n allowNamespace: true,\n };\n }\n getDescription() {\n // todo\n return undefined;\n }\n setDirty() {\n this.parsedXML = undefined;\n super.setDirty();\n }\n buildTableOptions() {\n var _a, _b, _c;\n const tableOptions = {\n withHeader: false,\n keyType: Types.TableKeyType.user,\n secondary: [],\n };\n for (const k of ((_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.dd43v) || []) {\n const fields = [];\n for (const f of ((_b = this.parsedXML) === null || _b === void 0 ? void 0 : _b.dd42v) || []) {\n if (f.keyname === k.keyname) {\n fields.push(f.keyfield);\n }\n }\n let accessType = basic_1.TableAccessType.standard;\n switch (k.accessmode) {\n case \"S\":\n accessType = basic_1.TableAccessType.sorted;\n break;\n case \"H\":\n accessType = basic_1.TableAccessType.hashed;\n break;\n default:\n break;\n }\n (_c = tableOptions.secondary) === null || _c === void 0 ? void 0 : _c.push({\n name: k.keyname,\n type: accessType,\n keyFields: fields,\n isUnique: k.unique,\n });\n }\n return tableOptions;\n }\n parseType(reg) {\n this.parseXML();\n const ddic = new ddic_1.DDIC(reg);\n const references = [];\n let type;\n const tableOptions = this.buildTableOptions();\n if (this.parsedXML === undefined) {\n type = new Types.UnknownType(\"Table Type, parser error\", this.getName());\n }\n else if (this.parsedXML.rowkind === \"S\") {\n const lookup = ddic.lookupTableOrView(this.parsedXML.rowtype);\n type = new Types.TableType(lookup.type, tableOptions, this.getName());\n if (lookup.object) {\n references.push({ object: lookup.object });\n }\n }\n else if (this.parsedXML.rowkind === \"E\") {\n const lookup = ddic.lookupDataElement(this.parsedXML.rowtype);\n type = new Types.TableType(lookup.type, tableOptions, this.getName());\n if (lookup.object) {\n references.push({ object: lookup.object });\n }\n }\n else if (this.parsedXML.rowkind === \"L\") {\n const lookup = ddic.lookupTableType(this.parsedXML.rowtype);\n type = new Types.TableType(lookup.type, tableOptions, this.getName());\n if (lookup.object) {\n references.push({ object: lookup.object });\n }\n }\n else if (this.parsedXML.rowkind === \"R\" && this.parsedXML.rowtype === \"OBJECT\") {\n type = new Types.TableType(new basic_1.GenericObjectReferenceType(), tableOptions, this.getName());\n }\n else if (this.parsedXML.rowkind === \"R\" && this.parsedXML.rowtype === \"DATA\") {\n type = new Types.TableType(new basic_1.DataReference(new basic_1.AnyType()), tableOptions, this.getName());\n }\n else if (this.parsedXML.rowkind === \"R\" && this.parsedXML.rowtype !== undefined) {\n const lookup = ddic.lookupObject(this.parsedXML.rowtype);\n type = new Types.TableType(lookup.type, tableOptions, this.getName());\n if (lookup.object) {\n references.push({ object: lookup.object });\n }\n }\n else if (this.parsedXML.rowkind === \"\") {\n if (this.parsedXML.datatype === undefined) {\n type = new Types.UnknownType(\"Table Type, empty DATATYPE\" + this.getName(), this.getName());\n }\n else {\n const row = ddic.textToType(this.parsedXML.datatype, this.parsedXML.leng, this.parsedXML.decimals, this.getName());\n type = new Types.TableType(row, tableOptions, this.getName());\n }\n }\n else {\n type = new Types.UnknownType(\"Table Type, unknown kind \\\"\" + this.parsedXML.rowkind + \"\\\"\" + this.getName(), this.getName());\n }\n reg.getDDICReferences().setUsing(this, references);\n return type;\n }\n ////////////////////\n parseXML() {\n var _a, _b;\n if (this.parsedXML !== undefined) {\n return;\n }\n this.parsedXML = {\n dd42v: [],\n dd43v: [],\n };\n const parsed = super.parseRaw2();\n if (parsed === undefined || parsed.abapGit === undefined) {\n return;\n }\n const values = parsed.abapGit[\"asx:abap\"][\"asx:values\"];\n const dd40v = values.DD40V;\n this.parsedXML.rowtype = dd40v.ROWTYPE ? dd40v.ROWTYPE : \"\";\n this.parsedXML.rowkind = dd40v.ROWKIND ? dd40v.ROWKIND : \"\";\n this.parsedXML.datatype = dd40v.DATATYPE;\n this.parsedXML.leng = dd40v.LENG;\n this.parsedXML.decimals = dd40v.DECIMALS;\n for (const x of (0, xml_utils_1.xmlToArray)((_a = values.DD42V) === null || _a === void 0 ? void 0 : _a.DD42V)) {\n this.parsedXML.dd42v.push({\n keyname: x.SECKEYNAME || \"\",\n keyfield: x.KEYFIELD || \"\",\n });\n }\n for (const x of (0, xml_utils_1.xmlToArray)((_b = values.DD43V) === null || _b === void 0 ? void 0 : _b.DD43V)) {\n this.parsedXML.dd43v.push({\n keyname: x.SECKEYNAME || \"\",\n accessmode: x.ACCESSMODE || \"\",\n kind: x.KIND || \"\",\n unique: x.SECKEYUNIQUE === \"X\",\n });\n }\n }\n}\nexports.TableType = TableType;\n//# sourceMappingURL=table_type.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/objects/table_type.js?");
|
|
11636
11636
|
|
|
11637
11637
|
/***/ }),
|
|
11638
11638
|
|
|
@@ -11841,7 +11841,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
11841
11841
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11842
11842
|
|
|
11843
11843
|
"use strict";
|
|
11844
|
-
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.96.2\";\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?");
|
|
11844
|
+
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.97.2\";\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?");
|
|
11845
11845
|
|
|
11846
11846
|
/***/ }),
|
|
11847
11847
|
|
|
@@ -12204,7 +12204,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
12204
12204
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12205
12205
|
|
|
12206
12206
|
"use strict";
|
|
12207
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.ConstantClasses = exports.ConstantClassesConf = void 0;\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\nconst __1 = __webpack_require__(/*! .. */ \"./node_modules/@abaplint/core/build/src/index.js\");\n/** Checks that constants classes are in sync with domain fixed values */\nclass ConstantClassesConf extends _basic_rule_config_1.BasicRuleConfig {\n constructor() {\n super(...arguments);\n /** Specify a list of domain-class pairs which will be validated */\n this.mapping = [];\n }\n}\nexports.ConstantClassesConf = ConstantClassesConf;\nclass ConstantClasses {\n constructor() {\n this.conf = new ConstantClassesConf();\n }\n getMetadata() {\n return {\n key: \"constant_classes\",\n title: \"Validate constant classes\",\n shortDescription: `Checks that a class contains exactly the constants corresponding to a domain's fixed values.`,\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-enumeration-classes-to-constants-interfaces`,\n tags: [_irule_1.RuleTag.Styleguide
|
|
12207
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.ConstantClasses = exports.ConstantClassesConf = void 0;\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\nconst __1 = __webpack_require__(/*! .. */ \"./node_modules/@abaplint/core/build/src/index.js\");\n/** Checks that constants classes are in sync with domain fixed values */\nclass ConstantClassesConf extends _basic_rule_config_1.BasicRuleConfig {\n constructor() {\n super(...arguments);\n /** Specify a list of domain-class pairs which will be validated */\n this.mapping = [];\n }\n}\nexports.ConstantClassesConf = ConstantClassesConf;\nclass ConstantClasses {\n constructor() {\n this.conf = new ConstantClassesConf();\n }\n getMetadata() {\n return {\n key: \"constant_classes\",\n title: \"Validate constant classes\",\n shortDescription: `Checks that a class contains exactly the constants corresponding to a domain's fixed values.`,\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-enumeration-classes-to-constants-interfaces`,\n tags: [_irule_1.RuleTag.Styleguide],\n };\n }\n initialize(reg) {\n this.reg = reg;\n return this;\n }\n getConfig() {\n return this.conf;\n }\n setConfig(conf) {\n this.conf = conf;\n }\n run(obj) {\n if (this.conf\n && this.conf.mapping\n && obj instanceof __1.Objects.Domain) {\n const configEntry = this.conf.mapping.find(x => x.domain.toUpperCase() === obj.getName().toUpperCase());\n if (!configEntry) {\n return [];\n }\n const classWithConstants = this.reg.getObject(\"CLAS\", configEntry === null || configEntry === void 0 ? void 0 : configEntry.class.toUpperCase());\n if (!classWithConstants) {\n return [issue_1.Issue.atIdentifier(obj.getIdentifier(), `Constant class pattern implementation ${configEntry.class} missing for domain ${configEntry.domain}`, this.getMetadata().key, this.conf.severity)];\n // quickfix will implement the whole class\n }\n const classContents = classWithConstants.getMainABAPFile();\n if (classContents === undefined) {\n return [];\n }\n const def = classWithConstants.getClassDefinition();\n if (!def) {\n // this issue is checked by rule implement_methods.\n // we will not issue errors that all constants are missing until there is a class implementation\n return [];\n }\n const domainValueInfo = obj.getFixedValues();\n const domainValues = domainValueInfo.map(x => x.low);\n const issues = [];\n if (obj.getFixedValues().length === 0) {\n // possibly this is not even a domain with fixed values\n issues.push(issue_1.Issue.atStatement(classContents, classContents.getStatements()[0], `Domain ${configEntry.domain} does not contain any fixed values. Either add some values or disable this check`, this.getMetadata().key, this.conf.severity));\n }\n // later we will raise an issue if we did not find it\n let domainNameConstantFound = false;\n for (const constant of def.constants) {\n if (configEntry.constantForDomainName\n && constant.name === configEntry.constantForDomainName) {\n // we require the constant value to be uppercase just in case\n // in the config it does not matter\n if (constant.value !== configEntry.domain.toLocaleUpperCase()) {\n issues.push(this.issueAtConstant(constant, `Constant value ${constant.value} must match domain name ${configEntry.domain} `));\n }\n domainNameConstantFound = true;\n continue;\n }\n if (configEntry.useExactType && constant.typeName.toLowerCase() !== configEntry.domain.toLowerCase()) {\n issues.push(this.issueAtConstant(constant, `Use exact type ${configEntry.domain} instead of ${constant.typeName}`));\n // quickfix will change the type\n }\n if (constant.visibility !== __1.Visibility.Public) {\n issues.push(this.issueAtConstant(constant, `Constant ${constant.name} should be public`));\n // quickfix will move constant\n }\n if (!domainValues.includes(constant.value)) {\n issues.push(this.issueAtConstant(constant, `Extra constant ${constant.name} found which is not present in domain ${configEntry.domain}`));\n // quickfix will remove constant\n }\n }\n for (const d of domainValueInfo) {\n if (!def.constants.find(c => c.value === d.low)) {\n issues.push(issue_1.Issue.atStatement(classContents, classContents.getStatements()[0], `Missing constant for ${d.low} (domain ${configEntry.domain})`, this.getMetadata().key, this.conf.severity));\n // quickfix will add constant\n }\n }\n if (configEntry.constantForDomainName && !domainNameConstantFound) {\n issues.push(issue_1.Issue.atStatement(classContents, classContents.getStatements()[0], `Missing constant ${configEntry.constantForDomainName} for name of domain ${configEntry.domain}`, this.getMetadata().key, this.conf.severity));\n }\n return issues;\n }\n return [];\n }\n issueAtConstant(constant, message) {\n return issue_1.Issue.atIdentifier(constant.identifier, message, this.getMetadata().key, this.conf.severity);\n }\n}\nexports.ConstantClasses = ConstantClasses;\n//# sourceMappingURL=constant_classes.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/constant_classes.js?");
|
|
12208
12208
|
|
|
12209
12209
|
/***/ }),
|
|
12210
12210
|
|
|
@@ -12314,7 +12314,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
12314
12314
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12315
12315
|
|
|
12316
12316
|
"use strict";
|
|
12317
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Downport = exports.DownportConf = void 0;\n/* eslint-disable max-len */\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\nconst Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\nconst registry_1 = __webpack_require__(/*! ../registry */ \"./node_modules/@abaplint/core/build/src/registry.js\");\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\nconst _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\nconst basic_1 = __webpack_require__(/*! ../abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nconst config_1 = __webpack_require__(/*! ../config */ \"./node_modules/@abaplint/core/build/src/config.js\");\nconst tokens_1 = __webpack_require__(/*! ../abap/1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\nconst include_graph_1 = __webpack_require__(/*! ../utils/include_graph */ \"./node_modules/@abaplint/core/build/src/utils/include_graph.js\");\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\nconst _builtin_1 = __webpack_require__(/*! ../abap/5_syntax/_builtin */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_builtin.js\");\nconst _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\nconst statements_1 = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\n// todo: refactor each sub-rule to new classes?\n// todo: add configuration\nclass DownportConf extends _basic_rule_config_1.BasicRuleConfig {\n}\nexports.DownportConf = DownportConf;\nclass SkipToNextFile extends Error {\n constructor(issue) {\n super();\n this.issue = issue;\n }\n}\nclass SpagHelper {\n constructor(spag) {\n this.spag = spag;\n }\n renameVariable(oldName, pos, lowFile, newName) {\n let fix = undefined;\n const references = this.findReferences(oldName, pos);\n references.sort((a, b) => {\n if (a.start.equals(b.start)) {\n return 0;\n }\n return a.start.isAfter(b.start) ? 1 : -1;\n });\n for (const r of references) {\n const replace = edit_helper_1.EditHelper.replaceRange(lowFile, r.start, r.end, newName);\n if (fix === undefined) {\n fix = replace;\n }\n else {\n fix = edit_helper_1.EditHelper.merge(replace, fix);\n }\n }\n return fix;\n }\n findReferences(name, pos) {\n var _a, _b;\n const positions = [];\n function has(element) {\n return positions.some(a => a.start.equals(element.start));\n }\n for (const r of this.spag.getData().references) {\n if (((_a = r.resolved) === null || _a === void 0 ? void 0 : _a.getName()) === name && ((_b = r.resolved) === null || _b === void 0 ? void 0 : _b.getStart().equals(pos))) {\n const sub = {\n start: r.position.getStart(),\n end: r.position.getEnd(),\n };\n if (has(sub) === false) {\n positions.push(sub);\n }\n }\n }\n for (const child of this.spag.getChildren()) {\n const subPositions = new SpagHelper(child).findReferences(name, pos);\n for (const sub of subPositions) {\n if (has(sub) === false) {\n positions.push(sub);\n }\n }\n }\n return positions;\n }\n findRecursiveDuplicate(name, skip) {\n var _a;\n const found = this.spag.findVariable(name);\n if ((found === null || found === void 0 ? void 0 : found.getStart().equals(skip)) === false) {\n return found;\n }\n for (const child of ((_a = this.spag) === null || _a === void 0 ? void 0 : _a.getChildren()) || []) {\n const sub = new SpagHelper(child).findRecursiveDuplicate(name, skip);\n if (sub) {\n return sub;\n }\n }\n return undefined;\n }\n isDuplicateName(name, pos) {\n let parent = this.spag.getParent();\n while ((parent === null || parent === void 0 ? void 0 : parent.getIdentifier().stype) === _scope_type_1.ScopeType.Let\n || (parent === null || parent === void 0 ? void 0 : parent.getIdentifier().stype) === _scope_type_1.ScopeType.For) {\n parent = parent.getParent();\n }\n if (parent === undefined) {\n return undefined;\n }\n return new SpagHelper(parent).findRecursiveDuplicate(name, pos) !== undefined;\n }\n}\nclass Downport {\n constructor() {\n this.conf = new DownportConf();\n }\n getMetadata() {\n return {\n key: \"downport\",\n title: \"Downport statement\",\n shortDescription: `Experimental downport functionality`,\n extendedInformation: `Much like the 'commented_code' rule this rule loops through unknown statements and tries parsing with\r\na higher level language version. If successful, various rules are applied to downport the statement.\r\nTarget downport version is always v702, thus rule is only enabled if target version is v702.\r\n\r\nCurrent rules:\r\n* NEW transformed to CREATE OBJECT, opposite of https://rules.abaplint.org/use_new/\r\n* DATA() definitions are outlined, opposite of https://rules.abaplint.org/prefer_inline/\r\n* FIELD-SYMBOL() definitions are outlined\r\n* CONV is outlined\r\n* COND is outlined\r\n* REDUCE is outlined\r\n* SWITCH is outlined\r\n* FILTER is outlined\r\n* APPEND expression is outlined\r\n* INSERT expression is outlined\r\n* EMPTY KEY is changed to DEFAULT KEY, opposite of DEFAULT KEY in https://rules.abaplint.org/avoid_use/\r\n* CAST changed to ?=\r\n* LOOP AT method_call( ) is outlined\r\n* VALUE # with structure fields\r\n* VALUE # with internal table lines\r\n* Table Expressions are outlined\r\n* SELECT INTO @DATA definitions are outlined\r\n* Some occurrences of string template formatting option ALPHA changed to function module call\r\n* SELECT/INSERT/MODIFY/DELETE/UPDATE \",\" in field list removed, \"@\" in source/targets removed\r\n* PARTIALLY IMPLEMENTED removed, it can be quick fixed via rule implement_methods\r\n* RAISE EXCEPTION ... MESSAGE\r\n* Moving with +=, -=, /=, *=, &&= is expanded\r\n* line_exists and line_index is downported to READ TABLE\r\n* ENUMs, but does not nessesarily give the correct type and value\r\n* MESSAGE with non simple source\r\n\r\nOnly one transformation is applied to a statement at a time, so multiple steps might be required to do the full downport.`,\n tags: [_irule_1.RuleTag.Experimental, _irule_1.RuleTag.Downport, _irule_1.RuleTag.Quickfix],\n };\n }\n getConfig() {\n return this.conf;\n }\n setConfig(conf) {\n this.conf = conf;\n }\n initialize(reg) {\n this.lowReg = reg;\n const version = this.lowReg.getConfig().getVersion();\n if (version === version_1.Version.v702 || version === version_1.Version.OpenABAP) {\n this.initHighReg();\n }\n return this;\n }\n listMainForInclude(filename) {\n if (filename === undefined) {\n return [];\n }\n // only initialize this.graph if needed\n if (this.graph === undefined) {\n this.graph = new include_graph_1.IncludeGraph(this.lowReg);\n }\n return this.graph.listMainForInclude(filename);\n }\n containsError(highObj) {\n for (const file of highObj.getABAPFiles()) {\n for (const statement of file.getStatements()) {\n if (statement.get() instanceof _statement_1.Unknown) {\n return true; // contains parser errors\n }\n }\n if (file.getStructure() === undefined) {\n return true;\n }\n }\n return false;\n }\n run(lowObj) {\n var _a;\n const ret = [];\n this.counter = 1;\n const version = this.lowReg.getConfig().getVersion();\n if (version !== version_1.Version.v702 && version !== version_1.Version.OpenABAP) {\n return ret;\n }\n else if (!(lowObj instanceof _abap_object_1.ABAPObject)) {\n return ret;\n }\n const highObj = this.highReg.getObject(lowObj.getType(), lowObj.getName());\n if (highObj === undefined || !(highObj instanceof _abap_object_1.ABAPObject)) {\n return ret;\n }\n let highSyntaxObj = highObj;\n if (this.containsError(highObj)) {\n return ret;\n }\n // for includes do the syntax check via a main program\n if (lowObj instanceof objects_1.Program && lowObj.isInclude()) {\n const mains = this.listMainForInclude((_a = lowObj.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getFilename());\n if (mains.length <= 0) {\n return [];\n }\n const f = this.highReg.getFileByName(mains[0]);\n if (f === undefined) {\n return [];\n }\n highSyntaxObj = this.highReg.findObjectForFile(f);\n }\n for (const lowFile of lowObj.getABAPFiles()) {\n let highSyntax = undefined;\n const highFile = highObj.getABAPFileByName(lowFile.getFilename());\n if (highFile === undefined) {\n continue;\n }\n const lowStatements = lowFile.getStatements();\n const highStatements = highFile.getStatements();\n if (lowStatements.length !== highStatements.length) {\n // after applying a fix, there might be more statements in lowFile\n // should highReg be initialized again?\n /*\n const message = \"Internal Error: Statement lengths does not match\";\n ret.push(Issue.atStatement(lowFile, lowStatements[0], message, this.getMetadata().key));\n */\n // hmm, add some way to disable lazyUnknown() in statement_parser.ts\n // alternatively explicit enable it in vscode, its only relevant when a user is\n // actively editing the files\n continue;\n }\n if (highSyntax === undefined) {\n highSyntax = new syntax_1.SyntaxLogic(this.highReg, highSyntaxObj).run();\n }\n let containsUnknown = false;\n for (let i = 0; i < lowStatements.length; i++) {\n const low = lowStatements[i];\n const high = highStatements[i];\n if ((low.get() instanceof _statement_1.Unknown && !(high.get() instanceof _statement_1.Unknown))\n || high.findFirstExpression(Expressions.InlineData)) {\n containsUnknown = true;\n try {\n const issue = this.checkStatement(low, high, lowFile, highSyntax, highFile);\n if (issue) {\n ret.push(issue);\n }\n }\n catch (e) {\n if (e instanceof SkipToNextFile) {\n ret.push(e.issue);\n break;\n }\n else {\n throw e;\n }\n }\n }\n }\n if (ret.length === 0 && containsUnknown) {\n // this is a hack in order not to change too many unit tests\n for (let i = 0; i < lowStatements.length; i++) {\n const high = highStatements[i];\n if (high.get() instanceof Statements.Data) {\n const issue = this.anonymousTableType(high, lowFile, highSyntax);\n if (issue) {\n ret.push(issue);\n }\n }\n }\n }\n else if (ret.length === 0 && / xsdbool\\(/i.test(lowFile.getRaw())) {\n for (let i = 0; i < lowStatements.length; i++) {\n const high = highStatements[i];\n const issue = this.replaceXsdBool(high, lowFile, highSyntax);\n if (issue) {\n ret.push(issue);\n break;\n }\n }\n }\n }\n return ret;\n }\n ////////////////////\n /** clones the orginal repository into highReg, and parses it with higher language version */\n initHighReg() {\n // use default configuration, ie. default target version\n const highConfig = config_1.Config.getDefault().get();\n const lowConfig = this.lowReg.getConfig().get();\n highConfig.syntax.errorNamespace = lowConfig.syntax.errorNamespace;\n highConfig.syntax.globalConstants = lowConfig.syntax.globalConstants;\n highConfig.syntax.globalMacros = lowConfig.syntax.globalMacros;\n this.highReg = new registry_1.Registry();\n for (const o of this.lowReg.getObjects()) {\n for (const f of o.getFiles()) {\n if (this.lowReg.isDependency(o) === true) {\n this.highReg.addDependency(f);\n }\n else {\n this.highReg.addFile(f);\n }\n }\n }\n this.highReg.parse();\n }\n /** applies one rule at a time, multiple iterations are required to transform complex statements */\n checkStatement(low, high, lowFile, highSyntax, highFile) {\n if (low.getFirstToken().getStart() instanceof position_1.VirtualPosition) {\n return undefined;\n }\n // downport XSDBOOL() early, as it is valid 702 syntax\n let found = this.replaceXsdBool(high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.downportEnum(low, high, lowFile, highSyntax, highFile);\n if (found) {\n return found;\n }\n found = this.partiallyImplemented(high, lowFile);\n if (found) {\n return found;\n }\n found = this.raiseException(high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.emptyKey(low, high, lowFile);\n if (found) {\n return found;\n }\n found = this.stringTemplateAlpha(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.moveWithOperator(low, high, lowFile);\n if (found) {\n return found;\n }\n found = this.moveWithSimpleValue(low, high, lowFile);\n if (found) {\n return found;\n }\n found = this.assignWithTable(low, high, lowFile);\n if (found) {\n return found;\n }\n found = this.downportRefSimple(high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.downportCorrespondingSimple(high, lowFile);\n if (found) {\n return found;\n }\n found = this.downportRef(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.downportLoopGroup(high, lowFile, highSyntax, highFile);\n if (found) {\n return found;\n }\n found = this.callFunctionParameterSimple(high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.moveWithTableTarget(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.downportSelectInline(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.downportSQLExtras(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.outlineLoopInput(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.outlineLoopTarget(high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n let skipValue = false;\n let skipReduce = false;\n const valueBody = high.findFirstExpression(Expressions.ValueBody);\n const reduceBody = high.findFirstExpression(Expressions.ReduceBody);\n if (valueBody && reduceBody) {\n const valueToken = valueBody.getFirstToken();\n const reduceToken = reduceBody.getFirstToken();\n if (valueToken.getStart().isBefore(reduceToken.getStart())) {\n skipReduce = true;\n }\n else {\n skipValue = true;\n }\n }\n if (skipValue !== true) {\n found = this.outlineValue(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n }\n if (skipReduce !== true) {\n found = this.outlineReduce(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n }\n found = this.outlineSwitch(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.outlineFilter(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.outlineCast(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.outlineConv(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.outlineCond(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.outlineCatchSimple(high, lowFile);\n if (found) {\n return found;\n }\n found = this.outlineGetReferenceSimple(high, lowFile);\n if (found) {\n return found;\n }\n found = this.outlineDataSimple(high, lowFile);\n if (found) {\n return found;\n }\n found = this.outlineData(high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.outlineFS(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.newToCreateObject(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.replaceLineFunctions(high, lowFile, highSyntax, highFile);\n if (found) {\n return found;\n }\n found = this.getReference(high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.replaceContains(high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.replaceMethodConditional(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.replaceTableExpression(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.replaceAppendExpression(high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.replaceInsertExpression(high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.downportMessage(high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n return undefined;\n }\n //////////////////////////////////////////\n downportSQLExtras(low, high, lowFile, highSyntax) {\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n if (!(high.get() instanceof Statements.Select)\n && !(high.get() instanceof Statements.SelectLoop)\n && !(high.get() instanceof Statements.UpdateDatabase)\n && !(high.get() instanceof Statements.ModifyDatabase)\n && !(high.get() instanceof Statements.DeleteDatabase)\n && !(high.get() instanceof Statements.InsertDatabase)) {\n return undefined;\n }\n let fix = undefined;\n const addFix = (token) => {\n const add = edit_helper_1.EditHelper.deleteToken(lowFile, token);\n if (fix === undefined) {\n fix = add;\n }\n else {\n fix = edit_helper_1.EditHelper.merge(fix, add);\n }\n };\n const candidates = [high.findAllExpressionsRecursive(Expressions.SQLTarget),\n high.findAllExpressionsRecursive(Expressions.SQLSource),\n high.findAllExpressionsRecursive(Expressions.SQLSourceSimple)].flat();\n for (const c of candidates.reverse()) {\n if (c.getFirstToken() instanceof tokens_1.WAt\n || c.getFirstToken() instanceof tokens_1.At) {\n const tokens = c.getAllTokens();\n if (tokens[1] instanceof tokens_1.ParenLeftW && tokens[tokens.length - 1] instanceof tokens_1.WParenRightW) {\n const source = c.findDirectExpression(Expressions.Source);\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `DATA(${uniqueName}) = ${source === null || source === void 0 ? void 0 : source.concatTokens()}.\\n`);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, c.getFirstToken().getStart(), c.getLastToken().getEnd(), \"@\" + uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, low.getFirstToken(), \"SQL, outline complex @\", this.getMetadata().key, this.conf.severity, fix);\n }\n else {\n addFix(c.getFirstToken());\n }\n }\n }\n for (const fieldList of high.findAllExpressionsMulti([Expressions.SQLFieldList, Expressions.SQLFieldListLoop], true)) {\n for (const token of fieldList.getDirectTokens()) {\n if (token.getStr() === \",\") {\n addFix(token);\n }\n }\n }\n if (fix !== undefined) {\n return issue_1.Issue.atToken(lowFile, low.getFirstToken(), \"SQL, remove @ and ,\", this.getMetadata().key, this.conf.severity, fix);\n }\n for (const c of high.findAllExpressionsRecursive(Expressions.SQLIn)) {\n const children = c.getChildren();\n const first = children[1];\n if (!(first.get() instanceof tokens_1.WParenLeftW)) {\n continue;\n }\n const last = children[children.length - 1];\n if (last.get() instanceof tokens_1.WParenRightW || last.get() instanceof tokens_1.WParenRight) {\n const firstEnd = first.getFirstToken().getEnd();\n const endDelete = new position_1.Position(firstEnd.getRow(), firstEnd.getCol() + 1);\n const fix1 = edit_helper_1.EditHelper.deleteRange(lowFile, firstEnd, endDelete);\n const lastStart = last.getFirstToken().getStart();\n const startDelete = new position_1.Position(lastStart.getRow(), lastStart.getCol() - 1);\n const fix2 = edit_helper_1.EditHelper.deleteRange(lowFile, startDelete, lastStart);\n fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, low.getFirstToken(), \"SQL, remove spaces\", this.getMetadata().key, this.conf.severity, fix);\n }\n }\n return undefined;\n }\n downportSelectInline(low, high, lowFile, highSyntax) {\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n else if (!(high.get() instanceof Statements.Select) && !(high.get() instanceof Statements.SelectLoop)) {\n return undefined;\n }\n // as first step outline the @DATA, note that void types are okay, as long the field names are specified\n let found = this.downportSelectSingleInline(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.downportSelectTableInline(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n return undefined;\n }\n downportSelectSingleInline(low, high, lowFile, _highSyntax) {\n var _a, _b, _c, _d;\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n const targets = ((_a = high.findFirstExpression(Expressions.SQLIntoStructure)) === null || _a === void 0 ? void 0 : _a.findDirectExpressions(Expressions.SQLTarget)) || [];\n if (targets.length !== 1) {\n return undefined;\n }\n const inlineData = targets[0].findFirstExpression(Expressions.InlineData);\n if (inlineData === undefined) {\n return undefined;\n }\n const sqlFrom = high.findAllExpressions(Expressions.SQLFromSource);\n if (sqlFrom.length !== 1) {\n return undefined;\n }\n const tableName = (_b = sqlFrom[0].findDirectExpression(Expressions.DatabaseTable)) === null || _b === void 0 ? void 0 : _b.concatTokens();\n if (tableName === undefined) {\n return undefined;\n }\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n let fieldList = high.findFirstExpression(Expressions.SQLFieldList);\n if (fieldList === undefined) {\n fieldList = high.findFirstExpression(Expressions.SQLFieldListLoop);\n }\n if (fieldList === undefined) {\n return undefined;\n }\n let fieldDefinition = \"\";\n const fields = fieldList.findAllExpressions(Expressions.SQLFieldName);\n const name = ((_c = inlineData.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || \"error\";\n if (fields.length === 1) {\n fieldDefinition = `DATA ${name} TYPE ${tableName}-${fields[0].concatTokens()}.`;\n }\n else if (fieldList.concatTokens() === \"*\") {\n fieldDefinition = `DATA ${name} TYPE ${tableName}.`;\n }\n else if (fieldList.concatTokens().toUpperCase() === \"COUNT( * )\") {\n fieldDefinition = `DATA ${name} TYPE i.`;\n }\n else if (fieldList.getChildren().length === 1 && fieldList.getChildren()[0].get() instanceof Expressions.SQLAggregation) {\n const c = fieldList.getChildren()[0];\n if (c instanceof nodes_1.ExpressionNode) {\n const concat = (_d = c.findFirstExpression(Expressions.SQLArithmetics)) === null || _d === void 0 ? void 0 : _d.concatTokens();\n fieldDefinition = `DATA ${name} TYPE ${tableName}-${concat}.`;\n }\n }\n else {\n for (const f of fields) {\n const fieldName = f.concatTokens();\n fieldDefinition += indentation + \" \" + fieldName + \" TYPE \" + tableName + \"-\" + fieldName + \",\\n\";\n }\n fieldDefinition = `DATA: BEGIN OF ${name},\r\n${fieldDefinition}${indentation} END OF ${name}.`;\n }\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `${fieldDefinition}\r\n${indentation}`);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, inlineData.getFirstToken().getStart(), inlineData.getLastToken().getEnd(), name);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, inlineData.getFirstToken(), \"Outline SELECT @DATA\", this.getMetadata().key, this.conf.severity, fix);\n }\n downportSelectTableInline(low, high, lowFile, highSyntax) {\n var _a, _b, _c;\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n const targets = ((_a = high.findFirstExpression(Expressions.SQLIntoTable)) === null || _a === void 0 ? void 0 : _a.findDirectExpressions(Expressions.SQLTarget)) || [];\n if (targets.length !== 1) {\n return undefined;\n }\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n const inlineData = targets[0].findFirstExpression(Expressions.InlineData);\n if (inlineData === undefined) {\n return undefined;\n }\n const sqlFrom = high.findAllExpressions(Expressions.SQLFromSource);\n if (sqlFrom.length === 0) {\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Error outlining, sqlFrom not found\", this.getMetadata().key, this.conf.severity);\n }\n let tableName = (_b = sqlFrom[0].findDirectExpression(Expressions.DatabaseTable)) === null || _b === void 0 ? void 0 : _b.concatTokens();\n if (tableName === undefined) {\n return undefined;\n }\n const fieldList = high.findFirstExpression(Expressions.SQLFieldList);\n if (fieldList === undefined) {\n return undefined;\n }\n let fieldDefinitions = \"\";\n for (const f of fieldList.findAllExpressions(Expressions.SQLFieldName)) {\n let fieldName = f.concatTokens();\n if (fieldName.includes(\"~\")) {\n const split = fieldName.split(\"~\");\n tableName = split[0];\n fieldName = split[1];\n }\n fieldDefinitions += indentation + \" \" + fieldName + \" TYPE \" + tableName + \"-\" + fieldName + \",\\n\";\n }\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const name = ((_c = inlineData.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || \"error\";\n let fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `TYPES: BEGIN OF ${uniqueName},\r\n${fieldDefinitions}${indentation} END OF ${uniqueName}.\r\n${indentation}DATA ${name} TYPE STANDARD TABLE OF ${uniqueName} WITH DEFAULT KEY.\r\n${indentation}`);\n if (fieldDefinitions === \"\") {\n fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `DATA ${name} TYPE STANDARD TABLE OF ${tableName} WITH DEFAULT KEY.\r\n${indentation}`);\n }\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, inlineData.getFirstToken().getStart(), inlineData.getLastToken().getEnd(), name);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, inlineData.getFirstToken(), \"Outline SELECT @DATA\", this.getMetadata().key, this.conf.severity, fix);\n }\n // the anonymous type minght be used in inferred type statements, define it so it can be referred\n anonymousTableType(high, lowFile, highSyntax) {\n if (!(high.get() instanceof Statements.Data)) {\n return undefined;\n }\n const tt = high.findFirstExpression(Expressions.TypeTable);\n if (tt === undefined) {\n return undefined;\n }\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const code = `TYPES ${uniqueName} ${tt.concatTokens()}.\\n`;\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), code);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, tt.getFirstToken().getStart(), tt.getLastToken().getEnd(), \"TYPE \" + uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Add type for table definition\", this.getMetadata().key, this.conf.severity, fix);\n }\n downportMessage(high, lowFile, highSyntax) {\n var _a, _b;\n if (!(high.get() instanceof Statements.Message)) {\n return undefined;\n }\n const foundWith = high.findExpressionAfterToken(\"WITH\");\n if (foundWith === undefined) {\n return undefined;\n }\n const likeSource = high.findExpressionAfterToken(\"LIKE\");\n for (const s of high.findAllExpressions(Expressions.Source)) {\n if (s === likeSource) {\n continue;\n }\n else if (s.getChildren().length === 1 && ((_a = s.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.Constant) {\n continue;\n }\n else if (s.getChildren().length === 1 && ((_b = s.getFirstChild()) === null || _b === void 0 ? void 0 : _b.get()) instanceof Expressions.FieldChain) {\n continue;\n }\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n const firstToken = high.getFirstToken();\n const code = `DATA(${uniqueName}) = ${s.concatTokens()}.\\n${indentation}`;\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), code);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, s.getFirstToken().getStart(), s.getLastToken().getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Refactor MESSAGE WITH source\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n replaceAppendExpression(high, lowFile, highSyntax) {\n if (!(high.get() instanceof Statements.Append)) {\n return undefined;\n }\n const children = high.getChildren();\n if (children[1].get() instanceof Expressions.Source) {\n const source = children[1];\n const target = high.findDirectExpression(Expressions.Target);\n if (target === undefined) {\n return undefined;\n }\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n const firstToken = high.getFirstToken();\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${target === null || target === void 0 ? void 0 : target.concatTokens()}.\r\n${indentation}${uniqueName} = ${source.concatTokens()}.\\n${indentation}`);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Outline APPEND source expression\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n replaceInsertExpression(high, lowFile, highSyntax) {\n if (!(high.get() instanceof Statements.InsertInternal)) {\n return undefined;\n }\n const children = high.getChildren();\n if (children[1].get() instanceof Expressions.Source) {\n const source = children[1];\n const target = high.findDirectExpression(Expressions.Target);\n if (target === undefined) {\n return undefined;\n }\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n const firstToken = high.getFirstToken();\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${target === null || target === void 0 ? void 0 : target.concatTokens()}.\r\n${indentation}${uniqueName} = ${source.concatTokens()}.\\n${indentation}`);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Outline INSERT source expression\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n replaceTableExpression(low, high, lowFile, highSyntax) {\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n for (const fieldChain of high.findAllExpressionsRecursive(Expressions.FieldChain)) {\n const tableExpression = fieldChain.findDirectExpression(Expressions.TableExpression);\n if (tableExpression === undefined) {\n continue;\n }\n const concat = high.concatTokens().toUpperCase();\n if (concat.includes(\" LINE_EXISTS( \") || concat.includes(\" LINE_INDEX( \")) {\n // note: line_exists() must be replaced before handling table expressions\n continue;\n }\n let pre = \"\";\n let startToken = undefined;\n for (const child of fieldChain.getChildren()) {\n if (startToken === undefined) {\n startToken = child.getFirstToken();\n }\n else if (child === tableExpression) {\n break;\n }\n pre += child.concatTokens();\n }\n if (startToken === undefined) {\n continue;\n }\n const condition = this.tableCondition(tableExpression);\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const tabixBackup = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n const firstToken = high.getFirstToken();\n // note that the tabix restore should be done before throwing the exception\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${pre}.\r\n${indentation}DATA ${tabixBackup} LIKE sy-tabix.\r\n${indentation}${tabixBackup} = sy-tabix.\r\n${indentation}READ TABLE ${pre} ${condition}INTO ${uniqueName}.\r\n${indentation}sy-tabix = ${tabixBackup}.\r\n${indentation}IF sy-subrc <> 0.\r\n${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.\r\n${indentation}ENDIF.\r\n${indentation}`);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, startToken.getStart(), tableExpression.getLastToken().getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Outline table expression\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n tableCondition(tableExpression) {\n let condition = \"\";\n let keyName = \"\";\n for (const c of tableExpression.getChildren() || []) {\n if (c.getFirstToken().getStr() === \"[\" || c.getFirstToken().getStr() === \"]\") {\n continue;\n }\n else if (c.get() instanceof Expressions.ComponentChainSimple && condition === \"\") {\n if (keyName === \"\") {\n condition = \"WITH KEY \";\n }\n else {\n condition = \"WITH TABLE KEY \" + keyName + \" COMPONENTS \";\n }\n }\n else if (c.get() instanceof Expressions.Source && condition === \"\") {\n condition = \"INDEX \";\n }\n else if (c instanceof nodes_1.TokenNode && c.getFirstToken().getStr().toUpperCase() === \"KEY\") {\n continue;\n }\n else if (c.get() instanceof Expressions.SimpleName) {\n keyName = c.concatTokens();\n continue;\n }\n condition += c.concatTokens() + \" \";\n }\n return condition;\n }\n outlineCatchSimple(node, lowFile) {\n // outlines \"CATCH cx_bcs INTO DATA(lx_bcs_excep).\", note that this does not need to look at types\n var _a, _b;\n if (!(node.get() instanceof Statements.Catch)) {\n return undefined;\n }\n const target = node.findFirstExpression(Expressions.Target);\n if (!(((_a = target === null || target === void 0 ? void 0 : target.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.InlineData)) {\n return undefined;\n }\n const classNames = node.findDirectExpressions(Expressions.ClassName);\n if (classNames.length !== 1) {\n return undefined;\n }\n const className = classNames[0].concatTokens();\n const targetName = (_b = target.findFirstExpression(Expressions.TargetField)) === null || _b === void 0 ? void 0 : _b.concatTokens();\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\n const code = ` DATA ${targetName} TYPE REF TO ${className}.\r\n${indentation}CATCH ${className} INTO ${targetName}.`;\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getStart(), node.getEnd(), code);\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Outline DATA\", this.getMetadata().key, this.conf.severity, fix);\n }\n outlineGetReferenceSimple(node, lowFile) {\n var _a, _b, _c;\n if (!(node.get() instanceof Statements.GetReference)) {\n return undefined;\n }\n const target = node.findFirstExpression(Expressions.Target);\n if (!(((_a = target === null || target === void 0 ? void 0 : target.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.InlineData)) {\n return undefined;\n }\n const source = node.findFirstExpression(Expressions.Source);\n if (!(((_b = source === null || source === void 0 ? void 0 : source.getFirstChild()) === null || _b === void 0 ? void 0 : _b.get()) instanceof Expressions.FieldChain)) {\n return undefined;\n }\n const targetName = ((_c = target.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || \"errorError\";\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\n const firstToken = target.getFirstToken();\n const lastToken = target.getLastToken();\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getStart(), `DATA ${targetName} LIKE REF TO ${source.concatTokens()}.\\n${indentation}`);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), lastToken.getEnd(), targetName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Outline DATA\", this.getMetadata().key, this.conf.severity, fix);\n }\n outlineDataSimple(node, lowFile) {\n // outlines \"DATA(ls_msg) = temp1.\", note that this does not need to look at types\n var _a, _b, _c;\n if (!(node.get() instanceof Statements.Move)) {\n return undefined;\n }\n const target = node.findFirstExpression(Expressions.Target);\n if (!(((_a = target === null || target === void 0 ? void 0 : target.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.InlineData)) {\n return undefined;\n }\n let type = \"\";\n const source = node.findFirstExpression(Expressions.Source);\n if (source === undefined) {\n return undefined;\n }\n else if (source.getChildren().length !== 1) {\n return undefined;\n }\n else if (!(((_b = source.getFirstChild()) === null || _b === void 0 ? void 0 : _b.get()) instanceof Expressions.FieldChain)) {\n return undefined;\n }\n else if (source.findFirstExpression(Expressions.FieldOffset)) {\n return undefined;\n }\n else if (source.findFirstExpression(Expressions.FieldLength)) {\n return undefined;\n }\n else if (source.findFirstExpression(Expressions.TableExpression)) {\n const chain = source.findDirectExpression(Expressions.FieldChain);\n if (chain !== undefined\n && chain.getChildren().length === 2\n && chain.getChildren()[0].get() instanceof Expressions.SourceField\n && chain.getChildren()[1].get() instanceof Expressions.TableExpression) {\n type = \"LINE OF \" + chain.getChildren()[0].concatTokens();\n }\n else {\n return undefined;\n }\n }\n else {\n type = source.concatTokens();\n }\n const targetName = (_c = target.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens();\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\n const firstToken = node.getFirstToken();\n const lastToken = node.getLastToken();\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${targetName} LIKE ${type}.\\n${indentation}`);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), lastToken.getEnd(), `${targetName} = ${source.concatTokens()}.`);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Outline DATA\", this.getMetadata().key, this.conf.severity, fix);\n }\n partiallyImplemented(node, lowFile) {\n if (node.get() instanceof Statements.InterfaceDef) {\n const partially = node.findDirectTokenByText(\"PARTIALLY\");\n if (partially === undefined) {\n return undefined;\n }\n const implemented = node.findDirectTokenByText(\"IMPLEMENTED\");\n if (implemented === undefined) {\n return undefined;\n }\n const fix = edit_helper_1.EditHelper.deleteRange(lowFile, partially.getStart(), implemented.getEnd());\n return issue_1.Issue.atToken(lowFile, partially, \"Downport PARTIALLY IMPLEMENTED\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n raiseException(node, lowFile, highSyntax) {\n /*\n Note: IF_T100_DYN_MSG does not exist in 702, so this rule is mostly relevant for the transpiler\n \n DATA foo LIKE if_t100_message=>t100key.\n foo-msgid = 'ZHVAM'.\n foo-msgno = '001'.\n foo-attr1 = 'IF_T100_DYN_MSG~MSGV1'.\n foo-attr2 = 'IF_T100_DYN_MSG~MSGV2'.\n foo-attr3 = 'IF_T100_DYN_MSG~MSGV3'.\n foo-attr4 = 'IF_T100_DYN_MSG~MSGV4'.\n DATA bar TYPE REF TO zcl_hvam_exception.\n CREATE OBJECT bar EXPORTING textid = foo.\n bar->if_t100_dyn_msg~msgty = 'E'.\n bar->if_t100_dyn_msg~msgv1 = 'abc'.\n bar->if_t100_dyn_msg~msgv2 = 'abc'.\n bar->if_t100_dyn_msg~msgv3 = 'abc'.\n bar->if_t100_dyn_msg~msgv4 = 'abc'.\n RAISE EXCEPTION bar.\n */\n var _a, _b, _c;\n if (!(node.get() instanceof Statements.Raise)) {\n return undefined;\n }\n let id = undefined;\n let number = undefined;\n let startToken = node.findDirectTokenByText(\"ID\");\n if (startToken) {\n const sources = node.findDirectExpressions(Expressions.Source);\n id = sources[0].concatTokens();\n const numberExpression = node.findExpressionAfterToken(\"NUMBER\");\n if (numberExpression === undefined) {\n throw \"downport raiseException, could not find number\";\n }\n number = numberExpression.concatTokens();\n if (numberExpression.get() instanceof Expressions.MessageNumber) {\n number = \"'\" + number + \"'\";\n }\n }\n else {\n const s = node.findDirectExpression(Expressions.MessageSource);\n if (s === undefined) {\n return undefined;\n }\n id = \"'\" + ((_a = s.findDirectExpression(Expressions.MessageClass)) === null || _a === void 0 ? void 0 : _a.concatTokens()) + \"'\";\n number = \"'\" + ((_b = s.findDirectExpression(Expressions.MessageTypeAndNumber)) === null || _b === void 0 ? void 0 : _b.concatTokens().substring(1)) + \"'\";\n startToken = node.getFirstToken();\n }\n const className = ((_c = node.findDirectExpression(Expressions.ClassName)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || \"ERROR\";\n const uniqueName1 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const uniqueName2 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\n const abap = `DATA ${uniqueName1} LIKE if_t100_message=>t100key.\r\n${indentation}${uniqueName1}-msgid = ${id === null || id === void 0 ? void 0 : id.toUpperCase()}.\r\n${indentation}${uniqueName1}-msgno = ${number}.\r\n${indentation}DATA ${uniqueName2} TYPE REF TO ${className}.\r\n${indentation}CREATE OBJECT ${uniqueName2} EXPORTING textid = ${uniqueName1}.\r\n${indentation}RAISE EXCEPTION ${uniqueName2}.`;\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getStart(), node.getEnd(), abap);\n return issue_1.Issue.atToken(lowFile, startToken, \"Downport RAISE MESSAGE\", this.getMetadata().key, this.conf.severity, fix);\n }\n emptyKey(low, node, lowFile) {\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n for (let i of node.findAllExpressions(Expressions.TypeTable)) {\n const key = i.findDirectExpression(Expressions.TypeTableKey);\n if (key === undefined) {\n continue;\n }\n i = key;\n const concat = i.concatTokens();\n if (concat.toUpperCase().includes(\"WITH EMPTY KEY\") === false) {\n continue;\n }\n const token = i.findDirectTokenByText(\"EMPTY\");\n if (token === undefined) {\n continue;\n }\n const fix = edit_helper_1.EditHelper.replaceToken(lowFile, token, \"DEFAULT\");\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Downport EMPTY KEY\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n callFunctionParameterSimple(high, lowFile, highSyntax) {\n if (!(high.get() instanceof Statements.CallFunction)) {\n return undefined;\n }\n let found = undefined;\n for (const p of high.findAllExpressions(Expressions.FunctionExportingParameter)) {\n found = p.findDirectExpression(Expressions.Source);\n if (found && (found.findDirectExpression(Expressions.FieldChain)\n || found.findDirectExpression(Expressions.Constant)\n || found.findDirectExpression(Expressions.TextElement))) {\n // its actually simple, ok\n found = undefined;\n }\n else if (found !== undefined) {\n break;\n }\n }\n if (found === undefined) {\n return undefined;\n }\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const code = `DATA(${uniqueName}) = ${found.concatTokens()}.\\n`;\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, found.getFirstToken().getStart(), found.getLastToken().getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, call function parameter\", this.getMetadata().key, this.conf.severity, fix);\n }\n downportCorrespondingSimple(high, lowFile) {\n var _a, _b;\n if (!(high.get() instanceof Statements.Move)\n || high.getChildren().length !== 4\n || high.getChildren()[2].getFirstToken().getStr().toUpperCase() !== \"CORRESPONDING\") {\n return undefined;\n }\n const target = high.findDirectExpression(Expressions.Target);\n if (target === undefined) {\n return undefined;\n }\n const sourceRef = (_a = high.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.findFirstExpression(Expressions.CorrespondingBody);\n if ((sourceRef === null || sourceRef === void 0 ? void 0 : sourceRef.getChildren().length) === 1) {\n const code = `MOVE-CORRESPONDING ${sourceRef.concatTokens()} TO ${target.concatTokens()}`;\n const start = high.getFirstToken().getStart();\n const end = high.getLastToken().getStart();\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, simple CORRESPONDING move\", this.getMetadata().key, this.conf.severity, fix);\n }\n else if ((sourceRef === null || sourceRef === void 0 ? void 0 : sourceRef.getChildren().length) === 5 && ((_b = sourceRef.getFirstChild()) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase()) === \"BASE\") {\n let code = `${target.concatTokens()} = ${sourceRef.getChildren()[2].concatTokens()}.\\n`;\n code += `MOVE-CORRESPONDING ${sourceRef.getChildren()[4].concatTokens()} TO ${target.concatTokens()}`;\n const start = high.getFirstToken().getStart();\n const end = high.getLastToken().getStart();\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, CORRESPONDING BASE move\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n downportRefSimple(high, lowFile, highSyntax) {\n var _a;\n if (!(high.get() instanceof Statements.Move)\n || high.getChildren().length !== 4\n || high.getChildren()[2].getFirstToken().getStr().toUpperCase() !== \"REF\") {\n return undefined;\n }\n const target = high.findDirectExpression(Expressions.Target);\n if (target === undefined) {\n return undefined;\n }\n const sourceRef = (_a = high.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Source);\n if (sourceRef === undefined\n || sourceRef.getChildren().length !== 1) {\n return undefined;\n }\n let code = \"\";\n if (sourceRef.findFirstExpression(Expressions.TableExpression)) {\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n code = `ASSIGN ${sourceRef.concatTokens()} TO FIELD-SYMBOL(<${uniqueName}>).\r\nIF sy-subrc <> 0.\r\n RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.\r\nENDIF.\r\nGET REFERENCE OF <${uniqueName}> INTO ${target.concatTokens()}`;\n }\n else {\n code = `GET REFERENCE OF ${sourceRef.concatTokens()} INTO ${target.concatTokens()}`;\n }\n const start = high.getFirstToken().getStart();\n const end = high.getLastToken().getStart();\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, simple REF move\", this.getMetadata().key, this.conf.severity, fix);\n }\n downportLoopGroup(high, lowFile, highSyntax, highFile) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;\n if (!(high.get() instanceof Statements.Loop)) {\n return undefined;\n }\n const group = high.findDirectExpression(Expressions.LoopGroupBy);\n if (group === undefined) {\n return undefined;\n }\n const groupTargetName = ((_a = group.findFirstExpression(Expressions.TargetField)) === null || _a === void 0 ? void 0 : _a.concatTokens())\n || ((_b = group.findFirstExpression(Expressions.TargetFieldSymbol)) === null || _b === void 0 ? void 0 : _b.concatTokens().replace(\"<\", \"_\").replace(\">\", \"_\"))\n || \"nameNotFound\";\n const loopSourceName = ((_c = high.findFirstExpression(Expressions.SimpleSource2)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || \"nameNotFound\";\n const loopTargetName = ((_d = high.findFirstExpression(Expressions.TargetField)) === null || _d === void 0 ? void 0 : _d.concatTokens())\n || ((_e = high.findFirstExpression(Expressions.TargetFieldSymbol)) === null || _e === void 0 ? void 0 : _e.concatTokens())\n || \"nameNotFound\";\n const groupTarget = ((_f = group.findDirectExpression(Expressions.LoopGroupByTarget)) === null || _f === void 0 ? void 0 : _f.concatTokens()) || \"\";\n const isReference = (_g = high.findFirstExpression(Expressions.LoopTarget)) === null || _g === void 0 ? void 0 : _g.concatTokens().toUpperCase().startsWith(\"REFERENCE INTO \");\n let loopSourceRowType = \"typeNotFound\";\n const spag = highSyntax.spaghetti.lookupPosition(high.getFirstToken().getStart(), lowFile.getFilename());\n if (spag !== undefined) {\n const found = spag.findVariable(loopSourceName);\n const tt = found === null || found === void 0 ? void 0 : found.getType();\n if (tt instanceof basic_1.TableType) {\n loopSourceRowType = tt.getRowType().getQualifiedName() || \"typeNotFound\";\n }\n }\n let code = `TYPES: BEGIN OF ${groupTargetName}type,\\n`;\n let condition = \"\";\n let groupCountName = undefined;\n let groupIndexName = undefined;\n for (const c of group.findAllExpressions(Expressions.LoopGroupByComponent)) {\n const name = c.findFirstExpression(Expressions.ComponentName);\n let type = ((_h = c.findFirstExpression(Expressions.Source)) === null || _h === void 0 ? void 0 : _h.concatTokens()) || \"todo\";\n if ((_j = c.concatTokens()) === null || _j === void 0 ? void 0 : _j.toUpperCase().endsWith(\" = GROUP SIZE\")) {\n type = \"i\";\n groupCountName = name === null || name === void 0 ? void 0 : name.concatTokens();\n }\n else if ((_k = c.concatTokens()) === null || _k === void 0 ? void 0 : _k.toUpperCase().endsWith(\" = GROUP INDEX\")) {\n type = \"i\";\n groupIndexName = name === null || name === void 0 ? void 0 : name.concatTokens();\n }\n else {\n if (condition !== \"\") {\n condition += \" \";\n }\n condition += c.concatTokens();\n type = type.replace(loopTargetName, loopSourceRowType);\n type = type.replace(\"->\", \"-\");\n }\n code += ` ${name === null || name === void 0 ? void 0 : name.concatTokens()} TYPE ${type},\\n`;\n }\n const s = group.findDirectExpression(Expressions.Source);\n let singleName = \"\";\n if (s) {\n let type = s.concatTokens();\n type = type.replace(loopTargetName, loopSourceRowType);\n type = type.replace(\"->\", \"-\");\n singleName = s.concatTokens().split(\"-\")[1];\n code += ` ${singleName} TYPE ${type},\\n`;\n condition = singleName + \" = \" + s.concatTokens();\n }\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const uniqueFS = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const uniqueNameIndex = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n code += ` items LIKE ${loopSourceName},\r\n END OF ${groupTargetName}type.\r\nDATA ${groupTargetName}tab TYPE STANDARD TABLE OF ${groupTargetName}type WITH DEFAULT KEY.\r\nDATA ${uniqueName} LIKE LINE OF ${groupTargetName}tab.\r\nLOOP AT ${loopSourceName} ${(_l = high.findFirstExpression(Expressions.LoopTarget)) === null || _l === void 0 ? void 0 : _l.concatTokens()}.\\n`;\n if (groupIndexName !== undefined) {\n code += `DATA(${uniqueNameIndex}) = sy-tabix.\\n`;\n }\n code += `READ TABLE ${groupTargetName}tab ASSIGNING FIELD-SYMBOL(<${uniqueFS}>) WITH KEY ${condition}.\r\nIF sy-subrc = 0.\\n`;\n if (groupCountName !== undefined) {\n code += ` <${uniqueFS}>-${groupCountName} = <${uniqueFS}>-${groupCountName} + 1.\\n`;\n }\n code += ` INSERT ${loopTargetName}${isReference ? \"->*\" : \"\"} INTO TABLE <${uniqueFS}>-items.\r\nELSE.\\n`;\n code += ` CLEAR ${uniqueName}.\\n`;\n for (const c of group.findAllExpressions(Expressions.LoopGroupByComponent)) {\n const concat = c.concatTokens();\n // console.dir(concat);\n if (concat.endsWith(\" GROUP INDEX\")) {\n code += ` ${uniqueName}-${groupIndexName} = ${uniqueNameIndex}.\\n`;\n }\n else if (concat.endsWith(\" GROUP SIZE\")) {\n code += ` ${uniqueName}-${groupCountName} = 1.\\n`;\n }\n else {\n code += ` ${uniqueName}-${concat}.\\n`;\n }\n }\n if (singleName !== \"\") {\n code += ` ${uniqueName}-${singleName} = ${loopTargetName}-${singleName}.\\n`;\n }\n code += ` INSERT ${loopTargetName}${isReference ? \"->*\" : \"\"} INTO TABLE ${uniqueName}-items.\\n`;\n code += ` INSERT ${uniqueName} INTO TABLE ${groupTargetName}tab.\\n`;\n code += `ENDIF.\r\nENDLOOP.\r\nLOOP AT ${groupTargetName}tab ${groupTarget}.`;\n let fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);\n for (const l of ((_m = highFile.getStructure()) === null || _m === void 0 ? void 0 : _m.findAllStructures(Structures.Loop)) || []) {\n // make sure to find the correct/current loop statement\n if (l.findDirectStatement(Statements.Loop) !== high) {\n continue;\n }\n for (const loop of l.findAllStatements(Statements.Loop)) {\n if ((_o = loop.concatTokens()) === null || _o === void 0 ? void 0 : _o.toUpperCase().startsWith(\"LOOP AT GROUP \")) {\n const subLoopSource = loop.findFirstExpression(Expressions.SimpleSource2);\n if (subLoopSource === undefined) {\n continue;\n }\n const subLoopSourceName = (subLoopSource === null || subLoopSource === void 0 ? void 0 : subLoopSource.concatTokens()) || \"nameNotFound\";\n const subCode = `LOOP AT ${subLoopSourceName}${isReference ? \"->\" : \"-\"}items`;\n const subFix = edit_helper_1.EditHelper.replaceRange(lowFile, loop.getFirstToken().getStart(), subLoopSource.getLastToken().getEnd(), subCode);\n fix = edit_helper_1.EditHelper.merge(subFix, fix);\n }\n }\n }\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, LOOP GROUP\", this.getMetadata().key, this.conf.severity, fix);\n }\n downportRef(low, high, lowFile, highSyntax) {\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n let found = undefined;\n for (const s of high.findAllExpressionsRecursive(Expressions.Source)) {\n if (s.getFirstToken().getStr().toUpperCase() === \"REF\"\n && s.findDirectExpression(Expressions.TypeNameOrInfer)) {\n found = s;\n }\n }\n if (found === undefined) {\n return undefined;\n }\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const code = `DATA(${uniqueName}) = ${found.concatTokens()}.\\n`;\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, found.getFirstToken().getStart(), found.getLastToken().getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, REF\", this.getMetadata().key, this.conf.severity, fix);\n }\n assignWithTable(low, high, lowFile) {\n var _a, _b;\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n if (!(high.get() instanceof Statements.Assign)) {\n return undefined;\n }\n else if (high.getChildren().length !== 5) {\n return undefined;\n }\n const fieldChain = (_b = (_a = high.findDirectExpression(Expressions.AssignSource)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.FieldChain);\n const tableExpression = fieldChain === null || fieldChain === void 0 ? void 0 : fieldChain.getLastChild();\n if (tableExpression === undefined\n || !(tableExpression.get() instanceof Expressions.TableExpression)\n || !(tableExpression instanceof nodes_1.ExpressionNode)) {\n return undefined;\n }\n let condition = \"\";\n if (tableExpression.getChildren().length === 3) {\n const index = tableExpression.findDirectExpression(Expressions.Source);\n if (index === undefined) {\n return undefined;\n }\n condition = `INDEX ${index.concatTokens()}`;\n }\n else {\n let concat = tableExpression.concatTokens();\n concat = concat.substring(2);\n concat = concat.substring(0, concat.length - 2);\n condition = `WITH KEY ${concat}`;\n }\n let pre = \"\";\n for (const c of fieldChain.getChildren()) {\n if (c === tableExpression) {\n break;\n }\n pre += c.concatTokens();\n }\n const fsTarget = high.findDirectExpression(Expressions.FSTarget);\n const code = `READ TABLE ${pre} ${condition} ASSIGNING ${fsTarget === null || fsTarget === void 0 ? void 0 : fsTarget.concatTokens()}.`;\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, ASSIGN table expr\", this.getMetadata().key, this.conf.severity, fix);\n }\n moveWithSimpleValue(low, high, lowFile) {\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n if (!(high.get() instanceof Statements.Move)\n || high.getChildren().length !== 4) {\n return undefined;\n }\n const target = high.findDirectExpression(Expressions.Target);\n if (target === undefined) {\n return undefined;\n }\n const source = high.findDirectExpression(Expressions.Source);\n if (source === undefined) {\n return undefined;\n }\n const field = target.findDirectExpression(Expressions.TargetField);\n if (field === undefined) {\n return;\n }\n const valueBody = source.findDirectExpression(Expressions.ValueBody);\n if (valueBody === undefined) {\n return;\n }\n const fieldAssignments = valueBody.findDirectExpressions(Expressions.FieldAssignment);\n if (fieldAssignments.length === 0) {\n return;\n }\n else if (fieldAssignments.length !== valueBody.getChildren().length) {\n return;\n }\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n let code = `CLEAR ${target.concatTokens()}.\\n`;\n for (const fieldAssignment of fieldAssignments) {\n code += indentation + target.concatTokens() + \"-\" + fieldAssignment.concatTokens() + `.\\n`;\n }\n code = code.trimEnd();\n const start = high.getFirstToken().getStart();\n const end = high.getLastToken().getEnd();\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, simple move\", this.getMetadata().key, this.conf.severity, fix);\n }\n // note, downporting ENUM does not give the correct types, but it will work in most cases?\n downportEnum(_low, high, lowFile, _highSyntax, highFile) {\n var _a, _b, _c, _d, _e;\n if (!(high.get() instanceof Statements.TypeEnumBegin)) {\n return undefined;\n }\n const enumStructure = (_a = highFile.getStructure()) === null || _a === void 0 ? void 0 : _a.findFirstStructure(Structures.TypeEnum);\n if (enumStructure === undefined) {\n return undefined;\n }\n if (enumStructure.getFirstStatement() !== high) {\n return undefined;\n }\n const enumName = (_b = high.findExpressionAfterToken(\"ENUM\")) === null || _b === void 0 ? void 0 : _b.concatTokens();\n const structureName = (_c = high.findExpressionAfterToken(\"STRUCTURE\")) === null || _c === void 0 ? void 0 : _c.concatTokens();\n // all ENUMS are char like?\n let code = `TYPES ${enumName} TYPE string.\r\nCONSTANTS: BEGIN OF ${structureName},\\n`;\n let count = 1;\n for (const e of enumStructure.findDirectStatements(Statements.TypeEnum).concat(enumStructure.findDirectStatements(Statements.Type))) {\n const name = (_d = e.findFirstExpression(Expressions.NamespaceSimpleName)) === null || _d === void 0 ? void 0 : _d.concatTokens();\n let value = (_e = e.findFirstExpression(Expressions.Value)) === null || _e === void 0 ? void 0 : _e.concatTokens();\n if (value === undefined) {\n value = \"VALUE '\" + count++ + \"'\";\n }\n code += ` ${name} TYPE ${enumName} ${value},\\n`;\n }\n code += ` END OF ${structureName}.`;\n const start = enumStructure.getFirstToken().getStart();\n const end = enumStructure.getLastToken().getEnd();\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport ENUM\", this.getMetadata().key, this.conf.severity, fix);\n }\n moveWithTableTarget(low, high, lowFile, highSyntax) {\n var _a;\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n if (!(high.get() instanceof Statements.Move)) {\n return undefined;\n }\n const target = high.findDirectExpression(Expressions.Target);\n if (target === undefined) {\n return undefined;\n }\n const tableExpression = target.findDirectExpression(Expressions.TableExpression);\n if (tableExpression === undefined) {\n return undefined;\n }\n const index = tableExpression.findDirectExpression(Expressions.Source);\n if (index === undefined) {\n return undefined;\n }\n let uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n uniqueName = `<${uniqueName}>`;\n const tName = target.concatTokens().split(\"[\")[0];\n const condition = this.tableCondition(tableExpression);\n const tabixBackup = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n // restore tabix before exeption\n const code = `FIELD-SYMBOLS ${uniqueName} LIKE LINE OF ${tName}.\r\n${indentation}DATA ${tabixBackup} LIKE sy-tabix.\r\n${indentation}${tabixBackup} = sy-tabix.\r\n${indentation}READ TABLE ${tName} ${condition}ASSIGNING ${uniqueName}.\r\n${indentation}sy-tabix = ${tabixBackup}.\r\n${indentation}IF sy-subrc <> 0.\r\n${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.\r\n${indentation}ENDIF.\r\n${indentation}${uniqueName}`;\n const start = target.getFirstToken().getStart();\n const end = (_a = tableExpression.findDirectTokenByText(\"]\")) === null || _a === void 0 ? void 0 : _a.getEnd();\n if (end === undefined) {\n return undefined;\n }\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, move with table target\", this.getMetadata().key, this.conf.severity, fix);\n }\n moveWithOperator(low, high, lowFile) {\n var _a, _b, _c;\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n else if (!(high.get() instanceof Statements.Move)) {\n return undefined;\n }\n const children = high.getChildren();\n const secondChild = children[1];\n if (secondChild === undefined) {\n return undefined;\n }\n const op = secondChild.getFirstToken();\n let operator = \"\";\n switch (op.getStr()) {\n case \"+\":\n operator = \" + \";\n break;\n case \"-\":\n operator = \" - \";\n break;\n case \"/=\":\n operator = \" / \";\n break;\n case \"*=\":\n operator = \" * \";\n break;\n case \"&&=\":\n operator = \" && \";\n break;\n default:\n return undefined;\n }\n const target = (_a = high.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.concatTokens();\n if (target === undefined) {\n return;\n }\n const sourceStart = (_c = (_b = high.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.getFirstChild()) === null || _c === void 0 ? void 0 : _c.getFirstToken().getStart();\n if (sourceStart === undefined) {\n return;\n }\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, op.getStart(), sourceStart, \"= \" + target + operator);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Expand operator\", this.getMetadata().key, this.conf.severity, fix);\n }\n // must be very simple string templates, like \"|{ ls_line-no ALPHA = IN }|\"\n stringTemplateAlpha(low, high, lowFile, highSyntax) {\n var _a, _b, _c;\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n else if (!(high.get() instanceof Statements.Move)) {\n return undefined;\n }\n const topSource = high.findDirectExpression(Expressions.Source);\n if (topSource === undefined || topSource.getChildren().length !== 1) {\n return undefined;\n }\n let top = true;\n let child = topSource.getFirstChild();\n if (!(child.get() instanceof Expressions.StringTemplate)) {\n child = child.findFirstExpression(Expressions.StringTemplate);\n top = false;\n }\n if (child === undefined || !(child.get() instanceof Expressions.StringTemplate)) {\n return undefined;\n }\n const templateTokens = child.getChildren();\n if (templateTokens.length !== 3\n || templateTokens[0].getFirstToken().getStr() !== \"|{\"\n || templateTokens[2].getFirstToken().getStr() !== \"}|\") {\n return undefined;\n }\n const templateSource = child.findDirectExpression(Expressions.StringTemplateSource);\n const formatting = (_a = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.StringTemplateFormatting)) === null || _a === void 0 ? void 0 : _a.concatTokens();\n let functionName = \"\";\n switch (formatting) {\n case \"ALPHA = IN\":\n functionName = \"CONVERSION_EXIT_ALPHA_INPUT\";\n break;\n case \"ALPHA = OUT\":\n functionName = \"CONVERSION_EXIT_ALPHA_OUTPUT\";\n break;\n default:\n return undefined;\n }\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n const source = (_b = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens();\n const topTarget = (_c = high.findDirectExpression(Expressions.Target)) === null || _c === void 0 ? void 0 : _c.concatTokens();\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n if (top === false) {\n const code = `DATA ${uniqueName} TYPE string.\r\n${indentation}CALL FUNCTION '${functionName}'\r\n${indentation} EXPORTING\r\n${indentation} input = ${source}\r\n${indentation} IMPORTING\r\n${indentation} output = ${uniqueName}.\\n`;\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, child.getFirstToken().getStart(), child.getLastToken().getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport ALPHA\", this.getMetadata().key, this.conf.severity, fix);\n }\n else {\n const code = `CALL FUNCTION '${functionName}'\r\n${indentation} EXPORTING\r\n${indentation} input = ${source}\r\n${indentation} IMPORTING\r\n${indentation} output = ${topTarget}.`;\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport ALPHA\", this.getMetadata().key, this.conf.severity, fix);\n }\n }\n outlineLoopInput(low, high, lowFile, highSyntax) {\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n else if (!(high.get() instanceof Statements.Loop)) {\n return undefined;\n }\n else if (high.findDirectExpression(Expressions.SimpleSource2)) {\n return undefined;\n }\n // the first Source must be outlined\n const s = high.findDirectExpression(Expressions.Source);\n if (s === undefined) {\n return undefined;\n }\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const code = `DATA(${uniqueName}) = ${s.concatTokens()}.\\n` +\n \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, s.getFirstToken().getStart(), s.getLastToken().getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Outline LOOP input\", this.getMetadata().key, this.conf.severity, fix);\n }\n outlineLoopTarget(node, lowFile, highSyntax) {\n var _a, _b, _c, _d, _e, _f, _g;\n // also allows outlining of voided types\n if (!(node.get() instanceof Statements.Loop)) {\n return undefined;\n }\n const sourceName = (_a = node.findDirectExpression(Expressions.SimpleSource2)) === null || _a === void 0 ? void 0 : _a.concatTokens();\n if (sourceName === undefined) {\n return undefined;\n }\n const concat = node.concatTokens().toUpperCase();\n if (concat.includes(\" GROUP BY \") || concat.startsWith(\"LOOP AT GROUP \")) {\n return undefined;\n }\n const isReference = concat.includes(\" REFERENCE INTO \");\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\n const dataTarget = (_c = (_b = node.findDirectExpression(Expressions.LoopTarget)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.Target)) === null || _c === void 0 ? void 0 : _c.findDirectExpression(Expressions.InlineData);\n if (dataTarget) {\n const targetName = ((_d = dataTarget.findDirectExpression(Expressions.TargetField)) === null || _d === void 0 ? void 0 : _d.concatTokens()) || \"DOWNPORT_ERROR\";\n let code = `DATA ${targetName} LIKE LINE OF ${sourceName}.\\n${indentation}`;\n if (isReference) {\n const likeName = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n code = `DATA ${likeName} LIKE LINE OF ${sourceName}.\\n${indentation}DATA ${targetName} LIKE REF TO ${likeName}.\\n${indentation}`;\n }\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, dataTarget.getFirstToken().getStart(), dataTarget.getLastToken().getEnd(), targetName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Outline LOOP data target\", this.getMetadata().key, this.conf.severity, fix);\n }\n const fsTarget = (_f = (_e = node.findDirectExpression(Expressions.LoopTarget)) === null || _e === void 0 ? void 0 : _e.findDirectExpression(Expressions.FSTarget)) === null || _f === void 0 ? void 0 : _f.findDirectExpression(Expressions.InlineFS);\n if (fsTarget) {\n const targetName = ((_g = fsTarget.findDirectExpression(Expressions.TargetFieldSymbol)) === null || _g === void 0 ? void 0 : _g.concatTokens()) || \"DOWNPORT_ERROR\";\n const code = `FIELD-SYMBOLS ${targetName} LIKE LINE OF ${sourceName}.\\n${indentation}`;\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, fsTarget.getFirstToken().getStart(), fsTarget.getLastToken().getEnd(), targetName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Outline LOOP fs target\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n outlineFor(forLoop, indentation, lowFile, highSyntax) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j;\n let body = \"\";\n let end = \"\";\n const loopSource = (_a = forLoop.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();\n let loopTargetFieldExpression = forLoop.findFirstExpression(Expressions.TargetField);\n let loopTargetFieldName = loopTargetFieldExpression === null || loopTargetFieldExpression === void 0 ? void 0 : loopTargetFieldExpression.concatTokens();\n const of = forLoop.findExpressionAfterToken(\"OF\");\n if (of !== undefined) {\n loopTargetFieldExpression = of;\n loopTargetFieldName = of === null || of === void 0 ? void 0 : of.concatTokens();\n }\n if (((_c = (_b = forLoop.findDirectExpression(Expressions.InlineLoopDefinition)) === null || _b === void 0 ? void 0 : _b.getFirstChild()) === null || _c === void 0 ? void 0 : _c.get()) instanceof Expressions.TargetFieldSymbol) {\n loopTargetFieldExpression = undefined;\n loopTargetFieldName = undefined;\n }\n if (loopTargetFieldExpression) {\n const start = loopTargetFieldExpression.getFirstToken().getStart();\n const spag = highSyntax.spaghetti.lookupPosition(start, lowFile.getFilename());\n if (loopTargetFieldName && spag) {\n if (new SpagHelper(spag).isDuplicateName(loopTargetFieldName, start)) {\n this.renameVariable(spag, loopTargetFieldName, start, lowFile, highSyntax);\n }\n }\n }\n let cond = ((_d = forLoop.findDirectExpression(Expressions.ComponentCond)) === null || _d === void 0 ? void 0 : _d.concatTokens()) || \"\";\n if (cond !== \"\") {\n cond = \" WHERE \" + cond;\n }\n const loop = forLoop.findDirectExpression(Expressions.InlineLoopDefinition);\n const indexInto = (_e = loop === null || loop === void 0 ? void 0 : loop.findExpressionAfterToken(\"INTO\")) === null || _e === void 0 ? void 0 : _e.concatTokens();\n if (forLoop.findDirectTokenByText(\"UNTIL\")\n || forLoop.findDirectTokenByText(\"WHILE\")) {\n const fieldDef = forLoop.findDirectExpression(Expressions.InlineFieldDefinition);\n const field = (_f = fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.findFirstExpression(Expressions.Field)) === null || _f === void 0 ? void 0 : _f.concatTokens();\n const indexBackup = this.uniqueName(forLoop.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n body += indentation + \"DATA \" + field + \" TYPE i.\\n\";\n const second = fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.getChildren()[2];\n if ((second === null || second === void 0 ? void 0 : second.get()) instanceof Expressions.Source) {\n body += indentation + field + \" = \" + second.concatTokens() + \".\\n\";\n }\n const not = forLoop.findDirectTokenByText(\"UNTIL\") ? \" NOT\" : \"\";\n const cond = forLoop.findFirstExpression(Expressions.Cond);\n body += indentation + `DATA ${indexBackup} LIKE sy-index.\\n`;\n body += indentation + `${indexBackup} = sy-index.\\n`;\n body += indentation + `WHILE${not} ${cond === null || cond === void 0 ? void 0 : cond.concatTokens()}.\\n`;\n body += indentation + ` sy-index = ${indexBackup}.\\n`;\n const then = forLoop.findExpressionAfterToken(\"THEN\");\n if (then) {\n end += ` ${field} = ${then.concatTokens()}.\\n`;\n }\n else {\n end += ` ${field} = ${field} + 1.\\n`;\n }\n end += indentation + \"ENDWHILE\";\n }\n else if (loopTargetFieldName !== undefined) {\n let from = (_g = forLoop.findExpressionAfterToken(\"FROM\")) === null || _g === void 0 ? void 0 : _g.concatTokens();\n from = from ? \" FROM \" + from : \"\";\n let to = (_h = forLoop.findExpressionAfterToken(\"TO\")) === null || _h === void 0 ? void 0 : _h.concatTokens();\n to = to ? \" TO \" + to : \"\";\n let gby = \"\";\n for (const lg of forLoop.findDirectExpressions(Expressions.LoopGroupByComponent)) {\n if (gby !== \"\") {\n gby += \" \";\n }\n gby += lg.concatTokens();\n }\n if (gby !== \"\") {\n gby = \" GROUP BY ( \" + gby + \" )\";\n }\n const fc = forLoop.findDirectExpression(Expressions.FieldChain);\n if (fc) {\n gby = \" GROUP BY \" + fc.concatTokens();\n }\n if (forLoop.findDirectTokenByText(\"ASCENDING\")) {\n gby += \" ASCENDING\";\n }\n if (forLoop.findDirectTokenByText(\"DESCENDING\")) {\n gby += \" DESCENDING\";\n }\n const groups = forLoop.findExpressionAfterToken(\"GROUPS\");\n if (groups) {\n const concat = groups.concatTokens();\n if (concat.startsWith(\"<\")) {\n gby += \" ASSIGNING FIELD-SYMBOL(\" + concat + \")\";\n }\n else {\n gby += \" INTO DATA(\" + concat + \")\";\n }\n }\n let inGroup = \"\";\n if (forLoop.concatTokens().toUpperCase().includes(\" IN GROUP \")) {\n inGroup = \"-items\";\n }\n let into = \"INTO DATA\";\n if (loopTargetFieldName.startsWith(\"<\")) {\n into = \"ASSIGNING FIELD-SYMBOL\";\n }\n // todo, also backup sy-index / sy-tabix here?\n body += indentation + `LOOP AT ${loopSource}${inGroup} ${into}(${loopTargetFieldName})${from}${to}${cond}${gby}.\\n`;\n if (indexInto) {\n body += indentation + \" DATA(\" + indexInto + \") = sy-tabix.\\n\";\n }\n end = \"ENDLOOP\";\n }\n else if (loopTargetFieldName === undefined) {\n // todo, also backup sy-index / sy-tabix here?\n const loopTargetFieldSymbol = (_j = forLoop.findFirstExpression(Expressions.TargetFieldSymbol)) === null || _j === void 0 ? void 0 : _j.concatTokens();\n body += indentation + `LOOP AT ${loopSource} ASSIGNING FIELD-SYMBOL(${loopTargetFieldSymbol})${cond}.\\n`;\n if (indexInto) {\n body += indentation + \" DATA(\" + indexInto + \") = sy-tabix.\\n\";\n }\n end = \"ENDLOOP\";\n }\n const l = forLoop.findDirectExpression(Expressions.Let);\n if (l) {\n body += this.outlineLet(l, indentation, highSyntax, lowFile);\n }\n return { body, end };\n }\n outlineFilter(low, high, lowFile, highSyntax) {\n var _a;\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n for (const i of high.findAllExpressionsRecursive(Expressions.Source)) {\n const firstToken = i.getFirstToken();\n if (firstToken.getStr().toUpperCase() !== \"FILTER\") {\n continue;\n }\n const filterBody = i.findDirectExpression(Expressions.FilterBody);\n if (filterBody === undefined) {\n continue;\n }\n const sourceName = (_a = filterBody.findDirectExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();\n if (sourceName === undefined) {\n continue;\n }\n let type = this.findType(i, lowFile, highSyntax);\n if (type === undefined) {\n type = \"LIKE \" + sourceName;\n }\n else {\n type = \"TYPE \" + type;\n }\n const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\n const loopName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n let body = \"\";\n body += `DATA ${uniqueName} ${type}.\\n`;\n body += `${indentation}LOOP AT ${sourceName} INTO DATA(${loopName}) ${filterBody.concatTokens().substring(sourceName.length + 1)}.\\n`;\n body += `${indentation} INSERT ${loopName} INTO TABLE ${uniqueName}.\\n`;\n body += `${indentation}ENDLOOP.\\n${indentation}`;\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), body);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), i.getLastToken().getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, firstToken, \"Downport FILTER\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n outlineSwitch(low, high, lowFile, highSyntax) {\n var _a, _b, _c, _d;\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n for (const i of high.findAllExpressionsRecursive(Expressions.Source)) {\n const firstToken = i.getFirstToken();\n if (firstToken.getStr().toUpperCase() !== \"SWITCH\") {\n continue;\n }\n let type = this.findType(i, lowFile, highSyntax);\n if (type === undefined) {\n if (high.get() instanceof Statements.Move\n && high.findDirectExpression(Expressions.Source) === i\n && ((_a = high.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.TargetField)) !== undefined) {\n type = \"LIKE \" + ((_b = high.findDirectExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.concatTokens());\n }\n if (type === undefined) {\n continue;\n }\n }\n else {\n type = \"TYPE \" + type;\n }\n const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n let body = \"\";\n let name = \"\";\n const switchBody = i.findDirectExpression(Expressions.SwitchBody);\n if (switchBody === undefined) {\n continue;\n }\n for (const l of ((_c = switchBody === null || switchBody === void 0 ? void 0 : switchBody.findDirectExpression(Expressions.Let)) === null || _c === void 0 ? void 0 : _c.findDirectExpressions(Expressions.InlineFieldDefinition)) || []) {\n name = l.getFirstToken().getStr();\n body += indentation + `DATA(${name}) = ${(_d = switchBody.findFirstExpression(Expressions.Source)) === null || _d === void 0 ? void 0 : _d.concatTokens()}.\\n`;\n }\n body += `DATA ${uniqueName} ${type}.\\n`;\n let firstSource = false;\n let inWhen = false;\n for (const c of switchBody.getChildren()) {\n if (c.get() instanceof Expressions.Source && firstSource === false) {\n body += indentation + `CASE ${c.concatTokens()}.`;\n firstSource = true;\n }\n else if (c instanceof nodes_1.TokenNode && c.concatTokens().toUpperCase() === \"THEN\") {\n inWhen = true;\n body += \".\\n\";\n }\n else if (c instanceof nodes_1.TokenNode && c.concatTokens().toUpperCase() === \"WHEN\") {\n inWhen = false;\n body += `\\n${indentation} WHEN `;\n }\n else if (c instanceof nodes_1.TokenNode && c.concatTokens().toUpperCase() === \"OR\") {\n body += ` OR `;\n }\n else if (c instanceof nodes_1.TokenNode && c.concatTokens().toUpperCase() === \"ELSE\") {\n inWhen = true;\n body += `\\n${indentation} WHEN OTHERS.\\n`;\n }\n else if (inWhen === false) {\n body += c.concatTokens();\n }\n else {\n body += indentation + \" \" + uniqueName + \" = \" + c.concatTokens() + \".\";\n }\n }\n body += \"\\n\" + indentation + \"ENDCASE.\\n\" + indentation;\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), body);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), i.getLastToken().getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, firstToken, \"Downport SWITCH\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n outlineReduce(low, high, lowFile, highSyntax) {\n var _a, _b;\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n for (const i of high.findAllExpressionsRecursive(Expressions.Source)) {\n const firstToken = i.getFirstToken();\n if (firstToken.getStr().toUpperCase() !== \"REDUCE\") {\n continue;\n }\n const type = this.findType(i, lowFile, highSyntax);\n if (type === undefined) {\n continue;\n }\n const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n let body = \"\";\n let name = \"\";\n const reduceBody = i.findDirectExpression(Expressions.ReduceBody);\n if (reduceBody === undefined) {\n continue;\n }\n const letNode = reduceBody.findDirectExpression(Expressions.Let);\n if (letNode) {\n body += this.outlineLet(letNode, indentation, highSyntax, lowFile);\n }\n let firstName = \"\";\n for (const init of reduceBody.findDirectExpressions(Expressions.InlineFieldDefinition)) {\n name = init.getFirstToken().getStr();\n if (firstName === \"\") {\n firstName = name;\n }\n const spag = highSyntax.spaghetti.lookupPosition(init.getFirstToken().getStart(), lowFile.getFilename());\n if (spag && new SpagHelper(spag).isDuplicateName(name, init.getFirstToken().getStart())) {\n this.renameVariable(spag, name, init.getFirstToken().getStart(), lowFile, highSyntax);\n }\n const s = (_a = init.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();\n const t = (_b = init.findFirstExpression(Expressions.TypeName)) === null || _b === void 0 ? void 0 : _b.concatTokens();\n if (s) {\n if (s.toUpperCase().startsWith(\"VALUE #\")) {\n body += indentation + `DATA(${name}) = ${s.replace(\"#\", type)}.\\n`;\n }\n else {\n body += indentation + `DATA(${name}) = ${s}.\\n`;\n }\n }\n else {\n body += indentation + `DATA ${name} TYPE ${t}.\\n`;\n }\n }\n let end = \"\";\n for (const forLoop of (reduceBody === null || reduceBody === void 0 ? void 0 : reduceBody.findDirectExpressions(Expressions.For)) || []) {\n const outlineFor = this.outlineFor(forLoop, indentation, lowFile, highSyntax);\n body += outlineFor.body;\n end = outlineFor.end + `.\\n` + end;\n }\n const next = reduceBody.findDirectExpression(Expressions.ReduceNext);\n if (next === undefined) {\n continue;\n }\n for (const n of next.getChildren()) {\n const concat = n.concatTokens();\n if (concat.toUpperCase() === \"NEXT\") {\n continue;\n }\n else if (n.get() instanceof Expressions.SimpleTarget) {\n body += indentation + \" \" + concat + \" \";\n }\n else if (n.get() instanceof Expressions.Source) {\n body += \" \" + concat + \".\\n\";\n }\n else {\n body += concat;\n }\n }\n body += indentation + end;\n body += indentation + `${uniqueName} = ${firstName}.\\n`;\n const abap = `DATA ${uniqueName} TYPE ${type}.\\n` +\n body +\n indentation;\n const reduceEnd = i.findDirectTokenByText(\")\");\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), reduceEnd.getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, firstToken, \"Downport REDUCE\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n outlineValue(low, high, lowFile, highSyntax) {\n var _a, _b, _c;\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n const allSources = high.findAllExpressionsRecursive(Expressions.Source);\n for (const s of allSources) {\n const firstToken = s.getFirstToken();\n if (firstToken.getStr().toUpperCase() !== \"VALUE\") {\n continue;\n }\n const valueBody = s.findDirectExpression(Expressions.ValueBody);\n let type = this.findType(s, lowFile, highSyntax);\n if (type === undefined) {\n if (high.get() instanceof Statements.Move && high.findDirectExpression(Expressions.Source) === s) {\n type = \"LIKE \" + ((_a = high.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.concatTokens());\n }\n if (type === undefined) {\n continue;\n }\n }\n else {\n type = \"TYPE \" + type;\n }\n const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\n let indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n let body = \"\";\n const base = valueBody === null || valueBody === void 0 ? void 0 : valueBody.findExpressionAfterToken(\"BASE\");\n if (base) {\n body += indentation + uniqueName + \" = \" + base.concatTokens() + \".\\n\";\n }\n let end = \"\";\n let structureName = uniqueName;\n let added = false;\n let data = \"\";\n let previous = undefined;\n if ((valueBody === null || valueBody === void 0 ? void 0 : valueBody.findDirectExpression(Expressions.ValueBodyLine)) !== undefined) {\n structureName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\n const extra = (valueBody === null || valueBody === void 0 ? void 0 : valueBody.findDirectExpression(Expressions.For)) ? \" \" : \"\";\n data = indentation + extra + `DATA ${structureName} LIKE LINE OF ${uniqueName}.\\n`;\n }\n for (const a of (valueBody === null || valueBody === void 0 ? void 0 : valueBody.getChildren()) || []) {\n if (a.get() instanceof Expressions.FieldAssignment) {\n if (added === false) {\n body += data;\n added = true;\n }\n body += indentation + structureName + \"-\" + a.concatTokens() + \".\\n\";\n }\n else if (a instanceof nodes_1.ExpressionNode && a.get() instanceof Expressions.For) {\n const outlineFor = this.outlineFor(a, indentation, lowFile, highSyntax);\n body += outlineFor.body;\n end = outlineFor.end + `.\\n` + end;\n indentation += \" \";\n }\n else if (a instanceof nodes_1.ExpressionNode && a.get() instanceof Expressions.Source) {\n // special handling for superflous value expression\n if ((valueBody === null || valueBody === void 0 ? void 0 : valueBody.getChildren().length) === 1) {\n body += indentation + uniqueName + \" = \" + a.concatTokens() + `.\\n`;\n }\n }\n else if (a instanceof nodes_1.ExpressionNode && a.get() instanceof Expressions.Let) {\n body += this.outlineLet(a, indentation, highSyntax, lowFile);\n }\n if (a instanceof nodes_1.ExpressionNode && a.get() instanceof Expressions.ValueBodyLine) {\n let skip = false;\n for (const b of (a === null || a === void 0 ? void 0 : a.getChildren()) || []) {\n if (b.get() instanceof Expressions.FieldAssignment) {\n if (added === false) {\n body += data;\n added = true;\n }\n body += indentation + structureName + \"-\" + b.concatTokens() + \".\\n\";\n }\n else if (b.get() instanceof Expressions.Source) {\n body += indentation + \"APPEND \" + b.concatTokens() + ` TO ${uniqueName}.\\n`;\n skip = true;\n }\n else if (b.get() instanceof Expressions.ValueBodyLines) {\n body += indentation + \"APPEND \" + b.concatTokens() + ` TO ${uniqueName}.\\n`;\n skip = true;\n }\n else if (b.concatTokens() === \")\") {\n if (added === false && (previous === null || previous === void 0 ? void 0 : previous.concatTokens()) === \"(\") {\n body += data;\n added = true;\n }\n if (skip === false) {\n body += indentation + `APPEND ${structureName} TO ${uniqueName}.\\n`;\n }\n }\n previous = b;\n }\n }\n }\n if (body === \"\" && ((_b = valueBody === null || valueBody === void 0 ? void 0 : valueBody.getLastChild()) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr().toUpperCase()) === \"OPTIONAL\") {\n const fieldChain = valueBody.findFirstExpression(Expressions.FieldChain);\n const rowName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\n let tableExpression = undefined;\n let tabName = \"\";\n let after = \"\";\n for (const c of (fieldChain === null || fieldChain === void 0 ? void 0 : fieldChain.getChildren()) || []) {\n if (c.get() instanceof Expressions.TableExpression && c instanceof nodes_1.ExpressionNode) {\n tableExpression = c;\n }\n else if (tableExpression === undefined) {\n tabName += c.concatTokens();\n }\n else {\n after += c.concatTokens();\n }\n }\n let condition = \"\";\n if ((tableExpression === null || tableExpression === void 0 ? void 0 : tableExpression.getChildren().length) === 3) {\n condition = \"INDEX \" + ((_c = tableExpression === null || tableExpression === void 0 ? void 0 : tableExpression.findDirectExpression(Expressions.Source)) === null || _c === void 0 ? void 0 : _c.concatTokens());\n }\n else {\n condition = \"WITH KEY \" + (tableExpression === null || tableExpression === void 0 ? void 0 : tableExpression.concatTokens().replace(\"[ \", \"\").replace(\" ]\", \"\"));\n }\n body +=\n indentation + `READ TABLE ${tabName} INTO DATA(${rowName}) ${condition}.\\n` +\n indentation + `IF sy-subrc = 0.\\n` +\n indentation + ` ${uniqueName} = ${rowName}${after}.\\n` +\n indentation + `ENDIF.\\n`;\n }\n if (end !== \"\") {\n indentation = indentation.substring(2);\n body += indentation + end;\n }\n const abap = `DATA ${uniqueName} ${type}.\\n` +\n indentation + `CLEAR ${uniqueName}.\\n` + // might be called inside a loop\n body +\n indentation;\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), s.getLastToken().getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, firstToken, \"Downport VALUE\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n outlineLet(node, indentation, highSyntax, lowFile) {\n var _a;\n let ret = \"\";\n for (const f of node.findDirectExpressions(Expressions.InlineFieldDefinition)) {\n const c = f.getFirstChild();\n if (c === undefined) {\n continue;\n }\n const name = c.concatTokens().toLowerCase();\n const spag = highSyntax.spaghetti.lookupPosition(c.getFirstToken().getStart(), lowFile.getFilename());\n if (spag === undefined) {\n continue;\n }\n if (new SpagHelper(spag).isDuplicateName(name, c.getFirstToken().getStart())) {\n this.renameVariable(spag, name, c.getFirstToken().getStart(), lowFile, highSyntax);\n }\n const found = spag.findVariable(name);\n if (found === undefined) {\n const source = f.findFirstExpression(Expressions.Source);\n if (source) {\n ret += indentation + \"DATA(\" + name + `) = ${source.concatTokens()}.\\n`;\n }\n continue;\n }\n const type = found.getType().getQualifiedName() ? (_a = found.getType().getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toLowerCase() : found.getType().toABAP();\n ret += indentation + \"DATA \" + name + ` TYPE ${type}.\\n`;\n const source = f.findFirstExpression(Expressions.Source);\n if (source) {\n ret += indentation + name + ` = ${source.concatTokens()}.\\n`;\n }\n }\n return ret;\n }\n renameVariable(spag, name, pos, lowFile, highSyntax) {\n const newName = this.uniqueName(pos, lowFile.getFilename(), highSyntax);\n const fix = new SpagHelper(spag).renameVariable(name, pos, lowFile, newName);\n const issue = issue_1.Issue.atPosition(lowFile, pos, \"Rename before outline\", this.getMetadata().key, this.conf.severity, fix);\n throw new SkipToNextFile(issue);\n }\n findType(i, lowFile, highSyntax, ref = false) {\n var _a;\n const expr = i.findDirectExpression(Expressions.TypeNameOrInfer);\n if (expr === undefined) {\n return undefined;\n }\n const firstToken = expr.getFirstToken();\n const concat = expr.concatTokens().toLowerCase();\n if (concat !== \"#\") {\n return ref ? \"REF TO \" + concat : concat;\n }\n const spag = highSyntax.spaghetti.lookupPosition(firstToken.getStart(), lowFile.getFilename());\n if (spag === undefined) {\n return undefined;\n }\n let inferred = undefined;\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\n if (r.referenceType === _reference_1.ReferenceType.InferredType\n && r.resolved\n && r.position.getStart().equals(firstToken.getStart())\n && r.resolved instanceof _typed_identifier_1.TypedIdentifier) {\n inferred = r.resolved;\n break;\n }\n }\n if (inferred === undefined) {\n return undefined;\n }\n if (inferred.getType() instanceof basic_1.ObjectReferenceType) {\n return inferred.getType().toABAP();\n }\n else {\n return (_a = inferred.getType().getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toLowerCase();\n }\n }\n outlineFS(low, high, lowFile, highSyntax) {\n var _a, _b;\n if (!(low.get() instanceof _statement_1.Unknown)\n || (high.get() instanceof Statements.Loop)) {\n return undefined;\n }\n for (const i of high.findAllExpressionsRecursive(Expressions.InlineFS)) {\n const nameToken = (_a = i.findDirectExpression(Expressions.TargetFieldSymbol)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\n if (nameToken === undefined) {\n continue;\n }\n const name = nameToken.getStr();\n let type = \"\";\n if (high.concatTokens().toUpperCase().startsWith(\"APPEND INITIAL LINE TO \")) {\n type = \"LIKE LINE OF \" + ((_b = high.findFirstExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.concatTokens());\n }\n else {\n const spag = highSyntax.spaghetti.lookupPosition(nameToken.getStart(), lowFile.getFilename());\n if (spag === undefined) {\n continue;\n }\n const found = spag.findVariable(name);\n if (found === undefined) {\n continue;\n }\n else if (found.getType() instanceof basic_1.VoidType) {\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Error outlining voided type\", this.getMetadata().key, this.conf.severity);\n }\n type = \"TYPE \";\n type += found.getType().getQualifiedName() ? found.getType().getQualifiedName().toLowerCase() : found.getType().toABAP();\n }\n const code = `FIELD-SYMBOLS ${name} ${type}.\\n` +\n \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), name);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Outline FIELD-SYMBOL\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n outlineData(node, lowFile, highSyntax) {\n // hmm, no guard here, as DATA(SDF) is valid in 702\n var _a, _b;\n for (const i of node.findAllExpressionsRecursive(Expressions.InlineData)) {\n const nameToken = (_a = i.findDirectExpression(Expressions.TargetField)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\n if (nameToken === undefined) {\n continue;\n }\n const name = nameToken.getStr();\n const spag = highSyntax.spaghetti.lookupPosition(nameToken.getStart(), lowFile.getFilename());\n if (spag === undefined) {\n continue;\n }\n const found = spag.findVariable(name);\n if (found === undefined) {\n continue;\n }\n else if (found.getType() instanceof basic_1.VoidType && found.getType().getQualifiedName() === undefined) {\n continue;\n }\n let type = found.getType().getQualifiedName()\n ? (_b = found.getType().getQualifiedName()) === null || _b === void 0 ? void 0 : _b.toLowerCase()\n : found.getType().toABAP();\n if (found.getType() instanceof basic_1.ObjectReferenceType) {\n type = found.getType().toABAP();\n }\n if (type === \"\") {\n continue;\n }\n const code = `DATA ${name} TYPE ${type}.\\n` +\n \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), name);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Outline DATA\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n outlineCond(low, high, lowFile, highSyntax) {\n var _a, _b;\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n for (const i of high.findAllExpressionsRecursive(Expressions.Source)) {\n if (i.getFirstToken().getStr().toUpperCase() !== \"COND\") {\n continue;\n }\n const body = i.findDirectExpression(Expressions.CondBody);\n if (body === undefined) {\n continue;\n }\n const uniqueName = this.uniqueName(i.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n let type = this.findType(i, lowFile, highSyntax);\n if (type === undefined) {\n if (high.get() instanceof Statements.Move\n && high.findDirectExpression(Expressions.Source) === i\n && ((_a = high.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.TargetField)) !== undefined) {\n type = \"LIKE \" + ((_b = high.findDirectExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.concatTokens());\n }\n if (type === undefined) {\n continue;\n }\n }\n else {\n type = \"TYPE \" + type;\n }\n const indent = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n const bodyCode = this.buildCondBody(body, uniqueName, indent, lowFile, highSyntax);\n const last = i.findDirectTokenByText(\")\");\n const abap = `DATA ${uniqueName} ${type}.\\n` + bodyCode;\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), last.getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Downport COND\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n buildCondBody(body, uniqueName, indent, lowFile, highSyntax) {\n let code = \"\";\n let first = true;\n let addElse = true;\n for (const c of body.getChildren()) {\n if (c instanceof nodes_1.TokenNode) {\n switch (c.getFirstToken().getStr().toUpperCase()) {\n case \"WHEN\":\n if (first === true) {\n code += indent + \"IF \";\n first = false;\n }\n else {\n code += indent + \"ELSEIF \";\n }\n break;\n case \"THEN\":\n code += \".\\n\";\n break;\n case \"ELSE\":\n code += indent + \"ELSE.\\n\";\n addElse = false;\n break;\n default:\n throw \"buildCondBody, unexpected token\";\n }\n }\n else if (c.get() instanceof Expressions.Cond) {\n code += c.concatTokens();\n }\n else if (c.get() instanceof Expressions.Let) {\n code += this.outlineLet(c, indent, highSyntax, lowFile);\n }\n else if (c.get() instanceof Expressions.Source) {\n code += indent + \" \" + uniqueName + \" = \" + c.concatTokens() + \".\\n\";\n }\n else if (c.get() instanceof Expressions.Throw) {\n code += indent + \" \" + c.concatTokens().replace(/THROW /i, \"RAISE EXCEPTION NEW \") + \".\\n\";\n }\n else {\n throw \"buildCondBody, unexpected expression, \" + c.get().constructor.name;\n }\n }\n if (addElse) {\n // COND might be called inside a loop\n code += indent + \"ELSE.\\n\";\n code += indent + ` CLEAR ${uniqueName}.\\n`;\n }\n code += indent + \"ENDIF.\\n\";\n code += indent;\n return code;\n }\n outlineConv(low, high, lowFile, highSyntax) {\n var _a;\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n for (const i of high.findAllExpressionsRecursive(Expressions.Source)) {\n if (i.getFirstToken().getStr().toUpperCase() !== \"CONV\") {\n continue;\n }\n const end = i.findDirectTokenByText(\")\");\n if (end === undefined) {\n continue;\n }\n const body = (_a = i.findDirectExpression(Expressions.ConvBody)) === null || _a === void 0 ? void 0 : _a.concatTokens();\n if (body === undefined) {\n continue;\n }\n const uniqueName = this.uniqueName(i.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const type = this.findType(i, lowFile, highSyntax);\n const indent = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n const abap = `DATA ${uniqueName} TYPE ${type}.\\n` +\n indent + `${uniqueName} = ${body}.\\n` +\n indent;\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), end.getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Downport CONV\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n // \"CAST\" to \"?=\"\n outlineCast(low, high, lowFile, highSyntax) {\n var _a;\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n for (const i of high.findAllExpressionsRecursive(Expressions.Cast)) {\n const uniqueName = this.uniqueName(i.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const type = this.findType(i, lowFile, highSyntax, true);\n const body = (_a = i.findDirectExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();\n const abap = `DATA ${uniqueName} TYPE ${type}.\\n` +\n \" \".repeat(high.getFirstToken().getStart().getCol() - 1) +\n `${uniqueName} ?= ${body}.\\n` +\n \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Downport CAST\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n uniqueName(position, filename, highSyntax) {\n const spag = highSyntax.spaghetti.lookupPosition(position, filename);\n if (spag === undefined) {\n const name = \"temprr\" + this.counter;\n this.counter++;\n return name;\n }\n while (true) {\n const name = \"temp\" + this.counter;\n const exists = this.existsRecursive(spag, name);\n this.counter++;\n if (exists === false) {\n return name;\n }\n }\n }\n existsRecursive(spag, name) {\n const existsDirect = spag.findVariable(name);\n if (existsDirect) {\n return true;\n }\n for (const child of spag.getChildren()) {\n if (child.findVariable(name) || this.existsRecursive(child, name)) {\n return true;\n }\n }\n return false;\n }\n replaceXsdBool(node, lowFile, highSyntax) {\n const spag = highSyntax.spaghetti.lookupPosition(node.getFirstToken().getStart(), lowFile.getFilename());\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\n if (r.referenceType === _reference_1.ReferenceType.BuiltinMethodReference\n && r.position.getName().toUpperCase() === \"XSDBOOL\") {\n const token = r.position.getToken();\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, token.getStart(), token.getEnd(), \"boolc\");\n return issue_1.Issue.atToken(lowFile, token, \"Use BOOLC\", this.getMetadata().key, this.conf.severity, fix);\n }\n }\n return undefined;\n }\n findMethodCallExpression(node, token) {\n var _a;\n for (const m of node.findAllExpressions(Expressions.MethodCall)) {\n if ((_a = m.findDirectExpression(Expressions.MethodName)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStart().equals(token.getStart())) {\n return m;\n }\n }\n return undefined;\n }\n replaceMethodConditional(low, high, lowFile, highSyntax) {\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n for (const c of high.findAllExpressionsRecursive(Expressions.Compare)) {\n const chain = c.findDirectExpression(Expressions.MethodCallChain);\n if (chain === undefined) {\n continue;\n }\n const concat = chain.concatTokens().toUpperCase();\n if (concat.startsWith(\"LINE_EXISTS( \") || concat.startsWith(\"LINE_INDEX( \")) {\n // these are handled separately\n continue;\n }\n let predicate = false;\n const spag = highSyntax.spaghetti.lookupPosition(high.getFirstToken().getStart(), lowFile.getFilename());\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\n if (r.referenceType === _reference_1.ReferenceType.BuiltinMethodReference &&\n new _builtin_1.BuiltIn().isPredicate(chain.getFirstToken().getStr().toUpperCase())) {\n predicate = true;\n break;\n }\n }\n const end = chain.getLastToken().getEnd();\n let fix = edit_helper_1.EditHelper.insertAt(lowFile, end, \" IS NOT INITIAL\");\n if (predicate === true) {\n fix = edit_helper_1.EditHelper.insertAt(lowFile, end, \" ) = abap_true\");\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, chain.getFirstToken().getStart(), \"boolc( \");\n fix = edit_helper_1.EditHelper.merge(fix, fix1);\n }\n return issue_1.Issue.atToken(lowFile, chain.getFirstToken(), \"Downport method conditional\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n getReference(node, lowFile, _highSyntax) {\n var _a, _b, _c;\n if (!(node.get() instanceof Statements.GetReference)) {\n return undefined;\n }\n const inline = (_a = node.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.InlineData);\n if (inline === undefined) {\n return undefined;\n }\n const targetName = (_b = inline.findDirectExpression(Expressions.TargetField)) === null || _b === void 0 ? void 0 : _b.concatTokens();\n const sourceName = (_c = node.findDirectExpression(Expressions.Source)) === null || _c === void 0 ? void 0 : _c.concatTokens();\n if (targetName === undefined || sourceName === undefined) {\n return undefined;\n }\n const code = `DATA ${targetName} LIKE REF TO ${sourceName}.\\n`;\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, inline.getFirstToken().getStart(), inline.getLastToken().getEnd(), targetName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, inline.getFirstToken(), \"Downport, outline DATA ref\", this.getMetadata().key, this.conf.severity, fix);\n }\n replaceContains(node, lowFile, highSyntax) {\n const spag = highSyntax.spaghetti.lookupPosition(node.getFirstToken().getStart(), lowFile.getFilename());\n // only downport if its an single method call condition\n let found = false;\n for (const c of node.findAllExpressionsRecursive(Expressions.Compare)) {\n found = c.findDirectExpression(Expressions.MethodCallChain) !== undefined;\n if (found === true) {\n break;\n }\n }\n if (found === false) {\n return undefined;\n }\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\n if (r.referenceType !== _reference_1.ReferenceType.BuiltinMethodReference) {\n continue;\n }\n const func = r.position.getName().toUpperCase();\n if (func === \"CONTAINS\") {\n const token = r.position.getToken();\n const expression = this.findMethodCallExpression(node, token);\n if (expression === undefined) {\n continue;\n }\n const sList = expression.findAllExpressions(Expressions.Source).map(e => e.concatTokens());\n if (sList.length !== 2) {\n continue;\n }\n const code = sList[0] + \" CS \" + sList[1];\n const start = expression.getFirstToken().getStart();\n const end = expression.getLastToken().getEnd();\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);\n return issue_1.Issue.atToken(lowFile, token, \"Downport contains()\", this.getMetadata().key, this.conf.severity, fix);\n }\n }\n return undefined;\n }\n replaceLineFunctions(node, lowFile, highSyntax, highFile) {\n var _a, _b;\n const spag = highSyntax.spaghetti.lookupPosition(node.getFirstToken().getStart(), lowFile.getFilename());\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\n if (r.referenceType !== _reference_1.ReferenceType.BuiltinMethodReference) {\n continue;\n }\n const func = r.position.getName().toUpperCase();\n if (func === \"LINE_EXISTS\" || func === \"LINE_INDEX\") {\n const token = r.position.getToken();\n const expression = this.findMethodCallExpression(node, token);\n if (expression === undefined) {\n continue;\n }\n let condition = \"\";\n for (const c of ((_a = expression === null || expression === void 0 ? void 0 : expression.findFirstExpression(Expressions.TableExpression)) === null || _a === void 0 ? void 0 : _a.getChildren()) || []) {\n if (c.getFirstToken().getStr() === \"[\" || c.getFirstToken().getStr() === \"]\") {\n continue;\n }\n else if (c.get() instanceof Expressions.ComponentChainSimple && condition === \"\") {\n condition = \"WITH KEY \";\n }\n else if (c.get() instanceof Expressions.Source && condition === \"\") {\n condition = \"INDEX \";\n }\n condition += c.concatTokens() + \" \";\n }\n const tableName = (_b = expression.findFirstExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens().split(\"[\")[0];\n const uniqueName = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\n const sy = func === \"LINE_EXISTS\" ? \"sy-subrc\" : \"sy-tabix\";\n const code = `DATA ${uniqueName} LIKE sy-subrc.\\n` +\n indentation + `READ TABLE ${tableName} ${condition}TRANSPORTING NO FIELDS.\\n` +\n indentation + uniqueName + ` = ${sy}.\\n` +\n indentation;\n let insertAt = node.getFirstToken().getStart();\n if (node.get() instanceof statements_1.ElseIf) {\n // assumption: no side effects in IF conditions\n insertAt = this.findStartOfIf(node, highFile);\n if (insertAt === undefined) {\n continue;\n }\n }\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, insertAt, code);\n const start = expression.getFirstToken().getStart();\n const end = expression.getLastToken().getEnd();\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, uniqueName + (func === \"LINE_EXISTS\" ? \" = 0\" : \"\"));\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, token, \"Replace line function\", this.getMetadata().key, this.conf.severity, fix);\n }\n }\n return undefined;\n }\n findStartOfIf(node, highFile) {\n const structure = highFile.getStructure();\n for (const c of (structure === null || structure === void 0 ? void 0 : structure.findAllStructuresRecursive(Structures.If)) || []) {\n for (const ei of c.findDirectStructures(Structures.ElseIf)) {\n if (ei.getFirstStatement() === node) {\n return c.getFirstToken().getStart();\n }\n }\n }\n return undefined;\n }\n newToCreateObject(low, high, lowFile, highSyntax) {\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n const source = high.findDirectExpression(Expressions.Source);\n let fix = undefined;\n if (high.get() instanceof Statements.Move\n && source\n && source.getFirstToken().getStr().toUpperCase() === \"NEW\") {\n const target = high.findDirectExpression(Expressions.Target);\n const found = source === null || source === void 0 ? void 0 : source.findFirstExpression(Expressions.NewObject);\n // must be at top level of the source for quickfix to work(todo: handle more scenarios)\n if (target\n && found\n && source.concatTokens() === found.concatTokens()\n && target.findDirectExpression(Expressions.InlineData) === undefined) {\n const abap = this.newParameters(found, target.concatTokens(), highSyntax, lowFile);\n if (abap !== undefined) {\n fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), abap);\n }\n }\n }\n if (fix === undefined && high.findAllExpressions(Expressions.NewObject)) {\n const found = high.findFirstExpression(Expressions.NewObject);\n if (found === undefined) {\n return undefined;\n }\n const name = this.uniqueName(found.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const abap = this.newParameters(found, name, highSyntax, lowFile);\n if (abap === undefined) {\n return undefined;\n }\n const type = this.findType(found, lowFile, highSyntax);\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n const data = `DATA ${name} TYPE REF TO ${type}.\\n` +\n indentation + abap + \"\\n\" +\n indentation;\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), data);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, found.getFirstToken().getStart(), found.getLastToken().getEnd(), name);\n fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n }\n if (fix) {\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Use CREATE OBJECT instead of NEW\", this.getMetadata().key, this.conf.severity, fix);\n }\n else {\n return undefined;\n }\n }\n newParameters(found, name, highSyntax, lowFile) {\n var _a, _b, _c;\n const typeToken = (_a = found.findDirectExpression(Expressions.TypeNameOrInfer)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\n let extra = (typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStr()) === \"#\" ? \"\" : \" TYPE \" + (typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStr());\n const parameters = found.findFirstExpression(Expressions.ParameterListS);\n if (parameters) {\n extra = parameters ? extra + \" EXPORTING \" + parameters.concatTokens() : extra;\n }\n else if (typeToken) {\n const source = (_b = found.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens();\n if (source) {\n // find the default parameter name for the constructor\n const spag = highSyntax.spaghetti.lookupPosition(typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStart(), lowFile.getFilename());\n let cdef = undefined;\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\n if ((r.referenceType === _reference_1.ReferenceType.InferredType\n || r.referenceType === _reference_1.ReferenceType.ObjectOrientedReference)\n && r.resolved && r.position.getStart().equals(typeToken.getStart())) {\n cdef = r.resolved;\n }\n }\n if (cdef && cdef.getMethodDefinitions === undefined) {\n return undefined; // something wrong\n }\n const importing = (_c = cdef === null || cdef === void 0 ? void 0 : cdef.getMethodDefinitions().getByName(\"CONSTRUCTOR\")) === null || _c === void 0 ? void 0 : _c.getParameters().getDefaultImporting();\n if (importing) {\n extra += \" EXPORTING \" + importing + \" = \" + source;\n }\n else if (spag === undefined) {\n extra += \" SpagUndefined\";\n }\n else if (cdef === undefined) {\n extra += \" ClassDefinitionNotFound\";\n }\n else {\n extra += \" SomeError\";\n }\n }\n }\n const abap = `CREATE OBJECT ${name}${extra}.`;\n return abap;\n }\n}\nexports.Downport = Downport;\n//# sourceMappingURL=downport.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/downport.js?");
|
|
12317
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Downport = exports.DownportConf = void 0;\n/* eslint-disable max-len */\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\nconst Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\nconst registry_1 = __webpack_require__(/*! ../registry */ \"./node_modules/@abaplint/core/build/src/registry.js\");\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\nconst _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\nconst basic_1 = __webpack_require__(/*! ../abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\nconst config_1 = __webpack_require__(/*! ../config */ \"./node_modules/@abaplint/core/build/src/config.js\");\nconst tokens_1 = __webpack_require__(/*! ../abap/1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\nconst include_graph_1 = __webpack_require__(/*! ../utils/include_graph */ \"./node_modules/@abaplint/core/build/src/utils/include_graph.js\");\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\nconst _builtin_1 = __webpack_require__(/*! ../abap/5_syntax/_builtin */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_builtin.js\");\nconst _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\nconst statements_1 = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\n// todo: refactor each sub-rule to new classes?\n// todo: add configuration\nclass DownportConf extends _basic_rule_config_1.BasicRuleConfig {\n}\nexports.DownportConf = DownportConf;\nclass SkipToNextFile extends Error {\n constructor(issue) {\n super();\n this.issue = issue;\n }\n}\nclass SpagHelper {\n constructor(spag) {\n this.spag = spag;\n }\n renameVariable(oldName, pos, lowFile, newName) {\n let fix = undefined;\n const references = this.findReferences(oldName, pos);\n references.sort((a, b) => {\n if (a.start.equals(b.start)) {\n return 0;\n }\n return a.start.isAfter(b.start) ? 1 : -1;\n });\n for (const r of references) {\n const replace = edit_helper_1.EditHelper.replaceRange(lowFile, r.start, r.end, newName);\n if (fix === undefined) {\n fix = replace;\n }\n else {\n fix = edit_helper_1.EditHelper.merge(replace, fix);\n }\n }\n return fix;\n }\n findReferences(name, pos) {\n var _a, _b;\n const positions = [];\n function has(element) {\n return positions.some(a => a.start.equals(element.start));\n }\n for (const r of this.spag.getData().references) {\n if (((_a = r.resolved) === null || _a === void 0 ? void 0 : _a.getName()) === name && ((_b = r.resolved) === null || _b === void 0 ? void 0 : _b.getStart().equals(pos))) {\n const sub = {\n start: r.position.getStart(),\n end: r.position.getEnd(),\n };\n if (has(sub) === false) {\n positions.push(sub);\n }\n }\n }\n for (const child of this.spag.getChildren()) {\n const subPositions = new SpagHelper(child).findReferences(name, pos);\n for (const sub of subPositions) {\n if (has(sub) === false) {\n positions.push(sub);\n }\n }\n }\n return positions;\n }\n findRecursiveDuplicate(name, skip) {\n var _a;\n const found = this.spag.findVariable(name);\n if ((found === null || found === void 0 ? void 0 : found.getStart().equals(skip)) === false) {\n return found;\n }\n for (const child of ((_a = this.spag) === null || _a === void 0 ? void 0 : _a.getChildren()) || []) {\n const sub = new SpagHelper(child).findRecursiveDuplicate(name, skip);\n if (sub) {\n return sub;\n }\n }\n return undefined;\n }\n isDuplicateName(name, pos) {\n let parent = this.spag.getParent();\n while ((parent === null || parent === void 0 ? void 0 : parent.getIdentifier().stype) === _scope_type_1.ScopeType.Let\n || (parent === null || parent === void 0 ? void 0 : parent.getIdentifier().stype) === _scope_type_1.ScopeType.For) {\n parent = parent.getParent();\n }\n if (parent === undefined) {\n return undefined;\n }\n return new SpagHelper(parent).findRecursiveDuplicate(name, pos) !== undefined;\n }\n}\nclass Downport {\n constructor() {\n this.conf = new DownportConf();\n }\n getMetadata() {\n return {\n key: \"downport\",\n title: \"Downport statement\",\n shortDescription: `Downport functionality`,\n extendedInformation: `Much like the 'commented_code' rule this rule loops through unknown statements and tries parsing with\r\na higher level language version. If successful, various rules are applied to downport the statement.\r\nTarget downport version is always v702, thus rule is only enabled if target version is v702.\r\n\r\nCurrent rules:\r\n* NEW transformed to CREATE OBJECT, opposite of https://rules.abaplint.org/use_new/\r\n* DATA() definitions are outlined, opposite of https://rules.abaplint.org/prefer_inline/\r\n* FIELD-SYMBOL() definitions are outlined\r\n* CONV is outlined\r\n* COND is outlined\r\n* REDUCE is outlined\r\n* SWITCH is outlined\r\n* FILTER is outlined\r\n* APPEND expression is outlined\r\n* INSERT expression is outlined\r\n* EMPTY KEY is changed to DEFAULT KEY, opposite of DEFAULT KEY in https://rules.abaplint.org/avoid_use/\r\n* CAST changed to ?=\r\n* LOOP AT method_call( ) is outlined\r\n* VALUE # with structure fields\r\n* VALUE # with internal table lines\r\n* Table Expressions are outlined\r\n* SELECT INTO @DATA definitions are outlined\r\n* Some occurrences of string template formatting option ALPHA changed to function module call\r\n* SELECT/INSERT/MODIFY/DELETE/UPDATE \",\" in field list removed, \"@\" in source/targets removed\r\n* PARTIALLY IMPLEMENTED removed, it can be quick fixed via rule implement_methods\r\n* RAISE EXCEPTION ... MESSAGE\r\n* Moving with +=, -=, /=, *=, &&= is expanded\r\n* line_exists and line_index is downported to READ TABLE\r\n* ENUMs, but does not nessesarily give the correct type and value\r\n* MESSAGE with non simple source\r\n\r\nOnly one transformation is applied to a statement at a time, so multiple steps might be required to do the full downport.`,\n tags: [_irule_1.RuleTag.Downport, _irule_1.RuleTag.Quickfix],\n };\n }\n getConfig() {\n return this.conf;\n }\n setConfig(conf) {\n this.conf = conf;\n }\n initialize(reg) {\n this.lowReg = reg;\n const version = this.lowReg.getConfig().getVersion();\n if (version === version_1.Version.v702 || version === version_1.Version.OpenABAP) {\n this.initHighReg();\n }\n return this;\n }\n listMainForInclude(filename) {\n if (filename === undefined) {\n return [];\n }\n // only initialize this.graph if needed\n if (this.graph === undefined) {\n this.graph = new include_graph_1.IncludeGraph(this.lowReg);\n }\n return this.graph.listMainForInclude(filename);\n }\n containsError(highObj) {\n for (const file of highObj.getABAPFiles()) {\n for (const statement of file.getStatements()) {\n if (statement.get() instanceof _statement_1.Unknown) {\n return true; // contains parser errors\n }\n }\n if (file.getStructure() === undefined) {\n return true;\n }\n }\n return false;\n }\n run(lowObj) {\n var _a;\n const ret = [];\n this.counter = 1;\n const version = this.lowReg.getConfig().getVersion();\n if (version !== version_1.Version.v702 && version !== version_1.Version.OpenABAP) {\n return ret;\n }\n else if (!(lowObj instanceof _abap_object_1.ABAPObject)) {\n return ret;\n }\n const highObj = this.highReg.getObject(lowObj.getType(), lowObj.getName());\n if (highObj === undefined || !(highObj instanceof _abap_object_1.ABAPObject)) {\n return ret;\n }\n let highSyntaxObj = highObj;\n if (this.containsError(highObj)) {\n return ret;\n }\n // for includes do the syntax check via a main program\n if (lowObj instanceof objects_1.Program && lowObj.isInclude()) {\n const mains = this.listMainForInclude((_a = lowObj.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getFilename());\n if (mains.length <= 0) {\n return [];\n }\n const f = this.highReg.getFileByName(mains[0]);\n if (f === undefined) {\n return [];\n }\n highSyntaxObj = this.highReg.findObjectForFile(f);\n }\n for (const lowFile of lowObj.getABAPFiles()) {\n let highSyntax = undefined;\n const highFile = highObj.getABAPFileByName(lowFile.getFilename());\n if (highFile === undefined) {\n continue;\n }\n const lowStatements = lowFile.getStatements();\n const highStatements = highFile.getStatements();\n if (lowStatements.length !== highStatements.length) {\n // after applying a fix, there might be more statements in lowFile\n // should highReg be initialized again?\n /*\n const message = \"Internal Error: Statement lengths does not match\";\n ret.push(Issue.atStatement(lowFile, lowStatements[0], message, this.getMetadata().key));\n */\n // hmm, add some way to disable lazyUnknown() in statement_parser.ts\n // alternatively explicit enable it in vscode, its only relevant when a user is\n // actively editing the files\n continue;\n }\n if (highSyntax === undefined) {\n highSyntax = new syntax_1.SyntaxLogic(this.highReg, highSyntaxObj).run();\n }\n let containsUnknown = false;\n for (let i = 0; i < lowStatements.length; i++) {\n const low = lowStatements[i];\n const high = highStatements[i];\n if ((low.get() instanceof _statement_1.Unknown && !(high.get() instanceof _statement_1.Unknown))\n || high.findFirstExpression(Expressions.InlineData)) {\n containsUnknown = true;\n try {\n const issue = this.checkStatement(low, high, lowFile, highSyntax, highFile);\n if (issue) {\n ret.push(issue);\n }\n }\n catch (e) {\n if (e instanceof SkipToNextFile) {\n ret.push(e.issue);\n break;\n }\n else {\n throw e;\n }\n }\n }\n }\n if (ret.length === 0 && containsUnknown) {\n // this is a hack in order not to change too many unit tests\n for (let i = 0; i < lowStatements.length; i++) {\n const high = highStatements[i];\n if (high.get() instanceof Statements.Data) {\n const issue = this.anonymousTableType(high, lowFile, highSyntax);\n if (issue) {\n ret.push(issue);\n }\n }\n }\n }\n else if (ret.length === 0 && / xsdbool\\(/i.test(lowFile.getRaw())) {\n for (let i = 0; i < lowStatements.length; i++) {\n const high = highStatements[i];\n const issue = this.replaceXsdBool(high, lowFile, highSyntax);\n if (issue) {\n ret.push(issue);\n break;\n }\n }\n }\n }\n return ret;\n }\n ////////////////////\n /** clones the orginal repository into highReg, and parses it with higher language version */\n initHighReg() {\n // use default configuration, ie. default target version\n const highConfig = config_1.Config.getDefault().get();\n const lowConfig = this.lowReg.getConfig().get();\n highConfig.syntax.errorNamespace = lowConfig.syntax.errorNamespace;\n highConfig.syntax.globalConstants = lowConfig.syntax.globalConstants;\n highConfig.syntax.globalMacros = lowConfig.syntax.globalMacros;\n this.highReg = new registry_1.Registry();\n for (const o of this.lowReg.getObjects()) {\n for (const f of o.getFiles()) {\n if (this.lowReg.isDependency(o) === true) {\n this.highReg.addDependency(f);\n }\n else {\n this.highReg.addFile(f);\n }\n }\n }\n this.highReg.parse();\n }\n /** applies one rule at a time, multiple iterations are required to transform complex statements */\n checkStatement(low, high, lowFile, highSyntax, highFile) {\n if (low.getFirstToken().getStart() instanceof position_1.VirtualPosition) {\n return undefined;\n }\n // downport XSDBOOL() early, as it is valid 702 syntax\n let found = this.replaceXsdBool(high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.downportEnum(low, high, lowFile, highSyntax, highFile);\n if (found) {\n return found;\n }\n found = this.partiallyImplemented(high, lowFile);\n if (found) {\n return found;\n }\n found = this.raiseException(high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.emptyKey(low, high, lowFile);\n if (found) {\n return found;\n }\n found = this.stringTemplateAlpha(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.moveWithOperator(low, high, lowFile);\n if (found) {\n return found;\n }\n found = this.moveWithSimpleValue(low, high, lowFile);\n if (found) {\n return found;\n }\n found = this.assignWithTable(low, high, lowFile);\n if (found) {\n return found;\n }\n found = this.downportRefSimple(high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.downportCorrespondingSimple(high, lowFile);\n if (found) {\n return found;\n }\n found = this.downportRef(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.downportLoopGroup(high, lowFile, highSyntax, highFile);\n if (found) {\n return found;\n }\n found = this.callFunctionParameterSimple(high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.moveWithTableTarget(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.downportSelectInline(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.downportSQLExtras(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.outlineLoopInput(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.outlineLoopTarget(high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n let skipValue = false;\n let skipReduce = false;\n const valueBody = high.findFirstExpression(Expressions.ValueBody);\n const reduceBody = high.findFirstExpression(Expressions.ReduceBody);\n if (valueBody && reduceBody) {\n const valueToken = valueBody.getFirstToken();\n const reduceToken = reduceBody.getFirstToken();\n if (valueToken.getStart().isBefore(reduceToken.getStart())) {\n skipReduce = true;\n }\n else {\n skipValue = true;\n }\n }\n if (skipValue !== true) {\n found = this.outlineValue(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n }\n if (skipReduce !== true) {\n found = this.outlineReduce(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n }\n found = this.outlineSwitch(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.outlineFilter(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.outlineCast(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.outlineConv(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.outlineCond(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.outlineCatchSimple(high, lowFile);\n if (found) {\n return found;\n }\n found = this.outlineGetReferenceSimple(high, lowFile);\n if (found) {\n return found;\n }\n found = this.outlineDataSimple(high, lowFile);\n if (found) {\n return found;\n }\n found = this.outlineData(high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.outlineFS(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.newToCreateObject(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.replaceLineFunctions(high, lowFile, highSyntax, highFile);\n if (found) {\n return found;\n }\n found = this.getReference(high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.replaceContains(high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.replaceMethodConditional(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.replaceTableExpression(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.replaceAppendExpression(high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.replaceInsertExpression(high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.downportMessage(high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n return undefined;\n }\n //////////////////////////////////////////\n downportSQLExtras(low, high, lowFile, highSyntax) {\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n if (!(high.get() instanceof Statements.Select)\n && !(high.get() instanceof Statements.SelectLoop)\n && !(high.get() instanceof Statements.UpdateDatabase)\n && !(high.get() instanceof Statements.ModifyDatabase)\n && !(high.get() instanceof Statements.DeleteDatabase)\n && !(high.get() instanceof Statements.InsertDatabase)) {\n return undefined;\n }\n let fix = undefined;\n const addFix = (token) => {\n const add = edit_helper_1.EditHelper.deleteToken(lowFile, token);\n if (fix === undefined) {\n fix = add;\n }\n else {\n fix = edit_helper_1.EditHelper.merge(fix, add);\n }\n };\n const candidates = [high.findAllExpressionsRecursive(Expressions.SQLTarget),\n high.findAllExpressionsRecursive(Expressions.SQLSource),\n high.findAllExpressionsRecursive(Expressions.SQLSourceSimple)].flat();\n for (const c of candidates.reverse()) {\n if (c.getFirstToken() instanceof tokens_1.WAt\n || c.getFirstToken() instanceof tokens_1.At) {\n const tokens = c.getAllTokens();\n if (tokens[1] instanceof tokens_1.ParenLeftW && tokens[tokens.length - 1] instanceof tokens_1.WParenRightW) {\n const source = c.findDirectExpression(Expressions.Source);\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `DATA(${uniqueName}) = ${source === null || source === void 0 ? void 0 : source.concatTokens()}.\\n`);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, c.getFirstToken().getStart(), c.getLastToken().getEnd(), \"@\" + uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, low.getFirstToken(), \"SQL, outline complex @\", this.getMetadata().key, this.conf.severity, fix);\n }\n else {\n addFix(c.getFirstToken());\n }\n }\n }\n for (const fieldList of high.findAllExpressionsMulti([Expressions.SQLFieldList, Expressions.SQLFieldListLoop], true)) {\n for (const token of fieldList.getDirectTokens()) {\n if (token.getStr() === \",\") {\n addFix(token);\n }\n }\n }\n if (fix !== undefined) {\n return issue_1.Issue.atToken(lowFile, low.getFirstToken(), \"SQL, remove @ and ,\", this.getMetadata().key, this.conf.severity, fix);\n }\n for (const c of high.findAllExpressionsRecursive(Expressions.SQLIn)) {\n const children = c.getChildren();\n const first = children[1];\n if (!(first.get() instanceof tokens_1.WParenLeftW)) {\n continue;\n }\n const last = children[children.length - 1];\n if (last.get() instanceof tokens_1.WParenRightW || last.get() instanceof tokens_1.WParenRight) {\n const firstEnd = first.getFirstToken().getEnd();\n const endDelete = new position_1.Position(firstEnd.getRow(), firstEnd.getCol() + 1);\n const fix1 = edit_helper_1.EditHelper.deleteRange(lowFile, firstEnd, endDelete);\n const lastStart = last.getFirstToken().getStart();\n const startDelete = new position_1.Position(lastStart.getRow(), lastStart.getCol() - 1);\n const fix2 = edit_helper_1.EditHelper.deleteRange(lowFile, startDelete, lastStart);\n fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, low.getFirstToken(), \"SQL, remove spaces\", this.getMetadata().key, this.conf.severity, fix);\n }\n }\n return undefined;\n }\n downportSelectInline(low, high, lowFile, highSyntax) {\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n else if (!(high.get() instanceof Statements.Select) && !(high.get() instanceof Statements.SelectLoop)) {\n return undefined;\n }\n // as first step outline the @DATA, note that void types are okay, as long the field names are specified\n let found = this.downportSelectSingleInline(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n found = this.downportSelectTableInline(low, high, lowFile, highSyntax);\n if (found) {\n return found;\n }\n return undefined;\n }\n downportSelectSingleInline(low, high, lowFile, _highSyntax) {\n var _a, _b, _c, _d;\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n const targets = ((_a = high.findFirstExpression(Expressions.SQLIntoStructure)) === null || _a === void 0 ? void 0 : _a.findDirectExpressions(Expressions.SQLTarget)) || [];\n if (targets.length !== 1) {\n return undefined;\n }\n const inlineData = targets[0].findFirstExpression(Expressions.InlineData);\n if (inlineData === undefined) {\n return undefined;\n }\n const sqlFrom = high.findAllExpressions(Expressions.SQLFromSource);\n if (sqlFrom.length !== 1) {\n return undefined;\n }\n const tableName = (_b = sqlFrom[0].findDirectExpression(Expressions.DatabaseTable)) === null || _b === void 0 ? void 0 : _b.concatTokens();\n if (tableName === undefined) {\n return undefined;\n }\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n let fieldList = high.findFirstExpression(Expressions.SQLFieldList);\n if (fieldList === undefined) {\n fieldList = high.findFirstExpression(Expressions.SQLFieldListLoop);\n }\n if (fieldList === undefined) {\n return undefined;\n }\n let fieldDefinition = \"\";\n const fields = fieldList.findAllExpressions(Expressions.SQLFieldName);\n const name = ((_c = inlineData.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || \"error\";\n if (fields.length === 1) {\n fieldDefinition = `DATA ${name} TYPE ${tableName}-${fields[0].concatTokens()}.`;\n }\n else if (fieldList.concatTokens() === \"*\") {\n fieldDefinition = `DATA ${name} TYPE ${tableName}.`;\n }\n else if (fieldList.concatTokens().toUpperCase() === \"COUNT( * )\") {\n fieldDefinition = `DATA ${name} TYPE i.`;\n }\n else if (fieldList.getChildren().length === 1 && fieldList.getChildren()[0].get() instanceof Expressions.SQLAggregation) {\n const c = fieldList.getChildren()[0];\n if (c instanceof nodes_1.ExpressionNode) {\n const concat = (_d = c.findFirstExpression(Expressions.SQLArithmetics)) === null || _d === void 0 ? void 0 : _d.concatTokens();\n fieldDefinition = `DATA ${name} TYPE ${tableName}-${concat}.`;\n }\n }\n else {\n for (const f of fields) {\n const fieldName = f.concatTokens();\n fieldDefinition += indentation + \" \" + fieldName + \" TYPE \" + tableName + \"-\" + fieldName + \",\\n\";\n }\n fieldDefinition = `DATA: BEGIN OF ${name},\r\n${fieldDefinition}${indentation} END OF ${name}.`;\n }\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `${fieldDefinition}\r\n${indentation}`);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, inlineData.getFirstToken().getStart(), inlineData.getLastToken().getEnd(), name);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, inlineData.getFirstToken(), \"Outline SELECT @DATA\", this.getMetadata().key, this.conf.severity, fix);\n }\n downportSelectTableInline(low, high, lowFile, highSyntax) {\n var _a, _b, _c;\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n const targets = ((_a = high.findFirstExpression(Expressions.SQLIntoTable)) === null || _a === void 0 ? void 0 : _a.findDirectExpressions(Expressions.SQLTarget)) || [];\n if (targets.length !== 1) {\n return undefined;\n }\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n const inlineData = targets[0].findFirstExpression(Expressions.InlineData);\n if (inlineData === undefined) {\n return undefined;\n }\n const sqlFrom = high.findAllExpressions(Expressions.SQLFromSource);\n if (sqlFrom.length === 0) {\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Error outlining, sqlFrom not found\", this.getMetadata().key, this.conf.severity);\n }\n let tableName = (_b = sqlFrom[0].findDirectExpression(Expressions.DatabaseTable)) === null || _b === void 0 ? void 0 : _b.concatTokens();\n if (tableName === undefined) {\n return undefined;\n }\n const fieldList = high.findFirstExpression(Expressions.SQLFieldList);\n if (fieldList === undefined) {\n return undefined;\n }\n let fieldDefinitions = \"\";\n for (const f of fieldList.findAllExpressions(Expressions.SQLFieldName)) {\n let fieldName = f.concatTokens();\n if (fieldName.includes(\"~\")) {\n const split = fieldName.split(\"~\");\n tableName = split[0];\n fieldName = split[1];\n }\n fieldDefinitions += indentation + \" \" + fieldName + \" TYPE \" + tableName + \"-\" + fieldName + \",\\n\";\n }\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const name = ((_c = inlineData.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || \"error\";\n let fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `TYPES: BEGIN OF ${uniqueName},\r\n${fieldDefinitions}${indentation} END OF ${uniqueName}.\r\n${indentation}DATA ${name} TYPE STANDARD TABLE OF ${uniqueName} WITH DEFAULT KEY.\r\n${indentation}`);\n if (fieldDefinitions === \"\") {\n fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `DATA ${name} TYPE STANDARD TABLE OF ${tableName} WITH DEFAULT KEY.\r\n${indentation}`);\n }\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, inlineData.getFirstToken().getStart(), inlineData.getLastToken().getEnd(), name);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, inlineData.getFirstToken(), \"Outline SELECT @DATA\", this.getMetadata().key, this.conf.severity, fix);\n }\n // the anonymous type minght be used in inferred type statements, define it so it can be referred\n anonymousTableType(high, lowFile, highSyntax) {\n if (!(high.get() instanceof Statements.Data)) {\n return undefined;\n }\n const tt = high.findFirstExpression(Expressions.TypeTable);\n if (tt === undefined) {\n return undefined;\n }\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const code = `TYPES ${uniqueName} ${tt.concatTokens()}.\\n`;\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), code);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, tt.getFirstToken().getStart(), tt.getLastToken().getEnd(), \"TYPE \" + uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Add type for table definition\", this.getMetadata().key, this.conf.severity, fix);\n }\n downportMessage(high, lowFile, highSyntax) {\n var _a, _b;\n if (!(high.get() instanceof Statements.Message)) {\n return undefined;\n }\n const foundWith = high.findExpressionAfterToken(\"WITH\");\n if (foundWith === undefined) {\n return undefined;\n }\n const likeSource = high.findExpressionAfterToken(\"LIKE\");\n for (const s of high.findAllExpressions(Expressions.Source)) {\n if (s === likeSource) {\n continue;\n }\n else if (s.getChildren().length === 1 && ((_a = s.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.Constant) {\n continue;\n }\n else if (s.getChildren().length === 1 && ((_b = s.getFirstChild()) === null || _b === void 0 ? void 0 : _b.get()) instanceof Expressions.FieldChain) {\n continue;\n }\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n const firstToken = high.getFirstToken();\n const code = `DATA(${uniqueName}) = ${s.concatTokens()}.\\n${indentation}`;\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), code);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, s.getFirstToken().getStart(), s.getLastToken().getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Refactor MESSAGE WITH source\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n replaceAppendExpression(high, lowFile, highSyntax) {\n if (!(high.get() instanceof Statements.Append)) {\n return undefined;\n }\n const children = high.getChildren();\n if (children[1].get() instanceof Expressions.Source) {\n const source = children[1];\n const target = high.findDirectExpression(Expressions.Target);\n if (target === undefined) {\n return undefined;\n }\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n const firstToken = high.getFirstToken();\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${target === null || target === void 0 ? void 0 : target.concatTokens()}.\r\n${indentation}${uniqueName} = ${source.concatTokens()}.\\n${indentation}`);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Outline APPEND source expression\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n replaceInsertExpression(high, lowFile, highSyntax) {\n if (!(high.get() instanceof Statements.InsertInternal)) {\n return undefined;\n }\n const children = high.getChildren();\n if (children[1].get() instanceof Expressions.Source) {\n const source = children[1];\n const target = high.findDirectExpression(Expressions.Target);\n if (target === undefined) {\n return undefined;\n }\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n const firstToken = high.getFirstToken();\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${target === null || target === void 0 ? void 0 : target.concatTokens()}.\r\n${indentation}${uniqueName} = ${source.concatTokens()}.\\n${indentation}`);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Outline INSERT source expression\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n replaceTableExpression(low, high, lowFile, highSyntax) {\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n for (const fieldChain of high.findAllExpressionsRecursive(Expressions.FieldChain)) {\n const tableExpression = fieldChain.findDirectExpression(Expressions.TableExpression);\n if (tableExpression === undefined) {\n continue;\n }\n const concat = high.concatTokens().toUpperCase();\n if (concat.includes(\" LINE_EXISTS( \") || concat.includes(\" LINE_INDEX( \")) {\n // note: line_exists() must be replaced before handling table expressions\n continue;\n }\n let pre = \"\";\n let startToken = undefined;\n for (const child of fieldChain.getChildren()) {\n if (startToken === undefined) {\n startToken = child.getFirstToken();\n }\n else if (child === tableExpression) {\n break;\n }\n pre += child.concatTokens();\n }\n if (startToken === undefined) {\n continue;\n }\n const condition = this.tableCondition(tableExpression);\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const tabixBackup = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n const firstToken = high.getFirstToken();\n // note that the tabix restore should be done before throwing the exception\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${pre}.\r\n${indentation}DATA ${tabixBackup} LIKE sy-tabix.\r\n${indentation}${tabixBackup} = sy-tabix.\r\n${indentation}READ TABLE ${pre} ${condition}INTO ${uniqueName}.\r\n${indentation}sy-tabix = ${tabixBackup}.\r\n${indentation}IF sy-subrc <> 0.\r\n${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.\r\n${indentation}ENDIF.\r\n${indentation}`);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, startToken.getStart(), tableExpression.getLastToken().getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Outline table expression\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n tableCondition(tableExpression) {\n let condition = \"\";\n let keyName = \"\";\n for (const c of tableExpression.getChildren() || []) {\n if (c.getFirstToken().getStr() === \"[\" || c.getFirstToken().getStr() === \"]\") {\n continue;\n }\n else if (c.get() instanceof Expressions.ComponentChainSimple && condition === \"\") {\n if (keyName === \"\") {\n condition = \"WITH KEY \";\n }\n else {\n condition = \"WITH TABLE KEY \" + keyName + \" COMPONENTS \";\n }\n }\n else if (c.get() instanceof Expressions.Source && condition === \"\") {\n condition = \"INDEX \";\n }\n else if (c instanceof nodes_1.TokenNode && c.getFirstToken().getStr().toUpperCase() === \"KEY\") {\n continue;\n }\n else if (c.get() instanceof Expressions.SimpleName) {\n keyName = c.concatTokens();\n continue;\n }\n condition += c.concatTokens() + \" \";\n }\n return condition;\n }\n outlineCatchSimple(node, lowFile) {\n // outlines \"CATCH cx_bcs INTO DATA(lx_bcs_excep).\", note that this does not need to look at types\n var _a, _b;\n if (!(node.get() instanceof Statements.Catch)) {\n return undefined;\n }\n const target = node.findFirstExpression(Expressions.Target);\n if (!(((_a = target === null || target === void 0 ? void 0 : target.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.InlineData)) {\n return undefined;\n }\n const classNames = node.findDirectExpressions(Expressions.ClassName);\n if (classNames.length !== 1) {\n return undefined;\n }\n const className = classNames[0].concatTokens();\n const targetName = (_b = target.findFirstExpression(Expressions.TargetField)) === null || _b === void 0 ? void 0 : _b.concatTokens();\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\n const code = ` DATA ${targetName} TYPE REF TO ${className}.\r\n${indentation}CATCH ${className} INTO ${targetName}.`;\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getStart(), node.getEnd(), code);\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Outline DATA\", this.getMetadata().key, this.conf.severity, fix);\n }\n outlineGetReferenceSimple(node, lowFile) {\n var _a, _b, _c;\n if (!(node.get() instanceof Statements.GetReference)) {\n return undefined;\n }\n const target = node.findFirstExpression(Expressions.Target);\n if (!(((_a = target === null || target === void 0 ? void 0 : target.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.InlineData)) {\n return undefined;\n }\n const source = node.findFirstExpression(Expressions.Source);\n if (!(((_b = source === null || source === void 0 ? void 0 : source.getFirstChild()) === null || _b === void 0 ? void 0 : _b.get()) instanceof Expressions.FieldChain)) {\n return undefined;\n }\n const targetName = ((_c = target.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || \"errorError\";\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\n const firstToken = target.getFirstToken();\n const lastToken = target.getLastToken();\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getStart(), `DATA ${targetName} LIKE REF TO ${source.concatTokens()}.\\n${indentation}`);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), lastToken.getEnd(), targetName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Outline DATA\", this.getMetadata().key, this.conf.severity, fix);\n }\n outlineDataSimple(node, lowFile) {\n // outlines \"DATA(ls_msg) = temp1.\", note that this does not need to look at types\n var _a, _b, _c;\n if (!(node.get() instanceof Statements.Move)) {\n return undefined;\n }\n const target = node.findFirstExpression(Expressions.Target);\n if (!(((_a = target === null || target === void 0 ? void 0 : target.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.InlineData)) {\n return undefined;\n }\n let type = \"\";\n const source = node.findFirstExpression(Expressions.Source);\n if (source === undefined) {\n return undefined;\n }\n else if (source.getChildren().length !== 1) {\n return undefined;\n }\n else if (!(((_b = source.getFirstChild()) === null || _b === void 0 ? void 0 : _b.get()) instanceof Expressions.FieldChain)) {\n return undefined;\n }\n else if (source.findFirstExpression(Expressions.FieldOffset)) {\n return undefined;\n }\n else if (source.findFirstExpression(Expressions.FieldLength)) {\n return undefined;\n }\n else if (source.findFirstExpression(Expressions.TableExpression)) {\n const chain = source.findDirectExpression(Expressions.FieldChain);\n if (chain !== undefined\n && chain.getChildren().length === 2\n && chain.getChildren()[0].get() instanceof Expressions.SourceField\n && chain.getChildren()[1].get() instanceof Expressions.TableExpression) {\n type = \"LINE OF \" + chain.getChildren()[0].concatTokens();\n }\n else {\n return undefined;\n }\n }\n else {\n type = source.concatTokens();\n }\n const targetName = (_c = target.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens();\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\n const firstToken = node.getFirstToken();\n const lastToken = node.getLastToken();\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${targetName} LIKE ${type}.\\n${indentation}`);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), lastToken.getEnd(), `${targetName} = ${source.concatTokens()}.`);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Outline DATA\", this.getMetadata().key, this.conf.severity, fix);\n }\n partiallyImplemented(node, lowFile) {\n if (node.get() instanceof Statements.InterfaceDef) {\n const partially = node.findDirectTokenByText(\"PARTIALLY\");\n if (partially === undefined) {\n return undefined;\n }\n const implemented = node.findDirectTokenByText(\"IMPLEMENTED\");\n if (implemented === undefined) {\n return undefined;\n }\n const fix = edit_helper_1.EditHelper.deleteRange(lowFile, partially.getStart(), implemented.getEnd());\n return issue_1.Issue.atToken(lowFile, partially, \"Downport PARTIALLY IMPLEMENTED\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n raiseException(node, lowFile, highSyntax) {\n /*\n Note: IF_T100_DYN_MSG does not exist in 702, so this rule is mostly relevant for the transpiler\n \n DATA foo LIKE if_t100_message=>t100key.\n foo-msgid = 'ZHVAM'.\n foo-msgno = '001'.\n foo-attr1 = 'IF_T100_DYN_MSG~MSGV1'.\n foo-attr2 = 'IF_T100_DYN_MSG~MSGV2'.\n foo-attr3 = 'IF_T100_DYN_MSG~MSGV3'.\n foo-attr4 = 'IF_T100_DYN_MSG~MSGV4'.\n DATA bar TYPE REF TO zcl_hvam_exception.\n CREATE OBJECT bar EXPORTING textid = foo.\n bar->if_t100_dyn_msg~msgty = 'E'.\n bar->if_t100_dyn_msg~msgv1 = 'abc'.\n bar->if_t100_dyn_msg~msgv2 = 'abc'.\n bar->if_t100_dyn_msg~msgv3 = 'abc'.\n bar->if_t100_dyn_msg~msgv4 = 'abc'.\n RAISE EXCEPTION bar.\n */\n var _a, _b, _c;\n if (!(node.get() instanceof Statements.Raise)) {\n return undefined;\n }\n let id = undefined;\n let number = undefined;\n let startToken = node.findDirectTokenByText(\"ID\");\n if (startToken) {\n const sources = node.findDirectExpressions(Expressions.Source);\n id = sources[0].concatTokens();\n const numberExpression = node.findExpressionAfterToken(\"NUMBER\");\n if (numberExpression === undefined) {\n throw \"downport raiseException, could not find number\";\n }\n number = numberExpression.concatTokens();\n if (numberExpression.get() instanceof Expressions.MessageNumber) {\n number = \"'\" + number + \"'\";\n }\n }\n else {\n const s = node.findDirectExpression(Expressions.MessageSource);\n if (s === undefined) {\n return undefined;\n }\n id = \"'\" + ((_a = s.findDirectExpression(Expressions.MessageClass)) === null || _a === void 0 ? void 0 : _a.concatTokens()) + \"'\";\n number = \"'\" + ((_b = s.findDirectExpression(Expressions.MessageTypeAndNumber)) === null || _b === void 0 ? void 0 : _b.concatTokens().substring(1)) + \"'\";\n startToken = node.getFirstToken();\n }\n const className = ((_c = node.findDirectExpression(Expressions.ClassName)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || \"ERROR\";\n const uniqueName1 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const uniqueName2 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\n const abap = `DATA ${uniqueName1} LIKE if_t100_message=>t100key.\r\n${indentation}${uniqueName1}-msgid = ${id === null || id === void 0 ? void 0 : id.toUpperCase()}.\r\n${indentation}${uniqueName1}-msgno = ${number}.\r\n${indentation}DATA ${uniqueName2} TYPE REF TO ${className}.\r\n${indentation}CREATE OBJECT ${uniqueName2} EXPORTING textid = ${uniqueName1}.\r\n${indentation}RAISE EXCEPTION ${uniqueName2}.`;\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getStart(), node.getEnd(), abap);\n return issue_1.Issue.atToken(lowFile, startToken, \"Downport RAISE MESSAGE\", this.getMetadata().key, this.conf.severity, fix);\n }\n emptyKey(low, node, lowFile) {\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n for (let i of node.findAllExpressions(Expressions.TypeTable)) {\n const key = i.findDirectExpression(Expressions.TypeTableKey);\n if (key === undefined) {\n continue;\n }\n i = key;\n const concat = i.concatTokens();\n if (concat.toUpperCase().includes(\"WITH EMPTY KEY\") === false) {\n continue;\n }\n const token = i.findDirectTokenByText(\"EMPTY\");\n if (token === undefined) {\n continue;\n }\n const fix = edit_helper_1.EditHelper.replaceToken(lowFile, token, \"DEFAULT\");\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Downport EMPTY KEY\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n callFunctionParameterSimple(high, lowFile, highSyntax) {\n if (!(high.get() instanceof Statements.CallFunction)) {\n return undefined;\n }\n let found = undefined;\n for (const p of high.findAllExpressions(Expressions.FunctionExportingParameter)) {\n found = p.findDirectExpression(Expressions.Source);\n if (found && (found.findDirectExpression(Expressions.FieldChain)\n || found.findDirectExpression(Expressions.Constant)\n || found.findDirectExpression(Expressions.TextElement))) {\n // its actually simple, ok\n found = undefined;\n }\n else if (found !== undefined) {\n break;\n }\n }\n if (found === undefined) {\n return undefined;\n }\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const code = `DATA(${uniqueName}) = ${found.concatTokens()}.\\n`;\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, found.getFirstToken().getStart(), found.getLastToken().getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, call function parameter\", this.getMetadata().key, this.conf.severity, fix);\n }\n downportCorrespondingSimple(high, lowFile) {\n var _a, _b;\n if (!(high.get() instanceof Statements.Move)\n || high.getChildren().length !== 4\n || high.getChildren()[2].getFirstToken().getStr().toUpperCase() !== \"CORRESPONDING\") {\n return undefined;\n }\n const target = high.findDirectExpression(Expressions.Target);\n if (target === undefined) {\n return undefined;\n }\n const sourceRef = (_a = high.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.findFirstExpression(Expressions.CorrespondingBody);\n if ((sourceRef === null || sourceRef === void 0 ? void 0 : sourceRef.getChildren().length) === 1) {\n const code = `MOVE-CORRESPONDING ${sourceRef.concatTokens()} TO ${target.concatTokens()}`;\n const start = high.getFirstToken().getStart();\n const end = high.getLastToken().getStart();\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, simple CORRESPONDING move\", this.getMetadata().key, this.conf.severity, fix);\n }\n else if ((sourceRef === null || sourceRef === void 0 ? void 0 : sourceRef.getChildren().length) === 5 && ((_b = sourceRef.getFirstChild()) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase()) === \"BASE\") {\n let code = `${target.concatTokens()} = ${sourceRef.getChildren()[2].concatTokens()}.\\n`;\n code += `MOVE-CORRESPONDING ${sourceRef.getChildren()[4].concatTokens()} TO ${target.concatTokens()}`;\n const start = high.getFirstToken().getStart();\n const end = high.getLastToken().getStart();\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, CORRESPONDING BASE move\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n downportRefSimple(high, lowFile, highSyntax) {\n var _a;\n if (!(high.get() instanceof Statements.Move)\n || high.getChildren().length !== 4\n || high.getChildren()[2].getFirstToken().getStr().toUpperCase() !== \"REF\") {\n return undefined;\n }\n const target = high.findDirectExpression(Expressions.Target);\n if (target === undefined) {\n return undefined;\n }\n const sourceRef = (_a = high.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Source);\n if (sourceRef === undefined\n || sourceRef.getChildren().length !== 1) {\n return undefined;\n }\n let code = \"\";\n if (sourceRef.findFirstExpression(Expressions.TableExpression)) {\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n code = `ASSIGN ${sourceRef.concatTokens()} TO FIELD-SYMBOL(<${uniqueName}>).\r\nIF sy-subrc <> 0.\r\n RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.\r\nENDIF.\r\nGET REFERENCE OF <${uniqueName}> INTO ${target.concatTokens()}`;\n }\n else {\n code = `GET REFERENCE OF ${sourceRef.concatTokens()} INTO ${target.concatTokens()}`;\n }\n const start = high.getFirstToken().getStart();\n const end = high.getLastToken().getStart();\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, simple REF move\", this.getMetadata().key, this.conf.severity, fix);\n }\n downportLoopGroup(high, lowFile, highSyntax, highFile) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;\n if (!(high.get() instanceof Statements.Loop)) {\n return undefined;\n }\n const group = high.findDirectExpression(Expressions.LoopGroupBy);\n if (group === undefined) {\n return undefined;\n }\n const groupTargetName = ((_a = group.findFirstExpression(Expressions.TargetField)) === null || _a === void 0 ? void 0 : _a.concatTokens())\n || ((_b = group.findFirstExpression(Expressions.TargetFieldSymbol)) === null || _b === void 0 ? void 0 : _b.concatTokens().replace(\"<\", \"_\").replace(\">\", \"_\"))\n || \"nameNotFound\";\n const loopSourceName = ((_c = high.findFirstExpression(Expressions.SimpleSource2)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || \"nameNotFound\";\n const loopTargetName = ((_d = high.findFirstExpression(Expressions.TargetField)) === null || _d === void 0 ? void 0 : _d.concatTokens())\n || ((_e = high.findFirstExpression(Expressions.TargetFieldSymbol)) === null || _e === void 0 ? void 0 : _e.concatTokens())\n || \"nameNotFound\";\n const groupTarget = ((_f = group.findDirectExpression(Expressions.LoopGroupByTarget)) === null || _f === void 0 ? void 0 : _f.concatTokens()) || \"\";\n const isReference = (_g = high.findFirstExpression(Expressions.LoopTarget)) === null || _g === void 0 ? void 0 : _g.concatTokens().toUpperCase().startsWith(\"REFERENCE INTO \");\n let loopSourceRowType = \"typeNotFound\";\n const spag = highSyntax.spaghetti.lookupPosition(high.getFirstToken().getStart(), lowFile.getFilename());\n if (spag !== undefined) {\n const found = spag.findVariable(loopSourceName);\n const tt = found === null || found === void 0 ? void 0 : found.getType();\n if (tt instanceof basic_1.TableType) {\n loopSourceRowType = tt.getRowType().getQualifiedName() || \"typeNotFound\";\n }\n }\n let code = `TYPES: BEGIN OF ${groupTargetName}type,\\n`;\n let condition = \"\";\n let groupCountName = undefined;\n let groupIndexName = undefined;\n for (const c of group.findAllExpressions(Expressions.LoopGroupByComponent)) {\n const name = c.findFirstExpression(Expressions.ComponentName);\n let type = ((_h = c.findFirstExpression(Expressions.Source)) === null || _h === void 0 ? void 0 : _h.concatTokens()) || \"todo\";\n if ((_j = c.concatTokens()) === null || _j === void 0 ? void 0 : _j.toUpperCase().endsWith(\" = GROUP SIZE\")) {\n type = \"i\";\n groupCountName = name === null || name === void 0 ? void 0 : name.concatTokens();\n }\n else if ((_k = c.concatTokens()) === null || _k === void 0 ? void 0 : _k.toUpperCase().endsWith(\" = GROUP INDEX\")) {\n type = \"i\";\n groupIndexName = name === null || name === void 0 ? void 0 : name.concatTokens();\n }\n else {\n if (condition !== \"\") {\n condition += \" \";\n }\n condition += c.concatTokens();\n type = type.replace(loopTargetName, loopSourceRowType);\n type = type.replace(\"->\", \"-\");\n }\n code += ` ${name === null || name === void 0 ? void 0 : name.concatTokens()} TYPE ${type},\\n`;\n }\n const s = group.findDirectExpression(Expressions.Source);\n let singleName = \"\";\n if (s) {\n let type = s.concatTokens();\n type = type.replace(loopTargetName, loopSourceRowType);\n type = type.replace(\"->\", \"-\");\n singleName = s.concatTokens().split(\"-\")[1];\n code += ` ${singleName} TYPE ${type},\\n`;\n condition = singleName + \" = \" + s.concatTokens();\n }\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const uniqueFS = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const uniqueNameIndex = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n code += ` items LIKE ${loopSourceName},\r\n END OF ${groupTargetName}type.\r\nDATA ${groupTargetName}tab TYPE STANDARD TABLE OF ${groupTargetName}type WITH DEFAULT KEY.\r\nDATA ${uniqueName} LIKE LINE OF ${groupTargetName}tab.\r\nLOOP AT ${loopSourceName} ${(_l = high.findFirstExpression(Expressions.LoopTarget)) === null || _l === void 0 ? void 0 : _l.concatTokens()}.\\n`;\n if (groupIndexName !== undefined) {\n code += `DATA(${uniqueNameIndex}) = sy-tabix.\\n`;\n }\n code += `READ TABLE ${groupTargetName}tab ASSIGNING FIELD-SYMBOL(<${uniqueFS}>) WITH KEY ${condition}.\r\nIF sy-subrc = 0.\\n`;\n if (groupCountName !== undefined) {\n code += ` <${uniqueFS}>-${groupCountName} = <${uniqueFS}>-${groupCountName} + 1.\\n`;\n }\n code += ` INSERT ${loopTargetName}${isReference ? \"->*\" : \"\"} INTO TABLE <${uniqueFS}>-items.\r\nELSE.\\n`;\n code += ` CLEAR ${uniqueName}.\\n`;\n for (const c of group.findAllExpressions(Expressions.LoopGroupByComponent)) {\n const concat = c.concatTokens();\n // console.dir(concat);\n if (concat.endsWith(\" GROUP INDEX\")) {\n code += ` ${uniqueName}-${groupIndexName} = ${uniqueNameIndex}.\\n`;\n }\n else if (concat.endsWith(\" GROUP SIZE\")) {\n code += ` ${uniqueName}-${groupCountName} = 1.\\n`;\n }\n else {\n code += ` ${uniqueName}-${concat}.\\n`;\n }\n }\n if (singleName !== \"\") {\n code += ` ${uniqueName}-${singleName} = ${loopTargetName}-${singleName}.\\n`;\n }\n code += ` INSERT ${loopTargetName}${isReference ? \"->*\" : \"\"} INTO TABLE ${uniqueName}-items.\\n`;\n code += ` INSERT ${uniqueName} INTO TABLE ${groupTargetName}tab.\\n`;\n code += `ENDIF.\r\nENDLOOP.\r\nLOOP AT ${groupTargetName}tab ${groupTarget}.`;\n let fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);\n for (const l of ((_m = highFile.getStructure()) === null || _m === void 0 ? void 0 : _m.findAllStructures(Structures.Loop)) || []) {\n // make sure to find the correct/current loop statement\n if (l.findDirectStatement(Statements.Loop) !== high) {\n continue;\n }\n for (const loop of l.findAllStatements(Statements.Loop)) {\n if ((_o = loop.concatTokens()) === null || _o === void 0 ? void 0 : _o.toUpperCase().startsWith(\"LOOP AT GROUP \")) {\n const subLoopSource = loop.findFirstExpression(Expressions.SimpleSource2);\n if (subLoopSource === undefined) {\n continue;\n }\n const subLoopSourceName = (subLoopSource === null || subLoopSource === void 0 ? void 0 : subLoopSource.concatTokens()) || \"nameNotFound\";\n const subCode = `LOOP AT ${subLoopSourceName}${isReference ? \"->\" : \"-\"}items`;\n const subFix = edit_helper_1.EditHelper.replaceRange(lowFile, loop.getFirstToken().getStart(), subLoopSource.getLastToken().getEnd(), subCode);\n fix = edit_helper_1.EditHelper.merge(subFix, fix);\n }\n }\n }\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, LOOP GROUP\", this.getMetadata().key, this.conf.severity, fix);\n }\n downportRef(low, high, lowFile, highSyntax) {\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n let found = undefined;\n for (const s of high.findAllExpressionsRecursive(Expressions.Source)) {\n if (s.getFirstToken().getStr().toUpperCase() === \"REF\"\n && s.findDirectExpression(Expressions.TypeNameOrInfer)) {\n found = s;\n }\n }\n if (found === undefined) {\n return undefined;\n }\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const code = `DATA(${uniqueName}) = ${found.concatTokens()}.\\n`;\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, found.getFirstToken().getStart(), found.getLastToken().getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, REF\", this.getMetadata().key, this.conf.severity, fix);\n }\n assignWithTable(low, high, lowFile) {\n var _a, _b;\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n if (!(high.get() instanceof Statements.Assign)) {\n return undefined;\n }\n else if (high.getChildren().length !== 5) {\n return undefined;\n }\n const fieldChain = (_b = (_a = high.findDirectExpression(Expressions.AssignSource)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.FieldChain);\n const tableExpression = fieldChain === null || fieldChain === void 0 ? void 0 : fieldChain.getLastChild();\n if (tableExpression === undefined\n || !(tableExpression.get() instanceof Expressions.TableExpression)\n || !(tableExpression instanceof nodes_1.ExpressionNode)) {\n return undefined;\n }\n let condition = \"\";\n if (tableExpression.getChildren().length === 3) {\n const index = tableExpression.findDirectExpression(Expressions.Source);\n if (index === undefined) {\n return undefined;\n }\n condition = `INDEX ${index.concatTokens()}`;\n }\n else {\n let concat = tableExpression.concatTokens();\n concat = concat.substring(2);\n concat = concat.substring(0, concat.length - 2);\n condition = `WITH KEY ${concat}`;\n }\n let pre = \"\";\n for (const c of fieldChain.getChildren()) {\n if (c === tableExpression) {\n break;\n }\n pre += c.concatTokens();\n }\n const fsTarget = high.findDirectExpression(Expressions.FSTarget);\n const code = `READ TABLE ${pre} ${condition} ASSIGNING ${fsTarget === null || fsTarget === void 0 ? void 0 : fsTarget.concatTokens()}.`;\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, ASSIGN table expr\", this.getMetadata().key, this.conf.severity, fix);\n }\n moveWithSimpleValue(low, high, lowFile) {\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n if (!(high.get() instanceof Statements.Move)\n || high.getChildren().length !== 4) {\n return undefined;\n }\n const target = high.findDirectExpression(Expressions.Target);\n if (target === undefined) {\n return undefined;\n }\n const source = high.findDirectExpression(Expressions.Source);\n if (source === undefined) {\n return undefined;\n }\n const field = target.findDirectExpression(Expressions.TargetField);\n if (field === undefined) {\n return;\n }\n const valueBody = source.findDirectExpression(Expressions.ValueBody);\n if (valueBody === undefined) {\n return;\n }\n const fieldAssignments = valueBody.findDirectExpressions(Expressions.FieldAssignment);\n if (fieldAssignments.length === 0) {\n return;\n }\n else if (fieldAssignments.length !== valueBody.getChildren().length) {\n return;\n }\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n let code = `CLEAR ${target.concatTokens()}.\\n`;\n for (const fieldAssignment of fieldAssignments) {\n code += indentation + target.concatTokens() + \"-\" + fieldAssignment.concatTokens() + `.\\n`;\n }\n code = code.trimEnd();\n const start = high.getFirstToken().getStart();\n const end = high.getLastToken().getEnd();\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, simple move\", this.getMetadata().key, this.conf.severity, fix);\n }\n // note, downporting ENUM does not give the correct types, but it will work in most cases?\n downportEnum(_low, high, lowFile, _highSyntax, highFile) {\n var _a, _b, _c, _d, _e;\n if (!(high.get() instanceof Statements.TypeEnumBegin)) {\n return undefined;\n }\n const enumStructure = (_a = highFile.getStructure()) === null || _a === void 0 ? void 0 : _a.findFirstStructure(Structures.TypeEnum);\n if (enumStructure === undefined) {\n return undefined;\n }\n if (enumStructure.getFirstStatement() !== high) {\n return undefined;\n }\n const enumName = (_b = high.findExpressionAfterToken(\"ENUM\")) === null || _b === void 0 ? void 0 : _b.concatTokens();\n const structureName = (_c = high.findExpressionAfterToken(\"STRUCTURE\")) === null || _c === void 0 ? void 0 : _c.concatTokens();\n // all ENUMS are char like?\n let code = `TYPES ${enumName} TYPE string.\r\nCONSTANTS: BEGIN OF ${structureName},\\n`;\n let count = 1;\n for (const e of enumStructure.findDirectStatements(Statements.TypeEnum).concat(enumStructure.findDirectStatements(Statements.Type))) {\n const name = (_d = e.findFirstExpression(Expressions.NamespaceSimpleName)) === null || _d === void 0 ? void 0 : _d.concatTokens();\n let value = (_e = e.findFirstExpression(Expressions.Value)) === null || _e === void 0 ? void 0 : _e.concatTokens();\n if (value === undefined) {\n value = \"VALUE '\" + count++ + \"'\";\n }\n code += ` ${name} TYPE ${enumName} ${value},\\n`;\n }\n code += ` END OF ${structureName}.`;\n const start = enumStructure.getFirstToken().getStart();\n const end = enumStructure.getLastToken().getEnd();\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport ENUM\", this.getMetadata().key, this.conf.severity, fix);\n }\n moveWithTableTarget(low, high, lowFile, highSyntax) {\n var _a;\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n if (!(high.get() instanceof Statements.Move)) {\n return undefined;\n }\n const target = high.findDirectExpression(Expressions.Target);\n if (target === undefined) {\n return undefined;\n }\n const tableExpression = target.findDirectExpression(Expressions.TableExpression);\n if (tableExpression === undefined) {\n return undefined;\n }\n const index = tableExpression.findDirectExpression(Expressions.Source);\n if (index === undefined) {\n return undefined;\n }\n let uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n uniqueName = `<${uniqueName}>`;\n const tName = target.concatTokens().split(\"[\")[0];\n const condition = this.tableCondition(tableExpression);\n const tabixBackup = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n // restore tabix before exeption\n const code = `FIELD-SYMBOLS ${uniqueName} LIKE LINE OF ${tName}.\r\n${indentation}DATA ${tabixBackup} LIKE sy-tabix.\r\n${indentation}${tabixBackup} = sy-tabix.\r\n${indentation}READ TABLE ${tName} ${condition}ASSIGNING ${uniqueName}.\r\n${indentation}sy-tabix = ${tabixBackup}.\r\n${indentation}IF sy-subrc <> 0.\r\n${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.\r\n${indentation}ENDIF.\r\n${indentation}${uniqueName}`;\n const start = target.getFirstToken().getStart();\n const end = (_a = tableExpression.findDirectTokenByText(\"]\")) === null || _a === void 0 ? void 0 : _a.getEnd();\n if (end === undefined) {\n return undefined;\n }\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, move with table target\", this.getMetadata().key, this.conf.severity, fix);\n }\n moveWithOperator(low, high, lowFile) {\n var _a, _b, _c;\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n else if (!(high.get() instanceof Statements.Move)) {\n return undefined;\n }\n const children = high.getChildren();\n const secondChild = children[1];\n if (secondChild === undefined) {\n return undefined;\n }\n const op = secondChild.getFirstToken();\n let operator = \"\";\n switch (op.getStr()) {\n case \"+\":\n operator = \" + \";\n break;\n case \"-\":\n operator = \" - \";\n break;\n case \"/=\":\n operator = \" / \";\n break;\n case \"*=\":\n operator = \" * \";\n break;\n case \"&&=\":\n operator = \" && \";\n break;\n default:\n return undefined;\n }\n const target = (_a = high.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.concatTokens();\n if (target === undefined) {\n return;\n }\n const sourceStart = (_c = (_b = high.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.getFirstChild()) === null || _c === void 0 ? void 0 : _c.getFirstToken().getStart();\n if (sourceStart === undefined) {\n return;\n }\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, op.getStart(), sourceStart, \"= \" + target + operator);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Expand operator\", this.getMetadata().key, this.conf.severity, fix);\n }\n // must be very simple string templates, like \"|{ ls_line-no ALPHA = IN }|\"\n stringTemplateAlpha(low, high, lowFile, highSyntax) {\n var _a, _b, _c;\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n else if (!(high.get() instanceof Statements.Move)) {\n return undefined;\n }\n const topSource = high.findDirectExpression(Expressions.Source);\n if (topSource === undefined || topSource.getChildren().length !== 1) {\n return undefined;\n }\n let top = true;\n let child = topSource.getFirstChild();\n if (!(child.get() instanceof Expressions.StringTemplate)) {\n child = child.findFirstExpression(Expressions.StringTemplate);\n top = false;\n }\n if (child === undefined || !(child.get() instanceof Expressions.StringTemplate)) {\n return undefined;\n }\n const templateTokens = child.getChildren();\n if (templateTokens.length !== 3\n || templateTokens[0].getFirstToken().getStr() !== \"|{\"\n || templateTokens[2].getFirstToken().getStr() !== \"}|\") {\n return undefined;\n }\n const templateSource = child.findDirectExpression(Expressions.StringTemplateSource);\n const formatting = (_a = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.StringTemplateFormatting)) === null || _a === void 0 ? void 0 : _a.concatTokens();\n let functionName = \"\";\n switch (formatting) {\n case \"ALPHA = IN\":\n functionName = \"CONVERSION_EXIT_ALPHA_INPUT\";\n break;\n case \"ALPHA = OUT\":\n functionName = \"CONVERSION_EXIT_ALPHA_OUTPUT\";\n break;\n default:\n return undefined;\n }\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n const source = (_b = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens();\n const topTarget = (_c = high.findDirectExpression(Expressions.Target)) === null || _c === void 0 ? void 0 : _c.concatTokens();\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n if (top === false) {\n const code = `DATA ${uniqueName} TYPE string.\r\n${indentation}CALL FUNCTION '${functionName}'\r\n${indentation} EXPORTING\r\n${indentation} input = ${source}\r\n${indentation} IMPORTING\r\n${indentation} output = ${uniqueName}.\\n`;\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, child.getFirstToken().getStart(), child.getLastToken().getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport ALPHA\", this.getMetadata().key, this.conf.severity, fix);\n }\n else {\n const code = `CALL FUNCTION '${functionName}'\r\n${indentation} EXPORTING\r\n${indentation} input = ${source}\r\n${indentation} IMPORTING\r\n${indentation} output = ${topTarget}.`;\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport ALPHA\", this.getMetadata().key, this.conf.severity, fix);\n }\n }\n outlineLoopInput(low, high, lowFile, highSyntax) {\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n else if (!(high.get() instanceof Statements.Loop)) {\n return undefined;\n }\n else if (high.findDirectExpression(Expressions.SimpleSource2)) {\n return undefined;\n }\n // the first Source must be outlined\n const s = high.findDirectExpression(Expressions.Source);\n if (s === undefined) {\n return undefined;\n }\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const code = `DATA(${uniqueName}) = ${s.concatTokens()}.\\n` +\n \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, s.getFirstToken().getStart(), s.getLastToken().getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Outline LOOP input\", this.getMetadata().key, this.conf.severity, fix);\n }\n outlineLoopTarget(node, lowFile, highSyntax) {\n var _a, _b, _c, _d, _e, _f, _g;\n // also allows outlining of voided types\n if (!(node.get() instanceof Statements.Loop)) {\n return undefined;\n }\n const sourceName = (_a = node.findDirectExpression(Expressions.SimpleSource2)) === null || _a === void 0 ? void 0 : _a.concatTokens();\n if (sourceName === undefined) {\n return undefined;\n }\n const concat = node.concatTokens().toUpperCase();\n if (concat.includes(\" GROUP BY \") || concat.startsWith(\"LOOP AT GROUP \")) {\n return undefined;\n }\n const isReference = concat.includes(\" REFERENCE INTO \");\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\n const dataTarget = (_c = (_b = node.findDirectExpression(Expressions.LoopTarget)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.Target)) === null || _c === void 0 ? void 0 : _c.findDirectExpression(Expressions.InlineData);\n if (dataTarget) {\n const targetName = ((_d = dataTarget.findDirectExpression(Expressions.TargetField)) === null || _d === void 0 ? void 0 : _d.concatTokens()) || \"DOWNPORT_ERROR\";\n let code = `DATA ${targetName} LIKE LINE OF ${sourceName}.\\n${indentation}`;\n if (isReference) {\n const likeName = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n code = `DATA ${likeName} LIKE LINE OF ${sourceName}.\\n${indentation}DATA ${targetName} LIKE REF TO ${likeName}.\\n${indentation}`;\n }\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, dataTarget.getFirstToken().getStart(), dataTarget.getLastToken().getEnd(), targetName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Outline LOOP data target\", this.getMetadata().key, this.conf.severity, fix);\n }\n const fsTarget = (_f = (_e = node.findDirectExpression(Expressions.LoopTarget)) === null || _e === void 0 ? void 0 : _e.findDirectExpression(Expressions.FSTarget)) === null || _f === void 0 ? void 0 : _f.findDirectExpression(Expressions.InlineFS);\n if (fsTarget) {\n const targetName = ((_g = fsTarget.findDirectExpression(Expressions.TargetFieldSymbol)) === null || _g === void 0 ? void 0 : _g.concatTokens()) || \"DOWNPORT_ERROR\";\n const code = `FIELD-SYMBOLS ${targetName} LIKE LINE OF ${sourceName}.\\n${indentation}`;\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, fsTarget.getFirstToken().getStart(), fsTarget.getLastToken().getEnd(), targetName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Outline LOOP fs target\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n outlineFor(forLoop, indentation, lowFile, highSyntax) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j;\n let body = \"\";\n let end = \"\";\n const loopSource = (_a = forLoop.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();\n let loopTargetFieldExpression = forLoop.findFirstExpression(Expressions.TargetField);\n let loopTargetFieldName = loopTargetFieldExpression === null || loopTargetFieldExpression === void 0 ? void 0 : loopTargetFieldExpression.concatTokens();\n const of = forLoop.findExpressionAfterToken(\"OF\");\n if (of !== undefined) {\n loopTargetFieldExpression = of;\n loopTargetFieldName = of === null || of === void 0 ? void 0 : of.concatTokens();\n }\n if (((_c = (_b = forLoop.findDirectExpression(Expressions.InlineLoopDefinition)) === null || _b === void 0 ? void 0 : _b.getFirstChild()) === null || _c === void 0 ? void 0 : _c.get()) instanceof Expressions.TargetFieldSymbol) {\n loopTargetFieldExpression = undefined;\n loopTargetFieldName = undefined;\n }\n if (loopTargetFieldExpression) {\n const start = loopTargetFieldExpression.getFirstToken().getStart();\n const spag = highSyntax.spaghetti.lookupPosition(start, lowFile.getFilename());\n if (loopTargetFieldName && spag) {\n if (new SpagHelper(spag).isDuplicateName(loopTargetFieldName, start)) {\n this.renameVariable(spag, loopTargetFieldName, start, lowFile, highSyntax);\n }\n }\n }\n let cond = ((_d = forLoop.findDirectExpression(Expressions.ComponentCond)) === null || _d === void 0 ? void 0 : _d.concatTokens()) || \"\";\n if (cond !== \"\") {\n cond = \" WHERE \" + cond;\n }\n const loop = forLoop.findDirectExpression(Expressions.InlineLoopDefinition);\n const indexInto = (_e = loop === null || loop === void 0 ? void 0 : loop.findExpressionAfterToken(\"INTO\")) === null || _e === void 0 ? void 0 : _e.concatTokens();\n if (forLoop.findDirectTokenByText(\"UNTIL\")\n || forLoop.findDirectTokenByText(\"WHILE\")) {\n const fieldDef = forLoop.findDirectExpression(Expressions.InlineFieldDefinition);\n const field = (_f = fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.findFirstExpression(Expressions.Field)) === null || _f === void 0 ? void 0 : _f.concatTokens();\n const indexBackup = this.uniqueName(forLoop.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n body += indentation + \"DATA \" + field + \" TYPE i.\\n\";\n const second = fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.getChildren()[2];\n if ((second === null || second === void 0 ? void 0 : second.get()) instanceof Expressions.Source) {\n body += indentation + field + \" = \" + second.concatTokens() + \".\\n\";\n }\n const not = forLoop.findDirectTokenByText(\"UNTIL\") ? \" NOT\" : \"\";\n const cond = forLoop.findFirstExpression(Expressions.Cond);\n body += indentation + `DATA ${indexBackup} LIKE sy-index.\\n`;\n body += indentation + `${indexBackup} = sy-index.\\n`;\n body += indentation + `WHILE${not} ${cond === null || cond === void 0 ? void 0 : cond.concatTokens()}.\\n`;\n body += indentation + ` sy-index = ${indexBackup}.\\n`;\n const then = forLoop.findExpressionAfterToken(\"THEN\");\n if (then) {\n end += ` ${field} = ${then.concatTokens()}.\\n`;\n }\n else {\n end += ` ${field} = ${field} + 1.\\n`;\n }\n end += indentation + \"ENDWHILE\";\n }\n else if (loopTargetFieldName !== undefined) {\n let from = (_g = forLoop.findExpressionAfterToken(\"FROM\")) === null || _g === void 0 ? void 0 : _g.concatTokens();\n from = from ? \" FROM \" + from : \"\";\n let to = (_h = forLoop.findExpressionAfterToken(\"TO\")) === null || _h === void 0 ? void 0 : _h.concatTokens();\n to = to ? \" TO \" + to : \"\";\n let gby = \"\";\n for (const lg of forLoop.findDirectExpressions(Expressions.LoopGroupByComponent)) {\n if (gby !== \"\") {\n gby += \" \";\n }\n gby += lg.concatTokens();\n }\n if (gby !== \"\") {\n gby = \" GROUP BY ( \" + gby + \" )\";\n }\n const fc = forLoop.findDirectExpression(Expressions.FieldChain);\n if (fc) {\n gby = \" GROUP BY \" + fc.concatTokens();\n }\n if (forLoop.findDirectTokenByText(\"ASCENDING\")) {\n gby += \" ASCENDING\";\n }\n if (forLoop.findDirectTokenByText(\"DESCENDING\")) {\n gby += \" DESCENDING\";\n }\n const groups = forLoop.findExpressionAfterToken(\"GROUPS\");\n if (groups) {\n const concat = groups.concatTokens();\n if (concat.startsWith(\"<\")) {\n gby += \" ASSIGNING FIELD-SYMBOL(\" + concat + \")\";\n }\n else {\n gby += \" INTO DATA(\" + concat + \")\";\n }\n }\n let inGroup = \"\";\n if (forLoop.concatTokens().toUpperCase().includes(\" IN GROUP \")) {\n inGroup = \"-items\";\n }\n let into = \"INTO DATA\";\n if (loopTargetFieldName.startsWith(\"<\")) {\n into = \"ASSIGNING FIELD-SYMBOL\";\n }\n // todo, also backup sy-index / sy-tabix here?\n body += indentation + `LOOP AT ${loopSource}${inGroup} ${into}(${loopTargetFieldName})${from}${to}${cond}${gby}.\\n`;\n if (indexInto) {\n body += indentation + \" DATA(\" + indexInto + \") = sy-tabix.\\n\";\n }\n end = \"ENDLOOP\";\n }\n else if (loopTargetFieldName === undefined) {\n // todo, also backup sy-index / sy-tabix here?\n const loopTargetFieldSymbol = (_j = forLoop.findFirstExpression(Expressions.TargetFieldSymbol)) === null || _j === void 0 ? void 0 : _j.concatTokens();\n body += indentation + `LOOP AT ${loopSource} ASSIGNING FIELD-SYMBOL(${loopTargetFieldSymbol})${cond}.\\n`;\n if (indexInto) {\n body += indentation + \" DATA(\" + indexInto + \") = sy-tabix.\\n\";\n }\n end = \"ENDLOOP\";\n }\n const l = forLoop.findDirectExpression(Expressions.Let);\n if (l) {\n body += this.outlineLet(l, indentation, highSyntax, lowFile);\n }\n return { body, end };\n }\n outlineFilter(low, high, lowFile, highSyntax) {\n var _a;\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n for (const i of high.findAllExpressionsRecursive(Expressions.Source)) {\n const firstToken = i.getFirstToken();\n if (firstToken.getStr().toUpperCase() !== \"FILTER\") {\n continue;\n }\n const filterBody = i.findDirectExpression(Expressions.FilterBody);\n if (filterBody === undefined) {\n continue;\n }\n const sourceName = (_a = filterBody.findDirectExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();\n if (sourceName === undefined) {\n continue;\n }\n let type = this.findType(i, lowFile, highSyntax);\n if (type === undefined) {\n type = \"LIKE \" + sourceName;\n }\n else {\n type = \"TYPE \" + type;\n }\n const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\n const loopName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n let body = \"\";\n body += `DATA ${uniqueName} ${type}.\\n`;\n body += `${indentation}LOOP AT ${sourceName} INTO DATA(${loopName}) ${filterBody.concatTokens().substring(sourceName.length + 1)}.\\n`;\n body += `${indentation} INSERT ${loopName} INTO TABLE ${uniqueName}.\\n`;\n body += `${indentation}ENDLOOP.\\n${indentation}`;\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), body);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), i.getLastToken().getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, firstToken, \"Downport FILTER\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n outlineSwitch(low, high, lowFile, highSyntax) {\n var _a, _b, _c, _d;\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n for (const i of high.findAllExpressionsRecursive(Expressions.Source)) {\n const firstToken = i.getFirstToken();\n if (firstToken.getStr().toUpperCase() !== \"SWITCH\") {\n continue;\n }\n let type = this.findType(i, lowFile, highSyntax);\n if (type === undefined) {\n if (high.get() instanceof Statements.Move\n && high.findDirectExpression(Expressions.Source) === i\n && ((_a = high.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.TargetField)) !== undefined) {\n type = \"LIKE \" + ((_b = high.findDirectExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.concatTokens());\n }\n if (type === undefined) {\n continue;\n }\n }\n else {\n type = \"TYPE \" + type;\n }\n const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n let body = \"\";\n let name = \"\";\n const switchBody = i.findDirectExpression(Expressions.SwitchBody);\n if (switchBody === undefined) {\n continue;\n }\n for (const l of ((_c = switchBody === null || switchBody === void 0 ? void 0 : switchBody.findDirectExpression(Expressions.Let)) === null || _c === void 0 ? void 0 : _c.findDirectExpressions(Expressions.InlineFieldDefinition)) || []) {\n name = l.getFirstToken().getStr();\n body += indentation + `DATA(${name}) = ${(_d = switchBody.findFirstExpression(Expressions.Source)) === null || _d === void 0 ? void 0 : _d.concatTokens()}.\\n`;\n }\n body += `DATA ${uniqueName} ${type}.\\n`;\n let firstSource = false;\n let inWhen = false;\n for (const c of switchBody.getChildren()) {\n if (c.get() instanceof Expressions.Source && firstSource === false) {\n body += indentation + `CASE ${c.concatTokens()}.`;\n firstSource = true;\n }\n else if (c instanceof nodes_1.TokenNode && c.concatTokens().toUpperCase() === \"THEN\") {\n inWhen = true;\n body += \".\\n\";\n }\n else if (c instanceof nodes_1.TokenNode && c.concatTokens().toUpperCase() === \"WHEN\") {\n inWhen = false;\n body += `\\n${indentation} WHEN `;\n }\n else if (c instanceof nodes_1.TokenNode && c.concatTokens().toUpperCase() === \"OR\") {\n body += ` OR `;\n }\n else if (c instanceof nodes_1.TokenNode && c.concatTokens().toUpperCase() === \"ELSE\") {\n inWhen = true;\n body += `\\n${indentation} WHEN OTHERS.\\n`;\n }\n else if (inWhen === false) {\n body += c.concatTokens();\n }\n else {\n body += indentation + \" \" + uniqueName + \" = \" + c.concatTokens() + \".\";\n }\n }\n body += \"\\n\" + indentation + \"ENDCASE.\\n\" + indentation;\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), body);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), i.getLastToken().getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, firstToken, \"Downport SWITCH\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n outlineReduce(low, high, lowFile, highSyntax) {\n var _a, _b;\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n for (const i of high.findAllExpressionsRecursive(Expressions.Source)) {\n const firstToken = i.getFirstToken();\n if (firstToken.getStr().toUpperCase() !== \"REDUCE\") {\n continue;\n }\n const type = this.findType(i, lowFile, highSyntax);\n if (type === undefined) {\n continue;\n }\n const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n let body = \"\";\n let name = \"\";\n const reduceBody = i.findDirectExpression(Expressions.ReduceBody);\n if (reduceBody === undefined) {\n continue;\n }\n const letNode = reduceBody.findDirectExpression(Expressions.Let);\n if (letNode) {\n body += this.outlineLet(letNode, indentation, highSyntax, lowFile);\n }\n let firstName = \"\";\n for (const init of reduceBody.findDirectExpressions(Expressions.InlineFieldDefinition)) {\n name = init.getFirstToken().getStr();\n if (firstName === \"\") {\n firstName = name;\n }\n const spag = highSyntax.spaghetti.lookupPosition(init.getFirstToken().getStart(), lowFile.getFilename());\n if (spag && new SpagHelper(spag).isDuplicateName(name, init.getFirstToken().getStart())) {\n this.renameVariable(spag, name, init.getFirstToken().getStart(), lowFile, highSyntax);\n }\n const s = (_a = init.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();\n const t = (_b = init.findFirstExpression(Expressions.TypeName)) === null || _b === void 0 ? void 0 : _b.concatTokens();\n if (s) {\n if (s.toUpperCase().startsWith(\"VALUE #\")) {\n body += indentation + `DATA(${name}) = ${s.replace(\"#\", type)}.\\n`;\n }\n else {\n body += indentation + `DATA(${name}) = ${s}.\\n`;\n }\n }\n else {\n body += indentation + `DATA ${name} TYPE ${t}.\\n`;\n }\n }\n let end = \"\";\n for (const forLoop of (reduceBody === null || reduceBody === void 0 ? void 0 : reduceBody.findDirectExpressions(Expressions.For)) || []) {\n const outlineFor = this.outlineFor(forLoop, indentation, lowFile, highSyntax);\n body += outlineFor.body;\n end = outlineFor.end + `.\\n` + end;\n }\n const next = reduceBody.findDirectExpression(Expressions.ReduceNext);\n if (next === undefined) {\n continue;\n }\n for (const n of next.getChildren()) {\n const concat = n.concatTokens();\n if (concat.toUpperCase() === \"NEXT\") {\n continue;\n }\n else if (n.get() instanceof Expressions.SimpleTarget) {\n body += indentation + \" \" + concat + \" \";\n }\n else if (n.get() instanceof Expressions.Source) {\n body += \" \" + concat + \".\\n\";\n }\n else {\n body += concat;\n }\n }\n body += indentation + end;\n body += indentation + `${uniqueName} = ${firstName}.\\n`;\n const abap = `DATA ${uniqueName} TYPE ${type}.\\n` +\n body +\n indentation;\n const reduceEnd = i.findDirectTokenByText(\")\");\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), reduceEnd.getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, firstToken, \"Downport REDUCE\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n outlineValue(low, high, lowFile, highSyntax) {\n var _a, _b, _c;\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n const allSources = high.findAllExpressionsRecursive(Expressions.Source);\n for (const s of allSources) {\n const firstToken = s.getFirstToken();\n if (firstToken.getStr().toUpperCase() !== \"VALUE\") {\n continue;\n }\n const valueBody = s.findDirectExpression(Expressions.ValueBody);\n let type = this.findType(s, lowFile, highSyntax);\n if (type === undefined) {\n if (high.get() instanceof Statements.Move && high.findDirectExpression(Expressions.Source) === s) {\n type = \"LIKE \" + ((_a = high.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.concatTokens());\n }\n if (type === undefined) {\n continue;\n }\n }\n else {\n type = \"TYPE \" + type;\n }\n const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\n let indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n let body = \"\";\n const base = valueBody === null || valueBody === void 0 ? void 0 : valueBody.findExpressionAfterToken(\"BASE\");\n if (base) {\n body += indentation + uniqueName + \" = \" + base.concatTokens() + \".\\n\";\n }\n let end = \"\";\n let structureName = uniqueName;\n let added = false;\n let data = \"\";\n let previous = undefined;\n if ((valueBody === null || valueBody === void 0 ? void 0 : valueBody.findDirectExpression(Expressions.ValueBodyLine)) !== undefined) {\n structureName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\n const extra = (valueBody === null || valueBody === void 0 ? void 0 : valueBody.findDirectExpression(Expressions.For)) ? \" \" : \"\";\n data = indentation + extra + `DATA ${structureName} LIKE LINE OF ${uniqueName}.\\n`;\n }\n for (const a of (valueBody === null || valueBody === void 0 ? void 0 : valueBody.getChildren()) || []) {\n if (a.get() instanceof Expressions.FieldAssignment) {\n if (added === false) {\n body += data;\n added = true;\n }\n body += indentation + structureName + \"-\" + a.concatTokens() + \".\\n\";\n }\n else if (a instanceof nodes_1.ExpressionNode && a.get() instanceof Expressions.For) {\n const outlineFor = this.outlineFor(a, indentation, lowFile, highSyntax);\n body += outlineFor.body;\n end = outlineFor.end + `.\\n` + end;\n indentation += \" \";\n }\n else if (a instanceof nodes_1.ExpressionNode && a.get() instanceof Expressions.Source) {\n // special handling for superflous value expression\n if ((valueBody === null || valueBody === void 0 ? void 0 : valueBody.getChildren().length) === 1) {\n body += indentation + uniqueName + \" = \" + a.concatTokens() + `.\\n`;\n }\n }\n else if (a instanceof nodes_1.ExpressionNode && a.get() instanceof Expressions.Let) {\n body += this.outlineLet(a, indentation, highSyntax, lowFile);\n }\n if (a instanceof nodes_1.ExpressionNode && a.get() instanceof Expressions.ValueBodyLine) {\n let skip = false;\n for (const b of (a === null || a === void 0 ? void 0 : a.getChildren()) || []) {\n if (b.get() instanceof Expressions.FieldAssignment) {\n if (added === false) {\n body += data;\n added = true;\n }\n body += indentation + structureName + \"-\" + b.concatTokens() + \".\\n\";\n }\n else if (b.get() instanceof Expressions.Source) {\n body += indentation + \"APPEND \" + b.concatTokens() + ` TO ${uniqueName}.\\n`;\n skip = true;\n }\n else if (b.get() instanceof Expressions.ValueBodyLines) {\n body += indentation + \"APPEND \" + b.concatTokens() + ` TO ${uniqueName}.\\n`;\n skip = true;\n }\n else if (b.concatTokens() === \")\") {\n if (added === false && (previous === null || previous === void 0 ? void 0 : previous.concatTokens()) === \"(\") {\n body += data;\n added = true;\n }\n if (skip === false) {\n body += indentation + `APPEND ${structureName} TO ${uniqueName}.\\n`;\n }\n }\n previous = b;\n }\n }\n }\n if (body === \"\" && ((_b = valueBody === null || valueBody === void 0 ? void 0 : valueBody.getLastChild()) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr().toUpperCase()) === \"OPTIONAL\") {\n const fieldChain = valueBody.findFirstExpression(Expressions.FieldChain);\n const rowName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\n let tableExpression = undefined;\n let tabName = \"\";\n let after = \"\";\n for (const c of (fieldChain === null || fieldChain === void 0 ? void 0 : fieldChain.getChildren()) || []) {\n if (c.get() instanceof Expressions.TableExpression && c instanceof nodes_1.ExpressionNode) {\n tableExpression = c;\n }\n else if (tableExpression === undefined) {\n tabName += c.concatTokens();\n }\n else {\n after += c.concatTokens();\n }\n }\n let condition = \"\";\n if ((tableExpression === null || tableExpression === void 0 ? void 0 : tableExpression.getChildren().length) === 3) {\n condition = \"INDEX \" + ((_c = tableExpression === null || tableExpression === void 0 ? void 0 : tableExpression.findDirectExpression(Expressions.Source)) === null || _c === void 0 ? void 0 : _c.concatTokens());\n }\n else {\n condition = \"WITH KEY \" + (tableExpression === null || tableExpression === void 0 ? void 0 : tableExpression.concatTokens().replace(\"[ \", \"\").replace(\" ]\", \"\"));\n }\n body +=\n indentation + `READ TABLE ${tabName} INTO DATA(${rowName}) ${condition}.\\n` +\n indentation + `IF sy-subrc = 0.\\n` +\n indentation + ` ${uniqueName} = ${rowName}${after}.\\n` +\n indentation + `ENDIF.\\n`;\n }\n if (end !== \"\") {\n indentation = indentation.substring(2);\n body += indentation + end;\n }\n const abap = `DATA ${uniqueName} ${type}.\\n` +\n indentation + `CLEAR ${uniqueName}.\\n` + // might be called inside a loop\n body +\n indentation;\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), s.getLastToken().getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, firstToken, \"Downport VALUE\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n outlineLet(node, indentation, highSyntax, lowFile) {\n var _a;\n let ret = \"\";\n for (const f of node.findDirectExpressions(Expressions.InlineFieldDefinition)) {\n const c = f.getFirstChild();\n if (c === undefined) {\n continue;\n }\n const name = c.concatTokens().toLowerCase();\n const spag = highSyntax.spaghetti.lookupPosition(c.getFirstToken().getStart(), lowFile.getFilename());\n if (spag === undefined) {\n continue;\n }\n if (new SpagHelper(spag).isDuplicateName(name, c.getFirstToken().getStart())) {\n this.renameVariable(spag, name, c.getFirstToken().getStart(), lowFile, highSyntax);\n }\n const found = spag.findVariable(name);\n if (found === undefined) {\n const source = f.findFirstExpression(Expressions.Source);\n if (source) {\n ret += indentation + \"DATA(\" + name + `) = ${source.concatTokens()}.\\n`;\n }\n continue;\n }\n const type = found.getType().getQualifiedName() ? (_a = found.getType().getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toLowerCase() : found.getType().toABAP();\n ret += indentation + \"DATA \" + name + ` TYPE ${type}.\\n`;\n const source = f.findFirstExpression(Expressions.Source);\n if (source) {\n ret += indentation + name + ` = ${source.concatTokens()}.\\n`;\n }\n }\n return ret;\n }\n renameVariable(spag, name, pos, lowFile, highSyntax) {\n const newName = this.uniqueName(pos, lowFile.getFilename(), highSyntax);\n const fix = new SpagHelper(spag).renameVariable(name, pos, lowFile, newName);\n const issue = issue_1.Issue.atPosition(lowFile, pos, \"Rename before outline\", this.getMetadata().key, this.conf.severity, fix);\n throw new SkipToNextFile(issue);\n }\n findType(i, lowFile, highSyntax, ref = false) {\n var _a;\n const expr = i.findDirectExpression(Expressions.TypeNameOrInfer);\n if (expr === undefined) {\n return undefined;\n }\n const firstToken = expr.getFirstToken();\n const concat = expr.concatTokens().toLowerCase();\n if (concat !== \"#\") {\n return ref ? \"REF TO \" + concat : concat;\n }\n const spag = highSyntax.spaghetti.lookupPosition(firstToken.getStart(), lowFile.getFilename());\n if (spag === undefined) {\n return undefined;\n }\n let inferred = undefined;\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\n if (r.referenceType === _reference_1.ReferenceType.InferredType\n && r.resolved\n && r.position.getStart().equals(firstToken.getStart())\n && r.resolved instanceof _typed_identifier_1.TypedIdentifier) {\n inferred = r.resolved;\n break;\n }\n }\n if (inferred === undefined) {\n return undefined;\n }\n if (inferred.getType() instanceof basic_1.ObjectReferenceType) {\n return inferred.getType().toABAP();\n }\n else {\n return (_a = inferred.getType().getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toLowerCase();\n }\n }\n outlineFS(low, high, lowFile, highSyntax) {\n var _a, _b;\n if (!(low.get() instanceof _statement_1.Unknown)\n || (high.get() instanceof Statements.Loop)) {\n return undefined;\n }\n for (const i of high.findAllExpressionsRecursive(Expressions.InlineFS)) {\n const nameToken = (_a = i.findDirectExpression(Expressions.TargetFieldSymbol)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\n if (nameToken === undefined) {\n continue;\n }\n const name = nameToken.getStr();\n let type = \"\";\n if (high.concatTokens().toUpperCase().startsWith(\"APPEND INITIAL LINE TO \")) {\n type = \"LIKE LINE OF \" + ((_b = high.findFirstExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.concatTokens());\n }\n else {\n const spag = highSyntax.spaghetti.lookupPosition(nameToken.getStart(), lowFile.getFilename());\n if (spag === undefined) {\n continue;\n }\n const found = spag.findVariable(name);\n if (found === undefined) {\n continue;\n }\n else if (found.getType() instanceof basic_1.VoidType) {\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Error outlining voided type\", this.getMetadata().key, this.conf.severity);\n }\n type = \"TYPE \";\n type += found.getType().getQualifiedName() ? found.getType().getQualifiedName().toLowerCase() : found.getType().toABAP();\n }\n const code = `FIELD-SYMBOLS ${name} ${type}.\\n` +\n \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), name);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Outline FIELD-SYMBOL\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n outlineData(node, lowFile, highSyntax) {\n // hmm, no guard here, as DATA(SDF) is valid in 702\n var _a, _b;\n for (const i of node.findAllExpressionsRecursive(Expressions.InlineData)) {\n const nameToken = (_a = i.findDirectExpression(Expressions.TargetField)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\n if (nameToken === undefined) {\n continue;\n }\n const name = nameToken.getStr();\n const spag = highSyntax.spaghetti.lookupPosition(nameToken.getStart(), lowFile.getFilename());\n if (spag === undefined) {\n continue;\n }\n const found = spag.findVariable(name);\n if (found === undefined) {\n continue;\n }\n else if (found.getType() instanceof basic_1.VoidType && found.getType().getQualifiedName() === undefined) {\n continue;\n }\n let type = found.getType().getQualifiedName()\n ? (_b = found.getType().getQualifiedName()) === null || _b === void 0 ? void 0 : _b.toLowerCase()\n : found.getType().toABAP();\n if (found.getType() instanceof basic_1.ObjectReferenceType) {\n type = found.getType().toABAP();\n }\n if (type === \"\") {\n continue;\n }\n const code = `DATA ${name} TYPE ${type}.\\n` +\n \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), name);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Outline DATA\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n outlineCond(low, high, lowFile, highSyntax) {\n var _a, _b;\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n for (const i of high.findAllExpressionsRecursive(Expressions.Source)) {\n if (i.getFirstToken().getStr().toUpperCase() !== \"COND\") {\n continue;\n }\n const body = i.findDirectExpression(Expressions.CondBody);\n if (body === undefined) {\n continue;\n }\n const uniqueName = this.uniqueName(i.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n let type = this.findType(i, lowFile, highSyntax);\n if (type === undefined) {\n if (high.get() instanceof Statements.Move\n && high.findDirectExpression(Expressions.Source) === i\n && ((_a = high.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.TargetField)) !== undefined) {\n type = \"LIKE \" + ((_b = high.findDirectExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.concatTokens());\n }\n if (type === undefined) {\n continue;\n }\n }\n else {\n type = \"TYPE \" + type;\n }\n const indent = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n const bodyCode = this.buildCondBody(body, uniqueName, indent, lowFile, highSyntax);\n const last = i.findDirectTokenByText(\")\");\n const abap = `DATA ${uniqueName} ${type}.\\n` + bodyCode;\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), last.getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Downport COND\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n buildCondBody(body, uniqueName, indent, lowFile, highSyntax) {\n let code = \"\";\n let first = true;\n let addElse = true;\n for (const c of body.getChildren()) {\n if (c instanceof nodes_1.TokenNode) {\n switch (c.getFirstToken().getStr().toUpperCase()) {\n case \"WHEN\":\n if (first === true) {\n code += indent + \"IF \";\n first = false;\n }\n else {\n code += indent + \"ELSEIF \";\n }\n break;\n case \"THEN\":\n code += \".\\n\";\n break;\n case \"ELSE\":\n code += indent + \"ELSE.\\n\";\n addElse = false;\n break;\n default:\n throw \"buildCondBody, unexpected token\";\n }\n }\n else if (c.get() instanceof Expressions.Cond) {\n code += c.concatTokens();\n }\n else if (c.get() instanceof Expressions.Let) {\n code += this.outlineLet(c, indent, highSyntax, lowFile);\n }\n else if (c.get() instanceof Expressions.Source) {\n code += indent + \" \" + uniqueName + \" = \" + c.concatTokens() + \".\\n\";\n }\n else if (c.get() instanceof Expressions.Throw) {\n code += indent + \" \" + c.concatTokens().replace(/THROW /i, \"RAISE EXCEPTION NEW \") + \".\\n\";\n }\n else {\n throw \"buildCondBody, unexpected expression, \" + c.get().constructor.name;\n }\n }\n if (addElse) {\n // COND might be called inside a loop\n code += indent + \"ELSE.\\n\";\n code += indent + ` CLEAR ${uniqueName}.\\n`;\n }\n code += indent + \"ENDIF.\\n\";\n code += indent;\n return code;\n }\n outlineConv(low, high, lowFile, highSyntax) {\n var _a;\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n for (const i of high.findAllExpressionsRecursive(Expressions.Source)) {\n if (i.getFirstToken().getStr().toUpperCase() !== \"CONV\") {\n continue;\n }\n const end = i.findDirectTokenByText(\")\");\n if (end === undefined) {\n continue;\n }\n const body = (_a = i.findDirectExpression(Expressions.ConvBody)) === null || _a === void 0 ? void 0 : _a.concatTokens();\n if (body === undefined) {\n continue;\n }\n const uniqueName = this.uniqueName(i.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const type = this.findType(i, lowFile, highSyntax);\n const indent = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n const abap = `DATA ${uniqueName} TYPE ${type}.\\n` +\n indent + `${uniqueName} = ${body}.\\n` +\n indent;\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), end.getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Downport CONV\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n // \"CAST\" to \"?=\"\n outlineCast(low, high, lowFile, highSyntax) {\n var _a;\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n for (const i of high.findAllExpressionsRecursive(Expressions.Cast)) {\n const uniqueName = this.uniqueName(i.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const type = this.findType(i, lowFile, highSyntax, true);\n const body = (_a = i.findDirectExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();\n const abap = `DATA ${uniqueName} TYPE ${type}.\\n` +\n \" \".repeat(high.getFirstToken().getStart().getCol() - 1) +\n `${uniqueName} ?= ${body}.\\n` +\n \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), uniqueName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Downport CAST\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n uniqueName(position, filename, highSyntax) {\n const spag = highSyntax.spaghetti.lookupPosition(position, filename);\n if (spag === undefined) {\n const name = \"temprr\" + this.counter;\n this.counter++;\n return name;\n }\n while (true) {\n const name = \"temp\" + this.counter;\n const exists = this.existsRecursive(spag, name);\n this.counter++;\n if (exists === false) {\n return name;\n }\n }\n }\n existsRecursive(spag, name) {\n const existsDirect = spag.findVariable(name);\n if (existsDirect) {\n return true;\n }\n for (const child of spag.getChildren()) {\n if (child.findVariable(name) || this.existsRecursive(child, name)) {\n return true;\n }\n }\n return false;\n }\n replaceXsdBool(node, lowFile, highSyntax) {\n const spag = highSyntax.spaghetti.lookupPosition(node.getFirstToken().getStart(), lowFile.getFilename());\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\n if (r.referenceType === _reference_1.ReferenceType.BuiltinMethodReference\n && r.position.getName().toUpperCase() === \"XSDBOOL\") {\n const token = r.position.getToken();\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, token.getStart(), token.getEnd(), \"boolc\");\n return issue_1.Issue.atToken(lowFile, token, \"Use BOOLC\", this.getMetadata().key, this.conf.severity, fix);\n }\n }\n return undefined;\n }\n findMethodCallExpression(node, token) {\n var _a;\n for (const m of node.findAllExpressions(Expressions.MethodCall)) {\n if ((_a = m.findDirectExpression(Expressions.MethodName)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStart().equals(token.getStart())) {\n return m;\n }\n }\n return undefined;\n }\n replaceMethodConditional(low, high, lowFile, highSyntax) {\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n for (const c of high.findAllExpressionsRecursive(Expressions.Compare)) {\n const chain = c.findDirectExpression(Expressions.MethodCallChain);\n if (chain === undefined) {\n continue;\n }\n const concat = chain.concatTokens().toUpperCase();\n if (concat.startsWith(\"LINE_EXISTS( \") || concat.startsWith(\"LINE_INDEX( \")) {\n // these are handled separately\n continue;\n }\n let predicate = false;\n const spag = highSyntax.spaghetti.lookupPosition(high.getFirstToken().getStart(), lowFile.getFilename());\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\n if (r.referenceType === _reference_1.ReferenceType.BuiltinMethodReference &&\n new _builtin_1.BuiltIn().isPredicate(chain.getFirstToken().getStr().toUpperCase())) {\n predicate = true;\n break;\n }\n }\n const end = chain.getLastToken().getEnd();\n let fix = edit_helper_1.EditHelper.insertAt(lowFile, end, \" IS NOT INITIAL\");\n if (predicate === true) {\n fix = edit_helper_1.EditHelper.insertAt(lowFile, end, \" ) = abap_true\");\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, chain.getFirstToken().getStart(), \"boolc( \");\n fix = edit_helper_1.EditHelper.merge(fix, fix1);\n }\n return issue_1.Issue.atToken(lowFile, chain.getFirstToken(), \"Downport method conditional\", this.getMetadata().key, this.conf.severity, fix);\n }\n return undefined;\n }\n getReference(node, lowFile, _highSyntax) {\n var _a, _b, _c;\n if (!(node.get() instanceof Statements.GetReference)) {\n return undefined;\n }\n const inline = (_a = node.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.InlineData);\n if (inline === undefined) {\n return undefined;\n }\n const targetName = (_b = inline.findDirectExpression(Expressions.TargetField)) === null || _b === void 0 ? void 0 : _b.concatTokens();\n const sourceName = (_c = node.findDirectExpression(Expressions.Source)) === null || _c === void 0 ? void 0 : _c.concatTokens();\n if (targetName === undefined || sourceName === undefined) {\n return undefined;\n }\n const code = `DATA ${targetName} LIKE REF TO ${sourceName}.\\n`;\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, inline.getFirstToken().getStart(), inline.getLastToken().getEnd(), targetName);\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, inline.getFirstToken(), \"Downport, outline DATA ref\", this.getMetadata().key, this.conf.severity, fix);\n }\n replaceContains(node, lowFile, highSyntax) {\n const spag = highSyntax.spaghetti.lookupPosition(node.getFirstToken().getStart(), lowFile.getFilename());\n // only downport if its an single method call condition\n let found = false;\n for (const c of node.findAllExpressionsRecursive(Expressions.Compare)) {\n found = c.findDirectExpression(Expressions.MethodCallChain) !== undefined;\n if (found === true) {\n break;\n }\n }\n if (found === false) {\n return undefined;\n }\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\n if (r.referenceType !== _reference_1.ReferenceType.BuiltinMethodReference) {\n continue;\n }\n const func = r.position.getName().toUpperCase();\n if (func === \"CONTAINS\") {\n const token = r.position.getToken();\n const expression = this.findMethodCallExpression(node, token);\n if (expression === undefined) {\n continue;\n }\n const sList = expression.findAllExpressions(Expressions.Source).map(e => e.concatTokens());\n if (sList.length !== 2) {\n continue;\n }\n const code = sList[0] + \" CS \" + sList[1];\n const start = expression.getFirstToken().getStart();\n const end = expression.getLastToken().getEnd();\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);\n return issue_1.Issue.atToken(lowFile, token, \"Downport contains()\", this.getMetadata().key, this.conf.severity, fix);\n }\n }\n return undefined;\n }\n replaceLineFunctions(node, lowFile, highSyntax, highFile) {\n var _a, _b;\n const spag = highSyntax.spaghetti.lookupPosition(node.getFirstToken().getStart(), lowFile.getFilename());\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\n if (r.referenceType !== _reference_1.ReferenceType.BuiltinMethodReference) {\n continue;\n }\n const func = r.position.getName().toUpperCase();\n if (func === \"LINE_EXISTS\" || func === \"LINE_INDEX\") {\n const token = r.position.getToken();\n const expression = this.findMethodCallExpression(node, token);\n if (expression === undefined) {\n continue;\n }\n let condition = \"\";\n for (const c of ((_a = expression === null || expression === void 0 ? void 0 : expression.findFirstExpression(Expressions.TableExpression)) === null || _a === void 0 ? void 0 : _a.getChildren()) || []) {\n if (c.getFirstToken().getStr() === \"[\" || c.getFirstToken().getStr() === \"]\") {\n continue;\n }\n else if (c.get() instanceof Expressions.ComponentChainSimple && condition === \"\") {\n condition = \"WITH KEY \";\n }\n else if (c.get() instanceof Expressions.Source && condition === \"\") {\n condition = \"INDEX \";\n }\n condition += c.concatTokens() + \" \";\n }\n const tableName = (_b = expression.findFirstExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens().split(\"[\")[0];\n const uniqueName = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\n const sy = func === \"LINE_EXISTS\" ? \"sy-subrc\" : \"sy-tabix\";\n const code = `DATA ${uniqueName} LIKE sy-subrc.\\n` +\n indentation + `READ TABLE ${tableName} ${condition}TRANSPORTING NO FIELDS.\\n` +\n indentation + uniqueName + ` = ${sy}.\\n` +\n indentation;\n let insertAt = node.getFirstToken().getStart();\n if (node.get() instanceof statements_1.ElseIf) {\n // assumption: no side effects in IF conditions\n insertAt = this.findStartOfIf(node, highFile);\n if (insertAt === undefined) {\n continue;\n }\n }\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, insertAt, code);\n const start = expression.getFirstToken().getStart();\n const end = expression.getLastToken().getEnd();\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, uniqueName + (func === \"LINE_EXISTS\" ? \" = 0\" : \"\"));\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n return issue_1.Issue.atToken(lowFile, token, \"Replace line function\", this.getMetadata().key, this.conf.severity, fix);\n }\n }\n return undefined;\n }\n findStartOfIf(node, highFile) {\n const structure = highFile.getStructure();\n for (const c of (structure === null || structure === void 0 ? void 0 : structure.findAllStructuresRecursive(Structures.If)) || []) {\n for (const ei of c.findDirectStructures(Structures.ElseIf)) {\n if (ei.getFirstStatement() === node) {\n return c.getFirstToken().getStart();\n }\n }\n }\n return undefined;\n }\n newToCreateObject(low, high, lowFile, highSyntax) {\n if (!(low.get() instanceof _statement_1.Unknown)) {\n return undefined;\n }\n const source = high.findDirectExpression(Expressions.Source);\n let fix = undefined;\n if (high.get() instanceof Statements.Move\n && source\n && source.getFirstToken().getStr().toUpperCase() === \"NEW\") {\n const target = high.findDirectExpression(Expressions.Target);\n const found = source === null || source === void 0 ? void 0 : source.findFirstExpression(Expressions.NewObject);\n // must be at top level of the source for quickfix to work(todo: handle more scenarios)\n if (target\n && found\n && source.concatTokens() === found.concatTokens()\n && target.findDirectExpression(Expressions.InlineData) === undefined) {\n const abap = this.newParameters(found, target.concatTokens(), highSyntax, lowFile);\n if (abap !== undefined) {\n fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), abap);\n }\n }\n }\n if (fix === undefined && high.findAllExpressions(Expressions.NewObject)) {\n const found = high.findFirstExpression(Expressions.NewObject);\n if (found === undefined) {\n return undefined;\n }\n const name = this.uniqueName(found.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\n const abap = this.newParameters(found, name, highSyntax, lowFile);\n if (abap === undefined) {\n return undefined;\n }\n const type = this.findType(found, lowFile, highSyntax);\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\n const data = `DATA ${name} TYPE REF TO ${type}.\\n` +\n indentation + abap + \"\\n\" +\n indentation;\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), data);\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, found.getFirstToken().getStart(), found.getLastToken().getEnd(), name);\n fix = edit_helper_1.EditHelper.merge(fix2, fix1);\n }\n if (fix) {\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Use CREATE OBJECT instead of NEW\", this.getMetadata().key, this.conf.severity, fix);\n }\n else {\n return undefined;\n }\n }\n newParameters(found, name, highSyntax, lowFile) {\n var _a, _b, _c;\n const typeToken = (_a = found.findDirectExpression(Expressions.TypeNameOrInfer)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\n let extra = (typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStr()) === \"#\" ? \"\" : \" TYPE \" + (typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStr());\n const parameters = found.findFirstExpression(Expressions.ParameterListS);\n if (parameters) {\n extra = parameters ? extra + \" EXPORTING \" + parameters.concatTokens() : extra;\n }\n else if (typeToken) {\n const source = (_b = found.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens();\n if (source) {\n // find the default parameter name for the constructor\n const spag = highSyntax.spaghetti.lookupPosition(typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStart(), lowFile.getFilename());\n let cdef = undefined;\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\n if ((r.referenceType === _reference_1.ReferenceType.InferredType\n || r.referenceType === _reference_1.ReferenceType.ObjectOrientedReference)\n && r.resolved && r.position.getStart().equals(typeToken.getStart())) {\n cdef = r.resolved;\n }\n }\n if (cdef && cdef.getMethodDefinitions === undefined) {\n return undefined; // something wrong\n }\n const importing = (_c = cdef === null || cdef === void 0 ? void 0 : cdef.getMethodDefinitions().getByName(\"CONSTRUCTOR\")) === null || _c === void 0 ? void 0 : _c.getParameters().getDefaultImporting();\n if (importing) {\n extra += \" EXPORTING \" + importing + \" = \" + source;\n }\n else if (spag === undefined) {\n extra += \" SpagUndefined\";\n }\n else if (cdef === undefined) {\n extra += \" ClassDefinitionNotFound\";\n }\n else {\n extra += \" SomeError\";\n }\n }\n }\n const abap = `CREATE OBJECT ${name}${extra}.`;\n return abap;\n }\n}\nexports.Downport = Downport;\n//# sourceMappingURL=downport.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/downport.js?");
|
|
12318
12318
|
|
|
12319
12319
|
/***/ }),
|
|
12320
12320
|
|
|
@@ -12578,7 +12578,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
12578
12578
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
12579
12579
|
|
|
12580
12580
|
"use strict";
|
|
12581
|
-
eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n__exportStar(__webpack_require__(/*! ./7bit_ascii */ \"./node_modules/@abaplint/core/build/src/rules/7bit_ascii.js\"), exports);\n__exportStar(__webpack_require__(/*! ./abapdoc */ \"./node_modules/@abaplint/core/build/src/rules/abapdoc.js\"), exports);\n__exportStar(__webpack_require__(/*! ./align_parameters */ \"./node_modules/@abaplint/core/build/src/rules/align_parameters.js\"), exports);\n__exportStar(__webpack_require__(/*! ./allowed_object_naming */ \"./node_modules/@abaplint/core/build/src/rules/allowed_object_naming.js\"), exports);\n__exportStar(__webpack_require__(/*! ./allowed_object_types */ \"./node_modules/@abaplint/core/build/src/rules/allowed_object_types.js\"), exports);\n__exportStar(__webpack_require__(/*! ./ambiguous_statement */ \"./node_modules/@abaplint/core/build/src/rules/ambiguous_statement.js\"), exports);\n__exportStar(__webpack_require__(/*! ./avoid_use */ \"./node_modules/@abaplint/core/build/src/rules/avoid_use.js\"), exports);\n__exportStar(__webpack_require__(/*! ./begin_end_names */ \"./node_modules/@abaplint/core/build/src/rules/begin_end_names.js\"), exports);\n__exportStar(__webpack_require__(/*! ./begin_single_include */ \"./node_modules/@abaplint/core/build/src/rules/begin_single_include.js\"), exports);\n__exportStar(__webpack_require__(/*! ./call_transaction_authority_check */ \"./node_modules/@abaplint/core/build/src/rules/call_transaction_authority_check.js\"), exports);\n__exportStar(__webpack_require__(/*! ./cds_comment_style */ \"./node_modules/@abaplint/core/build/src/rules/cds_comment_style.js\"), exports);\n__exportStar(__webpack_require__(/*! ./cds_legacy_view */ \"./node_modules/@abaplint/core/build/src/rules/cds_legacy_view.js\"), exports);\n__exportStar(__webpack_require__(/*! ./cds_parser_error */ \"./node_modules/@abaplint/core/build/src/rules/cds_parser_error.js\"), exports);\n__exportStar(__webpack_require__(/*! ./chain_mainly_declarations */ \"./node_modules/@abaplint/core/build/src/rules/chain_mainly_declarations.js\"), exports);\n__exportStar(__webpack_require__(/*! ./change_if_to_case */ \"./node_modules/@abaplint/core/build/src/rules/change_if_to_case.js\"), exports);\n__exportStar(__webpack_require__(/*! ./check_abstract */ \"./node_modules/@abaplint/core/build/src/rules/check_abstract.js\"), exports);\n__exportStar(__webpack_require__(/*! ./check_comments */ \"./node_modules/@abaplint/core/build/src/rules/check_comments.js\"), exports);\n__exportStar(__webpack_require__(/*! ./check_ddic */ \"./node_modules/@abaplint/core/build/src/rules/check_ddic.js\"), exports);\n__exportStar(__webpack_require__(/*! ./check_include */ \"./node_modules/@abaplint/core/build/src/rules/check_include.js\"), exports);\n__exportStar(__webpack_require__(/*! ./check_subrc */ \"./node_modules/@abaplint/core/build/src/rules/check_subrc.js\"), exports);\n__exportStar(__webpack_require__(/*! ./check_syntax */ \"./node_modules/@abaplint/core/build/src/rules/check_syntax.js\"), exports);\n__exportStar(__webpack_require__(/*! ./check_text_elements */ \"./node_modules/@abaplint/core/build/src/rules/check_text_elements.js\"), exports);\n__exportStar(__webpack_require__(/*! ./check_transformation_exists */ \"./node_modules/@abaplint/core/build/src/rules/check_transformation_exists.js\"), exports);\n__exportStar(__webpack_require__(/*! ./class_attribute_names */ \"./node_modules/@abaplint/core/build/src/rules/class_attribute_names.js\"), exports);\n__exportStar(__webpack_require__(/*! ./classic_exceptions_overlap */ \"./node_modules/@abaplint/core/build/src/rules/classic_exceptions_overlap.js\"), exports);\n__exportStar(__webpack_require__(/*! ./cloud_types */ \"./node_modules/@abaplint/core/build/src/rules/cloud_types.js\"), exports);\n__exportStar(__webpack_require__(/*! ./colon_missing_space */ \"./node_modules/@abaplint/core/build/src/rules/colon_missing_space.js\"), exports);\n__exportStar(__webpack_require__(/*! ./commented_code */ \"./node_modules/@abaplint/core/build/src/rules/commented_code.js\"), exports);\n__exportStar(__webpack_require__(/*! ./constant_classes */ \"./node_modules/@abaplint/core/build/src/rules/constant_classes.js\"), exports);\n__exportStar(__webpack_require__(/*! ./constructor_visibility_public */ \"./node_modules/@abaplint/core/build/src/rules/constructor_visibility_public.js\"), exports);\n__exportStar(__webpack_require__(/*! ./contains_tab */ \"./node_modules/@abaplint/core/build/src/rules/contains_tab.js\"), exports);\n__exportStar(__webpack_require__(/*! ./cyclic_oo */ \"./node_modules/@abaplint/core/build/src/rules/cyclic_oo.js\"), exports);\n__exportStar(__webpack_require__(/*! ./cyclomatic_complexity */ \"./node_modules/@abaplint/core/build/src/rules/cyclomatic_complexity.js\"), exports);\n__exportStar(__webpack_require__(/*! ./dangerous_statement */ \"./node_modules/@abaplint/core/build/src/rules/dangerous_statement.js\"), exports);\n__exportStar(__webpack_require__(/*! ./db_operation_in_loop */ \"./node_modules/@abaplint/core/build/src/rules/db_operation_in_loop.js\"), exports);\n__exportStar(__webpack_require__(/*! ./definitions_top */ \"./node_modules/@abaplint/core/build/src/rules/definitions_top.js\"), exports);\n__exportStar(__webpack_require__(/*! ./description_empty */ \"./node_modules/@abaplint/core/build/src/rules/description_empty.js\"), exports);\n__exportStar(__webpack_require__(/*! ./double_space */ \"./node_modules/@abaplint/core/build/src/rules/double_space.js\"), exports);\n__exportStar(__webpack_require__(/*! ./downport */ \"./node_modules/@abaplint/core/build/src/rules/downport.js\"), exports);\n__exportStar(__webpack_require__(/*! ./empty_line_in_statement */ \"./node_modules/@abaplint/core/build/src/rules/empty_line_in_statement.js\"), exports);\n__exportStar(__webpack_require__(/*! ./empty_statement */ \"./node_modules/@abaplint/core/build/src/rules/empty_statement.js\"), exports);\n__exportStar(__webpack_require__(/*! ./empty_structure */ \"./node_modules/@abaplint/core/build/src/rules/empty_structure.js\"), exports);\n__exportStar(__webpack_require__(/*! ./exit_or_check */ \"./node_modules/@abaplint/core/build/src/rules/exit_or_check.js\"), exports);\n__exportStar(__webpack_require__(/*! ./expand_macros */ \"./node_modules/@abaplint/core/build/src/rules/expand_macros.js\"), exports);\n__exportStar(__webpack_require__(/*! ./exporting */ \"./node_modules/@abaplint/core/build/src/rules/exporting.js\"), exports);\n__exportStar(__webpack_require__(/*! ./forbidden_identifier */ \"./node_modules/@abaplint/core/build/src/rules/forbidden_identifier.js\"), exports);\n__exportStar(__webpack_require__(/*! ./forbidden_pseudo_and_pragma */ \"./node_modules/@abaplint/core/build/src/rules/forbidden_pseudo_and_pragma.js\"), exports);\n__exportStar(__webpack_require__(/*! ./forbidden_void_type */ \"./node_modules/@abaplint/core/build/src/rules/forbidden_void_type.js\"), exports);\n__exportStar(__webpack_require__(/*! ./form_tables_obsolete */ \"./node_modules/@abaplint/core/build/src/rules/form_tables_obsolete.js\"), exports);\n__exportStar(__webpack_require__(/*! ./fully_type_constants */ \"./node_modules/@abaplint/core/build/src/rules/fully_type_constants.js\"), exports);\n__exportStar(__webpack_require__(/*! ./fully_type_itabs */ \"./node_modules/@abaplint/core/build/src/rules/fully_type_itabs.js\"), exports);\n__exportStar(__webpack_require__(/*! ./function_module_recommendations */ \"./node_modules/@abaplint/core/build/src/rules/function_module_recommendations.js\"), exports);\n__exportStar(__webpack_require__(/*! ./functional_writing */ \"./node_modules/@abaplint/core/build/src/rules/functional_writing.js\"), exports);\n__exportStar(__webpack_require__(/*! ./global_class */ \"./node_modules/@abaplint/core/build/src/rules/global_class.js\"), exports);\n__exportStar(__webpack_require__(/*! ./identical_conditions */ \"./node_modules/@abaplint/core/build/src/rules/identical_conditions.js\"), exports);\n__exportStar(__webpack_require__(/*! ./identical_contents */ \"./node_modules/@abaplint/core/build/src/rules/identical_contents.js\"), exports);\n__exportStar(__webpack_require__(/*! ./identical_descriptions */ \"./node_modules/@abaplint/core/build/src/rules/identical_descriptions.js\"), exports);\n__exportStar(__webpack_require__(/*! ./identical_form_names */ \"./node_modules/@abaplint/core/build/src/rules/identical_form_names.js\"), exports);\n__exportStar(__webpack_require__(/*! ./if_in_if */ \"./node_modules/@abaplint/core/build/src/rules/if_in_if.js\"), exports);\n__exportStar(__webpack_require__(/*! ./implement_methods */ \"./node_modules/@abaplint/core/build/src/rules/implement_methods.js\"), exports);\n__exportStar(__webpack_require__(/*! ./in_statement_indentation */ \"./node_modules/@abaplint/core/build/src/rules/in_statement_indentation.js\"), exports);\n__exportStar(__webpack_require__(/*! ./indentation */ \"./node_modules/@abaplint/core/build/src/rules/indentation.js\"), exports);\n__exportStar(__webpack_require__(/*! ./inline_data_old_versions */ \"./node_modules/@abaplint/core/build/src/rules/inline_data_old_versions.js\"), exports);\n__exportStar(__webpack_require__(/*! ./intf_referencing_clas */ \"./node_modules/@abaplint/core/build/src/rules/intf_referencing_clas.js\"), exports);\n__exportStar(__webpack_require__(/*! ./keep_single_parameter_on_one_line */ \"./node_modules/@abaplint/core/build/src/rules/keep_single_parameter_on_one_line.js\"), exports);\n__exportStar(__webpack_require__(/*! ./keyword_case */ \"./node_modules/@abaplint/core/build/src/rules/keyword_case.js\"), exports);\n__exportStar(__webpack_require__(/*! ./line_break_multiple_parameters */ \"./node_modules/@abaplint/core/build/src/rules/line_break_multiple_parameters.js\"), exports);\n__exportStar(__webpack_require__(/*! ./line_break_style */ \"./node_modules/@abaplint/core/build/src/rules/line_break_style.js\"), exports);\n__exportStar(__webpack_require__(/*! ./line_length */ \"./node_modules/@abaplint/core/build/src/rules/line_length.js\"), exports);\n__exportStar(__webpack_require__(/*! ./line_only_punc */ \"./node_modules/@abaplint/core/build/src/rules/line_only_punc.js\"), exports);\n__exportStar(__webpack_require__(/*! ./local_class_naming */ \"./node_modules/@abaplint/core/build/src/rules/local_class_naming.js\"), exports);\n__exportStar(__webpack_require__(/*! ./local_testclass_consistency */ \"./node_modules/@abaplint/core/build/src/rules/local_testclass_consistency.js\"), exports);\n__exportStar(__webpack_require__(/*! ./local_variable_names */ \"./node_modules/@abaplint/core/build/src/rules/local_variable_names.js\"), exports);\n__exportStar(__webpack_require__(/*! ./main_file_contents */ \"./node_modules/@abaplint/core/build/src/rules/main_file_contents.js\"), exports);\n__exportStar(__webpack_require__(/*! ./many_parentheses */ \"./node_modules/@abaplint/core/build/src/rules/many_parentheses.js\"), exports);\n__exportStar(__webpack_require__(/*! ./max_one_method_parameter_per_line */ \"./node_modules/@abaplint/core/build/src/rules/max_one_method_parameter_per_line.js\"), exports);\n__exportStar(__webpack_require__(/*! ./max_one_statement */ \"./node_modules/@abaplint/core/build/src/rules/max_one_statement.js\"), exports);\n__exportStar(__webpack_require__(/*! ./message_exists */ \"./node_modules/@abaplint/core/build/src/rules/message_exists.js\"), exports);\n__exportStar(__webpack_require__(/*! ./method_implemented_twice */ \"./node_modules/@abaplint/core/build/src/rules/method_implemented_twice.js\"), exports);\n__exportStar(__webpack_require__(/*! ./method_length */ \"./node_modules/@abaplint/core/build/src/rules/method_length.js\"), exports);\n__exportStar(__webpack_require__(/*! ./method_overwrites_builtin */ \"./node_modules/@abaplint/core/build/src/rules/method_overwrites_builtin.js\"), exports);\n__exportStar(__webpack_require__(/*! ./method_parameter_names */ \"./node_modules/@abaplint/core/build/src/rules/method_parameter_names.js\"), exports);\n__exportStar(__webpack_require__(/*! ./mix_returning */ \"./node_modules/@abaplint/core/build/src/rules/mix_returning.js\"), exports);\n__exportStar(__webpack_require__(/*! ./modify_only_own_db_tables */ \"./node_modules/@abaplint/core/build/src/rules/modify_only_own_db_tables.js\"), exports);\n__exportStar(__webpack_require__(/*! ./msag_consistency */ \"./node_modules/@abaplint/core/build/src/rules/msag_consistency.js\"), exports);\n__exportStar(__webpack_require__(/*! ./names_no_dash */ \"./node_modules/@abaplint/core/build/src/rules/names_no_dash.js\"), exports);\n__exportStar(__webpack_require__(/*! ./nesting */ \"./node_modules/@abaplint/core/build/src/rules/nesting.js\"), exports);\n__exportStar(__webpack_require__(/*! ./newline_between_methods */ \"./node_modules/@abaplint/core/build/src/rules/newline_between_methods.js\"), exports);\n__exportStar(__webpack_require__(/*! ./no_aliases */ \"./node_modules/@abaplint/core/build/src/rules/no_aliases.js\"), exports);\n__exportStar(__webpack_require__(/*! ./no_chained_assignment */ \"./node_modules/@abaplint/core/build/src/rules/no_chained_assignment.js\"), exports);\n__exportStar(__webpack_require__(/*! ./no_external_form_calls */ \"./node_modules/@abaplint/core/build/src/rules/no_external_form_calls.js\"), exports);\n__exportStar(__webpack_require__(/*! ./no_inline_in_optional_branches */ \"./node_modules/@abaplint/core/build/src/rules/no_inline_in_optional_branches.js\"), exports);\n__exportStar(__webpack_require__(/*! ./no_public_attributes */ \"./node_modules/@abaplint/core/build/src/rules/no_public_attributes.js\"), exports);\n__exportStar(__webpack_require__(/*! ./no_yoda_conditions */ \"./node_modules/@abaplint/core/build/src/rules/no_yoda_conditions.js\"), exports);\n__exportStar(__webpack_require__(/*! ./nrob_consistency */ \"./node_modules/@abaplint/core/build/src/rules/nrob_consistency.js\"), exports);\n__exportStar(__webpack_require__(/*! ./object_naming */ \"./node_modules/@abaplint/core/build/src/rules/object_naming.js\"), exports);\n__exportStar(__webpack_require__(/*! ./obsolete_statement */ \"./node_modules/@abaplint/core/build/src/rules/obsolete_statement.js\"), exports);\n__exportStar(__webpack_require__(/*! ./omit_parameter_name */ \"./node_modules/@abaplint/core/build/src/rules/omit_parameter_name.js\"), exports);\n__exportStar(__webpack_require__(/*! ./omit_preceding_zeros */ \"./node_modules/@abaplint/core/build/src/rules/omit_preceding_zeros.js\"), exports);\n__exportStar(__webpack_require__(/*! ./omit_receiving */ \"./node_modules/@abaplint/core/build/src/rules/omit_receiving.js\"), exports);\n__exportStar(__webpack_require__(/*! ./parser_702_chaining */ \"./node_modules/@abaplint/core/build/src/rules/parser_702_chaining.js\"), exports);\n__exportStar(__webpack_require__(/*! ./parser_error */ \"./node_modules/@abaplint/core/build/src/rules/parser_error.js\"), exports);\n__exportStar(__webpack_require__(/*! ./parser_missing_space */ \"./node_modules/@abaplint/core/build/src/rules/parser_missing_space.js\"), exports);\n__exportStar(__webpack_require__(/*! ./pragma_style */ \"./node_modules/@abaplint/core/build/src/rules/pragma_style.js\"), exports);\n__exportStar(__webpack_require__(/*! ./prefer_corresponding */ \"./node_modules/@abaplint/core/build/src/rules/prefer_corresponding.js\"), exports);\n__exportStar(__webpack_require__(/*! ./prefer_inline */ \"./node_modules/@abaplint/core/build/src/rules/prefer_inline.js\"), exports);\n__exportStar(__webpack_require__(/*! ./prefer_is_not */ \"./node_modules/@abaplint/core/build/src/rules/prefer_is_not.js\"), exports);\n__exportStar(__webpack_require__(/*! ./prefer_raise_exception_new */ \"./node_modules/@abaplint/core/build/src/rules/prefer_raise_exception_new.js\"), exports);\n__exportStar(__webpack_require__(/*! ./prefer_returning_to_exporting */ \"./node_modules/@abaplint/core/build/src/rules/prefer_returning_to_exporting.js\"), exports);\n__exportStar(__webpack_require__(/*! ./prefer_xsdbool */ \"./node_modules/@abaplint/core/build/src/rules/prefer_xsdbool.js\"), exports);\n__exportStar(__webpack_require__(/*! ./preferred_compare_operator */ \"./node_modules/@abaplint/core/build/src/rules/preferred_compare_operator.js\"), exports);\n__exportStar(__webpack_require__(/*! ./prefix_is_current_class */ \"./node_modules/@abaplint/core/build/src/rules/prefix_is_current_class.js\"), exports);\n__exportStar(__webpack_require__(/*! ./reduce_string_templates */ \"./node_modules/@abaplint/core/build/src/rules/reduce_string_templates.js\"), exports);\n__exportStar(__webpack_require__(/*! ./release_idoc */ \"./node_modules/@abaplint/core/build/src/rules/release_idoc.js\"), exports);\n__exportStar(__webpack_require__(/*! ./remove_descriptions */ \"./node_modules/@abaplint/core/build/src/rules/remove_descriptions.js\"), exports);\n__exportStar(__webpack_require__(/*! ./rfc_error_handling */ \"./node_modules/@abaplint/core/build/src/rules/rfc_error_handling.js\"), exports);\n__exportStar(__webpack_require__(/*! ./select_add_order_by */ \"./node_modules/@abaplint/core/build/src/rules/select_add_order_by.js\"), exports);\n__exportStar(__webpack_require__(/*! ./select_performance */ \"./node_modules/@abaplint/core/build/src/rules/select_performance.js\"), exports);\n__exportStar(__webpack_require__(/*! ./selection_screen_naming */ \"./node_modules/@abaplint/core/build/src/rules/selection_screen_naming.js\"), exports);\n__exportStar(__webpack_require__(/*! ./sequential_blank */ \"./node_modules/@abaplint/core/build/src/rules/sequential_blank.js\"), exports);\n__exportStar(__webpack_require__(/*! ./short_case */ \"./node_modules/@abaplint/core/build/src/rules/short_case.js\"), exports);\n__exportStar(__webpack_require__(/*! ./sicf_consistency */ \"./node_modules/@abaplint/core/build/src/rules/sicf_consistency.js\"), exports);\n__exportStar(__webpack_require__(/*! ./slow_parameter_passing */ \"./node_modules/@abaplint/core/build/src/rules/slow_parameter_passing.js\"), exports);\n__exportStar(__webpack_require__(/*! ./space_before_colon */ \"./node_modules/@abaplint/core/build/src/rules/space_before_colon.js\"), exports);\n__exportStar(__webpack_require__(/*! ./space_before_dot */ \"./node_modules/@abaplint/core/build/src/rules/space_before_dot.js\"), exports);\n__exportStar(__webpack_require__(/*! ./sql_escape_host_variables */ \"./node_modules/@abaplint/core/build/src/rules/sql_escape_host_variables.js\"), exports);\n__exportStar(__webpack_require__(/*! ./start_at_tab */ \"./node_modules/@abaplint/core/build/src/rules/start_at_tab.js\"), exports);\n__exportStar(__webpack_require__(/*! ./static_call_via_instance */ \"./node_modules/@abaplint/core/build/src/rules/static_call_via_instance.js\"), exports);\n__exportStar(__webpack_require__(/*! ./superclass_final */ \"./node_modules/@abaplint/core/build/src/rules/superclass_final.js\"), exports);\n__exportStar(__webpack_require__(/*! ./superfluous_value */ \"./node_modules/@abaplint/core/build/src/rules/superfluous_value.js\"), exports);\n__exportStar(__webpack_require__(/*! ./sy_modification */ \"./node_modules/@abaplint/core/build/src/rules/sy_modification.js\"), exports);\n__exportStar(__webpack_require__(/*! ./tabl_enhancement_category */ \"./node_modules/@abaplint/core/build/src/rules/tabl_enhancement_category.js\"), exports);\n__exportStar(__webpack_require__(/*! ./try_without_catch */ \"./node_modules/@abaplint/core/build/src/rules/try_without_catch.js\"), exports);\n__exportStar(__webpack_require__(/*! ./type_form_parameters */ \"./node_modules/@abaplint/core/build/src/rules/type_form_parameters.js\"), exports);\n__exportStar(__webpack_require__(/*! ./types_naming */ \"./node_modules/@abaplint/core/build/src/rules/types_naming.js\"), exports);\n__exportStar(__webpack_require__(/*! ./uncaught_exception */ \"./node_modules/@abaplint/core/build/src/rules/uncaught_exception.js\"), exports);\n__exportStar(__webpack_require__(/*! ./unknown_types */ \"./node_modules/@abaplint/core/build/src/rules/unknown_types.js\"), exports);\n__exportStar(__webpack_require__(/*! ./unnecessary_chaining */ \"./node_modules/@abaplint/core/build/src/rules/unnecessary_chaining.js\"), exports);\n__exportStar(__webpack_require__(/*! ./unnecessary_pragma */ \"./node_modules/@abaplint/core/build/src/rules/unnecessary_pragma.js\"), exports);\n__exportStar(__webpack_require__(/*! ./unnecessary_return */ \"./node_modules/@abaplint/core/build/src/rules/unnecessary_return.js\"), exports);\n__exportStar(__webpack_require__(/*! ./unreachable_code */ \"./node_modules/@abaplint/core/build/src/rules/unreachable_code.js\"), exports);\n__exportStar(__webpack_require__(/*! ./unsecure_fae */ \"./node_modules/@abaplint/core/build/src/rules/unsecure_fae.js\"), exports);\n__exportStar(__webpack_require__(/*! ./unused_ddic */ \"./node_modules/@abaplint/core/build/src/rules/unused_ddic.js\"), exports);\n__exportStar(__webpack_require__(/*! ./unused_methods */ \"./node_modules/@abaplint/core/build/src/rules/unused_methods.js\"), exports);\n__exportStar(__webpack_require__(/*! ./unused_types */ \"./node_modules/@abaplint/core/build/src/rules/unused_types.js\"), exports);\n__exportStar(__webpack_require__(/*! ./unused_variables */ \"./node_modules/@abaplint/core/build/src/rules/unused_variables.js\"), exports);\n__exportStar(__webpack_require__(/*! ./use_bool_expression */ \"./node_modules/@abaplint/core/build/src/rules/use_bool_expression.js\"), exports);\n__exportStar(__webpack_require__(/*! ./use_class_based_exceptions */ \"./node_modules/@abaplint/core/build/src/rules/use_class_based_exceptions.js\"), exports);\n__exportStar(__webpack_require__(/*! ./use_line_exists */ \"./node_modules/@abaplint/core/build/src/rules/use_line_exists.js\"), exports);\n__exportStar(__webpack_require__(/*! ./use_new */ \"./node_modules/@abaplint/core/build/src/rules/use_new.js\"), exports);\n__exportStar(__webpack_require__(/*! ./when_others_last */ \"./node_modules/@abaplint/core/build/src/rules/when_others_last.js\"), exports);\n__exportStar(__webpack_require__(/*! ./whitespace_end */ \"./node_modules/@abaplint/core/build/src/rules/whitespace_end.js\"), exports);\n__exportStar(__webpack_require__(/*! ./xml_consistency */ \"./node_modules/@abaplint/core/build/src/rules/xml_consistency.js\"), exports);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/index.js?");
|
|
12581
|
+
eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n__exportStar(__webpack_require__(/*! ./7bit_ascii */ \"./node_modules/@abaplint/core/build/src/rules/7bit_ascii.js\"), exports);\n__exportStar(__webpack_require__(/*! ./abapdoc */ \"./node_modules/@abaplint/core/build/src/rules/abapdoc.js\"), exports);\n__exportStar(__webpack_require__(/*! ./align_parameters */ \"./node_modules/@abaplint/core/build/src/rules/align_parameters.js\"), exports);\n__exportStar(__webpack_require__(/*! ./allowed_object_naming */ \"./node_modules/@abaplint/core/build/src/rules/allowed_object_naming.js\"), exports);\n__exportStar(__webpack_require__(/*! ./allowed_object_types */ \"./node_modules/@abaplint/core/build/src/rules/allowed_object_types.js\"), exports);\n__exportStar(__webpack_require__(/*! ./ambiguous_statement */ \"./node_modules/@abaplint/core/build/src/rules/ambiguous_statement.js\"), exports);\n__exportStar(__webpack_require__(/*! ./avoid_use */ \"./node_modules/@abaplint/core/build/src/rules/avoid_use.js\"), exports);\n__exportStar(__webpack_require__(/*! ./begin_end_names */ \"./node_modules/@abaplint/core/build/src/rules/begin_end_names.js\"), exports);\n__exportStar(__webpack_require__(/*! ./begin_single_include */ \"./node_modules/@abaplint/core/build/src/rules/begin_single_include.js\"), exports);\n__exportStar(__webpack_require__(/*! ./call_transaction_authority_check */ \"./node_modules/@abaplint/core/build/src/rules/call_transaction_authority_check.js\"), exports);\n__exportStar(__webpack_require__(/*! ./cds_comment_style */ \"./node_modules/@abaplint/core/build/src/rules/cds_comment_style.js\"), exports);\n__exportStar(__webpack_require__(/*! ./cds_legacy_view */ \"./node_modules/@abaplint/core/build/src/rules/cds_legacy_view.js\"), exports);\n__exportStar(__webpack_require__(/*! ./cds_parser_error */ \"./node_modules/@abaplint/core/build/src/rules/cds_parser_error.js\"), exports);\n__exportStar(__webpack_require__(/*! ./chain_mainly_declarations */ \"./node_modules/@abaplint/core/build/src/rules/chain_mainly_declarations.js\"), exports);\n__exportStar(__webpack_require__(/*! ./change_if_to_case */ \"./node_modules/@abaplint/core/build/src/rules/change_if_to_case.js\"), exports);\n__exportStar(__webpack_require__(/*! ./check_abstract */ \"./node_modules/@abaplint/core/build/src/rules/check_abstract.js\"), exports);\n__exportStar(__webpack_require__(/*! ./check_comments */ \"./node_modules/@abaplint/core/build/src/rules/check_comments.js\"), exports);\n__exportStar(__webpack_require__(/*! ./check_ddic */ \"./node_modules/@abaplint/core/build/src/rules/check_ddic.js\"), exports);\n__exportStar(__webpack_require__(/*! ./check_include */ \"./node_modules/@abaplint/core/build/src/rules/check_include.js\"), exports);\n__exportStar(__webpack_require__(/*! ./check_subrc */ \"./node_modules/@abaplint/core/build/src/rules/check_subrc.js\"), exports);\n__exportStar(__webpack_require__(/*! ./check_syntax */ \"./node_modules/@abaplint/core/build/src/rules/check_syntax.js\"), exports);\n__exportStar(__webpack_require__(/*! ./check_text_elements */ \"./node_modules/@abaplint/core/build/src/rules/check_text_elements.js\"), exports);\n__exportStar(__webpack_require__(/*! ./check_transformation_exists */ \"./node_modules/@abaplint/core/build/src/rules/check_transformation_exists.js\"), exports);\n__exportStar(__webpack_require__(/*! ./class_attribute_names */ \"./node_modules/@abaplint/core/build/src/rules/class_attribute_names.js\"), exports);\n__exportStar(__webpack_require__(/*! ./classic_exceptions_overlap */ \"./node_modules/@abaplint/core/build/src/rules/classic_exceptions_overlap.js\"), exports);\n__exportStar(__webpack_require__(/*! ./cloud_types */ \"./node_modules/@abaplint/core/build/src/rules/cloud_types.js\"), exports);\n__exportStar(__webpack_require__(/*! ./colon_missing_space */ \"./node_modules/@abaplint/core/build/src/rules/colon_missing_space.js\"), exports);\n__exportStar(__webpack_require__(/*! ./commented_code */ \"./node_modules/@abaplint/core/build/src/rules/commented_code.js\"), exports);\n__exportStar(__webpack_require__(/*! ./constant_classes */ \"./node_modules/@abaplint/core/build/src/rules/constant_classes.js\"), exports);\n__exportStar(__webpack_require__(/*! ./constructor_visibility_public */ \"./node_modules/@abaplint/core/build/src/rules/constructor_visibility_public.js\"), exports);\n__exportStar(__webpack_require__(/*! ./contains_tab */ \"./node_modules/@abaplint/core/build/src/rules/contains_tab.js\"), exports);\n__exportStar(__webpack_require__(/*! ./cyclic_oo */ \"./node_modules/@abaplint/core/build/src/rules/cyclic_oo.js\"), exports);\n__exportStar(__webpack_require__(/*! ./cyclomatic_complexity */ \"./node_modules/@abaplint/core/build/src/rules/cyclomatic_complexity.js\"), exports);\n__exportStar(__webpack_require__(/*! ./dangerous_statement */ \"./node_modules/@abaplint/core/build/src/rules/dangerous_statement.js\"), exports);\n__exportStar(__webpack_require__(/*! ./db_operation_in_loop */ \"./node_modules/@abaplint/core/build/src/rules/db_operation_in_loop.js\"), exports);\n__exportStar(__webpack_require__(/*! ./definitions_top */ \"./node_modules/@abaplint/core/build/src/rules/definitions_top.js\"), exports);\n__exportStar(__webpack_require__(/*! ./description_empty */ \"./node_modules/@abaplint/core/build/src/rules/description_empty.js\"), exports);\n__exportStar(__webpack_require__(/*! ./double_space */ \"./node_modules/@abaplint/core/build/src/rules/double_space.js\"), exports);\n__exportStar(__webpack_require__(/*! ./downport */ \"./node_modules/@abaplint/core/build/src/rules/downport.js\"), exports);\n__exportStar(__webpack_require__(/*! ./empty_line_in_statement */ \"./node_modules/@abaplint/core/build/src/rules/empty_line_in_statement.js\"), exports);\n__exportStar(__webpack_require__(/*! ./empty_statement */ \"./node_modules/@abaplint/core/build/src/rules/empty_statement.js\"), exports);\n__exportStar(__webpack_require__(/*! ./empty_structure */ \"./node_modules/@abaplint/core/build/src/rules/empty_structure.js\"), exports);\n__exportStar(__webpack_require__(/*! ./exit_or_check */ \"./node_modules/@abaplint/core/build/src/rules/exit_or_check.js\"), exports);\n__exportStar(__webpack_require__(/*! ./expand_macros */ \"./node_modules/@abaplint/core/build/src/rules/expand_macros.js\"), exports);\n__exportStar(__webpack_require__(/*! ./exporting */ \"./node_modules/@abaplint/core/build/src/rules/exporting.js\"), exports);\n__exportStar(__webpack_require__(/*! ./forbidden_identifier */ \"./node_modules/@abaplint/core/build/src/rules/forbidden_identifier.js\"), exports);\n__exportStar(__webpack_require__(/*! ./forbidden_pseudo_and_pragma */ \"./node_modules/@abaplint/core/build/src/rules/forbidden_pseudo_and_pragma.js\"), exports);\n__exportStar(__webpack_require__(/*! ./forbidden_void_type */ \"./node_modules/@abaplint/core/build/src/rules/forbidden_void_type.js\"), exports);\n__exportStar(__webpack_require__(/*! ./form_tables_obsolete */ \"./node_modules/@abaplint/core/build/src/rules/form_tables_obsolete.js\"), exports);\n__exportStar(__webpack_require__(/*! ./fully_type_constants */ \"./node_modules/@abaplint/core/build/src/rules/fully_type_constants.js\"), exports);\n__exportStar(__webpack_require__(/*! ./fully_type_itabs */ \"./node_modules/@abaplint/core/build/src/rules/fully_type_itabs.js\"), exports);\n__exportStar(__webpack_require__(/*! ./function_module_recommendations */ \"./node_modules/@abaplint/core/build/src/rules/function_module_recommendations.js\"), exports);\n__exportStar(__webpack_require__(/*! ./functional_writing */ \"./node_modules/@abaplint/core/build/src/rules/functional_writing.js\"), exports);\n__exportStar(__webpack_require__(/*! ./global_class */ \"./node_modules/@abaplint/core/build/src/rules/global_class.js\"), exports);\n__exportStar(__webpack_require__(/*! ./identical_conditions */ \"./node_modules/@abaplint/core/build/src/rules/identical_conditions.js\"), exports);\n__exportStar(__webpack_require__(/*! ./identical_contents */ \"./node_modules/@abaplint/core/build/src/rules/identical_contents.js\"), exports);\n__exportStar(__webpack_require__(/*! ./identical_descriptions */ \"./node_modules/@abaplint/core/build/src/rules/identical_descriptions.js\"), exports);\n__exportStar(__webpack_require__(/*! ./identical_form_names */ \"./node_modules/@abaplint/core/build/src/rules/identical_form_names.js\"), exports);\n__exportStar(__webpack_require__(/*! ./if_in_if */ \"./node_modules/@abaplint/core/build/src/rules/if_in_if.js\"), exports);\n__exportStar(__webpack_require__(/*! ./implement_methods */ \"./node_modules/@abaplint/core/build/src/rules/implement_methods.js\"), exports);\n__exportStar(__webpack_require__(/*! ./in_statement_indentation */ \"./node_modules/@abaplint/core/build/src/rules/in_statement_indentation.js\"), exports);\n__exportStar(__webpack_require__(/*! ./indentation */ \"./node_modules/@abaplint/core/build/src/rules/indentation.js\"), exports);\n__exportStar(__webpack_require__(/*! ./inline_data_old_versions */ \"./node_modules/@abaplint/core/build/src/rules/inline_data_old_versions.js\"), exports);\n__exportStar(__webpack_require__(/*! ./intf_referencing_clas */ \"./node_modules/@abaplint/core/build/src/rules/intf_referencing_clas.js\"), exports);\n__exportStar(__webpack_require__(/*! ./keep_single_parameter_on_one_line */ \"./node_modules/@abaplint/core/build/src/rules/keep_single_parameter_on_one_line.js\"), exports);\n__exportStar(__webpack_require__(/*! ./keyword_case */ \"./node_modules/@abaplint/core/build/src/rules/keyword_case.js\"), exports);\n__exportStar(__webpack_require__(/*! ./line_break_multiple_parameters */ \"./node_modules/@abaplint/core/build/src/rules/line_break_multiple_parameters.js\"), exports);\n__exportStar(__webpack_require__(/*! ./line_break_style */ \"./node_modules/@abaplint/core/build/src/rules/line_break_style.js\"), exports);\n__exportStar(__webpack_require__(/*! ./line_length */ \"./node_modules/@abaplint/core/build/src/rules/line_length.js\"), exports);\n__exportStar(__webpack_require__(/*! ./line_only_punc */ \"./node_modules/@abaplint/core/build/src/rules/line_only_punc.js\"), exports);\n__exportStar(__webpack_require__(/*! ./local_class_naming */ \"./node_modules/@abaplint/core/build/src/rules/local_class_naming.js\"), exports);\n__exportStar(__webpack_require__(/*! ./local_testclass_consistency */ \"./node_modules/@abaplint/core/build/src/rules/local_testclass_consistency.js\"), exports);\n__exportStar(__webpack_require__(/*! ./local_variable_names */ \"./node_modules/@abaplint/core/build/src/rules/local_variable_names.js\"), exports);\n__exportStar(__webpack_require__(/*! ./main_file_contents */ \"./node_modules/@abaplint/core/build/src/rules/main_file_contents.js\"), exports);\n__exportStar(__webpack_require__(/*! ./many_parentheses */ \"./node_modules/@abaplint/core/build/src/rules/many_parentheses.js\"), exports);\n__exportStar(__webpack_require__(/*! ./max_one_method_parameter_per_line */ \"./node_modules/@abaplint/core/build/src/rules/max_one_method_parameter_per_line.js\"), exports);\n__exportStar(__webpack_require__(/*! ./max_one_statement */ \"./node_modules/@abaplint/core/build/src/rules/max_one_statement.js\"), exports);\n__exportStar(__webpack_require__(/*! ./message_exists */ \"./node_modules/@abaplint/core/build/src/rules/message_exists.js\"), exports);\n__exportStar(__webpack_require__(/*! ./method_implemented_twice */ \"./node_modules/@abaplint/core/build/src/rules/method_implemented_twice.js\"), exports);\n__exportStar(__webpack_require__(/*! ./method_length */ \"./node_modules/@abaplint/core/build/src/rules/method_length.js\"), exports);\n__exportStar(__webpack_require__(/*! ./method_overwrites_builtin */ \"./node_modules/@abaplint/core/build/src/rules/method_overwrites_builtin.js\"), exports);\n__exportStar(__webpack_require__(/*! ./method_parameter_names */ \"./node_modules/@abaplint/core/build/src/rules/method_parameter_names.js\"), exports);\n__exportStar(__webpack_require__(/*! ./mix_returning */ \"./node_modules/@abaplint/core/build/src/rules/mix_returning.js\"), exports);\n__exportStar(__webpack_require__(/*! ./modify_only_own_db_tables */ \"./node_modules/@abaplint/core/build/src/rules/modify_only_own_db_tables.js\"), exports);\n__exportStar(__webpack_require__(/*! ./msag_consistency */ \"./node_modules/@abaplint/core/build/src/rules/msag_consistency.js\"), exports);\n__exportStar(__webpack_require__(/*! ./names_no_dash */ \"./node_modules/@abaplint/core/build/src/rules/names_no_dash.js\"), exports);\n__exportStar(__webpack_require__(/*! ./nesting */ \"./node_modules/@abaplint/core/build/src/rules/nesting.js\"), exports);\n__exportStar(__webpack_require__(/*! ./newline_between_methods */ \"./node_modules/@abaplint/core/build/src/rules/newline_between_methods.js\"), exports);\n__exportStar(__webpack_require__(/*! ./no_aliases */ \"./node_modules/@abaplint/core/build/src/rules/no_aliases.js\"), exports);\n__exportStar(__webpack_require__(/*! ./no_chained_assignment */ \"./node_modules/@abaplint/core/build/src/rules/no_chained_assignment.js\"), exports);\n__exportStar(__webpack_require__(/*! ./no_external_form_calls */ \"./node_modules/@abaplint/core/build/src/rules/no_external_form_calls.js\"), exports);\n__exportStar(__webpack_require__(/*! ./no_inline_in_optional_branches */ \"./node_modules/@abaplint/core/build/src/rules/no_inline_in_optional_branches.js\"), exports);\n__exportStar(__webpack_require__(/*! ./no_public_attributes */ \"./node_modules/@abaplint/core/build/src/rules/no_public_attributes.js\"), exports);\n__exportStar(__webpack_require__(/*! ./no_yoda_conditions */ \"./node_modules/@abaplint/core/build/src/rules/no_yoda_conditions.js\"), exports);\n__exportStar(__webpack_require__(/*! ./nrob_consistency */ \"./node_modules/@abaplint/core/build/src/rules/nrob_consistency.js\"), exports);\n__exportStar(__webpack_require__(/*! ./object_naming */ \"./node_modules/@abaplint/core/build/src/rules/object_naming.js\"), exports);\n__exportStar(__webpack_require__(/*! ./obsolete_statement */ \"./node_modules/@abaplint/core/build/src/rules/obsolete_statement.js\"), exports);\n__exportStar(__webpack_require__(/*! ./omit_parameter_name */ \"./node_modules/@abaplint/core/build/src/rules/omit_parameter_name.js\"), exports);\n__exportStar(__webpack_require__(/*! ./omit_preceding_zeros */ \"./node_modules/@abaplint/core/build/src/rules/omit_preceding_zeros.js\"), exports);\n__exportStar(__webpack_require__(/*! ./omit_receiving */ \"./node_modules/@abaplint/core/build/src/rules/omit_receiving.js\"), exports);\n__exportStar(__webpack_require__(/*! ./parser_702_chaining */ \"./node_modules/@abaplint/core/build/src/rules/parser_702_chaining.js\"), exports);\n__exportStar(__webpack_require__(/*! ./parser_error */ \"./node_modules/@abaplint/core/build/src/rules/parser_error.js\"), exports);\n__exportStar(__webpack_require__(/*! ./parser_missing_space */ \"./node_modules/@abaplint/core/build/src/rules/parser_missing_space.js\"), exports);\n__exportStar(__webpack_require__(/*! ./pragma_style */ \"./node_modules/@abaplint/core/build/src/rules/pragma_style.js\"), exports);\n__exportStar(__webpack_require__(/*! ./prefer_corresponding */ \"./node_modules/@abaplint/core/build/src/rules/prefer_corresponding.js\"), exports);\n__exportStar(__webpack_require__(/*! ./prefer_inline */ \"./node_modules/@abaplint/core/build/src/rules/prefer_inline.js\"), exports);\n__exportStar(__webpack_require__(/*! ./prefer_is_not */ \"./node_modules/@abaplint/core/build/src/rules/prefer_is_not.js\"), exports);\n__exportStar(__webpack_require__(/*! ./prefer_raise_exception_new */ \"./node_modules/@abaplint/core/build/src/rules/prefer_raise_exception_new.js\"), exports);\n__exportStar(__webpack_require__(/*! ./prefer_returning_to_exporting */ \"./node_modules/@abaplint/core/build/src/rules/prefer_returning_to_exporting.js\"), exports);\n__exportStar(__webpack_require__(/*! ./prefer_xsdbool */ \"./node_modules/@abaplint/core/build/src/rules/prefer_xsdbool.js\"), exports);\n__exportStar(__webpack_require__(/*! ./preferred_compare_operator */ \"./node_modules/@abaplint/core/build/src/rules/preferred_compare_operator.js\"), exports);\n__exportStar(__webpack_require__(/*! ./prefix_is_current_class */ \"./node_modules/@abaplint/core/build/src/rules/prefix_is_current_class.js\"), exports);\n__exportStar(__webpack_require__(/*! ./reduce_string_templates */ \"./node_modules/@abaplint/core/build/src/rules/reduce_string_templates.js\"), exports);\n__exportStar(__webpack_require__(/*! ./release_idoc */ \"./node_modules/@abaplint/core/build/src/rules/release_idoc.js\"), exports);\n__exportStar(__webpack_require__(/*! ./remove_descriptions */ \"./node_modules/@abaplint/core/build/src/rules/remove_descriptions.js\"), exports);\n__exportStar(__webpack_require__(/*! ./rfc_error_handling */ \"./node_modules/@abaplint/core/build/src/rules/rfc_error_handling.js\"), exports);\n__exportStar(__webpack_require__(/*! ./select_add_order_by */ \"./node_modules/@abaplint/core/build/src/rules/select_add_order_by.js\"), exports);\n__exportStar(__webpack_require__(/*! ./select_performance */ \"./node_modules/@abaplint/core/build/src/rules/select_performance.js\"), exports);\n__exportStar(__webpack_require__(/*! ./selection_screen_naming */ \"./node_modules/@abaplint/core/build/src/rules/selection_screen_naming.js\"), exports);\n__exportStar(__webpack_require__(/*! ./sequential_blank */ \"./node_modules/@abaplint/core/build/src/rules/sequential_blank.js\"), exports);\n__exportStar(__webpack_require__(/*! ./short_case */ \"./node_modules/@abaplint/core/build/src/rules/short_case.js\"), exports);\n__exportStar(__webpack_require__(/*! ./sicf_consistency */ \"./node_modules/@abaplint/core/build/src/rules/sicf_consistency.js\"), exports);\n__exportStar(__webpack_require__(/*! ./slow_parameter_passing */ \"./node_modules/@abaplint/core/build/src/rules/slow_parameter_passing.js\"), exports);\n__exportStar(__webpack_require__(/*! ./space_before_colon */ \"./node_modules/@abaplint/core/build/src/rules/space_before_colon.js\"), exports);\n__exportStar(__webpack_require__(/*! ./space_before_dot */ \"./node_modules/@abaplint/core/build/src/rules/space_before_dot.js\"), exports);\n__exportStar(__webpack_require__(/*! ./sql_escape_host_variables */ \"./node_modules/@abaplint/core/build/src/rules/sql_escape_host_variables.js\"), exports);\n__exportStar(__webpack_require__(/*! ./start_at_tab */ \"./node_modules/@abaplint/core/build/src/rules/start_at_tab.js\"), exports);\n__exportStar(__webpack_require__(/*! ./static_call_via_instance */ \"./node_modules/@abaplint/core/build/src/rules/static_call_via_instance.js\"), exports);\n__exportStar(__webpack_require__(/*! ./strict_sql */ \"./node_modules/@abaplint/core/build/src/rules/strict_sql.js\"), exports);\n__exportStar(__webpack_require__(/*! ./superclass_final */ \"./node_modules/@abaplint/core/build/src/rules/superclass_final.js\"), exports);\n__exportStar(__webpack_require__(/*! ./superfluous_value */ \"./node_modules/@abaplint/core/build/src/rules/superfluous_value.js\"), exports);\n__exportStar(__webpack_require__(/*! ./sy_modification */ \"./node_modules/@abaplint/core/build/src/rules/sy_modification.js\"), exports);\n__exportStar(__webpack_require__(/*! ./tabl_enhancement_category */ \"./node_modules/@abaplint/core/build/src/rules/tabl_enhancement_category.js\"), exports);\n__exportStar(__webpack_require__(/*! ./try_without_catch */ \"./node_modules/@abaplint/core/build/src/rules/try_without_catch.js\"), exports);\n__exportStar(__webpack_require__(/*! ./type_form_parameters */ \"./node_modules/@abaplint/core/build/src/rules/type_form_parameters.js\"), exports);\n__exportStar(__webpack_require__(/*! ./types_naming */ \"./node_modules/@abaplint/core/build/src/rules/types_naming.js\"), exports);\n__exportStar(__webpack_require__(/*! ./uncaught_exception */ \"./node_modules/@abaplint/core/build/src/rules/uncaught_exception.js\"), exports);\n__exportStar(__webpack_require__(/*! ./unknown_types */ \"./node_modules/@abaplint/core/build/src/rules/unknown_types.js\"), exports);\n__exportStar(__webpack_require__(/*! ./unnecessary_chaining */ \"./node_modules/@abaplint/core/build/src/rules/unnecessary_chaining.js\"), exports);\n__exportStar(__webpack_require__(/*! ./unnecessary_pragma */ \"./node_modules/@abaplint/core/build/src/rules/unnecessary_pragma.js\"), exports);\n__exportStar(__webpack_require__(/*! ./unnecessary_return */ \"./node_modules/@abaplint/core/build/src/rules/unnecessary_return.js\"), exports);\n__exportStar(__webpack_require__(/*! ./unreachable_code */ \"./node_modules/@abaplint/core/build/src/rules/unreachable_code.js\"), exports);\n__exportStar(__webpack_require__(/*! ./unsecure_fae */ \"./node_modules/@abaplint/core/build/src/rules/unsecure_fae.js\"), exports);\n__exportStar(__webpack_require__(/*! ./unused_ddic */ \"./node_modules/@abaplint/core/build/src/rules/unused_ddic.js\"), exports);\n__exportStar(__webpack_require__(/*! ./unused_methods */ \"./node_modules/@abaplint/core/build/src/rules/unused_methods.js\"), exports);\n__exportStar(__webpack_require__(/*! ./unused_types */ \"./node_modules/@abaplint/core/build/src/rules/unused_types.js\"), exports);\n__exportStar(__webpack_require__(/*! ./unused_variables */ \"./node_modules/@abaplint/core/build/src/rules/unused_variables.js\"), exports);\n__exportStar(__webpack_require__(/*! ./use_bool_expression */ \"./node_modules/@abaplint/core/build/src/rules/use_bool_expression.js\"), exports);\n__exportStar(__webpack_require__(/*! ./use_class_based_exceptions */ \"./node_modules/@abaplint/core/build/src/rules/use_class_based_exceptions.js\"), exports);\n__exportStar(__webpack_require__(/*! ./use_line_exists */ \"./node_modules/@abaplint/core/build/src/rules/use_line_exists.js\"), exports);\n__exportStar(__webpack_require__(/*! ./use_new */ \"./node_modules/@abaplint/core/build/src/rules/use_new.js\"), exports);\n__exportStar(__webpack_require__(/*! ./when_others_last */ \"./node_modules/@abaplint/core/build/src/rules/when_others_last.js\"), exports);\n__exportStar(__webpack_require__(/*! ./whitespace_end */ \"./node_modules/@abaplint/core/build/src/rules/whitespace_end.js\"), exports);\n__exportStar(__webpack_require__(/*! ./xml_consistency */ \"./node_modules/@abaplint/core/build/src/rules/xml_consistency.js\"), exports);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/index.js?");
|
|
12582
12582
|
|
|
12583
12583
|
/***/ }),
|
|
12584
12584
|
|
|
@@ -13282,7 +13282,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
13282
13282
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13283
13283
|
|
|
13284
13284
|
"use strict";
|
|
13285
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.SQLEscapeHostVariables = exports.SQLEscapeHostVariablesConf = void 0;\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\nclass SQLEscapeHostVariablesConf extends _basic_rule_config_1.BasicRuleConfig {\n}\nexports.SQLEscapeHostVariablesConf = SQLEscapeHostVariablesConf;\nclass SQLEscapeHostVariables extends _abap_rule_1.ABAPRule {\n constructor() {\n super(...arguments);\n this.conf = new SQLEscapeHostVariablesConf();\n }\n getMetadata() {\n return {\n key: \"sql_escape_host_variables\",\n title: \"Escape SQL host variables\",\n shortDescription: `Escape SQL host variables, from 740sp05`,\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-obsolete-language-elements`,\n tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix],\n badExample: `SELECT * FROM tab INTO TABLE res WHERE field = val.`,\n goodExample: `SELECT * FROM tab INTO TABLE @res WHERE field = @val.`,\n };\n }\n getConfig() {\n return this.conf;\n }\n setConfig(conf) {\n this.conf = conf;\n }\n runParsed(file, obj) {\n const issues = [];\n const type = obj.getType();\n if (type === \"INTF\" || type === \"TYPE\") {\n return [];\n }\n if (this.reg.getConfig().getVersion() < version_1.Version.v740sp02\n && this.reg.getConfig().getVersion() !== version_1.Version.Cloud) {\n return [];\n }\n for (const s of file.getStatements()) {\n if (s.get() instanceof Statements.UpdateDatabase\n || s.get() instanceof Statements.ModifyDatabase\n || s.get() instanceof Statements.Select\n || s.get() instanceof Statements.SelectLoop\n || s.get() instanceof Statements.InsertDatabase\n || s.get() instanceof Statements.DeleteDatabase) {\n for (const o of s.findAllExpressions(Expressions.SQLSource)) {\n const first = o.getFirstChild();\n if (((first === null || first === void 0 ? void 0 : first.get()) instanceof Expressions.Source && first.getChildren()[0].get() instanceof Expressions.FieldChain)\n || ((first === null || first === void 0 ? void 0 : first.get()) instanceof Expressions.SimpleSource3 && first.getChildren()[0].get() instanceof Expressions.FieldChain)) {\n const message = \"Escape SQL host variables\";\n const firstToken = o.getFirstChild().getFirstToken();\n const fix = edit_helper_1.EditHelper.replaceToken(file, firstToken, \"@\" + (firstToken === null || firstToken === void 0 ? void 0 : firstToken.getStr()));\n const issue = issue_1.Issue.atToken(file, first.getFirstToken(), message, this.getMetadata().key, this.conf.severity, fix);\n issues.push(issue);\n break;\n }\n }\n for (const o of s.findAllExpressions(Expressions.SQLTarget)) {\n const escaped = o.findDirectTokenByText(\"@\");\n if (escaped !== undefined) {\n continue;\n }\n const message = \"Escape SQL host variables\";\n const firstToken = o.getFirstChild().getFirstToken();\n const fix = edit_helper_1.EditHelper.replaceToken(file, firstToken, \"@\" + (firstToken === null || firstToken === void 0 ? void 0 : firstToken.getStr()));\n const issue = issue_1.Issue.atToken(file, o.getFirstToken(), message, this.getMetadata().key, this.conf.severity, fix);\n issues.push(issue);\n break;\n }\n }\n }\n return issues;\n }\n}\nexports.SQLEscapeHostVariables = SQLEscapeHostVariables;\n//# sourceMappingURL=sql_escape_host_variables.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/sql_escape_host_variables.js?");
|
|
13285
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.SQLEscapeHostVariables = exports.SQLEscapeHostVariablesConf = void 0;\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\nclass SQLEscapeHostVariablesConf extends _basic_rule_config_1.BasicRuleConfig {\n}\nexports.SQLEscapeHostVariablesConf = SQLEscapeHostVariablesConf;\nclass SQLEscapeHostVariables extends _abap_rule_1.ABAPRule {\n constructor() {\n super(...arguments);\n this.conf = new SQLEscapeHostVariablesConf();\n }\n getMetadata() {\n return {\n key: \"sql_escape_host_variables\",\n title: \"Escape SQL host variables\",\n shortDescription: `Escape SQL host variables, from 740sp05`,\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-obsolete-language-elements`,\n tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.Syntax],\n badExample: `SELECT * FROM tab INTO TABLE res WHERE field = val.`,\n goodExample: `SELECT * FROM tab INTO TABLE @res WHERE field = @val.`,\n };\n }\n getConfig() {\n return this.conf;\n }\n setConfig(conf) {\n this.conf = conf;\n }\n runParsed(file, obj) {\n const issues = [];\n const type = obj.getType();\n if (type === \"INTF\" || type === \"TYPE\") {\n return [];\n }\n if (this.reg.getConfig().getVersion() < version_1.Version.v740sp02\n && this.reg.getConfig().getVersion() !== version_1.Version.Cloud) {\n return [];\n }\n for (const s of file.getStatements()) {\n if (s.get() instanceof Statements.UpdateDatabase\n || s.get() instanceof Statements.ModifyDatabase\n || s.get() instanceof Statements.Select\n || s.get() instanceof Statements.SelectLoop\n || s.get() instanceof Statements.InsertDatabase\n || s.get() instanceof Statements.DeleteDatabase) {\n for (const o of s.findAllExpressions(Expressions.SQLSource)) {\n const first = o.getFirstChild();\n if (((first === null || first === void 0 ? void 0 : first.get()) instanceof Expressions.Source && first.getChildren()[0].get() instanceof Expressions.FieldChain)\n || ((first === null || first === void 0 ? void 0 : first.get()) instanceof Expressions.SimpleSource3 && first.getChildren()[0].get() instanceof Expressions.FieldChain)) {\n const message = \"Escape SQL host variables\";\n const firstToken = o.getFirstChild().getFirstToken();\n const fix = edit_helper_1.EditHelper.replaceToken(file, firstToken, \"@\" + (firstToken === null || firstToken === void 0 ? void 0 : firstToken.getStr()));\n const issue = issue_1.Issue.atToken(file, first.getFirstToken(), message, this.getMetadata().key, this.conf.severity, fix);\n issues.push(issue);\n break;\n }\n }\n for (const o of s.findAllExpressions(Expressions.SQLTarget)) {\n const escaped = o.findDirectTokenByText(\"@\");\n if (escaped !== undefined) {\n continue;\n }\n const message = \"Escape SQL host variables\";\n const firstToken = o.getFirstChild().getFirstToken();\n const fix = edit_helper_1.EditHelper.replaceToken(file, firstToken, \"@\" + (firstToken === null || firstToken === void 0 ? void 0 : firstToken.getStr()));\n const issue = issue_1.Issue.atToken(file, o.getFirstToken(), message, this.getMetadata().key, this.conf.severity, fix);\n issues.push(issue);\n break;\n }\n }\n }\n return issues;\n }\n}\nexports.SQLEscapeHostVariables = SQLEscapeHostVariables;\n//# sourceMappingURL=sql_escape_host_variables.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/sql_escape_host_variables.js?");
|
|
13286
13286
|
|
|
13287
13287
|
/***/ }),
|
|
13288
13288
|
|
|
@@ -13308,6 +13308,17 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
13308
13308
|
|
|
13309
13309
|
/***/ }),
|
|
13310
13310
|
|
|
13311
|
+
/***/ "./node_modules/@abaplint/core/build/src/rules/strict_sql.js":
|
|
13312
|
+
/*!*******************************************************************!*\
|
|
13313
|
+
!*** ./node_modules/@abaplint/core/build/src/rules/strict_sql.js ***!
|
|
13314
|
+
\*******************************************************************/
|
|
13315
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13316
|
+
|
|
13317
|
+
"use strict";
|
|
13318
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.StrictSQL = exports.StrictSQLConf = void 0;\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\nclass StrictSQLConf extends _basic_rule_config_1.BasicRuleConfig {\n}\nexports.StrictSQLConf = StrictSQLConf;\nclass StrictSQL extends _abap_rule_1.ABAPRule {\n constructor() {\n super(...arguments);\n this.conf = new StrictSQLConf();\n }\n getMetadata() {\n return {\n key: \"strict_sql\",\n title: \"Strict SQL\",\n shortDescription: `Strict SQL`,\n extendedInformation: `https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abapinto_clause.htm\r\n\r\nhttps://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abenopensql_strict_mode_750.htm\r\n\r\nAlso see separate rule sql_escape_host_variables`,\n tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Syntax],\n };\n }\n getConfig() {\n return this.conf;\n }\n setConfig(conf) {\n this.conf = conf;\n }\n runParsed(file, obj) {\n const issues = [];\n const type = obj.getType();\n if (type === \"INTF\" || type === \"TYPE\") {\n return [];\n }\n if (this.reg.getConfig().getVersion() < version_1.Version.v740sp02\n && this.reg.getConfig().getVersion() !== version_1.Version.Cloud) {\n return [];\n }\n for (const s of file.getStatements()) {\n if (s.get() instanceof Statements.Select\n || s.get() instanceof Statements.SelectLoop) {\n const expr = s.findDirectExpression(Expressions.Select);\n const where = expr === null || expr === void 0 ? void 0 : expr.findDirectExpression(Expressions.SQLCond);\n const into = (expr === null || expr === void 0 ? void 0 : expr.findDirectExpression(Expressions.SQLIntoStructure))\n || (expr === null || expr === void 0 ? void 0 : expr.findDirectExpression(Expressions.SQLIntoTable));\n if (into === undefined || where === undefined) {\n continue;\n }\n if (where.getFirstToken().getStart().isBefore(into.getFirstToken().getStart())) {\n continue;\n }\n const message = \"INTO/APPENDING must be last in strict SQL\";\n const issue = issue_1.Issue.atToken(file, s.getFirstToken(), message, this.getMetadata().key, this.conf.severity);\n issues.push(issue);\n break;\n }\n }\n return issues;\n }\n}\nexports.StrictSQL = StrictSQL;\n//# sourceMappingURL=strict_sql.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/strict_sql.js?");
|
|
13319
|
+
|
|
13320
|
+
/***/ }),
|
|
13321
|
+
|
|
13311
13322
|
/***/ "./node_modules/@abaplint/core/build/src/rules/superclass_final.js":
|
|
13312
13323
|
/*!*************************************************************************!*\
|
|
13313
13324
|
!*** ./node_modules/@abaplint/core/build/src/rules/superclass_final.js ***!
|