@abaplint/cli 2.84.11 → 2.85.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/README.md +21 -21
- package/abaplint +2 -2
- package/build/cli.js +84 -84
- package/package.json +64 -64
package/build/cli.js
CHANGED
|
@@ -170,7 +170,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
170
170
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
171
171
|
|
|
172
172
|
"use strict";
|
|
173
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Lexer = void 0;\r\nconst Tokens = __webpack_require__(/*! ./tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nconst position_1 = __webpack_require__(/*! ../../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nvar Mode;\r\n(function (Mode) {\r\n Mode[Mode[\"Normal\"] = 0] = \"Normal\";\r\n Mode[Mode[\"Ping\"] = 1] = \"Ping\";\r\n Mode[Mode[\"Str\"] = 2] = \"Str\";\r\n Mode[Mode[\"Template\"] = 3] = \"Template\";\r\n Mode[Mode[\"Comment\"] = 4] = \"Comment\";\r\n Mode[Mode[\"Pragma\"] = 5] = \"Pragma\";\r\n})(Mode || (Mode = {}));\r\nclass Buffer {\r\n constructor() {\r\n this.buf = \"\";\r\n }\r\n add(s) {\r\n this.buf = this.buf + s;\r\n }\r\n get() {\r\n return this.buf;\r\n }\r\n clear() {\r\n this.buf = \"\";\r\n }\r\n}\r\nclass Stream {\r\n constructor(raw) {\r\n this.offset = -1;\r\n this.raw = raw;\r\n this.row = 0;\r\n this.col = 0;\r\n }\r\n advance() {\r\n if (this.currentChar() === \"\\n\") {\r\n this.col = 1;\r\n this.row = this.row + 1;\r\n }\r\n if (this.offset === this.raw.length) {\r\n return false;\r\n }\r\n this.col = this.col + 1;\r\n this.offset = this.offset + 1;\r\n return true;\r\n }\r\n getCol() {\r\n return this.col;\r\n }\r\n getRow() {\r\n return this.row;\r\n }\r\n prevChar() {\r\n return this.raw.substr(this.offset - 1, 1);\r\n }\r\n prevPrevChar() {\r\n return this.raw.substr(this.offset - 2, 2);\r\n }\r\n currentChar() {\r\n if (this.offset < 0) {\r\n return \"\\n\"; // simulate newline at start of file to handle star(*) comments\r\n }\r\n return this.raw.substr(this.offset, 1);\r\n }\r\n nextChar() {\r\n return this.raw.substr(this.offset + 1, 1);\r\n }\r\n nextNextChar() {\r\n return this.raw.substr(this.offset + 1, 2);\r\n }\r\n}\r\nclass Lexer {\r\n static run(file, virtual) {\r\n this.virtual = virtual;\r\n this.tokens = [];\r\n this.m = Mode.Normal;\r\n this.process(file.getRaw());\r\n return { file, tokens: this.tokens };\r\n }\r\n static add() {\r\n const s = this.buffer.get().trim();\r\n if (s.length > 0) {\r\n const col = this.stream.getCol();\r\n const row = this.stream.getRow();\r\n let whiteBefore = false;\r\n let prev = this.stream.prevChar();\r\n if (s.length === 2) {\r\n prev = this.stream.prevPrevChar().substr(0, 1);\r\n }\r\n if (prev === \" \" || prev === \"\\n\" || prev === \"\\t\" || prev === \":\") {\r\n whiteBefore = true;\r\n }\r\n let whiteAfter = false;\r\n const next = this.stream.nextChar();\r\n if (next === \" \" || next === \"\\n\" || next === \"\\t\" || next === \":\" || next === \",\" || next === \".\" || next === \"\" || next === \"\\\"\") {\r\n whiteAfter = true;\r\n }\r\n let pos = new position_1.Position(row, col - s.length);\r\n if (this.virtual) {\r\n pos = new position_1.VirtualPosition(this.virtual, pos.getRow(), pos.getCol());\r\n }\r\n let tok = undefined;\r\n if (this.m === Mode.Comment) {\r\n tok = new Tokens.Comment(pos, s);\r\n }\r\n else if (this.m === Mode.Ping || this.m === Mode.Str) {\r\n tok = new Tokens.String(pos, s);\r\n }\r\n else if (this.m === Mode.Template) {\r\n const first = s.charAt(0);\r\n const last = s.charAt(s.length - 1);\r\n if (first === \"|\" && last === \"|\") {\r\n tok = new Tokens.StringTemplate(pos, s);\r\n }\r\n else if (first === \"|\" && last === \"{\") {\r\n tok = new Tokens.StringTemplateBegin(pos, s);\r\n }\r\n else if (first === \"}\" && last === \"|\") {\r\n tok = new Tokens.StringTemplateEnd(pos, s);\r\n }\r\n else if (first === \"}\" && last === \"{\") {\r\n tok = new Tokens.StringTemplateMiddle(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.Identifier(pos, s);\r\n }\r\n }\r\n else if (s.substr(0, 2) === \"##\") {\r\n tok = new Tokens.Pragma(pos, s);\r\n }\r\n else if (s.length === 1) {\r\n if (s === \".\" || s === \",\") {\r\n tok = new Tokens.Punctuation(pos, s);\r\n }\r\n else if (s === \"[\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WBracketLeftW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WBracketLeft(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.BracketLeftW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.BracketLeft(pos, s);\r\n }\r\n }\r\n else if (s === \"(\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WParenLeftW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WParenLeft(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.ParenLeftW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.ParenLeft(pos, s);\r\n }\r\n }\r\n else if (s === \"]\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WBracketRightW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WBracketRight(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.BracketRightW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.BracketRight(pos, s);\r\n }\r\n }\r\n else if (s === \")\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WParenRightW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WParenRight(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.ParenRightW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.ParenRight(pos, s);\r\n }\r\n }\r\n else if (s === \"-\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WDashW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WDash(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.DashW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.Dash(pos, s);\r\n }\r\n }\r\n else if (s === \"+\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WPlusW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WPlus(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.PlusW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.Plus(pos, s);\r\n }\r\n }\r\n else if (s === \"@\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WAtW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WAt(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.AtW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.At(pos, s);\r\n }\r\n }\r\n }\r\n else if (s.length === 2) {\r\n if (s === \"->\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WInstanceArrowW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WInstanceArrow(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.InstanceArrowW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.InstanceArrow(pos, s);\r\n }\r\n }\r\n else if (s === \"=>\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WStaticArrowW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WStaticArrow(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.StaticArrowW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.StaticArrow(pos, s);\r\n }\r\n }\r\n }\r\n if (tok === undefined) {\r\n tok = new Tokens.Identifier(pos, s);\r\n }\r\n this.tokens.push(tok);\r\n }\r\n this.buffer.clear();\r\n }\r\n static process(raw) {\r\n this.stream = new Stream(raw.replace(/\\r/g, \"\"));\r\n this.buffer = new Buffer();\r\n for (;;) {\r\n const current = this.stream.currentChar();\r\n this.buffer.add(current);\r\n const buf = this.buffer.get();\r\n const ahead = this.stream.nextChar();\r\n const aahead = this.stream.nextNextChar();\r\n const prev = this.stream.prevChar();\r\n if (ahead === \"'\" && this.m === Mode.Normal) {\r\n // start string\r\n this.add();\r\n this.m = Mode.Str;\r\n }\r\n else if ((ahead === \"|\" || ahead === \"}\")\r\n && this.m === Mode.Normal) {\r\n // start template\r\n this.add();\r\n this.m = Mode.Template;\r\n }\r\n else if (ahead === \"`\" && this.m === Mode.Normal) {\r\n // start ping\r\n this.add();\r\n this.m = Mode.Ping;\r\n }\r\n else if (aahead === \"##\" && this.m === Mode.Normal) {\r\n // start pragma\r\n this.add();\r\n this.m = Mode.Pragma;\r\n }\r\n else if ((ahead === \"\\\"\" || (ahead === \"*\" && current === \"\\n\"))\r\n && this.m === Mode.Normal) {\r\n // start comment\r\n this.add();\r\n this.m = Mode.Comment;\r\n }\r\n else if (this.m === Mode.Pragma && (ahead === \",\" || ahead === \":\" || ahead === \".\" || ahead === \" \" || ahead === \"\\n\")) {\r\n // end of pragma\r\n this.add();\r\n this.m = Mode.Normal;\r\n }\r\n else if (this.m === Mode.Ping\r\n && buf.length > 1\r\n && current === \"`\"\r\n && aahead !== \"``\"\r\n && (buf.match(/`/g) || []).length % 2 === 0\r\n && ahead !== \"`\") {\r\n // end of ping\r\n this.add();\r\n this.m = Mode.Normal;\r\n }\r\n else if (this.m === Mode.Template\r\n && buf.length > 1\r\n && (current === \"|\" || current === \"{\")\r\n && (prev !== \"\\\\\" || this.stream.prevPrevChar() === \"\\\\\\\\\")) {\r\n // end of template\r\n this.add();\r\n this.m = Mode.Normal;\r\n }\r\n else if (this.m === Mode.Str\r\n && current === \"'\"\r\n && buf.length > 1\r\n && aahead !== \"''\"\r\n && (buf.match(/'/g) || []).length % 2 === 0\r\n && ahead !== \"'\") {\r\n // end of string\r\n this.add();\r\n if (ahead === \"\\\"\") {\r\n this.m = Mode.Comment;\r\n }\r\n else {\r\n this.m = Mode.Normal;\r\n }\r\n }\r\n else if (this.m === Mode.Normal\r\n && (ahead === \" \"\r\n || ahead === \":\"\r\n || ahead === \".\"\r\n || ahead === \",\"\r\n || ahead === \"-\"\r\n || ahead === \"+\"\r\n || ahead === \"(\"\r\n || ahead === \")\"\r\n || ahead === \"[\"\r\n || ahead === \"]\"\r\n || (ahead === \"@\" && buf.trim().length === 0)\r\n || aahead === \"->\"\r\n || aahead === \"=>\"\r\n || ahead === \"\\t\"\r\n || ahead === \"\\n\")) {\r\n this.add();\r\n }\r\n else if (ahead === \"\\n\" && this.m !== Mode.Template) {\r\n this.add();\r\n this.m = Mode.Normal;\r\n }\r\n else if (this.m === Mode.Template && current === \"\\n\") {\r\n this.add();\r\n }\r\n else if (current === \">\"\r\n && (prev === \"-\" || prev === \"=\")\r\n && ahead !== \" \"\r\n && this.m === Mode.Normal) {\r\n // arrows\r\n this.add();\r\n }\r\n else if (this.m === Mode.Normal\r\n && (buf === \".\"\r\n || buf === \",\"\r\n || buf === \":\"\r\n || buf === \"(\"\r\n || buf === \")\"\r\n || buf === \"[\"\r\n || buf === \"]\"\r\n || buf === \"+\"\r\n || buf === \"@\"\r\n || (buf === \"-\" && ahead !== \">\"))) {\r\n this.add();\r\n }\r\n if (!this.stream.advance()) {\r\n break;\r\n }\r\n }\r\n this.add();\r\n }\r\n}\r\nexports.Lexer = Lexer;\r\n//# sourceMappingURL=lexer.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/1_lexer/lexer.js?");
|
|
173
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Lexer = void 0;\r\nconst Tokens = __webpack_require__(/*! ./tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nconst position_1 = __webpack_require__(/*! ../../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nvar Mode;\r\n(function (Mode) {\r\n Mode[Mode[\"Normal\"] = 0] = \"Normal\";\r\n Mode[Mode[\"Ping\"] = 1] = \"Ping\";\r\n Mode[Mode[\"Str\"] = 2] = \"Str\";\r\n Mode[Mode[\"Template\"] = 3] = \"Template\";\r\n Mode[Mode[\"Comment\"] = 4] = \"Comment\";\r\n Mode[Mode[\"Pragma\"] = 5] = \"Pragma\";\r\n})(Mode || (Mode = {}));\r\nclass Buffer {\r\n constructor() {\r\n this.buf = \"\";\r\n }\r\n add(s) {\r\n this.buf = this.buf + s;\r\n }\r\n get() {\r\n return this.buf;\r\n }\r\n clear() {\r\n this.buf = \"\";\r\n }\r\n}\r\nclass Stream {\r\n constructor(raw) {\r\n this.offset = -1;\r\n this.raw = raw;\r\n this.row = 0;\r\n this.col = 0;\r\n }\r\n advance() {\r\n if (this.currentChar() === \"\\n\") {\r\n this.col = 1;\r\n this.row = this.row + 1;\r\n }\r\n if (this.offset === this.raw.length) {\r\n return false;\r\n }\r\n this.col = this.col + 1;\r\n this.offset = this.offset + 1;\r\n return true;\r\n }\r\n getCol() {\r\n return this.col;\r\n }\r\n getRow() {\r\n return this.row;\r\n }\r\n prevChar() {\r\n return this.raw.substr(this.offset - 1, 1);\r\n }\r\n prevPrevChar() {\r\n return this.raw.substr(this.offset - 2, 2);\r\n }\r\n currentChar() {\r\n if (this.offset < 0) {\r\n return \"\\n\"; // simulate newline at start of file to handle star(*) comments\r\n }\r\n return this.raw.substr(this.offset, 1);\r\n }\r\n nextChar() {\r\n return this.raw.substr(this.offset + 1, 1);\r\n }\r\n nextNextChar() {\r\n return this.raw.substr(this.offset + 1, 2);\r\n }\r\n}\r\nclass Lexer {\r\n static run(file, virtual) {\r\n this.virtual = virtual;\r\n this.tokens = [];\r\n this.m = Mode.Normal;\r\n this.process(file.getRaw());\r\n return { file, tokens: this.tokens };\r\n }\r\n static add() {\r\n const s = this.buffer.get().trim();\r\n if (s.length > 0) {\r\n const col = this.stream.getCol();\r\n const row = this.stream.getRow();\r\n let whiteBefore = false;\r\n let prev = this.stream.prevChar();\r\n if (s.length === 2) {\r\n prev = this.stream.prevPrevChar().substr(0, 1);\r\n }\r\n if (prev === \" \" || prev === \"\\n\" || prev === \"\\t\" || prev === \":\") {\r\n whiteBefore = true;\r\n }\r\n let whiteAfter = false;\r\n const next = this.stream.nextChar();\r\n if (next === \" \" || next === \"\\n\" || next === \"\\t\" || next === \":\" || next === \",\" || next === \".\" || next === \"\" || next === \"\\\"\") {\r\n whiteAfter = true;\r\n }\r\n let pos = new position_1.Position(row, col - s.length);\r\n if (this.virtual) {\r\n pos = new position_1.VirtualPosition(this.virtual, pos.getRow(), pos.getCol());\r\n }\r\n let tok = undefined;\r\n if (this.m === Mode.Comment) {\r\n tok = new Tokens.Comment(pos, s);\r\n }\r\n else if (this.m === Mode.Ping || this.m === Mode.Str) {\r\n tok = new Tokens.String(pos, s);\r\n }\r\n else if (this.m === Mode.Template) {\r\n const first = s.charAt(0);\r\n const last = s.charAt(s.length - 1);\r\n if (first === \"|\" && last === \"|\") {\r\n tok = new Tokens.StringTemplate(pos, s);\r\n }\r\n else if (first === \"|\" && last === \"{\") {\r\n tok = new Tokens.StringTemplateBegin(pos, s);\r\n }\r\n else if (first === \"}\" && last === \"|\") {\r\n tok = new Tokens.StringTemplateEnd(pos, s);\r\n }\r\n else if (first === \"}\" && last === \"{\") {\r\n tok = new Tokens.StringTemplateMiddle(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.Identifier(pos, s);\r\n }\r\n }\r\n else if (s.substr(0, 2) === \"##\") {\r\n tok = new Tokens.Pragma(pos, s);\r\n }\r\n else if (s.length === 1) {\r\n if (s === \".\" || s === \",\") {\r\n tok = new Tokens.Punctuation(pos, s);\r\n }\r\n else if (s === \"[\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WBracketLeftW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WBracketLeft(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.BracketLeftW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.BracketLeft(pos, s);\r\n }\r\n }\r\n else if (s === \"(\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WParenLeftW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WParenLeft(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.ParenLeftW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.ParenLeft(pos, s);\r\n }\r\n }\r\n else if (s === \"]\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WBracketRightW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WBracketRight(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.BracketRightW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.BracketRight(pos, s);\r\n }\r\n }\r\n else if (s === \")\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WParenRightW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WParenRight(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.ParenRightW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.ParenRight(pos, s);\r\n }\r\n }\r\n else if (s === \"-\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WDashW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WDash(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.DashW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.Dash(pos, s);\r\n }\r\n }\r\n else if (s === \"+\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WPlusW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WPlus(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.PlusW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.Plus(pos, s);\r\n }\r\n }\r\n else if (s === \"@\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WAtW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WAt(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.AtW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.At(pos, s);\r\n }\r\n }\r\n }\r\n else if (s.length === 2) {\r\n if (s === \"->\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WInstanceArrowW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WInstanceArrow(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.InstanceArrowW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.InstanceArrow(pos, s);\r\n }\r\n }\r\n else if (s === \"=>\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WStaticArrowW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WStaticArrow(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.StaticArrowW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.StaticArrow(pos, s);\r\n }\r\n }\r\n }\r\n if (tok === undefined) {\r\n tok = new Tokens.Identifier(pos, s);\r\n }\r\n this.tokens.push(tok);\r\n }\r\n this.buffer.clear();\r\n }\r\n static process(raw) {\r\n this.stream = new Stream(raw.replace(/\\r/g, \"\"));\r\n this.buffer = new Buffer();\r\n for (;;) {\r\n const current = this.stream.currentChar();\r\n this.buffer.add(current);\r\n const buf = this.buffer.get();\r\n const ahead = this.stream.nextChar();\r\n const aahead = this.stream.nextNextChar();\r\n const prev = this.stream.prevChar();\r\n if (ahead === \"'\" && this.m === Mode.Normal) {\r\n // start string\r\n this.add();\r\n this.m = Mode.Str;\r\n }\r\n else if ((ahead === \"|\" || ahead === \"}\")\r\n && this.m === Mode.Normal) {\r\n // start template\r\n this.add();\r\n this.m = Mode.Template;\r\n }\r\n else if (ahead === \"`\" && this.m === Mode.Normal) {\r\n // start ping\r\n this.add();\r\n this.m = Mode.Ping;\r\n }\r\n else if (aahead === \"##\" && this.m === Mode.Normal) {\r\n // start pragma\r\n this.add();\r\n this.m = Mode.Pragma;\r\n }\r\n else if ((ahead === \"\\\"\" || (ahead === \"*\" && current === \"\\n\"))\r\n && this.m === Mode.Normal) {\r\n // start comment\r\n this.add();\r\n this.m = Mode.Comment;\r\n }\r\n else if (this.m === Mode.Pragma && (ahead === \",\" || ahead === \":\" || ahead === \".\" || ahead === \" \" || ahead === \"\\n\")) {\r\n // end of pragma\r\n this.add();\r\n this.m = Mode.Normal;\r\n }\r\n else if (this.m === Mode.Ping\r\n && buf.length > 1\r\n && current === \"`\"\r\n && aahead !== \"``\"\r\n && (buf.match(/`/g) || []).length % 2 === 0\r\n && ahead !== \"`\") {\r\n // end of ping\r\n this.add();\r\n if (ahead === `\"`) {\r\n this.m = Mode.Comment;\r\n }\r\n else {\r\n this.m = Mode.Normal;\r\n }\r\n }\r\n else if (this.m === Mode.Template\r\n && buf.length > 1\r\n && (current === \"|\" || current === \"{\")\r\n && (prev !== \"\\\\\" || this.stream.prevPrevChar() === \"\\\\\\\\\")) {\r\n // end of template\r\n this.add();\r\n this.m = Mode.Normal;\r\n }\r\n else if (this.m === Mode.Str\r\n && current === \"'\"\r\n && buf.length > 1\r\n && aahead !== \"''\"\r\n && (buf.match(/'/g) || []).length % 2 === 0\r\n && ahead !== \"'\") {\r\n // end of string\r\n this.add();\r\n if (ahead === \"\\\"\") {\r\n this.m = Mode.Comment;\r\n }\r\n else {\r\n this.m = Mode.Normal;\r\n }\r\n }\r\n else if (this.m === Mode.Normal\r\n && (ahead === \" \"\r\n || ahead === \":\"\r\n || ahead === \".\"\r\n || ahead === \",\"\r\n || ahead === \"-\"\r\n || ahead === \"+\"\r\n || ahead === \"(\"\r\n || ahead === \")\"\r\n || ahead === \"[\"\r\n || ahead === \"]\"\r\n || (ahead === \"@\" && buf.trim().length === 0)\r\n || aahead === \"->\"\r\n || aahead === \"=>\"\r\n || ahead === \"\\t\"\r\n || ahead === \"\\n\")) {\r\n this.add();\r\n }\r\n else if (ahead === \"\\n\" && this.m !== Mode.Template) {\r\n this.add();\r\n this.m = Mode.Normal;\r\n }\r\n else if (this.m === Mode.Template && current === \"\\n\") {\r\n this.add();\r\n }\r\n else if (current === \">\"\r\n && (prev === \"-\" || prev === \"=\")\r\n && ahead !== \" \"\r\n && this.m === Mode.Normal) {\r\n // arrows\r\n this.add();\r\n }\r\n else if (this.m === Mode.Normal\r\n && (buf === \".\"\r\n || buf === \",\"\r\n || buf === \":\"\r\n || buf === \"(\"\r\n || buf === \")\"\r\n || buf === \"[\"\r\n || buf === \"]\"\r\n || buf === \"+\"\r\n || buf === \"@\"\r\n || (buf === \"-\" && ahead !== \">\"))) {\r\n this.add();\r\n }\r\n if (!this.stream.advance()) {\r\n break;\r\n }\r\n }\r\n this.add();\r\n }\r\n}\r\nexports.Lexer = Lexer;\r\n//# sourceMappingURL=lexer.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/1_lexer/lexer.js?");
|
|
174
174
|
|
|
175
175
|
/***/ }),
|
|
176
176
|
|
|
@@ -379,7 +379,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
379
379
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
380
380
|
|
|
381
381
|
"use strict";
|
|
382
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ExpandMacros = void 0;\r\nconst Statements = __webpack_require__(/*! ./statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Tokens = __webpack_require__(/*! ../1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nconst _statement_1 = __webpack_require__(/*! ./statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst statement_node_1 = __webpack_require__(/*! ../nodes/statement_node */ \"./node_modules/@abaplint/core/build/src/abap/nodes/statement_node.js\");\r\nconst token_node_1 = __webpack_require__(/*! ../nodes/token_node */ \"./node_modules/@abaplint/core/build/src/abap/nodes/token_node.js\");\r\nconst statement_parser_1 = __webpack_require__(/*! ./statement_parser */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statement_parser.js\");\r\nconst memory_file_1 = __webpack_require__(/*! ../../files/memory_file */ \"./node_modules/@abaplint/core/build/src/files/memory_file.js\");\r\nconst lexer_1 = __webpack_require__(/*! ../1_lexer/lexer */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/lexer.js\");\r\nconst position_1 = __webpack_require__(/*! ../../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nclass Macros {\r\n constructor(globalMacros) {\r\n this.macros = {};\r\n for (const m of globalMacros) {\r\n this.macros[m.toUpperCase()] = [];\r\n }\r\n }\r\n addMacro(name, contents) {\r\n if (this.isMacro(name)) {\r\n return;\r\n }\r\n this.macros[name.toUpperCase()] = contents;\r\n }\r\n getContents(name) {\r\n return this.macros[name.toUpperCase()];\r\n }\r\n listMacroNames() {\r\n return Object.keys(this.macros);\r\n }\r\n isMacro(name) {\r\n if (this.macros[name.toUpperCase()]) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n}\r\nclass ExpandMacros {\r\n constructor(globalMacros, version) {\r\n this.macros = new Macros(globalMacros);\r\n this.version = version;\r\n }\r\n find(statements) {\r\n let name = undefined;\r\n let contents = [];\r\n for (let i = 0; i < statements.length; i++) {\r\n const statement = statements[i];\r\n const type = statement.get();\r\n if (type instanceof Statements.Define) {\r\n // todo, will this break if first token is a pragma?\r\n name = statement.getTokens()[1].getStr();\r\n contents = [];\r\n }\r\n else if (name) {\r\n if (type instanceof Statements.EndOfDefinition) {\r\n this.macros.addMacro(name, contents);\r\n name = undefined;\r\n }\r\n else if (!(type instanceof _statement_1.Comment)) {\r\n statements[i] = new statement_node_1.StatementNode(new _statement_1.MacroContent()).setChildren(this.tokensToNodes(statement.getTokens()));\r\n contents.push(statements[i]);\r\n }\r\n }\r\n }\r\n }\r\n handleMacros(statements) {\r\n const result = [];\r\n let containsUnknown = false;\r\n for (const statement of statements) {\r\n const type = statement.get();\r\n if (type instanceof _statement_1.Unknown || type instanceof _statement_1.MacroCall) {\r\n const macroName = this.findName(statement.getTokens());\r\n if (macroName && this.macros.isMacro(macroName)) {\r\n result.push(new statement_node_1.StatementNode(new _statement_1.MacroCall()).setChildren(this.tokensToNodes(statement.getTokens())));\r\n const expanded = this.expandContents(macroName, statement);\r\n const handled = this.handleMacros(expanded);\r\n for (const e of handled.statements) {\r\n result.push(e);\r\n }\r\n if (handled.containsUnknown === true) {\r\n containsUnknown = true;\r\n }\r\n continue;\r\n }\r\n else {\r\n containsUnknown = true;\r\n }\r\n }\r\n result.push(statement);\r\n }\r\n return { statements: result, containsUnknown };\r\n }\r\n //////////////\r\n expandContents(name, statement) {\r\n const contents = this.macros.getContents(name);\r\n if (contents === undefined || contents.length === 0) {\r\n return [];\r\n }\r\n let str = \"\";\r\n for (const c of contents) {\r\n let concat = c.concatTokens();\r\n if (c.getTerminator() === \",\") {\r\n // workaround for chained statements\r\n concat = concat.replace(/,$/, \".\");\r\n }\r\n str += concat + \"\\n\";\r\n }\r\n const inputs = this.buildInput(statement);\r\n let i = 1;\r\n for (const input of inputs) {\r\n const search = \"&\" + i;\r\n const reg = new RegExp(search, \"g\");\r\n str = str.replace(reg, input);\r\n i++;\r\n }\r\n const file = new memory_file_1.MemoryFile(\"expand_macros.abap.prog\", str);\r\n const lexerResult = lexer_1.Lexer.run(file, statement.getFirstToken().getStart());\r\n const result = new statement_parser_1.StatementParser(this.version).run([lexerResult], this.macros.listMacroNames());\r\n return result[0].statements;\r\n }\r\n buildInput(statement) {\r\n const result = [];\r\n const tokens = statement.getTokens();\r\n let build = \"\";\r\n for (let i = 1; i < tokens.length - 1; i++) {\r\n const now = tokens[i];\r\n let next = tokens[i + 1];\r\n if (i + 2 === tokens.length) {\r\n next = undefined; // dont take the punctuation\r\n }\r\n // argh, macros is a nightmare\r\n let end = now.getStart();\r\n if (end instanceof position_1.VirtualPosition) {\r\n end = new position_1.VirtualPosition(end, end.vrow, end.vcol + now.getStr().length);\r\n }\r\n else {\r\n end = now.getEnd();\r\n }\r\n if (next && next.getStart().equals(end)) {\r\n build += now.getStr();\r\n }\r\n else {\r\n build += now.getStr();\r\n result.push(build);\r\n build = \"\";\r\n }\r\n }\r\n return result;\r\n }\r\n findName(tokens) {\r\n let macroName = undefined;\r\n let previous = undefined;\r\n for (const i of tokens) {\r\n if (previous && (previous === null || previous === void 0 ? void 0 : previous.getEnd().getCol()) !== i.getStart().getCol()) {\r\n break;\r\n }\r\n else if (i instanceof Tokens.Identifier || i.getStr() === \"-\") {\r\n if (macroName === undefined) {\r\n macroName = i.getStr();\r\n }\r\n else {\r\n macroName += i.getStr();\r\n }\r\n }\r\n else if (i instanceof Tokens.Pragma) {\r\n continue;\r\n }\r\n else {\r\n break;\r\n }\r\n previous = i;\r\n }\r\n return macroName;\r\n }\r\n tokensToNodes(tokens) {\r\n const ret = [];\r\n for (const t of tokens) {\r\n ret.push(new token_node_1.TokenNode(t));\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.ExpandMacros = ExpandMacros;\r\n//# sourceMappingURL=expand_macros.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/2_statements/expand_macros.js?");
|
|
382
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ExpandMacros = void 0;\r\nconst Statements = __webpack_require__(/*! ./statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ./expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst Tokens = __webpack_require__(/*! ../1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nconst _statement_1 = __webpack_require__(/*! ./statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst statement_node_1 = __webpack_require__(/*! ../nodes/statement_node */ \"./node_modules/@abaplint/core/build/src/abap/nodes/statement_node.js\");\r\nconst token_node_1 = __webpack_require__(/*! ../nodes/token_node */ \"./node_modules/@abaplint/core/build/src/abap/nodes/token_node.js\");\r\nconst statement_parser_1 = __webpack_require__(/*! ./statement_parser */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statement_parser.js\");\r\nconst memory_file_1 = __webpack_require__(/*! ../../files/memory_file */ \"./node_modules/@abaplint/core/build/src/files/memory_file.js\");\r\nconst lexer_1 = __webpack_require__(/*! ../1_lexer/lexer */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/lexer.js\");\r\nconst position_1 = __webpack_require__(/*! ../../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nclass Macros {\r\n constructor(globalMacros) {\r\n this.macros = {};\r\n for (const m of globalMacros) {\r\n this.macros[m.toUpperCase()] = [];\r\n }\r\n }\r\n addMacro(name, contents) {\r\n if (this.isMacro(name)) {\r\n return;\r\n }\r\n this.macros[name.toUpperCase()] = contents;\r\n }\r\n getContents(name) {\r\n return this.macros[name.toUpperCase()];\r\n }\r\n listMacroNames() {\r\n return Object.keys(this.macros);\r\n }\r\n isMacro(name) {\r\n if (this.macros[name.toUpperCase()]) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n}\r\nclass ExpandMacros {\r\n // \"reg\" must be supplied if there are cross object macros via INCLUDE\r\n constructor(globalMacros, version, reg) {\r\n this.macros = new Macros(globalMacros);\r\n this.version = version;\r\n this.globalMacros = globalMacros;\r\n this.reg = reg;\r\n }\r\n find(statements) {\r\n var _a, _b;\r\n let name = undefined;\r\n let contents = [];\r\n for (let i = 0; i < statements.length; i++) {\r\n const statement = statements[i];\r\n const type = statement.get();\r\n if (type instanceof Statements.Define) {\r\n // todo, will this break if first token is a pragma?\r\n name = statement.getTokens()[1].getStr();\r\n contents = [];\r\n }\r\n else if (type instanceof Statements.Include) {\r\n const includeName = (_a = statement.findDirectExpression(Expressions.IncludeName)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n // todo, this does not take function module includes into account\r\n const prog = (_b = this.reg) === null || _b === void 0 ? void 0 : _b.getObject(\"PROG\", includeName);\r\n if (prog) {\r\n prog.parse(this.version, this.globalMacros, this.reg);\r\n const main = prog.getMainABAPFile();\r\n if (main) {\r\n // slow, this copies everything,\r\n this.find([...main.getStatements()]);\r\n }\r\n }\r\n }\r\n else if (name) {\r\n if (type instanceof Statements.EndOfDefinition) {\r\n this.macros.addMacro(name, contents);\r\n name = undefined;\r\n }\r\n else if (!(type instanceof _statement_1.Comment)) {\r\n statements[i] = new statement_node_1.StatementNode(new _statement_1.MacroContent()).setChildren(this.tokensToNodes(statement.getTokens()));\r\n contents.push(statements[i]);\r\n }\r\n }\r\n }\r\n }\r\n handleMacros(statements) {\r\n const result = [];\r\n let containsUnknown = false;\r\n for (const statement of statements) {\r\n const type = statement.get();\r\n if (type instanceof _statement_1.Unknown || type instanceof _statement_1.MacroCall) {\r\n const macroName = this.findName(statement.getTokens());\r\n if (macroName && this.macros.isMacro(macroName)) {\r\n result.push(new statement_node_1.StatementNode(new _statement_1.MacroCall()).setChildren(this.tokensToNodes(statement.getTokens())));\r\n const expanded = this.expandContents(macroName, statement);\r\n const handled = this.handleMacros(expanded);\r\n for (const e of handled.statements) {\r\n result.push(e);\r\n }\r\n if (handled.containsUnknown === true) {\r\n containsUnknown = true;\r\n }\r\n continue;\r\n }\r\n else {\r\n containsUnknown = true;\r\n }\r\n }\r\n result.push(statement);\r\n }\r\n return { statements: result, containsUnknown };\r\n }\r\n //////////////\r\n expandContents(name, statement) {\r\n const contents = this.macros.getContents(name);\r\n if (contents === undefined || contents.length === 0) {\r\n return [];\r\n }\r\n let str = \"\";\r\n for (const c of contents) {\r\n let concat = c.concatTokens();\r\n if (c.getTerminator() === \",\") {\r\n // workaround for chained statements\r\n concat = concat.replace(/,$/, \".\");\r\n }\r\n str += concat + \"\\n\";\r\n }\r\n const inputs = this.buildInput(statement);\r\n let i = 1;\r\n for (const input of inputs) {\r\n const search = \"&\" + i;\r\n const reg = new RegExp(search, \"g\");\r\n str = str.replace(reg, input);\r\n i++;\r\n }\r\n const file = new memory_file_1.MemoryFile(\"expand_macros.abap.prog\", str);\r\n const lexerResult = lexer_1.Lexer.run(file, statement.getFirstToken().getStart());\r\n const result = new statement_parser_1.StatementParser(this.version, this.reg).run([lexerResult], this.macros.listMacroNames());\r\n return result[0].statements;\r\n }\r\n buildInput(statement) {\r\n const result = [];\r\n const tokens = statement.getTokens();\r\n let build = \"\";\r\n for (let i = 1; i < tokens.length - 1; i++) {\r\n const now = tokens[i];\r\n let next = tokens[i + 1];\r\n if (i + 2 === tokens.length) {\r\n next = undefined; // dont take the punctuation\r\n }\r\n // argh, macros is a nightmare\r\n let end = now.getStart();\r\n if (end instanceof position_1.VirtualPosition) {\r\n end = new position_1.VirtualPosition(end, end.vrow, end.vcol + now.getStr().length);\r\n }\r\n else {\r\n end = now.getEnd();\r\n }\r\n if (next && next.getStart().equals(end)) {\r\n build += now.getStr();\r\n }\r\n else {\r\n build += now.getStr();\r\n result.push(build);\r\n build = \"\";\r\n }\r\n }\r\n return result;\r\n }\r\n findName(tokens) {\r\n let macroName = undefined;\r\n let previous = undefined;\r\n for (const i of tokens) {\r\n if (previous && (previous === null || previous === void 0 ? void 0 : previous.getEnd().getCol()) !== i.getStart().getCol()) {\r\n break;\r\n }\r\n else if (i instanceof Tokens.Identifier || i.getStr() === \"-\") {\r\n if (macroName === undefined) {\r\n macroName = i.getStr();\r\n }\r\n else {\r\n macroName += i.getStr();\r\n }\r\n }\r\n else if (i instanceof Tokens.Pragma) {\r\n continue;\r\n }\r\n else {\r\n break;\r\n }\r\n previous = i;\r\n }\r\n return macroName;\r\n }\r\n tokensToNodes(tokens) {\r\n const ret = [];\r\n for (const t of tokens) {\r\n ret.push(new token_node_1.TokenNode(t));\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.ExpandMacros = ExpandMacros;\r\n//# sourceMappingURL=expand_macros.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/2_statements/expand_macros.js?");
|
|
383
383
|
|
|
384
384
|
/***/ }),
|
|
385
385
|
|
|
@@ -665,7 +665,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
665
665
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
666
666
|
|
|
667
667
|
"use strict";
|
|
668
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ConcatenatedConstant = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nclass ConcatenatedConstant extends combi_1.Expression {\r\n getRunnable() {\r\n
|
|
668
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ConcatenatedConstant = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nclass ConcatenatedConstant extends combi_1.Expression {\r\n getRunnable() {\r\n const str = (0, combi_1.seq)((0, combi_1.regex)(/^`.*`$/), (0, combi_1.plusPrio)((0, combi_1.seq)(\"&\", (0, combi_1.regex)(/^`.*`$/))));\r\n const char = (0, combi_1.seq)((0, combi_1.regex)(/^'.*'$/), (0, combi_1.plusPrio)((0, combi_1.seq)(\"&\", (0, combi_1.regex)(/^'.*'$/))));\r\n return (0, combi_1.altPrio)(str, char);\r\n }\r\n}\r\nexports.ConcatenatedConstant = ConcatenatedConstant;\r\n//# sourceMappingURL=concatenated_constant.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/concatenated_constant.js?");
|
|
669
669
|
|
|
670
670
|
/***/ }),
|
|
671
671
|
|
|
@@ -1039,7 +1039,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
1039
1039
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1040
1040
|
|
|
1041
1041
|
"use strict";
|
|
1042
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FormParam = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst _1 = __webpack_require__(/*! . */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nclass FormParam extends combi_1.Expression {\r\n getRunnable() {\r\n const stru = (0, combi_1.seq)(\"STRUCTURE\", _1.
|
|
1042
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FormParam = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst _1 = __webpack_require__(/*! . */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nclass FormParam extends combi_1.Expression {\r\n getRunnable() {\r\n const stru = (0, combi_1.seq)(\"STRUCTURE\", _1.SimpleFieldChain);\r\n const ret = (0, combi_1.seq)((0, combi_1.altPrio)(_1.PassByValue, _1.FormParamName), (0, combi_1.optPrio)((0, combi_1.altPrio)(_1.FormParamType, stru)));\r\n return ret;\r\n }\r\n}\r\nexports.FormParam = FormParam;\r\n//# sourceMappingURL=form_param.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/form_param.js?");
|
|
1043
1043
|
|
|
1044
1044
|
/***/ }),
|
|
1045
1045
|
|
|
@@ -2491,7 +2491,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
2491
2491
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2492
2492
|
|
|
2493
2493
|
"use strict";
|
|
2494
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.StatementParser = exports.STATEMENT_MAX_TOKENS = void 0;\r\nconst Statements = __webpack_require__(/*! ./statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ./expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst Tokens = __webpack_require__(/*! ../1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst artifacts_1 = __webpack_require__(/*! ../artifacts */ \"./node_modules/@abaplint/core/build/src/abap/artifacts.js\");\r\nconst combi_1 = __webpack_require__(/*! ./combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst _statement_1 = __webpack_require__(/*! ./statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst expand_macros_1 = __webpack_require__(/*! ./expand_macros */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expand_macros.js\");\r\nconst tokens_1 = __webpack_require__(/*! ../1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nexports.STATEMENT_MAX_TOKENS = 1000;\r\nclass StatementMap {\r\n constructor() {\r\n this.map = {};\r\n for (const stat of artifacts_1.ArtifactsABAP.getStatements()) {\r\n const f = stat.getMatcher().first();\r\n if (f.length === 0) {\r\n throw new Error(\"StatementMap, first must have contents\");\r\n }\r\n for (const first of f) {\r\n if (this.map[first]) {\r\n this.map[first].push(stat);\r\n }\r\n else {\r\n this.map[first] = [stat];\r\n }\r\n }\r\n }\r\n }\r\n lookup(str) {\r\n const res = this.map[str.toUpperCase()];\r\n if (res === undefined) {\r\n return [];\r\n }\r\n return res;\r\n }\r\n}\r\nclass WorkArea {\r\n constructor(file, tokens) {\r\n this.file = file;\r\n this.tokens = tokens;\r\n this.statements = [];\r\n }\r\n addUnknown(pre, post, colon) {\r\n const st = new nodes_1.StatementNode(new _statement_1.Unknown(), colon);\r\n st.setChildren(this.tokensToNodes(pre, post));\r\n this.statements.push(st);\r\n }\r\n toResult() {\r\n return { file: this.file, tokens: this.tokens, statements: this.statements };\r\n }\r\n tokensToNodes(tokens1, tokens2) {\r\n const ret = [];\r\n for (const t of tokens1) {\r\n ret.push(new nodes_1.TokenNode(t));\r\n }\r\n for (const t of tokens2) {\r\n ret.push(new nodes_1.TokenNode(t));\r\n }\r\n return ret;\r\n }\r\n}\r\nclass StatementParser {\r\n constructor(version) {\r\n if (!StatementParser.map) {\r\n StatementParser.map = new StatementMap();\r\n }\r\n this.version = version;\r\n }\r\n /** input is one full object */\r\n run(input, globalMacros) {\r\n const macros = new expand_macros_1.ExpandMacros(globalMacros, this.version);\r\n const wa = input.map(i => new WorkArea(i.file, i.tokens));\r\n for (const w of wa) {\r\n this.process(w);\r\n this.categorize(w);\r\n macros.find(w.statements);\r\n }\r\n for (const w of wa) {\r\n const res = macros.handleMacros(w.statements);\r\n w.statements = res.statements;\r\n if (res.containsUnknown === true) {\r\n this.lazyUnknown(w);\r\n }\r\n this.nativeSQL(w);\r\n }\r\n return wa.map(w => w.toResult());\r\n }\r\n // todo, refactor, remove method here and only have in WorkArea class\r\n tokensToNodes(tokens) {\r\n const ret = [];\r\n for (const t of tokens) {\r\n ret.push(new nodes_1.TokenNode(t));\r\n }\r\n return ret;\r\n }\r\n // tries to split Unknown statements by newlines, when adding/writing a new statement\r\n // in an editor, adding the statement terminator is typically the last thing to do\r\n // note: this will not work if the second statement is a macro call, guess this is okay\r\n lazyUnknown(wa) {\r\n const result = [];\r\n for (let statement of wa.statements) {\r\n if (statement.get() instanceof _statement_1.Unknown) {\r\n for (const { first, second } of this.buildSplits(statement.getTokens())) {\r\n const s = this.categorizeStatement(new nodes_1.StatementNode(new _statement_1.Unknown()).setChildren(this.tokensToNodes(second)));\r\n if (!(s.get() instanceof _statement_1.Unknown)) {\r\n result.push(new nodes_1.StatementNode(new _statement_1.Unknown()).setChildren(this.tokensToNodes(first)));\r\n statement = s;\r\n break;\r\n }\r\n }\r\n }\r\n result.push(statement);\r\n }\r\n wa.statements = result;\r\n }\r\n buildSplits(tokens) {\r\n const res = [];\r\n const before = [];\r\n let prevRow = tokens[0].getRow();\r\n for (let i = 0; i < tokens.length; i++) {\r\n if (tokens[i].getRow() !== prevRow) {\r\n res.push({ first: [...before], second: [...tokens].splice(i) });\r\n }\r\n prevRow = tokens[i].getRow();\r\n before.push(tokens[i]);\r\n }\r\n return res;\r\n }\r\n nativeSQL(wa) {\r\n let sql = false;\r\n for (let i = 0; i < wa.statements.length; i++) {\r\n const statement = wa.statements[i];\r\n const type = statement.get();\r\n if (type instanceof Statements.ExecSQL\r\n || (type instanceof Statements.MethodImplementation && statement.findDirectExpression(Expressions.Language))) {\r\n sql = true;\r\n }\r\n else if (sql === true) {\r\n if (type instanceof Statements.EndExec\r\n || type instanceof Statements.EndMethod) {\r\n sql = false;\r\n }\r\n else if (!(type instanceof _statement_1.Comment)) {\r\n wa.statements[i] = new nodes_1.StatementNode(new _statement_1.NativeSQL()).setChildren(this.tokensToNodes(statement.getTokens()));\r\n }\r\n }\r\n }\r\n }\r\n // for each statement, run statement matchers to figure out which kind of statement it is\r\n categorize(wa) {\r\n const result = [];\r\n for (const statement of wa.statements) {\r\n result.push(this.categorizeStatement(statement));\r\n }\r\n wa.statements = result;\r\n }\r\n categorizeStatement(input) {\r\n let statement = input;\r\n const length = input.getChildren().length;\r\n const lastToken = input.getLastToken();\r\n const isPunctuation = lastToken instanceof Tokens.Punctuation;\r\n if (length === 1 && isPunctuation) {\r\n const tokens = statement.getTokens();\r\n statement = new nodes_1.StatementNode(new _statement_1.Empty()).setChildren(this.tokensToNodes(tokens));\r\n }\r\n else if (statement.get() instanceof _statement_1.Unknown) {\r\n if (isPunctuation) {\r\n statement = this.match(statement);\r\n }\r\n else if (length > exports.STATEMENT_MAX_TOKENS) {\r\n // if the statement contains more than STATEMENT_MAX_TOKENS tokens, just give up\r\n statement = input;\r\n }\r\n else if (length === 1 && lastToken instanceof tokens_1.Pragma) {\r\n statement = new nodes_1.StatementNode(new _statement_1.Empty(), undefined, [lastToken]);\r\n }\r\n }\r\n return statement;\r\n }\r\n removePragma(tokens) {\r\n const result = [];\r\n const pragmas = [];\r\n // skip the last token as it is the punctuation\r\n for (let i = 0; i < tokens.length - 1; i++) {\r\n const t = tokens[i];\r\n if (t instanceof Tokens.Pragma) {\r\n pragmas.push(t);\r\n }\r\n else {\r\n result.push(t);\r\n }\r\n }\r\n return { tokens: result, pragmas: pragmas };\r\n }\r\n match(statement) {\r\n const tokens = statement.getTokens();\r\n const { tokens: filtered, pragmas } = this.removePragma(tokens);\r\n if (filtered.length === 0) {\r\n return new nodes_1.StatementNode(new _statement_1.Empty()).setChildren(this.tokensToNodes(tokens));\r\n }\r\n for (const st of StatementParser.map.lookup(filtered[0].getStr())) {\r\n const match = combi_1.Combi.run(st.getMatcher(), filtered, this.version);\r\n if (match) {\r\n const last = tokens[tokens.length - 1];\r\n match.push(new nodes_1.TokenNode(last));\r\n return new nodes_1.StatementNode(st, statement.getColon(), pragmas).setChildren(match);\r\n }\r\n }\r\n // next try the statements without specific keywords\r\n for (const st of StatementParser.map.lookup(\"\")) {\r\n const match = combi_1.Combi.run(st.getMatcher(), filtered, this.version);\r\n if (match) {\r\n const last = tokens[tokens.length - 1];\r\n match.push(new nodes_1.TokenNode(last));\r\n return new nodes_1.StatementNode(st, statement.getColon(), pragmas).setChildren(match);\r\n }\r\n }\r\n return statement;\r\n }\r\n // takes care of splitting tokens into statements, also handles chained statements\r\n // statements are split by \",\" or \".\"\r\n // additional colons/chaining after the first colon are ignored\r\n process(wa) {\r\n let add = [];\r\n let pre = [];\r\n let colon = undefined;\r\n for (const token of wa.tokens) {\r\n if (token instanceof Tokens.Comment) {\r\n wa.statements.push(new nodes_1.StatementNode(new _statement_1.Comment()).setChildren(this.tokensToNodes([token])));\r\n continue;\r\n }\r\n add.push(token);\r\n const str = token.getStr();\r\n if (str === \".\") {\r\n wa.addUnknown(pre, add, colon);\r\n add = [];\r\n pre = [];\r\n colon = undefined;\r\n }\r\n else if (str === \",\" && pre.length > 0) {\r\n wa.addUnknown(pre, add, colon);\r\n add = [];\r\n }\r\n else if (str === \":\" && colon === undefined) {\r\n colon = token;\r\n add.pop(); // do not add colon token to statement\r\n pre.push(...add);\r\n add = [];\r\n }\r\n else if (str === \":\") {\r\n add.pop(); // do not add colon token to statement\r\n }\r\n }\r\n if (add.length > 0) {\r\n wa.addUnknown(pre, add, colon);\r\n }\r\n }\r\n}\r\nexports.StatementParser = StatementParser;\r\n//# sourceMappingURL=statement_parser.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/2_statements/statement_parser.js?");
|
|
2494
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.StatementParser = exports.STATEMENT_MAX_TOKENS = void 0;\r\nconst Statements = __webpack_require__(/*! ./statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ./expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst Tokens = __webpack_require__(/*! ../1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst artifacts_1 = __webpack_require__(/*! ../artifacts */ \"./node_modules/@abaplint/core/build/src/abap/artifacts.js\");\r\nconst combi_1 = __webpack_require__(/*! ./combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst _statement_1 = __webpack_require__(/*! ./statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst expand_macros_1 = __webpack_require__(/*! ./expand_macros */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expand_macros.js\");\r\nconst tokens_1 = __webpack_require__(/*! ../1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nexports.STATEMENT_MAX_TOKENS = 1000;\r\nclass StatementMap {\r\n constructor() {\r\n this.map = {};\r\n for (const stat of artifacts_1.ArtifactsABAP.getStatements()) {\r\n const f = stat.getMatcher().first();\r\n if (f.length === 0) {\r\n throw new Error(\"StatementMap, first must have contents\");\r\n }\r\n for (const first of f) {\r\n if (this.map[first]) {\r\n this.map[first].push(stat);\r\n }\r\n else {\r\n this.map[first] = [stat];\r\n }\r\n }\r\n }\r\n }\r\n lookup(str) {\r\n const res = this.map[str.toUpperCase()];\r\n if (res === undefined) {\r\n return [];\r\n }\r\n return res;\r\n }\r\n}\r\nclass WorkArea {\r\n constructor(file, tokens) {\r\n this.file = file;\r\n this.tokens = tokens;\r\n this.statements = [];\r\n }\r\n addUnknown(pre, post, colon) {\r\n const st = new nodes_1.StatementNode(new _statement_1.Unknown(), colon);\r\n st.setChildren(this.tokensToNodes(pre, post));\r\n this.statements.push(st);\r\n }\r\n toResult() {\r\n return { file: this.file, tokens: this.tokens, statements: this.statements };\r\n }\r\n tokensToNodes(tokens1, tokens2) {\r\n const ret = [];\r\n for (const t of tokens1) {\r\n ret.push(new nodes_1.TokenNode(t));\r\n }\r\n for (const t of tokens2) {\r\n ret.push(new nodes_1.TokenNode(t));\r\n }\r\n return ret;\r\n }\r\n}\r\nclass StatementParser {\r\n constructor(version, reg) {\r\n if (!StatementParser.map) {\r\n StatementParser.map = new StatementMap();\r\n }\r\n this.version = version;\r\n this.reg = reg;\r\n }\r\n /** input is one full object */\r\n run(input, globalMacros) {\r\n const macros = new expand_macros_1.ExpandMacros(globalMacros, this.version, this.reg);\r\n const wa = input.map(i => new WorkArea(i.file, i.tokens));\r\n for (const w of wa) {\r\n this.process(w);\r\n this.categorize(w);\r\n macros.find(w.statements);\r\n }\r\n for (const w of wa) {\r\n const res = macros.handleMacros(w.statements);\r\n w.statements = res.statements;\r\n if (res.containsUnknown === true) {\r\n this.lazyUnknown(w);\r\n }\r\n this.nativeSQL(w);\r\n }\r\n return wa.map(w => w.toResult());\r\n }\r\n // todo, refactor, remove method here and only have in WorkArea class\r\n tokensToNodes(tokens) {\r\n const ret = [];\r\n for (const t of tokens) {\r\n ret.push(new nodes_1.TokenNode(t));\r\n }\r\n return ret;\r\n }\r\n // tries to split Unknown statements by newlines, when adding/writing a new statement\r\n // in an editor, adding the statement terminator is typically the last thing to do\r\n // note: this will not work if the second statement is a macro call, guess this is okay\r\n lazyUnknown(wa) {\r\n const result = [];\r\n for (let statement of wa.statements) {\r\n if (statement.get() instanceof _statement_1.Unknown) {\r\n for (const { first, second } of this.buildSplits(statement.getTokens())) {\r\n const s = this.categorizeStatement(new nodes_1.StatementNode(new _statement_1.Unknown()).setChildren(this.tokensToNodes(second)));\r\n if (!(s.get() instanceof _statement_1.Unknown)) {\r\n result.push(new nodes_1.StatementNode(new _statement_1.Unknown()).setChildren(this.tokensToNodes(first)));\r\n statement = s;\r\n break;\r\n }\r\n }\r\n }\r\n result.push(statement);\r\n }\r\n wa.statements = result;\r\n }\r\n buildSplits(tokens) {\r\n const res = [];\r\n const before = [];\r\n let prevRow = tokens[0].getRow();\r\n for (let i = 0; i < tokens.length; i++) {\r\n if (tokens[i].getRow() !== prevRow) {\r\n res.push({ first: [...before], second: [...tokens].splice(i) });\r\n }\r\n prevRow = tokens[i].getRow();\r\n before.push(tokens[i]);\r\n }\r\n return res;\r\n }\r\n nativeSQL(wa) {\r\n let sql = false;\r\n for (let i = 0; i < wa.statements.length; i++) {\r\n const statement = wa.statements[i];\r\n const type = statement.get();\r\n if (type instanceof Statements.ExecSQL\r\n || (type instanceof Statements.MethodImplementation && statement.findDirectExpression(Expressions.Language))) {\r\n sql = true;\r\n }\r\n else if (sql === true) {\r\n if (type instanceof Statements.EndExec\r\n || type instanceof Statements.EndMethod) {\r\n sql = false;\r\n }\r\n else if (!(type instanceof _statement_1.Comment)) {\r\n wa.statements[i] = new nodes_1.StatementNode(new _statement_1.NativeSQL()).setChildren(this.tokensToNodes(statement.getTokens()));\r\n }\r\n }\r\n }\r\n }\r\n // for each statement, run statement matchers to figure out which kind of statement it is\r\n categorize(wa) {\r\n const result = [];\r\n for (const statement of wa.statements) {\r\n result.push(this.categorizeStatement(statement));\r\n }\r\n wa.statements = result;\r\n }\r\n categorizeStatement(input) {\r\n let statement = input;\r\n const length = input.getChildren().length;\r\n const lastToken = input.getLastToken();\r\n const isPunctuation = lastToken instanceof Tokens.Punctuation;\r\n if (length === 1 && isPunctuation) {\r\n const tokens = statement.getTokens();\r\n statement = new nodes_1.StatementNode(new _statement_1.Empty()).setChildren(this.tokensToNodes(tokens));\r\n }\r\n else if (statement.get() instanceof _statement_1.Unknown) {\r\n if (isPunctuation) {\r\n statement = this.match(statement);\r\n }\r\n else if (length > exports.STATEMENT_MAX_TOKENS) {\r\n // if the statement contains more than STATEMENT_MAX_TOKENS tokens, just give up\r\n statement = input;\r\n }\r\n else if (length === 1 && lastToken instanceof tokens_1.Pragma) {\r\n statement = new nodes_1.StatementNode(new _statement_1.Empty(), undefined, [lastToken]);\r\n }\r\n }\r\n return statement;\r\n }\r\n removePragma(tokens) {\r\n const result = [];\r\n const pragmas = [];\r\n // skip the last token as it is the punctuation\r\n for (let i = 0; i < tokens.length - 1; i++) {\r\n const t = tokens[i];\r\n if (t instanceof Tokens.Pragma) {\r\n pragmas.push(t);\r\n }\r\n else {\r\n result.push(t);\r\n }\r\n }\r\n return { tokens: result, pragmas: pragmas };\r\n }\r\n match(statement) {\r\n const tokens = statement.getTokens();\r\n const { tokens: filtered, pragmas } = this.removePragma(tokens);\r\n if (filtered.length === 0) {\r\n return new nodes_1.StatementNode(new _statement_1.Empty()).setChildren(this.tokensToNodes(tokens));\r\n }\r\n for (const st of StatementParser.map.lookup(filtered[0].getStr())) {\r\n const match = combi_1.Combi.run(st.getMatcher(), filtered, this.version);\r\n if (match) {\r\n const last = tokens[tokens.length - 1];\r\n match.push(new nodes_1.TokenNode(last));\r\n return new nodes_1.StatementNode(st, statement.getColon(), pragmas).setChildren(match);\r\n }\r\n }\r\n // next try the statements without specific keywords\r\n for (const st of StatementParser.map.lookup(\"\")) {\r\n const match = combi_1.Combi.run(st.getMatcher(), filtered, this.version);\r\n if (match) {\r\n const last = tokens[tokens.length - 1];\r\n match.push(new nodes_1.TokenNode(last));\r\n return new nodes_1.StatementNode(st, statement.getColon(), pragmas).setChildren(match);\r\n }\r\n }\r\n return statement;\r\n }\r\n // takes care of splitting tokens into statements, also handles chained statements\r\n // statements are split by \",\" or \".\"\r\n // additional colons/chaining after the first colon are ignored\r\n process(wa) {\r\n let add = [];\r\n let pre = [];\r\n let colon = undefined;\r\n for (const token of wa.tokens) {\r\n if (token instanceof Tokens.Comment) {\r\n wa.statements.push(new nodes_1.StatementNode(new _statement_1.Comment()).setChildren(this.tokensToNodes([token])));\r\n continue;\r\n }\r\n add.push(token);\r\n const str = token.getStr();\r\n if (str === \".\") {\r\n wa.addUnknown(pre, add, colon);\r\n add = [];\r\n pre = [];\r\n colon = undefined;\r\n }\r\n else if (str === \",\" && pre.length > 0) {\r\n wa.addUnknown(pre, add, colon);\r\n add = [];\r\n }\r\n else if (str === \":\" && colon === undefined) {\r\n colon = token;\r\n add.pop(); // do not add colon token to statement\r\n pre.push(...add);\r\n add = [];\r\n }\r\n else if (str === \":\") {\r\n add.pop(); // do not add colon token to statement\r\n }\r\n }\r\n if (add.length > 0) {\r\n wa.addUnknown(pre, add, colon);\r\n }\r\n }\r\n}\r\nexports.StatementParser = StatementParser;\r\n//# sourceMappingURL=statement_parser.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/2_statements/statement_parser.js?");
|
|
2495
2495
|
|
|
2496
2496
|
/***/ }),
|
|
2497
2497
|
|
|
@@ -6462,7 +6462,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
6462
6462
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
6463
6463
|
|
|
6464
6464
|
"use strict";
|
|
6465
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.BasicTypes = void 0;\r\n/* eslint-disable default-case */\r\nconst _typed_identifier_1 = __webpack_require__(/*! ../types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\r\nconst Expressions = __webpack_require__(/*! ../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst Types = __webpack_require__(/*! ../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst _scope_type_1 = __webpack_require__(/*! ./_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\r\nconst _object_oriented_1 = __webpack_require__(/*! ./_object_oriented */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js\");\r\nconst class_constant_1 = __webpack_require__(/*! ../types/class_constant */ \"./node_modules/@abaplint/core/build/src/abap/types/class_constant.js\");\r\nconst identifier_1 = __webpack_require__(/*! ../1_lexer/tokens/identifier */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/identifier.js\");\r\nconst _reference_1 = __webpack_require__(/*! ./_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nconst basic_1 = __webpack_require__(/*! ../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst field_chain_1 = __webpack_require__(/*! ./expressions/field_chain */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/field_chain.js\");\r\nconst types_1 = __webpack_require__(/*! ../types */ \"./node_modules/@abaplint/core/build/src/abap/types/index.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _builtin_1 = __webpack_require__(/*! ./_builtin */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_builtin.js\");\r\nconst position_1 = __webpack_require__(/*! ../../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nclass BasicTypes {\r\n constructor(filename, scope) {\r\n this.filename = filename;\r\n this.scope = scope;\r\n }\r\n lookupQualifiedName(name) {\r\n var _a;\r\n if (name === undefined) {\r\n return undefined;\r\n }\r\n const found = this.scope.findType(name);\r\n if (found) {\r\n return found;\r\n }\r\n if (name.includes(\"=>\")) {\r\n const split = name.split(\"=>\");\r\n const ooName = split[0];\r\n const typeName = split[1];\r\n const oo = this.scope.findObjectDefinition(ooName);\r\n if (oo) {\r\n const f = oo.getTypeDefinitions().getByName(typeName);\r\n if (f) {\r\n return f;\r\n }\r\n }\r\n }\r\n const lookup = this.scope.getDDIC().lookupNoVoid(name);\r\n const id = (_a = lookup === null || lookup === void 0 ? void 0 : lookup.object) === null || _a === void 0 ? void 0 : _a.getIdentifier();\r\n if (id && (lookup === null || lookup === void 0 ? void 0 : lookup.type)) {\r\n return new _typed_identifier_1.TypedIdentifier(id.getToken(), id.getFilename(), lookup.type);\r\n }\r\n const builtin = this.scope.getDDIC().lookupBuiltinType(name);\r\n if (builtin) {\r\n return new _typed_identifier_1.TypedIdentifier(new identifier_1.Identifier(new position_1.Position(1, 1), name), _builtin_1.BuiltIn.filename, builtin);\r\n }\r\n return undefined;\r\n }\r\n resolveLikeName(node, headerLogic = true) {\r\n var _a;\r\n if (node === undefined) {\r\n return undefined;\r\n }\r\n let chain = node.findFirstExpression(Expressions.FieldChain);\r\n if (chain === undefined) {\r\n chain = node.findFirstExpression(Expressions.TypeName);\r\n }\r\n if (chain === undefined) {\r\n chain = node.findFirstExpression(Expressions.FieldSub);\r\n }\r\n if (chain === undefined) {\r\n throw new Error(\"resolveLikeName, chain undefined\");\r\n }\r\n const fullName = chain.concatTokens();\r\n const children = [...chain.getChildren()];\r\n if (children.length === 0) {\r\n return new Types.UnknownType(\"Type error, could not resolve \\\"\" + fullName + \"\\\", resolveLikeName1\");\r\n }\r\n let type = undefined;\r\n if (children[1] && (children[1].getFirstToken().getStr() === \"=>\" || children[1].getFirstToken().getStr() === \"->\")) {\r\n type = new field_chain_1.FieldChain().runSyntax(chain, this.scope, this.filename, _reference_1.ReferenceType.TypeReference);\r\n }\r\n else {\r\n const name = children.shift().getFirstToken().getStr();\r\n let found = this.scope.findVariable(name);\r\n type = found === null || found === void 0 ? void 0 : found.getType();\r\n if (found === undefined) {\r\n found = this.scope.findExtraLikeType(name);\r\n type = found === null || found === void 0 ? void 0 : found.getType();\r\n }\r\n if (found) {\r\n this.scope.addReference(chain === null || chain === void 0 ? void 0 : chain.getFirstToken(), found, _reference_1.ReferenceType.TypeReference, this.filename);\r\n }\r\n if (type === undefined) {\r\n type = (_a = this.scope.getDDIC().lookupNoVoid(name)) === null || _a === void 0 ? void 0 : _a.type;\r\n }\r\n if (type === undefined && this.scope.isOO() === false && this.scope.getDDIC().inErrorNamespace(name) === false) {\r\n this.scope.addReference(chain.getChildren()[0].getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.filename);\r\n return new Types.VoidType(name);\r\n }\r\n while (children.length > 0) {\r\n const child = children.shift();\r\n if (child.getFirstToken().getStr() === \"-\") {\r\n if (type instanceof Types.VoidType) {\r\n return type;\r\n }\r\n }\r\n else if (child.concatTokens() === \"[]\") {\r\n if (type instanceof Types.TableType) {\r\n type = new basic_1.TableType(type.getRowType(), { withHeader: false });\r\n }\r\n }\r\n else { // field name\r\n let sub = undefined;\r\n if (type instanceof Types.TableType) {\r\n type = type.getRowType();\r\n }\r\n if (type instanceof Types.StructureType) {\r\n sub = type.getComponentByName(child.getFirstToken().getStr());\r\n }\r\n if (sub === undefined) {\r\n return new Types.UnknownType(\"Type error, field not part of structure \" + fullName);\r\n }\r\n type = sub;\r\n }\r\n }\r\n if (type instanceof Types.VoidType) {\r\n return type;\r\n }\r\n else if (type instanceof basic_1.TableType\r\n && type.isWithHeader()\r\n && headerLogic === true) {\r\n type = type.getRowType();\r\n }\r\n else if (type instanceof Types.TableType\r\n && type.isWithHeader() === true\r\n && type.getRowType() instanceof Types.VoidType) {\r\n return type.getRowType();\r\n }\r\n }\r\n if (!type) {\r\n return new Types.UnknownType(\"Type error, could not resolve \\\"\" + fullName + \"\\\", resolveLikeName2\");\r\n }\r\n return type;\r\n }\r\n resolveTypeName(typeName, length, decimals, name) {\r\n if (typeName === undefined) {\r\n return undefined;\r\n }\r\n const chain = this.resolveTypeChain(typeName);\r\n if (chain) {\r\n return chain;\r\n }\r\n const chainText = typeName.concatTokens().toUpperCase();\r\n const f = this.scope.getDDIC().lookupBuiltinType(chainText, length, decimals, name);\r\n if (f !== undefined) {\r\n return f;\r\n }\r\n const typ = this.scope.findType(chainText);\r\n if (typ) {\r\n const token = typeName.getFirstToken();\r\n if (chainText.includes(\"~\")) {\r\n const name = chainText.split(\"~\")[0];\r\n const idef = this.scope.findInterfaceDefinition(name);\r\n if (idef) {\r\n this.scope.addReference(token, idef, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: \"INTF\", ooName: name });\r\n }\r\n }\r\n this.scope.addReference(token, typ, _reference_1.ReferenceType.TypeReference, this.filename);\r\n return typ.getType();\r\n }\r\n const type = this.scope.findTypePoolType(chainText);\r\n if (type) {\r\n // this.scope.addReference(typeName.getFirstToken(), type, ReferenceType.TypeReference, this.filename);\r\n return type;\r\n }\r\n const ddic = this.scope.getDDIC().lookup(chainText);\r\n if (ddic) {\r\n this.scope.getDDICReferences().addUsing(this.scope.getParentObj(), { object: ddic.object, token: typeName.getFirstToken(), filename: this.filename });\r\n if (ddic.type instanceof _typed_identifier_1.TypedIdentifier) {\r\n this.scope.addReference(typeName.getFirstToken(), ddic.type, _reference_1.ReferenceType.TypeReference, this.filename);\r\n }\r\n else if (ddic.type instanceof basic_1.VoidType) {\r\n this.scope.addReference(typeName.getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.filename);\r\n }\r\n return ddic.type;\r\n }\r\n return undefined;\r\n }\r\n simpleType(node) {\r\n let nameExpr = node.findFirstExpression(Expressions.NamespaceSimpleName);\r\n if (nameExpr === undefined) {\r\n nameExpr = node.findFirstExpression(Expressions.DefinitionName);\r\n }\r\n if (nameExpr === undefined) {\r\n return undefined;\r\n }\r\n let name = nameExpr.getFirstToken();\r\n if (nameExpr.countTokens() > 1) { // workaround for names with dashes\r\n name = new identifier_1.Identifier(name.getStart(), nameExpr.concatTokens());\r\n }\r\n const found = this.parseType(node, this.scope.isTypePool() ? name.getStr() : undefined);\r\n if (found) {\r\n return new _typed_identifier_1.TypedIdentifier(name, this.filename, found);\r\n }\r\n return undefined;\r\n }\r\n parseTable(node, name) {\r\n var _a;\r\n const typename = node.findFirstExpression(Expressions.TypeName);\r\n const text = (_a = node.findFirstExpression(Expressions.TypeTable)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();\r\n if (text === undefined) {\r\n return undefined;\r\n }\r\n let type = undefined;\r\n if (text.includes(\" STANDARD TABLE \")) {\r\n type = basic_1.TableAccessType.standard;\r\n }\r\n else if (text.includes(\" SORTED TABLE \")) {\r\n type = basic_1.TableAccessType.sorted;\r\n }\r\n else if (text.includes(\" HASHED TABLE \")) {\r\n type = basic_1.TableAccessType.hashed;\r\n }\r\n const keyFields = [];\r\n if (type) {\r\n const keys = node.findFirstExpression(expressions_1.TypeTableKey);\r\n for (const k of (keys === null || keys === void 0 ? void 0 : keys.findDirectExpressions(expressions_1.FieldSub)) || []) {\r\n keyFields.push(k.concatTokens().toUpperCase());\r\n }\r\n }\r\n const options = {\r\n withHeader: text.includes(\"WITH HEADER LINE\"),\r\n type: type,\r\n isUnique: text.includes(\"WITH UNIQUE\"),\r\n keyFields: keyFields,\r\n };\r\n let found = undefined;\r\n if (text.startsWith(\"TYPE TABLE OF REF TO \")\r\n || text.startsWith(\"TYPE STANDARD TABLE OF REF TO \")\r\n || text.startsWith(\"TYPE SORTED TABLE OF REF TO \")\r\n || text.startsWith(\"TYPE HASHED TABLE OF REF TO \")) {\r\n found = this.resolveTypeRef(typename);\r\n if (found) {\r\n return new Types.TableType(found, options, name);\r\n }\r\n }\r\n else if (text.startsWith(\"TYPE TABLE OF \")\r\n || text.startsWith(\"TYPE STANDARD TABLE OF \")\r\n || text.startsWith(\"TYPE SORTED TABLE OF \")\r\n || text.startsWith(\"TYPE HASHED TABLE OF \")) {\r\n found = this.resolveTypeName(typename);\r\n if (found) {\r\n return new Types.TableType(found, options, name);\r\n }\r\n }\r\n else if (text.startsWith(\"LIKE TABLE OF \")\r\n || text.startsWith(\"LIKE STANDARD TABLE OF \")\r\n || text.startsWith(\"LIKE SORTED TABLE OF \")\r\n || text.startsWith(\"LIKE HASHED TABLE OF \")) {\r\n found = this.resolveLikeName(node);\r\n if (found) {\r\n return new Types.TableType(found, options, name);\r\n }\r\n }\r\n else if (text === \"TYPE STANDARD TABLE\"\r\n || text === \"TYPE SORTED TABLE\"\r\n || text === \"TYPE HASHED TABLE\"\r\n || text === \"TYPE INDEX TABLE\"\r\n || text === \"TYPE ANY TABLE\") {\r\n return new Types.TableType(new Types.AnyType(), options);\r\n }\r\n else if (text.startsWith(\"TYPE RANGE OF \")) {\r\n const sub = node.findFirstExpression(Expressions.TypeName);\r\n found = this.resolveTypeName(sub);\r\n if (found === undefined) {\r\n return new Types.UnknownType(\"TYPE RANGE OF, could not resolve type\");\r\n }\r\n const structure = new Types.StructureType([\r\n { name: \"sign\", type: new Types.CharacterType(1) },\r\n { name: \"option\", type: new Types.CharacterType(2) },\r\n { name: \"low\", type: found },\r\n { name: \"high\", type: found },\r\n ], name);\r\n return new Types.TableType(structure, options);\r\n }\r\n else if (text.startsWith(\"LIKE RANGE OF \")) {\r\n const sub = node.findFirstExpression(Expressions.SimpleFieldChain);\r\n found = this.resolveLikeName(sub);\r\n if (found === undefined) {\r\n return new Types.UnknownType(\"LIKE RANGE OF, could not resolve type\");\r\n }\r\n const structure = new Types.StructureType([\r\n { name: \"sign\", type: new Types.CharacterType(1) },\r\n { name: \"option\", type: new Types.CharacterType(2) },\r\n { name: \"low\", type: found },\r\n { name: \"high\", type: found },\r\n ], name);\r\n return new Types.TableType(structure, options);\r\n }\r\n // fallback to old style syntax, OCCURS etc\r\n return this.parseType(node, name);\r\n }\r\n parseType(node, name) {\r\n var _a, _b, _c, _d, _e, _f;\r\n const typename = node.findFirstExpression(Expressions.TypeName);\r\n let text = (_a = node.findFirstExpression(Expressions.Type)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();\r\n if (text === undefined) {\r\n text = (_b = node.findFirstExpression(Expressions.TypeParam)) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase();\r\n }\r\n if (text === undefined) {\r\n text = (_c = node.findFirstExpression(Expressions.TypeTable)) === null || _c === void 0 ? void 0 : _c.concatTokens().toUpperCase();\r\n if ((text === null || text === void 0 ? void 0 : text.startsWith(\"TYPE\")) === false && (text === null || text === void 0 ? void 0 : text.startsWith(\"LIKE\")) === false) {\r\n text = \"TYPE\";\r\n }\r\n }\r\n if (text === undefined) {\r\n text = (_d = node.findFirstExpression(Expressions.FormParamType)) === null || _d === void 0 ? void 0 : _d.concatTokens().toUpperCase();\r\n }\r\n if (text === undefined) {\r\n text = \"TYPE\";\r\n }\r\n let found = undefined;\r\n if (text.startsWith(\"LIKE LINE OF \")) {\r\n const name = (_e = node.findFirstExpression(Expressions.FieldChain)) === null || _e === void 0 ? void 0 : _e.concatTokens();\r\n let e = node.findFirstExpression(Expressions.Type);\r\n if (e === undefined) {\r\n e = node.findFirstExpression(Expressions.FormParamType);\r\n }\r\n const type = this.resolveLikeName(e, false);\r\n if (type === undefined) {\r\n return new Types.UnknownType(\"Type error, could not resolve \\\"\" + name + \"\\\", parseType\");\r\n }\r\n else if (type instanceof Types.TableType) {\r\n return type.getRowType();\r\n }\r\n else if (type instanceof Types.VoidType) {\r\n return type;\r\n }\r\n else {\r\n return new Types.UnknownType(\"Type error, not a table type \" + name);\r\n }\r\n }\r\n else if (text.startsWith(\"LIKE REF TO \")) {\r\n const name = (_f = node.findFirstExpression(Expressions.FieldChain)) === null || _f === void 0 ? void 0 : _f.concatTokens();\r\n const type = this.resolveLikeName(node.findFirstExpression(Expressions.Type), false);\r\n if (type === undefined) {\r\n return new Types.UnknownType(\"Type error, could not resolve \\\"\" + name + \"\\\", parseType\");\r\n }\r\n return new Types.DataReference(type, name);\r\n }\r\n else if (text === \"TYPE STANDARD TABLE\"\r\n || text === \"TYPE SORTED TABLE\"\r\n || text === \"TYPE HASHED TABLE\"\r\n || text === \"TYPE INDEX TABLE\"\r\n || text === \"TYPE ANY TABLE\") {\r\n return new Types.TableType(new Types.AnyType(), { withHeader: node.concatTokens().toUpperCase().includes(\"WITH HEADER LINE\") });\r\n }\r\n else if (text.startsWith(\"LIKE \")) {\r\n let sub = node.findFirstExpression(Expressions.Type);\r\n if (sub === undefined) {\r\n sub = node.findFirstExpression(Expressions.FormParamType);\r\n }\r\n if (sub === undefined) {\r\n sub = node.findFirstExpression(Expressions.TypeParam);\r\n }\r\n if (sub === undefined) {\r\n sub = node.findFirstExpression(Expressions.FieldChain);\r\n }\r\n found = this.resolveLikeName(sub);\r\n if (found && text.includes(\" OCCURS \")) {\r\n found = new Types.TableType(found, { withHeader: text.includes(\"WITH HEADER LINE\") }, name);\r\n }\r\n }\r\n else if (text.startsWith(\"TYPE LINE OF \")) {\r\n const sub = node.findFirstExpression(Expressions.TypeName);\r\n found = this.resolveTypeName(sub);\r\n if (found instanceof _typed_identifier_1.TypedIdentifier) {\r\n found = found.getType();\r\n }\r\n if (found instanceof Types.TableType) {\r\n return found.getRowType();\r\n }\r\n else if (found instanceof Types.VoidType) {\r\n return found;\r\n }\r\n else if (found instanceof Types.UnknownType) {\r\n return new Types.UnknownType(\"TYPE LINE OF, unknown type, \" + found.getError());\r\n }\r\n else {\r\n return new Types.UnknownType(\"TYPE LINE OF, unexpected type, \" + (found === null || found === void 0 ? void 0 : found.constructor.name));\r\n }\r\n }\r\n else if (text.startsWith(\"TYPE REF TO \")) {\r\n found = this.resolveTypeRef(typename);\r\n }\r\n else if (text.startsWith(\"TYPE\")) {\r\n found = this.resolveTypeName(typename, this.findLength(node), this.findDecimals(node), name);\r\n const concat = node.concatTokens().toUpperCase();\r\n if (found && concat.includes(\" OCCURS \")) {\r\n found = new Types.TableType(found, { withHeader: concat.includes(\"WITH HEADER LINE\") }, name);\r\n }\r\n else if (found && concat.includes(\"WITH HEADER LINE\")) {\r\n if (found instanceof Types.VoidType) {\r\n found = new Types.TableType(found, { withHeader: true });\r\n }\r\n else if (!(found instanceof Types.TableType)) {\r\n throw new Error(\"WITH HEADER LINE can only be used with internal table\");\r\n }\r\n else {\r\n found = new Types.TableType(found.getRowType(), { withHeader: true });\r\n }\r\n }\r\n if (found === undefined && typename === undefined) {\r\n let length = 1;\r\n const len = node.findDirectExpression(Expressions.ConstantFieldLength);\r\n if (len) {\r\n const int = len.findDirectExpression(Expressions.Integer);\r\n if (int) {\r\n length = parseInt(int.concatTokens(), 10);\r\n }\r\n }\r\n found = new Types.CharacterType(length, name); // fallback\r\n if (concat.includes(\" OCCURS \")) {\r\n found = new Types.TableType(found, { withHeader: concat.includes(\"WITH HEADER LINE\") }, name);\r\n }\r\n }\r\n }\r\n return found;\r\n }\r\n /////////////////////\r\n // todo, rewrite this method\r\n resolveTypeChain(expr) {\r\n const chainText = expr.concatTokens().toUpperCase();\r\n if (chainText.includes(\"=>\") === false && chainText.includes(\"-\") === false) {\r\n return undefined;\r\n }\r\n let className;\r\n let rest = chainText;\r\n if (chainText.includes(\"=>\")) {\r\n const split = chainText.split(\"=>\");\r\n className = split[0];\r\n rest = split[1];\r\n }\r\n const subs = rest.split(\"-\");\r\n let foundType = undefined;\r\n if (className) {\r\n const split = chainText.split(\"=>\");\r\n const className = split[0];\r\n // the prefix might be itself\r\n if ((this.scope.getType() === _scope_type_1.ScopeType.Interface\r\n || this.scope.getType() === _scope_type_1.ScopeType.ClassDefinition)\r\n && this.scope.getName().toUpperCase() === className.toUpperCase()) {\r\n const foundId = this.scope.findType(subs[0]);\r\n foundType = foundId === null || foundId === void 0 ? void 0 : foundId.getType();\r\n if (foundType === undefined) {\r\n return new Types.UnknownType(\"Could not resolve type \" + chainText);\r\n }\r\n this.scope.addReference(expr.getTokens()[2], foundId, _reference_1.ReferenceType.TypeReference, this.filename);\r\n }\r\n else {\r\n // lookup in local and global scope\r\n const obj = this.scope.findObjectDefinition(className);\r\n if (obj === undefined && this.scope.getDDIC().inErrorNamespace(className) === false) {\r\n this.scope.addReference(expr.getFirstToken(), undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, this.filename, { ooName: className.toUpperCase() });\r\n return new Types.VoidType(className);\r\n }\r\n else if (obj === undefined) {\r\n return new Types.UnknownType(\"Could not resolve top \" + className + \", resolveTypeChain\");\r\n }\r\n const type = obj instanceof types_1.ClassDefinition ? \"CLAS\" : \"INTF\";\r\n this.scope.addReference(expr.getFirstToken(), obj, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: type, ooName: className });\r\n const byName = new _object_oriented_1.ObjectOriented(this.scope).searchTypeName(obj, subs[0]);\r\n foundType = byName === null || byName === void 0 ? void 0 : byName.getType();\r\n if (byName === undefined || foundType === undefined) {\r\n return new Types.UnknownType(subs[0] + \" not found in class or interface\");\r\n }\r\n this.scope.addReference(expr.getTokens()[2], byName, _reference_1.ReferenceType.TypeReference, this.filename);\r\n }\r\n }\r\n else {\r\n const found = this.scope.findType(subs[0]);\r\n foundType = found === null || found === void 0 ? void 0 : found.getType();\r\n if (foundType === undefined) {\r\n const typePoolType = this.scope.findTypePoolType(subs[0]);\r\n if (typePoolType) {\r\n // this.scope.addReference(typeName.getFirstToken(), typePoolType, ReferenceType.TypeReference, this.filename);\r\n foundType = typePoolType;\r\n }\r\n if (foundType === undefined) {\r\n const f = this.scope.getDDIC().lookupTableOrView(subs[0]);\r\n this.scope.getDDICReferences().addUsing(this.scope.getParentObj(), { object: f.object, filename: this.filename, token: expr.getFirstToken() });\r\n if (f.type instanceof _typed_identifier_1.TypedIdentifier) {\r\n foundType = f.type.getType();\r\n }\r\n else {\r\n foundType = f.type;\r\n }\r\n }\r\n }\r\n else {\r\n this.scope.addReference(expr.getFirstToken(), found, _reference_1.ReferenceType.TypeReference, this.filename);\r\n }\r\n if (foundType === undefined && this.scope.getDDIC().inErrorNamespace(subs[0]) === false) {\r\n this.scope.addReference(expr.getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.filename);\r\n return new Types.VoidType(subs[0]);\r\n }\r\n else if (foundType instanceof Types.VoidType) {\r\n this.scope.addReference(expr.getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.filename);\r\n return foundType;\r\n }\r\n else if (foundType === undefined) {\r\n return new Types.UnknownType(\"Unknown type \" + subs[0]);\r\n }\r\n }\r\n subs.shift();\r\n while (subs.length > 0) {\r\n if (foundType instanceof Types.UnknownType) {\r\n return foundType;\r\n }\r\n else if (!(foundType instanceof Types.StructureType)) {\r\n return new Types.UnknownType(\"Not a structured type\");\r\n }\r\n foundType = foundType.getComponentByName(subs[0]);\r\n subs.shift();\r\n }\r\n return foundType;\r\n }\r\n resolveConstantValue(expr) {\r\n var _a, _b;\r\n if (!(expr.get() instanceof Expressions.SimpleFieldChain)) {\r\n throw new Error(\"resolveConstantValue\");\r\n }\r\n const firstNode = expr.getFirstChild();\r\n const firstToken = firstNode.getFirstToken();\r\n const firstName = firstToken.getStr();\r\n if (firstNode.get() instanceof Expressions.Field) {\r\n const found = this.scope.findVariable(firstName);\r\n const val = found === null || found === void 0 ? void 0 : found.getValue();\r\n if (typeof val === \"string\") {\r\n this.scope.addReference(firstToken, found, _reference_1.ReferenceType.DataReadReference, this.filename);\r\n return val;\r\n }\r\n return undefined;\r\n }\r\n else if (firstNode.get() instanceof Expressions.ClassName\r\n && firstName.toLowerCase() === this.scope.getName().toLowerCase()\r\n && (this.scope.getType() === _scope_type_1.ScopeType.Interface\r\n || this.scope.getType() === _scope_type_1.ScopeType.ClassDefinition)) {\r\n const children = expr.getChildren();\r\n const token = (_a = children[2]) === null || _a === void 0 ? void 0 : _a.getFirstToken();\r\n const found = this.scope.findVariable(token.getStr());\r\n const val = found === null || found === void 0 ? void 0 : found.getValue();\r\n if (typeof val === \"string\") {\r\n this.scope.addReference(firstToken, found, _reference_1.ReferenceType.DataReadReference, this.filename);\r\n return val;\r\n }\r\n return undefined;\r\n }\r\n else if (firstNode.get() instanceof Expressions.ClassName) {\r\n const obj = this.scope.findObjectDefinition(firstName);\r\n if (obj === undefined) {\r\n if (this.scope.existsObject(firstName).found === true) {\r\n return undefined;\r\n }\r\n else if (this.scope.getDDIC().inErrorNamespace(firstName) === true) {\r\n throw new Error(\"resolveConstantValue, not found: \" + firstName);\r\n }\r\n else {\r\n this.scope.addReference(firstNode.getFirstToken(), undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, this.filename, { ooName: firstName.toUpperCase() });\r\n return undefined;\r\n }\r\n }\r\n const children = expr.getChildren();\r\n const token = (_b = children[2]) === null || _b === void 0 ? void 0 : _b.getFirstToken();\r\n const attr = token.getStr();\r\n const c = new _object_oriented_1.ObjectOriented(this.scope).searchConstantName(obj, attr);\r\n if (c instanceof class_constant_1.ClassConstant) {\r\n this.scope.addReference(token, c, _reference_1.ReferenceType.DataReadReference, this.filename);\r\n const val = c.getValue();\r\n if (typeof val === \"string\") {\r\n return val;\r\n }\r\n else if (typeof val === \"object\" && children[4]) {\r\n const name = children[4].getFirstToken().getStr();\r\n if (val[name] !== undefined) {\r\n return val[name];\r\n }\r\n }\r\n return undefined;\r\n }\r\n throw new Error(\"resolveConstantValue, constant not found \" + attr);\r\n }\r\n else {\r\n throw new Error(\"resolveConstantValue, unexpected structure\");\r\n }\r\n }\r\n resolveTypeRef(chain) {\r\n var _a;\r\n if (chain === undefined) {\r\n return undefined;\r\n }\r\n const name = chain.getFirstToken().getStr();\r\n if (chain.getAllTokens().length === 1) {\r\n if (name.toUpperCase() === \"OBJECT\") {\r\n return new Types.GenericObjectReferenceType();\r\n }\r\n const search = this.scope.existsObject(name);\r\n if (search.found === true && search.id) {\r\n this.scope.addReference(chain.getFirstToken(), search.id, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: search.ooType, ooName: name });\r\n return new Types.ObjectReferenceType(search.id);\r\n }\r\n }\r\n const found = this.resolveTypeName(chain);\r\n if (found && !(found instanceof Types.UnknownType) && !(found instanceof Types.VoidType)) {\r\n return new Types.DataReference(found);\r\n }\r\n else if (chain.concatTokens().toUpperCase() === \"DATA\") {\r\n return new Types.DataReference(new Types.AnyType());\r\n }\r\n if (this.scope.isBadiDef(name) === true) {\r\n return new Types.VoidType(name);\r\n }\r\n if (((_a = this.scope.getDDIC()) === null || _a === void 0 ? void 0 : _a.inErrorNamespace(name)) === false) {\r\n // this.scope.addReference(chain.getFirstToken(), undefined, ReferenceType.VoidType, this.filename);\r\n return new Types.VoidType(name);\r\n }\r\n return new Types.UnknownType(\"REF, unable to resolve \" + name);\r\n }\r\n findValue(node) {\r\n const val = node.findFirstExpression(Expressions.Value);\r\n if (val === undefined) {\r\n throw new Error(\"VALUE missing in expression\");\r\n }\r\n if (val.concatTokens().toUpperCase() === \"VALUE IS INITIAL\") {\r\n return undefined;\r\n }\r\n const constant = val.findFirstExpression(Expressions.Constant);\r\n if (constant) {\r\n return constant.concatTokens();\r\n }\r\n const chain = val.findFirstExpression(Expressions.SimpleFieldChain);\r\n if (chain) {\r\n return this.resolveConstantValue(chain);\r\n }\r\n throw new Error(\"findValue, unexpected\");\r\n }\r\n findDecimals(node) {\r\n var _a, _b;\r\n const dec = (_b = (_a = node.findDirectExpression(Expressions.Decimals)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Integer)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n if (dec) {\r\n return parseInt(dec, 10);\r\n }\r\n return undefined;\r\n }\r\n findLength(node) {\r\n const val = node.findFirstExpression(Expressions.Length);\r\n const flen = node.findFirstExpression(Expressions.ConstantFieldLength);\r\n if (val && flen) {\r\n throw new Error(\"Only specify length once\");\r\n }\r\n if (flen) {\r\n const cintExpr = flen.findFirstExpression(Expressions.Integer);\r\n if (cintExpr) {\r\n return this.parseInt(cintExpr.concatTokens());\r\n }\r\n const cchain = flen.findFirstExpression(Expressions.SimpleFieldChain);\r\n if (cchain) {\r\n const val = this.resolveConstantValue(cchain);\r\n return this.parseInt(val);\r\n }\r\n }\r\n if (val === undefined) {\r\n return 1;\r\n }\r\n const intExpr = val.findFirstExpression(Expressions.Integer);\r\n if (intExpr) {\r\n return this.parseInt(intExpr.concatTokens());\r\n }\r\n const strExpr = val.findFirstExpression(Expressions.ConstantString);\r\n if (strExpr) {\r\n return this.parseInt(strExpr.concatTokens());\r\n }\r\n const chain = val.findFirstExpression(Expressions.SimpleFieldChain);\r\n if (chain) {\r\n const val = this.resolveConstantValue(chain);\r\n return this.parseInt(val);\r\n }\r\n throw new Error(\"Unexpected, findLength\");\r\n }\r\n parseInt(text) {\r\n if (text === undefined) {\r\n return undefined;\r\n }\r\n if (text.startsWith(\"'\")) {\r\n text = text.split(\"'\")[1];\r\n }\r\n else if (text.startsWith(\"`\")) {\r\n text = text.split(\"`\")[1];\r\n }\r\n return parseInt(text, 10);\r\n }\r\n}\r\nexports.BasicTypes = BasicTypes;\r\n//# sourceMappingURL=basic_types.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/basic_types.js?");
|
|
6465
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.BasicTypes = void 0;\r\n/* eslint-disable default-case */\r\nconst _typed_identifier_1 = __webpack_require__(/*! ../types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\r\nconst Expressions = __webpack_require__(/*! ../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst Types = __webpack_require__(/*! ../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst _scope_type_1 = __webpack_require__(/*! ./_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\r\nconst _object_oriented_1 = __webpack_require__(/*! ./_object_oriented */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js\");\r\nconst class_constant_1 = __webpack_require__(/*! ../types/class_constant */ \"./node_modules/@abaplint/core/build/src/abap/types/class_constant.js\");\r\nconst identifier_1 = __webpack_require__(/*! ../1_lexer/tokens/identifier */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/identifier.js\");\r\nconst _reference_1 = __webpack_require__(/*! ./_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nconst basic_1 = __webpack_require__(/*! ../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst field_chain_1 = __webpack_require__(/*! ./expressions/field_chain */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/field_chain.js\");\r\nconst types_1 = __webpack_require__(/*! ../types */ \"./node_modules/@abaplint/core/build/src/abap/types/index.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _builtin_1 = __webpack_require__(/*! ./_builtin */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_builtin.js\");\r\nconst position_1 = __webpack_require__(/*! ../../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nclass BasicTypes {\r\n constructor(filename, scope) {\r\n this.filename = filename;\r\n this.scope = scope;\r\n }\r\n lookupQualifiedName(name) {\r\n var _a;\r\n if (name === undefined) {\r\n return undefined;\r\n }\r\n const found = this.scope.findType(name);\r\n if (found) {\r\n return found;\r\n }\r\n if (name.includes(\"=>\")) {\r\n const split = name.split(\"=>\");\r\n const ooName = split[0];\r\n const typeName = split[1];\r\n const oo = this.scope.findObjectDefinition(ooName);\r\n if (oo) {\r\n const f = oo.getTypeDefinitions().getByName(typeName);\r\n if (f) {\r\n return f;\r\n }\r\n }\r\n }\r\n const lookup = this.scope.getDDIC().lookupNoVoid(name);\r\n const id = (_a = lookup === null || lookup === void 0 ? void 0 : lookup.object) === null || _a === void 0 ? void 0 : _a.getIdentifier();\r\n if (id && (lookup === null || lookup === void 0 ? void 0 : lookup.type)) {\r\n return new _typed_identifier_1.TypedIdentifier(id.getToken(), id.getFilename(), lookup.type);\r\n }\r\n const builtin = this.scope.getDDIC().lookupBuiltinType(name);\r\n if (builtin) {\r\n return new _typed_identifier_1.TypedIdentifier(new identifier_1.Identifier(new position_1.Position(1, 1), name), _builtin_1.BuiltIn.filename, builtin);\r\n }\r\n return undefined;\r\n }\r\n resolveLikeName(node, headerLogic = true) {\r\n var _a;\r\n if (node === undefined) {\r\n return undefined;\r\n }\r\n let chain = node.findFirstExpression(Expressions.FieldChain);\r\n if (chain === undefined) {\r\n chain = node.findFirstExpression(Expressions.TypeName);\r\n }\r\n if (chain === undefined) {\r\n chain = node.findFirstExpression(Expressions.FieldSub);\r\n }\r\n if (chain === undefined) {\r\n chain = node.findFirstExpression(Expressions.SimpleFieldChain);\r\n }\r\n if (chain === undefined) {\r\n throw new Error(\"resolveLikeName, chain undefined\");\r\n }\r\n const fullName = chain.concatTokens();\r\n const children = [...chain.getChildren()];\r\n if (children.length === 0) {\r\n return new Types.UnknownType(\"Type error, could not resolve \\\"\" + fullName + \"\\\", resolveLikeName1\");\r\n }\r\n let type = undefined;\r\n if (children[1] && (children[1].getFirstToken().getStr() === \"=>\" || children[1].getFirstToken().getStr() === \"->\")) {\r\n type = new field_chain_1.FieldChain().runSyntax(chain, this.scope, this.filename, _reference_1.ReferenceType.TypeReference);\r\n }\r\n else {\r\n const name = children.shift().getFirstToken().getStr();\r\n let found = this.scope.findVariable(name);\r\n type = found === null || found === void 0 ? void 0 : found.getType();\r\n if (found === undefined) {\r\n found = this.scope.findExtraLikeType(name);\r\n type = found === null || found === void 0 ? void 0 : found.getType();\r\n }\r\n if (found) {\r\n this.scope.addReference(chain === null || chain === void 0 ? void 0 : chain.getFirstToken(), found, _reference_1.ReferenceType.TypeReference, this.filename);\r\n }\r\n if (type === undefined) {\r\n type = (_a = this.scope.getDDIC().lookupNoVoid(name)) === null || _a === void 0 ? void 0 : _a.type;\r\n }\r\n if (type === undefined && this.scope.isOO() === false && this.scope.getDDIC().inErrorNamespace(name) === false) {\r\n this.scope.addReference(chain.getChildren()[0].getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.filename);\r\n return new Types.VoidType(name);\r\n }\r\n while (children.length > 0) {\r\n const child = children.shift();\r\n if (child.getFirstToken().getStr() === \"-\") {\r\n if (type instanceof Types.VoidType) {\r\n return type;\r\n }\r\n }\r\n else if (child.concatTokens() === \"[]\") {\r\n if (type instanceof Types.TableType) {\r\n type = new basic_1.TableType(type.getRowType(), { withHeader: false });\r\n }\r\n }\r\n else { // field name\r\n let sub = undefined;\r\n if (type instanceof Types.TableType) {\r\n type = type.getRowType();\r\n }\r\n if (type instanceof Types.StructureType) {\r\n sub = type.getComponentByName(child.getFirstToken().getStr());\r\n }\r\n if (sub === undefined) {\r\n return new Types.UnknownType(\"Type error, field not part of structure \" + fullName);\r\n }\r\n type = sub;\r\n }\r\n }\r\n if (type instanceof Types.VoidType) {\r\n return type;\r\n }\r\n else if (type instanceof basic_1.TableType\r\n && type.isWithHeader()\r\n && headerLogic === true) {\r\n type = type.getRowType();\r\n }\r\n else if (type instanceof Types.TableType\r\n && type.isWithHeader() === true\r\n && type.getRowType() instanceof Types.VoidType) {\r\n return type.getRowType();\r\n }\r\n }\r\n if (!type) {\r\n return new Types.UnknownType(\"Type error, could not resolve \\\"\" + fullName + \"\\\", resolveLikeName2\");\r\n }\r\n return type;\r\n }\r\n resolveTypeName(typeName, length, decimals, name) {\r\n if (typeName === undefined) {\r\n return undefined;\r\n }\r\n const chain = this.resolveTypeChain(typeName);\r\n if (chain) {\r\n return chain;\r\n }\r\n const chainText = typeName.concatTokens().toUpperCase();\r\n const f = this.scope.getDDIC().lookupBuiltinType(chainText, length, decimals, name);\r\n if (f !== undefined) {\r\n return f;\r\n }\r\n const typ = this.scope.findType(chainText);\r\n if (typ) {\r\n const token = typeName.getFirstToken();\r\n if (chainText.includes(\"~\")) {\r\n const name = chainText.split(\"~\")[0];\r\n const idef = this.scope.findInterfaceDefinition(name);\r\n if (idef) {\r\n this.scope.addReference(token, idef, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: \"INTF\", ooName: name });\r\n }\r\n }\r\n this.scope.addReference(token, typ, _reference_1.ReferenceType.TypeReference, this.filename);\r\n return typ.getType();\r\n }\r\n const type = this.scope.findTypePoolType(chainText);\r\n if (type) {\r\n // this.scope.addReference(typeName.getFirstToken(), type, ReferenceType.TypeReference, this.filename);\r\n return type;\r\n }\r\n const ddic = this.scope.getDDIC().lookup(chainText);\r\n if (ddic) {\r\n this.scope.getDDICReferences().addUsing(this.scope.getParentObj(), { object: ddic.object, token: typeName.getFirstToken(), filename: this.filename });\r\n if (ddic.type instanceof _typed_identifier_1.TypedIdentifier) {\r\n this.scope.addReference(typeName.getFirstToken(), ddic.type, _reference_1.ReferenceType.TypeReference, this.filename);\r\n }\r\n else if (ddic.type instanceof basic_1.VoidType) {\r\n this.scope.addReference(typeName.getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.filename);\r\n }\r\n return ddic.type;\r\n }\r\n return undefined;\r\n }\r\n simpleType(node) {\r\n let nameExpr = node.findFirstExpression(Expressions.NamespaceSimpleName);\r\n if (nameExpr === undefined) {\r\n nameExpr = node.findFirstExpression(Expressions.DefinitionName);\r\n }\r\n if (nameExpr === undefined) {\r\n return undefined;\r\n }\r\n let name = nameExpr.getFirstToken();\r\n if (nameExpr.countTokens() > 1) { // workaround for names with dashes\r\n name = new identifier_1.Identifier(name.getStart(), nameExpr.concatTokens());\r\n }\r\n const found = this.parseType(node, this.scope.isTypePool() ? name.getStr() : undefined);\r\n if (found) {\r\n return new _typed_identifier_1.TypedIdentifier(name, this.filename, found);\r\n }\r\n return undefined;\r\n }\r\n parseTable(node, name) {\r\n var _a;\r\n const typename = node.findFirstExpression(Expressions.TypeName);\r\n const text = (_a = node.findFirstExpression(Expressions.TypeTable)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();\r\n if (text === undefined) {\r\n return undefined;\r\n }\r\n let type = undefined;\r\n if (text.includes(\" STANDARD TABLE \")) {\r\n type = basic_1.TableAccessType.standard;\r\n }\r\n else if (text.includes(\" SORTED TABLE \")) {\r\n type = basic_1.TableAccessType.sorted;\r\n }\r\n else if (text.includes(\" HASHED TABLE \")) {\r\n type = basic_1.TableAccessType.hashed;\r\n }\r\n const keyFields = [];\r\n if (type) {\r\n const keys = node.findFirstExpression(expressions_1.TypeTableKey);\r\n for (const k of (keys === null || keys === void 0 ? void 0 : keys.findDirectExpressions(expressions_1.FieldSub)) || []) {\r\n keyFields.push(k.concatTokens().toUpperCase());\r\n }\r\n }\r\n const options = {\r\n withHeader: text.includes(\"WITH HEADER LINE\"),\r\n type: type,\r\n isUnique: text.includes(\"WITH UNIQUE\"),\r\n keyFields: keyFields,\r\n };\r\n let found = undefined;\r\n if (text.startsWith(\"TYPE TABLE OF REF TO \")\r\n || text.startsWith(\"TYPE STANDARD TABLE OF REF TO \")\r\n || text.startsWith(\"TYPE SORTED TABLE OF REF TO \")\r\n || text.startsWith(\"TYPE HASHED TABLE OF REF TO \")) {\r\n found = this.resolveTypeRef(typename);\r\n if (found) {\r\n return new Types.TableType(found, options, name);\r\n }\r\n }\r\n else if (text.startsWith(\"TYPE TABLE OF \")\r\n || text.startsWith(\"TYPE STANDARD TABLE OF \")\r\n || text.startsWith(\"TYPE SORTED TABLE OF \")\r\n || text.startsWith(\"TYPE HASHED TABLE OF \")) {\r\n found = this.resolveTypeName(typename);\r\n if (found) {\r\n return new Types.TableType(found, options, name);\r\n }\r\n }\r\n else if (text.startsWith(\"LIKE TABLE OF \")\r\n || text.startsWith(\"LIKE STANDARD TABLE OF \")\r\n || text.startsWith(\"LIKE SORTED TABLE OF \")\r\n || text.startsWith(\"LIKE HASHED TABLE OF \")) {\r\n found = this.resolveLikeName(node);\r\n if (found) {\r\n return new Types.TableType(found, options, name);\r\n }\r\n }\r\n else if (text === \"TYPE STANDARD TABLE\"\r\n || text === \"TYPE SORTED TABLE\"\r\n || text === \"TYPE HASHED TABLE\"\r\n || text === \"TYPE INDEX TABLE\"\r\n || text === \"TYPE ANY TABLE\") {\r\n return new Types.TableType(new Types.AnyType(), options);\r\n }\r\n else if (text.startsWith(\"TYPE RANGE OF \")) {\r\n const sub = node.findFirstExpression(Expressions.TypeName);\r\n found = this.resolveTypeName(sub);\r\n if (found === undefined) {\r\n return new Types.UnknownType(\"TYPE RANGE OF, could not resolve type\");\r\n }\r\n const structure = new Types.StructureType([\r\n { name: \"sign\", type: new Types.CharacterType(1) },\r\n { name: \"option\", type: new Types.CharacterType(2) },\r\n { name: \"low\", type: found },\r\n { name: \"high\", type: found },\r\n ], name);\r\n return new Types.TableType(structure, options);\r\n }\r\n else if (text.startsWith(\"LIKE RANGE OF \")) {\r\n const sub = node.findFirstExpression(Expressions.SimpleFieldChain);\r\n found = this.resolveLikeName(sub);\r\n if (found === undefined) {\r\n return new Types.UnknownType(\"LIKE RANGE OF, could not resolve type\");\r\n }\r\n const structure = new Types.StructureType([\r\n { name: \"sign\", type: new Types.CharacterType(1) },\r\n { name: \"option\", type: new Types.CharacterType(2) },\r\n { name: \"low\", type: found },\r\n { name: \"high\", type: found },\r\n ], name);\r\n return new Types.TableType(structure, options);\r\n }\r\n // fallback to old style syntax, OCCURS etc\r\n return this.parseType(node, name);\r\n }\r\n parseType(node, name) {\r\n var _a, _b, _c, _d, _e, _f;\r\n const typename = node.findFirstExpression(Expressions.TypeName);\r\n let text = (_a = node.findFirstExpression(Expressions.Type)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();\r\n if (text === undefined) {\r\n text = (_b = node.findFirstExpression(Expressions.TypeParam)) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase();\r\n }\r\n if (text === undefined) {\r\n text = (_c = node.findFirstExpression(Expressions.TypeTable)) === null || _c === void 0 ? void 0 : _c.concatTokens().toUpperCase();\r\n if ((text === null || text === void 0 ? void 0 : text.startsWith(\"TYPE\")) === false && (text === null || text === void 0 ? void 0 : text.startsWith(\"LIKE\")) === false) {\r\n text = \"TYPE\";\r\n }\r\n }\r\n if (text === undefined) {\r\n text = (_d = node.findFirstExpression(Expressions.FormParamType)) === null || _d === void 0 ? void 0 : _d.concatTokens().toUpperCase();\r\n }\r\n if (text === undefined) {\r\n text = \"TYPE\";\r\n }\r\n let found = undefined;\r\n if (text.startsWith(\"LIKE LINE OF \")) {\r\n const name = (_e = node.findFirstExpression(Expressions.FieldChain)) === null || _e === void 0 ? void 0 : _e.concatTokens();\r\n let e = node.findFirstExpression(Expressions.Type);\r\n if (e === undefined) {\r\n e = node.findFirstExpression(Expressions.FormParamType);\r\n }\r\n const type = this.resolveLikeName(e, false);\r\n if (type === undefined) {\r\n return new Types.UnknownType(\"Type error, could not resolve \\\"\" + name + \"\\\", parseType\");\r\n }\r\n else if (type instanceof Types.TableType) {\r\n return type.getRowType();\r\n }\r\n else if (type instanceof Types.VoidType) {\r\n return type;\r\n }\r\n else {\r\n return new Types.UnknownType(\"Type error, not a table type \" + name);\r\n }\r\n }\r\n else if (text.startsWith(\"LIKE REF TO \")) {\r\n const name = (_f = node.findFirstExpression(Expressions.FieldChain)) === null || _f === void 0 ? void 0 : _f.concatTokens();\r\n const type = this.resolveLikeName(node.findFirstExpression(Expressions.Type), false);\r\n if (type === undefined) {\r\n return new Types.UnknownType(\"Type error, could not resolve \\\"\" + name + \"\\\", parseType\");\r\n }\r\n return new Types.DataReference(type, name);\r\n }\r\n else if (text === \"TYPE STANDARD TABLE\"\r\n || text === \"TYPE SORTED TABLE\"\r\n || text === \"TYPE HASHED TABLE\"\r\n || text === \"TYPE INDEX TABLE\"\r\n || text === \"TYPE ANY TABLE\") {\r\n return new Types.TableType(new Types.AnyType(), { withHeader: node.concatTokens().toUpperCase().includes(\"WITH HEADER LINE\") });\r\n }\r\n else if (text.startsWith(\"LIKE \")) {\r\n let sub = node.findFirstExpression(Expressions.Type);\r\n if (sub === undefined) {\r\n sub = node.findFirstExpression(Expressions.FormParamType);\r\n }\r\n if (sub === undefined) {\r\n sub = node.findFirstExpression(Expressions.TypeParam);\r\n }\r\n if (sub === undefined) {\r\n sub = node.findFirstExpression(Expressions.FieldChain);\r\n }\r\n found = this.resolveLikeName(sub);\r\n if (found && text.includes(\" OCCURS \")) {\r\n found = new Types.TableType(found, { withHeader: text.includes(\"WITH HEADER LINE\") }, name);\r\n }\r\n }\r\n else if (text.startsWith(\"TYPE LINE OF \")) {\r\n const sub = node.findFirstExpression(Expressions.TypeName);\r\n found = this.resolveTypeName(sub);\r\n if (found instanceof _typed_identifier_1.TypedIdentifier) {\r\n found = found.getType();\r\n }\r\n if (found instanceof Types.TableType) {\r\n return found.getRowType();\r\n }\r\n else if (found instanceof Types.VoidType) {\r\n return found;\r\n }\r\n else if (found instanceof Types.UnknownType) {\r\n return new Types.UnknownType(\"TYPE LINE OF, unknown type, \" + found.getError());\r\n }\r\n else {\r\n return new Types.UnknownType(\"TYPE LINE OF, unexpected type, \" + (found === null || found === void 0 ? void 0 : found.constructor.name));\r\n }\r\n }\r\n else if (text.startsWith(\"TYPE REF TO \")) {\r\n found = this.resolveTypeRef(typename);\r\n }\r\n else if (text.startsWith(\"TYPE\")) {\r\n found = this.resolveTypeName(typename, this.findLength(node), this.findDecimals(node), name);\r\n const concat = node.concatTokens().toUpperCase();\r\n if (found && concat.includes(\" OCCURS \")) {\r\n found = new Types.TableType(found, { withHeader: concat.includes(\"WITH HEADER LINE\") }, name);\r\n }\r\n else if (found && concat.includes(\"WITH HEADER LINE\")) {\r\n if (found instanceof Types.VoidType) {\r\n found = new Types.TableType(found, { withHeader: true });\r\n }\r\n else if (!(found instanceof Types.TableType)) {\r\n throw new Error(\"WITH HEADER LINE can only be used with internal table\");\r\n }\r\n else {\r\n found = new Types.TableType(found.getRowType(), { withHeader: true });\r\n }\r\n }\r\n if (found === undefined && typename === undefined) {\r\n let length = 1;\r\n const len = node.findDirectExpression(Expressions.ConstantFieldLength);\r\n if (len) {\r\n const int = len.findDirectExpression(Expressions.Integer);\r\n if (int) {\r\n length = parseInt(int.concatTokens(), 10);\r\n }\r\n }\r\n found = new Types.CharacterType(length, name); // fallback\r\n if (concat.includes(\" OCCURS \")) {\r\n found = new Types.TableType(found, { withHeader: concat.includes(\"WITH HEADER LINE\") }, name);\r\n }\r\n }\r\n }\r\n return found;\r\n }\r\n /////////////////////\r\n // todo, rewrite this method\r\n resolveTypeChain(expr) {\r\n const chainText = expr.concatTokens().toUpperCase();\r\n if (chainText.includes(\"=>\") === false && chainText.includes(\"-\") === false) {\r\n return undefined;\r\n }\r\n let className;\r\n let rest = chainText;\r\n if (chainText.includes(\"=>\")) {\r\n const split = chainText.split(\"=>\");\r\n className = split[0];\r\n rest = split[1];\r\n }\r\n const subs = rest.split(\"-\");\r\n let foundType = undefined;\r\n if (className) {\r\n const split = chainText.split(\"=>\");\r\n const className = split[0];\r\n // the prefix might be itself\r\n if ((this.scope.getType() === _scope_type_1.ScopeType.Interface\r\n || this.scope.getType() === _scope_type_1.ScopeType.ClassDefinition)\r\n && this.scope.getName().toUpperCase() === className.toUpperCase()) {\r\n const foundId = this.scope.findType(subs[0]);\r\n foundType = foundId === null || foundId === void 0 ? void 0 : foundId.getType();\r\n if (foundType === undefined) {\r\n return new Types.UnknownType(\"Could not resolve type \" + chainText);\r\n }\r\n this.scope.addReference(expr.getTokens()[2], foundId, _reference_1.ReferenceType.TypeReference, this.filename);\r\n }\r\n else {\r\n // lookup in local and global scope\r\n const obj = this.scope.findObjectDefinition(className);\r\n if (obj === undefined && this.scope.getDDIC().inErrorNamespace(className) === false) {\r\n this.scope.addReference(expr.getFirstToken(), undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, this.filename, { ooName: className.toUpperCase() });\r\n return new Types.VoidType(className);\r\n }\r\n else if (obj === undefined) {\r\n return new Types.UnknownType(\"Could not resolve top \" + className + \", resolveTypeChain\");\r\n }\r\n const type = obj instanceof types_1.ClassDefinition ? \"CLAS\" : \"INTF\";\r\n this.scope.addReference(expr.getFirstToken(), obj, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: type, ooName: className });\r\n const byName = new _object_oriented_1.ObjectOriented(this.scope).searchTypeName(obj, subs[0]);\r\n foundType = byName === null || byName === void 0 ? void 0 : byName.getType();\r\n if (byName === undefined || foundType === undefined) {\r\n return new Types.UnknownType(subs[0] + \" not found in class or interface\");\r\n }\r\n this.scope.addReference(expr.getTokens()[2], byName, _reference_1.ReferenceType.TypeReference, this.filename);\r\n }\r\n }\r\n else {\r\n const found = this.scope.findType(subs[0]);\r\n foundType = found === null || found === void 0 ? void 0 : found.getType();\r\n if (foundType === undefined) {\r\n const typePoolType = this.scope.findTypePoolType(subs[0]);\r\n if (typePoolType) {\r\n // this.scope.addReference(typeName.getFirstToken(), typePoolType, ReferenceType.TypeReference, this.filename);\r\n foundType = typePoolType;\r\n }\r\n if (foundType === undefined) {\r\n const f = this.scope.getDDIC().lookupTableOrView(subs[0]);\r\n this.scope.getDDICReferences().addUsing(this.scope.getParentObj(), { object: f.object, filename: this.filename, token: expr.getFirstToken() });\r\n if (f.type instanceof _typed_identifier_1.TypedIdentifier) {\r\n foundType = f.type.getType();\r\n }\r\n else {\r\n foundType = f.type;\r\n }\r\n }\r\n }\r\n else {\r\n this.scope.addReference(expr.getFirstToken(), found, _reference_1.ReferenceType.TypeReference, this.filename);\r\n }\r\n if (foundType === undefined && this.scope.getDDIC().inErrorNamespace(subs[0]) === false) {\r\n this.scope.addReference(expr.getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.filename);\r\n return new Types.VoidType(subs[0]);\r\n }\r\n else if (foundType instanceof Types.VoidType) {\r\n this.scope.addReference(expr.getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.filename);\r\n return foundType;\r\n }\r\n else if (foundType === undefined) {\r\n return new Types.UnknownType(\"Unknown type \" + subs[0]);\r\n }\r\n }\r\n subs.shift();\r\n while (subs.length > 0) {\r\n if (foundType instanceof Types.UnknownType) {\r\n return foundType;\r\n }\r\n else if (!(foundType instanceof Types.StructureType)) {\r\n return new Types.UnknownType(\"Not a structured type\");\r\n }\r\n foundType = foundType.getComponentByName(subs[0]);\r\n subs.shift();\r\n }\r\n return foundType;\r\n }\r\n resolveConstantValue(expr) {\r\n var _a, _b;\r\n if (!(expr.get() instanceof Expressions.SimpleFieldChain)) {\r\n throw new Error(\"resolveConstantValue\");\r\n }\r\n const firstNode = expr.getFirstChild();\r\n const firstToken = firstNode.getFirstToken();\r\n const firstName = firstToken.getStr();\r\n if (firstNode.get() instanceof Expressions.Field) {\r\n const found = this.scope.findVariable(firstName);\r\n const val = found === null || found === void 0 ? void 0 : found.getValue();\r\n if (typeof val === \"string\") {\r\n this.scope.addReference(firstToken, found, _reference_1.ReferenceType.DataReadReference, this.filename);\r\n return val;\r\n }\r\n return undefined;\r\n }\r\n else if (firstNode.get() instanceof Expressions.ClassName\r\n && firstName.toLowerCase() === this.scope.getName().toLowerCase()\r\n && (this.scope.getType() === _scope_type_1.ScopeType.Interface\r\n || this.scope.getType() === _scope_type_1.ScopeType.ClassDefinition)) {\r\n const children = expr.getChildren();\r\n const token = (_a = children[2]) === null || _a === void 0 ? void 0 : _a.getFirstToken();\r\n const found = this.scope.findVariable(token.getStr());\r\n const val = found === null || found === void 0 ? void 0 : found.getValue();\r\n if (typeof val === \"string\") {\r\n this.scope.addReference(firstToken, found, _reference_1.ReferenceType.DataReadReference, this.filename);\r\n return val;\r\n }\r\n return undefined;\r\n }\r\n else if (firstNode.get() instanceof Expressions.ClassName) {\r\n const obj = this.scope.findObjectDefinition(firstName);\r\n if (obj === undefined) {\r\n if (this.scope.existsObject(firstName).found === true) {\r\n return undefined;\r\n }\r\n else if (this.scope.getDDIC().inErrorNamespace(firstName) === true) {\r\n throw new Error(\"resolveConstantValue, not found: \" + firstName);\r\n }\r\n else {\r\n this.scope.addReference(firstNode.getFirstToken(), undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, this.filename, { ooName: firstName.toUpperCase() });\r\n return undefined;\r\n }\r\n }\r\n const children = expr.getChildren();\r\n const token = (_b = children[2]) === null || _b === void 0 ? void 0 : _b.getFirstToken();\r\n const attr = token.getStr();\r\n const c = new _object_oriented_1.ObjectOriented(this.scope).searchConstantName(obj, attr);\r\n if (c instanceof class_constant_1.ClassConstant) {\r\n this.scope.addReference(token, c, _reference_1.ReferenceType.DataReadReference, this.filename);\r\n const val = c.getValue();\r\n if (typeof val === \"string\") {\r\n return val;\r\n }\r\n else if (typeof val === \"object\" && children[4]) {\r\n const name = children[4].getFirstToken().getStr();\r\n if (val[name] !== undefined) {\r\n return val[name];\r\n }\r\n }\r\n return undefined;\r\n }\r\n throw new Error(\"resolveConstantValue, constant not found \" + attr);\r\n }\r\n else {\r\n throw new Error(\"resolveConstantValue, unexpected structure\");\r\n }\r\n }\r\n resolveTypeRef(chain) {\r\n var _a;\r\n if (chain === undefined) {\r\n return undefined;\r\n }\r\n const name = chain.getFirstToken().getStr();\r\n if (chain.getAllTokens().length === 1) {\r\n if (name.toUpperCase() === \"OBJECT\") {\r\n return new Types.GenericObjectReferenceType();\r\n }\r\n const search = this.scope.existsObject(name);\r\n if (search.found === true && search.id) {\r\n this.scope.addReference(chain.getFirstToken(), search.id, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: search.ooType, ooName: name });\r\n return new Types.ObjectReferenceType(search.id);\r\n }\r\n }\r\n const found = this.resolveTypeName(chain);\r\n if (found && !(found instanceof Types.UnknownType) && !(found instanceof Types.VoidType)) {\r\n return new Types.DataReference(found);\r\n }\r\n else if (chain.concatTokens().toUpperCase() === \"DATA\") {\r\n return new Types.DataReference(new Types.AnyType());\r\n }\r\n if (this.scope.isBadiDef(name) === true) {\r\n return new Types.VoidType(name);\r\n }\r\n if (((_a = this.scope.getDDIC()) === null || _a === void 0 ? void 0 : _a.inErrorNamespace(name)) === false) {\r\n // this.scope.addReference(chain.getFirstToken(), undefined, ReferenceType.VoidType, this.filename);\r\n return new Types.VoidType(name);\r\n }\r\n return new Types.UnknownType(\"REF, unable to resolve \" + name);\r\n }\r\n findValue(node) {\r\n const val = node.findFirstExpression(Expressions.Value);\r\n if (val === undefined) {\r\n throw new Error(\"VALUE missing in expression\");\r\n }\r\n if (val.concatTokens().toUpperCase() === \"VALUE IS INITIAL\") {\r\n return undefined;\r\n }\r\n const constant = val.findFirstExpression(Expressions.Constant);\r\n if (constant) {\r\n return constant.concatTokens();\r\n }\r\n const chain = val.findFirstExpression(Expressions.SimpleFieldChain);\r\n if (chain) {\r\n return this.resolveConstantValue(chain);\r\n }\r\n throw new Error(\"findValue, unexpected\");\r\n }\r\n findDecimals(node) {\r\n var _a, _b;\r\n const dec = (_b = (_a = node.findDirectExpression(Expressions.Decimals)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Integer)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n if (dec) {\r\n return parseInt(dec, 10);\r\n }\r\n return undefined;\r\n }\r\n findLength(node) {\r\n const val = node.findFirstExpression(Expressions.Length);\r\n const flen = node.findFirstExpression(Expressions.ConstantFieldLength);\r\n if (val && flen) {\r\n throw new Error(\"Only specify length once\");\r\n }\r\n if (flen) {\r\n const cintExpr = flen.findFirstExpression(Expressions.Integer);\r\n if (cintExpr) {\r\n return this.parseInt(cintExpr.concatTokens());\r\n }\r\n const cchain = flen.findFirstExpression(Expressions.SimpleFieldChain);\r\n if (cchain) {\r\n const val = this.resolveConstantValue(cchain);\r\n return this.parseInt(val);\r\n }\r\n }\r\n if (val === undefined) {\r\n return 1;\r\n }\r\n const intExpr = val.findFirstExpression(Expressions.Integer);\r\n if (intExpr) {\r\n return this.parseInt(intExpr.concatTokens());\r\n }\r\n const strExpr = val.findFirstExpression(Expressions.ConstantString);\r\n if (strExpr) {\r\n return this.parseInt(strExpr.concatTokens());\r\n }\r\n const chain = val.findFirstExpression(Expressions.SimpleFieldChain);\r\n if (chain) {\r\n const val = this.resolveConstantValue(chain);\r\n return this.parseInt(val);\r\n }\r\n throw new Error(\"Unexpected, findLength\");\r\n }\r\n parseInt(text) {\r\n if (text === undefined) {\r\n return undefined;\r\n }\r\n if (text.startsWith(\"'\")) {\r\n text = text.split(\"'\")[1];\r\n }\r\n else if (text.startsWith(\"`\")) {\r\n text = text.split(\"`\")[1];\r\n }\r\n return parseInt(text, 10);\r\n }\r\n}\r\nexports.BasicTypes = BasicTypes;\r\n//# sourceMappingURL=basic_types.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/basic_types.js?");
|
|
6466
6466
|
|
|
6467
6467
|
/***/ }),
|
|
6468
6468
|
|
|
@@ -6748,7 +6748,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
6748
6748
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
6749
6749
|
|
|
6750
6750
|
"use strict";
|
|
6751
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FormParam = void 0;\r\nconst _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\r\nconst basic_1 = __webpack_require__(/*! ../../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst basic_types_1 = __webpack_require__(/*! ../basic_types */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/basic_types.js\");\r\nclass FormParam {\r\n runSyntax(node, scope, filename) {\r\n var _a, _b, _c;\r\n const nameToken = (_a = node.findFirstExpression(expressions_1.FormParamName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\r\n if (node.findDirectTokenByText(\"STRUCTURE\") && nameToken) {\r\n // STRUCTURES typing\r\n const typeName = (_b = node.findDirectExpression(expressions_1.
|
|
6751
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FormParam = void 0;\r\nconst _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\r\nconst basic_1 = __webpack_require__(/*! ../../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst basic_types_1 = __webpack_require__(/*! ../basic_types */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/basic_types.js\");\r\nclass FormParam {\r\n runSyntax(node, scope, filename) {\r\n var _a, _b, _c;\r\n const nameToken = (_a = node.findFirstExpression(expressions_1.FormParamName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\r\n if (node.findDirectTokenByText(\"STRUCTURE\") && nameToken) {\r\n // STRUCTURES typing\r\n const typeName = (_b = node.findDirectExpression(expressions_1.SimpleFieldChain)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr();\r\n let type = undefined;\r\n if (typeName) {\r\n type = (_c = scope.findType(typeName)) === null || _c === void 0 ? void 0 : _c.getType();\r\n if (type === undefined) {\r\n type = scope.getDDIC().lookupTableOrView(typeName).type;\r\n }\r\n }\r\n else {\r\n type = new basic_1.UnknownType(\"todo, FORM STRUCTURES typing\");\r\n }\r\n return new _typed_identifier_1.TypedIdentifier(nameToken, filename, type, [\"form_parameter\" /* FormParameter */]);\r\n }\r\n if (node.getChildren().length === 1 && nameToken) {\r\n // untyped FORM parameter\r\n return new _typed_identifier_1.TypedIdentifier(nameToken, filename, new basic_1.AnyType(), [\"form_parameter\" /* FormParameter */]);\r\n }\r\n const bfound = new basic_types_1.BasicTypes(filename, scope).parseType(node);\r\n if (nameToken && bfound) {\r\n return new _typed_identifier_1.TypedIdentifier(nameToken, filename, bfound, [\"form_parameter\" /* FormParameter */]);\r\n }\r\n if (nameToken) {\r\n return new _typed_identifier_1.TypedIdentifier(nameToken, filename, new basic_1.UnknownType(\"FormParam, todo\"), [\"form_parameter\" /* FormParameter */]);\r\n }\r\n throw new Error(\"FormParam, unexpected node\");\r\n }\r\n}\r\nexports.FormParam = FormParam;\r\n//# sourceMappingURL=form_param.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/form_param.js?");
|
|
6752
6752
|
|
|
6753
6753
|
/***/ }),
|
|
6754
6754
|
|
|
@@ -8431,7 +8431,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
8431
8431
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
8432
8432
|
|
|
8433
8433
|
"use strict";
|
|
8434
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ABAPParser = void 0;\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst lexer_1 = __webpack_require__(/*! ./1_lexer/lexer */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/lexer.js\");\r\nconst statement_parser_1 = __webpack_require__(/*! ./2_statements/statement_parser */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statement_parser.js\");\r\nconst structure_parser_1 = __webpack_require__(/*! ./3_structures/structure_parser */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structure_parser.js\");\r\nconst abap_file_information_1 = __webpack_require__(/*! ./4_file_information/abap_file_information */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/abap_file_information.js\");\r\nconst abap_file_1 = __webpack_require__(/*! ./abap_file */ \"./node_modules/@abaplint/core/build/src/abap/abap_file.js\");\r\nclass ABAPParser {\r\n constructor(version, globalMacros) {\r\n this.version = version ? version : version_1.defaultVersion;\r\n this.globalMacros = globalMacros ? globalMacros : [];\r\n }\r\n // files is input for a single object\r\n parse(files) {\r\n const issues = [];\r\n const output = [];\r\n const start = Date.now();\r\n // 1: lexing\r\n const b1 = Date.now();\r\n const lexerResult = files.map(f => lexer_1.Lexer.run(f));\r\n const lexingRuntime = Date.now() - b1;\r\n // 2: statements\r\n const b2 = Date.now();\r\n const statementResult = new statement_parser_1.StatementParser(this.version).run(lexerResult, this.globalMacros);\r\n const statementsRuntime = Date.now() - b2;\r\n // 3: structures\r\n const b3 = Date.now();\r\n for (const f of statementResult) {\r\n const result = structure_parser_1.StructureParser.run(f);\r\n // 4: file information\r\n const info = new abap_file_information_1.ABAPFileInformation(result.node, f.file.getFilename());\r\n output.push(new abap_file_1.ABAPFile(f.file, f.tokens, f.statements, result.node, info));\r\n issues.push(...result.issues);\r\n }\r\n const structuresRuntime = Date.now() - b3;\r\n const end = Date.now();\r\n return { issues,\r\n output,\r\n runtime: end - start,\r\n runtimeExtra: { lexing: lexingRuntime, statements: statementsRuntime, structure: structuresRuntime },\r\n };\r\n }\r\n}\r\nexports.ABAPParser = ABAPParser;\r\n//# sourceMappingURL=abap_parser.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/abap_parser.js?");
|
|
8434
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ABAPParser = void 0;\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst lexer_1 = __webpack_require__(/*! ./1_lexer/lexer */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/lexer.js\");\r\nconst statement_parser_1 = __webpack_require__(/*! ./2_statements/statement_parser */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statement_parser.js\");\r\nconst structure_parser_1 = __webpack_require__(/*! ./3_structures/structure_parser */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structure_parser.js\");\r\nconst abap_file_information_1 = __webpack_require__(/*! ./4_file_information/abap_file_information */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/abap_file_information.js\");\r\nconst abap_file_1 = __webpack_require__(/*! ./abap_file */ \"./node_modules/@abaplint/core/build/src/abap/abap_file.js\");\r\nclass ABAPParser {\r\n constructor(version, globalMacros, reg) {\r\n this.version = version ? version : version_1.defaultVersion;\r\n this.globalMacros = globalMacros ? globalMacros : [];\r\n this.reg = reg;\r\n }\r\n // files is input for a single object\r\n parse(files) {\r\n const issues = [];\r\n const output = [];\r\n const start = Date.now();\r\n // 1: lexing\r\n const b1 = Date.now();\r\n const lexerResult = files.map(f => lexer_1.Lexer.run(f));\r\n const lexingRuntime = Date.now() - b1;\r\n // 2: statements\r\n const b2 = Date.now();\r\n const statementResult = new statement_parser_1.StatementParser(this.version, this.reg).run(lexerResult, this.globalMacros);\r\n const statementsRuntime = Date.now() - b2;\r\n // 3: structures\r\n const b3 = Date.now();\r\n for (const f of statementResult) {\r\n const result = structure_parser_1.StructureParser.run(f);\r\n // 4: file information\r\n const info = new abap_file_information_1.ABAPFileInformation(result.node, f.file.getFilename());\r\n output.push(new abap_file_1.ABAPFile(f.file, f.tokens, f.statements, result.node, info));\r\n issues.push(...result.issues);\r\n }\r\n const structuresRuntime = Date.now() - b3;\r\n const end = Date.now();\r\n return { issues,\r\n output,\r\n runtime: end - start,\r\n runtimeExtra: { lexing: lexingRuntime, statements: statementsRuntime, structure: structuresRuntime },\r\n };\r\n }\r\n}\r\nexports.ABAPParser = ABAPParser;\r\n//# sourceMappingURL=abap_parser.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/abap_parser.js?");
|
|
8435
8435
|
|
|
8436
8436
|
/***/ }),
|
|
8437
8437
|
|
|
@@ -8453,7 +8453,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
8453
8453
|
/***/ ((__unused_webpack_module, exports) => {
|
|
8454
8454
|
|
|
8455
8455
|
"use strict";
|
|
8456
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FlowGraph = void 0;\r\nclass FlowGraph {\r\n constructor(counter) {\r\n this.label = \"undefined\";\r\n this.edges = {};\r\n this.start = \"start#\" + counter;\r\n this.end = \"end#\" + counter;\r\n }\r\n getStart() {\r\n return this.start;\r\n }\r\n getEnd() {\r\n return this.end;\r\n }\r\n addEdge(from, to) {\r\n if (this.edges[from] === undefined) {\r\n this.edges[from] = {};\r\n }\r\n this.edges[from][to] = true;\r\n }\r\n removeEdge(from, to) {\r\n if (this.edges[from] === undefined) {\r\n return;\r\n }\r\n delete this.edges[from][to];\r\n if (Object.keys(this.edges[from]).length === 0) {\r\n delete this.edges[from];\r\n }\r\n }\r\n listEdges() {\r\n const list = [];\r\n for (const from of Object.keys(this.edges)) {\r\n for (const to of Object.keys(this.edges[from])) {\r\n list.push({ from, to });\r\n }\r\n }\r\n return list;\r\n }\r\n listNodes() {\r\n const set = new Set();\r\n for (const l of this.listEdges()) {\r\n set.add(l.from);\r\n set.add(l.to);\r\n }\r\n return Array.from(set.values());\r\n }\r\n hasEdges() {\r\n return Object.keys(this.edges).length > 0;\r\n }\r\n /** return value: end node of to graph */\r\n addGraph(from, to) {\r\n if (to.hasEdges() === false) {\r\n return from;\r\n }\r\n this.addEdge(from, to.getStart());\r\n to.listEdges().forEach(e => this.addEdge(e.from, e.to));\r\n return to.getEnd();\r\n }\r\n toJSON() {\r\n return JSON.stringify(this.edges);\r\n }\r\n toTextEdges() {\r\n let graph = \"\";\r\n for (const l of this.listEdges()) {\r\n graph += `\"${l.from}\" -> \"${l.to}\";\\n`;\r\n }\r\n return graph.trim();\r\n }\r\n setLabel(label) {\r\n this.label = label;\r\n }\r\n toDigraph() {\r\n return `digraph G {\nlabelloc=\"t\";\nlabel=\"${this.label}\";\ngraph [fontname = \"helvetica\"];\nnode [fontname = \"helvetica\", shape=\"box\"];\nedge [fontname = \"helvetica\"];\n${this.toTextEdges()}\n}`;\r\n }\r\n listSources(node) {\r\n const set = new Set();\r\n for (const l of this.listEdges()) {\r\n if (node === l.to) {\r\n set.add(l.from);\r\n }\r\n }\r\n return Array.from(set.values());\r\n }\r\n listTargets(node) {\r\n const set = new Set();\r\n for (const l of this.listEdges()) {\r\n if (node === l.from) {\r\n set.add(l.to);\r\n }\r\n }\r\n return Array.from(set.values());\r\n }\r\n /** removes all nodes containing \"#\" that have one ingoing and one outgoing edge */\r\n reduce() {\r\n for (const node of this.listNodes()) {\r\n if (node.includes(\"#\") === false) {\r\n continue;\r\n }\r\n const sources = this.listSources(node);\r\n const targets = this.listTargets(node);\r\n if (sources.length > 0 && targets.length > 0) {\r\n // hash node in the middle of the graph\r\n for (const s of sources) {\r\n this.removeEdge(s, node);\r\n }\r\n for (const t of targets) {\r\n this.removeEdge(node, t);\r\n }\r\n for (const s of sources) {\r\n for (const t of targets) {\r\n this.addEdge(s, t);\r\n }\r\n }\r\n }\r\n if (node.startsWith(\"end#\") && sources.length === 0) {\r\n for (const t of targets) {\r\n this.removeEdge(node, t);\r\n }\r\n }\r\n }\r\n return this;\r\n }\r\n}\r\nexports.FlowGraph = FlowGraph;\r\n//# sourceMappingURL=flow_graph.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/flow/flow_graph.js?");
|
|
8456
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FlowGraph = void 0;\r\nclass FlowGraph {\r\n constructor(counter) {\r\n this.label = \"undefined\";\r\n this.edges = {};\r\n this.start = \"start#\" + counter;\r\n this.end = \"end#\" + counter;\r\n }\r\n getStart() {\r\n return this.start;\r\n }\r\n getEnd() {\r\n return this.end;\r\n }\r\n addEdge(from, to) {\r\n if (this.edges[from] === undefined) {\r\n this.edges[from] = {};\r\n }\r\n this.edges[from][to] = true;\r\n }\r\n removeEdge(from, to) {\r\n if (this.edges[from] === undefined) {\r\n return;\r\n }\r\n delete this.edges[from][to];\r\n if (Object.keys(this.edges[from]).length === 0) {\r\n delete this.edges[from];\r\n }\r\n }\r\n listEdges() {\r\n const list = [];\r\n for (const from of Object.keys(this.edges)) {\r\n for (const to of Object.keys(this.edges[from])) {\r\n list.push({ from, to });\r\n }\r\n }\r\n return list;\r\n }\r\n listNodes() {\r\n const set = new Set();\r\n for (const l of this.listEdges()) {\r\n set.add(l.from);\r\n set.add(l.to);\r\n }\r\n return Array.from(set.values());\r\n }\r\n hasEdges() {\r\n return Object.keys(this.edges).length > 0;\r\n }\r\n /** return value: end node of to graph */\r\n addGraph(from, to) {\r\n if (to.hasEdges() === false) {\r\n return from;\r\n }\r\n this.addEdge(from, to.getStart());\r\n to.listEdges().forEach(e => this.addEdge(e.from, e.to));\r\n return to.getEnd();\r\n }\r\n toJSON() {\r\n return JSON.stringify(this.edges);\r\n }\r\n toTextEdges() {\r\n let graph = \"\";\r\n for (const l of this.listEdges()) {\r\n graph += `\"${l.from}\" -> \"${l.to}\";\\n`;\r\n }\r\n return graph.trim();\r\n }\r\n setLabel(label) {\r\n this.label = label;\r\n }\r\n toDigraph() {\r\n return `digraph G {\r\nlabelloc=\"t\";\r\nlabel=\"${this.label}\";\r\ngraph [fontname = \"helvetica\"];\r\nnode [fontname = \"helvetica\", shape=\"box\"];\r\nedge [fontname = \"helvetica\"];\r\n${this.toTextEdges()}\r\n}`;\r\n }\r\n listSources(node) {\r\n const set = new Set();\r\n for (const l of this.listEdges()) {\r\n if (node === l.to) {\r\n set.add(l.from);\r\n }\r\n }\r\n return Array.from(set.values());\r\n }\r\n listTargets(node) {\r\n const set = new Set();\r\n for (const l of this.listEdges()) {\r\n if (node === l.from) {\r\n set.add(l.to);\r\n }\r\n }\r\n return Array.from(set.values());\r\n }\r\n /** removes all nodes containing \"#\" that have one ingoing and one outgoing edge */\r\n reduce() {\r\n for (const node of this.listNodes()) {\r\n if (node.includes(\"#\") === false) {\r\n continue;\r\n }\r\n const sources = this.listSources(node);\r\n const targets = this.listTargets(node);\r\n if (sources.length > 0 && targets.length > 0) {\r\n // hash node in the middle of the graph\r\n for (const s of sources) {\r\n this.removeEdge(s, node);\r\n }\r\n for (const t of targets) {\r\n this.removeEdge(node, t);\r\n }\r\n for (const s of sources) {\r\n for (const t of targets) {\r\n this.addEdge(s, t);\r\n }\r\n }\r\n }\r\n if (node.startsWith(\"end#\") && sources.length === 0) {\r\n for (const t of targets) {\r\n this.removeEdge(node, t);\r\n }\r\n }\r\n }\r\n return this;\r\n }\r\n}\r\nexports.FlowGraph = FlowGraph;\r\n//# sourceMappingURL=flow_graph.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/flow/flow_graph.js?");
|
|
8457
8457
|
|
|
8458
8458
|
/***/ }),
|
|
8459
8459
|
|
|
@@ -8948,7 +8948,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
8948
8948
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
8949
8949
|
|
|
8950
8950
|
"use strict";
|
|
8951
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ClassDefinition = void 0;\r\nconst method_definitions_1 = __webpack_require__(/*! ./method_definitions */ \"./node_modules/@abaplint/core/build/src/abap/types/method_definitions.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst Statements = __webpack_require__(/*! ../2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Structures = __webpack_require__(/*! ../3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst class_attributes_1 = __webpack_require__(/*! ./class_attributes */ \"./node_modules/@abaplint/core/build/src/abap/types/class_attributes.js\");\r\nconst _identifier_1 = __webpack_require__(/*! ../4_file_information/_identifier */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/_identifier.js\");\r\nconst aliases_1 = __webpack_require__(/*! ./aliases */ \"./node_modules/@abaplint/core/build/src/abap/types/aliases.js\");\r\nconst _scope_type_1 = __webpack_require__(/*! ../5_syntax/_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\r\nconst event_definition_1 = __webpack_require__(/*! ./event_definition */ \"./node_modules/@abaplint/core/build/src/abap/types/event_definition.js\");\r\nconst visibility_1 = __webpack_require__(/*! ../4_file_information/visibility */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js\");\r\nconst _object_oriented_1 = __webpack_require__(/*! ../5_syntax/_object_oriented */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nclass ClassDefinition extends _identifier_1.Identifier {\r\n constructor(node, filename, scope) {\r\n if (!(node.get() instanceof Structures.ClassDefinition)) {\r\n throw new Error(\"ClassDefinition, unexpected node type\");\r\n }\r\n const def = node.findFirstStatement(Statements.ClassDefinition);\r\n const name = def.findDirectExpression(Expressions.ClassName).getFirstToken();\r\n super(name, filename);\r\n scope.addClassDefinition(this);\r\n this.node = node;\r\n this.events = [];\r\n this.implementing = [];\r\n scope.push(_scope_type_1.ScopeType.ClassDefinition, name.getStr(), name.getStart(), filename);\r\n this.superClass = this.findSuper(def, filename, scope);\r\n this.friends = this.findFriends(def, filename, scope);\r\n this.parse(filename, scope);\r\n const helper = new _object_oriented_1.ObjectOriented(scope);\r\n helper.fromSuperClassesAndInterfaces(this);\r\n helper.addAliasedTypes(this.aliases);\r\n this.attributes = new class_attributes_1.Attributes(this.node, this.filename, scope);\r\n this.types = this.attributes.getTypes();\r\n
|
|
8951
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ClassDefinition = void 0;\r\nconst method_definitions_1 = __webpack_require__(/*! ./method_definitions */ \"./node_modules/@abaplint/core/build/src/abap/types/method_definitions.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst Statements = __webpack_require__(/*! ../2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Structures = __webpack_require__(/*! ../3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst class_attributes_1 = __webpack_require__(/*! ./class_attributes */ \"./node_modules/@abaplint/core/build/src/abap/types/class_attributes.js\");\r\nconst _identifier_1 = __webpack_require__(/*! ../4_file_information/_identifier */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/_identifier.js\");\r\nconst aliases_1 = __webpack_require__(/*! ./aliases */ \"./node_modules/@abaplint/core/build/src/abap/types/aliases.js\");\r\nconst _scope_type_1 = __webpack_require__(/*! ../5_syntax/_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\r\nconst event_definition_1 = __webpack_require__(/*! ./event_definition */ \"./node_modules/@abaplint/core/build/src/abap/types/event_definition.js\");\r\nconst visibility_1 = __webpack_require__(/*! ../4_file_information/visibility */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js\");\r\nconst _object_oriented_1 = __webpack_require__(/*! ../5_syntax/_object_oriented */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nclass ClassDefinition extends _identifier_1.Identifier {\r\n constructor(node, filename, scope) {\r\n if (!(node.get() instanceof Structures.ClassDefinition)) {\r\n throw new Error(\"ClassDefinition, unexpected node type\");\r\n }\r\n const def = node.findFirstStatement(Statements.ClassDefinition);\r\n const name = def.findDirectExpression(Expressions.ClassName).getFirstToken();\r\n super(name, filename);\r\n scope.addClassDefinition(this);\r\n this.node = node;\r\n this.events = [];\r\n this.implementing = [];\r\n scope.push(_scope_type_1.ScopeType.ClassDefinition, name.getStr(), name.getStart(), filename);\r\n this.superClass = this.findSuper(def, filename, scope);\r\n this.friends = this.findFriends(def, filename, scope);\r\n this.parse(filename, scope);\r\n const helper = new _object_oriented_1.ObjectOriented(scope);\r\n helper.fromSuperClassesAndInterfaces(this);\r\n helper.addAliasedTypes(this.aliases);\r\n this.attributes = new class_attributes_1.Attributes(this.node, this.filename, scope);\r\n this.types = this.attributes.getTypes();\r\n const events = this.node.findAllStatements(Statements.Events);\r\n for (const e of events) {\r\n this.events.push(new event_definition_1.EventDefinition(e, visibility_1.Visibility.Public, this.filename, scope)); // todo, all these are not Public\r\n }\r\n this.methodDefs = new method_definitions_1.MethodDefinitions(this.node, this.filename, scope);\r\n scope.pop(node.getLastToken().getEnd());\r\n const concat = this.node.findFirstStatement(Statements.ClassDefinition).concatTokens().toUpperCase();\r\n this.testing = concat.includes(\" FOR TESTING\");\r\n this.abstract = concat.includes(\" ABSTRACT\");\r\n }\r\n getFriends() {\r\n return this.friends;\r\n }\r\n getEvents() {\r\n return this.events;\r\n }\r\n getMethodDefinitions() {\r\n return this.methodDefs;\r\n }\r\n getTypeDefinitions() {\r\n return this.types;\r\n }\r\n getSuperClass() {\r\n return this.superClass;\r\n }\r\n getAttributes() {\r\n return this.attributes;\r\n }\r\n isGlobal() {\r\n return this.node.findFirstExpression(Expressions.ClassGlobal) !== undefined;\r\n }\r\n isFinal() {\r\n return this.node.findFirstExpression(Expressions.ClassFinal) !== undefined;\r\n }\r\n getImplementing() {\r\n return this.implementing;\r\n }\r\n getAliases() {\r\n return this.aliases;\r\n }\r\n isForTesting() {\r\n return this.testing;\r\n }\r\n isAbstract() {\r\n return this.abstract;\r\n }\r\n /*\r\n public getEvents() {\r\n }\r\n */\r\n ///////////////////\r\n findSuper(def, filename, scope) {\r\n var _a;\r\n const token = (_a = def === null || def === void 0 ? void 0 : def.findDirectExpression(expressions_1.SuperClassName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\r\n this.addReference(token, filename, scope);\r\n const name = token === null || token === void 0 ? void 0 : token.getStr();\r\n return name;\r\n }\r\n findFriends(def, filename, scope) {\r\n var _a;\r\n const result = [];\r\n for (const n of ((_a = def === null || def === void 0 ? void 0 : def.findDirectExpression(Expressions.ClassFriends)) === null || _a === void 0 ? void 0 : _a.findDirectExpressions(Expressions.ClassName)) || []) {\r\n const token = n.getFirstToken();\r\n this.addReference(token, filename, scope);\r\n const name = token.getStr();\r\n result.push(name);\r\n }\r\n return result;\r\n }\r\n addReference(token, filename, scope) {\r\n const name = token === null || token === void 0 ? void 0 : token.getStr();\r\n if (name) {\r\n const s = scope.findClassDefinition(name);\r\n if (s) {\r\n scope.addReference(token, s, _reference_1.ReferenceType.ObjectOrientedReference, filename, { ooName: name.toUpperCase(), ooType: \"CLAS\" });\r\n }\r\n else if (scope.getDDIC().inErrorNamespace(name) === false) {\r\n scope.addReference(token, undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, filename);\r\n }\r\n }\r\n }\r\n parse(filename, scope) {\r\n var _a;\r\n for (const node of this.node.findAllStatements(Statements.InterfaceDef)) {\r\n const partial = node.concatTokens().toUpperCase().includes(\" PARTIALLY IMPLEMENTED\");\r\n const token = (_a = node.findFirstExpression(Expressions.InterfaceName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\r\n if (token === undefined) {\r\n throw new Error(\"ClassDefinition, unable to find interface token\");\r\n }\r\n const name = token.getStr().toUpperCase();\r\n this.implementing.push({ name, partial });\r\n const intf = scope.findInterfaceDefinition(name);\r\n if (intf) {\r\n scope.addReference(token, intf, _reference_1.ReferenceType.ObjectOrientedReference, filename, { ooName: name.toUpperCase(), ooType: \"INTF\" });\r\n }\r\n else if (scope.getDDIC().inErrorNamespace(name) === false) {\r\n scope.addReference(token, undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, filename, { ooName: name.toUpperCase(), ooType: \"INTF\" });\r\n }\r\n else {\r\n scope.addReference(token, undefined, _reference_1.ReferenceType.ObjectOrientedUnknownReference, filename, { ooName: name.toUpperCase(), ooType: \"INTF\" });\r\n }\r\n }\r\n this.aliases = new aliases_1.Aliases(this.node, this.filename, scope);\r\n }\r\n}\r\nexports.ClassDefinition = ClassDefinition;\r\n//# sourceMappingURL=class_definition.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/types/class_definition.js?");
|
|
8952
8952
|
|
|
8953
8953
|
/***/ }),
|
|
8954
8954
|
|
|
@@ -9751,7 +9751,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
9751
9751
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
9752
9752
|
|
|
9753
9753
|
"use strict";
|
|
9754
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Help = void 0;\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst _lsp_utils_1 = __webpack_require__(/*! ./_lsp_utils */ \"./node_modules/@abaplint/core/build/src/lsp/_lsp_utils.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst dump_scope_1 = __webpack_require__(/*! ./dump_scope */ \"./node_modules/@abaplint/core/build/src/lsp/dump_scope.js\");\r\nclass Help {\r\n static find(reg, textDocument, position) {\r\n const file = _lsp_utils_1.LSPUtils.getABAPFile(reg, textDocument.uri);\r\n if (file === undefined) {\r\n return \"file not found\";\r\n }\r\n else {\r\n return this.dumpABAP(file, reg, textDocument, position);\r\n }\r\n }\r\n /////////////////////////////////////////////////\r\n static dumpABAP(file, reg, textDocument, position) {\r\n let content = \"\";\r\n content = `\n <a href=\"#_tokens\" rel=\"no-refresh\">Tokens</a> |\n <a href=\"#_statements\" rel=\"no-refresh\">Statements</a> |\n <a href=\"#_structure\" rel=\"no-refresh\">Structure</a> |\n <a href=\"#_files\" rel=\"no-refresh\">Files</a> |\n <a href=\"#_info\" rel=\"no-refresh\">Info Dump</a>\n <hr>\n ` +\r\n \"<tt>\" + textDocument.uri + \" (\" +\r\n (position.line + 1) + \", \" +\r\n (position.character + 1) + \")</tt>\";\r\n content = content + \"<hr>\";\r\n content = content + this.cursorInformation(reg, textDocument, position, file);\r\n content = content + this.fileInformation(file);\r\n content = content + \"<hr>\";\r\n content = content + this.dumpFiles(reg);\r\n content = content + \"<hr>\";\r\n content = content + this.dumpInfo(file);\r\n return content;\r\n }\r\n static dumpInfo(file) {\r\n const info = file.getInfo();\r\n const dump = {\r\n classDefinitions: info.listClassDefinitions(),\r\n classImplementations: info.listClassImplementations(),\r\n interfaceDefinitions: info.listInterfaceDefinitions(),\r\n forms: info.listFormDefinitions(),\r\n };\r\n const text = JSON.stringify(dump, null, 2);\r\n return `<h3 id=\"_info\">Info Dump</h3><pre>` + text + \"</pre>\";\r\n }\r\n static cursorInformation(reg, textDocument, position, file) {\r\n let ret = \"\";\r\n const found = _lsp_utils_1.LSPUtils.findCursor(reg, { textDocument, position });\r\n if (found !== undefined) {\r\n ret = \"Statement: \" + this.linkToStatement(found.snode.get()) + \"<br>\\n\" +\r\n \"Token: \" + found.token.constructor.name + \"<br>\\n\" +\r\n this.fullPath(file, found.token).value;\r\n }\r\n else {\r\n ret = \"No token found at cursor position\";\r\n }\r\n const obj = reg.getObject(file.getObjectType(), file.getObjectName());\r\n if (obj instanceof _abap_object_1.ABAPObject) {\r\n const spaghetti = new syntax_1.SyntaxLogic(reg, obj).run().spaghetti;\r\n ret = ret + dump_scope_1.DumpScope.dump(spaghetti);\r\n if (found !== undefined) {\r\n ret = ret + \"<hr>Spaghetti Scope by Cursor Position:<br><br>\\n\";\r\n const lookup = spaghetti.lookupPosition(found.token.getStart(), textDocument.uri);\r\n if (lookup) {\r\n const identifier = lookup.getIdentifier();\r\n ret = ret + \"<u>\" + identifier.stype + \", <tt>\" + identifier.sname + \"</tt>, \" + identifier.filename;\r\n ret = ret + \", (\" + identifier.start.getRow() + \", \" + identifier.start.getCol() + \")</u><br>\";\r\n }\r\n else {\r\n ret = ret + \"Not found\";\r\n }\r\n }\r\n }\r\n return ret;\r\n }\r\n static fullPath(file, token) {\r\n const structure = file.getStructure();\r\n if (structure === undefined) {\r\n return { value: \"\", keyword: false };\r\n }\r\n const found = this.traverse(structure, \"\", token);\r\n if (found === undefined) {\r\n return { value: \"\", keyword: false };\r\n }\r\n return { value: \"\\n\\n\" + found.value, keyword: found.keyword };\r\n }\r\n static traverse(node, parents, search) {\r\n let local = parents;\r\n if (local !== \"\") {\r\n local = local + \" -> \";\r\n }\r\n if (node instanceof nodes_1.StructureNode) {\r\n local = local + \"Structure: \" + this.linkToStructure(node.get());\r\n }\r\n else if (node instanceof nodes_1.StatementNode) {\r\n local = local + \"Statement: \" + this.linkToStatement(node.get());\r\n }\r\n else if (node instanceof nodes_1.ExpressionNode) {\r\n local = local + \"Expression: \" + this.linkToExpression(node.get());\r\n }\r\n else if (node instanceof nodes_1.TokenNode) {\r\n local = local + \"Token: \" + node.get().constructor.name;\r\n const token = node.get();\r\n if (token.getStr() === search.getStr()\r\n && token.getCol() === search.getCol()\r\n && token.getRow() === search.getRow()) {\r\n const keyword = !(node instanceof nodes_1.TokenNodeRegex);\r\n return { value: local, keyword };\r\n }\r\n }\r\n else {\r\n throw new Error(\"hover, traverse, unexpected node type\");\r\n }\r\n for (const child of node.getChildren()) {\r\n const ret = this.traverse(child, local, search);\r\n if (ret) {\r\n return ret;\r\n }\r\n }\r\n return undefined;\r\n }\r\n static fileInformation(file) {\r\n let content = \"\";\r\n content = content + `<hr><h3 id=\"_tokens\">Tokens</h3>\\n`;\r\n content = content + this.tokens(file);\r\n content = content + `<hr><h3 id=\"_statements\">Statements</h3>\\n`;\r\n content = content + this.buildStatements(file);\r\n content = content + `<hr><h3 id=\"_structure\">Structure</h3>\\n`;\r\n const structure = file.getStructure();\r\n if (structure !== undefined) {\r\n content = content + this.buildStructure([structure]);\r\n }\r\n else {\r\n content = content + \"structure undefined\";\r\n }\r\n return content;\r\n }\r\n static escape(str) {\r\n str = str.replace(/&/g, \"&\");\r\n str = str.replace(/>/g, \">\");\r\n str = str.replace(/</g, \"<\");\r\n str = str.replace(/\"/g, \""\");\r\n str = str.replace(/'/g, \"'\");\r\n return str;\r\n }\r\n static linkToStatement(statement) {\r\n return `<a href=\"https://syntax.abaplint.org/#/statement/${statement.constructor.name}\" target=\"_blank\">${statement.constructor.name}</a>\\n`;\r\n }\r\n static linkToStructure(structure) {\r\n return `<a href=\"https://syntax.abaplint.org/#/structure/${structure.constructor.name}\" target=\"_blank\">${structure.constructor.name}</a>\\n`;\r\n }\r\n static linkToExpression(expression) {\r\n return `<a href=\"https://syntax.abaplint.org/#/expression/${expression.constructor.name}\" target=\"_blank\">${expression.constructor.name}</a>\\n`;\r\n }\r\n static outputNodes(nodes) {\r\n let ret = \"<ul>\";\r\n for (const node of nodes) {\r\n let extra = \"\";\r\n switch (node.constructor.name) {\r\n case \"TokenNode\":\r\n case \"TokenNodeRegex\":\r\n extra = node.get().constructor.name + \", \\\"\" + node.get().getStr() + \"\\\"\";\r\n break;\r\n case \"ExpressionNode\":\r\n extra = this.linkToExpression(node.get()) + this.outputNodes(node.getChildren());\r\n break;\r\n default:\r\n break;\r\n }\r\n ret = ret + \"<li>\" + node.constructor.name + \", \" + extra + \"</li>\";\r\n }\r\n return ret + \"</ul>\";\r\n }\r\n static tokens(file) {\r\n let inner = \"<table><tr><td><b>String</b></td><td><b>Type</b></td><td><b>Row</b></td><td><b>Column</b></td></tr>\";\r\n for (const token of file.getTokens()) {\r\n inner = inner + \"<tr><td><tt>\" +\r\n this.escape(token.getStr()) + \"</tt></td><td>\" +\r\n token.constructor.name + \"</td><td align=\\\"right\\\">\" +\r\n token.getRow() + \"</td><td align=\\\"right\\\">\" +\r\n token.getCol() + \"</td></tr>\";\r\n }\r\n inner = inner + \"</table>\";\r\n return inner;\r\n }\r\n static buildStatements(file) {\r\n let output = \"\";\r\n for (const statement of file.getStatements()) {\r\n const row = statement.getStart().getRow();\r\n // getting the class name only works if uglify does not mangle names\r\n output = output +\r\n row + \": \" +\r\n this.linkToStatement(statement.get()) +\r\n \"</div></b>\\n\" + this.outputNodes(statement.getChildren());\r\n }\r\n return output;\r\n }\r\n static buildStructure(nodes) {\r\n let output = \"<ul>\";\r\n for (const node of nodes) {\r\n if (node instanceof nodes_1.StructureNode) {\r\n output = output + \"<li>\" + this.linkToStructure(node.get()) + \", Structure \" + this.buildStructure(node.getChildren()) + \"</li>\";\r\n }\r\n else if (node instanceof nodes_1.StatementNode) {\r\n output = output + \"<li>\" + this.linkToStatement(node.get()) + \", Statement</li>\";\r\n }\r\n }\r\n return output + \"</ul>\";\r\n }\r\n static dumpFiles(reg) {\r\n let output = `<h3 id=\"_files\">Files</h3><table>\\n`;\r\n for (const o of reg.getObjects()) {\r\n if (reg.isDependency(o) === true) {\r\n continue;\r\n }\r\n output = output + \"<tr><td valign=\\\"top\\\">\" + o.getType() + \" \" + o.getName() + \"</td><td>\";\r\n for (const f of o.getFiles()) {\r\n output = output + f.getFilename() + \"<br>\";\r\n }\r\n output = output + \"</td></tr>\\n\";\r\n }\r\n return output + \"</table>\\n\";\r\n }\r\n}\r\nexports.Help = Help;\r\n//# sourceMappingURL=help.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/lsp/help.js?");
|
|
9754
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Help = void 0;\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst _lsp_utils_1 = __webpack_require__(/*! ./_lsp_utils */ \"./node_modules/@abaplint/core/build/src/lsp/_lsp_utils.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst dump_scope_1 = __webpack_require__(/*! ./dump_scope */ \"./node_modules/@abaplint/core/build/src/lsp/dump_scope.js\");\r\nclass Help {\r\n static find(reg, textDocument, position) {\r\n const file = _lsp_utils_1.LSPUtils.getABAPFile(reg, textDocument.uri);\r\n if (file === undefined) {\r\n return \"file not found\";\r\n }\r\n else {\r\n return this.dumpABAP(file, reg, textDocument, position);\r\n }\r\n }\r\n /////////////////////////////////////////////////\r\n static dumpABAP(file, reg, textDocument, position) {\r\n let content = \"\";\r\n content = `\r\n <a href=\"#_tokens\" rel=\"no-refresh\">Tokens</a> |\r\n <a href=\"#_statements\" rel=\"no-refresh\">Statements</a> |\r\n <a href=\"#_structure\" rel=\"no-refresh\">Structure</a> |\r\n <a href=\"#_files\" rel=\"no-refresh\">Files</a> |\r\n <a href=\"#_info\" rel=\"no-refresh\">Info Dump</a>\r\n <hr>\r\n ` +\r\n \"<tt>\" + textDocument.uri + \" (\" +\r\n (position.line + 1) + \", \" +\r\n (position.character + 1) + \")</tt>\";\r\n content = content + \"<hr>\";\r\n content = content + this.cursorInformation(reg, textDocument, position, file);\r\n content = content + this.fileInformation(file);\r\n content = content + \"<hr>\";\r\n content = content + this.dumpFiles(reg);\r\n content = content + \"<hr>\";\r\n content = content + this.dumpInfo(file);\r\n return content;\r\n }\r\n static dumpInfo(file) {\r\n const info = file.getInfo();\r\n const dump = {\r\n classDefinitions: info.listClassDefinitions(),\r\n classImplementations: info.listClassImplementations(),\r\n interfaceDefinitions: info.listInterfaceDefinitions(),\r\n forms: info.listFormDefinitions(),\r\n };\r\n const text = JSON.stringify(dump, null, 2);\r\n return `<h3 id=\"_info\">Info Dump</h3><pre>` + text + \"</pre>\";\r\n }\r\n static cursorInformation(reg, textDocument, position, file) {\r\n let ret = \"\";\r\n const found = _lsp_utils_1.LSPUtils.findCursor(reg, { textDocument, position });\r\n if (found !== undefined) {\r\n ret = \"Statement: \" + this.linkToStatement(found.snode.get()) + \"<br>\\n\" +\r\n \"Token: \" + found.token.constructor.name + \"<br>\\n\" +\r\n this.fullPath(file, found.token).value;\r\n }\r\n else {\r\n ret = \"No token found at cursor position\";\r\n }\r\n const obj = reg.getObject(file.getObjectType(), file.getObjectName());\r\n if (obj instanceof _abap_object_1.ABAPObject) {\r\n const spaghetti = new syntax_1.SyntaxLogic(reg, obj).run().spaghetti;\r\n ret = ret + dump_scope_1.DumpScope.dump(spaghetti);\r\n if (found !== undefined) {\r\n ret = ret + \"<hr>Spaghetti Scope by Cursor Position:<br><br>\\n\";\r\n const lookup = spaghetti.lookupPosition(found.token.getStart(), textDocument.uri);\r\n if (lookup) {\r\n const identifier = lookup.getIdentifier();\r\n ret = ret + \"<u>\" + identifier.stype + \", <tt>\" + identifier.sname + \"</tt>, \" + identifier.filename;\r\n ret = ret + \", (\" + identifier.start.getRow() + \", \" + identifier.start.getCol() + \")</u><br>\";\r\n }\r\n else {\r\n ret = ret + \"Not found\";\r\n }\r\n }\r\n }\r\n return ret;\r\n }\r\n static fullPath(file, token) {\r\n const structure = file.getStructure();\r\n if (structure === undefined) {\r\n return { value: \"\", keyword: false };\r\n }\r\n const found = this.traverse(structure, \"\", token);\r\n if (found === undefined) {\r\n return { value: \"\", keyword: false };\r\n }\r\n return { value: \"\\n\\n\" + found.value, keyword: found.keyword };\r\n }\r\n static traverse(node, parents, search) {\r\n let local = parents;\r\n if (local !== \"\") {\r\n local = local + \" -> \";\r\n }\r\n if (node instanceof nodes_1.StructureNode) {\r\n local = local + \"Structure: \" + this.linkToStructure(node.get());\r\n }\r\n else if (node instanceof nodes_1.StatementNode) {\r\n local = local + \"Statement: \" + this.linkToStatement(node.get());\r\n }\r\n else if (node instanceof nodes_1.ExpressionNode) {\r\n local = local + \"Expression: \" + this.linkToExpression(node.get());\r\n }\r\n else if (node instanceof nodes_1.TokenNode) {\r\n local = local + \"Token: \" + node.get().constructor.name;\r\n const token = node.get();\r\n if (token.getStr() === search.getStr()\r\n && token.getCol() === search.getCol()\r\n && token.getRow() === search.getRow()) {\r\n const keyword = !(node instanceof nodes_1.TokenNodeRegex);\r\n return { value: local, keyword };\r\n }\r\n }\r\n else {\r\n throw new Error(\"hover, traverse, unexpected node type\");\r\n }\r\n for (const child of node.getChildren()) {\r\n const ret = this.traverse(child, local, search);\r\n if (ret) {\r\n return ret;\r\n }\r\n }\r\n return undefined;\r\n }\r\n static fileInformation(file) {\r\n let content = \"\";\r\n content = content + `<hr><h3 id=\"_tokens\">Tokens</h3>\\n`;\r\n content = content + this.tokens(file);\r\n content = content + `<hr><h3 id=\"_statements\">Statements</h3>\\n`;\r\n content = content + this.buildStatements(file);\r\n content = content + `<hr><h3 id=\"_structure\">Structure</h3>\\n`;\r\n const structure = file.getStructure();\r\n if (structure !== undefined) {\r\n content = content + this.buildStructure([structure]);\r\n }\r\n else {\r\n content = content + \"structure undefined\";\r\n }\r\n return content;\r\n }\r\n static escape(str) {\r\n str = str.replace(/&/g, \"&\");\r\n str = str.replace(/>/g, \">\");\r\n str = str.replace(/</g, \"<\");\r\n str = str.replace(/\"/g, \""\");\r\n str = str.replace(/'/g, \"'\");\r\n return str;\r\n }\r\n static linkToStatement(statement) {\r\n return `<a href=\"https://syntax.abaplint.org/#/statement/${statement.constructor.name}\" target=\"_blank\">${statement.constructor.name}</a>\\n`;\r\n }\r\n static linkToStructure(structure) {\r\n return `<a href=\"https://syntax.abaplint.org/#/structure/${structure.constructor.name}\" target=\"_blank\">${structure.constructor.name}</a>\\n`;\r\n }\r\n static linkToExpression(expression) {\r\n return `<a href=\"https://syntax.abaplint.org/#/expression/${expression.constructor.name}\" target=\"_blank\">${expression.constructor.name}</a>\\n`;\r\n }\r\n static outputNodes(nodes) {\r\n let ret = \"<ul>\";\r\n for (const node of nodes) {\r\n let extra = \"\";\r\n switch (node.constructor.name) {\r\n case \"TokenNode\":\r\n case \"TokenNodeRegex\":\r\n extra = node.get().constructor.name + \", \\\"\" + node.get().getStr() + \"\\\"\";\r\n break;\r\n case \"ExpressionNode\":\r\n extra = this.linkToExpression(node.get()) + this.outputNodes(node.getChildren());\r\n break;\r\n default:\r\n break;\r\n }\r\n ret = ret + \"<li>\" + node.constructor.name + \", \" + extra + \"</li>\";\r\n }\r\n return ret + \"</ul>\";\r\n }\r\n static tokens(file) {\r\n let inner = \"<table><tr><td><b>String</b></td><td><b>Type</b></td><td><b>Row</b></td><td><b>Column</b></td></tr>\";\r\n for (const token of file.getTokens()) {\r\n inner = inner + \"<tr><td><tt>\" +\r\n this.escape(token.getStr()) + \"</tt></td><td>\" +\r\n token.constructor.name + \"</td><td align=\\\"right\\\">\" +\r\n token.getRow() + \"</td><td align=\\\"right\\\">\" +\r\n token.getCol() + \"</td></tr>\";\r\n }\r\n inner = inner + \"</table>\";\r\n return inner;\r\n }\r\n static buildStatements(file) {\r\n let output = \"\";\r\n for (const statement of file.getStatements()) {\r\n const row = statement.getStart().getRow();\r\n // getting the class name only works if uglify does not mangle names\r\n output = output +\r\n row + \": \" +\r\n this.linkToStatement(statement.get()) +\r\n \"</div></b>\\n\" + this.outputNodes(statement.getChildren());\r\n }\r\n return output;\r\n }\r\n static buildStructure(nodes) {\r\n let output = \"<ul>\";\r\n for (const node of nodes) {\r\n if (node instanceof nodes_1.StructureNode) {\r\n output = output + \"<li>\" + this.linkToStructure(node.get()) + \", Structure \" + this.buildStructure(node.getChildren()) + \"</li>\";\r\n }\r\n else if (node instanceof nodes_1.StatementNode) {\r\n output = output + \"<li>\" + this.linkToStatement(node.get()) + \", Statement</li>\";\r\n }\r\n }\r\n return output + \"</ul>\";\r\n }\r\n static dumpFiles(reg) {\r\n let output = `<h3 id=\"_files\">Files</h3><table>\\n`;\r\n for (const o of reg.getObjects()) {\r\n if (reg.isDependency(o) === true) {\r\n continue;\r\n }\r\n output = output + \"<tr><td valign=\\\"top\\\">\" + o.getType() + \" \" + o.getName() + \"</td><td>\";\r\n for (const f of o.getFiles()) {\r\n output = output + f.getFilename() + \"<br>\";\r\n }\r\n output = output + \"</td></tr>\\n\";\r\n }\r\n return output + \"</table>\\n\";\r\n }\r\n}\r\nexports.Help = Help;\r\n//# sourceMappingURL=help.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/lsp/help.js?");
|
|
9755
9755
|
|
|
9756
9756
|
/***/ }),
|
|
9757
9757
|
|
|
@@ -9850,7 +9850,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
9850
9850
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
9851
9851
|
|
|
9852
9852
|
"use strict";
|
|
9853
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ABAPObject = void 0;\r\nconst _abstract_object_1 = __webpack_require__(/*! ./_abstract_object */ \"./node_modules/@abaplint/core/build/src/objects/_abstract_object.js\");\r\nconst xml_utils_1 = __webpack_require__(/*! ../xml_utils */ \"./node_modules/@abaplint/core/build/src/xml_utils.js\");\r\nconst abap_parser_1 = __webpack_require__(/*! ../abap/abap_parser */ \"./node_modules/@abaplint/core/build/src/abap/abap_parser.js\");\r\nclass ABAPObject extends _abstract_object_1.AbstractObject {\r\n constructor(name) {\r\n super(name);\r\n this.parsed = [];\r\n this.texts = undefined;\r\n }\r\n static is(x) {\r\n return !!x && x instanceof ABAPObject;\r\n }\r\n parse(version, globalMacros) {\r\n if (this.isDirty() === false) {\r\n return { updated: false, runtime: 0 };\r\n }\r\n const abapFiles = this.getFiles().filter(f => f.getFilename().endsWith(\".abap\"));\r\n const result = new abap_parser_1.ABAPParser(version, globalMacros).parse(abapFiles);\r\n this.parsed = result.output;\r\n this.old = result.issues;\r\n this.dirty = false;\r\n return { updated: true, runtime: result.runtime, runtimeExtra: result.runtimeExtra };\r\n }\r\n setDirty() {\r\n this.syntaxResult = undefined;\r\n this.texts = undefined;\r\n super.setDirty();\r\n }\r\n getABAPFiles() {\r\n return this.parsed;\r\n }\r\n getABAPFileByName(filename) {\r\n for (const p of this.parsed) {\r\n if (p.getFilename() === filename) {\r\n return p;\r\n }\r\n }\r\n return undefined;\r\n }\r\n getMainABAPFile() {\r\n // todo, uris, https://github.com/abaplint/abaplint/issues/673\r\n const search = this.getName().replace(/\\//g, \"#\").toLowerCase() + \".\" + this.getType().toLowerCase() + \".abap\";\r\n for (const file of this.getABAPFiles()) {\r\n if (file.getFilename().endsWith(search)) {\r\n return file;\r\n }\r\n }\r\n // uri fallback,\r\n for (const file of this.getABAPFiles()) {\r\n if (file.getFilename().endsWith(\".abap\")) {\r\n return file;\r\n }\r\n }\r\n return undefined;\r\n }\r\n getTexts() {\r\n if (this.texts === undefined) {\r\n this.findTexts(this.parseRaw2());\r\n }\r\n return this.texts;\r\n }\r\n findTexts(parsed) {\r\n var _a, _b;\r\n this.texts = {};\r\n if (((_b = (_a = parsed === null || parsed === void 0 ? void 0 : parsed.abapGit[\"asx:abap\"][\"asx:values\"]) === null || _a === void 0 ? void 0 : _a.TPOOL) === null || _b === void 0 ? void 0 : _b.item) === undefined) {\r\n return;\r\n }\r\n for (const t of (0, xml_utils_1.xmlToArray)(parsed.abapGit[\"asx:abap\"][\"asx:values\"].TPOOL.item)) {\r\n if ((t === null || t === void 0 ? void 0 : t.ID) === \"I\") {\r\n if (t.KEY === undefined) {\r\n throw new Error(\"findTexts, undefined\");\r\n }\r\n const key = t.KEY;\r\n if (key === undefined) {\r\n continue;\r\n }\r\n this.texts[key.toUpperCase()] = t.ENTRY ? (0, xml_utils_1.unescape)(t.ENTRY) : \"\";\r\n }\r\n }\r\n }\r\n}\r\nexports.ABAPObject = ABAPObject;\r\n//# sourceMappingURL=_abap_object.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/objects/_abap_object.js?");
|
|
9853
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ABAPObject = void 0;\r\nconst _abstract_object_1 = __webpack_require__(/*! ./_abstract_object */ \"./node_modules/@abaplint/core/build/src/objects/_abstract_object.js\");\r\nconst xml_utils_1 = __webpack_require__(/*! ../xml_utils */ \"./node_modules/@abaplint/core/build/src/xml_utils.js\");\r\nconst abap_parser_1 = __webpack_require__(/*! ../abap/abap_parser */ \"./node_modules/@abaplint/core/build/src/abap/abap_parser.js\");\r\nclass ABAPObject extends _abstract_object_1.AbstractObject {\r\n constructor(name) {\r\n super(name);\r\n this.parsed = [];\r\n this.texts = undefined;\r\n }\r\n static is(x) {\r\n return !!x && x instanceof ABAPObject;\r\n }\r\n parse(version, globalMacros, reg) {\r\n if (this.isDirty() === false) {\r\n return { updated: false, runtime: 0 };\r\n }\r\n const abapFiles = this.getFiles().filter(f => f.getFilename().endsWith(\".abap\"));\r\n const result = new abap_parser_1.ABAPParser(version, globalMacros, reg).parse(abapFiles);\r\n this.parsed = result.output;\r\n this.old = result.issues;\r\n this.dirty = false;\r\n return { updated: true, runtime: result.runtime, runtimeExtra: result.runtimeExtra };\r\n }\r\n setDirty() {\r\n this.syntaxResult = undefined;\r\n this.texts = undefined;\r\n super.setDirty();\r\n }\r\n getABAPFiles() {\r\n return this.parsed;\r\n }\r\n getABAPFileByName(filename) {\r\n for (const p of this.parsed) {\r\n if (p.getFilename() === filename) {\r\n return p;\r\n }\r\n }\r\n return undefined;\r\n }\r\n getMainABAPFile() {\r\n // todo, uris, https://github.com/abaplint/abaplint/issues/673\r\n const search = this.getName().replace(/\\//g, \"#\").toLowerCase() + \".\" + this.getType().toLowerCase() + \".abap\";\r\n for (const file of this.getABAPFiles()) {\r\n if (file.getFilename().endsWith(search)) {\r\n return file;\r\n }\r\n }\r\n // uri fallback,\r\n for (const file of this.getABAPFiles()) {\r\n if (file.getFilename().endsWith(\".abap\")) {\r\n return file;\r\n }\r\n }\r\n return undefined;\r\n }\r\n getTexts() {\r\n if (this.texts === undefined) {\r\n this.findTexts(this.parseRaw2());\r\n }\r\n return this.texts;\r\n }\r\n findTexts(parsed) {\r\n var _a, _b;\r\n this.texts = {};\r\n if (((_b = (_a = parsed === null || parsed === void 0 ? void 0 : parsed.abapGit[\"asx:abap\"][\"asx:values\"]) === null || _a === void 0 ? void 0 : _a.TPOOL) === null || _b === void 0 ? void 0 : _b.item) === undefined) {\r\n return;\r\n }\r\n for (const t of (0, xml_utils_1.xmlToArray)(parsed.abapGit[\"asx:abap\"][\"asx:values\"].TPOOL.item)) {\r\n if ((t === null || t === void 0 ? void 0 : t.ID) === \"I\") {\r\n if (t.KEY === undefined) {\r\n throw new Error(\"findTexts, undefined\");\r\n }\r\n const key = t.KEY;\r\n if (key === undefined) {\r\n continue;\r\n }\r\n this.texts[key.toUpperCase()] = t.ENTRY ? (0, xml_utils_1.unescape)(t.ENTRY) : \"\";\r\n }\r\n }\r\n }\r\n}\r\nexports.ABAPObject = ABAPObject;\r\n//# sourceMappingURL=_abap_object.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/objects/_abap_object.js?");
|
|
9854
9854
|
|
|
9855
9855
|
/***/ }),
|
|
9856
9856
|
|
|
@@ -9861,7 +9861,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
9861
9861
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
9862
9862
|
|
|
9863
9863
|
"use strict";
|
|
9864
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.AbstractObject = void 0;\r\nconst fast_xml_parser_1 = __webpack_require__(/*! fast-xml-parser */ \"./node_modules/fast-xml-parser/src/fxp.js\");\r\nconst _identifier_1 = __webpack_require__(/*! ../abap/4_file_information/_identifier */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/_identifier.js\");\r\nconst identifier_1 = __webpack_require__(/*! ../abap/1_lexer/tokens/identifier */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/identifier.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nclass AbstractObject {\r\n constructor(name) {\r\n this.name = name;\r\n this.files = [];\r\n this.old = [];\r\n this.dirty = false;\r\n }\r\n getParsingIssues() {\r\n return this.old;\r\n }\r\n parse(_version, _globalMacros) {\r\n return { updated: false, runtime: 0 };\r\n }\r\n getName() {\r\n return this.name;\r\n }\r\n setDirty() {\r\n this.dirty = true;\r\n }\r\n addFile(file) {\r\n this.setDirty();\r\n this.files.push(file);\r\n }\r\n getFiles() {\r\n return this.files;\r\n }\r\n containsFile(filename) {\r\n for (const f of this.files) {\r\n if (f.getFilename() === filename) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n removeFile(file) {\r\n this.setDirty();\r\n for (let i = 0; i < this.files.length; i++) {\r\n if (this.files[i].getFilename() === file.getFilename()) {\r\n this.files.splice(i, 1);\r\n return;\r\n }\r\n }\r\n throw new Error(\"removeFile: file not found\");\r\n }\r\n isDirty() {\r\n return this.dirty;\r\n }\r\n getIdentifier() {\r\n // this method can be redefined in each object type to give a better result\r\n const file = this.getXMLFile();\r\n if (file === undefined) {\r\n return undefined;\r\n }\r\n return new _identifier_1.Identifier(new identifier_1.Identifier(new position_1.Position(1, 1), this.getName()), file.getFilename());\r\n }\r\n getXMLFile() {\r\n // todo, https://github.com/abaplint/abaplint/issues/673 uris\r\n const expected1 = this.getName().toLowerCase().replace(/\\//g, \"#\") + \".\" + this.getType().toLowerCase() + \".xml\";\r\n const expected2 = this.getName().toLowerCase().replace(/\\//g, \"%23\") + \".\" + this.getType().toLowerCase() + \".xml\";\r\n for (const file of this.getFiles()) {\r\n if (file.getFilename().endsWith(expected1) || file.getFilename().endsWith(expected2)) {\r\n return file;\r\n }\r\n }\r\n // uri fallback, assume there is only one xml file\r\n for (const file of this.getFiles()) {\r\n if (file.getFilename().endsWith(\".xml\")) {\r\n return file;\r\n }\r\n }\r\n return undefined;\r\n }\r\n getXML() {\r\n const file = this.getXMLFile();\r\n if (file) {\r\n return file.getRaw();\r\n }\r\n return undefined;\r\n }\r\n updateFile(file) {\r\n this.setDirty();\r\n for (let i = 0; i < this.files.length; i++) {\r\n if (this.files[i].getFilename() === file.getFilename()) {\r\n this.files[i] = file;\r\n return;\r\n }\r\n }\r\n throw new Error(\"updateFile: file not found\");\r\n }\r\n parseRaw2() {\r\n const xml = this.getXML();\r\n if (xml === undefined) {\r\n return undefined;\r\n }\r\n try {\r\n return new fast_xml_parser_1.XMLParser({ parseTagValue: false, ignoreAttributes: true, trimValues: false }).parse(xml);\r\n }\r\n catch (_a) {\r\n return undefined;\r\n }\r\n }\r\n}\r\nexports.AbstractObject = AbstractObject;\r\n//# sourceMappingURL=_abstract_object.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/objects/_abstract_object.js?");
|
|
9864
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.AbstractObject = void 0;\r\nconst fast_xml_parser_1 = __webpack_require__(/*! fast-xml-parser */ \"./node_modules/fast-xml-parser/src/fxp.js\");\r\nconst _identifier_1 = __webpack_require__(/*! ../abap/4_file_information/_identifier */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/_identifier.js\");\r\nconst identifier_1 = __webpack_require__(/*! ../abap/1_lexer/tokens/identifier */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/identifier.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nclass AbstractObject {\r\n constructor(name) {\r\n this.name = name;\r\n this.files = [];\r\n this.old = [];\r\n this.dirty = false;\r\n }\r\n getParsingIssues() {\r\n return this.old;\r\n }\r\n parse(_version, _globalMacros, _reg) {\r\n return { updated: false, runtime: 0 };\r\n }\r\n getName() {\r\n return this.name;\r\n }\r\n setDirty() {\r\n this.dirty = true;\r\n }\r\n addFile(file) {\r\n this.setDirty();\r\n this.files.push(file);\r\n }\r\n getFiles() {\r\n return this.files;\r\n }\r\n containsFile(filename) {\r\n for (const f of this.files) {\r\n if (f.getFilename() === filename) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n removeFile(file) {\r\n this.setDirty();\r\n for (let i = 0; i < this.files.length; i++) {\r\n if (this.files[i].getFilename() === file.getFilename()) {\r\n this.files.splice(i, 1);\r\n return;\r\n }\r\n }\r\n throw new Error(\"removeFile: file not found\");\r\n }\r\n isDirty() {\r\n return this.dirty;\r\n }\r\n getIdentifier() {\r\n // this method can be redefined in each object type to give a better result\r\n const file = this.getXMLFile();\r\n if (file === undefined) {\r\n return undefined;\r\n }\r\n return new _identifier_1.Identifier(new identifier_1.Identifier(new position_1.Position(1, 1), this.getName()), file.getFilename());\r\n }\r\n getXMLFile() {\r\n // todo, https://github.com/abaplint/abaplint/issues/673 uris\r\n const expected1 = this.getName().toLowerCase().replace(/\\//g, \"#\") + \".\" + this.getType().toLowerCase() + \".xml\";\r\n const expected2 = this.getName().toLowerCase().replace(/\\//g, \"%23\") + \".\" + this.getType().toLowerCase() + \".xml\";\r\n for (const file of this.getFiles()) {\r\n if (file.getFilename().endsWith(expected1) || file.getFilename().endsWith(expected2)) {\r\n return file;\r\n }\r\n }\r\n // uri fallback, assume there is only one xml file\r\n for (const file of this.getFiles()) {\r\n if (file.getFilename().endsWith(\".xml\")) {\r\n return file;\r\n }\r\n }\r\n return undefined;\r\n }\r\n getXML() {\r\n const file = this.getXMLFile();\r\n if (file) {\r\n return file.getRaw();\r\n }\r\n return undefined;\r\n }\r\n updateFile(file) {\r\n this.setDirty();\r\n for (let i = 0; i < this.files.length; i++) {\r\n if (this.files[i].getFilename() === file.getFilename()) {\r\n this.files[i] = file;\r\n return;\r\n }\r\n }\r\n throw new Error(\"updateFile: file not found\");\r\n }\r\n parseRaw2() {\r\n const xml = this.getXML();\r\n if (xml === undefined) {\r\n return undefined;\r\n }\r\n try {\r\n return new fast_xml_parser_1.XMLParser({ parseTagValue: false, ignoreAttributes: true, trimValues: false }).parse(xml);\r\n }\r\n catch (_a) {\r\n return undefined;\r\n }\r\n }\r\n}\r\nexports.AbstractObject = AbstractObject;\r\n//# sourceMappingURL=_abstract_object.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/objects/_abstract_object.js?");
|
|
9865
9865
|
|
|
9866
9866
|
/***/ }),
|
|
9867
9867
|
|
|
@@ -10950,7 +10950,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
10950
10950
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
10951
10951
|
|
|
10952
10952
|
"use strict";
|
|
10953
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Table = exports.TableCategory = exports.EnhancementCategory = void 0;\r\nconst Types = __webpack_require__(/*! ../abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst _abstract_object_1 = __webpack_require__(/*! ./_abstract_object */ \"./node_modules/@abaplint/core/build/src/objects/_abstract_object.js\");\r\nconst xml_utils_1 = __webpack_require__(/*! ../xml_utils */ \"./node_modules/@abaplint/core/build/src/xml_utils.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nconst _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\r\nconst basic_1 = __webpack_require__(/*! ../abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nvar EnhancementCategory;\r\n(function (EnhancementCategory) {\r\n EnhancementCategory[\"NotClassified\"] = \"0\";\r\n EnhancementCategory[\"CannotBeEhanced\"] = \"1\";\r\n EnhancementCategory[\"Character\"] = \"2\";\r\n EnhancementCategory[\"CharacterOrNumeric\"] = \"3\";\r\n EnhancementCategory[\"Deep\"] = \"4\";\r\n})(EnhancementCategory = exports.EnhancementCategory || (exports.EnhancementCategory = {}));\r\nvar TableCategory;\r\n(function (TableCategory) {\r\n TableCategory[\"Transparent\"] = \"TRANSP\";\r\n TableCategory[\"Structure\"] = \"INTTAB\";\r\n TableCategory[\"Cluster\"] = \"CLUSTER\";\r\n TableCategory[\"Pooled\"] = \"POOL\";\r\n TableCategory[\"View\"] = \"VIEW\";\r\n TableCategory[\"Append\"] = \"APPEND\";\r\n})(TableCategory = exports.TableCategory || (exports.TableCategory = {}));\r\nclass Table extends _abstract_object_1.AbstractObject {\r\n getType() {\r\n return \"TABL\";\r\n }\r\n getDescription() {\r\n // todo\r\n return undefined;\r\n }\r\n getAllowedNaming() {\r\n return {\r\n maxLength: 30,\r\n allowNamespace: true,\r\n };\r\n }\r\n setDirty() {\r\n this.parsedData = undefined;\r\n super.setDirty();\r\n }\r\n listKeys() {\r\n if (this.parsedData === undefined) {\r\n this.parseXML();\r\n }\r\n if (this.parsedData === undefined) {\r\n return [];\r\n }\r\n const ret = [];\r\n for (const p of this.parsedData.fields) {\r\n if (p.KEYFLAG === \"X\") {\r\n ret.push(p.FIELDNAME);\r\n }\r\n }\r\n return ret;\r\n }\r\n parseType(reg) {\r\n var _a, _b;\r\n if (this.parsedData === undefined) {\r\n this.parseXML();\r\n if (this.parsedData === undefined) {\r\n return new Types.UnknownType(\"Table, parser error\");\r\n }\r\n }\r\n const references = [];\r\n const components = [];\r\n const ddic = new ddic_1.DDIC(reg);\r\n for (const field of this.parsedData.fields) {\r\n const comptype = field.COMPTYPE ? field.COMPTYPE : \"\";\r\n if (comptype === \"E\") { // data element\r\n const lookup = ddic.lookupDataElement(field.ROLLNAME);\r\n components.push({ name: field.FIELDNAME, type: lookup.type });\r\n if (lookup.object) {\r\n references.push({ object: lookup.object });\r\n }\r\n }\r\n else if (field.FIELDNAME === \".INCLUDE\" || field.FIELDNAME === \".INCLU--AP\") { // incude or append structure\r\n if (field.PRECFIELD === undefined) {\r\n return new Types.UnknownType(\"Table, parser error, PRECFIELD undefined\");\r\n }\r\n const lookup = ddic.lookupTableOrView(field.PRECFIELD);\r\n let found = lookup.type;\r\n if (lookup.object) {\r\n references.push({ object: lookup.object });\r\n }\r\n if (found instanceof _typed_identifier_1.TypedIdentifier) {\r\n found = found.getType();\r\n }\r\n if (found instanceof Types.StructureType) {\r\n if (field.GROUPNAME !== undefined) {\r\n components.push({ name: field.GROUPNAME, type: found });\r\n }\r\n else {\r\n for (const c of found.getComponents()) {\r\n components.push({ name: c.name, type: c.type });\r\n }\r\n }\r\n }\r\n else if ((((_a = field.PRECFIELD) === null || _a === void 0 ? void 0 : _a.startsWith(\"CI_\")) || ((_b = field.PRECFIELD) === null || _b === void 0 ? void 0 : _b.startsWith(\"SI_\")))\r\n && found instanceof Types.UnknownType) {\r\n continue;\r\n }\r\n else if (found instanceof Types.UnknownType) {\r\n return found;\r\n }\r\n else if (found instanceof Types.VoidType) {\r\n // set the full structure to void\r\n return found;\r\n }\r\n else {\r\n components.push({ name: field.FIELDNAME, type: found });\r\n }\r\n }\r\n else if (comptype === \"S\" && field.FIELDNAME.startsWith(\".INCLU-\")) {\r\n const lookup = ddic.lookupTableOrView(field.ROLLNAME);\r\n if (lookup.object) {\r\n references.push({ object: lookup.object });\r\n }\r\n const found = lookup.type;\r\n if (found instanceof Types.VoidType) {\r\n // set the full structure to void\r\n return found;\r\n }\r\n else if (found instanceof Types.StructureType) {\r\n const suffix = field.FIELDNAME.split(\"-\")[1];\r\n for (const c of found.getComponents()) {\r\n components.push({ name: c.name + suffix, type: c.type });\r\n }\r\n }\r\n else if (found instanceof Types.UnknownType) {\r\n return found;\r\n }\r\n }\r\n else if (comptype === \"S\") {\r\n const lookup = ddic.lookupTableOrView(field.ROLLNAME);\r\n components.push({ name: field.FIELDNAME, type: lookup.type });\r\n if (lookup.object) {\r\n references.push({ object: lookup.object });\r\n }\r\n }\r\n else if (comptype === \"R\") {\r\n if (field.ROLLNAME === undefined) {\r\n throw new Error(\"Expected ROLLNAME\");\r\n }\r\n if (field.ROLLNAME === \"DATA\") {\r\n components.push({\r\n name: field.FIELDNAME,\r\n type: new basic_1.DataReference(new basic_1.AnyType())\r\n });\r\n }\r\n else if (field.ROLLNAME === \"OBJECT\") {\r\n components.push({\r\n name: field.FIELDNAME,\r\n type: new basic_1.GenericObjectReferenceType()\r\n });\r\n }\r\n else {\r\n const lookup = ddic.lookupObject(field.ROLLNAME);\r\n components.push({ name: field.FIELDNAME, type: lookup.type });\r\n if (lookup.object) {\r\n references.push({ object: lookup.object });\r\n }\r\n }\r\n }\r\n else if (comptype === \"L\") {\r\n const lookup = ddic.lookupTableType(field.ROLLNAME);\r\n components.push({ name: field.FIELDNAME, type: lookup.type });\r\n if (lookup.object) {\r\n references.push({ object: lookup.object });\r\n }\r\n }\r\n else if (comptype === \"\") { // built in\r\n const datatype = field.DATATYPE;\r\n if (datatype === undefined) {\r\n throw new Error(\"Expected DATATYPE, while parsing TABL \" + this.getName());\r\n }\r\n const length = field.LENG ? field.LENG : field.INTLEN;\r\n components.push({\r\n name: field.FIELDNAME,\r\n type: ddic.textToType(datatype, length, field.DECIMALS, this.getName() + \"-\" + field.FIELDNAME)\r\n });\r\n }\r\n else {\r\n components.push({\r\n name: field.FIELDNAME,\r\n type: new Types.UnknownType(\"Table \" + this.getName() + \", unknown component type \\\"\" + comptype + \"\\\"\")\r\n });\r\n }\r\n }\r\n if (components.length === 0) {\r\n return new Types.UnknownType(\"Table/Structure \" + this.getName() + \" does not contain any components\");\r\n }\r\n reg.getDDICReferences().setUsing(this, references);\r\n return new Types.StructureType(components, this.getName());\r\n }\r\n getTableCategory() {\r\n var _a;\r\n if (this.parsedData === undefined) {\r\n this.parseXML();\r\n }\r\n return (_a = this.parsedData) === null || _a === void 0 ? void 0 : _a.tableCategory;\r\n }\r\n getEnhancementCategory() {\r\n var _a;\r\n if (this.parsedData === undefined) {\r\n this.parseXML();\r\n }\r\n if (((_a = this.parsedData) === null || _a === void 0 ? void 0 : _a.enhancementCategory) === undefined) {\r\n return EnhancementCategory.NotClassified;\r\n }\r\n return this.parsedData.enhancementCategory;\r\n }\r\n ///////////////\r\n parseXML() {\r\n var _a, _b, _c, _d, _e, _f, _g;\r\n const parsed = super.parseRaw2();\r\n if (parsed === undefined) {\r\n return;\r\n }\r\n this.parsedData = { fields: [] };\r\n if (parsed.abapGit === undefined) {\r\n return;\r\n }\r\n // enhancement category\r\n if (((_b = (_a = parsed.abapGit[\"asx:abap\"][\"asx:values\"]) === null || _a === void 0 ? void 0 : _a.DD02V) === null || _b === void 0 ? void 0 : _b.EXCLASS) === undefined) {\r\n this.parsedData.enhancementCategory = EnhancementCategory.NotClassified;\r\n }\r\n else {\r\n this.parsedData.enhancementCategory = (_d = (_c = parsed.abapGit[\"asx:abap\"][\"asx:values\"]) === null || _c === void 0 ? void 0 : _c.DD02V) === null || _d === void 0 ? void 0 : _d.EXCLASS;\r\n }\r\n // table category\r\n this.parsedData.tableCategory = (_f = (_e = parsed.abapGit[\"asx:abap\"][\"asx:values\"]) === null || _e === void 0 ? void 0 : _e.DD02V) === null || _f === void 0 ? void 0 : _f.TABCLASS;\r\n // fields\r\n const fields = (_g = parsed.abapGit[\"asx:abap\"][\"asx:values\"]) === null || _g === void 0 ? void 0 : _g.DD03P_TABLE;\r\n for (const field of (0, xml_utils_1.xmlToArray)(fields === null || fields === void 0 ? void 0 : fields.DD03P)) {\r\n this.parsedData.fields.push({\r\n FIELDNAME: field.FIELDNAME,\r\n ROLLNAME: field.ROLLNAME,\r\n COMPTYPE: field.COMPTYPE,\r\n PRECFIELD: field.PRECFIELD,\r\n LENG: field.LENG,\r\n INTLEN: field.INTLEN,\r\n DATATYPE: field.DATATYPE,\r\n DECIMALS: field.DECIMALS,\r\n KEYFLAG: field.KEYFLAG,\r\n GROUPNAME: field.GROUPNAME,\r\n });\r\n }\r\n }\r\n}\r\nexports.Table = Table;\r\n//# sourceMappingURL=table.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/objects/table.js?");
|
|
10953
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Table = exports.TableCategory = exports.EnhancementCategory = void 0;\r\nconst Types = __webpack_require__(/*! ../abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst _abstract_object_1 = __webpack_require__(/*! ./_abstract_object */ \"./node_modules/@abaplint/core/build/src/objects/_abstract_object.js\");\r\nconst xml_utils_1 = __webpack_require__(/*! ../xml_utils */ \"./node_modules/@abaplint/core/build/src/xml_utils.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nconst _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\r\nconst basic_1 = __webpack_require__(/*! ../abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nvar EnhancementCategory;\r\n(function (EnhancementCategory) {\r\n EnhancementCategory[\"NotClassified\"] = \"0\";\r\n EnhancementCategory[\"CannotBeEhanced\"] = \"1\";\r\n EnhancementCategory[\"Character\"] = \"2\";\r\n EnhancementCategory[\"CharacterOrNumeric\"] = \"3\";\r\n EnhancementCategory[\"Deep\"] = \"4\";\r\n})(EnhancementCategory = exports.EnhancementCategory || (exports.EnhancementCategory = {}));\r\nvar TableCategory;\r\n(function (TableCategory) {\r\n TableCategory[\"Transparent\"] = \"TRANSP\";\r\n TableCategory[\"Structure\"] = \"INTTAB\";\r\n TableCategory[\"Cluster\"] = \"CLUSTER\";\r\n TableCategory[\"Pooled\"] = \"POOL\";\r\n TableCategory[\"View\"] = \"VIEW\";\r\n TableCategory[\"Append\"] = \"APPEND\";\r\n})(TableCategory = exports.TableCategory || (exports.TableCategory = {}));\r\nclass Table extends _abstract_object_1.AbstractObject {\r\n getType() {\r\n return \"TABL\";\r\n }\r\n getDescription() {\r\n // todo\r\n return undefined;\r\n }\r\n getAllowedNaming() {\r\n return {\r\n maxLength: 30,\r\n allowNamespace: true,\r\n };\r\n }\r\n setDirty() {\r\n this.parsedData = undefined;\r\n super.setDirty();\r\n }\r\n listKeys() {\r\n if (this.parsedData === undefined) {\r\n this.parseXML();\r\n }\r\n if (this.parsedData === undefined) {\r\n return [];\r\n }\r\n const ret = [];\r\n for (const p of this.parsedData.fields) {\r\n if (p.KEYFLAG === \"X\") {\r\n ret.push(p.FIELDNAME);\r\n }\r\n }\r\n return ret;\r\n }\r\n parseType(reg) {\r\n var _a, _b;\r\n if (this.parsedData === undefined) {\r\n this.parseXML();\r\n if (this.parsedData === undefined) {\r\n return new Types.UnknownType(\"Table, parser error\");\r\n }\r\n }\r\n const references = [];\r\n const components = [];\r\n const ddic = new ddic_1.DDIC(reg);\r\n for (const field of this.parsedData.fields) {\r\n const comptype = field.COMPTYPE ? field.COMPTYPE : \"\";\r\n if (comptype === \"E\") { // data element\r\n const lookup = ddic.lookupDataElement(field.ROLLNAME);\r\n components.push({ name: field.FIELDNAME, type: lookup.type });\r\n if (lookup.object) {\r\n references.push({ object: lookup.object });\r\n }\r\n }\r\n else if (field.FIELDNAME === \".INCLUDE\" || field.FIELDNAME === \".INCLU--AP\") { // incude or append structure\r\n if (field.PRECFIELD === undefined) {\r\n return new Types.UnknownType(\"Table, parser error, PRECFIELD undefined\");\r\n }\r\n const lookup = ddic.lookupTableOrView(field.PRECFIELD);\r\n let found = lookup.type;\r\n if (lookup.object) {\r\n references.push({ object: lookup.object });\r\n }\r\n if (found instanceof _typed_identifier_1.TypedIdentifier) {\r\n found = found.getType();\r\n }\r\n if (found instanceof Types.StructureType) {\r\n if (field.GROUPNAME !== undefined) {\r\n components.push({ name: field.GROUPNAME, type: found });\r\n }\r\n for (const c of found.getComponents()) {\r\n components.push({ name: c.name, type: c.type });\r\n }\r\n }\r\n else if ((((_a = field.PRECFIELD) === null || _a === void 0 ? void 0 : _a.startsWith(\"CI_\")) || ((_b = field.PRECFIELD) === null || _b === void 0 ? void 0 : _b.startsWith(\"SI_\")))\r\n && found instanceof Types.UnknownType) {\r\n continue;\r\n }\r\n else if (found instanceof Types.UnknownType) {\r\n return found;\r\n }\r\n else if (found instanceof Types.VoidType) {\r\n // set the full structure to void\r\n return found;\r\n }\r\n else {\r\n components.push({ name: field.FIELDNAME, type: found });\r\n }\r\n }\r\n else if (comptype === \"S\" && field.FIELDNAME.startsWith(\".INCLU-\")) {\r\n const lookup = ddic.lookupTableOrView(field.ROLLNAME);\r\n if (lookup.object) {\r\n references.push({ object: lookup.object });\r\n }\r\n const found = lookup.type;\r\n if (found instanceof Types.VoidType) {\r\n // set the full structure to void\r\n return found;\r\n }\r\n else if (found instanceof Types.StructureType) {\r\n const suffix = field.FIELDNAME.split(\"-\")[1];\r\n for (const c of found.getComponents()) {\r\n components.push({ name: c.name + suffix, type: c.type });\r\n }\r\n }\r\n else if (found instanceof Types.UnknownType) {\r\n return found;\r\n }\r\n }\r\n else if (comptype === \"S\") {\r\n const lookup = ddic.lookupTableOrView(field.ROLLNAME);\r\n components.push({ name: field.FIELDNAME, type: lookup.type });\r\n if (lookup.object) {\r\n references.push({ object: lookup.object });\r\n }\r\n }\r\n else if (comptype === \"R\") {\r\n if (field.ROLLNAME === undefined) {\r\n throw new Error(\"Expected ROLLNAME\");\r\n }\r\n if (field.ROLLNAME === \"DATA\") {\r\n components.push({\r\n name: field.FIELDNAME,\r\n type: new basic_1.DataReference(new basic_1.AnyType())\r\n });\r\n }\r\n else if (field.ROLLNAME === \"OBJECT\") {\r\n components.push({\r\n name: field.FIELDNAME,\r\n type: new basic_1.GenericObjectReferenceType()\r\n });\r\n }\r\n else {\r\n const lookup = ddic.lookupObject(field.ROLLNAME);\r\n components.push({ name: field.FIELDNAME, type: lookup.type });\r\n if (lookup.object) {\r\n references.push({ object: lookup.object });\r\n }\r\n }\r\n }\r\n else if (comptype === \"L\") {\r\n const lookup = ddic.lookupTableType(field.ROLLNAME);\r\n components.push({ name: field.FIELDNAME, type: lookup.type });\r\n if (lookup.object) {\r\n references.push({ object: lookup.object });\r\n }\r\n }\r\n else if (comptype === \"\") { // built in\r\n const datatype = field.DATATYPE;\r\n if (datatype === undefined) {\r\n throw new Error(\"Expected DATATYPE, while parsing TABL \" + this.getName());\r\n }\r\n const length = field.LENG ? field.LENG : field.INTLEN;\r\n components.push({\r\n name: field.FIELDNAME,\r\n type: ddic.textToType(datatype, length, field.DECIMALS, this.getName() + \"-\" + field.FIELDNAME)\r\n });\r\n }\r\n else {\r\n components.push({\r\n name: field.FIELDNAME,\r\n type: new Types.UnknownType(\"Table \" + this.getName() + \", unknown component type \\\"\" + comptype + \"\\\"\")\r\n });\r\n }\r\n }\r\n if (components.length === 0) {\r\n return new Types.UnknownType(\"Table/Structure \" + this.getName() + \" does not contain any components\");\r\n }\r\n reg.getDDICReferences().setUsing(this, references);\r\n return new Types.StructureType(components, this.getName());\r\n }\r\n getTableCategory() {\r\n var _a;\r\n if (this.parsedData === undefined) {\r\n this.parseXML();\r\n }\r\n return (_a = this.parsedData) === null || _a === void 0 ? void 0 : _a.tableCategory;\r\n }\r\n getEnhancementCategory() {\r\n var _a;\r\n if (this.parsedData === undefined) {\r\n this.parseXML();\r\n }\r\n if (((_a = this.parsedData) === null || _a === void 0 ? void 0 : _a.enhancementCategory) === undefined) {\r\n return EnhancementCategory.NotClassified;\r\n }\r\n return this.parsedData.enhancementCategory;\r\n }\r\n ///////////////\r\n parseXML() {\r\n var _a, _b, _c, _d, _e, _f, _g;\r\n const parsed = super.parseRaw2();\r\n if (parsed === undefined) {\r\n return;\r\n }\r\n this.parsedData = { fields: [] };\r\n if (parsed.abapGit === undefined) {\r\n return;\r\n }\r\n // enhancement category\r\n if (((_b = (_a = parsed.abapGit[\"asx:abap\"][\"asx:values\"]) === null || _a === void 0 ? void 0 : _a.DD02V) === null || _b === void 0 ? void 0 : _b.EXCLASS) === undefined) {\r\n this.parsedData.enhancementCategory = EnhancementCategory.NotClassified;\r\n }\r\n else {\r\n this.parsedData.enhancementCategory = (_d = (_c = parsed.abapGit[\"asx:abap\"][\"asx:values\"]) === null || _c === void 0 ? void 0 : _c.DD02V) === null || _d === void 0 ? void 0 : _d.EXCLASS;\r\n }\r\n // table category\r\n this.parsedData.tableCategory = (_f = (_e = parsed.abapGit[\"asx:abap\"][\"asx:values\"]) === null || _e === void 0 ? void 0 : _e.DD02V) === null || _f === void 0 ? void 0 : _f.TABCLASS;\r\n // fields\r\n const fields = (_g = parsed.abapGit[\"asx:abap\"][\"asx:values\"]) === null || _g === void 0 ? void 0 : _g.DD03P_TABLE;\r\n for (const field of (0, xml_utils_1.xmlToArray)(fields === null || fields === void 0 ? void 0 : fields.DD03P)) {\r\n this.parsedData.fields.push({\r\n FIELDNAME: field.FIELDNAME,\r\n ROLLNAME: field.ROLLNAME,\r\n COMPTYPE: field.COMPTYPE,\r\n PRECFIELD: field.PRECFIELD,\r\n LENG: field.LENG,\r\n INTLEN: field.INTLEN,\r\n DATATYPE: field.DATATYPE,\r\n DECIMALS: field.DECIMALS,\r\n KEYFLAG: field.KEYFLAG,\r\n GROUPNAME: field.GROUPNAME,\r\n });\r\n }\r\n }\r\n}\r\nexports.Table = Table;\r\n//# sourceMappingURL=table.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/objects/table.js?");
|
|
10954
10954
|
|
|
10955
10955
|
/***/ }),
|
|
10956
10956
|
|
|
@@ -11170,7 +11170,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11170
11170
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11171
11171
|
|
|
11172
11172
|
"use strict";
|
|
11173
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Registry = void 0;\nconst config_1 = __webpack_require__(/*! ./config */ \"./node_modules/@abaplint/core/build/src/config.js\");\nconst artifacts_objects_1 = __webpack_require__(/*! ./artifacts_objects */ \"./node_modules/@abaplint/core/build/src/artifacts_objects.js\");\nconst artifacts_rules_1 = __webpack_require__(/*! ./artifacts_rules */ \"./node_modules/@abaplint/core/build/src/artifacts_rules.js\");\nconst skip_logic_1 = __webpack_require__(/*! ./skip_logic */ \"./node_modules/@abaplint/core/build/src/skip_logic.js\");\nconst _abap_object_1 = __webpack_require__(/*! ./objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\nconst find_global_definitions_1 = __webpack_require__(/*! ./abap/5_syntax/global_definitions/find_global_definitions */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/global_definitions/find_global_definitions.js\");\nconst syntax_1 = __webpack_require__(/*! ./abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\nconst excludeHelper_1 = __webpack_require__(/*! ./utils/excludeHelper */ \"./node_modules/@abaplint/core/build/src/utils/excludeHelper.js\");\nconst ddic_references_1 = __webpack_require__(/*! ./ddic_references */ \"./node_modules/@abaplint/core/build/src/ddic_references.js\");\n// todo, this should really be an instance in case there are multiple Registry'ies\nclass ParsingPerformance {\n static clear() {\n this.results = [];\n this.lexing = 0;\n this.statements = 0;\n this.structure = 0;\n }\n static push(obj, result) {\n if (result.runtimeExtra) {\n this.lexing += result.runtimeExtra.lexing;\n this.statements += result.runtimeExtra.statements;\n this.structure += result.runtimeExtra.structure;\n }\n if (result.runtime < 100) {\n return;\n }\n if (this.results === undefined) {\n this.results = [];\n }\n let extra = \"\";\n if (result.runtimeExtra) {\n extra = `\\t(lexing: ${result.runtimeExtra.lexing}ms, statements: ${result.runtimeExtra.statements}ms, structure: ${result.runtimeExtra.structure}ms)`;\n }\n this.results.push({\n runtime: result.runtime,\n extra,\n name: obj.getType() + \" \" + obj.getName(),\n });\n }\n static output() {\n const MAX = 10;\n this.results.sort((a, b) => { return b.runtime - a.runtime; });\n for (let i = 0; i < MAX; i++) {\n const row = this.results[i];\n if (row === undefined) {\n break;\n }\n process.stderr.write(`\\t${row.runtime}ms\\t${row.name} ${row.extra}\\n`);\n }\n process.stderr.write(`\\tTotal lexing: ${this.lexing}ms\\n`);\n process.stderr.write(`\\tTotal statements: ${this.statements}ms\\n`);\n process.stderr.write(`\\tTotal structure: ${this.structure}ms\\n`);\n }\n}\n///////////////////////////////////////////////////////////////////////////////////////////////\nclass Registry {\n constructor(conf) {\n this.objects = {};\n this.objectsByType = {};\n /** object containing filenames of dependencies */\n this.dependencies = {};\n this.issues = [];\n this.conf = conf ? conf : config_1.Config.getDefault();\n this.references = new ddic_references_1.DDICReferences();\n }\n static abaplintVersion() {\n // magic, see build script \"version.sh\"\n return \"2.84.11\";\n }\n getDDICReferences() {\n return this.references;\n }\n *getObjects() {\n for (const name in this.objects) {\n for (const type in this.objects[name]) {\n yield this.objects[name][type];\n }\n }\n }\n *getObjectsByType(type) {\n for (const name in this.objectsByType[type] || []) {\n yield this.objectsByType[type][name];\n }\n }\n *getFiles() {\n for (const obj of this.getObjects()) {\n for (const file of obj.getFiles()) {\n yield file;\n }\n }\n }\n getFirstObject() {\n for (const name in this.objects) {\n for (const type in this.objects[name]) {\n return this.objects[name][type];\n }\n }\n return undefined;\n }\n getObjectCount(skipDependencies = true) {\n let res = 0;\n for (const o of this.getObjects()) {\n if (skipDependencies === true && this.isDependency(o)) {\n continue;\n }\n res = res + 1;\n }\n return res;\n }\n getFileByName(filename) {\n const upper = filename.toUpperCase();\n for (const o of this.getObjects()) {\n for (const f of o.getFiles()) {\n if (f.getFilename().toUpperCase() === upper) {\n return f;\n }\n }\n }\n return undefined;\n }\n getObject(type, name) {\n if (type === undefined || name === undefined) {\n return undefined;\n }\n const searchName = name.toUpperCase();\n if (this.objects[searchName]) {\n return this.objects[searchName][type];\n }\n return undefined;\n }\n getConfig() {\n return this.conf;\n }\n // assumption: Config is immutable, and can only be changed via this method\n setConfig(conf) {\n for (const obj of this.getObjects()) {\n obj.setDirty();\n }\n this.conf = conf;\n return this;\n }\n inErrorNamespace(name) {\n const reg = new RegExp(this.getConfig().getSyntaxSetttings().errorNamespace, \"i\");\n return reg.test(name);\n }\n addFile(file) {\n return this.addFiles([file]);\n }\n updateFile(file) {\n const obj = this.find(file.getObjectName(), file.getObjectType());\n obj.updateFile(file);\n return this;\n }\n removeFile(file) {\n const obj = this.find(file.getObjectName(), file.getObjectType());\n obj.removeFile(file);\n if (obj.getFiles().length === 0) {\n this.references.clear(obj);\n this.removeObject(obj);\n }\n return this;\n }\n addFiles(files) {\n var _a;\n const globalExclude = ((_a = this.conf.getGlobal().exclude) !== null && _a !== void 0 ? _a : [])\n .map(pattern => new RegExp(pattern, \"i\"));\n for (const f of files) {\n const filename = f.getFilename();\n const isNotAbapgitFile = filename.split(\".\").length <= 2;\n if (isNotAbapgitFile || excludeHelper_1.ExcludeHelper.isExcluded(filename, globalExclude)) {\n continue;\n }\n const found = this.findOrCreate(f.getObjectName(), f.getObjectType());\n found.addFile(f);\n }\n return this;\n }\n addDependencies(files) {\n for (const f of files) {\n this.dependencies[f.getFilename().toUpperCase()] = true;\n }\n return this.addFiles(files);\n }\n addDependency(file) {\n this.dependencies[file.getFilename().toUpperCase()] = true;\n this.addFile(file);\n return this;\n }\n isDependency(obj) {\n const filename = obj.getFiles()[0].getFilename().toUpperCase();\n return this.dependencies[filename] === true;\n }\n isFileDependency(filename) {\n return this.dependencies[filename.toUpperCase()] === true;\n }\n // assumption: the file is already in the registry\n findObjectForFile(file) {\n const filename = file.getFilename();\n for (const obj of this.getObjects()) {\n for (const ofile of obj.getFiles()) {\n if (ofile.getFilename() === filename) {\n return obj;\n }\n }\n }\n return undefined;\n }\n // todo, this will be changed to async sometime\n findIssues(input) {\n if (this.isDirty() === true) {\n this.parse();\n }\n return this.runRules(input);\n }\n // todo, this will be changed to async sometime\n findIssuesObject(iobj) {\n if (this.isDirty() === true) {\n this.parse();\n }\n return this.runRules(undefined, iobj);\n }\n // todo, this will be changed to async sometime\n parse() {\n if (this.isDirty() === false) {\n return this;\n }\n ParsingPerformance.clear();\n this.issues = [];\n for (const o of this.getObjects()) {\n this.parsePrivate(o);\n this.issues.push(...o.getParsingIssues());\n }\n new find_global_definitions_1.FindGlobalDefinitions(this).run();\n return this;\n }\n async parseAsync(input) {\n var _a, _b;\n if (this.isDirty() === false) {\n return this;\n }\n ParsingPerformance.clear();\n (_a = input === null || input === void 0 ? void 0 : input.progress) === null || _a === void 0 ? void 0 : _a.set(this.getObjectCount(false), \"Lexing and parsing\");\n this.issues = [];\n for (const o of this.getObjects()) {\n await ((_b = input === null || input === void 0 ? void 0 : input.progress) === null || _b === void 0 ? void 0 : _b.tick(\"Lexing and parsing(\" + this.conf.getVersion() + \") - \" + o.getType() + \" \" + o.getName()));\n this.parsePrivate(o);\n this.issues.push(...o.getParsingIssues());\n }\n if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {\n ParsingPerformance.output();\n }\n new find_global_definitions_1.FindGlobalDefinitions(this).run(input === null || input === void 0 ? void 0 : input.progress);\n return this;\n }\n //////////////////////////////////////////\n // todo, refactor, this is a mess, see where-used, a lot of the code should be in this method instead\n parsePrivate(input) {\n const config = this.getConfig();\n const result = input.parse(config.getVersion(), config.getSyntaxSetttings().globalMacros);\n ParsingPerformance.push(input, result);\n }\n isDirty() {\n for (const o of this.getObjects()) {\n const dirty = o.isDirty();\n if (dirty === true) {\n return true;\n }\n }\n return false;\n }\n runRules(input, iobj) {\n var _a, _b, _c, _d, _e, _f;\n const rulePerformance = {};\n const issues = this.issues.slice(0);\n const objects = iobj ? [iobj] : this.getObjects();\n const rules = this.conf.getEnabledRules();\n const skipLogic = new skip_logic_1.SkipLogic(this);\n (_a = input === null || input === void 0 ? void 0 : input.progress) === null || _a === void 0 ? void 0 : _a.set(iobj ? 1 : this.getObjectCount(false), \"Run Syntax\");\n const check = [];\n for (const obj of objects) {\n (_b = input === null || input === void 0 ? void 0 : input.progress) === null || _b === void 0 ? void 0 : _b.tick(\"Run Syntax - \" + obj.getName());\n if (skipLogic.skip(obj) || this.isDependency(obj)) {\n continue;\n }\n if (obj instanceof _abap_object_1.ABAPObject) {\n new syntax_1.SyntaxLogic(this, obj).run();\n }\n check.push(obj);\n }\n (_c = input === null || input === void 0 ? void 0 : input.progress) === null || _c === void 0 ? void 0 : _c.set(rules.length, \"Initialize Rules\");\n for (const rule of rules) {\n (_d = input === null || input === void 0 ? void 0 : input.progress) === null || _d === void 0 ? void 0 : _d.tick(\"Initialize Rules - \" + rule.getMetadata().key);\n if (rule.initialize === undefined) {\n throw new Error(rule.getMetadata().key + \" missing initialize method\");\n }\n rule.initialize(this);\n rulePerformance[rule.getMetadata().key] = 0;\n }\n (_e = input === null || input === void 0 ? void 0 : input.progress) === null || _e === void 0 ? void 0 : _e.set(check.length, \"Finding Issues\");\n for (const obj of check) {\n (_f = input === null || input === void 0 ? void 0 : input.progress) === null || _f === void 0 ? void 0 : _f.tick(\"Finding Issues - \" + obj.getType() + \" \" + obj.getName());\n for (const rule of rules) {\n const before = Date.now();\n issues.push(...rule.run(obj));\n const runtime = Date.now() - before;\n rulePerformance[rule.getMetadata().key] = rulePerformance[rule.getMetadata().key] + runtime;\n }\n }\n if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {\n const perf = [];\n for (const p in rulePerformance) {\n if (rulePerformance[p] > 100) { // ignore rules if it takes less than 100ms\n perf.push({ name: p, time: rulePerformance[p] });\n }\n }\n perf.sort((a, b) => { return b.time - a.time; });\n for (const p of perf) {\n process.stderr.write(\"\\t\" + p.time + \"ms\\t\" + p.name + \"\\n\");\n }\n }\n return this.excludeIssues(issues);\n }\n excludeIssues(issues) {\n var _a;\n const ret = issues;\n const globalNoIssues = this.conf.getGlobal().noIssues || [];\n const globalNoIssuesPatterns = globalNoIssues.map(x => new RegExp(x, \"i\"));\n if (globalNoIssuesPatterns.length > 0) {\n for (let i = ret.length - 1; i >= 0; i--) {\n const filename = ret[i].getFilename();\n if (excludeHelper_1.ExcludeHelper.isExcluded(filename, globalNoIssuesPatterns)) {\n ret.splice(i, 1);\n }\n }\n }\n // exclude issues, as now we know both the filename and issue key\n for (const rule of artifacts_rules_1.ArtifactsRules.getRules()) {\n const key = rule.getMetadata().key;\n const ruleExclude = (_a = this.conf.readByKey(key, \"exclude\")) !== null && _a !== void 0 ? _a : [];\n if (ruleExclude.length === 0) {\n continue;\n }\n const ruleExcludePatterns = ruleExclude.map(x => new RegExp(x, \"i\"));\n for (let i = ret.length - 1; i >= 0; i--) {\n if (ret[i].getKey() !== key) {\n continue;\n }\n const filename = ret[i].getFilename();\n if (excludeHelper_1.ExcludeHelper.isExcluded(filename, ruleExcludePatterns)) {\n ret.splice(i, 1);\n }\n }\n }\n return ret;\n }\n findOrCreate(name, type) {\n try {\n return this.find(name, type);\n }\n catch (_a) {\n const newName = name.toUpperCase();\n const newType = type ? type : \"UNKNOWN\";\n const add = artifacts_objects_1.ArtifactsObjects.newObject(newName, newType);\n if (this.objects[newName] === undefined) {\n this.objects[newName] = {};\n }\n this.objects[newName][newType] = add;\n if (this.objectsByType[newType] === undefined) {\n this.objectsByType[newType] = {};\n }\n this.objectsByType[newType][newName] = add;\n return add;\n }\n }\n removeObject(remove) {\n if (remove === undefined) {\n return;\n }\n if (this.objects[remove.getName()][remove.getType()] === undefined) {\n throw new Error(\"removeObject: object not found\");\n }\n if (Object.keys(this.objects[remove.getName()]).length === 1) {\n delete this.objects[remove.getName()];\n }\n else {\n delete this.objects[remove.getName()][remove.getType()];\n }\n if (Object.keys(this.objectsByType[remove.getType()]).length === 1) {\n delete this.objectsByType[remove.getType()];\n }\n else {\n delete this.objectsByType[remove.getType()][remove.getName()];\n }\n }\n find(name, type) {\n const searchType = type ? type : \"UNKNOWN\";\n const searchName = name.toUpperCase();\n if (this.objects[searchName] !== undefined\n && this.objects[searchName][searchType]) {\n return this.objects[searchName][searchType];\n }\n throw new Error(\"find: object not found, \" + type + \" \" + name);\n }\n}\nexports.Registry = Registry;\n//# sourceMappingURL=registry.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/registry.js?");
|
|
11173
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Registry = void 0;\nconst config_1 = __webpack_require__(/*! ./config */ \"./node_modules/@abaplint/core/build/src/config.js\");\nconst artifacts_objects_1 = __webpack_require__(/*! ./artifacts_objects */ \"./node_modules/@abaplint/core/build/src/artifacts_objects.js\");\nconst artifacts_rules_1 = __webpack_require__(/*! ./artifacts_rules */ \"./node_modules/@abaplint/core/build/src/artifacts_rules.js\");\nconst skip_logic_1 = __webpack_require__(/*! ./skip_logic */ \"./node_modules/@abaplint/core/build/src/skip_logic.js\");\nconst _abap_object_1 = __webpack_require__(/*! ./objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\nconst find_global_definitions_1 = __webpack_require__(/*! ./abap/5_syntax/global_definitions/find_global_definitions */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/global_definitions/find_global_definitions.js\");\nconst syntax_1 = __webpack_require__(/*! ./abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\nconst excludeHelper_1 = __webpack_require__(/*! ./utils/excludeHelper */ \"./node_modules/@abaplint/core/build/src/utils/excludeHelper.js\");\nconst ddic_references_1 = __webpack_require__(/*! ./ddic_references */ \"./node_modules/@abaplint/core/build/src/ddic_references.js\");\n// todo, this should really be an instance in case there are multiple Registry'ies\nclass ParsingPerformance {\n static clear() {\n this.results = [];\n this.lexing = 0;\n this.statements = 0;\n this.structure = 0;\n }\n static push(obj, result) {\n if (result.runtimeExtra) {\n this.lexing += result.runtimeExtra.lexing;\n this.statements += result.runtimeExtra.statements;\n this.structure += result.runtimeExtra.structure;\n }\n if (result.runtime < 100) {\n return;\n }\n if (this.results === undefined) {\n this.results = [];\n }\n let extra = \"\";\n if (result.runtimeExtra) {\n extra = `\\t(lexing: ${result.runtimeExtra.lexing}ms, statements: ${result.runtimeExtra.statements}ms, structure: ${result.runtimeExtra.structure}ms)`;\n }\n this.results.push({\n runtime: result.runtime,\n extra,\n name: obj.getType() + \" \" + obj.getName(),\n });\n }\n static output() {\n const MAX = 10;\n this.results.sort((a, b) => { return b.runtime - a.runtime; });\n for (let i = 0; i < MAX; i++) {\n const row = this.results[i];\n if (row === undefined) {\n break;\n }\n process.stderr.write(`\\t${row.runtime}ms\\t${row.name} ${row.extra}\\n`);\n }\n process.stderr.write(`\\tTotal lexing: ${this.lexing}ms\\n`);\n process.stderr.write(`\\tTotal statements: ${this.statements}ms\\n`);\n process.stderr.write(`\\tTotal structure: ${this.structure}ms\\n`);\n }\n}\n///////////////////////////////////////////////////////////////////////////////////////////////\nclass Registry {\n constructor(conf) {\n this.objects = {};\n this.objectsByType = {};\n /** object containing filenames of dependencies */\n this.dependencies = {};\n this.issues = [];\n this.conf = conf ? conf : config_1.Config.getDefault();\n this.references = new ddic_references_1.DDICReferences();\n }\n static abaplintVersion() {\n // magic, see build script \"version.sh\"\n return \"2.85.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 const reg = new RegExp(this.getConfig().getSyntaxSetttings().errorNamespace, \"i\");\n return reg.test(name);\n }\n addFile(file) {\n return this.addFiles([file]);\n }\n updateFile(file) {\n const obj = this.find(file.getObjectName(), file.getObjectType());\n obj.updateFile(file);\n return this;\n }\n removeFile(file) {\n const obj = this.find(file.getObjectName(), file.getObjectType());\n obj.removeFile(file);\n if (obj.getFiles().length === 0) {\n this.references.clear(obj);\n this.removeObject(obj);\n }\n return this;\n }\n addFiles(files) {\n var _a;\n const globalExclude = ((_a = this.conf.getGlobal().exclude) !== null && _a !== void 0 ? _a : [])\n .map(pattern => new RegExp(pattern, \"i\"));\n for (const f of files) {\n const filename = f.getFilename();\n const isNotAbapgitFile = filename.split(\".\").length <= 2;\n if (isNotAbapgitFile || excludeHelper_1.ExcludeHelper.isExcluded(filename, globalExclude)) {\n continue;\n }\n const found = this.findOrCreate(f.getObjectName(), f.getObjectType());\n found.addFile(f);\n }\n return this;\n }\n addDependencies(files) {\n for (const f of files) {\n this.dependencies[f.getFilename().toUpperCase()] = true;\n }\n return this.addFiles(files);\n }\n addDependency(file) {\n this.dependencies[file.getFilename().toUpperCase()] = true;\n this.addFile(file);\n return this;\n }\n isDependency(obj) {\n const filename = obj.getFiles()[0].getFilename().toUpperCase();\n return this.dependencies[filename] === true;\n }\n isFileDependency(filename) {\n return this.dependencies[filename.toUpperCase()] === true;\n }\n // assumption: the file is already in the registry\n findObjectForFile(file) {\n const filename = file.getFilename();\n for (const obj of this.getObjects()) {\n for (const ofile of obj.getFiles()) {\n if (ofile.getFilename() === filename) {\n return obj;\n }\n }\n }\n return undefined;\n }\n // todo, this will be changed to async sometime\n findIssues(input) {\n if (this.isDirty() === true) {\n this.parse();\n }\n return this.runRules(input);\n }\n // todo, this will be changed to async sometime\n findIssuesObject(iobj) {\n if (this.isDirty() === true) {\n this.parse();\n }\n return this.runRules(undefined, iobj);\n }\n // todo, this will be changed to async sometime\n parse() {\n if (this.isDirty() === false) {\n return this;\n }\n ParsingPerformance.clear();\n this.issues = [];\n for (const o of this.getObjects()) {\n this.parsePrivate(o);\n this.issues.push(...o.getParsingIssues());\n }\n new find_global_definitions_1.FindGlobalDefinitions(this).run();\n return this;\n }\n async parseAsync(input) {\n var _a, _b;\n if (this.isDirty() === false) {\n return this;\n }\n ParsingPerformance.clear();\n (_a = input === null || input === void 0 ? void 0 : input.progress) === null || _a === void 0 ? void 0 : _a.set(this.getObjectCount(false), \"Lexing and parsing\");\n this.issues = [];\n for (const o of this.getObjects()) {\n await ((_b = input === null || input === void 0 ? void 0 : input.progress) === null || _b === void 0 ? void 0 : _b.tick(\"Lexing and parsing(\" + this.conf.getVersion() + \") - \" + o.getType() + \" \" + o.getName()));\n this.parsePrivate(o);\n this.issues.push(...o.getParsingIssues());\n }\n if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {\n ParsingPerformance.output();\n }\n new find_global_definitions_1.FindGlobalDefinitions(this).run(input === null || input === void 0 ? void 0 : input.progress);\n return this;\n }\n //////////////////////////////////////////\n // todo, refactor, this is a mess, see where-used, a lot of the code should be in this method instead\n parsePrivate(input) {\n const config = this.getConfig();\n const result = input.parse(config.getVersion(), config.getSyntaxSetttings().globalMacros, this);\n ParsingPerformance.push(input, result);\n }\n isDirty() {\n for (const o of this.getObjects()) {\n const dirty = o.isDirty();\n if (dirty === true) {\n return true;\n }\n }\n return false;\n }\n runRules(input, iobj) {\n var _a, _b, _c, _d, _e, _f;\n const rulePerformance = {};\n const issues = this.issues.slice(0);\n const objects = iobj ? [iobj] : this.getObjects();\n const rules = this.conf.getEnabledRules();\n const skipLogic = new skip_logic_1.SkipLogic(this);\n (_a = input === null || input === void 0 ? void 0 : input.progress) === null || _a === void 0 ? void 0 : _a.set(iobj ? 1 : this.getObjectCount(false), \"Run Syntax\");\n const check = [];\n for (const obj of objects) {\n (_b = input === null || input === void 0 ? void 0 : input.progress) === null || _b === void 0 ? void 0 : _b.tick(\"Run Syntax - \" + obj.getName());\n if (skipLogic.skip(obj) || this.isDependency(obj)) {\n continue;\n }\n if (obj instanceof _abap_object_1.ABAPObject) {\n new syntax_1.SyntaxLogic(this, obj).run();\n }\n check.push(obj);\n }\n (_c = input === null || input === void 0 ? void 0 : input.progress) === null || _c === void 0 ? void 0 : _c.set(rules.length, \"Initialize Rules\");\n for (const rule of rules) {\n (_d = input === null || input === void 0 ? void 0 : input.progress) === null || _d === void 0 ? void 0 : _d.tick(\"Initialize Rules - \" + rule.getMetadata().key);\n if (rule.initialize === undefined) {\n throw new Error(rule.getMetadata().key + \" missing initialize method\");\n }\n rule.initialize(this);\n rulePerformance[rule.getMetadata().key] = 0;\n }\n (_e = input === null || input === void 0 ? void 0 : input.progress) === null || _e === void 0 ? void 0 : _e.set(check.length, \"Finding Issues\");\n for (const obj of check) {\n (_f = input === null || input === void 0 ? void 0 : input.progress) === null || _f === void 0 ? void 0 : _f.tick(\"Finding Issues - \" + obj.getType() + \" \" + obj.getName());\n for (const rule of rules) {\n const before = Date.now();\n issues.push(...rule.run(obj));\n const runtime = Date.now() - before;\n rulePerformance[rule.getMetadata().key] = rulePerformance[rule.getMetadata().key] + runtime;\n }\n }\n if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {\n const perf = [];\n for (const p in rulePerformance) {\n if (rulePerformance[p] > 100) { // ignore rules if it takes less than 100ms\n perf.push({ name: p, time: rulePerformance[p] });\n }\n }\n perf.sort((a, b) => { return b.time - a.time; });\n for (const p of perf) {\n process.stderr.write(\"\\t\" + p.time + \"ms\\t\" + p.name + \"\\n\");\n }\n }\n return this.excludeIssues(issues);\n }\n excludeIssues(issues) {\n var _a;\n const ret = issues;\n const globalNoIssues = this.conf.getGlobal().noIssues || [];\n const globalNoIssuesPatterns = globalNoIssues.map(x => new RegExp(x, \"i\"));\n if (globalNoIssuesPatterns.length > 0) {\n for (let i = ret.length - 1; i >= 0; i--) {\n const filename = ret[i].getFilename();\n if (excludeHelper_1.ExcludeHelper.isExcluded(filename, globalNoIssuesPatterns)) {\n ret.splice(i, 1);\n }\n }\n }\n // exclude issues, as now we know both the filename and issue key\n for (const rule of artifacts_rules_1.ArtifactsRules.getRules()) {\n const key = rule.getMetadata().key;\n const ruleExclude = (_a = this.conf.readByKey(key, \"exclude\")) !== null && _a !== void 0 ? _a : [];\n if (ruleExclude.length === 0) {\n continue;\n }\n const ruleExcludePatterns = ruleExclude.map(x => new RegExp(x, \"i\"));\n for (let i = ret.length - 1; i >= 0; i--) {\n if (ret[i].getKey() !== key) {\n continue;\n }\n const filename = ret[i].getFilename();\n if (excludeHelper_1.ExcludeHelper.isExcluded(filename, ruleExcludePatterns)) {\n ret.splice(i, 1);\n }\n }\n }\n return ret;\n }\n findOrCreate(name, type) {\n try {\n return this.find(name, type);\n }\n catch (_a) {\n const newName = name.toUpperCase();\n const newType = type ? type : \"UNKNOWN\";\n const add = artifacts_objects_1.ArtifactsObjects.newObject(newName, newType);\n if (this.objects[newName] === undefined) {\n this.objects[newName] = {};\n }\n this.objects[newName][newType] = add;\n if (this.objectsByType[newType] === undefined) {\n this.objectsByType[newType] = {};\n }\n this.objectsByType[newType][newName] = add;\n return add;\n }\n }\n removeObject(remove) {\n if (remove === undefined) {\n return;\n }\n if (this.objects[remove.getName()][remove.getType()] === undefined) {\n throw new Error(\"removeObject: object not found\");\n }\n if (Object.keys(this.objects[remove.getName()]).length === 1) {\n delete this.objects[remove.getName()];\n }\n else {\n delete this.objects[remove.getName()][remove.getType()];\n }\n if (Object.keys(this.objectsByType[remove.getType()]).length === 1) {\n delete this.objectsByType[remove.getType()];\n }\n else {\n delete this.objectsByType[remove.getType()][remove.getName()];\n }\n }\n find(name, type) {\n const searchType = type ? type : \"UNKNOWN\";\n const searchName = name.toUpperCase();\n if (this.objects[searchName] !== undefined\n && this.objects[searchName][searchType]) {\n return this.objects[searchName][searchType];\n }\n throw new Error(\"find: object not found, \" + type + \" \" + name);\n }\n}\nexports.Registry = Registry;\n//# sourceMappingURL=registry.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/registry.js?");
|
|
11174
11174
|
|
|
11175
11175
|
/***/ }),
|
|
11176
11176
|
|
|
@@ -11181,7 +11181,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
11181
11181
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11182
11182
|
|
|
11183
11183
|
"use strict";
|
|
11184
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SevenBitAscii = exports.SevenBitAsciiConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass SevenBitAsciiConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.SevenBitAsciiConf = SevenBitAsciiConf;\r\nclass SevenBitAscii {\r\n constructor() {\r\n this.conf = new SevenBitAsciiConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"7bit_ascii\",\r\n title: \"Check for 7bit ascii\",\r\n shortDescription: `Only allow characters from the 7bit ASCII set.`,\r\n extendedInformation: `https://docs.abapopenchecks.org/checks/05/\n\nCheckes files with extension \".abap\" and \".asddls\"`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n initialize(_reg) {\r\n return this;\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n run(obj) {\r\n const output = [];\r\n for (const file of obj.getFiles()) {\r\n const filename = file.getFilename();\r\n if (filename.endsWith(\".abap\") || filename.endsWith(\".asddls\")) {\r\n const rows = file.getRawRows();\r\n for (let i = 0; i < rows.length; i++) {\r\n const found = /[\\u007f-\\uffff]/.exec(rows[i]);\r\n if (found !== null) {\r\n const column = found.index + 1;\r\n const start = new position_1.Position(i + 1, column);\r\n const end = new position_1.Position(i + 1, column + 1);\r\n const message = \"Contains non 7 bit ascii character\";\r\n const issue = issue_1.Issue.atRange(file, start, end, message, this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n // method getRawRows() splits by newline, so the carraige return\r\n // should always be last character if present\r\n const carriage = /\\r.+$/.exec(rows[i]);\r\n if (carriage !== null) {\r\n const column = carriage.index + 1;\r\n const start = new position_1.Position(i + 1, column);\r\n const end = new position_1.Position(i + 1, column + 1);\r\n const message = \"Dangling carriage return\";\r\n const issue = issue_1.Issue.atRange(file, start, end, message, this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n }\r\n }\r\n }\r\n return output;\r\n }\r\n}\r\nexports.SevenBitAscii = SevenBitAscii;\r\n//# sourceMappingURL=7bit_ascii.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/7bit_ascii.js?");
|
|
11184
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SevenBitAscii = exports.SevenBitAsciiConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass SevenBitAsciiConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.SevenBitAsciiConf = SevenBitAsciiConf;\r\nclass SevenBitAscii {\r\n constructor() {\r\n this.conf = new SevenBitAsciiConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"7bit_ascii\",\r\n title: \"Check for 7bit ascii\",\r\n shortDescription: `Only allow characters from the 7bit ASCII set.`,\r\n extendedInformation: `https://docs.abapopenchecks.org/checks/05/\r\n\r\nCheckes files with extension \".abap\" and \".asddls\"`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n initialize(_reg) {\r\n return this;\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n run(obj) {\r\n const output = [];\r\n for (const file of obj.getFiles()) {\r\n const filename = file.getFilename();\r\n if (filename.endsWith(\".abap\") || filename.endsWith(\".asddls\")) {\r\n const rows = file.getRawRows();\r\n for (let i = 0; i < rows.length; i++) {\r\n const found = /[\\u007f-\\uffff]/.exec(rows[i]);\r\n if (found !== null) {\r\n const column = found.index + 1;\r\n const start = new position_1.Position(i + 1, column);\r\n const end = new position_1.Position(i + 1, column + 1);\r\n const message = \"Contains non 7 bit ascii character\";\r\n const issue = issue_1.Issue.atRange(file, start, end, message, this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n // method getRawRows() splits by newline, so the carraige return\r\n // should always be last character if present\r\n const carriage = /\\r.+$/.exec(rows[i]);\r\n if (carriage !== null) {\r\n const column = carriage.index + 1;\r\n const start = new position_1.Position(i + 1, column);\r\n const end = new position_1.Position(i + 1, column + 1);\r\n const message = \"Dangling carriage return\";\r\n const issue = issue_1.Issue.atRange(file, start, end, message, this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n }\r\n }\r\n }\r\n return output;\r\n }\r\n}\r\nexports.SevenBitAscii = SevenBitAscii;\r\n//# sourceMappingURL=7bit_ascii.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/7bit_ascii.js?");
|
|
11185
11185
|
|
|
11186
11186
|
/***/ }),
|
|
11187
11187
|
|
|
@@ -11236,7 +11236,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11236
11236
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11237
11237
|
|
|
11238
11238
|
"use strict";
|
|
11239
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Abapdoc = exports.AbapdocConf = void 0;\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst visibility_1 = __webpack_require__(/*! ../abap/4_file_information/visibility */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass AbapdocConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Check local classes and interfaces for abapdoc. */\r\n this.checkLocal = false;\r\n }\r\n}\r\nexports.AbapdocConf = AbapdocConf;\r\nclass Abapdoc extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new AbapdocConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"abapdoc\",\r\n title: \"Check abapdoc\",\r\n shortDescription: `Various checks regarding abapdoc.\nBase rule checks for existence of abapdoc for public class methods and all interface methods.`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n const rows = file.getRawRows();\r\n let methods = [];\r\n for (const classDef of file.getInfo().listClassDefinitions()) {\r\n if (this.conf.checkLocal === false && classDef.isLocal === true) {\r\n continue;\r\n }\r\n methods = methods.concat(classDef.methods.filter(m => m.visibility === visibility_1.Visibility.Public));\r\n }\r\n for (const interfaceDef of file.getInfo().listInterfaceDefinitions()) {\r\n if (this.conf.checkLocal === false && interfaceDef.isLocal === true) {\r\n continue;\r\n }\r\n methods = methods.concat(interfaceDef.methods);\r\n }\r\n for (const method of methods) {\r\n if (method.isRedefinition === true) {\r\n continue;\r\n }\r\n const previousRow = method.identifier.getStart().getRow() - 2;\r\n if (!(rows[previousRow].trim().substring(0, 2) === \"\\\"!\")) {\r\n const message = \"Missing ABAP Doc for method \" + method.identifier.getToken().getStr();\r\n const issue = issue_1.Issue.atIdentifier(method.identifier, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.Abapdoc = Abapdoc;\r\n//# sourceMappingURL=abapdoc.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/abapdoc.js?");
|
|
11239
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Abapdoc = exports.AbapdocConf = void 0;\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst visibility_1 = __webpack_require__(/*! ../abap/4_file_information/visibility */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass AbapdocConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Check local classes and interfaces for abapdoc. */\r\n this.checkLocal = false;\r\n }\r\n}\r\nexports.AbapdocConf = AbapdocConf;\r\nclass Abapdoc extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new AbapdocConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"abapdoc\",\r\n title: \"Check abapdoc\",\r\n shortDescription: `Various checks regarding abapdoc.\r\nBase rule checks for existence of abapdoc for public class methods and all interface methods.`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n const rows = file.getRawRows();\r\n let methods = [];\r\n for (const classDef of file.getInfo().listClassDefinitions()) {\r\n if (this.conf.checkLocal === false && classDef.isLocal === true) {\r\n continue;\r\n }\r\n methods = methods.concat(classDef.methods.filter(m => m.visibility === visibility_1.Visibility.Public));\r\n }\r\n for (const interfaceDef of file.getInfo().listInterfaceDefinitions()) {\r\n if (this.conf.checkLocal === false && interfaceDef.isLocal === true) {\r\n continue;\r\n }\r\n methods = methods.concat(interfaceDef.methods);\r\n }\r\n for (const method of methods) {\r\n if (method.isRedefinition === true) {\r\n continue;\r\n }\r\n const previousRow = method.identifier.getStart().getRow() - 2;\r\n if (!(rows[previousRow].trim().substring(0, 2) === \"\\\"!\")) {\r\n const message = \"Missing ABAP Doc for method \" + method.identifier.getToken().getStr();\r\n const issue = issue_1.Issue.atIdentifier(method.identifier, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.Abapdoc = Abapdoc;\r\n//# sourceMappingURL=abapdoc.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/abapdoc.js?");
|
|
11240
11240
|
|
|
11241
11241
|
/***/ }),
|
|
11242
11242
|
|
|
@@ -11247,7 +11247,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11247
11247
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11248
11248
|
|
|
11249
11249
|
"use strict";
|
|
11250
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.AlignParameters = exports.AlignParametersConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst __1 = __webpack_require__(/*! .. */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nclass AlignParametersConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.AlignParametersConf = AlignParametersConf;\r\nclass AlignParameters extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new AlignParametersConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"align_parameters\",\r\n title: \"Align Parameters\",\r\n shortDescription: `Checks for vertially aligned parameters`,\r\n extendedInformation: `Checks:\n* function module calls\n* method calls\n* VALUE constructors\n* NEW constructors\n* RAISE EXCEPTION statements\n* CREATE OBJECT statements\n* RAISE EVENT statements\n\nhttps://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#align-parameters\n\nDoes not take effect on non functional method calls, use https://rules.abaplint.org/functional_writing/\n\nAlso https://rules.abaplint.org/max_one_method_parameter_per_line/ can help aligning parameter syntax`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Styleguide],\r\n badExample: `CALL FUNCTION 'FOOBAR'\n EXPORTING\n foo = 2\n parameter = 3.\n\nfoobar( moo = 1\n param = 1 ).\n\nfoo = VALUE #(\n foo = bar\n moo = 2 ).`,\r\n goodExample: `CALL FUNCTION 'FOOBAR'\n EXPORTING\n foo = 2\n parameter = 3.\n\nfoobar( moo = 1\n param = 1 ).\n\nfoo = VALUE #(\n foo = bar\n moo = 2 ).`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return issues; // parser error\r\n }\r\n const candidates = [];\r\n candidates.push(...this.functionParameterCandidates(stru));\r\n candidates.push(...this.methodCallParamCandidates(stru));\r\n candidates.push(...this.valueBodyCandidates(stru));\r\n candidates.push(...this.raiseAndCreateCandidates(stru));\r\n candidates.push(...this.newCandidates(stru));\r\n for (const c of candidates) {\r\n const i = this.checkCandidate(c, file);\r\n if (i) {\r\n issues.push(i);\r\n }\r\n }\r\n return issues;\r\n }\r\n checkCandidate(candidate, file) {\r\n if (candidate.parameters.length === 0) {\r\n return undefined;\r\n }\r\n let expectedEqualsColumn = 0;\r\n for (const p of candidate.parameters) {\r\n const currentCol = p.left.getLastToken().getCol() + p.left.getLastToken().getStr().length + 1;\r\n if (currentCol > expectedEqualsColumn) {\r\n expectedEqualsColumn = currentCol;\r\n }\r\n }\r\n for (const p of candidate.parameters) {\r\n if (p.eq.getCol() !== expectedEqualsColumn) {\r\n const message = \"Align parameters to column \" + expectedEqualsColumn;\r\n return issue_1.Issue.atPosition(file, p.eq, message, this.getMetadata().key);\r\n }\r\n }\r\n return undefined;\r\n }\r\n newCandidates(stru) {\r\n const candidates = [];\r\n for (const vb of stru.findAllExpressionsRecursive(Expressions.NewObject)) {\r\n const parameters = [];\r\n const fieldAssignments = vb.findDirectExpressions(Expressions.FieldAssignment);\r\n if (fieldAssignments.length >= 2) {\r\n for (const fs of fieldAssignments) {\r\n const children = fs.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n if (parameters.length > 0) {\r\n candidates.push({ parameters });\r\n continue;\r\n }\r\n }\r\n const list = vb.findDirectExpression(Expressions.ParameterListS);\r\n if (list) {\r\n for (const c of list.getChildren()) {\r\n const children = c.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n if (parameters.length > 0) {\r\n candidates.push({ parameters });\r\n }\r\n }\r\n }\r\n return candidates;\r\n }\r\n valueBodyCandidates(stru) {\r\n const candidates = [];\r\n for (const vb of stru.findAllExpressionsRecursive(Expressions.ValueBody)) {\r\n const parameters = [];\r\n const fieldAssignments = vb.findDirectExpressions(Expressions.FieldAssignment);\r\n if (fieldAssignments.length <= 1) {\r\n continue;\r\n }\r\n for (const fs of fieldAssignments) {\r\n const children = fs.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n if (parameters.length > 0) {\r\n candidates.push({ parameters });\r\n }\r\n }\r\n return candidates;\r\n }\r\n raiseAndCreateCandidates(stru) {\r\n const candidates = [];\r\n const statements = stru.findAllStatements(__1.Statements.Raise);\r\n statements.push(...stru.findAllStatements(__1.Statements.CreateObject));\r\n statements.push(...stru.findAllStatements(__1.Statements.RaiseEvent));\r\n for (const raise of statements) {\r\n const parameters = [];\r\n const param = raise.findDirectExpression(Expressions.ParameterListS);\r\n for (const p of (param === null || param === void 0 ? void 0 : param.getChildren()) || []) {\r\n const children = p.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n const ex = raise.findDirectExpression(Expressions.ParameterListExceptions);\r\n for (const e of (ex === null || ex === void 0 ? void 0 : ex.getChildren()) || []) {\r\n const children = e.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n if (parameters.length > 0) {\r\n candidates.push({ parameters });\r\n }\r\n }\r\n return candidates;\r\n }\r\n methodCallParamCandidates(stru) {\r\n var _a, _b, _c;\r\n const candidates = [];\r\n for (const mcp of stru.findAllExpressionsRecursive(Expressions.MethodCallParam)) {\r\n const parameters = [];\r\n for (const param of ((_a = mcp.findDirectExpression(Expressions.ParameterListS)) === null || _a === void 0 ? void 0 : _a.getChildren()) || []) {\r\n const children = param.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n const mp = mcp.findDirectExpression(Expressions.MethodParameters);\r\n if (mp) {\r\n for (const p of ((_b = mp.findDirectExpression(Expressions.ParameterListS)) === null || _b === void 0 ? void 0 : _b.getChildren()) || []) {\r\n const children = p.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n for (const l of mp.findDirectExpressions(Expressions.ParameterListT)) {\r\n for (const p of l.findDirectExpressions(Expressions.ParameterT) || []) {\r\n const children = p.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n }\r\n const rec = mp.findDirectExpression(Expressions.ParameterT);\r\n if (rec) {\r\n const children = rec.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n for (const ex of ((_c = mp.findDirectExpression(Expressions.ParameterListExceptions)) === null || _c === void 0 ? void 0 : _c.getChildren()) || []) {\r\n const children = ex.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n }\r\n if (parameters.length > 0) {\r\n candidates.push({ parameters });\r\n }\r\n }\r\n return candidates;\r\n }\r\n functionParameterCandidates(stru) {\r\n const candidates = [];\r\n for (const fp of stru.findAllExpressionsRecursive(Expressions.FunctionParameters)) {\r\n const parameters = [];\r\n for (const p of fp.findAllExpressions(Expressions.FunctionExportingParameter)) {\r\n const children = p.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n for (const list of fp.findDirectExpressions(Expressions.ParameterListT)) {\r\n for (const pt of list.findDirectExpressions(Expressions.ParameterT)) {\r\n const children = pt.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n }\r\n const list = fp.findDirectExpression(Expressions.ParameterListExceptions);\r\n if (list) {\r\n for (const pt of list.findDirectExpressions(Expressions.ParameterException)) {\r\n const children = pt.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n }\r\n if (parameters.length > 0) {\r\n candidates.push({ parameters });\r\n }\r\n }\r\n return candidates;\r\n }\r\n}\r\nexports.AlignParameters = AlignParameters;\r\n//# sourceMappingURL=align_parameters.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/align_parameters.js?");
|
|
11250
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.AlignParameters = exports.AlignParametersConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst __1 = __webpack_require__(/*! .. */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nclass AlignParametersConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.AlignParametersConf = AlignParametersConf;\r\nclass AlignParameters extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new AlignParametersConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"align_parameters\",\r\n title: \"Align Parameters\",\r\n shortDescription: `Checks for vertially aligned parameters`,\r\n extendedInformation: `Checks:\r\n* function module calls\r\n* method calls\r\n* VALUE constructors\r\n* NEW constructors\r\n* RAISE EXCEPTION statements\r\n* CREATE OBJECT statements\r\n* RAISE EVENT statements\r\n\r\nhttps://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#align-parameters\r\n\r\nDoes not take effect on non functional method calls, use https://rules.abaplint.org/functional_writing/\r\n\r\nAlso https://rules.abaplint.org/max_one_method_parameter_per_line/ can help aligning parameter syntax`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Styleguide],\r\n badExample: `CALL FUNCTION 'FOOBAR'\r\n EXPORTING\r\n foo = 2\r\n parameter = 3.\r\n\r\nfoobar( moo = 1\r\n param = 1 ).\r\n\r\nfoo = VALUE #(\r\n foo = bar\r\n moo = 2 ).`,\r\n goodExample: `CALL FUNCTION 'FOOBAR'\r\n EXPORTING\r\n foo = 2\r\n parameter = 3.\r\n\r\nfoobar( moo = 1\r\n param = 1 ).\r\n\r\nfoo = VALUE #(\r\n foo = bar\r\n moo = 2 ).`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return issues; // parser error\r\n }\r\n const candidates = [];\r\n candidates.push(...this.functionParameterCandidates(stru));\r\n candidates.push(...this.methodCallParamCandidates(stru));\r\n candidates.push(...this.valueBodyCandidates(stru));\r\n candidates.push(...this.raiseAndCreateCandidates(stru));\r\n candidates.push(...this.newCandidates(stru));\r\n for (const c of candidates) {\r\n const i = this.checkCandidate(c, file);\r\n if (i) {\r\n issues.push(i);\r\n }\r\n }\r\n return issues;\r\n }\r\n checkCandidate(candidate, file) {\r\n if (candidate.parameters.length === 0) {\r\n return undefined;\r\n }\r\n let expectedEqualsColumn = 0;\r\n for (const p of candidate.parameters) {\r\n const currentCol = p.left.getLastToken().getCol() + p.left.getLastToken().getStr().length + 1;\r\n if (currentCol > expectedEqualsColumn) {\r\n expectedEqualsColumn = currentCol;\r\n }\r\n }\r\n for (const p of candidate.parameters) {\r\n if (p.eq.getCol() !== expectedEqualsColumn) {\r\n const message = \"Align parameters to column \" + expectedEqualsColumn;\r\n return issue_1.Issue.atPosition(file, p.eq, message, this.getMetadata().key);\r\n }\r\n }\r\n return undefined;\r\n }\r\n newCandidates(stru) {\r\n const candidates = [];\r\n for (const vb of stru.findAllExpressionsRecursive(Expressions.NewObject)) {\r\n const parameters = [];\r\n const fieldAssignments = vb.findDirectExpressions(Expressions.FieldAssignment);\r\n if (fieldAssignments.length >= 2) {\r\n for (const fs of fieldAssignments) {\r\n const children = fs.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n if (parameters.length > 0) {\r\n candidates.push({ parameters });\r\n continue;\r\n }\r\n }\r\n const list = vb.findDirectExpression(Expressions.ParameterListS);\r\n if (list) {\r\n for (const c of list.getChildren()) {\r\n const children = c.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n if (parameters.length > 0) {\r\n candidates.push({ parameters });\r\n }\r\n }\r\n }\r\n return candidates;\r\n }\r\n valueBodyCandidates(stru) {\r\n const candidates = [];\r\n for (const vb of stru.findAllExpressionsRecursive(Expressions.ValueBody)) {\r\n const parameters = [];\r\n const fieldAssignments = vb.findDirectExpressions(Expressions.FieldAssignment);\r\n if (fieldAssignments.length <= 1) {\r\n continue;\r\n }\r\n for (const fs of fieldAssignments) {\r\n const children = fs.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n if (parameters.length > 0) {\r\n candidates.push({ parameters });\r\n }\r\n }\r\n return candidates;\r\n }\r\n raiseAndCreateCandidates(stru) {\r\n const candidates = [];\r\n const statements = stru.findAllStatements(__1.Statements.Raise);\r\n statements.push(...stru.findAllStatements(__1.Statements.CreateObject));\r\n statements.push(...stru.findAllStatements(__1.Statements.RaiseEvent));\r\n for (const raise of statements) {\r\n const parameters = [];\r\n const param = raise.findDirectExpression(Expressions.ParameterListS);\r\n for (const p of (param === null || param === void 0 ? void 0 : param.getChildren()) || []) {\r\n const children = p.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n const ex = raise.findDirectExpression(Expressions.ParameterListExceptions);\r\n for (const e of (ex === null || ex === void 0 ? void 0 : ex.getChildren()) || []) {\r\n const children = e.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n if (parameters.length > 0) {\r\n candidates.push({ parameters });\r\n }\r\n }\r\n return candidates;\r\n }\r\n methodCallParamCandidates(stru) {\r\n var _a, _b, _c;\r\n const candidates = [];\r\n for (const mcp of stru.findAllExpressionsRecursive(Expressions.MethodCallParam)) {\r\n const parameters = [];\r\n for (const param of ((_a = mcp.findDirectExpression(Expressions.ParameterListS)) === null || _a === void 0 ? void 0 : _a.getChildren()) || []) {\r\n const children = param.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n const mp = mcp.findDirectExpression(Expressions.MethodParameters);\r\n if (mp) {\r\n for (const p of ((_b = mp.findDirectExpression(Expressions.ParameterListS)) === null || _b === void 0 ? void 0 : _b.getChildren()) || []) {\r\n const children = p.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n for (const l of mp.findDirectExpressions(Expressions.ParameterListT)) {\r\n for (const p of l.findDirectExpressions(Expressions.ParameterT) || []) {\r\n const children = p.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n }\r\n const rec = mp.findDirectExpression(Expressions.ParameterT);\r\n if (rec) {\r\n const children = rec.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n for (const ex of ((_c = mp.findDirectExpression(Expressions.ParameterListExceptions)) === null || _c === void 0 ? void 0 : _c.getChildren()) || []) {\r\n const children = ex.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n }\r\n if (parameters.length > 0) {\r\n candidates.push({ parameters });\r\n }\r\n }\r\n return candidates;\r\n }\r\n functionParameterCandidates(stru) {\r\n const candidates = [];\r\n for (const fp of stru.findAllExpressionsRecursive(Expressions.FunctionParameters)) {\r\n const parameters = [];\r\n for (const p of fp.findAllExpressions(Expressions.FunctionExportingParameter)) {\r\n const children = p.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n for (const list of fp.findDirectExpressions(Expressions.ParameterListT)) {\r\n for (const pt of list.findDirectExpressions(Expressions.ParameterT)) {\r\n const children = pt.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n }\r\n const list = fp.findDirectExpression(Expressions.ParameterListExceptions);\r\n if (list) {\r\n for (const pt of list.findDirectExpressions(Expressions.ParameterException)) {\r\n const children = pt.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n }\r\n if (parameters.length > 0) {\r\n candidates.push({ parameters });\r\n }\r\n }\r\n return candidates;\r\n }\r\n}\r\nexports.AlignParameters = AlignParameters;\r\n//# sourceMappingURL=align_parameters.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/align_parameters.js?");
|
|
11251
11251
|
|
|
11252
11252
|
/***/ }),
|
|
11253
11253
|
|
|
@@ -11280,7 +11280,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11280
11280
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11281
11281
|
|
|
11282
11282
|
"use strict";
|
|
11283
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.AmbiguousStatement = exports.AmbiguousStatementConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst combi_1 = __webpack_require__(/*! ../abap/2_statements/combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass AmbiguousStatementConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.AmbiguousStatementConf = AmbiguousStatementConf;\r\nclass AmbiguousStatement extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new AmbiguousStatementConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"ambiguous_statement\",\r\n title: \"Check for ambigious statements\",\r\n shortDescription: `Checks for ambiguity between deleting or modifying from internal and database table\nAdd \"TABLE\" keyword or \"@\" for escaping SQL variables\n\nOnly works if the target version is 740sp05 or above`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: `DELETE foo FROM bar.\nMODIFY foo FROM bar.`,\r\n goodExample: `DELETE foo FROM @bar.\nMODIFY TABLE foo FROM bar.`,\r\n };\r\n }\r\n getMessage() {\r\n return \"Ambiguous statement. Use explicit syntax.\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n if (this.reg.getConfig().getVersion() < version_1.Version.v740sp05) {\r\n return [];\r\n }\r\n for (const statement of file.getStatements()) {\r\n let match = false;\r\n if (statement.get() instanceof Statements.DeleteDatabase) {\r\n match = this.tryMatch(statement, this.reg, Statements.DeleteInternal);\r\n }\r\n else if (statement.get() instanceof Statements.DeleteInternal) {\r\n match = this.tryMatch(statement, this.reg, Statements.DeleteDatabase);\r\n }\r\n else if (statement.get() instanceof Statements.ModifyInternal) {\r\n match = this.tryMatch(statement, this.reg, Statements.ModifyDatabase);\r\n }\r\n else if (statement.get() instanceof Statements.ModifyDatabase) {\r\n match = this.tryMatch(statement, this.reg, Statements.ModifyInternal);\r\n }\r\n if (match) {\r\n const issue = issue_1.Issue.atStatement(file, statement, this.getMessage(), this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n tryMatch(st, reg, type1) {\r\n const ver = reg.getConfig().getVersion();\r\n const tokens = st.getTokens().slice(0);\r\n tokens.pop();\r\n const match = combi_1.Combi.run(new type1().getMatcher(), tokens, ver);\r\n return match !== undefined;\r\n }\r\n}\r\nexports.AmbiguousStatement = AmbiguousStatement;\r\n//# sourceMappingURL=ambiguous_statement.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/ambiguous_statement.js?");
|
|
11283
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.AmbiguousStatement = exports.AmbiguousStatementConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst combi_1 = __webpack_require__(/*! ../abap/2_statements/combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass AmbiguousStatementConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.AmbiguousStatementConf = AmbiguousStatementConf;\r\nclass AmbiguousStatement extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new AmbiguousStatementConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"ambiguous_statement\",\r\n title: \"Check for ambigious statements\",\r\n shortDescription: `Checks for ambiguity between deleting or modifying from internal and database table\r\nAdd \"TABLE\" keyword or \"@\" for escaping SQL variables\r\n\r\nOnly works if the target version is 740sp05 or above`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: `DELETE foo FROM bar.\r\nMODIFY foo FROM bar.`,\r\n goodExample: `DELETE foo FROM @bar.\r\nMODIFY TABLE foo FROM bar.`,\r\n };\r\n }\r\n getMessage() {\r\n return \"Ambiguous statement. Use explicit syntax.\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n if (this.reg.getConfig().getVersion() < version_1.Version.v740sp05) {\r\n return [];\r\n }\r\n for (const statement of file.getStatements()) {\r\n let match = false;\r\n if (statement.get() instanceof Statements.DeleteDatabase) {\r\n match = this.tryMatch(statement, this.reg, Statements.DeleteInternal);\r\n }\r\n else if (statement.get() instanceof Statements.DeleteInternal) {\r\n match = this.tryMatch(statement, this.reg, Statements.DeleteDatabase);\r\n }\r\n else if (statement.get() instanceof Statements.ModifyInternal) {\r\n match = this.tryMatch(statement, this.reg, Statements.ModifyDatabase);\r\n }\r\n else if (statement.get() instanceof Statements.ModifyDatabase) {\r\n match = this.tryMatch(statement, this.reg, Statements.ModifyInternal);\r\n }\r\n if (match) {\r\n const issue = issue_1.Issue.atStatement(file, statement, this.getMessage(), this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n tryMatch(st, reg, type1) {\r\n const ver = reg.getConfig().getVersion();\r\n const tokens = st.getTokens().slice(0);\r\n tokens.pop();\r\n const match = combi_1.Combi.run(new type1().getMatcher(), tokens, ver);\r\n return match !== undefined;\r\n }\r\n}\r\nexports.AmbiguousStatement = AmbiguousStatement;\r\n//# sourceMappingURL=ambiguous_statement.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/ambiguous_statement.js?");
|
|
11284
11284
|
|
|
11285
11285
|
/***/ }),
|
|
11286
11286
|
|
|
@@ -11291,7 +11291,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11291
11291
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11292
11292
|
|
|
11293
11293
|
"use strict";
|
|
11294
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.AvoidUse = exports.AvoidUseConf = void 0;\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass AvoidUseConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Detects DEFINE (macro definitions) */\r\n this.define = true;\r\n /** Detects statics */\r\n this.statics = true;\r\n /** Detects DEFAULT KEY definitions, from version v740sp02 and up */\r\n this.defaultKey = true;\r\n /** Detects BREAK and BREAK-POINTS */\r\n this.break = true;\r\n /** Detects DESCRIBE TABLE LINES, use lines() instead */\r\n this.describeLines = true;\r\n }\r\n}\r\nexports.AvoidUseConf = AvoidUseConf;\r\nclass AvoidUse extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new AvoidUseConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"avoid_use\",\r\n title: \"Avoid use of certain statements\",\r\n shortDescription: `Detects usage of certain statements.`,\r\n extendedInformation: `DEFAULT KEY: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-default-key\n\nMacros: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abenmacros_guidl.htm\n\nSTATICS: use CLASS-DATA instead\n\nDESCRIBE TABLE LINES: use lines() instead (quickfix exists)`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getDescription(statement) {\r\n return \"Avoid use of \" + statement;\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n var _a;\r\n const issues = [];\r\n let isStaticsBlock = false;\r\n for (const statementNode of file.getStatements()) {\r\n const statement = statementNode.get();\r\n let message = undefined;\r\n let fix = undefined;\r\n if (this.conf.define && statement instanceof Statements.Define) {\r\n message = \"DEFINE\";\r\n }\r\n else if (this.conf.describeLines && statement instanceof Statements.Describe) {\r\n const children = statementNode.getChildren();\r\n if (children.length === 6 && children[3].getFirstToken().getStr().toUpperCase() === \"LINES\") {\r\n message = \"DESCRIBE LINES, use lines() instead\";\r\n fix = this.getDescribeLinesFix(file, statementNode);\r\n }\r\n }\r\n else if (this.conf.statics && statement instanceof Statements.StaticBegin) {\r\n isStaticsBlock = true;\r\n message = \"STATICS\";\r\n }\r\n else if (this.conf.statics && statement instanceof Statements.StaticEnd) {\r\n isStaticsBlock = false;\r\n }\r\n else if (this.conf.statics && statement instanceof Statements.Static && isStaticsBlock === false) {\r\n message = \"STATICS\";\r\n }\r\n else if (this.conf.break && statement instanceof Statements.Break) {\r\n message = \"BREAK/BREAK-POINT\";\r\n }\r\n if (message) {\r\n issues.push(issue_1.Issue.atStatement(file, statementNode, this.getDescription(message), this.getMetadata().key, this.conf.severity, fix));\r\n }\r\n if (this.conf.defaultKey\r\n && (this.reg.getConfig().getVersion() >= version_1.Version.v740sp02\r\n || this.reg.getConfig().getVersion() === version_1.Version.Cloud)\r\n && (statement instanceof Statements.Data || statement instanceof Statements.Type)) {\r\n const tt = (_a = statementNode.findFirstExpression(expressions_1.TypeTable)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(expressions_1.TypeTableKey);\r\n const token = tt === null || tt === void 0 ? void 0 : tt.findDirectTokenByText(\"DEFAULT\");\r\n if (tt && token) {\r\n message = \"DEFAULT KEY\";\r\n issues.push(issue_1.Issue.atToken(file, token, this.getDescription(message), this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n getDescribeLinesFix(file, statementNode) {\r\n const children = statementNode.getChildren();\r\n const target = children[4].concatTokens();\r\n const source = children[2].concatTokens();\r\n const startPosition = children[0].getFirstToken().getStart();\r\n const insertText = target + \" = lines( \" + source + \" ).\";\r\n const deleteFix = edit_helper_1.EditHelper.deleteStatement(file, statementNode);\r\n const insertFix = edit_helper_1.EditHelper.insertAt(file, startPosition, insertText);\r\n const finalFix = edit_helper_1.EditHelper.merge(deleteFix, insertFix);\r\n return finalFix;\r\n }\r\n}\r\nexports.AvoidUse = AvoidUse;\r\n//# sourceMappingURL=avoid_use.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/avoid_use.js?");
|
|
11294
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.AvoidUse = exports.AvoidUseConf = void 0;\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass AvoidUseConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Detects DEFINE (macro definitions) */\r\n this.define = true;\r\n /** Detects statics */\r\n this.statics = true;\r\n /** Detects DEFAULT KEY definitions, from version v740sp02 and up */\r\n this.defaultKey = true;\r\n /** Detects BREAK and BREAK-POINTS */\r\n this.break = true;\r\n /** Detects DESCRIBE TABLE LINES, use lines() instead */\r\n this.describeLines = true;\r\n }\r\n}\r\nexports.AvoidUseConf = AvoidUseConf;\r\nclass AvoidUse extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new AvoidUseConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"avoid_use\",\r\n title: \"Avoid use of certain statements\",\r\n shortDescription: `Detects usage of certain statements.`,\r\n extendedInformation: `DEFAULT KEY: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-default-key\r\n\r\nMacros: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abenmacros_guidl.htm\r\n\r\nSTATICS: use CLASS-DATA instead\r\n\r\nDESCRIBE TABLE LINES: use lines() instead (quickfix exists)`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getDescription(statement) {\r\n return \"Avoid use of \" + statement;\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n var _a;\r\n const issues = [];\r\n let isStaticsBlock = false;\r\n for (const statementNode of file.getStatements()) {\r\n const statement = statementNode.get();\r\n let message = undefined;\r\n let fix = undefined;\r\n if (this.conf.define && statement instanceof Statements.Define) {\r\n message = \"DEFINE\";\r\n }\r\n else if (this.conf.describeLines && statement instanceof Statements.Describe) {\r\n const children = statementNode.getChildren();\r\n if (children.length === 6 && children[3].getFirstToken().getStr().toUpperCase() === \"LINES\") {\r\n message = \"DESCRIBE LINES, use lines() instead\";\r\n fix = this.getDescribeLinesFix(file, statementNode);\r\n }\r\n }\r\n else if (this.conf.statics && statement instanceof Statements.StaticBegin) {\r\n isStaticsBlock = true;\r\n message = \"STATICS\";\r\n }\r\n else if (this.conf.statics && statement instanceof Statements.StaticEnd) {\r\n isStaticsBlock = false;\r\n }\r\n else if (this.conf.statics && statement instanceof Statements.Static && isStaticsBlock === false) {\r\n message = \"STATICS\";\r\n }\r\n else if (this.conf.break && statement instanceof Statements.Break) {\r\n message = \"BREAK/BREAK-POINT\";\r\n }\r\n if (message) {\r\n issues.push(issue_1.Issue.atStatement(file, statementNode, this.getDescription(message), this.getMetadata().key, this.conf.severity, fix));\r\n }\r\n if (this.conf.defaultKey\r\n && (this.reg.getConfig().getVersion() >= version_1.Version.v740sp02\r\n || this.reg.getConfig().getVersion() === version_1.Version.Cloud)\r\n && (statement instanceof Statements.Data || statement instanceof Statements.Type)) {\r\n const tt = (_a = statementNode.findFirstExpression(expressions_1.TypeTable)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(expressions_1.TypeTableKey);\r\n const token = tt === null || tt === void 0 ? void 0 : tt.findDirectTokenByText(\"DEFAULT\");\r\n if (tt && token) {\r\n message = \"DEFAULT KEY\";\r\n issues.push(issue_1.Issue.atToken(file, token, this.getDescription(message), this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n getDescribeLinesFix(file, statementNode) {\r\n const children = statementNode.getChildren();\r\n const target = children[4].concatTokens();\r\n const source = children[2].concatTokens();\r\n const startPosition = children[0].getFirstToken().getStart();\r\n const insertText = target + \" = lines( \" + source + \" ).\";\r\n const deleteFix = edit_helper_1.EditHelper.deleteStatement(file, statementNode);\r\n const insertFix = edit_helper_1.EditHelper.insertAt(file, startPosition, insertText);\r\n const finalFix = edit_helper_1.EditHelper.merge(deleteFix, insertFix);\r\n return finalFix;\r\n }\r\n}\r\nexports.AvoidUse = AvoidUse;\r\n//# sourceMappingURL=avoid_use.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/avoid_use.js?");
|
|
11295
11295
|
|
|
11296
11296
|
/***/ }),
|
|
11297
11297
|
|
|
@@ -11302,7 +11302,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11302
11302
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11303
11303
|
|
|
11304
11304
|
"use strict";
|
|
11305
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.BeginEndNames = exports.BeginEndNamesConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass BeginEndNamesConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.BeginEndNamesConf = BeginEndNamesConf;\r\nclass BeginEndNames extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new BeginEndNamesConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"begin_end_names\",\r\n title: \"Check BEGIN END names\",\r\n shortDescription: `Check BEGIN OF and END OF names match, plus there must be statements between BEGIN and END`,\r\n tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n badExample: `DATA: BEGIN OF stru,\n field TYPE i,\n END OF structure_not_the_same.`,\r\n goodExample: `DATA: BEGIN OF stru,\n field TYPE i,\n END OF stru.`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const output = [];\r\n const struc = file.getStructure();\r\n if (struc === undefined) {\r\n return [];\r\n }\r\n output.push(...this.test(struc, Structures.Data, Statements.DataBegin, Statements.DataEnd, file));\r\n output.push(...this.test(struc, Structures.ClassData, Statements.ClassDataBegin, Statements.ClassDataEnd, file));\r\n output.push(...this.test(struc, Structures.Constants, Statements.ConstantBegin, Statements.ConstantEnd, file));\r\n output.push(...this.test(struc, Structures.Statics, Statements.StaticBegin, Statements.StaticEnd, file));\r\n output.push(...this.test(struc, Structures.TypeEnum, Statements.TypeEnumBegin, Statements.TypeEnumEnd, file));\r\n output.push(...this.test(struc, Structures.Types, Statements.TypeBegin, Statements.TypeEnd, file));\r\n return output;\r\n }\r\n test(stru, type, b, e, file) {\r\n const output = [];\r\n for (const sub of stru.findAllStructuresRecursive(type)) {\r\n let begin = sub.findDirectStatements(b)[0].findFirstExpression(Expressions.NamespaceSimpleName);\r\n if (begin === undefined) {\r\n begin = sub.findDirectStatements(b)[0].findFirstExpression(Expressions.DefinitionName);\r\n }\r\n if (begin === undefined) {\r\n continue;\r\n }\r\n const first = begin.getFirstToken();\r\n let end = sub.findDirectStatements(e)[0].findFirstExpression(Expressions.NamespaceSimpleName);\r\n if (end === undefined) {\r\n end = sub.findDirectStatements(e)[0].findFirstExpression(Expressions.DefinitionName);\r\n }\r\n if (end === undefined) {\r\n continue;\r\n }\r\n const last = end.getFirstToken();\r\n if (first.getStr().toUpperCase() !== last.getStr().toUpperCase()) {\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, last.getStart(), last.getEnd(), first.getStr());\r\n const message = \"BEGIN END names must match\";\r\n const issue = issue_1.Issue.atToken(file, first, message, this.getMetadata().key, this.conf.severity, fix);\r\n output.push(issue);\r\n }\r\n if (sub.getChildren().length === 2) {\r\n const message = \"There must be statements between BEGIN and END\";\r\n const issue = issue_1.Issue.atToken(file, first, message, this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n }\r\n return output;\r\n }\r\n}\r\nexports.BeginEndNames = BeginEndNames;\r\n//# sourceMappingURL=begin_end_names.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/begin_end_names.js?");
|
|
11305
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.BeginEndNames = exports.BeginEndNamesConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass BeginEndNamesConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.BeginEndNamesConf = BeginEndNamesConf;\r\nclass BeginEndNames extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new BeginEndNamesConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"begin_end_names\",\r\n title: \"Check BEGIN END names\",\r\n shortDescription: `Check BEGIN OF and END OF names match, plus there must be statements between BEGIN and END`,\r\n tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n badExample: `DATA: BEGIN OF stru,\r\n field TYPE i,\r\n END OF structure_not_the_same.`,\r\n goodExample: `DATA: BEGIN OF stru,\r\n field TYPE i,\r\n END OF stru.`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const output = [];\r\n const struc = file.getStructure();\r\n if (struc === undefined) {\r\n return [];\r\n }\r\n output.push(...this.test(struc, Structures.Data, Statements.DataBegin, Statements.DataEnd, file));\r\n output.push(...this.test(struc, Structures.ClassData, Statements.ClassDataBegin, Statements.ClassDataEnd, file));\r\n output.push(...this.test(struc, Structures.Constants, Statements.ConstantBegin, Statements.ConstantEnd, file));\r\n output.push(...this.test(struc, Structures.Statics, Statements.StaticBegin, Statements.StaticEnd, file));\r\n output.push(...this.test(struc, Structures.TypeEnum, Statements.TypeEnumBegin, Statements.TypeEnumEnd, file));\r\n output.push(...this.test(struc, Structures.Types, Statements.TypeBegin, Statements.TypeEnd, file));\r\n return output;\r\n }\r\n test(stru, type, b, e, file) {\r\n const output = [];\r\n for (const sub of stru.findAllStructuresRecursive(type)) {\r\n let begin = sub.findDirectStatements(b)[0].findFirstExpression(Expressions.NamespaceSimpleName);\r\n if (begin === undefined) {\r\n begin = sub.findDirectStatements(b)[0].findFirstExpression(Expressions.DefinitionName);\r\n }\r\n if (begin === undefined) {\r\n continue;\r\n }\r\n const first = begin.getFirstToken();\r\n let end = sub.findDirectStatements(e)[0].findFirstExpression(Expressions.NamespaceSimpleName);\r\n if (end === undefined) {\r\n end = sub.findDirectStatements(e)[0].findFirstExpression(Expressions.DefinitionName);\r\n }\r\n if (end === undefined) {\r\n continue;\r\n }\r\n const last = end.getFirstToken();\r\n if (first.getStr().toUpperCase() !== last.getStr().toUpperCase()) {\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, last.getStart(), last.getEnd(), first.getStr());\r\n const message = \"BEGIN END names must match\";\r\n const issue = issue_1.Issue.atToken(file, first, message, this.getMetadata().key, this.conf.severity, fix);\r\n output.push(issue);\r\n }\r\n if (sub.getChildren().length === 2) {\r\n const message = \"There must be statements between BEGIN and END\";\r\n const issue = issue_1.Issue.atToken(file, first, message, this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n }\r\n return output;\r\n }\r\n}\r\nexports.BeginEndNames = BeginEndNames;\r\n//# sourceMappingURL=begin_end_names.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/begin_end_names.js?");
|
|
11306
11306
|
|
|
11307
11307
|
/***/ }),
|
|
11308
11308
|
|
|
@@ -11313,7 +11313,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11313
11313
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11314
11314
|
|
|
11315
11315
|
"use strict";
|
|
11316
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.BeginSingleInclude = exports.BeginSingleIncludeConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass BeginSingleIncludeConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.BeginSingleIncludeConf = BeginSingleIncludeConf;\r\nclass BeginSingleInclude extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new BeginSingleIncludeConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"begin_single_include\",\r\n title: \"BEGIN contains single INCLUDE\",\r\n shortDescription: `Finds TYPE BEGIN with just one INCLUDE TYPE, and DATA with single INCLUDE STRUCTURE`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: `TYPES: BEGIN OF dummy1.\n INCLUDE TYPE dselc.\nTYPES: END OF dummy1.\n\nDATA BEGIN OF foo.\nINCLUDE STRUCTURE syst.\nDATA END OF foo.\n\nSTATICS BEGIN OF bar.\nINCLUDE STRUCTURE syst.\nSTATICS END OF bar.`,\r\n goodExample: `DATA BEGIN OF foo.\nINCLUDE STRUCTURE dselc.\nDATA END OF foo.`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return [];\r\n }\r\n for (const t of stru.findAllStructures(Structures.Types)) {\r\n if (t.getChildren().length !== 3) {\r\n continue;\r\n }\r\n if (t.findFirstStatement(Statements.IncludeType)) {\r\n const token = t.getFirstToken();\r\n const message = \"TYPE BEGIN with single INCLUDE\";\r\n const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n for (const t of stru.findAllStructures(Structures.Data)) {\r\n if (t.getChildren().length !== 3) {\r\n continue;\r\n }\r\n if (t.findFirstStatement(Statements.IncludeType)) {\r\n const token = t.getFirstToken();\r\n const message = \"DATA BEGIN with single INCLUDE\";\r\n const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n for (const t of stru.findAllStructures(Structures.Statics)) {\r\n if (t.getChildren().length !== 3) {\r\n continue;\r\n }\r\n if (t.findFirstStatement(Statements.IncludeType)) {\r\n const token = t.getFirstToken();\r\n const message = \"STATICS BEGIN with single INCLUDE\";\r\n const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.BeginSingleInclude = BeginSingleInclude;\r\n//# sourceMappingURL=begin_single_include.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/begin_single_include.js?");
|
|
11316
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.BeginSingleInclude = exports.BeginSingleIncludeConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass BeginSingleIncludeConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.BeginSingleIncludeConf = BeginSingleIncludeConf;\r\nclass BeginSingleInclude extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new BeginSingleIncludeConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"begin_single_include\",\r\n title: \"BEGIN contains single INCLUDE\",\r\n shortDescription: `Finds TYPE BEGIN with just one INCLUDE TYPE, and DATA with single INCLUDE STRUCTURE`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: `TYPES: BEGIN OF dummy1.\r\n INCLUDE TYPE dselc.\r\nTYPES: END OF dummy1.\r\n\r\nDATA BEGIN OF foo.\r\nINCLUDE STRUCTURE syst.\r\nDATA END OF foo.\r\n\r\nSTATICS BEGIN OF bar.\r\nINCLUDE STRUCTURE syst.\r\nSTATICS END OF bar.`,\r\n goodExample: `DATA BEGIN OF foo.\r\nINCLUDE STRUCTURE dselc.\r\nDATA END OF foo.`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return [];\r\n }\r\n for (const t of stru.findAllStructures(Structures.Types)) {\r\n if (t.getChildren().length !== 3) {\r\n continue;\r\n }\r\n if (t.findFirstStatement(Statements.IncludeType)) {\r\n const token = t.getFirstToken();\r\n const message = \"TYPE BEGIN with single INCLUDE\";\r\n const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n for (const t of stru.findAllStructures(Structures.Data)) {\r\n if (t.getChildren().length !== 3) {\r\n continue;\r\n }\r\n if (t.findFirstStatement(Statements.IncludeType)) {\r\n const token = t.getFirstToken();\r\n const message = \"DATA BEGIN with single INCLUDE\";\r\n const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n for (const t of stru.findAllStructures(Structures.Statics)) {\r\n if (t.getChildren().length !== 3) {\r\n continue;\r\n }\r\n if (t.findFirstStatement(Statements.IncludeType)) {\r\n const token = t.getFirstToken();\r\n const message = \"STATICS BEGIN with single INCLUDE\";\r\n const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.BeginSingleInclude = BeginSingleInclude;\r\n//# sourceMappingURL=begin_single_include.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/begin_single_include.js?");
|
|
11317
11317
|
|
|
11318
11318
|
/***/ }),
|
|
11319
11319
|
|
|
@@ -11324,7 +11324,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11324
11324
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11325
11325
|
|
|
11326
11326
|
"use strict";
|
|
11327
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CallTransactionAuthorityCheck = exports.CallTransactionAuthorityCheckConf = void 0;\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nclass CallTransactionAuthorityCheckConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.CallTransactionAuthorityCheckConf = CallTransactionAuthorityCheckConf;\r\nclass CallTransactionAuthorityCheck extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new CallTransactionAuthorityCheckConf();\r\n this.MINIMUM_VERSION = version_1.Version.v740sp02;\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"call_transaction_authority_check\",\r\n title: \"Call Transaction Authority-Check\",\r\n shortDescription: `Checks that usages of CALL TRANSACTION contain an authority-check.`,\r\n extendedInformation: `https://docs.abapopenchecks.org/checks/54/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Security],\r\n badExample: `CALL TRANSACTION 'FOO'.`,\r\n goodExample: `TRY.\n CALL TRANSACTION 'FOO' WITH AUTHORITY-CHECK.\n CATCH cx_sy_authorization_error.\nENDTRY.`,\r\n };\r\n }\r\n getMessage() {\r\n return \"Add an authority check to CALL TRANSACTION\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file, obj) {\r\n const currentVersion = this.reg.getConfig().getVersion();\r\n // Cloud version does not support CALL TRANSACTION\r\n if (currentVersion < this.MINIMUM_VERSION || currentVersion === version_1.Version.Cloud) {\r\n return [];\r\n }\r\n const issues = [];\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n for (const statNode of file.getStatements()) {\r\n const statement = statNode.get();\r\n if (statement instanceof Statements.CallTransaction && !statNode.concatTokensWithoutStringsAndComments().toUpperCase().includes(\"WITH AUTHORITY-CHECK\")) {\r\n issues.push(issue_1.Issue.atStatement(file, statNode, this.getMessage(), this.getMetadata().key));\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.CallTransactionAuthorityCheck = CallTransactionAuthorityCheck;\r\n//# sourceMappingURL=call_transaction_authority_check.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/call_transaction_authority_check.js?");
|
|
11327
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CallTransactionAuthorityCheck = exports.CallTransactionAuthorityCheckConf = void 0;\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nclass CallTransactionAuthorityCheckConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.CallTransactionAuthorityCheckConf = CallTransactionAuthorityCheckConf;\r\nclass CallTransactionAuthorityCheck extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new CallTransactionAuthorityCheckConf();\r\n this.MINIMUM_VERSION = version_1.Version.v740sp02;\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"call_transaction_authority_check\",\r\n title: \"Call Transaction Authority-Check\",\r\n shortDescription: `Checks that usages of CALL TRANSACTION contain an authority-check.`,\r\n extendedInformation: `https://docs.abapopenchecks.org/checks/54/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Security],\r\n badExample: `CALL TRANSACTION 'FOO'.`,\r\n goodExample: `TRY.\r\n CALL TRANSACTION 'FOO' WITH AUTHORITY-CHECK.\r\n CATCH cx_sy_authorization_error.\r\nENDTRY.`,\r\n };\r\n }\r\n getMessage() {\r\n return \"Add an authority check to CALL TRANSACTION\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file, obj) {\r\n const currentVersion = this.reg.getConfig().getVersion();\r\n // Cloud version does not support CALL TRANSACTION\r\n if (currentVersion < this.MINIMUM_VERSION || currentVersion === version_1.Version.Cloud) {\r\n return [];\r\n }\r\n const issues = [];\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n for (const statNode of file.getStatements()) {\r\n const statement = statNode.get();\r\n if (statement instanceof Statements.CallTransaction && !statNode.concatTokensWithoutStringsAndComments().toUpperCase().includes(\"WITH AUTHORITY-CHECK\")) {\r\n issues.push(issue_1.Issue.atStatement(file, statNode, this.getMessage(), this.getMetadata().key));\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.CallTransactionAuthorityCheck = CallTransactionAuthorityCheck;\r\n//# sourceMappingURL=call_transaction_authority_check.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/call_transaction_authority_check.js?");
|
|
11328
11328
|
|
|
11329
11329
|
/***/ }),
|
|
11330
11330
|
|
|
@@ -11346,7 +11346,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11346
11346
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11347
11347
|
|
|
11348
11348
|
"use strict";
|
|
11349
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ChainMainlyDeclarations = exports.ChainMainlyDeclarationsConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass ChainMainlyDeclarationsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Allow definition statements to be chained */\r\n this.definitions = true;\r\n /** Allow WRITE statements to be chained */\r\n this.write = true;\r\n /** Allow MOVE statements to be chained */\r\n this.move = true;\r\n /** Allow REFRESH statements to be chained */\r\n this.refresh = true;\r\n /** Allow UNASSIGN statements to be chained */\r\n this.unassign = true;\r\n /** Allow CLEAR statements to be chained */\r\n this.clear = true;\r\n /** Allow HIDE statements to be chained */\r\n this.hide = true;\r\n /** Allow FREE statements to be chained */\r\n this.free = true;\r\n /** Allow INCLUDE statements to be chained */\r\n this.include = true;\r\n /** Allow CHECK statements to be chained */\r\n this.check = true;\r\n /** Allow SORT statements to be chained */\r\n this.sort = true;\r\n }\r\n}\r\nexports.ChainMainlyDeclarationsConf = ChainMainlyDeclarationsConf;\r\nclass ChainMainlyDeclarations extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ChainMainlyDeclarationsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"chain_mainly_declarations\",\r\n title: \"Chain mainly declarations\",\r\n shortDescription: `Chain mainly declarations, allows chaining for the configured statements, reports errors for other statements.`,\r\n extendedInformation: `\nhttps://docs.abapopenchecks.org/checks/23/\n\nhttps://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenchained_statements_guidl.htm\n`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],\r\n badExample: `CALL METHOD: bar.`,\r\n goodExample: `CALL METHOD bar.`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n var _a;\r\n const issues = [];\r\n const structure = file.getStructure();\r\n if (structure === undefined) {\r\n return [];\r\n }\r\n let previousRow;\r\n for (const statementNode of structure.findAllStatementNodes()) {\r\n const colon = statementNode.getColon();\r\n if (colon === undefined) {\r\n continue;\r\n }\r\n const statement = statementNode.get();\r\n if (this.conf.definitions === true\r\n && (statement instanceof Statements.ClassData\r\n || statement instanceof Statements.ClassDataBegin\r\n || statement instanceof Statements.ClassDataEnd\r\n || statement instanceof Statements.Static\r\n || statement instanceof Statements.StaticBegin\r\n || statement instanceof Statements.StaticEnd\r\n || statement instanceof Statements.Local\r\n || statement instanceof Statements.Constant\r\n || statement instanceof Statements.ConstantBegin\r\n || statement instanceof Statements.ConstantEnd\r\n || statement instanceof Statements.Controls\r\n || statement instanceof Statements.Parameter\r\n || statement instanceof Statements.SelectOption\r\n || statement instanceof Statements.SelectionScreen\r\n || statement instanceof Statements.Aliases\r\n || statement instanceof Statements.Tables\r\n || statement instanceof Statements.MethodDef\r\n || statement instanceof Statements.InterfaceDef\r\n || statement instanceof Statements.Type\r\n || statement instanceof Statements.TypeBegin\r\n || statement instanceof Statements.TypeEnd\r\n || statement instanceof Statements.TypeEnumBegin\r\n || statement instanceof Statements.TypeEnumEnd\r\n || statement instanceof Statements.TypeEnum\r\n || statement instanceof Statements.Events\r\n || statement instanceof Statements.Ranges\r\n || statement instanceof Statements.TypePools\r\n || statement instanceof Statements.FieldSymbol\r\n || statement instanceof Statements.Data\r\n || statement instanceof Statements.DataBegin\r\n || statement instanceof Statements.DataEnd)) {\r\n continue;\r\n }\r\n else if (this.conf.write === true && statement instanceof Statements.Write) {\r\n continue;\r\n }\r\n else if (this.conf.move === true && statement instanceof Statements.Move) {\r\n continue;\r\n }\r\n else if (this.conf.refresh === true && statement instanceof Statements.Refresh) {\r\n continue;\r\n }\r\n else if (this.conf.unassign === true && statement instanceof Statements.Unassign) {\r\n continue;\r\n }\r\n else if (this.conf.clear === true && statement instanceof Statements.Clear) {\r\n continue;\r\n }\r\n else if (this.conf.hide === true && statement instanceof Statements.Hide) {\r\n continue;\r\n }\r\n else if (this.conf.free === true && statement instanceof Statements.Free) {\r\n continue;\r\n }\r\n else if (this.conf.include === true && statement instanceof Statements.Include) {\r\n continue;\r\n }\r\n else if (this.conf.check === true && statement instanceof Statements.Check) {\r\n continue;\r\n }\r\n else if (this.conf.sort === true && statement instanceof Statements.Sort) {\r\n continue;\r\n }\r\n let prevFix;\r\n if (previousRow === colon.getStart().getRow()) {\r\n prevFix = (_a = issues.pop()) === null || _a === void 0 ? void 0 : _a.getFix();\r\n }\r\n const fix = this.getFix(file, statement, statementNode, prevFix);\r\n const message = \"Chain mainly declarations\";\r\n issues.push(issue_1.Issue.atToken(file, statementNode.getFirstToken(), message, this.getMetadata().key, this.conf.severity, fix));\r\n previousRow = statementNode.getColon().getStart().getRow();\r\n }\r\n return issues;\r\n }\r\n getFix(file, statement, statementNode, prevFix) {\r\n if (statement instanceof Statements.ClassDataBegin ||\r\n statement instanceof Statements.ClassDataEnd ||\r\n statement instanceof Statements.StaticBegin ||\r\n statement instanceof Statements.StaticEnd ||\r\n statement instanceof Statements.ConstantBegin ||\r\n statement instanceof Statements.ConstantEnd ||\r\n statement instanceof Statements.TypeBegin ||\r\n statement instanceof Statements.TypeEnd ||\r\n statement instanceof Statements.TypeEnumBegin ||\r\n statement instanceof Statements.TypeEnumEnd ||\r\n statement instanceof Statements.DataBegin ||\r\n statement instanceof Statements.DataEnd) {\r\n return undefined;\r\n }\r\n let replacement = statementNode.concatTokens();\r\n replacement = replacement.replace(\",\", \".\");\r\n let start;\r\n if (prevFix === undefined) {\r\n start = statementNode.getStart();\r\n }\r\n else {\r\n start = statementNode.getTokens()[1].getStart();\r\n }\r\n let fix = edit_helper_1.EditHelper.replaceRange(file, start, statementNode.getEnd(), replacement);\r\n if (prevFix !== undefined) {\r\n fix = edit_helper_1.EditHelper.merge(fix, prevFix);\r\n }\r\n return fix;\r\n }\r\n}\r\nexports.ChainMainlyDeclarations = ChainMainlyDeclarations;\r\n//# sourceMappingURL=chain_mainly_declarations.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/chain_mainly_declarations.js?");
|
|
11349
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ChainMainlyDeclarations = exports.ChainMainlyDeclarationsConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass ChainMainlyDeclarationsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Allow definition statements to be chained */\r\n this.definitions = true;\r\n /** Allow WRITE statements to be chained */\r\n this.write = true;\r\n /** Allow MOVE statements to be chained */\r\n this.move = true;\r\n /** Allow REFRESH statements to be chained */\r\n this.refresh = true;\r\n /** Allow UNASSIGN statements to be chained */\r\n this.unassign = true;\r\n /** Allow CLEAR statements to be chained */\r\n this.clear = true;\r\n /** Allow HIDE statements to be chained */\r\n this.hide = true;\r\n /** Allow FREE statements to be chained */\r\n this.free = true;\r\n /** Allow INCLUDE statements to be chained */\r\n this.include = true;\r\n /** Allow CHECK statements to be chained */\r\n this.check = true;\r\n /** Allow SORT statements to be chained */\r\n this.sort = true;\r\n }\r\n}\r\nexports.ChainMainlyDeclarationsConf = ChainMainlyDeclarationsConf;\r\nclass ChainMainlyDeclarations extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ChainMainlyDeclarationsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"chain_mainly_declarations\",\r\n title: \"Chain mainly declarations\",\r\n shortDescription: `Chain mainly declarations, allows chaining for the configured statements, reports errors for other statements.`,\r\n extendedInformation: `\r\nhttps://docs.abapopenchecks.org/checks/23/\r\n\r\nhttps://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenchained_statements_guidl.htm\r\n`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],\r\n badExample: `CALL METHOD: bar.`,\r\n goodExample: `CALL METHOD bar.`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n var _a;\r\n const issues = [];\r\n const structure = file.getStructure();\r\n if (structure === undefined) {\r\n return [];\r\n }\r\n let previousRow;\r\n for (const statementNode of structure.findAllStatementNodes()) {\r\n const colon = statementNode.getColon();\r\n if (colon === undefined) {\r\n continue;\r\n }\r\n const statement = statementNode.get();\r\n if (this.conf.definitions === true\r\n && (statement instanceof Statements.ClassData\r\n || statement instanceof Statements.ClassDataBegin\r\n || statement instanceof Statements.ClassDataEnd\r\n || statement instanceof Statements.Static\r\n || statement instanceof Statements.StaticBegin\r\n || statement instanceof Statements.StaticEnd\r\n || statement instanceof Statements.Local\r\n || statement instanceof Statements.Constant\r\n || statement instanceof Statements.ConstantBegin\r\n || statement instanceof Statements.ConstantEnd\r\n || statement instanceof Statements.Controls\r\n || statement instanceof Statements.Parameter\r\n || statement instanceof Statements.SelectOption\r\n || statement instanceof Statements.SelectionScreen\r\n || statement instanceof Statements.Aliases\r\n || statement instanceof Statements.Tables\r\n || statement instanceof Statements.MethodDef\r\n || statement instanceof Statements.InterfaceDef\r\n || statement instanceof Statements.Type\r\n || statement instanceof Statements.TypeBegin\r\n || statement instanceof Statements.TypeEnd\r\n || statement instanceof Statements.TypeEnumBegin\r\n || statement instanceof Statements.TypeEnumEnd\r\n || statement instanceof Statements.TypeEnum\r\n || statement instanceof Statements.Events\r\n || statement instanceof Statements.Ranges\r\n || statement instanceof Statements.TypePools\r\n || statement instanceof Statements.FieldSymbol\r\n || statement instanceof Statements.Data\r\n || statement instanceof Statements.DataBegin\r\n || statement instanceof Statements.DataEnd)) {\r\n continue;\r\n }\r\n else if (this.conf.write === true && statement instanceof Statements.Write) {\r\n continue;\r\n }\r\n else if (this.conf.move === true && statement instanceof Statements.Move) {\r\n continue;\r\n }\r\n else if (this.conf.refresh === true && statement instanceof Statements.Refresh) {\r\n continue;\r\n }\r\n else if (this.conf.unassign === true && statement instanceof Statements.Unassign) {\r\n continue;\r\n }\r\n else if (this.conf.clear === true && statement instanceof Statements.Clear) {\r\n continue;\r\n }\r\n else if (this.conf.hide === true && statement instanceof Statements.Hide) {\r\n continue;\r\n }\r\n else if (this.conf.free === true && statement instanceof Statements.Free) {\r\n continue;\r\n }\r\n else if (this.conf.include === true && statement instanceof Statements.Include) {\r\n continue;\r\n }\r\n else if (this.conf.check === true && statement instanceof Statements.Check) {\r\n continue;\r\n }\r\n else if (this.conf.sort === true && statement instanceof Statements.Sort) {\r\n continue;\r\n }\r\n let prevFix;\r\n if (previousRow === colon.getStart().getRow()) {\r\n prevFix = (_a = issues.pop()) === null || _a === void 0 ? void 0 : _a.getFix();\r\n }\r\n const fix = this.getFix(file, statement, statementNode, prevFix);\r\n const message = \"Chain mainly declarations\";\r\n issues.push(issue_1.Issue.atToken(file, statementNode.getFirstToken(), message, this.getMetadata().key, this.conf.severity, fix));\r\n previousRow = statementNode.getColon().getStart().getRow();\r\n }\r\n return issues;\r\n }\r\n getFix(file, statement, statementNode, prevFix) {\r\n if (statement instanceof Statements.ClassDataBegin ||\r\n statement instanceof Statements.ClassDataEnd ||\r\n statement instanceof Statements.StaticBegin ||\r\n statement instanceof Statements.StaticEnd ||\r\n statement instanceof Statements.ConstantBegin ||\r\n statement instanceof Statements.ConstantEnd ||\r\n statement instanceof Statements.TypeBegin ||\r\n statement instanceof Statements.TypeEnd ||\r\n statement instanceof Statements.TypeEnumBegin ||\r\n statement instanceof Statements.TypeEnumEnd ||\r\n statement instanceof Statements.DataBegin ||\r\n statement instanceof Statements.DataEnd) {\r\n return undefined;\r\n }\r\n let replacement = statementNode.concatTokens();\r\n replacement = replacement.replace(\",\", \".\");\r\n let start;\r\n if (prevFix === undefined) {\r\n start = statementNode.getStart();\r\n }\r\n else {\r\n start = statementNode.getTokens()[1].getStart();\r\n }\r\n let fix = edit_helper_1.EditHelper.replaceRange(file, start, statementNode.getEnd(), replacement);\r\n if (prevFix !== undefined) {\r\n fix = edit_helper_1.EditHelper.merge(fix, prevFix);\r\n }\r\n return fix;\r\n }\r\n}\r\nexports.ChainMainlyDeclarations = ChainMainlyDeclarations;\r\n//# sourceMappingURL=chain_mainly_declarations.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/chain_mainly_declarations.js?");
|
|
11350
11350
|
|
|
11351
11351
|
/***/ }),
|
|
11352
11352
|
|
|
@@ -11357,7 +11357,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11357
11357
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11358
11358
|
|
|
11359
11359
|
"use strict";
|
|
11360
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CheckAbstract = exports.CheckAbstractConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass CheckAbstractConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.CheckAbstractConf = CheckAbstractConf;\r\nvar IssueType;\r\n(function (IssueType) {\r\n /** Abstract method defined in non-abstract class */\r\n IssueType[IssueType[\"NotAbstractClass\"] = 0] = \"NotAbstractClass\";\r\n IssueType[IssueType[\"AbstractAndFinal\"] = 1] = \"AbstractAndFinal\";\r\n})(IssueType || (IssueType = {}));\r\nclass CheckAbstract extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new CheckAbstractConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"check_abstract\",\r\n title: \"Check abstract methods and classes\",\r\n shortDescription: `Checks abstract methods and classes:\n- class defined as abstract and final,\n- non-abstract class contains abstract methods`,\r\n extendedInformation: `If a class defines only constants, use an interface instead`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getDescription(issueType, name) {\r\n switch (issueType) {\r\n case IssueType.AbstractAndFinal:\r\n return \"Classes should not be ABSTRACT and FINAL: \" + name;\r\n case IssueType.NotAbstractClass:\r\n return \"Abstract methods require abstract classes: \" + name;\r\n default:\r\n return \"\";\r\n }\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n for (const classDef of file.getInfo().listClassDefinitions()) {\r\n if (classDef.isAbstract === true) {\r\n if (classDef.isFinal === true && classDef.isForTesting === false) {\r\n issues.push(issue_1.Issue.atIdentifier(classDef.identifier, this.getDescription(IssueType.AbstractAndFinal, classDef.name), this.getMetadata().key, this.conf.severity));\r\n }\r\n continue;\r\n }\r\n for (const methodDef of classDef.methods) {\r\n if (methodDef.isAbstract === true) {\r\n issues.push(issue_1.Issue.atIdentifier(methodDef.identifier, this.getDescription(IssueType.NotAbstractClass, methodDef.name), this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.CheckAbstract = CheckAbstract;\r\n//# sourceMappingURL=check_abstract.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/check_abstract.js?");
|
|
11360
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CheckAbstract = exports.CheckAbstractConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass CheckAbstractConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.CheckAbstractConf = CheckAbstractConf;\r\nvar IssueType;\r\n(function (IssueType) {\r\n /** Abstract method defined in non-abstract class */\r\n IssueType[IssueType[\"NotAbstractClass\"] = 0] = \"NotAbstractClass\";\r\n IssueType[IssueType[\"AbstractAndFinal\"] = 1] = \"AbstractAndFinal\";\r\n})(IssueType || (IssueType = {}));\r\nclass CheckAbstract extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new CheckAbstractConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"check_abstract\",\r\n title: \"Check abstract methods and classes\",\r\n shortDescription: `Checks abstract methods and classes:\r\n- class defined as abstract and final,\r\n- non-abstract class contains abstract methods`,\r\n extendedInformation: `If a class defines only constants, use an interface instead`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getDescription(issueType, name) {\r\n switch (issueType) {\r\n case IssueType.AbstractAndFinal:\r\n return \"Classes should not be ABSTRACT and FINAL: \" + name;\r\n case IssueType.NotAbstractClass:\r\n return \"Abstract methods require abstract classes: \" + name;\r\n default:\r\n return \"\";\r\n }\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n for (const classDef of file.getInfo().listClassDefinitions()) {\r\n if (classDef.isAbstract === true) {\r\n if (classDef.isFinal === true && classDef.isForTesting === false) {\r\n issues.push(issue_1.Issue.atIdentifier(classDef.identifier, this.getDescription(IssueType.AbstractAndFinal, classDef.name), this.getMetadata().key, this.conf.severity));\r\n }\r\n continue;\r\n }\r\n for (const methodDef of classDef.methods) {\r\n if (methodDef.isAbstract === true) {\r\n issues.push(issue_1.Issue.atIdentifier(methodDef.identifier, this.getDescription(IssueType.NotAbstractClass, methodDef.name), this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.CheckAbstract = CheckAbstract;\r\n//# sourceMappingURL=check_abstract.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/check_abstract.js?");
|
|
11361
11361
|
|
|
11362
11362
|
/***/ }),
|
|
11363
11363
|
|
|
@@ -11368,7 +11368,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11368
11368
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11369
11369
|
|
|
11370
11370
|
"use strict";
|
|
11371
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CheckComments = exports.CheckCommentsConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass CheckCommentsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Allows the use of end-of-line comments. */\r\n this.allowEndOfLine = false;\r\n }\r\n}\r\nexports.CheckCommentsConf = CheckCommentsConf;\r\nvar IssueType;\r\n(function (IssueType) {\r\n IssueType[IssueType[\"EndOfLine\"] = 0] = \"EndOfLine\";\r\n})(IssueType || (IssueType = {}));\r\nclass CheckComments extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new CheckCommentsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"check_comments\",\r\n title: \"Check Comments\",\r\n shortDescription: `\nVarious checks for comment usage.`,\r\n extendedInformation: `\n* End of line comments. Comments starting with \"#EC\" or \"##\" are ignored\n\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#put-comments-before-the-statement-they-relate-to`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getDescription(issueType) {\r\n switch (issueType) {\r\n case IssueType.EndOfLine: return `Do not use end of line comments - move comment to previous row instead`;\r\n default: return \"\";\r\n }\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n const rows = file.getRawRows();\r\n if (this.conf.allowEndOfLine === true) {\r\n return [];\r\n }\r\n const commentRows = [];\r\n for (let i = 0; i < rows.length; i++) {\r\n const row = rows[i];\r\n if (row.trim().startsWith(\"*\") || row.trim().startsWith(`\"`)) {\r\n commentRows.push(i);\r\n }\r\n }\r\n const statements = file.getStatements();\r\n for (let i = statements.length - 1; i >= 0; i--) {\r\n const statement = statements[i];\r\n if (statement.get() instanceof _statement_1.Comment && !commentRows.includes(statement.getStart().getRow() - 1)) {\r\n if (statement.getFirstToken().getStr().startsWith(`\"#EC`)\r\n || statement.getFirstToken().getStr().startsWith(`\"##`)) {\r\n continue;\r\n }\r\n issues.push(issue_1.Issue.atStatement(file, statement, this.getDescription(IssueType.EndOfLine), this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.CheckComments = CheckComments;\r\n//# sourceMappingURL=check_comments.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/check_comments.js?");
|
|
11371
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CheckComments = exports.CheckCommentsConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass CheckCommentsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Allows the use of end-of-line comments. */\r\n this.allowEndOfLine = false;\r\n }\r\n}\r\nexports.CheckCommentsConf = CheckCommentsConf;\r\nvar IssueType;\r\n(function (IssueType) {\r\n IssueType[IssueType[\"EndOfLine\"] = 0] = \"EndOfLine\";\r\n})(IssueType || (IssueType = {}));\r\nclass CheckComments extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new CheckCommentsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"check_comments\",\r\n title: \"Check Comments\",\r\n shortDescription: `\r\nVarious checks for comment usage.`,\r\n extendedInformation: `\r\n* End of line comments. Comments starting with \"#EC\" or \"##\" are ignored\r\n\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#put-comments-before-the-statement-they-relate-to`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getDescription(issueType) {\r\n switch (issueType) {\r\n case IssueType.EndOfLine: return `Do not use end of line comments - move comment to previous row instead`;\r\n default: return \"\";\r\n }\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n const rows = file.getRawRows();\r\n if (this.conf.allowEndOfLine === true) {\r\n return [];\r\n }\r\n const commentRows = [];\r\n for (let i = 0; i < rows.length; i++) {\r\n const row = rows[i];\r\n if (row.trim().startsWith(\"*\") || row.trim().startsWith(`\"`)) {\r\n commentRows.push(i);\r\n }\r\n }\r\n const statements = file.getStatements();\r\n for (let i = statements.length - 1; i >= 0; i--) {\r\n const statement = statements[i];\r\n if (statement.get() instanceof _statement_1.Comment && !commentRows.includes(statement.getStart().getRow() - 1)) {\r\n if (statement.getFirstToken().getStr().startsWith(`\"#EC`)\r\n || statement.getFirstToken().getStr().startsWith(`\"##`)) {\r\n continue;\r\n }\r\n issues.push(issue_1.Issue.atStatement(file, statement, this.getDescription(IssueType.EndOfLine), this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.CheckComments = CheckComments;\r\n//# sourceMappingURL=check_comments.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/check_comments.js?");
|
|
11372
11372
|
|
|
11373
11373
|
/***/ }),
|
|
11374
11374
|
|
|
@@ -11390,7 +11390,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11390
11390
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11391
11391
|
|
|
11392
11392
|
"use strict";
|
|
11393
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CheckInclude = exports.CheckIncludeConf = void 0;\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst include_graph_1 = __webpack_require__(/*! ../utils/include_graph */ \"./node_modules/@abaplint/core/build/src/utils/include_graph.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass CheckIncludeConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.CheckIncludeConf = CheckIncludeConf;\r\nclass CheckInclude {\r\n constructor() {\r\n this.conf = new CheckIncludeConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"check_include\",\r\n title: \"Check INCLUDEs\",\r\n shortDescription: `Checks INCLUDE statements`,\r\n extendedInformation: `\n* Reports unused includes\n* Errors if the includes are not found\n* Error if including a main program`,\r\n tags: [_irule_1.RuleTag.Syntax],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n this.graph = new include_graph_1.IncludeGraph(this.reg);\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof _abap_object_1.ABAPObject)) {\r\n return [];\r\n }\r\n let ret = [];\r\n for (const file of obj.getABAPFiles()) {\r\n ret = ret.concat(this.graph.getIssuesFile(file));\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.CheckInclude = CheckInclude;\r\n//# sourceMappingURL=check_include.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/check_include.js?");
|
|
11393
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CheckInclude = exports.CheckIncludeConf = void 0;\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst include_graph_1 = __webpack_require__(/*! ../utils/include_graph */ \"./node_modules/@abaplint/core/build/src/utils/include_graph.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass CheckIncludeConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.CheckIncludeConf = CheckIncludeConf;\r\nclass CheckInclude {\r\n constructor() {\r\n this.conf = new CheckIncludeConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"check_include\",\r\n title: \"Check INCLUDEs\",\r\n shortDescription: `Checks INCLUDE statements`,\r\n extendedInformation: `\r\n* Reports unused includes\r\n* Errors if the includes are not found\r\n* Error if including a main program`,\r\n tags: [_irule_1.RuleTag.Syntax],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n this.graph = new include_graph_1.IncludeGraph(this.reg);\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof _abap_object_1.ABAPObject)) {\r\n return [];\r\n }\r\n let ret = [];\r\n for (const file of obj.getABAPFiles()) {\r\n ret = ret.concat(this.graph.getIssuesFile(file));\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.CheckInclude = CheckInclude;\r\n//# sourceMappingURL=check_include.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/check_include.js?");
|
|
11394
11394
|
|
|
11395
11395
|
/***/ }),
|
|
11396
11396
|
|
|
@@ -11401,7 +11401,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11401
11401
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11402
11402
|
|
|
11403
11403
|
"use strict";
|
|
11404
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CheckNoHandlerPragma = exports.CheckNoHandlerPragmaConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass CheckNoHandlerPragmaConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.CheckNoHandlerPragmaConf = CheckNoHandlerPragmaConf;\r\nclass CheckNoHandlerPragma extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new CheckNoHandlerPragmaConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"check_no_handler_pragma\",\r\n title: \"Check if NO_HANDLER can be removed\",\r\n shortDescription: `Checks NO_HANDLER pragmas that can be removed`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: `TRY.\n ...\n CATCH zcx_abapgit_exception ##NO_HANDLER.\n RETURN. \" it has a handler\nENDTRY.`,\r\n goodExample: `TRY.\n ...\n CATCH zcx_abapgit_exception.\n RETURN.\nENDTRY.`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n let noHandler = false;\r\n const statements = file.getStatements();\r\n for (let i = 0; i < statements.length; i++) {\r\n const statement = statements[i];\r\n if (statement.get() instanceof Statements.EndTry) {\r\n noHandler = false;\r\n }\r\n else if (statement.get() instanceof _statement_1.Comment) {\r\n continue;\r\n }\r\n else if (noHandler === true && !(statement.get() instanceof Statements.Catch)) {\r\n const message = \"NO_HANDLER pragma or pseudo comment can be removed\";\r\n const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n noHandler = false;\r\n }\r\n else {\r\n noHandler = this.containsNoHandler(statement, statements[i + 1]);\r\n }\r\n }\r\n return issues;\r\n }\r\n containsNoHandler(statement, next) {\r\n for (const t of statement.getPragmas()) {\r\n if (t.getStr().toUpperCase() === \"##NO_HANDLER\") {\r\n return true;\r\n }\r\n }\r\n if (next\r\n && next.get() instanceof _statement_1.Comment\r\n && next.concatTokens().toUpperCase().includes(\"#EC NO_HANDLER\")) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n}\r\nexports.CheckNoHandlerPragma = CheckNoHandlerPragma;\r\n//# sourceMappingURL=check_no_handler_pragma.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/check_no_handler_pragma.js?");
|
|
11404
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CheckNoHandlerPragma = exports.CheckNoHandlerPragmaConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass CheckNoHandlerPragmaConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.CheckNoHandlerPragmaConf = CheckNoHandlerPragmaConf;\r\nclass CheckNoHandlerPragma extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new CheckNoHandlerPragmaConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"check_no_handler_pragma\",\r\n title: \"Check if NO_HANDLER can be removed\",\r\n shortDescription: `Checks NO_HANDLER pragmas that can be removed`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: `TRY.\r\n ...\r\n CATCH zcx_abapgit_exception ##NO_HANDLER.\r\n RETURN. \" it has a handler\r\nENDTRY.`,\r\n goodExample: `TRY.\r\n ...\r\n CATCH zcx_abapgit_exception.\r\n RETURN.\r\nENDTRY.`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n let noHandler = false;\r\n const statements = file.getStatements();\r\n for (let i = 0; i < statements.length; i++) {\r\n const statement = statements[i];\r\n if (statement.get() instanceof Statements.EndTry) {\r\n noHandler = false;\r\n }\r\n else if (statement.get() instanceof _statement_1.Comment) {\r\n continue;\r\n }\r\n else if (noHandler === true && !(statement.get() instanceof Statements.Catch)) {\r\n const message = \"NO_HANDLER pragma or pseudo comment can be removed\";\r\n const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n noHandler = false;\r\n }\r\n else {\r\n noHandler = this.containsNoHandler(statement, statements[i + 1]);\r\n }\r\n }\r\n return issues;\r\n }\r\n containsNoHandler(statement, next) {\r\n for (const t of statement.getPragmas()) {\r\n if (t.getStr().toUpperCase() === \"##NO_HANDLER\") {\r\n return true;\r\n }\r\n }\r\n if (next\r\n && next.get() instanceof _statement_1.Comment\r\n && next.concatTokens().toUpperCase().includes(\"#EC NO_HANDLER\")) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n}\r\nexports.CheckNoHandlerPragma = CheckNoHandlerPragma;\r\n//# sourceMappingURL=check_no_handler_pragma.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/check_no_handler_pragma.js?");
|
|
11405
11405
|
|
|
11406
11406
|
/***/ }),
|
|
11407
11407
|
|
|
@@ -11412,7 +11412,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11412
11412
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11413
11413
|
|
|
11414
11414
|
"use strict";
|
|
11415
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CheckSubrc = exports.CheckSubrcConf = void 0;\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nclass CheckSubrcConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n this.openDataset = true;\r\n this.authorityCheck = true;\r\n this.selectSingle = true;\r\n this.selectTable = true;\r\n this.updateDatabase = true;\r\n this.insertDatabase = true;\r\n this.modifyDatabase = true;\r\n this.readTable = true;\r\n this.assign = true;\r\n this.find = true;\r\n }\r\n}\r\nexports.CheckSubrcConf = CheckSubrcConf;\r\nclass CheckSubrc extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new CheckSubrcConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"check_subrc\",\r\n title: \"Check sy-subrc\",\r\n shortDescription: `Check sy-subrc`,\r\n extendedInformation: `Pseudo comment \"#EC CI_SUBRC can be added to suppress findings\n\nIf sy-dbcnt is checked after database statements, it is considered okay.\n\n\"SELECT SINGLE @abap_true FROM \" is considered as an existence check\n\nIf IS ASSIGNED is checked after assigning, it is considered okay.\n\nFIND statement with MATCH COUNT is considered okay if subrc is not checked`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n pseudoComment: \"EC CI_SUBRC\",\r\n pragma: \"##SUBRC_OK\",\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n const statements = file.getStatements();\r\n const message = \"Check sy-subrc\";\r\n const config = this.getConfig();\r\n for (let i = 0; i < statements.length; i++) {\r\n const statement = statements[i];\r\n // todo: CALL FUNCTION\r\n if (statement.getPragmas().some(t => t.getStr() === this.getMetadata().pragma)) {\r\n continue;\r\n }\r\n if (config.openDataset === true\r\n && statement.get() instanceof Statements.OpenDataset\r\n && this.isChecked(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.authorityCheck === true\r\n && statement.get() instanceof Statements.AuthorityCheck\r\n && this.isChecked(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.selectSingle === true\r\n && statement.get() instanceof Statements.Select\r\n && statement.concatTokens().toUpperCase().startsWith(\"SELECT SINGLE \")\r\n && this.isChecked(i, statements) === false\r\n && this.checksDbcnt(i, statements) === false) {\r\n const concat = statement.concatTokens().toUpperCase();\r\n if (concat.startsWith(\"SELECT SINGLE @ABAP_TRUE FROM \")) {\r\n continue;\r\n }\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.selectTable === true\r\n && statement.get() instanceof Statements.Select\r\n && statement.concatTokens().toUpperCase().startsWith(\"SELECT SINGLE \") === false\r\n && this.isChecked(i, statements) === false\r\n && this.checksDbcnt(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.updateDatabase === true\r\n && statement.get() instanceof Statements.UpdateDatabase\r\n && this.isChecked(i, statements) === false\r\n && this.checksDbcnt(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.insertDatabase === true\r\n && statement.get() instanceof Statements.InsertDatabase\r\n && this.isChecked(i, statements) === false\r\n && this.checksDbcnt(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.modifyDatabase === true\r\n && statement.get() instanceof Statements.ModifyDatabase\r\n && this.isChecked(i, statements) === false\r\n && this.checksDbcnt(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.readTable === true\r\n && statement.get() instanceof Statements.ReadTable\r\n && this.isChecked(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.assign === true\r\n && statement.get() instanceof Statements.Assign\r\n && this.isChecked(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.find === true\r\n && statement.get() instanceof Statements.Find\r\n && this.isExemptedFind(statement) === false\r\n && this.isChecked(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n return issues;\r\n }\r\n ////////////////\r\n isExemptedFind(s) {\r\n // see https://github.com/abaplint/abaplint/issues/2130\r\n return s.concatTokens().toUpperCase().includes(\" MATCH COUNT \") === true;\r\n }\r\n checksDbcnt(index, statements) {\r\n for (let i = index + 1; i < statements.length; i++) {\r\n const statement = statements[i];\r\n const concat = statement.concatTokens().toUpperCase();\r\n if (statement.get() instanceof _statement_1.Comment) {\r\n continue;\r\n }\r\n else if (statement.get() instanceof Statements.EndIf) {\r\n continue;\r\n }\r\n else {\r\n return concat.includes(\"SY-DBCNT\");\r\n }\r\n }\r\n return false;\r\n }\r\n isChecked(index, statements) {\r\n var _a, _b;\r\n let assigned = undefined;\r\n let assignedn = undefined;\r\n if (statements[index].get() instanceof Statements.Assign\r\n || statements[index].get() instanceof Statements.ReadTable) {\r\n const fs = (_b = (_a = statements[index].findFirstExpression(Expressions.FSTarget)) === null || _a === void 0 ? void 0 : _a.findFirstExpression(Expressions.FieldSymbol)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr();\r\n assigned = (fs === null || fs === void 0 ? void 0 : fs.toUpperCase()) + \" IS ASSIGNED\";\r\n assignedn = (fs === null || fs === void 0 ? void 0 : fs.toUpperCase()) + \" IS NOT ASSIGNED\";\r\n }\r\n for (let i = index + 1; i < statements.length; i++) {\r\n const statement = statements[i];\r\n const concat = statement.concatTokens().toUpperCase();\r\n if (statement.get() instanceof _statement_1.Comment) {\r\n if (concat.includes(\"\" + this.getMetadata().pseudoComment)) {\r\n return true;\r\n }\r\n }\r\n else if (statement.get() instanceof Statements.EndIf) {\r\n continue;\r\n }\r\n else {\r\n if (assigned && concat.includes(assigned)) {\r\n return true;\r\n }\r\n if (assignedn && concat.includes(assignedn)) {\r\n return true;\r\n }\r\n return concat.includes(\" SY-SUBRC\")\r\n || concat.includes(\"CL_ABAP_UNIT_ASSERT=>ASSERT_SUBRC\");\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\nexports.CheckSubrc = CheckSubrc;\r\n//# sourceMappingURL=check_subrc.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/check_subrc.js?");
|
|
11415
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CheckSubrc = exports.CheckSubrcConf = void 0;\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nclass CheckSubrcConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n this.openDataset = true;\r\n this.authorityCheck = true;\r\n this.selectSingle = true;\r\n this.selectTable = true;\r\n this.updateDatabase = true;\r\n this.insertDatabase = true;\r\n this.modifyDatabase = true;\r\n this.readTable = true;\r\n this.assign = true;\r\n this.find = true;\r\n }\r\n}\r\nexports.CheckSubrcConf = CheckSubrcConf;\r\nclass CheckSubrc extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new CheckSubrcConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"check_subrc\",\r\n title: \"Check sy-subrc\",\r\n shortDescription: `Check sy-subrc`,\r\n extendedInformation: `Pseudo comment \"#EC CI_SUBRC can be added to suppress findings\r\n\r\nIf sy-dbcnt is checked after database statements, it is considered okay.\r\n\r\n\"SELECT SINGLE @abap_true FROM \" is considered as an existence check\r\n\r\nIf IS ASSIGNED is checked after assigning, it is considered okay.\r\n\r\nFIND statement with MATCH COUNT is considered okay if subrc is not checked`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n pseudoComment: \"EC CI_SUBRC\",\r\n pragma: \"##SUBRC_OK\",\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n const statements = file.getStatements();\r\n const message = \"Check sy-subrc\";\r\n const config = this.getConfig();\r\n for (let i = 0; i < statements.length; i++) {\r\n const statement = statements[i];\r\n // todo: CALL FUNCTION\r\n if (statement.getPragmas().some(t => t.getStr() === this.getMetadata().pragma)) {\r\n continue;\r\n }\r\n if (config.openDataset === true\r\n && statement.get() instanceof Statements.OpenDataset\r\n && this.isChecked(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.authorityCheck === true\r\n && statement.get() instanceof Statements.AuthorityCheck\r\n && this.isChecked(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.selectSingle === true\r\n && statement.get() instanceof Statements.Select\r\n && statement.concatTokens().toUpperCase().startsWith(\"SELECT SINGLE \")\r\n && this.isChecked(i, statements) === false\r\n && this.checksDbcnt(i, statements) === false) {\r\n const concat = statement.concatTokens().toUpperCase();\r\n if (concat.startsWith(\"SELECT SINGLE @ABAP_TRUE FROM \")) {\r\n continue;\r\n }\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.selectTable === true\r\n && statement.get() instanceof Statements.Select\r\n && statement.concatTokens().toUpperCase().startsWith(\"SELECT SINGLE \") === false\r\n && this.isChecked(i, statements) === false\r\n && this.checksDbcnt(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.updateDatabase === true\r\n && statement.get() instanceof Statements.UpdateDatabase\r\n && this.isChecked(i, statements) === false\r\n && this.checksDbcnt(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.insertDatabase === true\r\n && statement.get() instanceof Statements.InsertDatabase\r\n && this.isChecked(i, statements) === false\r\n && this.checksDbcnt(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.modifyDatabase === true\r\n && statement.get() instanceof Statements.ModifyDatabase\r\n && this.isChecked(i, statements) === false\r\n && this.checksDbcnt(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.readTable === true\r\n && statement.get() instanceof Statements.ReadTable\r\n && this.isChecked(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.assign === true\r\n && statement.get() instanceof Statements.Assign\r\n && this.isChecked(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.find === true\r\n && statement.get() instanceof Statements.Find\r\n && this.isExemptedFind(statement) === false\r\n && this.isChecked(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n return issues;\r\n }\r\n ////////////////\r\n isExemptedFind(s) {\r\n // see https://github.com/abaplint/abaplint/issues/2130\r\n return s.concatTokens().toUpperCase().includes(\" MATCH COUNT \") === true;\r\n }\r\n checksDbcnt(index, statements) {\r\n for (let i = index + 1; i < statements.length; i++) {\r\n const statement = statements[i];\r\n const concat = statement.concatTokens().toUpperCase();\r\n if (statement.get() instanceof _statement_1.Comment) {\r\n continue;\r\n }\r\n else if (statement.get() instanceof Statements.EndIf) {\r\n continue;\r\n }\r\n else {\r\n return concat.includes(\"SY-DBCNT\");\r\n }\r\n }\r\n return false;\r\n }\r\n isChecked(index, statements) {\r\n var _a, _b;\r\n let assigned = undefined;\r\n let assignedn = undefined;\r\n if (statements[index].get() instanceof Statements.Assign\r\n || statements[index].get() instanceof Statements.ReadTable) {\r\n const fs = (_b = (_a = statements[index].findFirstExpression(Expressions.FSTarget)) === null || _a === void 0 ? void 0 : _a.findFirstExpression(Expressions.FieldSymbol)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr();\r\n assigned = (fs === null || fs === void 0 ? void 0 : fs.toUpperCase()) + \" IS ASSIGNED\";\r\n assignedn = (fs === null || fs === void 0 ? void 0 : fs.toUpperCase()) + \" IS NOT ASSIGNED\";\r\n }\r\n for (let i = index + 1; i < statements.length; i++) {\r\n const statement = statements[i];\r\n const concat = statement.concatTokens().toUpperCase();\r\n if (statement.get() instanceof _statement_1.Comment) {\r\n if (concat.includes(\"\" + this.getMetadata().pseudoComment)) {\r\n return true;\r\n }\r\n }\r\n else if (statement.get() instanceof Statements.EndIf) {\r\n continue;\r\n }\r\n else {\r\n if (assigned && concat.includes(assigned)) {\r\n return true;\r\n }\r\n if (assignedn && concat.includes(assignedn)) {\r\n return true;\r\n }\r\n return concat.includes(\" SY-SUBRC\")\r\n || concat.includes(\"CL_ABAP_UNIT_ASSERT=>ASSERT_SUBRC\");\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\nexports.CheckSubrc = CheckSubrc;\r\n//# sourceMappingURL=check_subrc.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/check_subrc.js?");
|
|
11416
11416
|
|
|
11417
11417
|
/***/ }),
|
|
11418
11418
|
|
|
@@ -11489,7 +11489,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11489
11489
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11490
11490
|
|
|
11491
11491
|
"use strict";
|
|
11492
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CommentedCode = exports.CommentedCodeConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst statements_1 = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst abap_parser_1 = __webpack_require__(/*! ../abap/abap_parser */ \"./node_modules/@abaplint/core/build/src/abap/abap_parser.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst memory_file_1 = __webpack_require__(/*! ../files/memory_file */ \"./node_modules/@abaplint/core/build/src/files/memory_file.js\");\r\nclass CommentedCodeConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Allow INCLUDEs in function groups */\r\n this.allowIncludeInFugr = true;\r\n }\r\n}\r\nexports.CommentedCodeConf = CommentedCodeConf;\r\nclass CommentedCode extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new CommentedCodeConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"commented_code\",\r\n title: \"Find commented code\",\r\n shortDescription: `Detects usage of commented out code.`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#delete-code-instead-of-commenting-it\nhttps://docs.abapopenchecks.org/checks/14/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getMessage() {\r\n return \"Commented code\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file, obj) {\r\n let issues = [];\r\n const rows = file.getRawRows();\r\n let code = \"\";\r\n let posEnd = undefined;\r\n let posStart = undefined;\r\n for (let i = 0; i < rows.length; i++) {\r\n if (this.isCommentLine(rows[i])) {\r\n if (code === \"\") {\r\n posStart = new position_1.Position(i + 1, 1);\r\n }\r\n code = code + rows[i].trim().substr(1) + \"\\n\";\r\n posEnd = new position_1.Position(i + 1, rows[i].length + 1);\r\n }\r\n else if (code !== \"\" && posStart && posEnd) {\r\n issues = issues.concat(this.check(code.trim(), file, posStart, posEnd, obj));\r\n code = \"\";\r\n }\r\n }\r\n if (posStart && posEnd) {\r\n issues = issues.concat(this.check(code.trim(), file, posStart, posEnd, obj));\r\n }\r\n return issues;\r\n }\r\n check(code, file, posStart, posEnd, obj) {\r\n // assumption: code must end with \".\" in order to be valid ABAP\r\n if (code === \"\" || code.charAt(code.length - 1) !== \".\") {\r\n return [];\r\n }\r\n const commented = new memory_file_1.MemoryFile(\"_foobar.prog.abap\", code);\r\n const abapFile = new abap_parser_1.ABAPParser().parse([commented]).output[0];\r\n const statementNodes = abapFile.getStatements();\r\n if (statementNodes.length === 0) {\r\n return [];\r\n }\r\n let containsStatement = false;\r\n for (const statementNode of statementNodes) {\r\n const statement = statementNode.get();\r\n if (this.getConfig().allowIncludeInFugr === true\r\n && obj instanceof objects_1.FunctionGroup\r\n && statement instanceof statements_1.Include) {\r\n continue;\r\n }\r\n if (!(statement instanceof _statement_1.Unknown\r\n || statement instanceof _statement_1.Empty\r\n || statement instanceof _statement_1.Comment)) {\r\n containsStatement = true;\r\n break;\r\n }\r\n }\r\n if (!containsStatement) {\r\n return [];\r\n }\r\n const fix = edit_helper_1.EditHelper.deleteRange(file, posStart, posEnd);\r\n const issue = issue_1.Issue.atRange(file, posStart, posEnd, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n return [issue];\r\n }\r\n isCommentLine(text) {\r\n return (text.substr(0, 1) === \"*\")\r\n || (text.trim().substr(0, 1) === \"\\\"\" && text.trim().substr(1, 1) !== \"!\");\r\n }\r\n}\r\nexports.CommentedCode = CommentedCode;\r\n//# sourceMappingURL=commented_code.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/commented_code.js?");
|
|
11492
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CommentedCode = exports.CommentedCodeConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst statements_1 = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst abap_parser_1 = __webpack_require__(/*! ../abap/abap_parser */ \"./node_modules/@abaplint/core/build/src/abap/abap_parser.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst memory_file_1 = __webpack_require__(/*! ../files/memory_file */ \"./node_modules/@abaplint/core/build/src/files/memory_file.js\");\r\nclass CommentedCodeConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Allow INCLUDEs in function groups */\r\n this.allowIncludeInFugr = true;\r\n }\r\n}\r\nexports.CommentedCodeConf = CommentedCodeConf;\r\nclass CommentedCode extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new CommentedCodeConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"commented_code\",\r\n title: \"Find commented code\",\r\n shortDescription: `Detects usage of commented out code.`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#delete-code-instead-of-commenting-it\r\nhttps://docs.abapopenchecks.org/checks/14/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getMessage() {\r\n return \"Commented code\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file, obj) {\r\n let issues = [];\r\n const rows = file.getRawRows();\r\n let code = \"\";\r\n let posEnd = undefined;\r\n let posStart = undefined;\r\n for (let i = 0; i < rows.length; i++) {\r\n if (this.isCommentLine(rows[i])) {\r\n if (code === \"\") {\r\n posStart = new position_1.Position(i + 1, 1);\r\n }\r\n code = code + rows[i].trim().substr(1) + \"\\n\";\r\n posEnd = new position_1.Position(i + 1, rows[i].length + 1);\r\n }\r\n else if (code !== \"\" && posStart && posEnd) {\r\n issues = issues.concat(this.check(code.trim(), file, posStart, posEnd, obj));\r\n code = \"\";\r\n }\r\n }\r\n if (posStart && posEnd) {\r\n issues = issues.concat(this.check(code.trim(), file, posStart, posEnd, obj));\r\n }\r\n return issues;\r\n }\r\n check(code, file, posStart, posEnd, obj) {\r\n // assumption: code must end with \".\" in order to be valid ABAP\r\n if (code === \"\" || code.charAt(code.length - 1) !== \".\") {\r\n return [];\r\n }\r\n const commented = new memory_file_1.MemoryFile(\"_foobar.prog.abap\", code);\r\n const abapFile = new abap_parser_1.ABAPParser().parse([commented]).output[0];\r\n const statementNodes = abapFile.getStatements();\r\n if (statementNodes.length === 0) {\r\n return [];\r\n }\r\n let containsStatement = false;\r\n for (const statementNode of statementNodes) {\r\n const statement = statementNode.get();\r\n if (this.getConfig().allowIncludeInFugr === true\r\n && obj instanceof objects_1.FunctionGroup\r\n && statement instanceof statements_1.Include) {\r\n continue;\r\n }\r\n if (!(statement instanceof _statement_1.Unknown\r\n || statement instanceof _statement_1.Empty\r\n || statement instanceof _statement_1.Comment)) {\r\n containsStatement = true;\r\n break;\r\n }\r\n }\r\n if (!containsStatement) {\r\n return [];\r\n }\r\n const fix = edit_helper_1.EditHelper.deleteRange(file, posStart, posEnd);\r\n const issue = issue_1.Issue.atRange(file, posStart, posEnd, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n return [issue];\r\n }\r\n isCommentLine(text) {\r\n return (text.substr(0, 1) === \"*\")\r\n || (text.trim().substr(0, 1) === \"\\\"\" && text.trim().substr(1, 1) !== \"!\");\r\n }\r\n}\r\nexports.CommentedCode = CommentedCode;\r\n//# sourceMappingURL=commented_code.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/commented_code.js?");
|
|
11493
11493
|
|
|
11494
11494
|
/***/ }),
|
|
11495
11495
|
|
|
@@ -11511,7 +11511,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11511
11511
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11512
11512
|
|
|
11513
11513
|
"use strict";
|
|
11514
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ConstructorVisibilityPublic = exports.ConstructorVisibilityPublicConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst visibility_1 = __webpack_require__(/*! ../abap/4_file_information/visibility */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js\");\r\nclass ConstructorVisibilityPublicConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.ConstructorVisibilityPublicConf = ConstructorVisibilityPublicConf;\r\nclass ConstructorVisibilityPublic {\r\n constructor() {\r\n this.conf = new ConstructorVisibilityPublicConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"constructor_visibility_public\",\r\n title: \"Check constructor visibility is public\",\r\n shortDescription: `Constructor must be placed in the public section, even if the class is not CREATE PUBLIC.`,\r\n extendedInformation: `\nThis only applies to global classes.\n\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#if-your-global-class-is-create-private-leave-the-constructor-public\nhttps://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abeninstance_constructor_guidl.htm`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getMessage() {\r\n return \"Constructor visibility should be public\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n initialize(_reg) {\r\n return this;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n run(obj) {\r\n const issues = [];\r\n if (!(obj instanceof objects_1.Class)) {\r\n return [];\r\n }\r\n const def = obj.getClassDefinition();\r\n if (def === undefined) {\r\n return [];\r\n }\r\n for (const method of def.methods) {\r\n if (method.name.toUpperCase() === \"CONSTRUCTOR\"\r\n && method.visibility !== visibility_1.Visibility.Public) {\r\n const issue = issue_1.Issue.atIdentifier(method.identifier, this.getMessage(), this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.ConstructorVisibilityPublic = ConstructorVisibilityPublic;\r\n//# sourceMappingURL=constructor_visibility_public.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/constructor_visibility_public.js?");
|
|
11514
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ConstructorVisibilityPublic = exports.ConstructorVisibilityPublicConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst visibility_1 = __webpack_require__(/*! ../abap/4_file_information/visibility */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js\");\r\nclass ConstructorVisibilityPublicConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.ConstructorVisibilityPublicConf = ConstructorVisibilityPublicConf;\r\nclass ConstructorVisibilityPublic {\r\n constructor() {\r\n this.conf = new ConstructorVisibilityPublicConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"constructor_visibility_public\",\r\n title: \"Check constructor visibility is public\",\r\n shortDescription: `Constructor must be placed in the public section, even if the class is not CREATE PUBLIC.`,\r\n extendedInformation: `\r\nThis only applies to global classes.\r\n\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#if-your-global-class-is-create-private-leave-the-constructor-public\r\nhttps://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abeninstance_constructor_guidl.htm`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getMessage() {\r\n return \"Constructor visibility should be public\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n initialize(_reg) {\r\n return this;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n run(obj) {\r\n const issues = [];\r\n if (!(obj instanceof objects_1.Class)) {\r\n return [];\r\n }\r\n const def = obj.getClassDefinition();\r\n if (def === undefined) {\r\n return [];\r\n }\r\n for (const method of def.methods) {\r\n if (method.name.toUpperCase() === \"CONSTRUCTOR\"\r\n && method.visibility !== visibility_1.Visibility.Public) {\r\n const issue = issue_1.Issue.atIdentifier(method.identifier, this.getMessage(), this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.ConstructorVisibilityPublic = ConstructorVisibilityPublic;\r\n//# sourceMappingURL=constructor_visibility_public.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/constructor_visibility_public.js?");
|
|
11515
11515
|
|
|
11516
11516
|
/***/ }),
|
|
11517
11517
|
|
|
@@ -11522,7 +11522,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11522
11522
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11523
11523
|
|
|
11524
11524
|
"use strict";
|
|
11525
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ContainsTab = exports.ContainsTabConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass ContainsTabConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** quick fix replace with number of spaces */\r\n this.spaces = 1;\r\n }\r\n}\r\nexports.ContainsTabConf = ContainsTabConf;\r\nclass ContainsTab extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ContainsTabConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"contains_tab\",\r\n title: \"Code contains tab\",\r\n shortDescription: `Checks for usage of tabs (enable to enforce spaces)`,\r\n extendedInformation: `\nhttps://docs.abapopenchecks.org/checks/09/\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#indent-and-snap-to-tab`,\r\n tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getMessage() {\r\n return \"Code should not contain tabs\";\r\n }\r\n getConfig() {\r\n if (this.conf.spaces === undefined) {\r\n this.conf.spaces = 1;\r\n }\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n const lines = file.getRaw().split(\"\\n\");\r\n lines.forEach((_, i) => {\r\n const tabCol = lines[i].indexOf(\"\\t\");\r\n if (tabCol >= 0) {\r\n let tabAmount = 1;\r\n while (lines[i].indexOf(\"\\t\", tabCol + tabAmount - 1) >= 0) {\r\n tabAmount++;\r\n }\r\n issues.push(this.createIssue(i, tabCol, tabAmount, file));\r\n }\r\n });\r\n return issues;\r\n }\r\n createIssue(line, tabCol, tabAmount, file) {\r\n const tabStartPos = new position_1.Position(line + 1, tabCol + 1);\r\n const tabEndPos = new position_1.Position(line + 1, tabCol + tabAmount);\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, tabStartPos, tabEndPos, \" \".repeat(this.getConfig().spaces));\r\n return issue_1.Issue.atRange(file, tabStartPos, tabEndPos, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n}\r\nexports.ContainsTab = ContainsTab;\r\n//# sourceMappingURL=contains_tab.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/contains_tab.js?");
|
|
11525
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ContainsTab = exports.ContainsTabConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass ContainsTabConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** quick fix replace with number of spaces */\r\n this.spaces = 1;\r\n }\r\n}\r\nexports.ContainsTabConf = ContainsTabConf;\r\nclass ContainsTab extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ContainsTabConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"contains_tab\",\r\n title: \"Code contains tab\",\r\n shortDescription: `Checks for usage of tabs (enable to enforce spaces)`,\r\n extendedInformation: `\r\nhttps://docs.abapopenchecks.org/checks/09/\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#indent-and-snap-to-tab`,\r\n tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getMessage() {\r\n return \"Code should not contain tabs\";\r\n }\r\n getConfig() {\r\n if (this.conf.spaces === undefined) {\r\n this.conf.spaces = 1;\r\n }\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n const lines = file.getRaw().split(\"\\n\");\r\n lines.forEach((_, i) => {\r\n const tabCol = lines[i].indexOf(\"\\t\");\r\n if (tabCol >= 0) {\r\n let tabAmount = 1;\r\n while (lines[i].indexOf(\"\\t\", tabCol + tabAmount - 1) >= 0) {\r\n tabAmount++;\r\n }\r\n issues.push(this.createIssue(i, tabCol, tabAmount, file));\r\n }\r\n });\r\n return issues;\r\n }\r\n createIssue(line, tabCol, tabAmount, file) {\r\n const tabStartPos = new position_1.Position(line + 1, tabCol + 1);\r\n const tabEndPos = new position_1.Position(line + 1, tabCol + tabAmount);\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, tabStartPos, tabEndPos, \" \".repeat(this.getConfig().spaces));\r\n return issue_1.Issue.atRange(file, tabStartPos, tabEndPos, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n}\r\nexports.ContainsTab = ContainsTab;\r\n//# sourceMappingURL=contains_tab.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/contains_tab.js?");
|
|
11526
11526
|
|
|
11527
11527
|
/***/ }),
|
|
11528
11528
|
|
|
@@ -11555,7 +11555,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11555
11555
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11556
11556
|
|
|
11557
11557
|
"use strict";
|
|
11558
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DangerousStatement = exports.DangerousStatementConf = void 0;\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass DangerousStatementConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Detects execSQL (dynamic SQL) */\r\n this.execSQL = true;\r\n /** Detects kernel calls */\r\n this.kernelCall = true;\r\n /** Detects SYSTEM-CALL */\r\n this.systemCall = true;\r\n /** Detects INSERT REPORT */\r\n this.insertReport = true;\r\n this.generateDynpro = true;\r\n this.generateReport = true;\r\n this.generateSubroutine = true;\r\n this.deleteReport = true;\r\n this.deleteTextpool = true;\r\n this.deleteDynpro = true;\r\n this.importDynpro = true;\r\n /** Finds instances of dynamic SQL: SELECT, UPDATE, DELETE, INSERT, MODIFY */\r\n this.dynamicSQL = true;\r\n }\r\n}\r\nexports.DangerousStatementConf = DangerousStatementConf;\r\nclass DangerousStatement extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new DangerousStatementConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"dangerous_statement\",\r\n title: \"Dangerous statement\",\r\n shortDescription: `Detects potentially dangerous statements`,\r\n extendedInformation: `Dynamic SQL: Typically ABAP logic does not need dynamic SQL,\ndynamic SQL can potentially create SQL injection problems`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Security],\r\n };\r\n }\r\n getDescription(statement) {\r\n return \"Potential dangerous statement \" + statement;\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n for (const statementNode of file.getStatements()) {\r\n const statement = statementNode.get();\r\n let message = undefined;\r\n if (this.conf.execSQL && statement instanceof Statements.ExecSQL) {\r\n message = \"EXEC SQL\";\r\n }\r\n else if (this.conf.kernelCall && statement instanceof Statements.CallKernel) {\r\n message = \"KERNEL CALL\";\r\n }\r\n else if (this.conf.systemCall && statement instanceof Statements.SystemCall) {\r\n message = \"SYSTEM-CALL\";\r\n }\r\n else if (this.conf.insertReport && statement instanceof Statements.InsertReport) {\r\n message = \"INSERT REPORT\";\r\n }\r\n else if (this.conf.generateDynpro && statement instanceof Statements.GenerateDynpro) {\r\n message = \"GENERATE DYNPRO\";\r\n }\r\n else if (this.conf.generateReport && statement instanceof Statements.GenerateReport) {\r\n message = \"GENERATE REPORT\";\r\n }\r\n else if (this.conf.generateSubroutine && statement instanceof Statements.GenerateSubroutine) {\r\n message = \"GENERATE SUBROUTINE\";\r\n }\r\n else if (this.conf.deleteReport && statement instanceof Statements.DeleteReport) {\r\n message = \"DELETE REPORT\";\r\n }\r\n else if (this.conf.deleteTextpool && statement instanceof Statements.DeleteTextpool) {\r\n message = \"DELETE TEXTPOOL\";\r\n }\r\n else if (this.conf.deleteDynpro && statement instanceof Statements.DeleteDynpro) {\r\n message = \"DELETE DYNPRO\";\r\n }\r\n else if (this.conf.importDynpro && statement instanceof Statements.ImportDynpro) {\r\n message = \"IMPORT DYNPRO\";\r\n }\r\n if (message) {\r\n issues.push(issue_1.Issue.atStatement(file, statementNode, this.getDescription(message), this.getMetadata().key, this.conf.severity));\r\n }\r\n if (this.conf.dynamicSQL) {\r\n message = this.findDynamicSQL(statementNode);\r\n if (message) {\r\n issues.push(issue_1.Issue.atStatement(file, statementNode, this.getDescription(message), this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n findDynamicSQL(statementNode) {\r\n const statement = statementNode.get();\r\n if (statement instanceof Statements.UpdateDatabase\r\n || statement instanceof Statements.Select\r\n || statement instanceof Statements.SelectLoop\r\n || statement instanceof Statements.InsertDatabase\r\n || statement instanceof Statements.ModifyDatabase\r\n || statement instanceof Statements.DeleteDatabase) {\r\n if (statementNode.findFirstExpression(Expressions.Dynamic)) {\r\n return \"Dynamic SQL\";\r\n }\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.DangerousStatement = DangerousStatement;\r\n//# sourceMappingURL=dangerous_statement.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/dangerous_statement.js?");
|
|
11558
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DangerousStatement = exports.DangerousStatementConf = void 0;\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass DangerousStatementConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Detects execSQL (dynamic SQL) */\r\n this.execSQL = true;\r\n /** Detects kernel calls */\r\n this.kernelCall = true;\r\n /** Detects SYSTEM-CALL */\r\n this.systemCall = true;\r\n /** Detects INSERT REPORT */\r\n this.insertReport = true;\r\n this.generateDynpro = true;\r\n this.generateReport = true;\r\n this.generateSubroutine = true;\r\n this.deleteReport = true;\r\n this.deleteTextpool = true;\r\n this.deleteDynpro = true;\r\n this.importDynpro = true;\r\n /** Finds instances of dynamic SQL: SELECT, UPDATE, DELETE, INSERT, MODIFY */\r\n this.dynamicSQL = true;\r\n }\r\n}\r\nexports.DangerousStatementConf = DangerousStatementConf;\r\nclass DangerousStatement extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new DangerousStatementConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"dangerous_statement\",\r\n title: \"Dangerous statement\",\r\n shortDescription: `Detects potentially dangerous statements`,\r\n extendedInformation: `Dynamic SQL: Typically ABAP logic does not need dynamic SQL,\r\ndynamic SQL can potentially create SQL injection problems`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Security],\r\n };\r\n }\r\n getDescription(statement) {\r\n return \"Potential dangerous statement \" + statement;\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n for (const statementNode of file.getStatements()) {\r\n const statement = statementNode.get();\r\n let message = undefined;\r\n if (this.conf.execSQL && statement instanceof Statements.ExecSQL) {\r\n message = \"EXEC SQL\";\r\n }\r\n else if (this.conf.kernelCall && statement instanceof Statements.CallKernel) {\r\n message = \"KERNEL CALL\";\r\n }\r\n else if (this.conf.systemCall && statement instanceof Statements.SystemCall) {\r\n message = \"SYSTEM-CALL\";\r\n }\r\n else if (this.conf.insertReport && statement instanceof Statements.InsertReport) {\r\n message = \"INSERT REPORT\";\r\n }\r\n else if (this.conf.generateDynpro && statement instanceof Statements.GenerateDynpro) {\r\n message = \"GENERATE DYNPRO\";\r\n }\r\n else if (this.conf.generateReport && statement instanceof Statements.GenerateReport) {\r\n message = \"GENERATE REPORT\";\r\n }\r\n else if (this.conf.generateSubroutine && statement instanceof Statements.GenerateSubroutine) {\r\n message = \"GENERATE SUBROUTINE\";\r\n }\r\n else if (this.conf.deleteReport && statement instanceof Statements.DeleteReport) {\r\n message = \"DELETE REPORT\";\r\n }\r\n else if (this.conf.deleteTextpool && statement instanceof Statements.DeleteTextpool) {\r\n message = \"DELETE TEXTPOOL\";\r\n }\r\n else if (this.conf.deleteDynpro && statement instanceof Statements.DeleteDynpro) {\r\n message = \"DELETE DYNPRO\";\r\n }\r\n else if (this.conf.importDynpro && statement instanceof Statements.ImportDynpro) {\r\n message = \"IMPORT DYNPRO\";\r\n }\r\n if (message) {\r\n issues.push(issue_1.Issue.atStatement(file, statementNode, this.getDescription(message), this.getMetadata().key, this.conf.severity));\r\n }\r\n if (this.conf.dynamicSQL) {\r\n message = this.findDynamicSQL(statementNode);\r\n if (message) {\r\n issues.push(issue_1.Issue.atStatement(file, statementNode, this.getDescription(message), this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n findDynamicSQL(statementNode) {\r\n const statement = statementNode.get();\r\n if (statement instanceof Statements.UpdateDatabase\r\n || statement instanceof Statements.Select\r\n || statement instanceof Statements.SelectLoop\r\n || statement instanceof Statements.InsertDatabase\r\n || statement instanceof Statements.ModifyDatabase\r\n || statement instanceof Statements.DeleteDatabase) {\r\n if (statementNode.findFirstExpression(Expressions.Dynamic)) {\r\n return \"Dynamic SQL\";\r\n }\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.DangerousStatement = DangerousStatement;\r\n//# sourceMappingURL=dangerous_statement.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/dangerous_statement.js?");
|
|
11559
11559
|
|
|
11560
11560
|
/***/ }),
|
|
11561
11561
|
|
|
@@ -11610,7 +11610,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11610
11610
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11611
11611
|
|
|
11612
11612
|
"use strict";
|
|
11613
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Downport = exports.DownportConf = void 0;\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst registry_1 = __webpack_require__(/*! ../registry */ \"./node_modules/@abaplint/core/build/src/registry.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nconst _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\r\nconst basic_1 = __webpack_require__(/*! ../abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst config_1 = __webpack_require__(/*! ../config */ \"./node_modules/@abaplint/core/build/src/config.js\");\r\nconst tokens_1 = __webpack_require__(/*! ../abap/1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\n// todo: refactor each sub-rule to new classes?\r\n// todo: add configuration\r\nclass DownportConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.DownportConf = DownportConf;\r\nclass Downport {\r\n constructor() {\r\n this.conf = new DownportConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"downport\",\r\n title: \"Downport statement\",\r\n shortDescription: `Experimental downport functionality`,\r\n extendedInformation: `Much like the 'commented_code' rule this rule loops through unknown statements and tries parsing with\na higher level language version. If successful, various rules are applied to downport the statement.\nTarget downport version is always v702, thus rule is only enabled if target version is v702.\n\nCurrent rules:\n* NEW transformed to CREATE OBJECT, opposite of https://rules.abaplint.org/use_new/\n* DATA() definitions are outlined, opposite of https://rules.abaplint.org/prefer_inline/\n* FIELD-SYMBOL() definitions are outlined\n* CONV is outlined\n* COND is outlined\n* REDUCE is outlined\n* EMPTY KEY is changed to DEFAULT KEY, opposite of DEFAULT KEY in https://rules.abaplint.org/avoid_use/\n* CAST changed to ?=\n* LOOP AT method_call( ) is outlined\n* VALUE # with structure fields\n* VALUE # with internal table lines\n* Table Expressions[ index ] are outlined\n* SELECT INTO @DATA definitions are outlined\n* Some occurrences of string template formatting option ALPHA changed to function module call\n* SELECT/INSERT/MODIFY/DELETE/UPDATE \",\" in field list removed, \"@\" in source/targets removed\n* PARTIALLY IMPLEMENTED removed, it can be quick fixed via rule implement_methods\n* RAISE EXCEPTION ... MESSAGE\n* APPEND expression is outlined\n\nOnly one transformation is applied to a statement at a time, so multiple steps might be required to do the full downport.`,\r\n tags: [_irule_1.RuleTag.Experimental, _irule_1.RuleTag.Downport, _irule_1.RuleTag.Quickfix],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n initialize(reg) {\r\n this.lowReg = reg;\r\n const version = this.lowReg.getConfig().getVersion();\r\n if (version === version_1.Version.v702 || version === version_1.Version.OpenABAP) {\r\n this.initHighReg();\r\n }\r\n return this;\r\n }\r\n run(lowObj) {\r\n const ret = [];\r\n this.counter = 1;\r\n const version = this.lowReg.getConfig().getVersion();\r\n if (version !== version_1.Version.v702 && version !== version_1.Version.OpenABAP) {\r\n return ret;\r\n }\r\n else if (!(lowObj instanceof _abap_object_1.ABAPObject)) {\r\n return ret;\r\n }\r\n const highObj = this.highReg.getObject(lowObj.getType(), lowObj.getName());\r\n if (highObj === undefined || !(highObj instanceof _abap_object_1.ABAPObject)) {\r\n return ret;\r\n }\r\n const highSyntax = new syntax_1.SyntaxLogic(this.highReg, highObj).run();\r\n for (const lowFile of lowObj.getABAPFiles()) {\r\n const highFile = highObj.getABAPFileByName(lowFile.getFilename());\r\n if (highFile === undefined) {\r\n continue;\r\n }\r\n const lowStatements = lowFile.getStatements();\r\n const highStatements = highFile.getStatements();\r\n if (lowStatements.length !== highStatements.length) {\r\n // after applying a fix, there might be more statements in lowFile\r\n // should highReg be initialized again?\r\n /*\r\n const message = \"Internal Error: Statement lengths does not match\";\r\n ret.push(Issue.atStatement(lowFile, lowStatements[0], message, this.getMetadata().key));\r\n */\r\n continue;\r\n }\r\n for (let i = 0; i < lowStatements.length; i++) {\r\n const low = lowStatements[i];\r\n const high = highStatements[i];\r\n if ((low.get() instanceof _statement_1.Unknown && !(high.get() instanceof _statement_1.Unknown))\r\n || high.findFirstExpression(Expressions.InlineData)) {\r\n const issue = this.checkStatement(low, high, lowFile, highSyntax);\r\n if (issue) {\r\n ret.push(issue);\r\n }\r\n }\r\n }\r\n }\r\n return ret;\r\n }\r\n ////////////////////\r\n /** clones the orginal repository into highReg, and parses it with higher language version */\r\n initHighReg() {\r\n // use default configuration, ie. default target version\r\n const highConfig = config_1.Config.getDefault().get();\r\n const lowConfig = this.lowReg.getConfig().get();\r\n highConfig.syntax.errorNamespace = lowConfig.syntax.errorNamespace;\r\n highConfig.syntax.globalConstants = lowConfig.syntax.globalConstants;\r\n highConfig.syntax.globalMacros = lowConfig.syntax.globalMacros;\r\n this.highReg = new registry_1.Registry();\r\n for (const o of this.lowReg.getObjects()) {\r\n for (const f of o.getFiles()) {\r\n if (this.lowReg.isDependency(o) === true) {\r\n this.highReg.addDependency(f);\r\n }\r\n else {\r\n this.highReg.addFile(f);\r\n }\r\n }\r\n }\r\n this.highReg.parse();\r\n }\r\n /** applies one rule at a time, multiple iterations are required to transform complex statements */\r\n checkStatement(low, high, lowFile, highSyntax) {\r\n if (low.getFirstToken().getStart() instanceof position_1.VirtualPosition) {\r\n return undefined;\r\n }\r\n let found = this.partiallyImplemented(high, lowFile);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.raiseException(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.emptyKey(high, lowFile);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.stringTemplateAlpha(high, lowFile);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.downportSelectInline(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.downportSQLExtras(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineLoopInput(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineLoopTarget(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineValue(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineReduce(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineCast(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineConv(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineCond(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineDataSimple(high, lowFile);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineData(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineFS(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.newToCreateObject(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.replaceXsdBool(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n // todo, line_exists() should be replaced before this call\r\n found = this.replaceTableExpression(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.replaceAppendExpression(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n // todo, add more rules here\r\n return undefined;\r\n }\r\n //////////////////////////////////////////\r\n downportSQLExtras(low, high, lowFile, _highSyntax) {\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n // todo: select loop\r\n if (!(high.get() instanceof Statements.Select)\r\n && !(high.get() instanceof Statements.UpdateDatabase)\r\n && !(high.get() instanceof Statements.ModifyDatabase)\r\n && !(high.get() instanceof Statements.DeleteDatabase)\r\n && !(high.get() instanceof Statements.InsertDatabase)) {\r\n return undefined;\r\n }\r\n let fix = undefined;\r\n const addFix = (token) => {\r\n const add = edit_helper_1.EditHelper.deleteToken(lowFile, token);\r\n if (fix === undefined) {\r\n fix = add;\r\n }\r\n else {\r\n fix = edit_helper_1.EditHelper.merge(fix, add);\r\n }\r\n };\r\n const candidates = [high.findAllExpressionsRecursive(Expressions.SQLTarget),\r\n high.findAllExpressionsRecursive(Expressions.SQLSource),\r\n high.findAllExpressionsRecursive(Expressions.SQLSourceSimple)].flat();\r\n for (const c of candidates) {\r\n if (c.getFirstToken() instanceof tokens_1.WAt) {\r\n addFix(c.getFirstToken());\r\n }\r\n }\r\n for (const fieldList of high.findAllExpressionsRecursive(Expressions.SQLFieldList)) {\r\n for (const token of fieldList.getDirectTokens()) {\r\n if (token.getStr() === \",\") {\r\n addFix(token);\r\n }\r\n }\r\n }\r\n if (fix === undefined) {\r\n return undefined;\r\n }\r\n else {\r\n return issue_1.Issue.atToken(lowFile, low.getFirstToken(), \"SQL, remove \\\" and ,\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n }\r\n downportSelectInline(low, high, lowFile, highSyntax) {\r\n if (!(low.get() instanceof _statement_1.Unknown)\r\n || !(high.get() instanceof Statements.Select)) {\r\n return undefined;\r\n }\r\n // as first step outline the @DATA, note that void types are okay, as long the field names are specified\r\n let found = this.downportSelectSingleInline(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.downportSelectTableInline(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n return undefined;\r\n }\r\n downportSelectSingleInline(_low, high, lowFile, _highSyntax) {\r\n var _a, _b, _c;\r\n const targets = ((_a = high.findFirstExpression(Expressions.SQLIntoStructure)) === null || _a === void 0 ? void 0 : _a.findDirectExpressions(Expressions.SQLTarget)) || [];\r\n if (targets.length !== 1) {\r\n return undefined;\r\n }\r\n const inlineData = targets[0].findFirstExpression(Expressions.InlineData);\r\n if (inlineData === undefined) {\r\n return undefined;\r\n }\r\n const sqlFrom = high.findAllExpressions(Expressions.SQLFromSource);\r\n if (sqlFrom.length !== 1) {\r\n return undefined;\r\n }\r\n const tableName = (_b = sqlFrom[0].findDirectExpression(Expressions.DatabaseTable)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n if (tableName === undefined) {\r\n return undefined;\r\n }\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const fieldList = high.findFirstExpression(Expressions.SQLFieldList);\r\n if (fieldList === undefined) {\r\n return undefined;\r\n }\r\n let fieldDefinition = \"\";\r\n const fields = fieldList.findDirectExpressions(Expressions.SQLFieldName);\r\n const name = ((_c = inlineData.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || \"error\";\r\n if (fields.length === 1) {\r\n fieldDefinition = `DATA ${name} TYPE ${tableName}-${fields[0].concatTokens()}.`;\r\n }\r\n else {\r\n for (const f of fields) {\r\n const fieldName = f.concatTokens();\r\n fieldDefinition += indentation + \" \" + fieldName + \" TYPE \" + tableName + \"-\" + fieldName + \",\\n\";\r\n }\r\n fieldDefinition = `DATA: BEGIN OF ${name},\n${fieldDefinition}${indentation} END OF ${name}.`;\r\n }\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `${fieldDefinition}\n${indentation}`);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, inlineData.getFirstToken().getStart(), inlineData.getLastToken().getEnd(), name);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, inlineData.getFirstToken(), \"Outline SELECT @DATA\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n downportSelectTableInline(_low, high, lowFile, highSyntax) {\r\n var _a, _b, _c;\r\n const targets = ((_a = high.findFirstExpression(Expressions.SQLIntoTable)) === null || _a === void 0 ? void 0 : _a.findDirectExpressions(Expressions.SQLTarget)) || [];\r\n if (targets.length !== 1) {\r\n return undefined;\r\n }\r\n const inlineData = targets[0].findFirstExpression(Expressions.InlineData);\r\n if (inlineData === undefined) {\r\n return undefined;\r\n }\r\n const sqlFrom = high.findAllExpressions(Expressions.SQLFromSource);\r\n if (sqlFrom.length !== 1) {\r\n return undefined;\r\n }\r\n const tableName = (_b = sqlFrom[0].findDirectExpression(Expressions.DatabaseTable)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n if (tableName === undefined) {\r\n return undefined;\r\n }\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const fieldList = high.findFirstExpression(Expressions.SQLFieldList);\r\n if (fieldList === undefined) {\r\n return undefined;\r\n }\r\n let fieldDefinitions = \"\";\r\n for (const f of fieldList.findDirectExpressions(Expressions.SQLFieldName)) {\r\n const fieldName = f.concatTokens();\r\n fieldDefinitions += indentation + \" \" + fieldName + \" TYPE \" + tableName + \"-\" + fieldName + \",\\n\";\r\n }\r\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const name = ((_c = inlineData.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || \"error\";\r\n let fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `TYPES: BEGIN OF ${uniqueName},\n${fieldDefinitions}${indentation} END OF ${uniqueName}.\n${indentation}DATA ${name} TYPE STANDARD TABLE OF ${uniqueName} WITH DEFAULT KEY.\n${indentation}`);\r\n if (fieldDefinitions === \"\") {\r\n fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `DATA ${name} TYPE STANDARD TABLE OF ${tableName} WITH DEFAULT KEY.\n${indentation}`);\r\n }\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, inlineData.getFirstToken().getStart(), inlineData.getLastToken().getEnd(), name);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, inlineData.getFirstToken(), \"Outline SELECT @DATA\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n replaceAppendExpression(high, lowFile, highSyntax) {\r\n if (!(high.get() instanceof Statements.Append)) {\r\n return undefined;\r\n }\r\n const children = high.getChildren();\r\n if (children[1].get() instanceof Expressions.Source) {\r\n const source = children[1];\r\n const target = high.findDirectExpression(Expressions.Target);\r\n if (target === undefined) {\r\n return undefined;\r\n }\r\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const firstToken = high.getFirstToken();\r\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()}.\n${indentation}${uniqueName} = ${source.concatTokens()}.\\n${indentation}`);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Outline APPEND source expression\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n replaceTableExpression(node, lowFile, highSyntax) {\r\n var _a;\r\n for (const fieldChain of node.findAllExpressionsRecursive(Expressions.FieldChain)) {\r\n const tableExpression = fieldChain.findDirectExpression(Expressions.TableExpression);\r\n if (tableExpression === undefined) {\r\n continue;\r\n }\r\n if (tableExpression.getChildren().length > 3) {\r\n // for now, only support the INDEX scenario\r\n continue;\r\n }\r\n let pre = \"\";\r\n let startToken = undefined;\r\n for (const child of fieldChain.getChildren()) {\r\n if (startToken === undefined) {\r\n startToken = child.getFirstToken();\r\n }\r\n else if (child === tableExpression) {\r\n break;\r\n }\r\n pre += child.concatTokens();\r\n }\r\n if (startToken === undefined) {\r\n continue;\r\n }\r\n const uniqueName = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const firstToken = node.getFirstToken();\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${pre}.\n${indentation}READ TABLE ${pre} INDEX ${(_a = tableExpression.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens()} INTO ${uniqueName}.\n${indentation}IF sy-subrc <> 0.\n${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.\n${indentation}ENDIF.\n${indentation}`);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, startToken.getStart(), tableExpression.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Outline table expression\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n outlineDataSimple(node, lowFile) {\r\n // outlines \"DATA(ls_msg) = temp1.\", note that this does not need to look at types\r\n var _a, _b, _c;\r\n if (!(node.get() instanceof Statements.Move)) {\r\n return undefined;\r\n }\r\n const target = node.findFirstExpression(Expressions.Target);\r\n if (!(((_a = target === null || target === void 0 ? void 0 : target.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.InlineData)) {\r\n return undefined;\r\n }\r\n const source = node.findFirstExpression(Expressions.Source);\r\n if (source === undefined) {\r\n return undefined;\r\n }\r\n else if (source.getChildren().length !== 1) {\r\n return undefined;\r\n }\r\n else if (!(((_b = source.getFirstChild()) === null || _b === void 0 ? void 0 : _b.get()) instanceof Expressions.FieldChain)) {\r\n return undefined;\r\n }\r\n else if (source.findFirstExpression(Expressions.FieldOffset)) {\r\n return undefined;\r\n }\r\n else if (source.findFirstExpression(Expressions.FieldLength)) {\r\n return undefined;\r\n }\r\n const targetName = (_c = target.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens();\r\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const firstToken = node.getFirstToken();\r\n const lastToken = node.getLastToken();\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${targetName} LIKE ${source.concatTokens()}.\\n${indentation}`);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), lastToken.getEnd(), `${targetName} = ${source.concatTokens()}.`);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Outline DATA\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n partiallyImplemented(node, lowFile) {\r\n if (node.get() instanceof Statements.InterfaceDef) {\r\n const partially = node.findDirectTokenByText(\"PARTIALLY\");\r\n if (partially === undefined) {\r\n return undefined;\r\n }\r\n const implemented = node.findDirectTokenByText(\"IMPLEMENTED\");\r\n if (implemented === undefined) {\r\n return undefined;\r\n }\r\n const fix = edit_helper_1.EditHelper.deleteRange(lowFile, partially.getStart(), implemented.getEnd());\r\n return issue_1.Issue.atToken(lowFile, partially, \"Downport PARTIALLY IMPLEMENTED\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n raiseException(node, lowFile, highSyntax) {\r\n /*\r\n Note: IF_T100_DYN_MSG does not exist in 702, so this rule is mostly relevant for the transpiler\r\n \r\n DATA foo LIKE if_t100_message=>t100key.\r\n foo-msgid = 'ZHVAM'.\r\n foo-msgno = '001'.\r\n foo-attr1 = 'IF_T100_DYN_MSG~MSGV1'.\r\n foo-attr2 = 'IF_T100_DYN_MSG~MSGV2'.\r\n foo-attr3 = 'IF_T100_DYN_MSG~MSGV3'.\r\n foo-attr4 = 'IF_T100_DYN_MSG~MSGV4'.\r\n DATA bar TYPE REF TO zcl_hvam_exception.\r\n CREATE OBJECT bar EXPORTING textid = foo.\r\n bar->if_t100_dyn_msg~msgty = 'E'.\r\n bar->if_t100_dyn_msg~msgv1 = 'abc'.\r\n bar->if_t100_dyn_msg~msgv2 = 'abc'.\r\n bar->if_t100_dyn_msg~msgv3 = 'abc'.\r\n bar->if_t100_dyn_msg~msgv4 = 'abc'.\r\n RAISE EXCEPTION bar.\r\n */\r\n var _a;\r\n if (node.get() instanceof Statements.Raise) {\r\n const startToken = node.findDirectTokenByText(\"ID\");\r\n if (startToken === undefined) {\r\n return undefined;\r\n }\r\n const sources = node.findDirectExpressions(Expressions.Source);\r\n const id = sources[0].concatTokens();\r\n const numberExpression = node.findExpressionAfterToken(\"NUMBER\");\r\n if (numberExpression === undefined) {\r\n throw \"downport raiseException, could not find number\";\r\n }\r\n let number = numberExpression.concatTokens();\r\n if (numberExpression.get() instanceof Expressions.MessageNumber) {\r\n number = \"'\" + number + \"'\";\r\n }\r\n const className = ((_a = node.findDirectExpression(Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.concatTokens()) || \"ERROR\";\r\n const uniqueName1 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const uniqueName2 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const abap = `DATA ${uniqueName1} LIKE if_t100_message=>t100key.\n${indentation}${uniqueName1}-msgid = ${id}.\n${indentation}${uniqueName1}-msgno = ${number}.\n${indentation}DATA ${uniqueName2} TYPE REF TO ${className}.\n${indentation}CREATE OBJECT ${uniqueName2} EXPORTING textid = ${uniqueName1}.\n${indentation}RAISE EXCEPTION ${uniqueName2}.`;\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getStart(), node.getEnd(), abap);\r\n return issue_1.Issue.atToken(lowFile, startToken, \"Downport RAISE MESSAGE\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n emptyKey(node, lowFile) {\r\n for (let i of node.findAllExpressions(Expressions.TypeTable)) {\r\n const key = i.findDirectExpression(Expressions.TypeTableKey);\r\n if (key === undefined) {\r\n continue;\r\n }\r\n i = key;\r\n const concat = i.concatTokens();\r\n if (concat.toUpperCase().includes(\"WITH EMPTY KEY\") === false) {\r\n continue;\r\n }\r\n const token = i.findDirectTokenByText(\"EMPTY\");\r\n if (token === undefined) {\r\n continue;\r\n }\r\n const fix = edit_helper_1.EditHelper.replaceToken(lowFile, token, \"DEFAULT\");\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Downport EMPTY KEY\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n // must be very simple string templates, like \"|{ ls_line-no ALPHA = IN }|\"\r\n stringTemplateAlpha(node, lowFile) {\r\n var _a, _b, _c;\r\n if (!(node.get() instanceof Statements.Move)) {\r\n return undefined;\r\n }\r\n const topSource = node.findDirectExpression(Expressions.Source);\r\n if (topSource === undefined || topSource.getChildren().length !== 1) {\r\n return undefined;\r\n }\r\n const child = topSource.getFirstChild();\r\n if (!(child.get() instanceof Expressions.StringTemplate)) {\r\n return undefined;\r\n }\r\n const templateTokens = child.getChildren();\r\n if (templateTokens.length !== 3\r\n || templateTokens[0].getFirstToken().getStr() !== \"|{\"\r\n || templateTokens[2].getFirstToken().getStr() !== \"}|\") {\r\n return undefined;\r\n }\r\n const templateSource = child.findDirectExpression(Expressions.StringTemplateSource);\r\n const formatting = (_a = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.StringTemplateFormatting)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n let functionName = \"\";\r\n switch (formatting) {\r\n case \"ALPHA = IN\":\r\n functionName = \"CONVERSION_EXIT_ALPHA_INPUT\";\r\n break;\r\n case \"ALPHA = OUT\":\r\n functionName = \"CONVERSION_EXIT_ALPHA_OUTPUT\";\r\n break;\r\n default:\r\n return undefined;\r\n }\r\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const source = (_b = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n const topTarget = (_c = node.findDirectExpression(Expressions.Target)) === null || _c === void 0 ? void 0 : _c.concatTokens();\r\n const code = `CALL FUNCTION '${functionName}'\n${indentation} EXPORTING\n${indentation} input = ${source}\n${indentation} IMPORTING\n${indentation} output = ${topTarget}.`;\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getFirstToken().getStart(), node.getLastToken().getEnd(), code);\r\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Downport ALPHA\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n outlineLoopInput(node, lowFile, highSyntax) {\r\n if (!(node.get() instanceof Statements.Loop)) {\r\n return undefined;\r\n }\r\n else if (node.findDirectExpression(Expressions.SimpleSource2)) {\r\n return undefined;\r\n }\r\n // the first Source must be outlined\r\n const s = node.findDirectExpression(Expressions.Source);\r\n if (s === undefined) {\r\n return undefined;\r\n }\r\n const uniqueName = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const code = `DATA(${uniqueName}) = ${s.concatTokens()}.\\n` +\r\n \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, s.getFirstToken().getStart(), s.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Outline LOOP input\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n outlineLoopTarget(node, lowFile, _highSyntax) {\r\n var _a, _b, _c, _d, _e;\r\n // also allows outlining of voided types\r\n if (!(node.get() instanceof Statements.Loop)) {\r\n return undefined;\r\n }\r\n const sourceName = (_a = node.findDirectExpression(Expressions.SimpleSource2)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n if (sourceName === undefined) {\r\n return undefined;\r\n }\r\n const concat = node.concatTokens();\r\n if (concat.includes(\" REFERENCE INTO \")) {\r\n return undefined;\r\n }\r\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const dataTarget = (_b = node.findDirectExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.InlineData);\r\n if (dataTarget) {\r\n const targetName = ((_c = dataTarget.findDirectExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || \"DOWNPORT_ERROR\";\r\n const code = `DATA ${targetName} LIKE LINE OF ${sourceName}.\\n${indentation}`;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, dataTarget.getFirstToken().getStart(), dataTarget.getLastToken().getEnd(), targetName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Outline LOOP data target\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n const fsTarget = (_d = node.findDirectExpression(Expressions.FSTarget)) === null || _d === void 0 ? void 0 : _d.findDirectExpression(Expressions.InlineFS);\r\n if (fsTarget) {\r\n const targetName = ((_e = fsTarget.findDirectExpression(Expressions.TargetFieldSymbol)) === null || _e === void 0 ? void 0 : _e.concatTokens()) || \"DOWNPORT_ERROR\";\r\n const code = `FIELD-SYMBOLS ${targetName} LIKE LINE OF ${sourceName}.\\n${indentation}`;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, fsTarget.getFirstToken().getStart(), fsTarget.getLastToken().getEnd(), targetName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Outline LOOP fs target\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n outlineReduce(node, lowFile, highSyntax) {\r\n var _a, _b, _c, _d;\r\n for (const i of node.findAllExpressionsRecursive(Expressions.Source)) {\r\n const firstToken = i.getFirstToken();\r\n if (firstToken.getStr().toUpperCase() !== \"REDUCE\") {\r\n continue;\r\n }\r\n const type = this.findType(i, lowFile, highSyntax);\r\n if (type === undefined) {\r\n continue;\r\n }\r\n const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\r\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n let body = \"\";\r\n let name = \"\";\r\n const reduceBody = i.findDirectExpression(Expressions.ReduceBody);\r\n if (reduceBody === undefined) {\r\n continue;\r\n }\r\n for (const init of reduceBody.findDirectExpressions(Expressions.InlineFieldDefinition)) {\r\n name = init.getFirstToken().getStr();\r\n body += indentation + `DATA(${name}) = ${(_a = reduceBody.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens()}.\\n`;\r\n }\r\n const loop = reduceBody.findFirstExpression(Expressions.InlineLoopDefinition);\r\n if (loop === undefined) {\r\n continue;\r\n }\r\n const loopSource = (_b = loop.findFirstExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n const loopTargetField = (_c = loop.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens();\r\n if (loopTargetField) {\r\n body += indentation + `LOOP AT ${loopSource} INTO DATA(${loopTargetField}).\\n`;\r\n }\r\n if (loopTargetField === undefined) {\r\n const loopTargetFieldSymbol = (_d = loop.findFirstExpression(Expressions.TargetFieldSymbol)) === null || _d === void 0 ? void 0 : _d.concatTokens();\r\n body += indentation + `LOOP AT ${loopSource} ASSIGNING FIELD-SYMBOL(${loopTargetFieldSymbol}).\\n`;\r\n }\r\n const next = reduceBody.findDirectExpression(Expressions.ReduceNext);\r\n if (next === undefined) {\r\n continue;\r\n }\r\n for (const n of next.getChildren()) {\r\n if (n.concatTokens().toUpperCase() === \"NEXT\") {\r\n continue;\r\n }\r\n else if (n.concatTokens() === \"=\") {\r\n body += \" = \";\r\n }\r\n else if (n.get() instanceof Expressions.Field) {\r\n body += indentation + \" \" + n.concatTokens();\r\n }\r\n else if (n.get() instanceof Expressions.Source) {\r\n body += n.concatTokens() + \".\\n\";\r\n }\r\n }\r\n body += indentation + `ENDLOOP.\\n`;\r\n body += indentation + `${uniqueName} = ${name}.\\n`;\r\n const abap = `DATA ${uniqueName} TYPE ${type}.\\n` +\r\n body +\r\n indentation;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), abap);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), i.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, firstToken, \"Downport REDUCE\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n outlineValue(node, lowFile, highSyntax) {\r\n var _a, _b;\r\n const allSources = node.findAllExpressionsRecursive(Expressions.Source);\r\n for (const i of allSources) {\r\n const firstToken = i.getFirstToken();\r\n if (firstToken.getStr().toUpperCase() !== \"VALUE\") {\r\n continue;\r\n }\r\n const type = this.findType(i, lowFile, highSyntax);\r\n if (type === undefined) {\r\n continue;\r\n }\r\n const valueBody = i.findDirectExpression(Expressions.ValueBody);\r\n const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\r\n let indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n let body = \"\";\r\n const loop = valueBody === null || valueBody === void 0 ? void 0 : valueBody.findFirstExpression(Expressions.InlineLoopDefinition);\r\n if (loop) {\r\n const loopSource = (_a = loop.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n const loopTargetFieldSymbol = (_b = loop.findFirstExpression(Expressions.TargetFieldSymbol)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n body += indentation + `LOOP AT ${loopSource} ASSIGNING FIELD-SYMBOL(${loopTargetFieldSymbol}).\\n`;\r\n indentation += \" \";\r\n }\r\n let structureName = uniqueName;\r\n let added = false;\r\n let data = \"\";\r\n for (const b of (valueBody === null || valueBody === void 0 ? void 0 : valueBody.getChildren()) || []) {\r\n if (b.concatTokens() === \"(\" && added === false) {\r\n structureName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\r\n data = indentation + `DATA ${structureName} LIKE LINE OF ${uniqueName}.\\n`;\r\n }\r\n if (b.get() instanceof Expressions.FieldAssignment) {\r\n if (added === false) {\r\n body += data;\r\n added = true;\r\n }\r\n body += indentation + structureName + \"-\" + b.concatTokens() + \".\\n\";\r\n }\r\n else if (b.get() instanceof Expressions.Source) {\r\n structureName = b.concatTokens();\r\n }\r\n else if (b instanceof nodes_1.ExpressionNode && b.get() instanceof Expressions.Let) {\r\n body += this.outlineLet(b, indentation, highSyntax, lowFile);\r\n }\r\n else if (b.concatTokens() === \")\") {\r\n body += indentation + `APPEND ${structureName} TO ${uniqueName}.\\n`;\r\n }\r\n }\r\n if (loop) {\r\n indentation = indentation.substr(2);\r\n body += indentation + `ENDLOOP.\\n`;\r\n }\r\n const abap = `DATA ${uniqueName} TYPE ${type}.\\n` +\r\n body +\r\n indentation;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), abap);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), i.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, firstToken, \"Downport VALUE\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n outlineLet(node, indentation, highSyntax, lowFile) {\r\n var _a;\r\n let ret = \"\";\r\n for (const f of node.findDirectExpressions(Expressions.InlineFieldDefinition)) {\r\n const c = f.getFirstChild();\r\n if (c === undefined) {\r\n continue;\r\n }\r\n const name = c.concatTokens().toLowerCase();\r\n const spag = highSyntax.spaghetti.lookupPosition(c.getFirstToken().getStart(), lowFile.getFilename());\r\n if (spag === undefined) {\r\n continue;\r\n }\r\n const found = spag.findVariable(name);\r\n if (found === undefined) {\r\n continue;\r\n }\r\n const type = found.getType().getQualifiedName() ? (_a = found.getType().getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toLowerCase() : found.getType().toABAP();\r\n ret += indentation + \"DATA \" + name + ` TYPE ${type}.\\n`;\r\n const source = f.findFirstExpression(Expressions.Source);\r\n if (source) {\r\n ret += indentation + name + ` = ${source.concatTokens()}.\\n`;\r\n }\r\n }\r\n return ret;\r\n }\r\n findType(i, lowFile, highSyntax) {\r\n var _a;\r\n const expr = i.findDirectExpression(Expressions.TypeNameOrInfer);\r\n if (expr === undefined) {\r\n return undefined;\r\n }\r\n const firstToken = expr.getFirstToken();\r\n const concat = expr.concatTokens().toLowerCase();\r\n if (concat !== \"#\") {\r\n return concat;\r\n }\r\n const spag = highSyntax.spaghetti.lookupPosition(firstToken.getStart(), lowFile.getFilename());\r\n if (spag === undefined) {\r\n return undefined;\r\n }\r\n let inferred = undefined;\r\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\r\n if (r.referenceType === _reference_1.ReferenceType.InferredType\r\n && r.resolved\r\n && r.position.getStart().equals(firstToken.getStart())\r\n && r.resolved instanceof _typed_identifier_1.TypedIdentifier) {\r\n inferred = r.resolved;\r\n break;\r\n }\r\n }\r\n if (inferred === undefined) {\r\n return undefined;\r\n }\r\n return (_a = inferred.getType().getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toLowerCase();\r\n }\r\n outlineFS(node, lowFile, highSyntax) {\r\n var _a, _b;\r\n for (const i of node.findAllExpressionsRecursive(Expressions.InlineFS)) {\r\n const nameToken = (_a = i.findDirectExpression(Expressions.TargetFieldSymbol)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\r\n if (nameToken === undefined) {\r\n continue;\r\n }\r\n const name = nameToken.getStr();\r\n const spag = highSyntax.spaghetti.lookupPosition(nameToken.getStart(), lowFile.getFilename());\r\n if (spag === undefined) {\r\n continue;\r\n }\r\n const found = spag.findVariable(name);\r\n if (found === undefined) {\r\n continue;\r\n }\r\n else if (found.getType() instanceof basic_1.VoidType) {\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Error outlining voided type\", this.getMetadata().key, this.conf.severity);\r\n }\r\n const type = found.getType().getQualifiedName() ? (_b = found.getType().getQualifiedName()) === null || _b === void 0 ? void 0 : _b.toLowerCase() : found.getType().toABAP();\r\n const code = `FIELD-SYMBOLS ${name} TYPE ${type}.\\n` +\r\n \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), name);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Outline FIELD-SYMBOL\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n outlineData(node, lowFile, highSyntax) {\r\n var _a, _b;\r\n for (const i of node.findAllExpressionsRecursive(Expressions.InlineData)) {\r\n const nameToken = (_a = i.findDirectExpression(Expressions.TargetField)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\r\n if (nameToken === undefined) {\r\n continue;\r\n }\r\n const name = nameToken.getStr();\r\n const spag = highSyntax.spaghetti.lookupPosition(nameToken.getStart(), lowFile.getFilename());\r\n if (spag === undefined) {\r\n continue;\r\n }\r\n const found = spag.findVariable(name);\r\n if (found === undefined) {\r\n continue;\r\n }\r\n else if (found.getType() instanceof basic_1.VoidType) {\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Error outlining voided type\", this.getMetadata().key, this.conf.severity);\r\n }\r\n const type = found.getType().getQualifiedName() ? (_b = found.getType().getQualifiedName()) === null || _b === void 0 ? void 0 : _b.toLowerCase() : found.getType().toABAP();\r\n const code = `DATA ${name} TYPE ${type}.\\n` +\r\n \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), name);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Outline DATA\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n outlineCond(node, lowFile, highSyntax) {\r\n for (const i of node.findAllExpressionsRecursive(Expressions.Source)) {\r\n if (i.getFirstToken().getStr().toUpperCase() !== \"COND\") {\r\n continue;\r\n }\r\n const body = i.findDirectExpression(Expressions.CondBody);\r\n if (body === undefined) {\r\n continue;\r\n }\r\n const uniqueName = this.uniqueName(i.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const type = this.findType(i, lowFile, highSyntax);\r\n const indent = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const bodyCode = this.buildCondBody(body, uniqueName, indent);\r\n const abap = `DATA ${uniqueName} TYPE ${type}.\\n` + bodyCode;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), abap);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Downport COND\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n buildCondBody(body, uniqueName, indent) {\r\n let code = indent;\r\n for (const c of body.getChildren()) {\r\n if (c instanceof nodes_1.TokenNode) {\r\n switch (c.getFirstToken().getStr().toUpperCase()) {\r\n case \"WHEN\":\r\n code += \"IF \";\r\n break;\r\n case \"THEN\":\r\n code += \".\\n\";\r\n break;\r\n case \"ELSE\":\r\n code += indent + \"ELSE.\\n\";\r\n break;\r\n default:\r\n throw \"buildCondBody, unexpected token\";\r\n }\r\n }\r\n else if (c.get() instanceof Expressions.Cond) {\r\n code += c.concatTokens();\r\n }\r\n else if (c.get() instanceof Expressions.Source) {\r\n code += indent + \" \" + uniqueName + \" = \" + c.concatTokens() + \".\\n\";\r\n }\r\n else {\r\n throw \"buildCondBody, unexpected expression\";\r\n }\r\n }\r\n code += indent + \"ENDIF.\\n\";\r\n code += indent;\r\n return code;\r\n }\r\n outlineConv(node, lowFile, highSyntax) {\r\n var _a;\r\n for (const i of node.findAllExpressionsRecursive(Expressions.Source)) {\r\n if (i.getFirstToken().getStr().toUpperCase() !== \"CONV\") {\r\n continue;\r\n }\r\n const body = (_a = i.findDirectExpression(Expressions.ConvBody)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n if (body === undefined) {\r\n continue;\r\n }\r\n const uniqueName = this.uniqueName(i.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const type = this.findType(i, lowFile, highSyntax);\r\n const indent = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const abap = `DATA ${uniqueName} TYPE ${type}.\\n` +\r\n indent + `${uniqueName} = ${body}.\\n` +\r\n indent;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), abap);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Downport CONV\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n // \"CAST\" to \"?=\"\r\n outlineCast(node, lowFile, highSyntax) {\r\n var _a;\r\n for (const i of node.findAllExpressionsRecursive(Expressions.Cast)) {\r\n const uniqueName = this.uniqueName(i.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const type = this.findType(i, lowFile, highSyntax);\r\n const body = (_a = i.findDirectExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n const abap = `DATA ${uniqueName} TYPE REF TO ${type}.\\n` +\r\n \" \".repeat(node.getFirstToken().getStart().getCol() - 1) +\r\n `${uniqueName} ?= ${body}.\\n` +\r\n \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), abap);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Downport CAST\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n uniqueName(position, filename, highSyntax) {\r\n const spag = highSyntax.spaghetti.lookupPosition(position, filename);\r\n if (spag === undefined) {\r\n return \"uniqueErrorSpag\";\r\n }\r\n while (true) {\r\n const name = \"temp\" + this.counter;\r\n const found = spag.findVariable(name);\r\n this.counter++;\r\n if (found === undefined) {\r\n return name;\r\n }\r\n }\r\n }\r\n replaceXsdBool(node, lowFile, highSyntax) {\r\n const spag = highSyntax.spaghetti.lookupPosition(node.getFirstToken().getStart(), lowFile.getFilename());\r\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\r\n if (r.referenceType === _reference_1.ReferenceType.BuiltinMethodReference\r\n && r.position.getName().toUpperCase() === \"XSDBOOL\") {\r\n const token = r.position.getToken();\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, token.getStart(), token.getEnd(), \"boolc\");\r\n return issue_1.Issue.atToken(lowFile, token, \"Use BOOLC\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n }\r\n return undefined;\r\n }\r\n newToCreateObject(node, lowFile, highSyntax) {\r\n const source = node.findDirectExpression(Expressions.Source);\r\n let fix = undefined;\r\n if (node.get() instanceof Statements.Move\r\n && source\r\n && source.getFirstToken().getStr().toUpperCase() === \"NEW\") {\r\n const target = node.findDirectExpression(Expressions.Target);\r\n const found = source === null || source === void 0 ? void 0 : source.findFirstExpression(Expressions.NewObject);\r\n // must be at top level of the source for quickfix to work(todo: handle more scenarios)\r\n // todo, assumption: the target is not an inline definition\r\n if (target && found && source.concatTokens() === found.concatTokens()) {\r\n const abap = this.newParameters(found, target.concatTokens(), highSyntax, lowFile);\r\n if (abap !== undefined) {\r\n fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getFirstToken().getStart(), node.getLastToken().getEnd(), abap);\r\n }\r\n }\r\n }\r\n if (fix === undefined && node.findAllExpressions(Expressions.NewObject)) {\r\n const found = node.findFirstExpression(Expressions.NewObject);\r\n if (found === undefined) {\r\n return undefined;\r\n }\r\n const name = this.uniqueName(found.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const abap = this.newParameters(found, name, highSyntax, lowFile);\r\n if (abap === undefined) {\r\n return undefined;\r\n }\r\n const type = this.findType(found, lowFile, highSyntax);\r\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const data = `DATA ${name} TYPE REF TO ${type}.\\n` +\r\n indentation + abap + \"\\n\" +\r\n indentation;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), data);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, found.getFirstToken().getStart(), found.getLastToken().getEnd(), name);\r\n fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n }\r\n if (fix) {\r\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Use CREATE OBJECT instead of NEW\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n else {\r\n return undefined;\r\n }\r\n }\r\n newParameters(found, name, highSyntax, lowFile) {\r\n var _a, _b, _c;\r\n const typeToken = (_a = found.findDirectExpression(Expressions.TypeNameOrInfer)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\r\n let extra = (typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStr()) === \"#\" ? \"\" : \" TYPE \" + (typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStr());\r\n const parameters = found.findFirstExpression(Expressions.ParameterListS);\r\n if (parameters) {\r\n extra = parameters ? extra + \" EXPORTING \" + parameters.concatTokens() : extra;\r\n }\r\n else if (typeToken) {\r\n const source = (_b = found.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n if (source) {\r\n // find the default parameter name for the constructor\r\n const spag = highSyntax.spaghetti.lookupPosition(typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStart(), lowFile.getFilename());\r\n let cdef = undefined;\r\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\r\n if ((r.referenceType === _reference_1.ReferenceType.InferredType\r\n || r.referenceType === _reference_1.ReferenceType.ObjectOrientedReference)\r\n && r.resolved && r.position.getStart().equals(typeToken.getStart())) {\r\n cdef = r.resolved;\r\n }\r\n }\r\n if (cdef && cdef.getMethodDefinitions === undefined) {\r\n return undefined; // something wrong\r\n }\r\n const importing = (_c = cdef === null || cdef === void 0 ? void 0 : cdef.getMethodDefinitions().getByName(\"CONSTRUCTOR\")) === null || _c === void 0 ? void 0 : _c.getParameters().getDefaultImporting();\r\n if (importing) {\r\n extra += \" EXPORTING \" + importing + \" = \" + source;\r\n }\r\n else if (spag === undefined) {\r\n extra += \" SpagUndefined\";\r\n }\r\n else if (cdef === undefined) {\r\n extra += \" ClassDefinitionNotFound\";\r\n }\r\n else {\r\n extra += \" SomeError\";\r\n }\r\n }\r\n }\r\n const abap = `CREATE OBJECT ${name}${extra}.`;\r\n return abap;\r\n }\r\n}\r\nexports.Downport = Downport;\r\n//# sourceMappingURL=downport.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/downport.js?");
|
|
11613
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Downport = exports.DownportConf = void 0;\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst registry_1 = __webpack_require__(/*! ../registry */ \"./node_modules/@abaplint/core/build/src/registry.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nconst _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\r\nconst basic_1 = __webpack_require__(/*! ../abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst config_1 = __webpack_require__(/*! ../config */ \"./node_modules/@abaplint/core/build/src/config.js\");\r\nconst tokens_1 = __webpack_require__(/*! ../abap/1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\n// todo: refactor each sub-rule to new classes?\r\n// todo: add configuration\r\nclass DownportConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.DownportConf = DownportConf;\r\nclass Downport {\r\n constructor() {\r\n this.conf = new DownportConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"downport\",\r\n title: \"Downport statement\",\r\n shortDescription: `Experimental downport functionality`,\r\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* 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[ index ] 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* APPEND expression is outlined\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.`,\r\n tags: [_irule_1.RuleTag.Experimental, _irule_1.RuleTag.Downport, _irule_1.RuleTag.Quickfix],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n initialize(reg) {\r\n this.lowReg = reg;\r\n const version = this.lowReg.getConfig().getVersion();\r\n if (version === version_1.Version.v702 || version === version_1.Version.OpenABAP) {\r\n this.initHighReg();\r\n }\r\n return this;\r\n }\r\n run(lowObj) {\r\n const ret = [];\r\n this.counter = 1;\r\n const version = this.lowReg.getConfig().getVersion();\r\n if (version !== version_1.Version.v702 && version !== version_1.Version.OpenABAP) {\r\n return ret;\r\n }\r\n else if (!(lowObj instanceof _abap_object_1.ABAPObject)) {\r\n return ret;\r\n }\r\n const highObj = this.highReg.getObject(lowObj.getType(), lowObj.getName());\r\n if (highObj === undefined || !(highObj instanceof _abap_object_1.ABAPObject)) {\r\n return ret;\r\n }\r\n const highSyntax = new syntax_1.SyntaxLogic(this.highReg, highObj).run();\r\n for (const lowFile of lowObj.getABAPFiles()) {\r\n const highFile = highObj.getABAPFileByName(lowFile.getFilename());\r\n if (highFile === undefined) {\r\n continue;\r\n }\r\n const lowStatements = lowFile.getStatements();\r\n const highStatements = highFile.getStatements();\r\n if (lowStatements.length !== highStatements.length) {\r\n // after applying a fix, there might be more statements in lowFile\r\n // should highReg be initialized again?\r\n /*\r\n const message = \"Internal Error: Statement lengths does not match\";\r\n ret.push(Issue.atStatement(lowFile, lowStatements[0], message, this.getMetadata().key));\r\n */\r\n continue;\r\n }\r\n for (let i = 0; i < lowStatements.length; i++) {\r\n const low = lowStatements[i];\r\n const high = highStatements[i];\r\n if ((low.get() instanceof _statement_1.Unknown && !(high.get() instanceof _statement_1.Unknown))\r\n || high.findFirstExpression(Expressions.InlineData)) {\r\n const issue = this.checkStatement(low, high, lowFile, highSyntax);\r\n if (issue) {\r\n ret.push(issue);\r\n }\r\n }\r\n }\r\n }\r\n return ret;\r\n }\r\n ////////////////////\r\n /** clones the orginal repository into highReg, and parses it with higher language version */\r\n initHighReg() {\r\n // use default configuration, ie. default target version\r\n const highConfig = config_1.Config.getDefault().get();\r\n const lowConfig = this.lowReg.getConfig().get();\r\n highConfig.syntax.errorNamespace = lowConfig.syntax.errorNamespace;\r\n highConfig.syntax.globalConstants = lowConfig.syntax.globalConstants;\r\n highConfig.syntax.globalMacros = lowConfig.syntax.globalMacros;\r\n this.highReg = new registry_1.Registry();\r\n for (const o of this.lowReg.getObjects()) {\r\n for (const f of o.getFiles()) {\r\n if (this.lowReg.isDependency(o) === true) {\r\n this.highReg.addDependency(f);\r\n }\r\n else {\r\n this.highReg.addFile(f);\r\n }\r\n }\r\n }\r\n this.highReg.parse();\r\n }\r\n /** applies one rule at a time, multiple iterations are required to transform complex statements */\r\n checkStatement(low, high, lowFile, highSyntax) {\r\n if (low.getFirstToken().getStart() instanceof position_1.VirtualPosition) {\r\n return undefined;\r\n }\r\n let found = this.partiallyImplemented(high, lowFile);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.raiseException(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.emptyKey(high, lowFile);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.stringTemplateAlpha(high, lowFile);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.downportSelectInline(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.downportSQLExtras(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineLoopInput(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineLoopTarget(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineValue(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineReduce(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineCast(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineConv(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineCond(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineDataSimple(high, lowFile);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineData(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineFS(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.newToCreateObject(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.replaceXsdBool(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n // todo, line_exists() should be replaced before this call\r\n found = this.replaceTableExpression(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.replaceAppendExpression(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n // todo, add more rules here\r\n return undefined;\r\n }\r\n //////////////////////////////////////////\r\n downportSQLExtras(low, high, lowFile, _highSyntax) {\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n // todo: select loop\r\n if (!(high.get() instanceof Statements.Select)\r\n && !(high.get() instanceof Statements.UpdateDatabase)\r\n && !(high.get() instanceof Statements.ModifyDatabase)\r\n && !(high.get() instanceof Statements.DeleteDatabase)\r\n && !(high.get() instanceof Statements.InsertDatabase)) {\r\n return undefined;\r\n }\r\n let fix = undefined;\r\n const addFix = (token) => {\r\n const add = edit_helper_1.EditHelper.deleteToken(lowFile, token);\r\n if (fix === undefined) {\r\n fix = add;\r\n }\r\n else {\r\n fix = edit_helper_1.EditHelper.merge(fix, add);\r\n }\r\n };\r\n const candidates = [high.findAllExpressionsRecursive(Expressions.SQLTarget),\r\n high.findAllExpressionsRecursive(Expressions.SQLSource),\r\n high.findAllExpressionsRecursive(Expressions.SQLSourceSimple)].flat();\r\n for (const c of candidates) {\r\n if (c.getFirstToken() instanceof tokens_1.WAt) {\r\n addFix(c.getFirstToken());\r\n }\r\n }\r\n for (const fieldList of high.findAllExpressionsRecursive(Expressions.SQLFieldList)) {\r\n for (const token of fieldList.getDirectTokens()) {\r\n if (token.getStr() === \",\") {\r\n addFix(token);\r\n }\r\n }\r\n }\r\n if (fix === undefined) {\r\n return undefined;\r\n }\r\n else {\r\n return issue_1.Issue.atToken(lowFile, low.getFirstToken(), \"SQL, remove \\\" and ,\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n }\r\n downportSelectInline(low, high, lowFile, highSyntax) {\r\n if (!(low.get() instanceof _statement_1.Unknown)\r\n || !(high.get() instanceof Statements.Select)) {\r\n return undefined;\r\n }\r\n // as first step outline the @DATA, note that void types are okay, as long the field names are specified\r\n let found = this.downportSelectSingleInline(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.downportSelectTableInline(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n return undefined;\r\n }\r\n downportSelectSingleInline(_low, high, lowFile, _highSyntax) {\r\n var _a, _b, _c;\r\n const targets = ((_a = high.findFirstExpression(Expressions.SQLIntoStructure)) === null || _a === void 0 ? void 0 : _a.findDirectExpressions(Expressions.SQLTarget)) || [];\r\n if (targets.length !== 1) {\r\n return undefined;\r\n }\r\n const inlineData = targets[0].findFirstExpression(Expressions.InlineData);\r\n if (inlineData === undefined) {\r\n return undefined;\r\n }\r\n const sqlFrom = high.findAllExpressions(Expressions.SQLFromSource);\r\n if (sqlFrom.length !== 1) {\r\n return undefined;\r\n }\r\n const tableName = (_b = sqlFrom[0].findDirectExpression(Expressions.DatabaseTable)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n if (tableName === undefined) {\r\n return undefined;\r\n }\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const fieldList = high.findFirstExpression(Expressions.SQLFieldList);\r\n if (fieldList === undefined) {\r\n return undefined;\r\n }\r\n let fieldDefinition = \"\";\r\n const fields = fieldList.findDirectExpressions(Expressions.SQLFieldName);\r\n const name = ((_c = inlineData.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || \"error\";\r\n if (fields.length === 1) {\r\n fieldDefinition = `DATA ${name} TYPE ${tableName}-${fields[0].concatTokens()}.`;\r\n }\r\n else {\r\n for (const f of fields) {\r\n const fieldName = f.concatTokens();\r\n fieldDefinition += indentation + \" \" + fieldName + \" TYPE \" + tableName + \"-\" + fieldName + \",\\n\";\r\n }\r\n fieldDefinition = `DATA: BEGIN OF ${name},\r\n${fieldDefinition}${indentation} END OF ${name}.`;\r\n }\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `${fieldDefinition}\r\n${indentation}`);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, inlineData.getFirstToken().getStart(), inlineData.getLastToken().getEnd(), name);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, inlineData.getFirstToken(), \"Outline SELECT @DATA\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n downportSelectTableInline(_low, high, lowFile, highSyntax) {\r\n var _a, _b, _c;\r\n const targets = ((_a = high.findFirstExpression(Expressions.SQLIntoTable)) === null || _a === void 0 ? void 0 : _a.findDirectExpressions(Expressions.SQLTarget)) || [];\r\n if (targets.length !== 1) {\r\n return undefined;\r\n }\r\n const inlineData = targets[0].findFirstExpression(Expressions.InlineData);\r\n if (inlineData === undefined) {\r\n return undefined;\r\n }\r\n const sqlFrom = high.findAllExpressions(Expressions.SQLFromSource);\r\n if (sqlFrom.length !== 1) {\r\n return undefined;\r\n }\r\n const tableName = (_b = sqlFrom[0].findDirectExpression(Expressions.DatabaseTable)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n if (tableName === undefined) {\r\n return undefined;\r\n }\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const fieldList = high.findFirstExpression(Expressions.SQLFieldList);\r\n if (fieldList === undefined) {\r\n return undefined;\r\n }\r\n let fieldDefinitions = \"\";\r\n for (const f of fieldList.findDirectExpressions(Expressions.SQLFieldName)) {\r\n const fieldName = f.concatTokens();\r\n fieldDefinitions += indentation + \" \" + fieldName + \" TYPE \" + tableName + \"-\" + fieldName + \",\\n\";\r\n }\r\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const name = ((_c = inlineData.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || \"error\";\r\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}`);\r\n if (fieldDefinitions === \"\") {\r\n fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `DATA ${name} TYPE STANDARD TABLE OF ${tableName} WITH DEFAULT KEY.\r\n${indentation}`);\r\n }\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, inlineData.getFirstToken().getStart(), inlineData.getLastToken().getEnd(), name);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, inlineData.getFirstToken(), \"Outline SELECT @DATA\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n replaceAppendExpression(high, lowFile, highSyntax) {\r\n if (!(high.get() instanceof Statements.Append)) {\r\n return undefined;\r\n }\r\n const children = high.getChildren();\r\n if (children[1].get() instanceof Expressions.Source) {\r\n const source = children[1];\r\n const target = high.findDirectExpression(Expressions.Target);\r\n if (target === undefined) {\r\n return undefined;\r\n }\r\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const firstToken = high.getFirstToken();\r\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}`);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Outline APPEND source expression\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n replaceTableExpression(node, lowFile, highSyntax) {\r\n var _a;\r\n for (const fieldChain of node.findAllExpressionsRecursive(Expressions.FieldChain)) {\r\n const tableExpression = fieldChain.findDirectExpression(Expressions.TableExpression);\r\n if (tableExpression === undefined) {\r\n continue;\r\n }\r\n if (tableExpression.getChildren().length > 3) {\r\n // for now, only support the INDEX scenario\r\n continue;\r\n }\r\n let pre = \"\";\r\n let startToken = undefined;\r\n for (const child of fieldChain.getChildren()) {\r\n if (startToken === undefined) {\r\n startToken = child.getFirstToken();\r\n }\r\n else if (child === tableExpression) {\r\n break;\r\n }\r\n pre += child.concatTokens();\r\n }\r\n if (startToken === undefined) {\r\n continue;\r\n }\r\n const uniqueName = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const firstToken = node.getFirstToken();\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${pre}.\r\n${indentation}READ TABLE ${pre} INDEX ${(_a = tableExpression.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens()} INTO ${uniqueName}.\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}`);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, startToken.getStart(), tableExpression.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Outline table expression\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n outlineDataSimple(node, lowFile) {\r\n // outlines \"DATA(ls_msg) = temp1.\", note that this does not need to look at types\r\n var _a, _b, _c;\r\n if (!(node.get() instanceof Statements.Move)) {\r\n return undefined;\r\n }\r\n const target = node.findFirstExpression(Expressions.Target);\r\n if (!(((_a = target === null || target === void 0 ? void 0 : target.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.InlineData)) {\r\n return undefined;\r\n }\r\n const source = node.findFirstExpression(Expressions.Source);\r\n if (source === undefined) {\r\n return undefined;\r\n }\r\n else if (source.getChildren().length !== 1) {\r\n return undefined;\r\n }\r\n else if (!(((_b = source.getFirstChild()) === null || _b === void 0 ? void 0 : _b.get()) instanceof Expressions.FieldChain)) {\r\n return undefined;\r\n }\r\n else if (source.findFirstExpression(Expressions.FieldOffset)) {\r\n return undefined;\r\n }\r\n else if (source.findFirstExpression(Expressions.FieldLength)) {\r\n return undefined;\r\n }\r\n const targetName = (_c = target.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens();\r\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const firstToken = node.getFirstToken();\r\n const lastToken = node.getLastToken();\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${targetName} LIKE ${source.concatTokens()}.\\n${indentation}`);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), lastToken.getEnd(), `${targetName} = ${source.concatTokens()}.`);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Outline DATA\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n partiallyImplemented(node, lowFile) {\r\n if (node.get() instanceof Statements.InterfaceDef) {\r\n const partially = node.findDirectTokenByText(\"PARTIALLY\");\r\n if (partially === undefined) {\r\n return undefined;\r\n }\r\n const implemented = node.findDirectTokenByText(\"IMPLEMENTED\");\r\n if (implemented === undefined) {\r\n return undefined;\r\n }\r\n const fix = edit_helper_1.EditHelper.deleteRange(lowFile, partially.getStart(), implemented.getEnd());\r\n return issue_1.Issue.atToken(lowFile, partially, \"Downport PARTIALLY IMPLEMENTED\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n raiseException(node, lowFile, highSyntax) {\r\n /*\r\n Note: IF_T100_DYN_MSG does not exist in 702, so this rule is mostly relevant for the transpiler\r\n \r\n DATA foo LIKE if_t100_message=>t100key.\r\n foo-msgid = 'ZHVAM'.\r\n foo-msgno = '001'.\r\n foo-attr1 = 'IF_T100_DYN_MSG~MSGV1'.\r\n foo-attr2 = 'IF_T100_DYN_MSG~MSGV2'.\r\n foo-attr3 = 'IF_T100_DYN_MSG~MSGV3'.\r\n foo-attr4 = 'IF_T100_DYN_MSG~MSGV4'.\r\n DATA bar TYPE REF TO zcl_hvam_exception.\r\n CREATE OBJECT bar EXPORTING textid = foo.\r\n bar->if_t100_dyn_msg~msgty = 'E'.\r\n bar->if_t100_dyn_msg~msgv1 = 'abc'.\r\n bar->if_t100_dyn_msg~msgv2 = 'abc'.\r\n bar->if_t100_dyn_msg~msgv3 = 'abc'.\r\n bar->if_t100_dyn_msg~msgv4 = 'abc'.\r\n RAISE EXCEPTION bar.\r\n */\r\n var _a;\r\n if (node.get() instanceof Statements.Raise) {\r\n const startToken = node.findDirectTokenByText(\"ID\");\r\n if (startToken === undefined) {\r\n return undefined;\r\n }\r\n const sources = node.findDirectExpressions(Expressions.Source);\r\n const id = sources[0].concatTokens();\r\n const numberExpression = node.findExpressionAfterToken(\"NUMBER\");\r\n if (numberExpression === undefined) {\r\n throw \"downport raiseException, could not find number\";\r\n }\r\n let number = numberExpression.concatTokens();\r\n if (numberExpression.get() instanceof Expressions.MessageNumber) {\r\n number = \"'\" + number + \"'\";\r\n }\r\n const className = ((_a = node.findDirectExpression(Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.concatTokens()) || \"ERROR\";\r\n const uniqueName1 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const uniqueName2 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const abap = `DATA ${uniqueName1} LIKE if_t100_message=>t100key.\r\n${indentation}${uniqueName1}-msgid = ${id}.\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}.`;\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getStart(), node.getEnd(), abap);\r\n return issue_1.Issue.atToken(lowFile, startToken, \"Downport RAISE MESSAGE\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n emptyKey(node, lowFile) {\r\n for (let i of node.findAllExpressions(Expressions.TypeTable)) {\r\n const key = i.findDirectExpression(Expressions.TypeTableKey);\r\n if (key === undefined) {\r\n continue;\r\n }\r\n i = key;\r\n const concat = i.concatTokens();\r\n if (concat.toUpperCase().includes(\"WITH EMPTY KEY\") === false) {\r\n continue;\r\n }\r\n const token = i.findDirectTokenByText(\"EMPTY\");\r\n if (token === undefined) {\r\n continue;\r\n }\r\n const fix = edit_helper_1.EditHelper.replaceToken(lowFile, token, \"DEFAULT\");\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Downport EMPTY KEY\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n // must be very simple string templates, like \"|{ ls_line-no ALPHA = IN }|\"\r\n stringTemplateAlpha(node, lowFile) {\r\n var _a, _b, _c;\r\n if (!(node.get() instanceof Statements.Move)) {\r\n return undefined;\r\n }\r\n const topSource = node.findDirectExpression(Expressions.Source);\r\n if (topSource === undefined || topSource.getChildren().length !== 1) {\r\n return undefined;\r\n }\r\n const child = topSource.getFirstChild();\r\n if (!(child.get() instanceof Expressions.StringTemplate)) {\r\n return undefined;\r\n }\r\n const templateTokens = child.getChildren();\r\n if (templateTokens.length !== 3\r\n || templateTokens[0].getFirstToken().getStr() !== \"|{\"\r\n || templateTokens[2].getFirstToken().getStr() !== \"}|\") {\r\n return undefined;\r\n }\r\n const templateSource = child.findDirectExpression(Expressions.StringTemplateSource);\r\n const formatting = (_a = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.StringTemplateFormatting)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n let functionName = \"\";\r\n switch (formatting) {\r\n case \"ALPHA = IN\":\r\n functionName = \"CONVERSION_EXIT_ALPHA_INPUT\";\r\n break;\r\n case \"ALPHA = OUT\":\r\n functionName = \"CONVERSION_EXIT_ALPHA_OUTPUT\";\r\n break;\r\n default:\r\n return undefined;\r\n }\r\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const source = (_b = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n const topTarget = (_c = node.findDirectExpression(Expressions.Target)) === null || _c === void 0 ? void 0 : _c.concatTokens();\r\n const code = `CALL FUNCTION '${functionName}'\r\n${indentation} EXPORTING\r\n${indentation} input = ${source}\r\n${indentation} IMPORTING\r\n${indentation} output = ${topTarget}.`;\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getFirstToken().getStart(), node.getLastToken().getEnd(), code);\r\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Downport ALPHA\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n outlineLoopInput(node, lowFile, highSyntax) {\r\n if (!(node.get() instanceof Statements.Loop)) {\r\n return undefined;\r\n }\r\n else if (node.findDirectExpression(Expressions.SimpleSource2)) {\r\n return undefined;\r\n }\r\n // the first Source must be outlined\r\n const s = node.findDirectExpression(Expressions.Source);\r\n if (s === undefined) {\r\n return undefined;\r\n }\r\n const uniqueName = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const code = `DATA(${uniqueName}) = ${s.concatTokens()}.\\n` +\r\n \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, s.getFirstToken().getStart(), s.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Outline LOOP input\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n outlineLoopTarget(node, lowFile, _highSyntax) {\r\n var _a, _b, _c, _d, _e;\r\n // also allows outlining of voided types\r\n if (!(node.get() instanceof Statements.Loop)) {\r\n return undefined;\r\n }\r\n const sourceName = (_a = node.findDirectExpression(Expressions.SimpleSource2)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n if (sourceName === undefined) {\r\n return undefined;\r\n }\r\n const concat = node.concatTokens();\r\n if (concat.includes(\" REFERENCE INTO \")) {\r\n return undefined;\r\n }\r\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const dataTarget = (_b = node.findDirectExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.InlineData);\r\n if (dataTarget) {\r\n const targetName = ((_c = dataTarget.findDirectExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || \"DOWNPORT_ERROR\";\r\n const code = `DATA ${targetName} LIKE LINE OF ${sourceName}.\\n${indentation}`;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, dataTarget.getFirstToken().getStart(), dataTarget.getLastToken().getEnd(), targetName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Outline LOOP data target\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n const fsTarget = (_d = node.findDirectExpression(Expressions.FSTarget)) === null || _d === void 0 ? void 0 : _d.findDirectExpression(Expressions.InlineFS);\r\n if (fsTarget) {\r\n const targetName = ((_e = fsTarget.findDirectExpression(Expressions.TargetFieldSymbol)) === null || _e === void 0 ? void 0 : _e.concatTokens()) || \"DOWNPORT_ERROR\";\r\n const code = `FIELD-SYMBOLS ${targetName} LIKE LINE OF ${sourceName}.\\n${indentation}`;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, fsTarget.getFirstToken().getStart(), fsTarget.getLastToken().getEnd(), targetName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Outline LOOP fs target\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n outlineReduce(node, lowFile, highSyntax) {\r\n var _a, _b, _c, _d;\r\n for (const i of node.findAllExpressionsRecursive(Expressions.Source)) {\r\n const firstToken = i.getFirstToken();\r\n if (firstToken.getStr().toUpperCase() !== \"REDUCE\") {\r\n continue;\r\n }\r\n const type = this.findType(i, lowFile, highSyntax);\r\n if (type === undefined) {\r\n continue;\r\n }\r\n const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\r\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n let body = \"\";\r\n let name = \"\";\r\n const reduceBody = i.findDirectExpression(Expressions.ReduceBody);\r\n if (reduceBody === undefined) {\r\n continue;\r\n }\r\n for (const init of reduceBody.findDirectExpressions(Expressions.InlineFieldDefinition)) {\r\n name = init.getFirstToken().getStr();\r\n body += indentation + `DATA(${name}) = ${(_a = reduceBody.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens()}.\\n`;\r\n }\r\n const loop = reduceBody.findFirstExpression(Expressions.InlineLoopDefinition);\r\n if (loop === undefined) {\r\n continue;\r\n }\r\n const loopSource = (_b = loop.findFirstExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n const loopTargetField = (_c = loop.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens();\r\n if (loopTargetField) {\r\n body += indentation + `LOOP AT ${loopSource} INTO DATA(${loopTargetField}).\\n`;\r\n }\r\n if (loopTargetField === undefined) {\r\n const loopTargetFieldSymbol = (_d = loop.findFirstExpression(Expressions.TargetFieldSymbol)) === null || _d === void 0 ? void 0 : _d.concatTokens();\r\n body += indentation + `LOOP AT ${loopSource} ASSIGNING FIELD-SYMBOL(${loopTargetFieldSymbol}).\\n`;\r\n }\r\n const next = reduceBody.findDirectExpression(Expressions.ReduceNext);\r\n if (next === undefined) {\r\n continue;\r\n }\r\n for (const n of next.getChildren()) {\r\n if (n.concatTokens().toUpperCase() === \"NEXT\") {\r\n continue;\r\n }\r\n else if (n.concatTokens() === \"=\") {\r\n body += \" = \";\r\n }\r\n else if (n.get() instanceof Expressions.Field) {\r\n body += indentation + \" \" + n.concatTokens();\r\n }\r\n else if (n.get() instanceof Expressions.Source) {\r\n body += n.concatTokens() + \".\\n\";\r\n }\r\n }\r\n body += indentation + `ENDLOOP.\\n`;\r\n body += indentation + `${uniqueName} = ${name}.\\n`;\r\n const abap = `DATA ${uniqueName} TYPE ${type}.\\n` +\r\n body +\r\n indentation;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), abap);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), i.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, firstToken, \"Downport REDUCE\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n outlineValue(node, lowFile, highSyntax) {\r\n var _a, _b;\r\n const allSources = node.findAllExpressionsRecursive(Expressions.Source);\r\n for (const i of allSources) {\r\n const firstToken = i.getFirstToken();\r\n if (firstToken.getStr().toUpperCase() !== \"VALUE\") {\r\n continue;\r\n }\r\n const type = this.findType(i, lowFile, highSyntax);\r\n if (type === undefined) {\r\n continue;\r\n }\r\n const valueBody = i.findDirectExpression(Expressions.ValueBody);\r\n const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\r\n let indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n let body = \"\";\r\n const loop = valueBody === null || valueBody === void 0 ? void 0 : valueBody.findFirstExpression(Expressions.InlineLoopDefinition);\r\n if (loop) {\r\n const loopSource = (_a = loop.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n const loopTargetFieldSymbol = (_b = loop.findFirstExpression(Expressions.TargetFieldSymbol)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n body += indentation + `LOOP AT ${loopSource} ASSIGNING FIELD-SYMBOL(${loopTargetFieldSymbol}).\\n`;\r\n indentation += \" \";\r\n }\r\n let structureName = uniqueName;\r\n let added = false;\r\n let data = \"\";\r\n for (const b of (valueBody === null || valueBody === void 0 ? void 0 : valueBody.getChildren()) || []) {\r\n if (b.concatTokens() === \"(\" && added === false) {\r\n structureName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\r\n data = indentation + `DATA ${structureName} LIKE LINE OF ${uniqueName}.\\n`;\r\n }\r\n if (b.get() instanceof Expressions.FieldAssignment) {\r\n if (added === false) {\r\n body += data;\r\n added = true;\r\n }\r\n body += indentation + structureName + \"-\" + b.concatTokens() + \".\\n\";\r\n }\r\n else if (b.get() instanceof Expressions.Source) {\r\n structureName = b.concatTokens();\r\n }\r\n else if (b instanceof nodes_1.ExpressionNode && b.get() instanceof Expressions.Let) {\r\n body += this.outlineLet(b, indentation, highSyntax, lowFile);\r\n }\r\n else if (b.concatTokens() === \")\") {\r\n body += indentation + `APPEND ${structureName} TO ${uniqueName}.\\n`;\r\n }\r\n }\r\n if (loop) {\r\n indentation = indentation.substr(2);\r\n body += indentation + `ENDLOOP.\\n`;\r\n }\r\n const abap = `DATA ${uniqueName} TYPE ${type}.\\n` +\r\n body +\r\n indentation;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), abap);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), i.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, firstToken, \"Downport VALUE\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n outlineLet(node, indentation, highSyntax, lowFile) {\r\n var _a;\r\n let ret = \"\";\r\n for (const f of node.findDirectExpressions(Expressions.InlineFieldDefinition)) {\r\n const c = f.getFirstChild();\r\n if (c === undefined) {\r\n continue;\r\n }\r\n const name = c.concatTokens().toLowerCase();\r\n const spag = highSyntax.spaghetti.lookupPosition(c.getFirstToken().getStart(), lowFile.getFilename());\r\n if (spag === undefined) {\r\n continue;\r\n }\r\n const found = spag.findVariable(name);\r\n if (found === undefined) {\r\n continue;\r\n }\r\n const type = found.getType().getQualifiedName() ? (_a = found.getType().getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toLowerCase() : found.getType().toABAP();\r\n ret += indentation + \"DATA \" + name + ` TYPE ${type}.\\n`;\r\n const source = f.findFirstExpression(Expressions.Source);\r\n if (source) {\r\n ret += indentation + name + ` = ${source.concatTokens()}.\\n`;\r\n }\r\n }\r\n return ret;\r\n }\r\n findType(i, lowFile, highSyntax) {\r\n var _a;\r\n const expr = i.findDirectExpression(Expressions.TypeNameOrInfer);\r\n if (expr === undefined) {\r\n return undefined;\r\n }\r\n const firstToken = expr.getFirstToken();\r\n const concat = expr.concatTokens().toLowerCase();\r\n if (concat !== \"#\") {\r\n return concat;\r\n }\r\n const spag = highSyntax.spaghetti.lookupPosition(firstToken.getStart(), lowFile.getFilename());\r\n if (spag === undefined) {\r\n return undefined;\r\n }\r\n let inferred = undefined;\r\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\r\n if (r.referenceType === _reference_1.ReferenceType.InferredType\r\n && r.resolved\r\n && r.position.getStart().equals(firstToken.getStart())\r\n && r.resolved instanceof _typed_identifier_1.TypedIdentifier) {\r\n inferred = r.resolved;\r\n break;\r\n }\r\n }\r\n if (inferred === undefined) {\r\n return undefined;\r\n }\r\n return (_a = inferred.getType().getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toLowerCase();\r\n }\r\n outlineFS(node, lowFile, highSyntax) {\r\n var _a, _b;\r\n for (const i of node.findAllExpressionsRecursive(Expressions.InlineFS)) {\r\n const nameToken = (_a = i.findDirectExpression(Expressions.TargetFieldSymbol)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\r\n if (nameToken === undefined) {\r\n continue;\r\n }\r\n const name = nameToken.getStr();\r\n const spag = highSyntax.spaghetti.lookupPosition(nameToken.getStart(), lowFile.getFilename());\r\n if (spag === undefined) {\r\n continue;\r\n }\r\n const found = spag.findVariable(name);\r\n if (found === undefined) {\r\n continue;\r\n }\r\n else if (found.getType() instanceof basic_1.VoidType) {\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Error outlining voided type\", this.getMetadata().key, this.conf.severity);\r\n }\r\n const type = found.getType().getQualifiedName() ? (_b = found.getType().getQualifiedName()) === null || _b === void 0 ? void 0 : _b.toLowerCase() : found.getType().toABAP();\r\n const code = `FIELD-SYMBOLS ${name} TYPE ${type}.\\n` +\r\n \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), name);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Outline FIELD-SYMBOL\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n outlineData(node, lowFile, highSyntax) {\r\n var _a, _b;\r\n for (const i of node.findAllExpressionsRecursive(Expressions.InlineData)) {\r\n const nameToken = (_a = i.findDirectExpression(Expressions.TargetField)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\r\n if (nameToken === undefined) {\r\n continue;\r\n }\r\n const name = nameToken.getStr();\r\n const spag = highSyntax.spaghetti.lookupPosition(nameToken.getStart(), lowFile.getFilename());\r\n if (spag === undefined) {\r\n continue;\r\n }\r\n const found = spag.findVariable(name);\r\n if (found === undefined) {\r\n continue;\r\n }\r\n else if (found.getType() instanceof basic_1.VoidType) {\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Error outlining voided type\", this.getMetadata().key, this.conf.severity);\r\n }\r\n const type = found.getType().getQualifiedName() ? (_b = found.getType().getQualifiedName()) === null || _b === void 0 ? void 0 : _b.toLowerCase() : found.getType().toABAP();\r\n const code = `DATA ${name} TYPE ${type}.\\n` +\r\n \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), name);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Outline DATA\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n outlineCond(node, lowFile, highSyntax) {\r\n for (const i of node.findAllExpressionsRecursive(Expressions.Source)) {\r\n if (i.getFirstToken().getStr().toUpperCase() !== \"COND\") {\r\n continue;\r\n }\r\n const body = i.findDirectExpression(Expressions.CondBody);\r\n if (body === undefined) {\r\n continue;\r\n }\r\n const uniqueName = this.uniqueName(i.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const type = this.findType(i, lowFile, highSyntax);\r\n const indent = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const bodyCode = this.buildCondBody(body, uniqueName, indent);\r\n const abap = `DATA ${uniqueName} TYPE ${type}.\\n` + bodyCode;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), abap);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Downport COND\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n buildCondBody(body, uniqueName, indent) {\r\n let code = indent;\r\n for (const c of body.getChildren()) {\r\n if (c instanceof nodes_1.TokenNode) {\r\n switch (c.getFirstToken().getStr().toUpperCase()) {\r\n case \"WHEN\":\r\n code += \"IF \";\r\n break;\r\n case \"THEN\":\r\n code += \".\\n\";\r\n break;\r\n case \"ELSE\":\r\n code += indent + \"ELSE.\\n\";\r\n break;\r\n default:\r\n throw \"buildCondBody, unexpected token\";\r\n }\r\n }\r\n else if (c.get() instanceof Expressions.Cond) {\r\n code += c.concatTokens();\r\n }\r\n else if (c.get() instanceof Expressions.Source) {\r\n code += indent + \" \" + uniqueName + \" = \" + c.concatTokens() + \".\\n\";\r\n }\r\n else {\r\n throw \"buildCondBody, unexpected expression\";\r\n }\r\n }\r\n code += indent + \"ENDIF.\\n\";\r\n code += indent;\r\n return code;\r\n }\r\n outlineConv(node, lowFile, highSyntax) {\r\n var _a;\r\n for (const i of node.findAllExpressionsRecursive(Expressions.Source)) {\r\n if (i.getFirstToken().getStr().toUpperCase() !== \"CONV\") {\r\n continue;\r\n }\r\n const body = (_a = i.findDirectExpression(Expressions.ConvBody)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n if (body === undefined) {\r\n continue;\r\n }\r\n const uniqueName = this.uniqueName(i.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const type = this.findType(i, lowFile, highSyntax);\r\n const indent = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const abap = `DATA ${uniqueName} TYPE ${type}.\\n` +\r\n indent + `${uniqueName} = ${body}.\\n` +\r\n indent;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), abap);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Downport CONV\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n // \"CAST\" to \"?=\"\r\n outlineCast(node, lowFile, highSyntax) {\r\n var _a;\r\n for (const i of node.findAllExpressionsRecursive(Expressions.Cast)) {\r\n const uniqueName = this.uniqueName(i.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const type = this.findType(i, lowFile, highSyntax);\r\n const body = (_a = i.findDirectExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n const abap = `DATA ${uniqueName} TYPE REF TO ${type}.\\n` +\r\n \" \".repeat(node.getFirstToken().getStart().getCol() - 1) +\r\n `${uniqueName} ?= ${body}.\\n` +\r\n \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), abap);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Downport CAST\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n uniqueName(position, filename, highSyntax) {\r\n const spag = highSyntax.spaghetti.lookupPosition(position, filename);\r\n if (spag === undefined) {\r\n return \"uniqueErrorSpag\";\r\n }\r\n while (true) {\r\n const name = \"temp\" + this.counter;\r\n const found = spag.findVariable(name);\r\n this.counter++;\r\n if (found === undefined) {\r\n return name;\r\n }\r\n }\r\n }\r\n replaceXsdBool(node, lowFile, highSyntax) {\r\n const spag = highSyntax.spaghetti.lookupPosition(node.getFirstToken().getStart(), lowFile.getFilename());\r\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\r\n if (r.referenceType === _reference_1.ReferenceType.BuiltinMethodReference\r\n && r.position.getName().toUpperCase() === \"XSDBOOL\") {\r\n const token = r.position.getToken();\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, token.getStart(), token.getEnd(), \"boolc\");\r\n return issue_1.Issue.atToken(lowFile, token, \"Use BOOLC\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n }\r\n return undefined;\r\n }\r\n newToCreateObject(node, lowFile, highSyntax) {\r\n const source = node.findDirectExpression(Expressions.Source);\r\n let fix = undefined;\r\n if (node.get() instanceof Statements.Move\r\n && source\r\n && source.getFirstToken().getStr().toUpperCase() === \"NEW\") {\r\n const target = node.findDirectExpression(Expressions.Target);\r\n const found = source === null || source === void 0 ? void 0 : source.findFirstExpression(Expressions.NewObject);\r\n // must be at top level of the source for quickfix to work(todo: handle more scenarios)\r\n // todo, assumption: the target is not an inline definition\r\n if (target && found && source.concatTokens() === found.concatTokens()) {\r\n const abap = this.newParameters(found, target.concatTokens(), highSyntax, lowFile);\r\n if (abap !== undefined) {\r\n fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getFirstToken().getStart(), node.getLastToken().getEnd(), abap);\r\n }\r\n }\r\n }\r\n if (fix === undefined && node.findAllExpressions(Expressions.NewObject)) {\r\n const found = node.findFirstExpression(Expressions.NewObject);\r\n if (found === undefined) {\r\n return undefined;\r\n }\r\n const name = this.uniqueName(found.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const abap = this.newParameters(found, name, highSyntax, lowFile);\r\n if (abap === undefined) {\r\n return undefined;\r\n }\r\n const type = this.findType(found, lowFile, highSyntax);\r\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const data = `DATA ${name} TYPE REF TO ${type}.\\n` +\r\n indentation + abap + \"\\n\" +\r\n indentation;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), data);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, found.getFirstToken().getStart(), found.getLastToken().getEnd(), name);\r\n fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n }\r\n if (fix) {\r\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Use CREATE OBJECT instead of NEW\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n else {\r\n return undefined;\r\n }\r\n }\r\n newParameters(found, name, highSyntax, lowFile) {\r\n var _a, _b, _c;\r\n const typeToken = (_a = found.findDirectExpression(Expressions.TypeNameOrInfer)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\r\n let extra = (typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStr()) === \"#\" ? \"\" : \" TYPE \" + (typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStr());\r\n const parameters = found.findFirstExpression(Expressions.ParameterListS);\r\n if (parameters) {\r\n extra = parameters ? extra + \" EXPORTING \" + parameters.concatTokens() : extra;\r\n }\r\n else if (typeToken) {\r\n const source = (_b = found.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n if (source) {\r\n // find the default parameter name for the constructor\r\n const spag = highSyntax.spaghetti.lookupPosition(typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStart(), lowFile.getFilename());\r\n let cdef = undefined;\r\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\r\n if ((r.referenceType === _reference_1.ReferenceType.InferredType\r\n || r.referenceType === _reference_1.ReferenceType.ObjectOrientedReference)\r\n && r.resolved && r.position.getStart().equals(typeToken.getStart())) {\r\n cdef = r.resolved;\r\n }\r\n }\r\n if (cdef && cdef.getMethodDefinitions === undefined) {\r\n return undefined; // something wrong\r\n }\r\n const importing = (_c = cdef === null || cdef === void 0 ? void 0 : cdef.getMethodDefinitions().getByName(\"CONSTRUCTOR\")) === null || _c === void 0 ? void 0 : _c.getParameters().getDefaultImporting();\r\n if (importing) {\r\n extra += \" EXPORTING \" + importing + \" = \" + source;\r\n }\r\n else if (spag === undefined) {\r\n extra += \" SpagUndefined\";\r\n }\r\n else if (cdef === undefined) {\r\n extra += \" ClassDefinitionNotFound\";\r\n }\r\n else {\r\n extra += \" SomeError\";\r\n }\r\n }\r\n }\r\n const abap = `CREATE OBJECT ${name}${extra}.`;\r\n return abap;\r\n }\r\n}\r\nexports.Downport = Downport;\r\n//# sourceMappingURL=downport.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/downport.js?");
|
|
11614
11614
|
|
|
11615
11615
|
/***/ }),
|
|
11616
11616
|
|
|
@@ -11654,7 +11654,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11654
11654
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11655
11655
|
|
|
11656
11656
|
"use strict";
|
|
11657
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ExitOrCheck = exports.ExitOrCheckConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass ExitOrCheckConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n this.allowExit = false;\r\n this.allowCheck = false;\r\n }\r\n}\r\nexports.ExitOrCheckConf = ExitOrCheckConf;\r\nclass ExitOrCheck extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ExitOrCheckConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"exit_or_check\",\r\n title: \"Find EXIT or CHECK outside loops\",\r\n shortDescription: `Detects usages of EXIT or CHECK statements outside of loops.\nUse RETURN to leave procesing blocks instead.`,\r\n extendedInformation: `https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenleave_processing_blocks.htm\nhttps://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abapcheck_processing_blocks.htm\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#check-vs-return`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n const stack = [];\r\n for (const statement of file.getStatements()) {\r\n const get = statement.get();\r\n if (get instanceof Statements.Loop\r\n || get instanceof Statements.While\r\n || get instanceof Statements.SelectLoop\r\n || get instanceof Statements.Do) {\r\n stack.push(statement);\r\n }\r\n else if (get instanceof Statements.EndLoop\r\n || get instanceof Statements.EndWhile\r\n || get instanceof Statements.EndSelect\r\n || get instanceof Statements.EndDo) {\r\n stack.pop();\r\n }\r\n else if (this.conf.allowCheck === false && get instanceof Statements.Check && stack.length === 0) {\r\n const message = \"CHECK is not allowed outside of loops\";\r\n let tokensString = statement.concatTokens();\r\n tokensString = tokensString.slice(statement.getFirstToken().getEnd().getCol());\r\n const replacement = \"IF NOT \" + tokensString + \"\\n RETURN.\\nENDIF.\";\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, statement.getFirstToken().getStart(), statement.getLastToken().getEnd(), replacement);\r\n const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n else if (this.conf.allowExit === false && get instanceof Statements.Exit && stack.length === 0) {\r\n const message = \"EXIT is not allowed outside of loops\";\r\n const fix = edit_helper_1.EditHelper.replaceToken(file, statement.getFirstToken(), \"RETURN\");\r\n const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.ExitOrCheck = ExitOrCheck;\r\n//# sourceMappingURL=exit_or_check.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/exit_or_check.js?");
|
|
11657
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ExitOrCheck = exports.ExitOrCheckConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass ExitOrCheckConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n this.allowExit = false;\r\n this.allowCheck = false;\r\n }\r\n}\r\nexports.ExitOrCheckConf = ExitOrCheckConf;\r\nclass ExitOrCheck extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ExitOrCheckConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"exit_or_check\",\r\n title: \"Find EXIT or CHECK outside loops\",\r\n shortDescription: `Detects usages of EXIT or CHECK statements outside of loops.\r\nUse RETURN to leave procesing blocks instead.`,\r\n extendedInformation: `https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenleave_processing_blocks.htm\r\nhttps://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abapcheck_processing_blocks.htm\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#check-vs-return`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n const stack = [];\r\n for (const statement of file.getStatements()) {\r\n const get = statement.get();\r\n if (get instanceof Statements.Loop\r\n || get instanceof Statements.While\r\n || get instanceof Statements.SelectLoop\r\n || get instanceof Statements.Do) {\r\n stack.push(statement);\r\n }\r\n else if (get instanceof Statements.EndLoop\r\n || get instanceof Statements.EndWhile\r\n || get instanceof Statements.EndSelect\r\n || get instanceof Statements.EndDo) {\r\n stack.pop();\r\n }\r\n else if (this.conf.allowCheck === false && get instanceof Statements.Check && stack.length === 0) {\r\n const message = \"CHECK is not allowed outside of loops\";\r\n let tokensString = statement.concatTokens();\r\n tokensString = tokensString.slice(statement.getFirstToken().getEnd().getCol());\r\n const replacement = \"IF NOT \" + tokensString + \"\\n RETURN.\\nENDIF.\";\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, statement.getFirstToken().getStart(), statement.getLastToken().getEnd(), replacement);\r\n const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n else if (this.conf.allowExit === false && get instanceof Statements.Exit && stack.length === 0) {\r\n const message = \"EXIT is not allowed outside of loops\";\r\n const fix = edit_helper_1.EditHelper.replaceToken(file, statement.getFirstToken(), \"RETURN\");\r\n const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.ExitOrCheck = ExitOrCheck;\r\n//# sourceMappingURL=exit_or_check.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/exit_or_check.js?");
|
|
11658
11658
|
|
|
11659
11659
|
/***/ }),
|
|
11660
11660
|
|
|
@@ -11665,7 +11665,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11665
11665
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11666
11666
|
|
|
11667
11667
|
"use strict";
|
|
11668
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Exporting = exports.ExportingConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass ExportingConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.ExportingConf = ExportingConf;\r\nclass Exporting extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ExportingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"exporting\",\r\n title: \"EXPORTING can be omitted\",\r\n shortDescription: `Detects EXPORTING statements which can be omitted.`,\r\n badExample: `call_method( EXPORTING foo = bar ).`,\r\n goodExample: `call_method( foo = bar ).`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#omit-the-optional-keyword-exporting\nhttps://docs.abapopenchecks.org/checks/30/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getMessage() {\r\n return \"The EXPORTING keyword can be omitted\";\r\n }\r\n runParsed(file, obj) {\r\n let issues = [];\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n for (const statement of file.getStatements()) {\r\n const expressions = statement.findAllExpressionsMulti([expressions_1.MethodCallBody, expressions_1.MethodCall]);\r\n for (const b of expressions) {\r\n if (b.get() instanceof expressions_1.MethodCallBody) {\r\n if (b.getFirstToken().getStr() !== \"(\") {\r\n continue;\r\n }\r\n issues = issues.concat(this.check(b, file));\r\n }\r\n else if (b.get() instanceof expressions_1.MethodCall) {\r\n issues = issues.concat(this.check(b, file));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n check(node, file) {\r\n const e = node.findFirstExpression(expressions_1.MethodParameters);\r\n if (e === undefined) {\r\n return [];\r\n }\r\n if (e.getFirstToken().getStr().toUpperCase() !== \"EXPORTING\") {\r\n return [];\r\n }\r\n const tokens = e.getDirectTokens();\r\n const strings = tokens.map(t => t.getStr().toUpperCase());\r\n if (strings[0] === \"EXPORTING\"\r\n && strings.includes(\"IMPORTING\") === false\r\n && strings.includes(\"RECEIVING\") === false\r\n && strings.includes(\"EXCEPTIONS\") === false\r\n && strings.includes(\"CHANGING\") === false) {\r\n const next = e.getAllTokens()[1];\r\n const fix = edit_helper_1.EditHelper.deleteRange(file, tokens[0].getStart(), next.getStart());\r\n const issue = issue_1.Issue.atToken(file, tokens[0], this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n return [issue];\r\n }\r\n return [];\r\n }\r\n}\r\nexports.Exporting = Exporting;\r\n//# sourceMappingURL=exporting.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/exporting.js?");
|
|
11668
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Exporting = exports.ExportingConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass ExportingConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.ExportingConf = ExportingConf;\r\nclass Exporting extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ExportingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"exporting\",\r\n title: \"EXPORTING can be omitted\",\r\n shortDescription: `Detects EXPORTING statements which can be omitted.`,\r\n badExample: `call_method( EXPORTING foo = bar ).`,\r\n goodExample: `call_method( foo = bar ).`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#omit-the-optional-keyword-exporting\r\nhttps://docs.abapopenchecks.org/checks/30/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getMessage() {\r\n return \"The EXPORTING keyword can be omitted\";\r\n }\r\n runParsed(file, obj) {\r\n let issues = [];\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n for (const statement of file.getStatements()) {\r\n const expressions = statement.findAllExpressionsMulti([expressions_1.MethodCallBody, expressions_1.MethodCall]);\r\n for (const b of expressions) {\r\n if (b.get() instanceof expressions_1.MethodCallBody) {\r\n if (b.getFirstToken().getStr() !== \"(\") {\r\n continue;\r\n }\r\n issues = issues.concat(this.check(b, file));\r\n }\r\n else if (b.get() instanceof expressions_1.MethodCall) {\r\n issues = issues.concat(this.check(b, file));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n check(node, file) {\r\n const e = node.findFirstExpression(expressions_1.MethodParameters);\r\n if (e === undefined) {\r\n return [];\r\n }\r\n if (e.getFirstToken().getStr().toUpperCase() !== \"EXPORTING\") {\r\n return [];\r\n }\r\n const tokens = e.getDirectTokens();\r\n const strings = tokens.map(t => t.getStr().toUpperCase());\r\n if (strings[0] === \"EXPORTING\"\r\n && strings.includes(\"IMPORTING\") === false\r\n && strings.includes(\"RECEIVING\") === false\r\n && strings.includes(\"EXCEPTIONS\") === false\r\n && strings.includes(\"CHANGING\") === false) {\r\n const next = e.getAllTokens()[1];\r\n const fix = edit_helper_1.EditHelper.deleteRange(file, tokens[0].getStart(), next.getStart());\r\n const issue = issue_1.Issue.atToken(file, tokens[0], this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n return [issue];\r\n }\r\n return [];\r\n }\r\n}\r\nexports.Exporting = Exporting;\r\n//# sourceMappingURL=exporting.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/exporting.js?");
|
|
11669
11669
|
|
|
11670
11670
|
/***/ }),
|
|
11671
11671
|
|
|
@@ -11676,7 +11676,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11676
11676
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11677
11677
|
|
|
11678
11678
|
"use strict";
|
|
11679
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ForbiddenIdentifier = exports.ForbiddenIdentifierConf = void 0;\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass ForbiddenIdentifierConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** List of forbideen identifiers, array of string regex\r\n * @uniqueItems true\r\n */\r\n this.check = [];\r\n }\r\n}\r\nexports.ForbiddenIdentifierConf = ForbiddenIdentifierConf;\r\nclass ForbiddenIdentifier extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ForbiddenIdentifierConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"forbidden_identifier\",\r\n title: \"Forbidden Identifier\",\r\n shortDescription: `Forbid use of specified identifiers, list of regex.`,\r\n extendedInformation: `Used in the transpiler to find javascript keywords in ABAP identifiers,\nhttps://github.com/abaplint/transpiler/blob/bda94b8b56e2b7f2f87be2168f12361aa530220e/packages/transpiler/src/validation.ts#L44`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n if (this.conf.check === undefined) {\r\n this.conf.check = [];\r\n }\r\n }\r\n runParsed(file) {\r\n if (this.conf.check.length === 0) {\r\n return [];\r\n }\r\n let ret = [];\r\n for (const s of file.getStatements()) {\r\n ret = ret.concat(this.traverse(s, file));\r\n }\r\n return ret;\r\n }\r\n traverse(node, file) {\r\n let ret = [];\r\n for (const c of node.getChildren()) {\r\n if (c instanceof nodes_1.TokenNodeRegex) {\r\n ret = ret.concat(this.check(c.get(), file));\r\n }\r\n else if (c instanceof nodes_1.TokenNode) {\r\n continue;\r\n }\r\n else {\r\n ret = ret.concat(this.traverse(c, file));\r\n }\r\n }\r\n return ret;\r\n }\r\n check(token, file) {\r\n const str = token.getStr();\r\n const ret = [];\r\n for (const c of this.conf.check) {\r\n const reg = new RegExp(c, \"i\");\r\n if (reg.exec(str)) {\r\n const message = \"Identifer \\\"\" + str + \"\\\" not allowed\";\r\n ret.push(issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.ForbiddenIdentifier = ForbiddenIdentifier;\r\n//# sourceMappingURL=forbidden_identifier.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/forbidden_identifier.js?");
|
|
11679
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ForbiddenIdentifier = exports.ForbiddenIdentifierConf = void 0;\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass ForbiddenIdentifierConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** List of forbideen identifiers, array of string regex\r\n * @uniqueItems true\r\n */\r\n this.check = [];\r\n }\r\n}\r\nexports.ForbiddenIdentifierConf = ForbiddenIdentifierConf;\r\nclass ForbiddenIdentifier extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ForbiddenIdentifierConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"forbidden_identifier\",\r\n title: \"Forbidden Identifier\",\r\n shortDescription: `Forbid use of specified identifiers, list of regex.`,\r\n extendedInformation: `Used in the transpiler to find javascript keywords in ABAP identifiers,\r\nhttps://github.com/abaplint/transpiler/blob/bda94b8b56e2b7f2f87be2168f12361aa530220e/packages/transpiler/src/validation.ts#L44`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n if (this.conf.check === undefined) {\r\n this.conf.check = [];\r\n }\r\n }\r\n runParsed(file) {\r\n if (this.conf.check.length === 0) {\r\n return [];\r\n }\r\n let ret = [];\r\n for (const s of file.getStatements()) {\r\n ret = ret.concat(this.traverse(s, file));\r\n }\r\n return ret;\r\n }\r\n traverse(node, file) {\r\n let ret = [];\r\n for (const c of node.getChildren()) {\r\n if (c instanceof nodes_1.TokenNodeRegex) {\r\n ret = ret.concat(this.check(c.get(), file));\r\n }\r\n else if (c instanceof nodes_1.TokenNode) {\r\n continue;\r\n }\r\n else {\r\n ret = ret.concat(this.traverse(c, file));\r\n }\r\n }\r\n return ret;\r\n }\r\n check(token, file) {\r\n const str = token.getStr();\r\n const ret = [];\r\n for (const c of this.conf.check) {\r\n const reg = new RegExp(c, \"i\");\r\n if (reg.exec(str)) {\r\n const message = \"Identifer \\\"\" + str + \"\\\" not allowed\";\r\n ret.push(issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.ForbiddenIdentifier = ForbiddenIdentifier;\r\n//# sourceMappingURL=forbidden_identifier.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/forbidden_identifier.js?");
|
|
11680
11680
|
|
|
11681
11681
|
/***/ }),
|
|
11682
11682
|
|
|
@@ -11698,7 +11698,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11698
11698
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11699
11699
|
|
|
11700
11700
|
"use strict";
|
|
11701
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ForbiddenVoidType = exports.ForbiddenVoidTypeConf = void 0;\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst void_type_1 = __webpack_require__(/*! ../abap/types/basic/void_type */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/void_type.js\");\r\nconst _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\r\nconst basic_1 = __webpack_require__(/*! ../abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nclass ForbiddenVoidTypeConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** List of forbidden void types, array of string regex, case in-sensitive\r\n * @uniqueItems true\r\n */\r\n this.check = [];\r\n }\r\n}\r\nexports.ForbiddenVoidTypeConf = ForbiddenVoidTypeConf;\r\nclass ForbiddenVoidType {\r\n constructor() {\r\n this.conf = new ForbiddenVoidTypeConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"forbidden_void_type\",\r\n title: \"Forbidden Void Types\",\r\n shortDescription: `Avoid usage of specified void types.`,\r\n extendedInformation: `Inspiration:\nBOOLEAN, BOOLE_D, CHAR01, CHAR1, CHAR10, CHAR12, CHAR128, CHAR2, CHAR20, CHAR4, CHAR70,\nDATS, TIMS, DATUM, FLAG, INT4, NUMC3, NUMC4, SAP_BOOL, TEXT25, TEXT80, X255, XFELD`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n if (this.conf.check === undefined) {\r\n this.conf.check = [];\r\n }\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof _abap_object_1.ABAPObject) || this.conf.check.length === 0) {\r\n return [];\r\n }\r\n return this.traverse(new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti.getTop());\r\n }\r\n ///////////////\r\n traverse(node) {\r\n var _a, _b, _c;\r\n let ret = [];\r\n const message = \"Forbidden void type: \";\r\n if (node.getIdentifier().stype !== _scope_type_1.ScopeType.BuiltIn) {\r\n for (const r of node.getData().references) {\r\n if (r.referenceType === _reference_1.ReferenceType.ObjectOrientedVoidReference\r\n && ((_a = r.extra) === null || _a === void 0 ? void 0 : _a.ooName) !== undefined\r\n && this.isForbiddenName((_b = r.extra) === null || _b === void 0 ? void 0 : _b.ooName)) {\r\n ret.push(issue_1.Issue.atIdentifier(r.position, message + ((_c = r.extra) === null || _c === void 0 ? void 0 : _c.ooName), this.getMetadata().key, this.conf.severity));\r\n }\r\n if ((r.referenceType === _reference_1.ReferenceType.VoidType\r\n || r.referenceType === _reference_1.ReferenceType.TableVoidReference)\r\n && this.isForbiddenName(r.position.getName())) {\r\n ret.push(issue_1.Issue.atIdentifier(r.position, message + r.position.getName(), this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n }\r\n for (const c of node.getChildren()) {\r\n ret = ret.concat(this.traverse(c));\r\n }\r\n return ret;\r\n }\r\n isForbiddenType(type) {\r\n if (type instanceof basic_1.StructureType) {\r\n return type.getComponents().some(c => this.isForbiddenType(c.type));\r\n }\r\n else if (!(type instanceof void_type_1.VoidType)) {\r\n return false;\r\n }\r\n const name = type.getVoided();\r\n return this.isForbiddenName(name);\r\n }\r\n isForbiddenName(name) {\r\n if (name === undefined) {\r\n return false;\r\n }\r\n for (const c of this.conf.check) {\r\n const reg = new RegExp(c, \"i\");\r\n const match = reg.test(name);\r\n if (match === true) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\nexports.ForbiddenVoidType = ForbiddenVoidType;\r\n//# sourceMappingURL=forbidden_void_type.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/forbidden_void_type.js?");
|
|
11701
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ForbiddenVoidType = exports.ForbiddenVoidTypeConf = void 0;\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst void_type_1 = __webpack_require__(/*! ../abap/types/basic/void_type */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/void_type.js\");\r\nconst _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\r\nconst basic_1 = __webpack_require__(/*! ../abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nclass ForbiddenVoidTypeConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** List of forbidden void types, array of string regex, case in-sensitive\r\n * @uniqueItems true\r\n */\r\n this.check = [];\r\n }\r\n}\r\nexports.ForbiddenVoidTypeConf = ForbiddenVoidTypeConf;\r\nclass ForbiddenVoidType {\r\n constructor() {\r\n this.conf = new ForbiddenVoidTypeConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"forbidden_void_type\",\r\n title: \"Forbidden Void Types\",\r\n shortDescription: `Avoid usage of specified void types.`,\r\n extendedInformation: `Inspiration:\r\nBOOLEAN, BOOLE_D, CHAR01, CHAR1, CHAR10, CHAR12, CHAR128, CHAR2, CHAR20, CHAR4, CHAR70,\r\nDATS, TIMS, DATUM, FLAG, INT4, NUMC3, NUMC4, SAP_BOOL, TEXT25, TEXT80, X255, XFELD`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n if (this.conf.check === undefined) {\r\n this.conf.check = [];\r\n }\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof _abap_object_1.ABAPObject) || this.conf.check.length === 0) {\r\n return [];\r\n }\r\n return this.traverse(new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti.getTop());\r\n }\r\n ///////////////\r\n traverse(node) {\r\n var _a, _b, _c;\r\n let ret = [];\r\n const message = \"Forbidden void type: \";\r\n if (node.getIdentifier().stype !== _scope_type_1.ScopeType.BuiltIn) {\r\n for (const r of node.getData().references) {\r\n if (r.referenceType === _reference_1.ReferenceType.ObjectOrientedVoidReference\r\n && ((_a = r.extra) === null || _a === void 0 ? void 0 : _a.ooName) !== undefined\r\n && this.isForbiddenName((_b = r.extra) === null || _b === void 0 ? void 0 : _b.ooName)) {\r\n ret.push(issue_1.Issue.atIdentifier(r.position, message + ((_c = r.extra) === null || _c === void 0 ? void 0 : _c.ooName), this.getMetadata().key, this.conf.severity));\r\n }\r\n if ((r.referenceType === _reference_1.ReferenceType.VoidType\r\n || r.referenceType === _reference_1.ReferenceType.TableVoidReference)\r\n && this.isForbiddenName(r.position.getName())) {\r\n ret.push(issue_1.Issue.atIdentifier(r.position, message + r.position.getName(), this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n }\r\n for (const c of node.getChildren()) {\r\n ret = ret.concat(this.traverse(c));\r\n }\r\n return ret;\r\n }\r\n isForbiddenType(type) {\r\n if (type instanceof basic_1.StructureType) {\r\n return type.getComponents().some(c => this.isForbiddenType(c.type));\r\n }\r\n else if (!(type instanceof void_type_1.VoidType)) {\r\n return false;\r\n }\r\n const name = type.getVoided();\r\n return this.isForbiddenName(name);\r\n }\r\n isForbiddenName(name) {\r\n if (name === undefined) {\r\n return false;\r\n }\r\n for (const c of this.conf.check) {\r\n const reg = new RegExp(c, \"i\");\r\n const match = reg.test(name);\r\n if (match === true) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\nexports.ForbiddenVoidType = ForbiddenVoidType;\r\n//# sourceMappingURL=forbidden_void_type.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/forbidden_void_type.js?");
|
|
11702
11702
|
|
|
11703
11703
|
/***/ }),
|
|
11704
11704
|
|
|
@@ -11742,7 +11742,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11742
11742
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11743
11743
|
|
|
11744
11744
|
"use strict";
|
|
11745
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FunctionalWriting = exports.FunctionalWritingConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass FunctionalWritingConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Ignore functional writing in exception classes, local + global */\r\n this.ignoreExceptions = true;\r\n }\r\n}\r\nexports.FunctionalWritingConf = FunctionalWritingConf;\r\nclass FunctionalWriting extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new FunctionalWritingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"functional_writing\",\r\n title: \"Use functional writing\",\r\n shortDescription: `Detects usage of call method when functional style calls can be used.`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-functional-to-procedural-calls\nhttps://docs.abapopenchecks.org/checks/07/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n badExample: `CALL METHOD zcl_class=>method( ).\nCALL METHOD cl_abap_typedescr=>describe_by_name\n EXPORTING\n p_name = 'NAME'\n RECEIVING\n p_descr_ref = lr_typedescr\n EXCEPTIONS\n type_not_found = 1\n OTHERS = 2.`,\r\n goodExample: `zcl_class=>method( ).\ncl_abap_typedescr=>describe_by_name(\n EXPORTING\n p_name = 'NAME'\n RECEIVING\n p_descr_ref = lr_typedescr\n EXCEPTIONS\n type_not_found = 1\n OTHERS = 2 ).`,\r\n };\r\n }\r\n getMessage() {\r\n return \"Use functional writing style for method calls\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file, obj) {\r\n var _a, _b;\r\n const issues = [];\r\n let exception = false;\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n let definition = undefined;\r\n if (obj instanceof objects_1.Class) {\r\n definition = obj.getClassDefinition();\r\n }\r\n const ddic = new ddic_1.DDIC(this.reg);\r\n for (const statNode of file.getStatements()) {\r\n if (statNode.get() instanceof Statements.ClassImplementation\r\n && definition\r\n && ddic.isException(definition, obj)\r\n && this.conf.ignoreExceptions) {\r\n exception = true;\r\n }\r\n else if (statNode.get() instanceof Statements.EndClass) {\r\n exception = false;\r\n }\r\n else if (exception === false && statNode.get() instanceof Statements.Call) {\r\n if (((_a = statNode.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.MethodCallChain) {\r\n continue;\r\n }\r\n const dynamic = (_b = statNode.findDirectExpression(Expressions.MethodSource)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.Dynamic);\r\n if (dynamic !== undefined) {\r\n continue;\r\n }\r\n issues.push(this.createIssueForStatementNode(file, statNode));\r\n }\r\n }\r\n return issues;\r\n }\r\n createIssueForStatementNode(file, statNode) {\r\n const fixString = this.buildFixString(statNode);\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, statNode.getStart(), statNode.getEnd(), fixString);\r\n return issue_1.Issue.atStatement(file, statNode, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n buildFixString(statNode) {\r\n // Note: line breaks from source are lost\r\n const methodSource = statNode.findDirectExpression(Expressions.MethodSource);\r\n let methodSourceStr = methodSource === null || methodSource === void 0 ? void 0 : methodSource.concatTokens();\r\n const methodBody = statNode.findDirectExpression(Expressions.MethodCallBody);\r\n let methodBodyStr = \"\";\r\n if (methodBody) {\r\n const methodCallParam = methodBody.findDirectExpression(Expressions.MethodCallParam);\r\n if (methodCallParam && methodCallParam.getFirstToken().getStr() === \"(\") {\r\n // has parameters and parantheses\r\n methodBodyStr = `${methodBody.concatTokens()}.`;\r\n }\r\n else {\r\n // has parameters, but parentheses are missing\r\n methodSourceStr = `${methodSourceStr}( `;\r\n methodBodyStr = `${methodBody.concatTokens()} ).`;\r\n }\r\n }\r\n else {\r\n // no body means no parentheses and no parameters\r\n methodBodyStr = \"( ).\";\r\n }\r\n return methodSourceStr + methodBodyStr;\r\n }\r\n}\r\nexports.FunctionalWriting = FunctionalWriting;\r\n//# sourceMappingURL=functional_writing.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/functional_writing.js?");
|
|
11745
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FunctionalWriting = exports.FunctionalWritingConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass FunctionalWritingConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Ignore functional writing in exception classes, local + global */\r\n this.ignoreExceptions = true;\r\n }\r\n}\r\nexports.FunctionalWritingConf = FunctionalWritingConf;\r\nclass FunctionalWriting extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new FunctionalWritingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"functional_writing\",\r\n title: \"Use functional writing\",\r\n shortDescription: `Detects usage of call method when functional style calls can be used.`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-functional-to-procedural-calls\r\nhttps://docs.abapopenchecks.org/checks/07/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n badExample: `CALL METHOD zcl_class=>method( ).\r\nCALL METHOD cl_abap_typedescr=>describe_by_name\r\n EXPORTING\r\n p_name = 'NAME'\r\n RECEIVING\r\n p_descr_ref = lr_typedescr\r\n EXCEPTIONS\r\n type_not_found = 1\r\n OTHERS = 2.`,\r\n goodExample: `zcl_class=>method( ).\r\ncl_abap_typedescr=>describe_by_name(\r\n EXPORTING\r\n p_name = 'NAME'\r\n RECEIVING\r\n p_descr_ref = lr_typedescr\r\n EXCEPTIONS\r\n type_not_found = 1\r\n OTHERS = 2 ).`,\r\n };\r\n }\r\n getMessage() {\r\n return \"Use functional writing style for method calls\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file, obj) {\r\n var _a, _b;\r\n const issues = [];\r\n let exception = false;\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n let definition = undefined;\r\n if (obj instanceof objects_1.Class) {\r\n definition = obj.getClassDefinition();\r\n }\r\n const ddic = new ddic_1.DDIC(this.reg);\r\n for (const statNode of file.getStatements()) {\r\n if (statNode.get() instanceof Statements.ClassImplementation\r\n && definition\r\n && ddic.isException(definition, obj)\r\n && this.conf.ignoreExceptions) {\r\n exception = true;\r\n }\r\n else if (statNode.get() instanceof Statements.EndClass) {\r\n exception = false;\r\n }\r\n else if (exception === false && statNode.get() instanceof Statements.Call) {\r\n if (((_a = statNode.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.MethodCallChain) {\r\n continue;\r\n }\r\n const dynamic = (_b = statNode.findDirectExpression(Expressions.MethodSource)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.Dynamic);\r\n if (dynamic !== undefined) {\r\n continue;\r\n }\r\n issues.push(this.createIssueForStatementNode(file, statNode));\r\n }\r\n }\r\n return issues;\r\n }\r\n createIssueForStatementNode(file, statNode) {\r\n const fixString = this.buildFixString(statNode);\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, statNode.getStart(), statNode.getEnd(), fixString);\r\n return issue_1.Issue.atStatement(file, statNode, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n buildFixString(statNode) {\r\n // Note: line breaks from source are lost\r\n const methodSource = statNode.findDirectExpression(Expressions.MethodSource);\r\n let methodSourceStr = methodSource === null || methodSource === void 0 ? void 0 : methodSource.concatTokens();\r\n const methodBody = statNode.findDirectExpression(Expressions.MethodCallBody);\r\n let methodBodyStr = \"\";\r\n if (methodBody) {\r\n const methodCallParam = methodBody.findDirectExpression(Expressions.MethodCallParam);\r\n if (methodCallParam && methodCallParam.getFirstToken().getStr() === \"(\") {\r\n // has parameters and parantheses\r\n methodBodyStr = `${methodBody.concatTokens()}.`;\r\n }\r\n else {\r\n // has parameters, but parentheses are missing\r\n methodSourceStr = `${methodSourceStr}( `;\r\n methodBodyStr = `${methodBody.concatTokens()} ).`;\r\n }\r\n }\r\n else {\r\n // no body means no parentheses and no parameters\r\n methodBodyStr = \"( ).\";\r\n }\r\n return methodSourceStr + methodBodyStr;\r\n }\r\n}\r\nexports.FunctionalWriting = FunctionalWriting;\r\n//# sourceMappingURL=functional_writing.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/functional_writing.js?");
|
|
11746
11746
|
|
|
11747
11747
|
/***/ }),
|
|
11748
11748
|
|
|
@@ -11753,7 +11753,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11753
11753
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11754
11754
|
|
|
11755
11755
|
"use strict";
|
|
11756
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.GlobalClass = exports.GlobalClassConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst Objects = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass GlobalClassConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.GlobalClassConf = GlobalClassConf;\r\nclass GlobalClass extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new GlobalClassConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"global_class\",\r\n title: \"Global class checks\",\r\n shortDescription: `Checks related to global classes.\n\n* global classes must be in own files\n\n* file names must match class name\n\n* file names must match interface name\n\n* global classes must be global definitions\n\n* global interfaces must be global definitions`,\r\n tags: [_irule_1.RuleTag.Syntax],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file, obj) {\r\n const output = [];\r\n for (const definition of file.getInfo().listClassDefinitions()) {\r\n if (definition.isLocal && obj instanceof Objects.Class && file.getFilename().match(/\\.clas\\.abap$/)) {\r\n const issue = issue_1.Issue.atIdentifier(definition.identifier, \"Global classes must be global\", this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n if (definition.isGlobal && obj instanceof Objects.Class && definition.name.toUpperCase() !== obj.getName().toUpperCase()) {\r\n const issue = issue_1.Issue.atIdentifier(definition.identifier, \"Class definition name must match filename\", this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n if (definition.isGlobal && !(obj instanceof Objects.Class)) {\r\n const issue = issue_1.Issue.atIdentifier(definition.identifier, \"Class must be local\", this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n }\r\n for (const impl of file.getInfo().listClassImplementations()) {\r\n if (file.getFilename().match(/\\.clas\\.abap$/)\r\n && obj instanceof Objects.Class\r\n && impl.identifier.getName().toUpperCase() !== obj.getName().toUpperCase()) {\r\n const issue = issue_1.Issue.atIdentifier(impl.identifier, \"Class implementation name must match filename\", this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n }\r\n for (const impl of file.getInfo().listInterfaceDefinitions()) {\r\n if (file.getFilename().match(/\\.intf\\.abap$/)\r\n && obj instanceof Objects.Interface\r\n && impl.identifier.getName().toUpperCase() !== obj.getName().toUpperCase()) {\r\n const issue = issue_1.Issue.atIdentifier(impl.identifier, \"Interface implementation name must match filename\", this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n }\r\n for (const intf of file.getInfo().listInterfaceDefinitions()) {\r\n if (intf.isLocal && obj instanceof Objects.Interface && file.getFilename().match(/\\.intf\\.abap$/)) {\r\n const issue = issue_1.Issue.atIdentifier(intf.identifier, \"Global interface must be global\", this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n }\r\n return output;\r\n }\r\n}\r\nexports.GlobalClass = GlobalClass;\r\n//# sourceMappingURL=global_class.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/global_class.js?");
|
|
11756
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.GlobalClass = exports.GlobalClassConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst Objects = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass GlobalClassConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.GlobalClassConf = GlobalClassConf;\r\nclass GlobalClass extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new GlobalClassConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"global_class\",\r\n title: \"Global class checks\",\r\n shortDescription: `Checks related to global classes.\r\n\r\n* global classes must be in own files\r\n\r\n* file names must match class name\r\n\r\n* file names must match interface name\r\n\r\n* global classes must be global definitions\r\n\r\n* global interfaces must be global definitions`,\r\n tags: [_irule_1.RuleTag.Syntax],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file, obj) {\r\n const output = [];\r\n for (const definition of file.getInfo().listClassDefinitions()) {\r\n if (definition.isLocal && obj instanceof Objects.Class && file.getFilename().match(/\\.clas\\.abap$/)) {\r\n const issue = issue_1.Issue.atIdentifier(definition.identifier, \"Global classes must be global\", this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n if (definition.isGlobal && obj instanceof Objects.Class && definition.name.toUpperCase() !== obj.getName().toUpperCase()) {\r\n const issue = issue_1.Issue.atIdentifier(definition.identifier, \"Class definition name must match filename\", this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n if (definition.isGlobal && !(obj instanceof Objects.Class)) {\r\n const issue = issue_1.Issue.atIdentifier(definition.identifier, \"Class must be local\", this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n }\r\n for (const impl of file.getInfo().listClassImplementations()) {\r\n if (file.getFilename().match(/\\.clas\\.abap$/)\r\n && obj instanceof Objects.Class\r\n && impl.identifier.getName().toUpperCase() !== obj.getName().toUpperCase()) {\r\n const issue = issue_1.Issue.atIdentifier(impl.identifier, \"Class implementation name must match filename\", this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n }\r\n for (const impl of file.getInfo().listInterfaceDefinitions()) {\r\n if (file.getFilename().match(/\\.intf\\.abap$/)\r\n && obj instanceof Objects.Interface\r\n && impl.identifier.getName().toUpperCase() !== obj.getName().toUpperCase()) {\r\n const issue = issue_1.Issue.atIdentifier(impl.identifier, \"Interface implementation name must match filename\", this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n }\r\n for (const intf of file.getInfo().listInterfaceDefinitions()) {\r\n if (intf.isLocal && obj instanceof Objects.Interface && file.getFilename().match(/\\.intf\\.abap$/)) {\r\n const issue = issue_1.Issue.atIdentifier(intf.identifier, \"Global interface must be global\", this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n }\r\n return output;\r\n }\r\n}\r\nexports.GlobalClass = GlobalClass;\r\n//# sourceMappingURL=global_class.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/global_class.js?");
|
|
11757
11757
|
|
|
11758
11758
|
/***/ }),
|
|
11759
11759
|
|
|
@@ -11764,7 +11764,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11764
11764
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11765
11765
|
|
|
11766
11766
|
"use strict";
|
|
11767
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.IdenticalConditions = exports.IdenticalConditionsConf = void 0;\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nclass Conditions {\r\n constructor() {\r\n this.arr = [];\r\n this.arr = [];\r\n }\r\n push(e) {\r\n this.arr.push(e.concatTokens());\r\n }\r\n hasDuplicates() {\r\n return this.arr.some(x => this.arr.indexOf(x) !== this.arr.lastIndexOf(x));\r\n }\r\n}\r\nclass IdenticalConditionsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.IdenticalConditionsConf = IdenticalConditionsConf;\r\nclass IdenticalConditions extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new IdenticalConditionsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"identical_conditions\",\r\n title: \"Identical conditions\",\r\n shortDescription: `Find identical conditions in IF + CASE + WHILE etc\n\nPrerequsites: code is pretty printed with identical cAsE`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n let issues = [];\r\n const structure = file.getStructure();\r\n if (structure === undefined) {\r\n return [];\r\n }\r\n for (const i of structure.findAllStructures(Structures.If)) {\r\n issues = issues.concat(this.analyzeIf(file, i));\r\n }\r\n for (const i of structure.findAllStructures(Structures.Case)) {\r\n issues = issues.concat(this.analyzeWhen(file, i));\r\n }\r\n for (const i of structure.findAllExpressions(Expressions.Cond)) {\r\n issues = issues.concat(this.analyzeCond(file, i));\r\n }\r\n return issues;\r\n }\r\n ////////////////\r\n analyzeCond(file, node) {\r\n const conditions = new Conditions();\r\n let operator = \"\";\r\n for (const c of node.getChildren()) {\r\n if (c instanceof nodes_1.ExpressionNode) {\r\n conditions.push(c);\r\n }\r\n else if (operator === \"\") {\r\n operator = c.get().getStr().toUpperCase();\r\n }\r\n else if (operator !== c.get().getStr().toUpperCase()) {\r\n return [];\r\n }\r\n }\r\n if (conditions.hasDuplicates()) {\r\n const message = \"Identical conditions\";\r\n const issue = issue_1.Issue.atToken(file, node.getFirstToken(), message, this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n return [];\r\n }\r\n analyzeIf(file, node) {\r\n var _a;\r\n const conditions = new Conditions();\r\n const i = node.findDirectStatement(Statements.If);\r\n if (i === undefined) {\r\n throw new Error(\"identical_conditions, no IF found\");\r\n }\r\n const c = i === null || i === void 0 ? void 0 : i.findDirectExpression(Expressions.Cond);\r\n if (c) {\r\n conditions.push(c);\r\n }\r\n for (const e of node.findDirectStructures(Structures.ElseIf)) {\r\n const c = (_a = e.findDirectStatement(Statements.ElseIf)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Cond);\r\n if (c) {\r\n conditions.push(c);\r\n }\r\n }\r\n if (conditions.hasDuplicates()) {\r\n const message = \"Identical conditions\";\r\n const issue = issue_1.Issue.atStatement(file, i, message, this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n return [];\r\n }\r\n analyzeWhen(file, node) {\r\n const conditions = new Conditions();\r\n const i = node.findDirectStatement(Statements.Case);\r\n if (i === undefined) {\r\n throw new Error(\"identical_conditions, no CASE found\");\r\n }\r\n for (const e of node.findDirectStructures(Structures.When)) {\r\n const w = e.findDirectStatement(Statements.When);\r\n if (w === undefined) {\r\n continue;\r\n }\r\n for (const s of w.findAllExpressions(Expressions.Source)) {\r\n conditions.push(s);\r\n }\r\n }\r\n if (conditions.hasDuplicates()) {\r\n const message = \"Identical conditions\";\r\n const issue = issue_1.Issue.atStatement(file, i, message, this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n return [];\r\n }\r\n}\r\nexports.IdenticalConditions = IdenticalConditions;\r\n//# sourceMappingURL=identical_conditions.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/identical_conditions.js?");
|
|
11767
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.IdenticalConditions = exports.IdenticalConditionsConf = void 0;\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nclass Conditions {\r\n constructor() {\r\n this.arr = [];\r\n this.arr = [];\r\n }\r\n push(e) {\r\n this.arr.push(e.concatTokens());\r\n }\r\n hasDuplicates() {\r\n return this.arr.some(x => this.arr.indexOf(x) !== this.arr.lastIndexOf(x));\r\n }\r\n}\r\nclass IdenticalConditionsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.IdenticalConditionsConf = IdenticalConditionsConf;\r\nclass IdenticalConditions extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new IdenticalConditionsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"identical_conditions\",\r\n title: \"Identical conditions\",\r\n shortDescription: `Find identical conditions in IF + CASE + WHILE etc\r\n\r\nPrerequsites: code is pretty printed with identical cAsE`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n let issues = [];\r\n const structure = file.getStructure();\r\n if (structure === undefined) {\r\n return [];\r\n }\r\n for (const i of structure.findAllStructures(Structures.If)) {\r\n issues = issues.concat(this.analyzeIf(file, i));\r\n }\r\n for (const i of structure.findAllStructures(Structures.Case)) {\r\n issues = issues.concat(this.analyzeWhen(file, i));\r\n }\r\n for (const i of structure.findAllExpressions(Expressions.Cond)) {\r\n issues = issues.concat(this.analyzeCond(file, i));\r\n }\r\n return issues;\r\n }\r\n ////////////////\r\n analyzeCond(file, node) {\r\n const conditions = new Conditions();\r\n let operator = \"\";\r\n for (const c of node.getChildren()) {\r\n if (c instanceof nodes_1.ExpressionNode) {\r\n conditions.push(c);\r\n }\r\n else if (operator === \"\") {\r\n operator = c.get().getStr().toUpperCase();\r\n }\r\n else if (operator !== c.get().getStr().toUpperCase()) {\r\n return [];\r\n }\r\n }\r\n if (conditions.hasDuplicates()) {\r\n const message = \"Identical conditions\";\r\n const issue = issue_1.Issue.atToken(file, node.getFirstToken(), message, this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n return [];\r\n }\r\n analyzeIf(file, node) {\r\n var _a;\r\n const conditions = new Conditions();\r\n const i = node.findDirectStatement(Statements.If);\r\n if (i === undefined) {\r\n throw new Error(\"identical_conditions, no IF found\");\r\n }\r\n const c = i === null || i === void 0 ? void 0 : i.findDirectExpression(Expressions.Cond);\r\n if (c) {\r\n conditions.push(c);\r\n }\r\n for (const e of node.findDirectStructures(Structures.ElseIf)) {\r\n const c = (_a = e.findDirectStatement(Statements.ElseIf)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Cond);\r\n if (c) {\r\n conditions.push(c);\r\n }\r\n }\r\n if (conditions.hasDuplicates()) {\r\n const message = \"Identical conditions\";\r\n const issue = issue_1.Issue.atStatement(file, i, message, this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n return [];\r\n }\r\n analyzeWhen(file, node) {\r\n const conditions = new Conditions();\r\n const i = node.findDirectStatement(Statements.Case);\r\n if (i === undefined) {\r\n throw new Error(\"identical_conditions, no CASE found\");\r\n }\r\n for (const e of node.findDirectStructures(Structures.When)) {\r\n const w = e.findDirectStatement(Statements.When);\r\n if (w === undefined) {\r\n continue;\r\n }\r\n for (const s of w.findAllExpressions(Expressions.Source)) {\r\n conditions.push(s);\r\n }\r\n }\r\n if (conditions.hasDuplicates()) {\r\n const message = \"Identical conditions\";\r\n const issue = issue_1.Issue.atStatement(file, i, message, this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n return [];\r\n }\r\n}\r\nexports.IdenticalConditions = IdenticalConditions;\r\n//# sourceMappingURL=identical_conditions.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/identical_conditions.js?");
|
|
11768
11768
|
|
|
11769
11769
|
/***/ }),
|
|
11770
11770
|
|
|
@@ -11775,7 +11775,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11775
11775
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11776
11776
|
|
|
11777
11777
|
"use strict";
|
|
11778
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.IdenticalContents = exports.IdenticalContentsConf = void 0;\r\nconst Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nclass IdenticalContentsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.IdenticalContentsConf = IdenticalContentsConf;\r\nclass IdenticalContents extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new IdenticalContentsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"identical_contents\",\r\n title: \"Identical contents\",\r\n shortDescription: `Find identical contents in blocks inside IFs, both in the beginning and in the end.\n\nPrerequsites: code is pretty printed with identical cAsE\n\nChained statments are ignored`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: `IF foo = bar.\n WRITE 'bar'.\n WRITE 'world'.\nELSE.\n WRITE 'foo'.\n WRITE 'world'.\nENDIF.`,\r\n goodExample: `IF foo = bar.\n WRITE 'bar'.\nELSE.\n WRITE 'foo'.\nENDIF.\nWRITE 'world'.`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n let issues = [];\r\n const structure = file.getStructure();\r\n if (structure === undefined) {\r\n return [];\r\n }\r\n for (const i of structure.findAllStructuresRecursive(Structures.If)) {\r\n issues = issues.concat(this.analyzeIf(file, i));\r\n }\r\n return issues;\r\n }\r\n ////////////////\r\n analyzeIf(file, node) {\r\n var _a;\r\n if (node.getChildren().length !== 4) {\r\n return [];\r\n }\r\n const ifBody = node.findDirectStructure(Structures.Body);\r\n if (node.findDirectStructure(Structures.ElseIf)) {\r\n return [];\r\n }\r\n const elseBody = (_a = node.findDirectStructure(Structures.Else)) === null || _a === void 0 ? void 0 : _a.findDirectStructure(Structures.Body);\r\n if (elseBody === undefined || ifBody === undefined) {\r\n return [];\r\n }\r\n {\r\n const ifFirst = ifBody.getFirstChild();\r\n const elseFirst = elseBody.getFirstChild();\r\n if (ifFirst === undefined || elseFirst === undefined || this.isChained(ifFirst)) {\r\n return [];\r\n }\r\n else if (ifFirst.concatTokens() === elseFirst.concatTokens()) {\r\n const message = \"Identical contents\";\r\n const issue = issue_1.Issue.atToken(file, node.getFirstToken(), message, this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n }\r\n {\r\n const ifLast = ifBody.getLastChild();\r\n const elseLast = elseBody.getLastChild();\r\n if (ifLast === undefined || elseLast === undefined || this.isChained(ifLast)) {\r\n return [];\r\n }\r\n else if (ifLast.concatTokens() === elseLast.concatTokens()) {\r\n const message = \"Identical contents\";\r\n const issue = issue_1.Issue.atToken(file, node.getFirstToken(), message, this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n }\r\n return [];\r\n }\r\n isChained(node) {\r\n if (node === undefined) {\r\n return false;\r\n }\r\n else if (node instanceof nodes_1.StatementNode) {\r\n return node.getColon() !== undefined;\r\n }\r\n else {\r\n return this.isChained(node.getFirstStatement());\r\n }\r\n }\r\n}\r\nexports.IdenticalContents = IdenticalContents;\r\n//# sourceMappingURL=identical_contents.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/identical_contents.js?");
|
|
11778
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.IdenticalContents = exports.IdenticalContentsConf = void 0;\r\nconst Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nclass IdenticalContentsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.IdenticalContentsConf = IdenticalContentsConf;\r\nclass IdenticalContents extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new IdenticalContentsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"identical_contents\",\r\n title: \"Identical contents\",\r\n shortDescription: `Find identical contents in blocks inside IFs, both in the beginning and in the end.\r\n\r\nPrerequsites: code is pretty printed with identical cAsE\r\n\r\nChained statments are ignored`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: `IF foo = bar.\r\n WRITE 'bar'.\r\n WRITE 'world'.\r\nELSE.\r\n WRITE 'foo'.\r\n WRITE 'world'.\r\nENDIF.`,\r\n goodExample: `IF foo = bar.\r\n WRITE 'bar'.\r\nELSE.\r\n WRITE 'foo'.\r\nENDIF.\r\nWRITE 'world'.`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n let issues = [];\r\n const structure = file.getStructure();\r\n if (structure === undefined) {\r\n return [];\r\n }\r\n for (const i of structure.findAllStructuresRecursive(Structures.If)) {\r\n issues = issues.concat(this.analyzeIf(file, i));\r\n }\r\n return issues;\r\n }\r\n ////////////////\r\n analyzeIf(file, node) {\r\n var _a;\r\n if (node.getChildren().length !== 4) {\r\n return [];\r\n }\r\n const ifBody = node.findDirectStructure(Structures.Body);\r\n if (node.findDirectStructure(Structures.ElseIf)) {\r\n return [];\r\n }\r\n const elseBody = (_a = node.findDirectStructure(Structures.Else)) === null || _a === void 0 ? void 0 : _a.findDirectStructure(Structures.Body);\r\n if (elseBody === undefined || ifBody === undefined) {\r\n return [];\r\n }\r\n {\r\n const ifFirst = ifBody.getFirstChild();\r\n const elseFirst = elseBody.getFirstChild();\r\n if (ifFirst === undefined || elseFirst === undefined || this.isChained(ifFirst)) {\r\n return [];\r\n }\r\n else if (ifFirst.concatTokens() === elseFirst.concatTokens()) {\r\n const message = \"Identical contents\";\r\n const issue = issue_1.Issue.atToken(file, node.getFirstToken(), message, this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n }\r\n {\r\n const ifLast = ifBody.getLastChild();\r\n const elseLast = elseBody.getLastChild();\r\n if (ifLast === undefined || elseLast === undefined || this.isChained(ifLast)) {\r\n return [];\r\n }\r\n else if (ifLast.concatTokens() === elseLast.concatTokens()) {\r\n const message = \"Identical contents\";\r\n const issue = issue_1.Issue.atToken(file, node.getFirstToken(), message, this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n }\r\n return [];\r\n }\r\n isChained(node) {\r\n if (node === undefined) {\r\n return false;\r\n }\r\n else if (node instanceof nodes_1.StatementNode) {\r\n return node.getColon() !== undefined;\r\n }\r\n else {\r\n return this.isChained(node.getFirstStatement());\r\n }\r\n }\r\n}\r\nexports.IdenticalContents = IdenticalContents;\r\n//# sourceMappingURL=identical_contents.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/identical_contents.js?");
|
|
11779
11779
|
|
|
11780
11780
|
/***/ }),
|
|
11781
11781
|
|
|
@@ -11786,7 +11786,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11786
11786
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11787
11787
|
|
|
11788
11788
|
"use strict";
|
|
11789
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.IdenticalDescriptions = exports.IdenticalDescriptionsConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nclass IdenticalDescriptionsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.IdenticalDescriptionsConf = IdenticalDescriptionsConf;\r\nclass IdenticalDescriptions {\r\n constructor() {\r\n this.conf = new IdenticalDescriptionsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"identical_descriptions\",\r\n title: \"Identical descriptions\",\r\n shortDescription: `Searches for objects with the same type and same description`,\r\n extendedInformation: `Case insensitive\n\nOnly checks the master language descriptions\n\nWorks for: INTF, CLAS, DOMA, DTEL, FUNC in same FUGR`,\r\n tags: [],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n initialize(reg) {\r\n var _a;\r\n this.descriptions = {};\r\n this.types = [\"INTF\", \"CLAS\", \"DOMA\", \"DTEL\"];\r\n for (const o of reg.getObjects()) {\r\n const type = o.getType();\r\n if (this.types.includes(type)) {\r\n const description = (_a = o.getDescription()) === null || _a === void 0 ? void 0 : _a.toUpperCase();\r\n if (description === undefined || description === \"\") {\r\n continue;\r\n }\r\n if (this.descriptions[type] === undefined) {\r\n this.descriptions[type] = {};\r\n }\r\n if (this.descriptions[type][description] === undefined) {\r\n this.descriptions[type][description] = [];\r\n }\r\n this.descriptions[type][description].push(o.getName());\r\n }\r\n }\r\n return this;\r\n }\r\n run(o) {\r\n var _a;\r\n const issues = [];\r\n const type = o.getType();\r\n if (this.types.includes(type)) {\r\n const description = (_a = o.getDescription()) === null || _a === void 0 ? void 0 : _a.toUpperCase();\r\n if (description === undefined || description === \"\") {\r\n return issues;\r\n }\r\n const found = this.descriptions[type][description].filter(a => a !== o.getName());\r\n if (found.length > 0) {\r\n const message = \"Identical description: \" + found[0];\r\n issues.push(issue_1.Issue.atRow(o.getXMLFile(), 1, message, this.getMetadata().key, this.getConfig().severity));\r\n }\r\n }\r\n if (o instanceof objects_1.FunctionGroup) {\r\n issues.push(...this.checkFunctionModules(o));\r\n }\r\n return issues;\r\n }\r\n checkFunctionModules(fugr) {\r\n var _a;\r\n const descriptions = {};\r\n for (const fm of fugr.getModules()) {\r\n const d = (_a = fm.getDescription()) === null || _a === void 0 ? void 0 : _a.toUpperCase();\r\n if (d === undefined || d === \"\") {\r\n continue;\r\n }\r\n if (descriptions[d] !== undefined) {\r\n const message = \"FUGR \" + fugr.getName() + \" contains function modules with identical descriptions\";\r\n return [issue_1.Issue.atRow(fugr.getXMLFile(), 1, message, this.getMetadata().key, this.getConfig().severity)];\r\n }\r\n descriptions[d] = true;\r\n }\r\n return [];\r\n }\r\n}\r\nexports.IdenticalDescriptions = IdenticalDescriptions;\r\n//# sourceMappingURL=identical_descriptions.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/identical_descriptions.js?");
|
|
11789
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.IdenticalDescriptions = exports.IdenticalDescriptionsConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nclass IdenticalDescriptionsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.IdenticalDescriptionsConf = IdenticalDescriptionsConf;\r\nclass IdenticalDescriptions {\r\n constructor() {\r\n this.conf = new IdenticalDescriptionsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"identical_descriptions\",\r\n title: \"Identical descriptions\",\r\n shortDescription: `Searches for objects with the same type and same description`,\r\n extendedInformation: `Case insensitive\r\n\r\nOnly checks the master language descriptions\r\n\r\nWorks for: INTF, CLAS, DOMA, DTEL, FUNC in same FUGR`,\r\n tags: [],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n initialize(reg) {\r\n var _a;\r\n this.descriptions = {};\r\n this.types = [\"INTF\", \"CLAS\", \"DOMA\", \"DTEL\"];\r\n for (const o of reg.getObjects()) {\r\n const type = o.getType();\r\n if (this.types.includes(type)) {\r\n const description = (_a = o.getDescription()) === null || _a === void 0 ? void 0 : _a.toUpperCase();\r\n if (description === undefined || description === \"\") {\r\n continue;\r\n }\r\n if (this.descriptions[type] === undefined) {\r\n this.descriptions[type] = {};\r\n }\r\n if (this.descriptions[type][description] === undefined) {\r\n this.descriptions[type][description] = [];\r\n }\r\n this.descriptions[type][description].push(o.getName());\r\n }\r\n }\r\n return this;\r\n }\r\n run(o) {\r\n var _a;\r\n const issues = [];\r\n const type = o.getType();\r\n if (this.types.includes(type)) {\r\n const description = (_a = o.getDescription()) === null || _a === void 0 ? void 0 : _a.toUpperCase();\r\n if (description === undefined || description === \"\") {\r\n return issues;\r\n }\r\n const found = this.descriptions[type][description].filter(a => a !== o.getName());\r\n if (found.length > 0) {\r\n const message = \"Identical description: \" + found[0];\r\n issues.push(issue_1.Issue.atRow(o.getXMLFile(), 1, message, this.getMetadata().key, this.getConfig().severity));\r\n }\r\n }\r\n if (o instanceof objects_1.FunctionGroup) {\r\n issues.push(...this.checkFunctionModules(o));\r\n }\r\n return issues;\r\n }\r\n checkFunctionModules(fugr) {\r\n var _a;\r\n const descriptions = {};\r\n for (const fm of fugr.getModules()) {\r\n const d = (_a = fm.getDescription()) === null || _a === void 0 ? void 0 : _a.toUpperCase();\r\n if (d === undefined || d === \"\") {\r\n continue;\r\n }\r\n if (descriptions[d] !== undefined) {\r\n const message = \"FUGR \" + fugr.getName() + \" contains function modules with identical descriptions\";\r\n return [issue_1.Issue.atRow(fugr.getXMLFile(), 1, message, this.getMetadata().key, this.getConfig().severity)];\r\n }\r\n descriptions[d] = true;\r\n }\r\n return [];\r\n }\r\n}\r\nexports.IdenticalDescriptions = IdenticalDescriptions;\r\n//# sourceMappingURL=identical_descriptions.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/identical_descriptions.js?");
|
|
11790
11790
|
|
|
11791
11791
|
/***/ }),
|
|
11792
11792
|
|
|
@@ -11808,7 +11808,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11808
11808
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11809
11809
|
|
|
11810
11810
|
"use strict";
|
|
11811
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.IfInIf = exports.IfInIfConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass IfInIfConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.IfInIfConf = IfInIfConf;\r\nclass IfInIf extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new IfInIfConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"if_in_if\",\r\n title: \"IF in IF\",\r\n shortDescription: `Detects nested ifs which can be refactored to a single condition using AND.`,\r\n extendedInformation: `https://docs.abapopenchecks.org/checks/01/\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#keep-the-nesting-depth-low`,\r\n badExample: `IF condition1.\n IF condition2.\n ...\n ENDIF.\nENDIF.`,\r\n goodExample: `IF ( condition1 ) AND ( condition2 ).\n ...\nENDIF.`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getMessage() {\r\n return \"IF in IF. Use IF cond1 AND cond2 instead\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file, obj) {\r\n const issues = [];\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return [];\r\n }\r\n let possible = stru.findAllStructures(Structures.If);\r\n possible = possible.concat(stru.findAllStructures(Structures.Else));\r\n for (const i of possible) {\r\n if (i.findDirectStructures(Structures.ElseIf).length > 0\r\n || i.findDirectStructures(Structures.Else).length > 0) {\r\n continue;\r\n }\r\n const blist = i.findDirectStructures(Structures.Body);\r\n if (blist.length === 0) {\r\n continue;\r\n }\r\n const nlist = blist[0].findDirectStructures(Structures.Normal);\r\n if (nlist.length !== 1) {\r\n continue;\r\n }\r\n const niflist = nlist[0].findDirectStructures(Structures.If);\r\n if (niflist.length !== 1) {\r\n continue;\r\n }\r\n const nestedIf = niflist[0];\r\n if (i.get() instanceof Structures.If\r\n && (nestedIf.findDirectStructures(Structures.ElseIf).length > 0\r\n || nestedIf.findDirectStructures(Structures.Else).length > 0)) {\r\n continue;\r\n }\r\n const token = i.getFirstToken();\r\n const issue = issue_1.Issue.atToken(file, token, this.getMessage(), this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.IfInIf = IfInIf;\r\n//# sourceMappingURL=if_in_if.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/if_in_if.js?");
|
|
11811
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.IfInIf = exports.IfInIfConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass IfInIfConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.IfInIfConf = IfInIfConf;\r\nclass IfInIf extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new IfInIfConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"if_in_if\",\r\n title: \"IF in IF\",\r\n shortDescription: `Detects nested ifs which can be refactored to a single condition using AND.`,\r\n extendedInformation: `https://docs.abapopenchecks.org/checks/01/\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#keep-the-nesting-depth-low`,\r\n badExample: `IF condition1.\r\n IF condition2.\r\n ...\r\n ENDIF.\r\nENDIF.`,\r\n goodExample: `IF ( condition1 ) AND ( condition2 ).\r\n ...\r\nENDIF.`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getMessage() {\r\n return \"IF in IF. Use IF cond1 AND cond2 instead\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file, obj) {\r\n const issues = [];\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return [];\r\n }\r\n let possible = stru.findAllStructures(Structures.If);\r\n possible = possible.concat(stru.findAllStructures(Structures.Else));\r\n for (const i of possible) {\r\n if (i.findDirectStructures(Structures.ElseIf).length > 0\r\n || i.findDirectStructures(Structures.Else).length > 0) {\r\n continue;\r\n }\r\n const blist = i.findDirectStructures(Structures.Body);\r\n if (blist.length === 0) {\r\n continue;\r\n }\r\n const nlist = blist[0].findDirectStructures(Structures.Normal);\r\n if (nlist.length !== 1) {\r\n continue;\r\n }\r\n const niflist = nlist[0].findDirectStructures(Structures.If);\r\n if (niflist.length !== 1) {\r\n continue;\r\n }\r\n const nestedIf = niflist[0];\r\n if (i.get() instanceof Structures.If\r\n && (nestedIf.findDirectStructures(Structures.ElseIf).length > 0\r\n || nestedIf.findDirectStructures(Structures.Else).length > 0)) {\r\n continue;\r\n }\r\n const token = i.getFirstToken();\r\n const issue = issue_1.Issue.atToken(file, token, this.getMessage(), this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.IfInIf = IfInIf;\r\n//# sourceMappingURL=if_in_if.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/if_in_if.js?");
|
|
11812
11812
|
|
|
11813
11813
|
/***/ }),
|
|
11814
11814
|
|
|
@@ -11819,7 +11819,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11819
11819
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11820
11820
|
|
|
11821
11821
|
"use strict";
|
|
11822
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ImplementMethods = exports.ImplementMethodsConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\n// todo: abstract methods from superclass parents(might be multiple), if class is not abstract\r\nclass ImplementMethodsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.ImplementMethodsConf = ImplementMethodsConf;\r\nclass ImplementMethods extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ImplementMethodsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"implement_methods\",\r\n title: \"Implement methods\",\r\n shortDescription: `Checks for abstract methods and methods from interfaces which need implementing.`,\r\n extendedInformation: `INCLUDE programs are only checked in connection with their main programs.`,\r\n tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.Quickfix],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file, obj) {\r\n let ret = [];\r\n if (file.getStructure() === undefined) {\r\n return [];\r\n }\r\n else if (obj instanceof objects_1.Program && obj.isInclude() === true) {\r\n return [];\r\n }\r\n this.obj = obj;\r\n for (const classDefinition of file.getInfo().listClassDefinitions()) {\r\n const classImplementation = this.lookupImplementationInObject(classDefinition.name, obj);\r\n ret = ret.concat(this.checkClass(classDefinition, classImplementation));\r\n ret = ret.concat(this.checkInterfaces(classDefinition, classImplementation));\r\n }\r\n return ret;\r\n }\r\n /////////////////////////////////\r\n lookupImplementationInObject(name, obj) {\r\n for (const sub of obj.getABAPFiles()) {\r\n const impl = sub.getInfo().getClassImplementationByName(name);\r\n if (impl !== undefined) {\r\n return impl;\r\n }\r\n }\r\n return undefined;\r\n }\r\n lookupDefinitionInObject(name) {\r\n for (const sub of this.obj.getABAPFiles()) {\r\n const def = sub.getInfo().getClassDefinitionByName(name);\r\n if (def !== undefined) {\r\n return def;\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkClass(def, impl) {\r\n const ret = [];\r\n for (const md of def.methods) {\r\n const found = impl === null || impl === void 0 ? void 0 : impl.methods.find(m => m.getName().toUpperCase() === md.name.toUpperCase());\r\n if (md.isAbstract === true) {\r\n if (found !== undefined) {\r\n const issue = issue_1.Issue.atIdentifier(found, \"Do not implement abstract method \\\"\" + md.name + \"\\\"\", this.getMetadata().key, this.conf.severity);\r\n ret.push(issue);\r\n }\r\n continue;\r\n }\r\n if (impl === undefined) {\r\n const message = \"Class implementation for \\\"\" + def.name + \"\\\" not found\";\r\n const issue = issue_1.Issue.atIdentifier(def.identifier, message, this.getMetadata().key, this.conf.severity);\r\n ret.push(issue);\r\n }\r\n else if (found === undefined) {\r\n const message = \"Implement method \\\"\" + md.name + \"\\\"\";\r\n const fix = this.buildFix(impl, md.name);\r\n const issue = issue_1.Issue.atIdentifier(impl.identifier, message, this.getMetadata().key, this.conf.severity, fix);\r\n ret.push(issue);\r\n }\r\n }\r\n return ret;\r\n }\r\n buildFix(impl, methodName) {\r\n var _a, _b;\r\n const file = this.obj.getABAPFileByName(impl.identifier.getFilename());\r\n if (file === undefined) {\r\n return undefined;\r\n }\r\n for (const i of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllStatements(Statements.ClassImplementation)) || []) {\r\n const name = (_b = i.findFirstExpression(Expressions.ClassName)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr().toUpperCase();\r\n if (name === impl.identifier.getName().toUpperCase()) {\r\n return edit_helper_1.EditHelper.insertAt(file, i.getLastToken().getEnd(), `\n METHOD ${methodName.toLowerCase()}.\n RETURN. \" todo, implement method\n ENDMETHOD.`);\r\n }\r\n }\r\n return undefined;\r\n }\r\n findInterface(identifier, name) {\r\n const idef = this.findInterfaceByName(name);\r\n if (idef === undefined) {\r\n const message = \"Implemented interface \\\"\" + name + \"\\\" not found\";\r\n const issue = issue_1.Issue.atIdentifier(identifier, message, this.getMetadata().key, this.conf.severity);\r\n return issue;\r\n }\r\n return idef;\r\n }\r\n findInterfaceByName(name) {\r\n var _a;\r\n let idef = undefined;\r\n const intf = this.reg.getObject(\"INTF\", name);\r\n if (intf === undefined) {\r\n // lookup in localfiles\r\n for (const file of this.obj.getABAPFiles()) {\r\n const found = file.getInfo().getInterfaceDefinitionByName(name);\r\n if (found) {\r\n idef = found;\r\n break;\r\n }\r\n }\r\n }\r\n else {\r\n idef = (_a = intf.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getInfo().listInterfaceDefinitions()[0];\r\n }\r\n return idef;\r\n }\r\n /** including implemented super interfaces */\r\n findInterfaceMethods(idef) {\r\n const methods = idef.methods.map((m) => {\r\n return { objectName: idef.name, method: m };\r\n });\r\n for (const i of idef.interfaces) {\r\n const sup = this.findInterface(idef.identifier, i.name);\r\n if (sup !== undefined && !(sup instanceof issue_1.Issue)) {\r\n sup.methods.forEach(m => {\r\n methods.push({ objectName: sup.name, method: m });\r\n });\r\n }\r\n }\r\n return methods;\r\n }\r\n findClass(name) {\r\n let def = this.lookupDefinitionInObject(name);\r\n let impl = this.lookupImplementationInObject(name, this.obj);\r\n if (def && impl) {\r\n return { def, impl };\r\n }\r\n const global = this.reg.getObject(\"CLAS\", name);\r\n if (global) {\r\n def = global.getClassDefinition();\r\n impl = this.lookupImplementationInObject(name, global);\r\n if (def && impl) {\r\n return { def, impl };\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkInterfaces(def, impl) {\r\n const ret = [];\r\n for (const interfaceInfo of def.interfaces) {\r\n const idef = this.findInterface(def.identifier, interfaceInfo.name);\r\n if (idef === undefined || interfaceInfo.partial === true || interfaceInfo.allAbstract === true) {\r\n continue; // ignore parser errors in interface\r\n }\r\n else if (idef instanceof issue_1.Issue) {\r\n return [idef];\r\n }\r\n for (const m of this.findInterfaceMethods(idef)) {\r\n if (interfaceInfo.abstractMethods.includes(m.method.name.toUpperCase())) {\r\n continue;\r\n }\r\n if (this.isImplemented(m, def, impl) === false) {\r\n const message = \"Implement method \\\"\" + m.method.name + \"\\\" from interface \\\"\" + m.objectName + \"\\\"\";\r\n if (impl) {\r\n const fix = this.buildFix(impl, m.objectName + \"~\" + m.method.name);\r\n const issue = issue_1.Issue.atIdentifier(impl.identifier, message, this.getMetadata().key, this.conf.severity, fix);\r\n ret.push(issue);\r\n }\r\n else {\r\n const issue = issue_1.Issue.atIdentifier(def.identifier, message, this.getMetadata().key, this.conf.severity);\r\n ret.push(issue);\r\n }\r\n }\r\n }\r\n }\r\n return ret;\r\n }\r\n isImplemented(m, def, impl) {\r\n if (impl === undefined) {\r\n return false;\r\n }\r\n const name = m.objectName + \"~\" + m.method.name;\r\n let found = impl.methods.find(m => m.getName().toUpperCase() === name.toUpperCase());\r\n if (found === undefined) {\r\n // try looking for ALIASes\r\n for (const alias of def.aliases) {\r\n if (alias.component.toUpperCase() === name.toUpperCase()) {\r\n found = impl.methods.find(m => m.getName().toUpperCase() === alias.name.toUpperCase());\r\n break;\r\n }\r\n }\r\n }\r\n if (found === undefined && def.superClassName !== undefined) {\r\n const clas = this.findClass(def.superClassName);\r\n if (clas) {\r\n return this.isImplemented(m, clas === null || clas === void 0 ? void 0 : clas.def, clas === null || clas === void 0 ? void 0 : clas.impl);\r\n }\r\n }\r\n if (found === undefined) {\r\n for (const i of def.interfaces) {\r\n const idef = this.findInterfaceByName(i.name);\r\n if (idef === undefined) {\r\n continue;\r\n }\r\n const ali = this.viaAliasInInterface(m, idef, impl);\r\n if (ali) {\r\n return ali;\r\n }\r\n }\r\n }\r\n return found !== undefined;\r\n }\r\n viaAliasInInterface(m, intf, impl) {\r\n for (const a of intf.aliases) {\r\n if (a.component.toUpperCase() === m.objectName.toUpperCase() + \"~\" + m.method.name.toUpperCase()) {\r\n const name = intf.name + \"~\" + a.name;\r\n const found = impl.methods.find(m => m.getName().toUpperCase() === name.toUpperCase());\r\n if (found) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\nexports.ImplementMethods = ImplementMethods;\r\n//# sourceMappingURL=implement_methods.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/implement_methods.js?");
|
|
11822
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ImplementMethods = exports.ImplementMethodsConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\n// todo: abstract methods from superclass parents(might be multiple), if class is not abstract\r\nclass ImplementMethodsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.ImplementMethodsConf = ImplementMethodsConf;\r\nclass ImplementMethods extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ImplementMethodsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"implement_methods\",\r\n title: \"Implement methods\",\r\n shortDescription: `Checks for abstract methods and methods from interfaces which need implementing.`,\r\n extendedInformation: `INCLUDE programs are only checked in connection with their main programs.`,\r\n tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.Quickfix],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file, obj) {\r\n let ret = [];\r\n if (file.getStructure() === undefined) {\r\n return [];\r\n }\r\n else if (obj instanceof objects_1.Program && obj.isInclude() === true) {\r\n return [];\r\n }\r\n this.obj = obj;\r\n for (const classDefinition of file.getInfo().listClassDefinitions()) {\r\n const classImplementation = this.lookupImplementationInObject(classDefinition.name, obj);\r\n ret = ret.concat(this.checkClass(classDefinition, classImplementation));\r\n ret = ret.concat(this.checkInterfaces(classDefinition, classImplementation));\r\n }\r\n return ret;\r\n }\r\n /////////////////////////////////\r\n lookupImplementationInObject(name, obj) {\r\n for (const sub of obj.getABAPFiles()) {\r\n const impl = sub.getInfo().getClassImplementationByName(name);\r\n if (impl !== undefined) {\r\n return impl;\r\n }\r\n }\r\n return undefined;\r\n }\r\n lookupDefinitionInObject(name) {\r\n for (const sub of this.obj.getABAPFiles()) {\r\n const def = sub.getInfo().getClassDefinitionByName(name);\r\n if (def !== undefined) {\r\n return def;\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkClass(def, impl) {\r\n const ret = [];\r\n for (const md of def.methods) {\r\n const found = impl === null || impl === void 0 ? void 0 : impl.methods.find(m => m.getName().toUpperCase() === md.name.toUpperCase());\r\n if (md.isAbstract === true) {\r\n if (found !== undefined) {\r\n const issue = issue_1.Issue.atIdentifier(found, \"Do not implement abstract method \\\"\" + md.name + \"\\\"\", this.getMetadata().key, this.conf.severity);\r\n ret.push(issue);\r\n }\r\n continue;\r\n }\r\n if (impl === undefined) {\r\n const message = \"Class implementation for \\\"\" + def.name + \"\\\" not found\";\r\n const issue = issue_1.Issue.atIdentifier(def.identifier, message, this.getMetadata().key, this.conf.severity);\r\n ret.push(issue);\r\n }\r\n else if (found === undefined) {\r\n const message = \"Implement method \\\"\" + md.name + \"\\\"\";\r\n const fix = this.buildFix(impl, md.name);\r\n const issue = issue_1.Issue.atIdentifier(impl.identifier, message, this.getMetadata().key, this.conf.severity, fix);\r\n ret.push(issue);\r\n }\r\n }\r\n return ret;\r\n }\r\n buildFix(impl, methodName) {\r\n var _a, _b;\r\n const file = this.obj.getABAPFileByName(impl.identifier.getFilename());\r\n if (file === undefined) {\r\n return undefined;\r\n }\r\n for (const i of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllStatements(Statements.ClassImplementation)) || []) {\r\n const name = (_b = i.findFirstExpression(Expressions.ClassName)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr().toUpperCase();\r\n if (name === impl.identifier.getName().toUpperCase()) {\r\n return edit_helper_1.EditHelper.insertAt(file, i.getLastToken().getEnd(), `\r\n METHOD ${methodName.toLowerCase()}.\r\n RETURN. \" todo, implement method\r\n ENDMETHOD.`);\r\n }\r\n }\r\n return undefined;\r\n }\r\n findInterface(identifier, name) {\r\n const idef = this.findInterfaceByName(name);\r\n if (idef === undefined) {\r\n const message = \"Implemented interface \\\"\" + name + \"\\\" not found\";\r\n const issue = issue_1.Issue.atIdentifier(identifier, message, this.getMetadata().key, this.conf.severity);\r\n return issue;\r\n }\r\n return idef;\r\n }\r\n findInterfaceByName(name) {\r\n var _a;\r\n let idef = undefined;\r\n const intf = this.reg.getObject(\"INTF\", name);\r\n if (intf === undefined) {\r\n // lookup in localfiles\r\n for (const file of this.obj.getABAPFiles()) {\r\n const found = file.getInfo().getInterfaceDefinitionByName(name);\r\n if (found) {\r\n idef = found;\r\n break;\r\n }\r\n }\r\n }\r\n else {\r\n idef = (_a = intf.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getInfo().listInterfaceDefinitions()[0];\r\n }\r\n return idef;\r\n }\r\n /** including implemented super interfaces */\r\n findInterfaceMethods(idef) {\r\n const methods = idef.methods.map((m) => {\r\n return { objectName: idef.name, method: m };\r\n });\r\n for (const i of idef.interfaces) {\r\n const sup = this.findInterface(idef.identifier, i.name);\r\n if (sup !== undefined && !(sup instanceof issue_1.Issue)) {\r\n sup.methods.forEach(m => {\r\n methods.push({ objectName: sup.name, method: m });\r\n });\r\n }\r\n }\r\n return methods;\r\n }\r\n findClass(name) {\r\n let def = this.lookupDefinitionInObject(name);\r\n let impl = this.lookupImplementationInObject(name, this.obj);\r\n if (def && impl) {\r\n return { def, impl };\r\n }\r\n const global = this.reg.getObject(\"CLAS\", name);\r\n if (global) {\r\n def = global.getClassDefinition();\r\n impl = this.lookupImplementationInObject(name, global);\r\n if (def && impl) {\r\n return { def, impl };\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkInterfaces(def, impl) {\r\n const ret = [];\r\n for (const interfaceInfo of def.interfaces) {\r\n const idef = this.findInterface(def.identifier, interfaceInfo.name);\r\n if (idef === undefined || interfaceInfo.partial === true || interfaceInfo.allAbstract === true) {\r\n continue; // ignore parser errors in interface\r\n }\r\n else if (idef instanceof issue_1.Issue) {\r\n return [idef];\r\n }\r\n for (const m of this.findInterfaceMethods(idef)) {\r\n if (interfaceInfo.abstractMethods.includes(m.method.name.toUpperCase())) {\r\n continue;\r\n }\r\n if (this.isImplemented(m, def, impl) === false) {\r\n const message = \"Implement method \\\"\" + m.method.name + \"\\\" from interface \\\"\" + m.objectName + \"\\\"\";\r\n if (impl) {\r\n const fix = this.buildFix(impl, m.objectName + \"~\" + m.method.name);\r\n const issue = issue_1.Issue.atIdentifier(impl.identifier, message, this.getMetadata().key, this.conf.severity, fix);\r\n ret.push(issue);\r\n }\r\n else {\r\n const issue = issue_1.Issue.atIdentifier(def.identifier, message, this.getMetadata().key, this.conf.severity);\r\n ret.push(issue);\r\n }\r\n }\r\n }\r\n }\r\n return ret;\r\n }\r\n isImplemented(m, def, impl) {\r\n if (impl === undefined) {\r\n return false;\r\n }\r\n const name = m.objectName + \"~\" + m.method.name;\r\n let found = impl.methods.find(m => m.getName().toUpperCase() === name.toUpperCase());\r\n if (found === undefined) {\r\n // try looking for ALIASes\r\n for (const alias of def.aliases) {\r\n if (alias.component.toUpperCase() === name.toUpperCase()) {\r\n found = impl.methods.find(m => m.getName().toUpperCase() === alias.name.toUpperCase());\r\n break;\r\n }\r\n }\r\n }\r\n if (found === undefined && def.superClassName !== undefined) {\r\n const clas = this.findClass(def.superClassName);\r\n if (clas) {\r\n return this.isImplemented(m, clas === null || clas === void 0 ? void 0 : clas.def, clas === null || clas === void 0 ? void 0 : clas.impl);\r\n }\r\n }\r\n if (found === undefined) {\r\n for (const i of def.interfaces) {\r\n const idef = this.findInterfaceByName(i.name);\r\n if (idef === undefined) {\r\n continue;\r\n }\r\n const ali = this.viaAliasInInterface(m, idef, impl);\r\n if (ali) {\r\n return ali;\r\n }\r\n }\r\n }\r\n return found !== undefined;\r\n }\r\n viaAliasInInterface(m, intf, impl) {\r\n for (const a of intf.aliases) {\r\n if (a.component.toUpperCase() === m.objectName.toUpperCase() + \"~\" + m.method.name.toUpperCase()) {\r\n const name = intf.name + \"~\" + a.name;\r\n const found = impl.methods.find(m => m.getName().toUpperCase() === name.toUpperCase());\r\n if (found) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\nexports.ImplementMethods = ImplementMethods;\r\n//# sourceMappingURL=implement_methods.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/implement_methods.js?");
|
|
11823
11823
|
|
|
11824
11824
|
/***/ }),
|
|
11825
11825
|
|
|
@@ -11830,7 +11830,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11830
11830
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11831
11831
|
|
|
11832
11832
|
"use strict";
|
|
11833
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.InStatementIndentation = exports.InStatementIndentationConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nclass InStatementIndentationConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Additional indent for first statement of blocks */\r\n this.blockStatements = 2;\r\n /** Ignore global exception classes */\r\n this.ignoreExceptions = true;\r\n }\r\n}\r\nexports.InStatementIndentationConf = InStatementIndentationConf;\r\nclass InStatementIndentation extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new InStatementIndentationConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"in_statement_indentation\",\r\n title: \"In-statement indentation\",\r\n shortDescription: \"Checks alignment within statements which span multiple lines.\",\r\n extendedInformation: `Lines following the first line should be indented once (2 spaces).\n \nFor block declaration statements, lines after the first should be indented an additional time (default: +2 spaces)\nto distinguish them better from code within the block.`,\r\n badExample: `IF 1 = 1\n AND 2 = 2.\n WRITE 'hello' &&\n 'world'.\nENDIF.`,\r\n goodExample: `IF 1 = 1\n AND 2 = 2.\n WRITE 'hello' &&\n 'world'.\nENDIF.`,\r\n tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getMessage() {\r\n return \"Fix in-statement indentation\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file, obj) {\r\n const ret = [];\r\n const ddic = new ddic_1.DDIC(this.reg);\r\n if (obj instanceof objects_1.Class) {\r\n const definition = obj.getClassDefinition();\r\n if (definition === undefined) {\r\n return [];\r\n }\r\n else if (this.conf.ignoreExceptions && ddic.isException(definition, obj)) {\r\n return [];\r\n }\r\n }\r\n for (const s of file.getStatements()) {\r\n if (s.get() instanceof _statement_1.Comment || s.get() instanceof _statement_1.Unknown) {\r\n continue;\r\n }\r\n const tokens = s.getTokens();\r\n if (tokens.length === 0) {\r\n continue;\r\n }\r\n const beginLine = tokens[0].getRow();\r\n let expected = tokens[0].getCol() + 2;\r\n const type = s.get();\r\n if (type instanceof Statements.If\r\n || type instanceof Statements.While\r\n || type instanceof Statements.Module\r\n || type instanceof Statements.SelectLoop\r\n || type instanceof Statements.FunctionModule\r\n || type instanceof Statements.Do\r\n || type instanceof Statements.At\r\n || type instanceof Statements.Catch\r\n || type instanceof Statements.Case\r\n || type instanceof Statements.When\r\n || type instanceof Statements.Cleanup\r\n || type instanceof Statements.Loop\r\n || type instanceof Statements.Form\r\n || type instanceof Statements.Else\r\n || type instanceof Statements.ElseIf\r\n || type instanceof Statements.MethodImplementation) {\r\n expected = expected + this.conf.blockStatements;\r\n }\r\n for (const t of tokens) {\r\n if (t.getRow() === beginLine) {\r\n continue;\r\n }\r\n if (t.getCol() < expected) {\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, new position_1.Position(t.getRow(), 1), t.getStart(), \" \".repeat(expected - 1));\r\n const issue = issue_1.Issue.atToken(file, t, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n ret.push(issue);\r\n break;\r\n }\r\n }\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.InStatementIndentation = InStatementIndentation;\r\n//# sourceMappingURL=in_statement_indentation.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/in_statement_indentation.js?");
|
|
11833
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.InStatementIndentation = exports.InStatementIndentationConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nclass InStatementIndentationConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Additional indent for first statement of blocks */\r\n this.blockStatements = 2;\r\n /** Ignore global exception classes */\r\n this.ignoreExceptions = true;\r\n }\r\n}\r\nexports.InStatementIndentationConf = InStatementIndentationConf;\r\nclass InStatementIndentation extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new InStatementIndentationConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"in_statement_indentation\",\r\n title: \"In-statement indentation\",\r\n shortDescription: \"Checks alignment within statements which span multiple lines.\",\r\n extendedInformation: `Lines following the first line should be indented once (2 spaces).\r\n \r\nFor block declaration statements, lines after the first should be indented an additional time (default: +2 spaces)\r\nto distinguish them better from code within the block.`,\r\n badExample: `IF 1 = 1\r\n AND 2 = 2.\r\n WRITE 'hello' &&\r\n 'world'.\r\nENDIF.`,\r\n goodExample: `IF 1 = 1\r\n AND 2 = 2.\r\n WRITE 'hello' &&\r\n 'world'.\r\nENDIF.`,\r\n tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getMessage() {\r\n return \"Fix in-statement indentation\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file, obj) {\r\n const ret = [];\r\n const ddic = new ddic_1.DDIC(this.reg);\r\n if (obj instanceof objects_1.Class) {\r\n const definition = obj.getClassDefinition();\r\n if (definition === undefined) {\r\n return [];\r\n }\r\n else if (this.conf.ignoreExceptions && ddic.isException(definition, obj)) {\r\n return [];\r\n }\r\n }\r\n for (const s of file.getStatements()) {\r\n if (s.get() instanceof _statement_1.Comment || s.get() instanceof _statement_1.Unknown) {\r\n continue;\r\n }\r\n const tokens = s.getTokens();\r\n if (tokens.length === 0) {\r\n continue;\r\n }\r\n const beginLine = tokens[0].getRow();\r\n let expected = tokens[0].getCol() + 2;\r\n const type = s.get();\r\n if (type instanceof Statements.If\r\n || type instanceof Statements.While\r\n || type instanceof Statements.Module\r\n || type instanceof Statements.SelectLoop\r\n || type instanceof Statements.FunctionModule\r\n || type instanceof Statements.Do\r\n || type instanceof Statements.At\r\n || type instanceof Statements.Catch\r\n || type instanceof Statements.Case\r\n || type instanceof Statements.When\r\n || type instanceof Statements.Cleanup\r\n || type instanceof Statements.Loop\r\n || type instanceof Statements.Form\r\n || type instanceof Statements.Else\r\n || type instanceof Statements.ElseIf\r\n || type instanceof Statements.MethodImplementation) {\r\n expected = expected + this.conf.blockStatements;\r\n }\r\n for (const t of tokens) {\r\n if (t.getRow() === beginLine) {\r\n continue;\r\n }\r\n if (t.getCol() < expected) {\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, new position_1.Position(t.getRow(), 1), t.getStart(), \" \".repeat(expected - 1));\r\n const issue = issue_1.Issue.atToken(file, t, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n ret.push(issue);\r\n break;\r\n }\r\n }\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.InStatementIndentation = InStatementIndentation;\r\n//# sourceMappingURL=in_statement_indentation.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/in_statement_indentation.js?");
|
|
11834
11834
|
|
|
11835
11835
|
/***/ }),
|
|
11836
11836
|
|
|
@@ -11874,7 +11874,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11874
11874
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11875
11875
|
|
|
11876
11876
|
"use strict";
|
|
11877
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.IntfReferencingClas = exports.IntfReferencingClasConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nclass IntfReferencingClasConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** List of classes allowed to be referenced, regex, case insensitive\r\n * @uniqueItems true\r\n */\r\n this.allow = [];\r\n }\r\n}\r\nexports.IntfReferencingClasConf = IntfReferencingClasConf;\r\nclass IntfReferencingClas {\r\n constructor() {\r\n this.conf = new IntfReferencingClasConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"intf_referencing_clas\",\r\n title: \"INTF referencing CLAS\",\r\n shortDescription: `Interface contains references to class`,\r\n extendedInformation: `Only global interfaces are checked.\n Only first level references are checked.\n Exception class references are ignored.\n Void references are ignored.`,\r\n };\r\n }\r\n getConfig() {\r\n if (this.conf.allow === undefined) {\r\n this.conf.allow = [];\r\n }\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof objects_1.Interface)) {\r\n return [];\r\n }\r\n return this.traverse(new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti.getTop());\r\n }\r\n ////////////////\r\n traverse(node) {\r\n var _a, _b;\r\n let ret = [];\r\n const message = \"Referencing CLAS: \";\r\n const ddic = new ddic_1.DDIC(this.reg);\r\n for (const r of node.getData().references) {\r\n if (r.referenceType === _reference_1.ReferenceType.ObjectOrientedReference\r\n && ((_a = r.extra) === null || _a === void 0 ? void 0 : _a.ooType) === \"CLAS\"\r\n && ((_b = r.extra) === null || _b === void 0 ? void 0 : _b.ooName) !== undefined) {\r\n const found = this.reg.getObject(\"CLAS\", r.extra.ooName) || undefined;\r\n if (found && ddic.isException(found.getClassDefinition(), found)) {\r\n continue;\r\n }\r\n else if (this.getConfig().allow.some(reg => new RegExp(reg, \"i\").test(r.extra.ooName))) {\r\n continue;\r\n }\r\n ret.push(issue_1.Issue.atIdentifier(r.position, message + r.extra.ooName, this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n for (const c of node.getChildren()) {\r\n ret = ret.concat(this.traverse(c));\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.IntfReferencingClas = IntfReferencingClas;\r\n//# sourceMappingURL=intf_referencing_clas.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/intf_referencing_clas.js?");
|
|
11877
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.IntfReferencingClas = exports.IntfReferencingClasConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nclass IntfReferencingClasConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** List of classes allowed to be referenced, regex, case insensitive\r\n * @uniqueItems true\r\n */\r\n this.allow = [];\r\n }\r\n}\r\nexports.IntfReferencingClasConf = IntfReferencingClasConf;\r\nclass IntfReferencingClas {\r\n constructor() {\r\n this.conf = new IntfReferencingClasConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"intf_referencing_clas\",\r\n title: \"INTF referencing CLAS\",\r\n shortDescription: `Interface contains references to class`,\r\n extendedInformation: `Only global interfaces are checked.\r\n Only first level references are checked.\r\n Exception class references are ignored.\r\n Void references are ignored.`,\r\n };\r\n }\r\n getConfig() {\r\n if (this.conf.allow === undefined) {\r\n this.conf.allow = [];\r\n }\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof objects_1.Interface)) {\r\n return [];\r\n }\r\n return this.traverse(new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti.getTop());\r\n }\r\n ////////////////\r\n traverse(node) {\r\n var _a, _b;\r\n let ret = [];\r\n const message = \"Referencing CLAS: \";\r\n const ddic = new ddic_1.DDIC(this.reg);\r\n for (const r of node.getData().references) {\r\n if (r.referenceType === _reference_1.ReferenceType.ObjectOrientedReference\r\n && ((_a = r.extra) === null || _a === void 0 ? void 0 : _a.ooType) === \"CLAS\"\r\n && ((_b = r.extra) === null || _b === void 0 ? void 0 : _b.ooName) !== undefined) {\r\n const found = this.reg.getObject(\"CLAS\", r.extra.ooName) || undefined;\r\n if (found && ddic.isException(found.getClassDefinition(), found)) {\r\n continue;\r\n }\r\n else if (this.getConfig().allow.some(reg => new RegExp(reg, \"i\").test(r.extra.ooName))) {\r\n continue;\r\n }\r\n ret.push(issue_1.Issue.atIdentifier(r.position, message + r.extra.ooName, this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n for (const c of node.getChildren()) {\r\n ret = ret.concat(this.traverse(c));\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.IntfReferencingClas = IntfReferencingClas;\r\n//# sourceMappingURL=intf_referencing_clas.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/intf_referencing_clas.js?");
|
|
11878
11878
|
|
|
11879
11879
|
/***/ }),
|
|
11880
11880
|
|
|
@@ -11918,7 +11918,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11918
11918
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11919
11919
|
|
|
11920
11920
|
"use strict";
|
|
11921
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LineBreakStyle = exports.LineBreakStyleConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass LineBreakStyleConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.LineBreakStyleConf = LineBreakStyleConf;\r\nclass LineBreakStyle {\r\n constructor() {\r\n this.conf = new LineBreakStyleConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"line_break_style\",\r\n title: \"Makes sure line breaks are consistent in the ABAP code\",\r\n shortDescription: `Enforces LF as newlines in ABAP files\n\nabapGit does not work with CRLF`,\r\n tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n initialize(_reg) {\r\n return this;\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n run(obj) {\r\n const output = [];\r\n for (const file of obj.getFiles()) {\r\n if (file.getFilename().endsWith(\".abap\")) {\r\n const rows = file.getRawRows();\r\n for (let i = 0; i < rows.length; i++) {\r\n if (rows[i].endsWith(\"\\r\") === true) {\r\n const message = \"Line contains carriage return\";\r\n const issue = issue_1.Issue.atRow(file, i + 1, message, this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n break; // only one finding per file\r\n }\r\n }\r\n }\r\n }\r\n return output;\r\n }\r\n}\r\nexports.LineBreakStyle = LineBreakStyle;\r\n//# sourceMappingURL=line_break_style.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/line_break_style.js?");
|
|
11921
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LineBreakStyle = exports.LineBreakStyleConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass LineBreakStyleConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.LineBreakStyleConf = LineBreakStyleConf;\r\nclass LineBreakStyle {\r\n constructor() {\r\n this.conf = new LineBreakStyleConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"line_break_style\",\r\n title: \"Makes sure line breaks are consistent in the ABAP code\",\r\n shortDescription: `Enforces LF as newlines in ABAP files\r\n\r\nabapGit does not work with CRLF`,\r\n tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n initialize(_reg) {\r\n return this;\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n run(obj) {\r\n const output = [];\r\n for (const file of obj.getFiles()) {\r\n if (file.getFilename().endsWith(\".abap\")) {\r\n const rows = file.getRawRows();\r\n for (let i = 0; i < rows.length; i++) {\r\n if (rows[i].endsWith(\"\\r\") === true) {\r\n const message = \"Line contains carriage return\";\r\n const issue = issue_1.Issue.atRow(file, i + 1, message, this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n break; // only one finding per file\r\n }\r\n }\r\n }\r\n }\r\n return output;\r\n }\r\n}\r\nexports.LineBreakStyle = LineBreakStyle;\r\n//# sourceMappingURL=line_break_style.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/line_break_style.js?");
|
|
11922
11922
|
|
|
11923
11923
|
/***/ }),
|
|
11924
11924
|
|
|
@@ -11929,7 +11929,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11929
11929
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11930
11930
|
|
|
11931
11931
|
"use strict";
|
|
11932
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LineLength = exports.LineLengthConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass LineLengthConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Maximum line length in characters, trailing whitespace ignored */\r\n this.length = 120;\r\n }\r\n}\r\nexports.LineLengthConf = LineLengthConf;\r\nclass LineLength extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new LineLengthConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"line_length\",\r\n title: \"Line length\",\r\n shortDescription: `Detects lines exceeding the provided maximum length.`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#stick-to-a-reasonable-line-length\nhttps://docs.abapopenchecks.org/checks/04/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n // maximum line length in abap files\r\n const maxLineLength = 255;\r\n file.getRawRows().forEach((row, rowIndex) => {\r\n row = row.replace(\"\\r\", \"\");\r\n let message = \"\";\r\n if (row.length > maxLineLength) {\r\n message = `Maximum allowed line length of ${maxLineLength} exceeded, currently ${row.length}`;\r\n }\r\n else if (row.length > this.conf.length) {\r\n message = `Reduce line length to max ${this.conf.length}, currently ${row.length}`;\r\n }\r\n else {\r\n return;\r\n }\r\n issues.push(issue_1.Issue.atRow(file, rowIndex + 1, message, this.getMetadata().key, this.conf.severity));\r\n });\r\n return issues;\r\n }\r\n}\r\nexports.LineLength = LineLength;\r\n//# sourceMappingURL=line_length.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/line_length.js?");
|
|
11932
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LineLength = exports.LineLengthConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass LineLengthConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Maximum line length in characters, trailing whitespace ignored */\r\n this.length = 120;\r\n }\r\n}\r\nexports.LineLengthConf = LineLengthConf;\r\nclass LineLength extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new LineLengthConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"line_length\",\r\n title: \"Line length\",\r\n shortDescription: `Detects lines exceeding the provided maximum length.`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#stick-to-a-reasonable-line-length\r\nhttps://docs.abapopenchecks.org/checks/04/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n // maximum line length in abap files\r\n const maxLineLength = 255;\r\n file.getRawRows().forEach((row, rowIndex) => {\r\n row = row.replace(\"\\r\", \"\");\r\n let message = \"\";\r\n if (row.length > maxLineLength) {\r\n message = `Maximum allowed line length of ${maxLineLength} exceeded, currently ${row.length}`;\r\n }\r\n else if (row.length > this.conf.length) {\r\n message = `Reduce line length to max ${this.conf.length}, currently ${row.length}`;\r\n }\r\n else {\r\n return;\r\n }\r\n issues.push(issue_1.Issue.atRow(file, rowIndex + 1, message, this.getMetadata().key, this.conf.severity));\r\n });\r\n return issues;\r\n }\r\n}\r\nexports.LineLength = LineLength;\r\n//# sourceMappingURL=line_length.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/line_length.js?");
|
|
11933
11933
|
|
|
11934
11934
|
/***/ }),
|
|
11935
11935
|
|
|
@@ -11940,7 +11940,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11940
11940
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11941
11941
|
|
|
11942
11942
|
"use strict";
|
|
11943
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LineOnlyPunc = exports.LineOnlyPuncConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nclass LineOnlyPuncConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Ignore lines with only puncutation in global exception classes */\r\n this.ignoreExceptions = true;\r\n }\r\n}\r\nexports.LineOnlyPuncConf = LineOnlyPuncConf;\r\nclass LineOnlyPunc extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new LineOnlyPuncConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"line_only_punc\",\r\n title: \"Line containing only punctuation\",\r\n shortDescription: `Detects lines containing only punctuation.`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#close-brackets-at-line-end\nhttps://docs.abapopenchecks.org/checks/16/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n badExample: \"zcl_class=>method(\\n).\",\r\n goodExample: \"zcl_class=>method( ).\",\r\n };\r\n }\r\n getMessage() {\r\n return \"A line should not contain only \\\".\\\" or \\\").\\\"\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file, obj) {\r\n const issues = [];\r\n const ddic = new ddic_1.DDIC(this.reg);\r\n if (obj instanceof objects_1.Class) {\r\n const definition = obj.getClassDefinition();\r\n if (definition === undefined) {\r\n return [];\r\n }\r\n else if (this.conf.ignoreExceptions && ddic.isException(definition, obj)) {\r\n return [];\r\n }\r\n }\r\n const rows = file.getRawRows();\r\n const reg = new RegExp(\"^\\\\)?\\\\. *(\\\\\\\".*)?$\");\r\n for (let i = 0; i < rows.length; i++) {\r\n if (reg.exec(rows[i].trim())) {\r\n const column = rows[i].indexOf(\")\") >= 0 ? rows[i].indexOf(\")\") + 1 : rows[i].indexOf(\".\") + 1;\r\n const position = new position_1.Position(i + 1, column);\r\n // merge punc into previous row\r\n let rowContent = rows[i].trim();\r\n // if reported row contains a paranthesis, prefix with space if needed\r\n if (rowContent.length > 1 && !rows[i - 1].endsWith(\" \") && !rows[i - 1].endsWith(\" \\r\")) {\r\n rowContent = \" \" + rowContent;\r\n }\r\n let offset = 0;\r\n if (rows[i - 1].endsWith(\"\\r\")) {\r\n offset = -1;\r\n }\r\n const startPos = new position_1.Position(i, rows[i - 1].length + 1 + offset);\r\n const endPos = new position_1.Position(i + 1, rows[i].length + 1);\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, startPos, endPos, rowContent);\r\n const issue = issue_1.Issue.atPosition(file, position, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.LineOnlyPunc = LineOnlyPunc;\r\n//# sourceMappingURL=line_only_punc.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/line_only_punc.js?");
|
|
11943
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LineOnlyPunc = exports.LineOnlyPuncConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nclass LineOnlyPuncConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Ignore lines with only puncutation in global exception classes */\r\n this.ignoreExceptions = true;\r\n }\r\n}\r\nexports.LineOnlyPuncConf = LineOnlyPuncConf;\r\nclass LineOnlyPunc extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new LineOnlyPuncConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"line_only_punc\",\r\n title: \"Line containing only punctuation\",\r\n shortDescription: `Detects lines containing only punctuation.`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#close-brackets-at-line-end\r\nhttps://docs.abapopenchecks.org/checks/16/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n badExample: \"zcl_class=>method(\\n).\",\r\n goodExample: \"zcl_class=>method( ).\",\r\n };\r\n }\r\n getMessage() {\r\n return \"A line should not contain only \\\".\\\" or \\\").\\\"\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file, obj) {\r\n const issues = [];\r\n const ddic = new ddic_1.DDIC(this.reg);\r\n if (obj instanceof objects_1.Class) {\r\n const definition = obj.getClassDefinition();\r\n if (definition === undefined) {\r\n return [];\r\n }\r\n else if (this.conf.ignoreExceptions && ddic.isException(definition, obj)) {\r\n return [];\r\n }\r\n }\r\n const rows = file.getRawRows();\r\n const reg = new RegExp(\"^\\\\)?\\\\. *(\\\\\\\".*)?$\");\r\n for (let i = 0; i < rows.length; i++) {\r\n if (reg.exec(rows[i].trim())) {\r\n const column = rows[i].indexOf(\")\") >= 0 ? rows[i].indexOf(\")\") + 1 : rows[i].indexOf(\".\") + 1;\r\n const position = new position_1.Position(i + 1, column);\r\n // merge punc into previous row\r\n let rowContent = rows[i].trim();\r\n // if reported row contains a paranthesis, prefix with space if needed\r\n if (rowContent.length > 1 && !rows[i - 1].endsWith(\" \") && !rows[i - 1].endsWith(\" \\r\")) {\r\n rowContent = \" \" + rowContent;\r\n }\r\n let offset = 0;\r\n if (rows[i - 1].endsWith(\"\\r\")) {\r\n offset = -1;\r\n }\r\n const startPos = new position_1.Position(i, rows[i - 1].length + 1 + offset);\r\n const endPos = new position_1.Position(i + 1, rows[i].length + 1);\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, startPos, endPos, rowContent);\r\n const issue = issue_1.Issue.atPosition(file, position, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.LineOnlyPunc = LineOnlyPunc;\r\n//# sourceMappingURL=line_only_punc.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/line_only_punc.js?");
|
|
11944
11944
|
|
|
11945
11945
|
/***/ }),
|
|
11946
11946
|
|
|
@@ -11973,7 +11973,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11973
11973
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11974
11974
|
|
|
11975
11975
|
"use strict";
|
|
11976
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LocalVariableNames = exports.LocalVariableNamesConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _naming_rule_config_1 = __webpack_require__(/*! ./_naming_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_naming_rule_config.js\");\r\nconst name_validator_1 = __webpack_require__(/*! ../utils/name_validator */ \"./node_modules/@abaplint/core/build/src/utils/name_validator.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass LocalVariableNamesConf extends _naming_rule_config_1.NamingRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** The pattern for local variable names */\r\n this.expectedData = \"^L._.+$\";\r\n /** The pattern for local constant names */\r\n this.expectedConstant = \"^LC_.+$\";\r\n /** The pattern for field symbol names */\r\n this.expectedFS = \"^<L._.+>$\";\r\n }\r\n}\r\nexports.LocalVariableNamesConf = LocalVariableNamesConf;\r\nclass LocalVariableNames extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new LocalVariableNamesConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"local_variable_names\",\r\n title: \"Local variable naming conventions\",\r\n shortDescription: `\nAllows you to enforce a pattern, such as a prefix, for local variables, constants and field symbols.\nRegexes are case-insensitive.`,\r\n tags: [_irule_1.RuleTag.Naming, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getDescription(expected, actual) {\r\n return this.conf.patternKind === \"required\" ?\r\n \"Local variable name does not match pattern \" + expected + \": \" + actual :\r\n \"Local variable name must not match pattern \" + expected + \": \" + actual;\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const ret = [];\r\n if (this.conf.patternKind === undefined) {\r\n this.conf.patternKind = \"required\";\r\n }\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return [];\r\n }\r\n // inside METHOD, FORM, FUNCTION MODULE\r\n for (const node of stru.findAllStructures(Structures.Form)) {\r\n ret.push(...this.checkLocals(node, file));\r\n }\r\n for (const node of stru.findAllStructures(Structures.Method)) {\r\n ret.push(...this.checkLocals(node, file));\r\n }\r\n for (const node of stru.findAllStructures(Structures.FunctionModule)) {\r\n ret.push(...this.checkLocals(node, file));\r\n }\r\n return ret;\r\n }\r\n checkLocals(structure, file) {\r\n let ret = [];\r\n // data, field symbols\r\n for (const dat of structure.findAllStatements(Statements.Data)) {\r\n const parent = structure.findParent(dat);\r\n if (parent && parent.get() instanceof Structures.Data) {\r\n continue; // inside DATA BEGIN OF\r\n }\r\n const found = dat.findFirstExpression(Expressions.DefinitionName);\r\n if (found) {\r\n const token = found.getFirstToken();\r\n ret = ret.concat(this.checkName(token, file, this.conf.expectedData));\r\n }\r\n }\r\n // inline data\r\n for (const dat of structure.findAllExpressions(Expressions.InlineData)) {\r\n const found = dat.findFirstExpression(Expressions.TargetField);\r\n if (found) {\r\n const token = found.getFirstToken();\r\n ret = ret.concat(this.checkName(token, file, this.conf.expectedData));\r\n }\r\n }\r\n // data structures, data begin of, first level\r\n const dataStructures = structure.findAllStructures(Structures.Data);\r\n for (const struc of dataStructures) {\r\n // ignore nested DATA BEGIN\r\n const stat = struc.findFirstStatement(Statements.DataBegin);\r\n const found = stat === null || stat === void 0 ? void 0 : stat.findFirstExpression(Expressions.DefinitionName);\r\n if (found) {\r\n const token = found.getFirstToken();\r\n ret = ret.concat(this.checkName(token, file, this.conf.expectedData));\r\n }\r\n }\r\n for (const fieldsymbol of structure.findAllStatements(Statements.FieldSymbol)) {\r\n const found = fieldsymbol.findFirstExpression(Expressions.FieldSymbol);\r\n if (found) {\r\n const token = found.getFirstToken();\r\n ret = ret.concat(this.checkName(token, file, this.conf.expectedFS));\r\n }\r\n }\r\n // inline field symbols\r\n for (const fieldsymbol of structure.findAllExpressions(Expressions.InlineFS)) {\r\n const found = fieldsymbol.findFirstExpression(Expressions.TargetFieldSymbol);\r\n if (found) {\r\n const token = found.getFirstToken();\r\n ret = ret.concat(this.checkName(token, file, this.conf.expectedFS));\r\n }\r\n }\r\n const constants = structure.findAllStatements(Statements.Constant);\r\n for (const constant of constants) {\r\n const parent = structure.findParent(constant);\r\n if (parent && parent.get() instanceof Structures.Constants) {\r\n continue; // inside DATA BEGIN OF\r\n }\r\n const found = constant.findFirstExpression(Expressions.DefinitionName);\r\n if (found) {\r\n const token = found.getFirstToken();\r\n ret = ret.concat(this.checkName(token, file, this.conf.expectedConstant));\r\n }\r\n }\r\n return ret;\r\n }\r\n checkName(token, file, expected) {\r\n const ret = [];\r\n const regex = new RegExp(expected, \"i\");\r\n const name = token.getStr();\r\n if (name_validator_1.NameValidator.violatesRule(name, regex, this.conf)) {\r\n const message = this.getDescription(expected, name);\r\n const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity);\r\n ret.push(issue);\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.LocalVariableNames = LocalVariableNames;\r\n//# sourceMappingURL=local_variable_names.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/local_variable_names.js?");
|
|
11976
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LocalVariableNames = exports.LocalVariableNamesConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _naming_rule_config_1 = __webpack_require__(/*! ./_naming_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_naming_rule_config.js\");\r\nconst name_validator_1 = __webpack_require__(/*! ../utils/name_validator */ \"./node_modules/@abaplint/core/build/src/utils/name_validator.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass LocalVariableNamesConf extends _naming_rule_config_1.NamingRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** The pattern for local variable names */\r\n this.expectedData = \"^L._.+$\";\r\n /** The pattern for local constant names */\r\n this.expectedConstant = \"^LC_.+$\";\r\n /** The pattern for field symbol names */\r\n this.expectedFS = \"^<L._.+>$\";\r\n }\r\n}\r\nexports.LocalVariableNamesConf = LocalVariableNamesConf;\r\nclass LocalVariableNames extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new LocalVariableNamesConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"local_variable_names\",\r\n title: \"Local variable naming conventions\",\r\n shortDescription: `\r\nAllows you to enforce a pattern, such as a prefix, for local variables, constants and field symbols.\r\nRegexes are case-insensitive.`,\r\n tags: [_irule_1.RuleTag.Naming, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getDescription(expected, actual) {\r\n return this.conf.patternKind === \"required\" ?\r\n \"Local variable name does not match pattern \" + expected + \": \" + actual :\r\n \"Local variable name must not match pattern \" + expected + \": \" + actual;\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const ret = [];\r\n if (this.conf.patternKind === undefined) {\r\n this.conf.patternKind = \"required\";\r\n }\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return [];\r\n }\r\n // inside METHOD, FORM, FUNCTION MODULE\r\n for (const node of stru.findAllStructures(Structures.Form)) {\r\n ret.push(...this.checkLocals(node, file));\r\n }\r\n for (const node of stru.findAllStructures(Structures.Method)) {\r\n ret.push(...this.checkLocals(node, file));\r\n }\r\n for (const node of stru.findAllStructures(Structures.FunctionModule)) {\r\n ret.push(...this.checkLocals(node, file));\r\n }\r\n return ret;\r\n }\r\n checkLocals(structure, file) {\r\n let ret = [];\r\n // data, field symbols\r\n for (const dat of structure.findAllStatements(Statements.Data)) {\r\n const parent = structure.findParent(dat);\r\n if (parent && parent.get() instanceof Structures.Data) {\r\n continue; // inside DATA BEGIN OF\r\n }\r\n const found = dat.findFirstExpression(Expressions.DefinitionName);\r\n if (found) {\r\n const token = found.getFirstToken();\r\n ret = ret.concat(this.checkName(token, file, this.conf.expectedData));\r\n }\r\n }\r\n // inline data\r\n for (const dat of structure.findAllExpressions(Expressions.InlineData)) {\r\n const found = dat.findFirstExpression(Expressions.TargetField);\r\n if (found) {\r\n const token = found.getFirstToken();\r\n ret = ret.concat(this.checkName(token, file, this.conf.expectedData));\r\n }\r\n }\r\n // data structures, data begin of, first level\r\n const dataStructures = structure.findAllStructures(Structures.Data);\r\n for (const struc of dataStructures) {\r\n // ignore nested DATA BEGIN\r\n const stat = struc.findFirstStatement(Statements.DataBegin);\r\n const found = stat === null || stat === void 0 ? void 0 : stat.findFirstExpression(Expressions.DefinitionName);\r\n if (found) {\r\n const token = found.getFirstToken();\r\n ret = ret.concat(this.checkName(token, file, this.conf.expectedData));\r\n }\r\n }\r\n for (const fieldsymbol of structure.findAllStatements(Statements.FieldSymbol)) {\r\n const found = fieldsymbol.findFirstExpression(Expressions.FieldSymbol);\r\n if (found) {\r\n const token = found.getFirstToken();\r\n ret = ret.concat(this.checkName(token, file, this.conf.expectedFS));\r\n }\r\n }\r\n // inline field symbols\r\n for (const fieldsymbol of structure.findAllExpressions(Expressions.InlineFS)) {\r\n const found = fieldsymbol.findFirstExpression(Expressions.TargetFieldSymbol);\r\n if (found) {\r\n const token = found.getFirstToken();\r\n ret = ret.concat(this.checkName(token, file, this.conf.expectedFS));\r\n }\r\n }\r\n const constants = structure.findAllStatements(Statements.Constant);\r\n for (const constant of constants) {\r\n const parent = structure.findParent(constant);\r\n if (parent && parent.get() instanceof Structures.Constants) {\r\n continue; // inside DATA BEGIN OF\r\n }\r\n const found = constant.findFirstExpression(Expressions.DefinitionName);\r\n if (found) {\r\n const token = found.getFirstToken();\r\n ret = ret.concat(this.checkName(token, file, this.conf.expectedConstant));\r\n }\r\n }\r\n return ret;\r\n }\r\n checkName(token, file, expected) {\r\n const ret = [];\r\n const regex = new RegExp(expected, \"i\");\r\n const name = token.getStr();\r\n if (name_validator_1.NameValidator.violatesRule(name, regex, this.conf)) {\r\n const message = this.getDescription(expected, name);\r\n const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity);\r\n ret.push(issue);\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.LocalVariableNames = LocalVariableNames;\r\n//# sourceMappingURL=local_variable_names.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/local_variable_names.js?");
|
|
11977
11977
|
|
|
11978
11978
|
/***/ }),
|
|
11979
11979
|
|
|
@@ -11995,7 +11995,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11995
11995
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11996
11996
|
|
|
11997
11997
|
"use strict";
|
|
11998
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ManyParentheses = exports.ManyParenthesesConf = void 0;\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass ManyParenthesesConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.ManyParenthesesConf = ManyParenthesesConf;\r\nclass ManyParentheses extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ManyParenthesesConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"many_parentheses\",\r\n title: \"Too many parentheses\",\r\n shortDescription: `Searches for expressions where extra parentheses can safely be removed`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],\r\n badExample: `\nIF ( destination IS INITIAL ).\nENDIF.\nIF foo = boo AND ( bar = lar AND moo = loo ).\nENDIF.\n`,\r\n goodExample: `\nIF destination IS INITIAL.\nENDIF.\nIF foo = boo AND bar = lar AND moo = loo.\nENDIF.\n`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n const structure = file.getStructure();\r\n if (structure === undefined) {\r\n return [];\r\n }\r\n for (const cond of structure.findAllExpressions(Expressions.Cond)) {\r\n issues.push(...this.analyze(file, cond));\r\n }\r\n for (const sub of structure.findAllExpressions(Expressions.CondSub)) {\r\n const cond = sub.findDirectExpressions(Expressions.Cond);\r\n if (cond.length !== 1) {\r\n continue;\r\n }\r\n if (cond[0].getChildren().length === 1) {\r\n const message = \"Too many parentheses, simple\";\r\n const fixText = sub.getChildren()[1].concatTokens();\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, sub.getFirstToken().getStart(), sub.getLastToken().getEnd(), fixText);\r\n const issue = issue_1.Issue.atToken(file, sub.getFirstToken(), message, this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n ////////////////////\r\n analyze(file, cond) {\r\n const issues = [];\r\n let comparator = \"\";\r\n for (const c of cond.getChildren()) {\r\n let current = \"\";\r\n if (c instanceof nodes_1.TokenNode) {\r\n current = c.get().getStr().toUpperCase();\r\n }\r\n else if (c instanceof nodes_1.ExpressionNode && c.get() instanceof Expressions.CondSub) {\r\n if (c.getFirstToken().getStr().toUpperCase() === \"NOT\") {\r\n return [];\r\n }\r\n const i = c.findDirectExpression(Expressions.Cond);\r\n if (i === undefined) {\r\n return [];\r\n }\r\n current = this.findComparator(i);\r\n }\r\n if (comparator === \"\") {\r\n comparator = current;\r\n }\r\n else if (comparator !== current) {\r\n return [];\r\n }\r\n }\r\n if (comparator !== \"\" && comparator !== \"MIXED\") {\r\n const message = \"Too many parentheses, complex\";\r\n const issue = issue_1.Issue.atToken(file, cond.getFirstToken(), message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n return issues;\r\n }\r\n findComparator(cond) {\r\n let comparator = \"\";\r\n const children = cond.getChildren();\r\n for (const c of children) {\r\n if (c instanceof nodes_1.TokenNode) {\r\n const current = c.get().getStr().toUpperCase();\r\n if (comparator === \"\") {\r\n comparator = current;\r\n }\r\n else if (current !== comparator) {\r\n return \"MIXED\";\r\n }\r\n }\r\n }\r\n return comparator;\r\n }\r\n}\r\nexports.ManyParentheses = ManyParentheses;\r\n//# sourceMappingURL=many_parentheses.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/many_parentheses.js?");
|
|
11998
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ManyParentheses = exports.ManyParenthesesConf = void 0;\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass ManyParenthesesConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.ManyParenthesesConf = ManyParenthesesConf;\r\nclass ManyParentheses extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ManyParenthesesConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"many_parentheses\",\r\n title: \"Too many parentheses\",\r\n shortDescription: `Searches for expressions where extra parentheses can safely be removed`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],\r\n badExample: `\r\nIF ( destination IS INITIAL ).\r\nENDIF.\r\nIF foo = boo AND ( bar = lar AND moo = loo ).\r\nENDIF.\r\n`,\r\n goodExample: `\r\nIF destination IS INITIAL.\r\nENDIF.\r\nIF foo = boo AND bar = lar AND moo = loo.\r\nENDIF.\r\n`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n const structure = file.getStructure();\r\n if (structure === undefined) {\r\n return [];\r\n }\r\n for (const cond of structure.findAllExpressions(Expressions.Cond)) {\r\n issues.push(...this.analyze(file, cond));\r\n }\r\n for (const sub of structure.findAllExpressions(Expressions.CondSub)) {\r\n const cond = sub.findDirectExpressions(Expressions.Cond);\r\n if (cond.length !== 1) {\r\n continue;\r\n }\r\n if (cond[0].getChildren().length === 1) {\r\n const message = \"Too many parentheses, simple\";\r\n const fixText = sub.getChildren()[1].concatTokens();\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, sub.getFirstToken().getStart(), sub.getLastToken().getEnd(), fixText);\r\n const issue = issue_1.Issue.atToken(file, sub.getFirstToken(), message, this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n ////////////////////\r\n analyze(file, cond) {\r\n const issues = [];\r\n let comparator = \"\";\r\n for (const c of cond.getChildren()) {\r\n let current = \"\";\r\n if (c instanceof nodes_1.TokenNode) {\r\n current = c.get().getStr().toUpperCase();\r\n }\r\n else if (c instanceof nodes_1.ExpressionNode && c.get() instanceof Expressions.CondSub) {\r\n if (c.getFirstToken().getStr().toUpperCase() === \"NOT\") {\r\n return [];\r\n }\r\n const i = c.findDirectExpression(Expressions.Cond);\r\n if (i === undefined) {\r\n return [];\r\n }\r\n current = this.findComparator(i);\r\n }\r\n if (comparator === \"\") {\r\n comparator = current;\r\n }\r\n else if (comparator !== current) {\r\n return [];\r\n }\r\n }\r\n if (comparator !== \"\" && comparator !== \"MIXED\") {\r\n const message = \"Too many parentheses, complex\";\r\n const issue = issue_1.Issue.atToken(file, cond.getFirstToken(), message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n return issues;\r\n }\r\n findComparator(cond) {\r\n let comparator = \"\";\r\n const children = cond.getChildren();\r\n for (const c of children) {\r\n if (c instanceof nodes_1.TokenNode) {\r\n const current = c.get().getStr().toUpperCase();\r\n if (comparator === \"\") {\r\n comparator = current;\r\n }\r\n else if (current !== comparator) {\r\n return \"MIXED\";\r\n }\r\n }\r\n }\r\n return comparator;\r\n }\r\n}\r\nexports.ManyParentheses = ManyParentheses;\r\n//# sourceMappingURL=many_parentheses.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/many_parentheses.js?");
|
|
11999
11999
|
|
|
12000
12000
|
/***/ }),
|
|
12001
12001
|
|
|
@@ -12006,7 +12006,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12006
12006
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12007
12007
|
|
|
12008
12008
|
"use strict";
|
|
12009
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MaxOneMethodParameterPerLine = exports.MaxOneMethodParameterPerLineConf = void 0;\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass MaxOneMethodParameterPerLineConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.MaxOneMethodParameterPerLineConf = MaxOneMethodParameterPerLineConf;\r\nclass MaxOneMethodParameterPerLine extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new MaxOneMethodParameterPerLineConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"max_one_method_parameter_per_line\",\r\n title: \"Max one method parameter definition per line\",\r\n shortDescription: `Keep max one method parameter description per line`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace],\r\n badExample: `\nMETHODS apps_scope_token\n IMPORTING\n body TYPE bodyapps_scope_token client_id TYPE str.`,\r\n goodExample: `\nMETHODS apps_scope_token\n IMPORTING\n body TYPE bodyapps_scope_token\n client_id TYPE str.`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n var _a;\r\n const issues = [];\r\n for (const statement of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllStatements(Statements.MethodDef)) || []) {\r\n let prev = undefined;\r\n for (const p of statement.findAllExpressions(Expressions.MethodParam)) {\r\n if (prev === undefined) {\r\n prev = p;\r\n continue;\r\n }\r\n if (prev.getFirstToken().getStart().getRow() === p.getFirstToken().getStart().getRow()) {\r\n const issue = issue_1.Issue.atToken(file, prev.getFirstToken(), this.getMetadata().title, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n prev = p;\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.MaxOneMethodParameterPerLine = MaxOneMethodParameterPerLine;\r\n//# sourceMappingURL=max_one_method_parameter_per_line.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/max_one_method_parameter_per_line.js?");
|
|
12009
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MaxOneMethodParameterPerLine = exports.MaxOneMethodParameterPerLineConf = void 0;\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass MaxOneMethodParameterPerLineConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.MaxOneMethodParameterPerLineConf = MaxOneMethodParameterPerLineConf;\r\nclass MaxOneMethodParameterPerLine extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new MaxOneMethodParameterPerLineConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"max_one_method_parameter_per_line\",\r\n title: \"Max one method parameter definition per line\",\r\n shortDescription: `Keep max one method parameter description per line`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace],\r\n badExample: `\r\nMETHODS apps_scope_token\r\n IMPORTING\r\n body TYPE bodyapps_scope_token client_id TYPE str.`,\r\n goodExample: `\r\nMETHODS apps_scope_token\r\n IMPORTING\r\n body TYPE bodyapps_scope_token\r\n client_id TYPE str.`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n var _a;\r\n const issues = [];\r\n for (const statement of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllStatements(Statements.MethodDef)) || []) {\r\n let prev = undefined;\r\n for (const p of statement.findAllExpressions(Expressions.MethodParam)) {\r\n if (prev === undefined) {\r\n prev = p;\r\n continue;\r\n }\r\n if (prev.getFirstToken().getStart().getRow() === p.getFirstToken().getStart().getRow()) {\r\n const issue = issue_1.Issue.atToken(file, prev.getFirstToken(), this.getMetadata().title, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n prev = p;\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.MaxOneMethodParameterPerLine = MaxOneMethodParameterPerLine;\r\n//# sourceMappingURL=max_one_method_parameter_per_line.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/max_one_method_parameter_per_line.js?");
|
|
12010
12010
|
|
|
12011
12011
|
/***/ }),
|
|
12012
12012
|
|
|
@@ -12017,7 +12017,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12017
12017
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12018
12018
|
|
|
12019
12019
|
"use strict";
|
|
12020
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MaxOneStatement = exports.MaxOneStatementConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nclass MaxOneStatementConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.MaxOneStatementConf = MaxOneStatementConf;\r\nclass MaxOneStatement extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new MaxOneStatementConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"max_one_statement\",\r\n title: \"Max one statement per line\",\r\n shortDescription: `Checks that each line contains only a single statement.`,\r\n extendedInformation: `Does not report empty statements, use rule empty_statement for detecting empty statements.\n\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#no-more-than-one-statement-per-line\nhttps://docs.abapopenchecks.org/checks/11/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n badExample: `WRITE foo. WRITE bar.`,\r\n goodExample: `WRITE foo.\\nWRITE bar.`,\r\n };\r\n }\r\n getMessage() {\r\n return \"Only one statement is allowed per line\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n let prev = 0;\r\n let reported = 0;\r\n for (const statement of file.getStatements()) {\r\n const term = statement.getTerminator();\r\n if (statement.get() instanceof _statement_1.Comment\r\n || statement.get() instanceof _statement_1.NativeSQL\r\n || term === \",\") {\r\n continue;\r\n }\r\n const pos = statement.getStart();\r\n if (pos instanceof position_1.VirtualPosition) {\r\n continue;\r\n }\r\n const row = pos.getRow();\r\n if (prev === row && row !== reported && statement.getFirstToken().getStr() !== \".\") {\r\n const fix = edit_helper_1.EditHelper.insertAt(file, pos, \"\\n\");\r\n const issue = issue_1.Issue.atPosition(file, pos, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n reported = row;\r\n }\r\n prev = row;\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.MaxOneStatement = MaxOneStatement;\r\n//# sourceMappingURL=max_one_statement.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/max_one_statement.js?");
|
|
12020
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MaxOneStatement = exports.MaxOneStatementConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nclass MaxOneStatementConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.MaxOneStatementConf = MaxOneStatementConf;\r\nclass MaxOneStatement extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new MaxOneStatementConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"max_one_statement\",\r\n title: \"Max one statement per line\",\r\n shortDescription: `Checks that each line contains only a single statement.`,\r\n extendedInformation: `Does not report empty statements, use rule empty_statement for detecting empty statements.\r\n\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#no-more-than-one-statement-per-line\r\nhttps://docs.abapopenchecks.org/checks/11/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n badExample: `WRITE foo. WRITE bar.`,\r\n goodExample: `WRITE foo.\\nWRITE bar.`,\r\n };\r\n }\r\n getMessage() {\r\n return \"Only one statement is allowed per line\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n let prev = 0;\r\n let reported = 0;\r\n for (const statement of file.getStatements()) {\r\n const term = statement.getTerminator();\r\n if (statement.get() instanceof _statement_1.Comment\r\n || statement.get() instanceof _statement_1.NativeSQL\r\n || term === \",\") {\r\n continue;\r\n }\r\n const pos = statement.getStart();\r\n if (pos instanceof position_1.VirtualPosition) {\r\n continue;\r\n }\r\n const row = pos.getRow();\r\n if (prev === row && row !== reported && statement.getFirstToken().getStr() !== \".\") {\r\n const fix = edit_helper_1.EditHelper.insertAt(file, pos, \"\\n\");\r\n const issue = issue_1.Issue.atPosition(file, pos, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n reported = row;\r\n }\r\n prev = row;\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.MaxOneStatement = MaxOneStatement;\r\n//# sourceMappingURL=max_one_statement.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/max_one_statement.js?");
|
|
12021
12021
|
|
|
12022
12022
|
/***/ }),
|
|
12023
12023
|
|
|
@@ -12127,7 +12127,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12127
12127
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12128
12128
|
|
|
12129
12129
|
"use strict";
|
|
12130
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Nesting = exports.NestingConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass NestingConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Maximum allowed nesting depth */\r\n this.depth = 5;\r\n }\r\n}\r\nexports.NestingConf = NestingConf;\r\nclass Nesting extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new NestingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"nesting\",\r\n title: \"Check nesting depth\",\r\n shortDescription: `Checks for methods exceeding a maximum nesting depth`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#keep-the-nesting-depth-low\nhttps://docs.abapopenchecks.org/checks/74/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getDescription(max) {\r\n return \"Reduce nesting depth to max \" + max;\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n let depth = 0;\r\n for (const statement of file.getStatements()) {\r\n const type = statement.get();\r\n if (type instanceof Statements.If\r\n || type instanceof Statements.Case\r\n || type instanceof Statements.While\r\n || type instanceof Statements.Loop\r\n || type instanceof Statements.SelectLoop\r\n || type instanceof Statements.Do\r\n || type instanceof Statements.Try) {\r\n depth = depth + 1;\r\n }\r\n else if (type instanceof Statements.EndIf\r\n || type instanceof Statements.EndCase\r\n || type instanceof Statements.EndWhile\r\n || type instanceof Statements.EndLoop\r\n || type instanceof Statements.EndSelect\r\n || type instanceof Statements.EndDo\r\n || type instanceof Statements.EndTry) {\r\n depth = depth - 1;\r\n }\r\n if (depth > this.conf.depth) {\r\n const pos = statement.getFirstToken().getStart();\r\n const issue = issue_1.Issue.atPosition(file, pos, this.getDescription(this.conf.depth.toString()), this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n break; // only one finding per file\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.Nesting = Nesting;\r\n//# sourceMappingURL=nesting.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/nesting.js?");
|
|
12130
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Nesting = exports.NestingConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass NestingConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Maximum allowed nesting depth */\r\n this.depth = 5;\r\n }\r\n}\r\nexports.NestingConf = NestingConf;\r\nclass Nesting extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new NestingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"nesting\",\r\n title: \"Check nesting depth\",\r\n shortDescription: `Checks for methods exceeding a maximum nesting depth`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#keep-the-nesting-depth-low\r\nhttps://docs.abapopenchecks.org/checks/74/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getDescription(max) {\r\n return \"Reduce nesting depth to max \" + max;\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n let depth = 0;\r\n for (const statement of file.getStatements()) {\r\n const type = statement.get();\r\n if (type instanceof Statements.If\r\n || type instanceof Statements.Case\r\n || type instanceof Statements.While\r\n || type instanceof Statements.Loop\r\n || type instanceof Statements.SelectLoop\r\n || type instanceof Statements.Do\r\n || type instanceof Statements.Try) {\r\n depth = depth + 1;\r\n }\r\n else if (type instanceof Statements.EndIf\r\n || type instanceof Statements.EndCase\r\n || type instanceof Statements.EndWhile\r\n || type instanceof Statements.EndLoop\r\n || type instanceof Statements.EndSelect\r\n || type instanceof Statements.EndDo\r\n || type instanceof Statements.EndTry) {\r\n depth = depth - 1;\r\n }\r\n if (depth > this.conf.depth) {\r\n const pos = statement.getFirstToken().getStart();\r\n const issue = issue_1.Issue.atPosition(file, pos, this.getDescription(this.conf.depth.toString()), this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n break; // only one finding per file\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.Nesting = Nesting;\r\n//# sourceMappingURL=nesting.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/nesting.js?");
|
|
12131
12131
|
|
|
12132
12132
|
/***/ }),
|
|
12133
12133
|
|
|
@@ -12160,7 +12160,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12160
12160
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12161
12161
|
|
|
12162
12162
|
"use strict";
|
|
12163
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.NoChainedAssignment = exports.NoChainedAssignmentConf = void 0;\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass NoChainedAssignmentConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.NoChainedAssignmentConf = NoChainedAssignmentConf;\r\nclass NoChainedAssignment extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new NoChainedAssignmentConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"no_chained_assignment\",\r\n title: \"No chained assignment\",\r\n shortDescription: `Find chained assingments and reports issues`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#dont-chain-assignments`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide],\r\n badExample: `var1 = var2 = var3.`,\r\n goodExample: `var2 = var3.\nvar1 = var2.`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n for (const s of file.getStatements()) {\r\n if (!(s.get() instanceof Statements.Move)) {\r\n continue;\r\n }\r\n if (s.findDirectExpressions(Expressions.Target).length >= 2) {\r\n const message = \"No chained assignment\";\r\n const issue = issue_1.Issue.atStatement(file, s, message, this.getMetadata().key);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.NoChainedAssignment = NoChainedAssignment;\r\n//# sourceMappingURL=no_chained_assignment.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/no_chained_assignment.js?");
|
|
12163
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.NoChainedAssignment = exports.NoChainedAssignmentConf = void 0;\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass NoChainedAssignmentConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.NoChainedAssignmentConf = NoChainedAssignmentConf;\r\nclass NoChainedAssignment extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new NoChainedAssignmentConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"no_chained_assignment\",\r\n title: \"No chained assignment\",\r\n shortDescription: `Find chained assingments and reports issues`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#dont-chain-assignments`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide],\r\n badExample: `var1 = var2 = var3.`,\r\n goodExample: `var2 = var3.\r\nvar1 = var2.`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n for (const s of file.getStatements()) {\r\n if (!(s.get() instanceof Statements.Move)) {\r\n continue;\r\n }\r\n if (s.findDirectExpressions(Expressions.Target).length >= 2) {\r\n const message = \"No chained assignment\";\r\n const issue = issue_1.Issue.atStatement(file, s, message, this.getMetadata().key);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.NoChainedAssignment = NoChainedAssignment;\r\n//# sourceMappingURL=no_chained_assignment.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/no_chained_assignment.js?");
|
|
12164
12164
|
|
|
12165
12165
|
/***/ }),
|
|
12166
12166
|
|
|
@@ -12171,7 +12171,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12171
12171
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12172
12172
|
|
|
12173
12173
|
"use strict";
|
|
12174
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.NoPublicAttributes = exports.NoPublicAttributesConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst visibility_1 = __webpack_require__(/*! ../abap/4_file_information/visibility */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js\");\r\nconst _abap_file_information_1 = __webpack_require__(/*! ../abap/4_file_information/_abap_file_information */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/_abap_file_information.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass NoPublicAttributesConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Allows public attributes, if they are declared as READ-ONLY. */\r\n this.allowReadOnly = false;\r\n }\r\n}\r\nexports.NoPublicAttributesConf = NoPublicAttributesConf;\r\nclass NoPublicAttributes extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new NoPublicAttributesConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"no_public_attributes\",\r\n title: \"No public attributes\",\r\n shortDescription: `Checks that classes and interfaces don't contain any public attributes.\nExceptions are excluded from this rule.`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#members-private-by-default-protected-only-if-needed`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getDescription(name) {\r\n return \"Public attributes are not allowed, attribute \\\"\" + name + \"\\\"\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file, obj) {\r\n this.file = file;\r\n const attributes = this.getAllPublicAttributes(obj);\r\n return this.findAllIssues(attributes);\r\n }\r\n getAllPublicAttributes(obj) {\r\n let attributes = [];\r\n attributes = attributes.concat(this.getAllPublicClassAttributes(obj));\r\n attributes = attributes.concat(this.getAllPublicInterfaceAttributes());\r\n return attributes;\r\n }\r\n getAllPublicClassAttributes(obj) {\r\n let attributes = [];\r\n const ddic = new ddic_1.DDIC(this.reg);\r\n for (const classDef of this.file.getInfo().listClassDefinitions()) {\r\n if (ddic.isException(classDef, obj)) {\r\n continue;\r\n }\r\n attributes = attributes.concat(classDef.attributes.filter(a => a.visibility === visibility_1.Visibility.Public));\r\n }\r\n return attributes;\r\n }\r\n getAllPublicInterfaceAttributes() {\r\n let attributes = [];\r\n for (const interfaceDef of this.file.getInfo().listInterfaceDefinitions()) {\r\n attributes = attributes.concat(interfaceDef.attributes.filter(a => a.visibility === visibility_1.Visibility.Public));\r\n }\r\n return attributes;\r\n }\r\n findAllIssues(attributes) {\r\n const issues = [];\r\n for (const attr of attributes) {\r\n if (this.conf.allowReadOnly === true && attr.readOnly) {\r\n continue;\r\n }\r\n else if (attr.level === _abap_file_information_1.AttributeLevel.Constant) {\r\n continue;\r\n }\r\n const issue = issue_1.Issue.atIdentifier(attr.identifier, this.getDescription(attr.name), this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.NoPublicAttributes = NoPublicAttributes;\r\n//# sourceMappingURL=no_public_attributes.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/no_public_attributes.js?");
|
|
12174
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.NoPublicAttributes = exports.NoPublicAttributesConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst visibility_1 = __webpack_require__(/*! ../abap/4_file_information/visibility */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js\");\r\nconst _abap_file_information_1 = __webpack_require__(/*! ../abap/4_file_information/_abap_file_information */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/_abap_file_information.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass NoPublicAttributesConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Allows public attributes, if they are declared as READ-ONLY. */\r\n this.allowReadOnly = false;\r\n }\r\n}\r\nexports.NoPublicAttributesConf = NoPublicAttributesConf;\r\nclass NoPublicAttributes extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new NoPublicAttributesConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"no_public_attributes\",\r\n title: \"No public attributes\",\r\n shortDescription: `Checks that classes and interfaces don't contain any public attributes.\r\nExceptions are excluded from this rule.`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#members-private-by-default-protected-only-if-needed`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getDescription(name) {\r\n return \"Public attributes are not allowed, attribute \\\"\" + name + \"\\\"\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file, obj) {\r\n this.file = file;\r\n const attributes = this.getAllPublicAttributes(obj);\r\n return this.findAllIssues(attributes);\r\n }\r\n getAllPublicAttributes(obj) {\r\n let attributes = [];\r\n attributes = attributes.concat(this.getAllPublicClassAttributes(obj));\r\n attributes = attributes.concat(this.getAllPublicInterfaceAttributes());\r\n return attributes;\r\n }\r\n getAllPublicClassAttributes(obj) {\r\n let attributes = [];\r\n const ddic = new ddic_1.DDIC(this.reg);\r\n for (const classDef of this.file.getInfo().listClassDefinitions()) {\r\n if (ddic.isException(classDef, obj)) {\r\n continue;\r\n }\r\n attributes = attributes.concat(classDef.attributes.filter(a => a.visibility === visibility_1.Visibility.Public));\r\n }\r\n return attributes;\r\n }\r\n getAllPublicInterfaceAttributes() {\r\n let attributes = [];\r\n for (const interfaceDef of this.file.getInfo().listInterfaceDefinitions()) {\r\n attributes = attributes.concat(interfaceDef.attributes.filter(a => a.visibility === visibility_1.Visibility.Public));\r\n }\r\n return attributes;\r\n }\r\n findAllIssues(attributes) {\r\n const issues = [];\r\n for (const attr of attributes) {\r\n if (this.conf.allowReadOnly === true && attr.readOnly) {\r\n continue;\r\n }\r\n else if (attr.level === _abap_file_information_1.AttributeLevel.Constant) {\r\n continue;\r\n }\r\n const issue = issue_1.Issue.atIdentifier(attr.identifier, this.getDescription(attr.name), this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.NoPublicAttributes = NoPublicAttributes;\r\n//# sourceMappingURL=no_public_attributes.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/no_public_attributes.js?");
|
|
12175
12175
|
|
|
12176
12176
|
/***/ }),
|
|
12177
12177
|
|
|
@@ -12182,7 +12182,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12182
12182
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12183
12183
|
|
|
12184
12184
|
"use strict";
|
|
12185
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.NoYodaConditions = exports.NoYodaConditionsConf = void 0;\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass NoYodaConditionsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Only report issues where the left side is a constant */\r\n this.onlyConstants = false;\r\n }\r\n}\r\nexports.NoYodaConditionsConf = NoYodaConditionsConf;\r\nclass NoYodaConditions extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new NoYodaConditionsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"no_yoda_conditions\",\r\n title: \"No Yoda conditions\",\r\n shortDescription: `Finds Yoda conditions and reports issues`,\r\n extendedInformation: `https://en.wikipedia.org/wiki/Yoda_conditions\n\nConditions with operators CP, NP, CS, NS, CA, NA, CO, CN are ignored`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: `IF 0 <> sy-subrc.\nENDIF.`,\r\n goodExample: `IF sy-subrc <> 0.\nENDIF.`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n var _a, _b;\r\n const issues = [];\r\n for (const c of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllExpressions(Expressions.Compare)) || []) {\r\n const operator = (_b = c.findDirectExpression(Expressions.CompareOperator)) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase();\r\n if (operator === undefined\r\n || operator === \"CP\"\r\n || operator === \"NP\"\r\n || operator === \"CS\"\r\n || operator === \"NS\"\r\n || operator === \"CA\"\r\n || operator === \"NA\"\r\n || operator === \"CO\"\r\n || operator === \"CN\") {\r\n continue;\r\n }\r\n const sources = c.findDirectExpressions(Expressions.Source);\r\n if (sources.length !== 2) {\r\n continue;\r\n }\r\n if (this.conf.onlyConstants === true) {\r\n if (this.isConstant(sources[0]) === true && this.isConstant(sources[1]) === false) {\r\n const start = sources[0].getFirstToken().getStart();\r\n const end = sources[1].getLastToken().getEnd();\r\n const issue = issue_1.Issue.atRange(file, start, end, \"No Yoda conditions\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n continue;\r\n }\r\n // Scenarios:\r\n // constant COMPARE chain\r\n // constant COMPARE multiple tokens with spaces\r\n // fieldChain COMPARE multiple tokens with spaces\r\n if ((this.withoutSpaces(sources[0]) === false && this.withoutSpaces(sources[1]) === true) || ((this.isConstant(sources[0]) === true && this.isFieldChain(sources[1]) === true))) {\r\n const start = sources[0].getFirstToken().getStart();\r\n const end = sources[1].getLastToken().getEnd();\r\n const issue = issue_1.Issue.atRange(file, start, end, \"No Yoda conditions\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n isConstant(node) {\r\n var _a;\r\n if (node.getChildren().length > 1) {\r\n return false;\r\n }\r\n return ((_a = node.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.Constant;\r\n }\r\n isFieldChain(node) {\r\n var _a;\r\n if (node.getChildren().length > 1) {\r\n return false;\r\n }\r\n return ((_a = node.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.FieldChain;\r\n }\r\n withoutSpaces(node) {\r\n return node.concatTokensWithoutStringsAndComments().includes(\" \");\r\n }\r\n}\r\nexports.NoYodaConditions = NoYodaConditions;\r\n//# sourceMappingURL=no_yoda_conditions.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/no_yoda_conditions.js?");
|
|
12185
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.NoYodaConditions = exports.NoYodaConditionsConf = void 0;\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass NoYodaConditionsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Only report issues where the left side is a constant */\r\n this.onlyConstants = false;\r\n }\r\n}\r\nexports.NoYodaConditionsConf = NoYodaConditionsConf;\r\nclass NoYodaConditions extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new NoYodaConditionsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"no_yoda_conditions\",\r\n title: \"No Yoda conditions\",\r\n shortDescription: `Finds Yoda conditions and reports issues`,\r\n extendedInformation: `https://en.wikipedia.org/wiki/Yoda_conditions\r\n\r\nConditions with operators CP, NP, CS, NS, CA, NA, CO, CN are ignored`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: `IF 0 <> sy-subrc.\r\nENDIF.`,\r\n goodExample: `IF sy-subrc <> 0.\r\nENDIF.`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n var _a, _b;\r\n const issues = [];\r\n for (const c of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllExpressions(Expressions.Compare)) || []) {\r\n const operator = (_b = c.findDirectExpression(Expressions.CompareOperator)) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase();\r\n if (operator === undefined\r\n || operator === \"CP\"\r\n || operator === \"NP\"\r\n || operator === \"CS\"\r\n || operator === \"NS\"\r\n || operator === \"CA\"\r\n || operator === \"NA\"\r\n || operator === \"CO\"\r\n || operator === \"CN\") {\r\n continue;\r\n }\r\n const sources = c.findDirectExpressions(Expressions.Source);\r\n if (sources.length !== 2) {\r\n continue;\r\n }\r\n if (this.conf.onlyConstants === true) {\r\n if (this.isConstant(sources[0]) === true && this.isConstant(sources[1]) === false) {\r\n const start = sources[0].getFirstToken().getStart();\r\n const end = sources[1].getLastToken().getEnd();\r\n const issue = issue_1.Issue.atRange(file, start, end, \"No Yoda conditions\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n continue;\r\n }\r\n // Scenarios:\r\n // constant COMPARE chain\r\n // constant COMPARE multiple tokens with spaces\r\n // fieldChain COMPARE multiple tokens with spaces\r\n if ((this.withoutSpaces(sources[0]) === false && this.withoutSpaces(sources[1]) === true) || ((this.isConstant(sources[0]) === true && this.isFieldChain(sources[1]) === true))) {\r\n const start = sources[0].getFirstToken().getStart();\r\n const end = sources[1].getLastToken().getEnd();\r\n const issue = issue_1.Issue.atRange(file, start, end, \"No Yoda conditions\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n isConstant(node) {\r\n var _a;\r\n if (node.getChildren().length > 1) {\r\n return false;\r\n }\r\n return ((_a = node.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.Constant;\r\n }\r\n isFieldChain(node) {\r\n var _a;\r\n if (node.getChildren().length > 1) {\r\n return false;\r\n }\r\n return ((_a = node.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.FieldChain;\r\n }\r\n withoutSpaces(node) {\r\n return node.concatTokensWithoutStringsAndComments().includes(\" \");\r\n }\r\n}\r\nexports.NoYodaConditions = NoYodaConditions;\r\n//# sourceMappingURL=no_yoda_conditions.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/no_yoda_conditions.js?");
|
|
12186
12186
|
|
|
12187
12187
|
/***/ }),
|
|
12188
12188
|
|
|
@@ -12204,7 +12204,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12204
12204
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12205
12205
|
|
|
12206
12206
|
"use strict";
|
|
12207
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ObsoleteStatement = exports.ObsoleteStatementConf = void 0;\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nclass ObsoleteStatementConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Check for REFRESH statement */\r\n this.refresh = true;\r\n /** Check for COMPUTE statement */\r\n this.compute = true;\r\n /** Check for ADD statement */\r\n this.add = true;\r\n /** Check for SUBTRACT statement */\r\n this.subtract = true;\r\n /** Check for MULTIPLY statement */\r\n this.multiply = true;\r\n /** Check for DIVIDE statement */\r\n this.divide = true;\r\n /** Check for MOVE statement */\r\n this.move = true;\r\n /** Checks for usages of IS REQUESTED */\r\n this.requested = true;\r\n /** Checks for usages of OCCURS */\r\n this.occurs = true;\r\n /** Checks for SET EXTENDED CHECK */\r\n this.setExtended = true;\r\n /** Checks for WITH HEADER LINE */\r\n this.withHeaderLine = true;\r\n /** Checks for FIELD-SYMBOLS ... STRUCTURE */\r\n this.fieldSymbolStructure = true;\r\n /** Checks for TYPE-POOLS */\r\n this.typePools = true;\r\n /** Checks for addition LOAD */\r\n this.load = true;\r\n /** Checks for PARAMETER */\r\n this.parameter = true;\r\n /** Checks for RANGES */\r\n this.ranges = true;\r\n /** Checks for COMMUNICATION */\r\n this.communication = true;\r\n /** Checks for PACK */\r\n this.pack = true;\r\n /** Checks for SELECT without INTO */\r\n this.selectWithoutInto = true;\r\n /** FREE MEMORY, without ID */\r\n this.freeMemory = true;\r\n /** Checks for EXIT FROM SQL */\r\n this.exitFromSQL = true;\r\n /** Checks for SORT itab BY <fs> */\r\n this.sortByFS = true;\r\n /** Checks for CALL TRANSFORMATION OBJECTS */\r\n this.callTransformation = true;\r\n /** Check for POSIX REGEX usage */\r\n this.regex = true;\r\n /** Check for OCCURENCES vs OCCURRENCES usage */\r\n this.occurences = true;\r\n }\r\n}\r\nexports.ObsoleteStatementConf = ObsoleteStatementConf;\r\nclass ObsoleteStatement extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ObsoleteStatementConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"obsolete_statement\",\r\n title: \"Obsolete statements\",\r\n shortDescription: `Checks for usages of certain obsolete statements`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix],\r\n extendedInformation: `\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-functional-to-procedural-language-constructs\n\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-obsolete-language-elements\n\nSET EXTENDED CHECK: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapset_extended_check.htm\n\nIS REQUESTED: https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abenlogexp_requested.htm\n\nWITH HEADER LINE: https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abapdata_header_line.htm\n\nFIELD-SYMBOLS STRUCTURE: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapfield-symbols_obsolete_typing.htm\n\nTYPE-POOLS: from 702, https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abennews-71-program_load.htm\n\nLOAD addition: from 702, https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abennews-71-program_load.htm\n\nCOMMUICATION: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapcommunication.htm\n\nOCCURS: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapdata_occurs.htm\n\nPARAMETER: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abapparameter.htm\n\nRANGES: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abapranges.htm\n\nPACK: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abappack.htm\n\nMOVE: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapmove_obs.htm\n\nSELECT without INTO: https://help.sap.com/doc/abapdocu_731_index_htm/7.31/en-US/abapselect_obsolete.htm\nSELECT COUNT(*) is considered okay\n\nFREE MEMORY: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abapfree_mem_id_obsolete.htm\n\nSORT BY FS: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abapsort_itab_obsolete.htm\n\nCALL TRANSFORMATION OBJECTS: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abapcall_transformation_objects.htm\n\nPOSIX REGEX: https://help.sap.com/doc/abapdocu_755_index_htm/7.55/en-US/index.htm\n\nOCCURENCES: check for OCCURENCES vs OCCURRENCES`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n var _a, _b, _c;\r\n const issues = [];\r\n const statements = file.getStatements();\r\n let prev = undefined;\r\n const configVersion = this.reg.getConfig().getVersion();\r\n for (const staNode of statements) {\r\n const sta = staNode.get();\r\n if ((sta instanceof Statements.Refresh && this.conf.refresh)\r\n || (sta instanceof Statements.Compute && this.conf.compute)\r\n || (sta instanceof Statements.Add && this.conf.add)\r\n || (sta instanceof Statements.Subtract && this.conf.subtract)\r\n || (sta instanceof Statements.ClassDefinitionLoad && this.conf.load && configVersion >= version_1.Version.v702)\r\n || (sta instanceof Statements.InterfaceLoad && this.conf.load && configVersion >= version_1.Version.v702)\r\n || (sta instanceof Statements.Multiply && this.conf.multiply)\r\n || (sta instanceof Statements.Divide && this.conf.divide)\r\n || (sta instanceof Statements.Move && this.conf.move\r\n && staNode.getTokens()[0].getStr().toUpperCase() === \"MOVE\"\r\n && staNode.getTokens()[1].getStr() !== \"-\"\r\n && staNode.getTokens()[1].getStr().toUpperCase() !== \"EXACT\")) {\r\n if (prev === undefined || staNode.getStart().getCol() !== prev.getCol() || staNode.getStart().getRow() !== prev.getRow()) {\r\n const message = \"Statement \\\"\" + staNode.getFirstToken().getStr() + \"\\\" is obsolete\";\r\n const fix = this.getFix(file, sta, staNode);\r\n const issue = issue_1.Issue.atStatement(file, staNode, message, this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n prev = staNode.getStart();\r\n }\r\n if (this.conf.setExtended && sta instanceof Statements.SetExtendedCheck) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"SET EXTENDED CHECK is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n if (this.conf.communication && sta instanceof Statements.Communication) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"COMMUNICATION is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n if (this.conf.pack && sta instanceof Statements.Pack) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"PACK is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n if (this.conf.parameter && sta instanceof Statements.Parameter) {\r\n const token = staNode.getFirstToken();\r\n if (token.getStr().toUpperCase() === \"PARAMETER\") {\r\n const fix = edit_helper_1.EditHelper.replaceToken(file, token, \"PARAMETERS\");\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Use PARAMETERS instead of PARAMETER\", this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.conf.ranges && sta instanceof Statements.Ranges) {\r\n const children = staNode.getChildren();\r\n let fix = undefined;\r\n if (children.length === 5) {\r\n const simpleNameString = children[1].concatTokens();\r\n const fieldSubString = children[3].concatTokens();\r\n const replacement = \"TYPES \" + simpleNameString + \" LIKE RANGE OF \" + fieldSubString + \".\";\r\n fix = edit_helper_1.EditHelper.replaceRange(file, staNode.getStart(), staNode.getEnd(), replacement);\r\n }\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Use LIKE RANGE OF instead of RANGES\", this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n if (this.conf.selectWithoutInto\r\n && (sta instanceof Statements.Select || sta instanceof Statements.SelectLoop)\r\n && staNode.findFirstExpression(Expressions.SQLIntoStructure) === undefined\r\n && staNode.findFirstExpression(Expressions.SQLIntoTable) === undefined) {\r\n const concat = (_a = staNode.findFirstExpression(Expressions.SQLFieldList)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();\r\n if (concat !== \"COUNT(*)\" && concat !== \"COUNT( * )\") {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"SELECT without INTO\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.conf.requested && sta instanceof Statements.If) {\r\n for (const compare of staNode.findAllExpressions(Expressions.Compare)) {\r\n const token = compare.findDirectTokenByText(\"REQUESTED\");\r\n if (token) {\r\n const fix = edit_helper_1.EditHelper.replaceToken(file, token, \"SUPPLIED\");\r\n const issue = issue_1.Issue.atToken(file, token, \"IS REQUESTED is obsolete\", this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n if (this.conf.occurs) {\r\n if ((sta instanceof Statements.Describe)\r\n || (sta instanceof Statements.Ranges)\r\n || (sta instanceof Statements.DataBegin)\r\n || (sta instanceof Statements.TypeBegin)) {\r\n const token = staNode.findDirectTokenByText(\"OCCURS\");\r\n if (token) {\r\n const issue = issue_1.Issue.atToken(file, token, \"OCCURS is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n for (const dataDef of staNode.findAllExpressions(Expressions.DataDefinition)) {\r\n const token = (_b = dataDef.findDirectExpression(Expressions.TypeTable)) === null || _b === void 0 ? void 0 : _b.findDirectTokenByText(\"OCCURS\");\r\n if (token) {\r\n const issue = issue_1.Issue.atToken(file, token, \"OCCURS is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n if (this.conf.withHeaderLine === true && sta instanceof Statements.Data) {\r\n if (staNode.concatTokens().toUpperCase().includes(\"WITH HEADER LINE\")) {\r\n const token = staNode.getFirstToken();\r\n if (token) {\r\n const issue = issue_1.Issue.atToken(file, token, \"WITH HEADER LINE is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n if (this.conf.fieldSymbolStructure && sta instanceof Statements.FieldSymbol) {\r\n const token = staNode.findDirectTokenByText(\"STRUCTURE\");\r\n if (token) {\r\n const issue = issue_1.Issue.atToken(file, token, \"FIELD-SYMBOLS ... STRUCTURE is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.conf.typePools && sta instanceof Statements.TypePools && configVersion >= version_1.Version.v702) {\r\n const fix = edit_helper_1.EditHelper.deleteStatement(file, staNode);\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Statement \\\"TYPE-POOLS\\\" is obsolete\", this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n if (this.conf.freeMemory && sta instanceof Statements.FreeMemory) {\r\n const concat = staNode.concatTokens().toUpperCase();\r\n if (concat === \"FREE MEMORY.\") {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Statement \\\"FREE MEMORY\\\" without ID is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.conf.exitFromSQL && sta instanceof Statements.Exit) {\r\n const concat = staNode.concatTokens().toUpperCase();\r\n if (concat === \"EXIT FROM SQL.\") {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Statement \\\"EXIT FROM SQL\\\" is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.conf.sortByFS && sta instanceof Statements.Sort) {\r\n const afterBy = staNode.findExpressionAfterToken(\"BY\");\r\n if (afterBy instanceof nodes_1.ExpressionNode && afterBy.get() instanceof expressions_1.SourceFieldSymbol) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Statement \\\"SORT itab BY <fs>\\\" is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.conf.callTransformation && sta instanceof Statements.CallTransformation) {\r\n const objects = staNode.findExpressionAfterToken(\"OBJECTS\");\r\n if (objects) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Use PARAMETERS instead of OBJECTS\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.conf.occurences && sta instanceof Statements.Replace) {\r\n const concat = staNode.concatTokens().toUpperCase();\r\n if (concat.includes(\" OCCURENCES \")) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Use \\\"OCCURRENCES\\\"\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (configVersion >= version_1.Version.v756 && this.conf.regex) {\r\n if (sta instanceof Statements.Find || sta instanceof Statements.Replace) {\r\n if ((_c = staNode.findFirstExpression(Expressions.FindType)) === null || _c === void 0 ? void 0 : _c.concatTokens().includes(\"REGEX\")) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"REGEX obsolete, use PCRE\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n else {\r\n const classNameExpression = staNode.findAllExpressions(Expressions.ClassName);\r\n const methodNameExpression = staNode.findAllExpressions(Expressions.MethodName);\r\n if (classNameExpression.length !== 0 && methodNameExpression.length !== 0) {\r\n const className = classNameExpression[0].concatTokens();\r\n const methodName = methodNameExpression[0].concatTokens();\r\n if (className === \"cl_abap_regex\") {\r\n if (methodName === \"create_posix\") {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"create_posix obsolete, use create_pcre\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n else if (className === \"cl_abap_matcher\") {\r\n if (methodName.includes(\"posix\")) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"posix methods obsolete, use pcre methods\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n getFix(file, statement, statementNode) {\r\n if (statement instanceof Statements.Refresh) {\r\n if (statementNode.getChildren().length === 6) {\r\n return undefined;\r\n }\r\n return edit_helper_1.EditHelper.replaceToken(file, statementNode.getFirstToken(), \"CLEAR\");\r\n }\r\n else if (statement instanceof Statements.Compute) {\r\n const children = statementNode.getChildren();\r\n if (children.length === 5) {\r\n const tokenForDeletion = statementNode.getFirstToken();\r\n let endPosition = tokenForDeletion.getEnd();\r\n endPosition = new position_1.Position(endPosition.getRow(), endPosition.getCol() + 1);\r\n return edit_helper_1.EditHelper.deleteRange(file, tokenForDeletion.getStart(), endPosition);\r\n }\r\n else {\r\n const targetString = children[2].concatTokens();\r\n const sourceString = children[4].concatTokens();\r\n const replacement = targetString + \" = EXACT #( \" + sourceString + \" ).\";\r\n return edit_helper_1.EditHelper.replaceRange(file, statementNode.getStart(), statementNode.getEnd(), replacement);\r\n }\r\n }\r\n else if (statement instanceof Statements.Add ||\r\n statement instanceof Statements.Subtract) {\r\n const children = statementNode.getChildren();\r\n const sourceString = children[1].concatTokens();\r\n const targetString = children[3].concatTokens();\r\n let replacement = \"\";\r\n if (statement instanceof Statements.Add) {\r\n replacement = targetString + \" = \" + targetString + \" + \" + sourceString + \".\";\r\n }\r\n else if (statement instanceof Statements.Subtract) {\r\n replacement = targetString + \" = \" + targetString + \" - \" + sourceString + \".\";\r\n }\r\n return edit_helper_1.EditHelper.replaceRange(file, statementNode.getStart(), statementNode.getEnd(), replacement);\r\n }\r\n else if (statement instanceof Statements.Multiply ||\r\n statement instanceof Statements.Divide) {\r\n const children = statementNode.getChildren();\r\n const targetString = children[1].concatTokens();\r\n const sourceString = children[3].concatTokens();\r\n let replacement = \"\";\r\n if (statement instanceof Statements.Multiply) {\r\n replacement = targetString + \" = \" + targetString + \" * \" + sourceString + \".\";\r\n }\r\n else if (statement instanceof Statements.Divide) {\r\n replacement = targetString + \" = \" + targetString + \" / \" + sourceString + \".\";\r\n }\r\n return edit_helper_1.EditHelper.replaceRange(file, statementNode.getStart(), statementNode.getEnd(), replacement);\r\n }\r\n else if (statement instanceof Statements.Move) {\r\n if (statementNode.getColon() !== undefined) {\r\n return undefined;\r\n }\r\n const children = statementNode.getChildren();\r\n const sourceString = children[1].concatTokens();\r\n const targetString = children[3].concatTokens();\r\n let operator = children[2].concatTokens();\r\n if (operator === \"TO\") {\r\n operator = \" = \";\r\n }\r\n else {\r\n operator = \" ?= \";\r\n }\r\n const replacement = targetString + operator + sourceString + \".\";\r\n return edit_helper_1.EditHelper.replaceRange(file, statementNode.getStart(), statementNode.getEnd(), replacement);\r\n }\r\n else if (statement instanceof Statements.ClassDefinitionLoad ||\r\n statement instanceof Statements.InterfaceLoad) {\r\n let token = undefined;\r\n if (statement instanceof Statements.ClassDefinitionLoad) {\r\n token = statementNode.getChildren()[3].getFirstToken();\r\n }\r\n else {\r\n token = statementNode.getChildren()[2].getFirstToken();\r\n }\r\n let startPosition = token.getStart();\r\n startPosition = new position_1.Position(startPosition.getRow(), startPosition.getCol() - 1);\r\n return edit_helper_1.EditHelper.deleteRange(file, startPosition, token.getEnd());\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.ObsoleteStatement = ObsoleteStatement;\r\n//# sourceMappingURL=obsolete_statement.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/obsolete_statement.js?");
|
|
12207
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ObsoleteStatement = exports.ObsoleteStatementConf = void 0;\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nclass ObsoleteStatementConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Check for REFRESH statement */\r\n this.refresh = true;\r\n /** Check for COMPUTE statement */\r\n this.compute = true;\r\n /** Check for ADD statement */\r\n this.add = true;\r\n /** Check for SUBTRACT statement */\r\n this.subtract = true;\r\n /** Check for MULTIPLY statement */\r\n this.multiply = true;\r\n /** Check for DIVIDE statement */\r\n this.divide = true;\r\n /** Check for MOVE statement */\r\n this.move = true;\r\n /** Checks for usages of IS REQUESTED */\r\n this.requested = true;\r\n /** Checks for usages of OCCURS */\r\n this.occurs = true;\r\n /** Checks for SET EXTENDED CHECK */\r\n this.setExtended = true;\r\n /** Checks for WITH HEADER LINE */\r\n this.withHeaderLine = true;\r\n /** Checks for FIELD-SYMBOLS ... STRUCTURE */\r\n this.fieldSymbolStructure = true;\r\n /** Checks for TYPE-POOLS */\r\n this.typePools = true;\r\n /** Checks for addition LOAD */\r\n this.load = true;\r\n /** Checks for PARAMETER */\r\n this.parameter = true;\r\n /** Checks for RANGES */\r\n this.ranges = true;\r\n /** Checks for COMMUNICATION */\r\n this.communication = true;\r\n /** Checks for PACK */\r\n this.pack = true;\r\n /** Checks for SELECT without INTO */\r\n this.selectWithoutInto = true;\r\n /** FREE MEMORY, without ID */\r\n this.freeMemory = true;\r\n /** Checks for EXIT FROM SQL */\r\n this.exitFromSQL = true;\r\n /** Checks for SORT itab BY <fs> */\r\n this.sortByFS = true;\r\n /** Checks for CALL TRANSFORMATION OBJECTS */\r\n this.callTransformation = true;\r\n /** Check for POSIX REGEX usage */\r\n this.regex = true;\r\n /** Check for OCCURENCES vs OCCURRENCES usage */\r\n this.occurences = true;\r\n }\r\n}\r\nexports.ObsoleteStatementConf = ObsoleteStatementConf;\r\nclass ObsoleteStatement extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ObsoleteStatementConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"obsolete_statement\",\r\n title: \"Obsolete statements\",\r\n shortDescription: `Checks for usages of certain obsolete statements`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix],\r\n extendedInformation: `\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-functional-to-procedural-language-constructs\r\n\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-obsolete-language-elements\r\n\r\nSET EXTENDED CHECK: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapset_extended_check.htm\r\n\r\nIS REQUESTED: https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abenlogexp_requested.htm\r\n\r\nWITH HEADER LINE: https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abapdata_header_line.htm\r\n\r\nFIELD-SYMBOLS STRUCTURE: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapfield-symbols_obsolete_typing.htm\r\n\r\nTYPE-POOLS: from 702, https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abennews-71-program_load.htm\r\n\r\nLOAD addition: from 702, https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abennews-71-program_load.htm\r\n\r\nCOMMUICATION: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapcommunication.htm\r\n\r\nOCCURS: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapdata_occurs.htm\r\n\r\nPARAMETER: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abapparameter.htm\r\n\r\nRANGES: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abapranges.htm\r\n\r\nPACK: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abappack.htm\r\n\r\nMOVE: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapmove_obs.htm\r\n\r\nSELECT without INTO: https://help.sap.com/doc/abapdocu_731_index_htm/7.31/en-US/abapselect_obsolete.htm\r\nSELECT COUNT(*) is considered okay\r\n\r\nFREE MEMORY: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abapfree_mem_id_obsolete.htm\r\n\r\nSORT BY FS: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abapsort_itab_obsolete.htm\r\n\r\nCALL TRANSFORMATION OBJECTS: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abapcall_transformation_objects.htm\r\n\r\nPOSIX REGEX: https://help.sap.com/doc/abapdocu_755_index_htm/7.55/en-US/index.htm\r\n\r\nOCCURENCES: check for OCCURENCES vs OCCURRENCES`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n var _a, _b, _c;\r\n const issues = [];\r\n const statements = file.getStatements();\r\n let prev = undefined;\r\n const configVersion = this.reg.getConfig().getVersion();\r\n for (const staNode of statements) {\r\n const sta = staNode.get();\r\n if ((sta instanceof Statements.Refresh && this.conf.refresh)\r\n || (sta instanceof Statements.Compute && this.conf.compute)\r\n || (sta instanceof Statements.Add && this.conf.add)\r\n || (sta instanceof Statements.Subtract && this.conf.subtract)\r\n || (sta instanceof Statements.ClassDefinitionLoad && this.conf.load && configVersion >= version_1.Version.v702)\r\n || (sta instanceof Statements.InterfaceLoad && this.conf.load && configVersion >= version_1.Version.v702)\r\n || (sta instanceof Statements.Multiply && this.conf.multiply)\r\n || (sta instanceof Statements.Divide && this.conf.divide)\r\n || (sta instanceof Statements.Move && this.conf.move\r\n && staNode.getTokens()[0].getStr().toUpperCase() === \"MOVE\"\r\n && staNode.getTokens()[1].getStr() !== \"-\"\r\n && staNode.getTokens()[1].getStr().toUpperCase() !== \"EXACT\")) {\r\n if (prev === undefined || staNode.getStart().getCol() !== prev.getCol() || staNode.getStart().getRow() !== prev.getRow()) {\r\n const message = \"Statement \\\"\" + staNode.getFirstToken().getStr() + \"\\\" is obsolete\";\r\n const fix = this.getFix(file, sta, staNode);\r\n const issue = issue_1.Issue.atStatement(file, staNode, message, this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n prev = staNode.getStart();\r\n }\r\n if (this.conf.setExtended && sta instanceof Statements.SetExtendedCheck) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"SET EXTENDED CHECK is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n if (this.conf.communication && sta instanceof Statements.Communication) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"COMMUNICATION is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n if (this.conf.pack && sta instanceof Statements.Pack) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"PACK is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n if (this.conf.parameter && sta instanceof Statements.Parameter) {\r\n const token = staNode.getFirstToken();\r\n if (token.getStr().toUpperCase() === \"PARAMETER\") {\r\n const fix = edit_helper_1.EditHelper.replaceToken(file, token, \"PARAMETERS\");\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Use PARAMETERS instead of PARAMETER\", this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.conf.ranges && sta instanceof Statements.Ranges) {\r\n const children = staNode.getChildren();\r\n let fix = undefined;\r\n if (children.length === 5) {\r\n const simpleNameString = children[1].concatTokens();\r\n const fieldSubString = children[3].concatTokens();\r\n const replacement = \"TYPES \" + simpleNameString + \" LIKE RANGE OF \" + fieldSubString + \".\";\r\n fix = edit_helper_1.EditHelper.replaceRange(file, staNode.getStart(), staNode.getEnd(), replacement);\r\n }\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Use LIKE RANGE OF instead of RANGES\", this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n if (this.conf.selectWithoutInto\r\n && (sta instanceof Statements.Select || sta instanceof Statements.SelectLoop)\r\n && staNode.findFirstExpression(Expressions.SQLIntoStructure) === undefined\r\n && staNode.findFirstExpression(Expressions.SQLIntoTable) === undefined) {\r\n const concat = (_a = staNode.findFirstExpression(Expressions.SQLFieldList)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();\r\n if (concat !== \"COUNT(*)\" && concat !== \"COUNT( * )\") {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"SELECT without INTO\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.conf.requested && sta instanceof Statements.If) {\r\n for (const compare of staNode.findAllExpressions(Expressions.Compare)) {\r\n const token = compare.findDirectTokenByText(\"REQUESTED\");\r\n if (token) {\r\n const fix = edit_helper_1.EditHelper.replaceToken(file, token, \"SUPPLIED\");\r\n const issue = issue_1.Issue.atToken(file, token, \"IS REQUESTED is obsolete\", this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n if (this.conf.occurs) {\r\n if ((sta instanceof Statements.Describe)\r\n || (sta instanceof Statements.Ranges)\r\n || (sta instanceof Statements.DataBegin)\r\n || (sta instanceof Statements.TypeBegin)) {\r\n const token = staNode.findDirectTokenByText(\"OCCURS\");\r\n if (token) {\r\n const issue = issue_1.Issue.atToken(file, token, \"OCCURS is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n for (const dataDef of staNode.findAllExpressions(Expressions.DataDefinition)) {\r\n const token = (_b = dataDef.findDirectExpression(Expressions.TypeTable)) === null || _b === void 0 ? void 0 : _b.findDirectTokenByText(\"OCCURS\");\r\n if (token) {\r\n const issue = issue_1.Issue.atToken(file, token, \"OCCURS is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n if (this.conf.withHeaderLine === true && sta instanceof Statements.Data) {\r\n if (staNode.concatTokens().toUpperCase().includes(\"WITH HEADER LINE\")) {\r\n const token = staNode.getFirstToken();\r\n if (token) {\r\n const issue = issue_1.Issue.atToken(file, token, \"WITH HEADER LINE is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n if (this.conf.fieldSymbolStructure && sta instanceof Statements.FieldSymbol) {\r\n const token = staNode.findDirectTokenByText(\"STRUCTURE\");\r\n if (token) {\r\n const issue = issue_1.Issue.atToken(file, token, \"FIELD-SYMBOLS ... STRUCTURE is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.conf.typePools && sta instanceof Statements.TypePools && configVersion >= version_1.Version.v702) {\r\n const fix = edit_helper_1.EditHelper.deleteStatement(file, staNode);\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Statement \\\"TYPE-POOLS\\\" is obsolete\", this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n if (this.conf.freeMemory && sta instanceof Statements.FreeMemory) {\r\n const concat = staNode.concatTokens().toUpperCase();\r\n if (concat === \"FREE MEMORY.\") {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Statement \\\"FREE MEMORY\\\" without ID is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.conf.exitFromSQL && sta instanceof Statements.Exit) {\r\n const concat = staNode.concatTokens().toUpperCase();\r\n if (concat === \"EXIT FROM SQL.\") {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Statement \\\"EXIT FROM SQL\\\" is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.conf.sortByFS && sta instanceof Statements.Sort) {\r\n const afterBy = staNode.findExpressionAfterToken(\"BY\");\r\n if (afterBy instanceof nodes_1.ExpressionNode && afterBy.get() instanceof expressions_1.SourceFieldSymbol) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Statement \\\"SORT itab BY <fs>\\\" is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.conf.callTransformation && sta instanceof Statements.CallTransformation) {\r\n const objects = staNode.findExpressionAfterToken(\"OBJECTS\");\r\n if (objects) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Use PARAMETERS instead of OBJECTS\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.conf.occurences && sta instanceof Statements.Replace) {\r\n const concat = staNode.concatTokens().toUpperCase();\r\n if (concat.includes(\" OCCURENCES \")) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Use \\\"OCCURRENCES\\\"\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (configVersion >= version_1.Version.v756 && this.conf.regex) {\r\n if (sta instanceof Statements.Find || sta instanceof Statements.Replace) {\r\n if ((_c = staNode.findFirstExpression(Expressions.FindType)) === null || _c === void 0 ? void 0 : _c.concatTokens().includes(\"REGEX\")) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"REGEX obsolete, use PCRE\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n else {\r\n const classNameExpression = staNode.findAllExpressions(Expressions.ClassName);\r\n const methodNameExpression = staNode.findAllExpressions(Expressions.MethodName);\r\n if (classNameExpression.length !== 0 && methodNameExpression.length !== 0) {\r\n const className = classNameExpression[0].concatTokens();\r\n const methodName = methodNameExpression[0].concatTokens();\r\n if (className === \"cl_abap_regex\") {\r\n if (methodName === \"create_posix\") {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"create_posix obsolete, use create_pcre\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n else if (className === \"cl_abap_matcher\") {\r\n if (methodName.includes(\"posix\")) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"posix methods obsolete, use pcre methods\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n getFix(file, statement, statementNode) {\r\n if (statement instanceof Statements.Refresh) {\r\n if (statementNode.getChildren().length === 6) {\r\n return undefined;\r\n }\r\n return edit_helper_1.EditHelper.replaceToken(file, statementNode.getFirstToken(), \"CLEAR\");\r\n }\r\n else if (statement instanceof Statements.Compute) {\r\n const children = statementNode.getChildren();\r\n if (children.length === 5) {\r\n const tokenForDeletion = statementNode.getFirstToken();\r\n let endPosition = tokenForDeletion.getEnd();\r\n endPosition = new position_1.Position(endPosition.getRow(), endPosition.getCol() + 1);\r\n return edit_helper_1.EditHelper.deleteRange(file, tokenForDeletion.getStart(), endPosition);\r\n }\r\n else {\r\n const targetString = children[2].concatTokens();\r\n const sourceString = children[4].concatTokens();\r\n const replacement = targetString + \" = EXACT #( \" + sourceString + \" ).\";\r\n return edit_helper_1.EditHelper.replaceRange(file, statementNode.getStart(), statementNode.getEnd(), replacement);\r\n }\r\n }\r\n else if (statement instanceof Statements.Add ||\r\n statement instanceof Statements.Subtract) {\r\n const children = statementNode.getChildren();\r\n const sourceString = children[1].concatTokens();\r\n const targetString = children[3].concatTokens();\r\n let replacement = \"\";\r\n if (statement instanceof Statements.Add) {\r\n replacement = targetString + \" = \" + targetString + \" + \" + sourceString + \".\";\r\n }\r\n else if (statement instanceof Statements.Subtract) {\r\n replacement = targetString + \" = \" + targetString + \" - \" + sourceString + \".\";\r\n }\r\n return edit_helper_1.EditHelper.replaceRange(file, statementNode.getStart(), statementNode.getEnd(), replacement);\r\n }\r\n else if (statement instanceof Statements.Multiply ||\r\n statement instanceof Statements.Divide) {\r\n const children = statementNode.getChildren();\r\n const targetString = children[1].concatTokens();\r\n const sourceString = children[3].concatTokens();\r\n let replacement = \"\";\r\n if (statement instanceof Statements.Multiply) {\r\n replacement = targetString + \" = \" + targetString + \" * \" + sourceString + \".\";\r\n }\r\n else if (statement instanceof Statements.Divide) {\r\n replacement = targetString + \" = \" + targetString + \" / \" + sourceString + \".\";\r\n }\r\n return edit_helper_1.EditHelper.replaceRange(file, statementNode.getStart(), statementNode.getEnd(), replacement);\r\n }\r\n else if (statement instanceof Statements.Move) {\r\n if (statementNode.getColon() !== undefined) {\r\n return undefined;\r\n }\r\n const children = statementNode.getChildren();\r\n const sourceString = children[1].concatTokens();\r\n const targetString = children[3].concatTokens();\r\n let operator = children[2].concatTokens();\r\n if (operator === \"TO\") {\r\n operator = \" = \";\r\n }\r\n else {\r\n operator = \" ?= \";\r\n }\r\n const replacement = targetString + operator + sourceString + \".\";\r\n return edit_helper_1.EditHelper.replaceRange(file, statementNode.getStart(), statementNode.getEnd(), replacement);\r\n }\r\n else if (statement instanceof Statements.ClassDefinitionLoad ||\r\n statement instanceof Statements.InterfaceLoad) {\r\n let token = undefined;\r\n if (statement instanceof Statements.ClassDefinitionLoad) {\r\n token = statementNode.getChildren()[3].getFirstToken();\r\n }\r\n else {\r\n token = statementNode.getChildren()[2].getFirstToken();\r\n }\r\n let startPosition = token.getStart();\r\n startPosition = new position_1.Position(startPosition.getRow(), startPosition.getCol() - 1);\r\n return edit_helper_1.EditHelper.deleteRange(file, startPosition, token.getEnd());\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.ObsoleteStatement = ObsoleteStatement;\r\n//# sourceMappingURL=obsolete_statement.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/obsolete_statement.js?");
|
|
12208
12208
|
|
|
12209
12209
|
/***/ }),
|
|
12210
12210
|
|
|
@@ -12215,7 +12215,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12215
12215
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12216
12216
|
|
|
12217
12217
|
"use strict";
|
|
12218
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.OmitParameterName = exports.OmitParameterNameConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nconst method_definition_1 = __webpack_require__(/*! ../abap/types/method_definition */ \"./node_modules/@abaplint/core/build/src/abap/types/method_definition.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass OmitParameterNameConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.OmitParameterNameConf = OmitParameterNameConf;\r\nclass OmitParameterName {\r\n constructor() {\r\n this.conf = new OmitParameterNameConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"omit_parameter_name\",\r\n title: \"Omit parameter name\",\r\n shortDescription: `Omit the parameter name in single parameter calls`,\r\n extendedInformation: `\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#omit-the-parameter-name-in-single-parameter-calls\n\nEXPORTING must already be omitted for this rule to take effect, https://rules.abaplint.org/exporting/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix],\r\n badExample: `method( param = 2 ).`,\r\n goodExample: `method( 2 ).`,\r\n };\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n run(obj) {\r\n var _a, _b;\r\n const issues = [];\r\n if (!(obj instanceof _abap_object_1.ABAPObject) || obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n const spaghetti = new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti;\r\n for (const file of obj.getABAPFiles()) {\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n continue;\r\n }\r\n for (const c of stru.findAllExpressions(Expressions.MethodCall)) {\r\n if (c.findFirstExpression(Expressions.MethodParameters)) {\r\n continue;\r\n }\r\n // hmm, this will break for nested method calls?\r\n const parameters = c.findAllExpressions(Expressions.ParameterS);\r\n if (parameters.length > 1 || parameters.length === 0) {\r\n continue;\r\n }\r\n const name = c.findDirectExpression(Expressions.MethodName);\r\n if (name === undefined) {\r\n continue;\r\n }\r\n const param = c.findDirectExpression(Expressions.MethodCallParam);\r\n if (param === undefined) {\r\n continue;\r\n }\r\n const ref = this.findMethodReference(name.getFirstToken(), spaghetti, file.getFilename());\r\n if (ref === undefined) {\r\n continue;\r\n }\r\n const i = ref.getParameters().getDefaultImporting();\r\n if (i === undefined) {\r\n continue;\r\n }\r\n const p = (_a = parameters[0].findDirectExpression(Expressions.ParameterName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\r\n if ((p === null || p === void 0 ? void 0 : p.getStr().toUpperCase()) === i.toUpperCase()) {\r\n const message = \"Omit default parameter name \\\"\" + i + \"\\\"\";\r\n let fix = undefined;\r\n const end = (_b = parameters[0].findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStart();\r\n if (end) {\r\n fix = edit_helper_1.EditHelper.deleteRange(file, p.getStart(), end);\r\n }\r\n issues.push(issue_1.Issue.atToken(file, name.getFirstToken(), message, this.getMetadata().key, this.getConfig().severity, fix));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n ///////////////////\r\n findMethodReference(token, spaghetti, filename) {\r\n const scope = spaghetti.lookupPosition(token.getStart(), filename);\r\n if (scope === undefined) {\r\n return undefined;\r\n }\r\n for (const r of scope.getData().references) {\r\n if (r.referenceType !== _reference_1.ReferenceType.MethodReference) {\r\n continue;\r\n }\r\n else if (r.position.getStart().equals(token.getStart())\r\n && r.resolved instanceof method_definition_1.MethodDefinition) {\r\n return r.resolved;\r\n }\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.OmitParameterName = OmitParameterName;\r\n//# sourceMappingURL=omit_parameter_name.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/omit_parameter_name.js?");
|
|
12218
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.OmitParameterName = exports.OmitParameterNameConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nconst method_definition_1 = __webpack_require__(/*! ../abap/types/method_definition */ \"./node_modules/@abaplint/core/build/src/abap/types/method_definition.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass OmitParameterNameConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.OmitParameterNameConf = OmitParameterNameConf;\r\nclass OmitParameterName {\r\n constructor() {\r\n this.conf = new OmitParameterNameConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"omit_parameter_name\",\r\n title: \"Omit parameter name\",\r\n shortDescription: `Omit the parameter name in single parameter calls`,\r\n extendedInformation: `\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#omit-the-parameter-name-in-single-parameter-calls\r\n\r\nEXPORTING must already be omitted for this rule to take effect, https://rules.abaplint.org/exporting/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix],\r\n badExample: `method( param = 2 ).`,\r\n goodExample: `method( 2 ).`,\r\n };\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n run(obj) {\r\n var _a, _b;\r\n const issues = [];\r\n if (!(obj instanceof _abap_object_1.ABAPObject) || obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n const spaghetti = new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti;\r\n for (const file of obj.getABAPFiles()) {\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n continue;\r\n }\r\n for (const c of stru.findAllExpressions(Expressions.MethodCall)) {\r\n if (c.findFirstExpression(Expressions.MethodParameters)) {\r\n continue;\r\n }\r\n // hmm, this will break for nested method calls?\r\n const parameters = c.findAllExpressions(Expressions.ParameterS);\r\n if (parameters.length > 1 || parameters.length === 0) {\r\n continue;\r\n }\r\n const name = c.findDirectExpression(Expressions.MethodName);\r\n if (name === undefined) {\r\n continue;\r\n }\r\n const param = c.findDirectExpression(Expressions.MethodCallParam);\r\n if (param === undefined) {\r\n continue;\r\n }\r\n const ref = this.findMethodReference(name.getFirstToken(), spaghetti, file.getFilename());\r\n if (ref === undefined) {\r\n continue;\r\n }\r\n const i = ref.getParameters().getDefaultImporting();\r\n if (i === undefined) {\r\n continue;\r\n }\r\n const p = (_a = parameters[0].findDirectExpression(Expressions.ParameterName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\r\n if ((p === null || p === void 0 ? void 0 : p.getStr().toUpperCase()) === i.toUpperCase()) {\r\n const message = \"Omit default parameter name \\\"\" + i + \"\\\"\";\r\n let fix = undefined;\r\n const end = (_b = parameters[0].findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStart();\r\n if (end) {\r\n fix = edit_helper_1.EditHelper.deleteRange(file, p.getStart(), end);\r\n }\r\n issues.push(issue_1.Issue.atToken(file, name.getFirstToken(), message, this.getMetadata().key, this.getConfig().severity, fix));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n ///////////////////\r\n findMethodReference(token, spaghetti, filename) {\r\n const scope = spaghetti.lookupPosition(token.getStart(), filename);\r\n if (scope === undefined) {\r\n return undefined;\r\n }\r\n for (const r of scope.getData().references) {\r\n if (r.referenceType !== _reference_1.ReferenceType.MethodReference) {\r\n continue;\r\n }\r\n else if (r.position.getStart().equals(token.getStart())\r\n && r.resolved instanceof method_definition_1.MethodDefinition) {\r\n return r.resolved;\r\n }\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.OmitParameterName = OmitParameterName;\r\n//# sourceMappingURL=omit_parameter_name.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/omit_parameter_name.js?");
|
|
12219
12219
|
|
|
12220
12220
|
/***/ }),
|
|
12221
12221
|
|
|
@@ -12237,7 +12237,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12237
12237
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12238
12238
|
|
|
12239
12239
|
"use strict";
|
|
12240
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.OmitReceiving = exports.OmitReceivingConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nclass OmitReceivingConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.OmitReceivingConf = OmitReceivingConf;\r\nclass OmitReceiving extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new OmitReceivingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"omit_receiving\",\r\n title: \"Omit RECEIVING\",\r\n shortDescription: `Omit RECEIVING`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#omit-receiving`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n badExample: `\n upload_pack(\n EXPORTING\n io_client = lo_client\n iv_url = iv_url\n iv_deepen_level = iv_deepen_level\n it_hashes = lt_hashes\n RECEIVING\n rt_objects = et_objects ).`,\r\n goodExample: `\n et_objects = upload_pack(\n io_client = lo_client\n iv_url = iv_url\n iv_deepen_level = iv_deepen_level\n it_hashes = lt_hashes ).`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n var _a;\r\n const issues = [];\r\n for (const e of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllExpressions(Expressions.MethodCallParam)) || []) {\r\n const p = e.findDirectExpression(Expressions.MethodParameters);\r\n if (p === undefined) {\r\n continue;\r\n }\r\n const r = p.findDirectTokenByText(\"RECEIVING\");\r\n if (r === undefined) {\r\n continue;\r\n }\r\n const ex = p.findDirectTokenByText(\"EXCEPTIONS\");\r\n if (ex !== undefined) {\r\n continue;\r\n }\r\n issues.push(issue_1.Issue.atToken(file, r, \"Omit RECEIVING\", this.getMetadata().key, this.getConfig().severity));\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.OmitReceiving = OmitReceiving;\r\n//# sourceMappingURL=omit_receiving.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/omit_receiving.js?");
|
|
12240
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.OmitReceiving = exports.OmitReceivingConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nclass OmitReceivingConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.OmitReceivingConf = OmitReceivingConf;\r\nclass OmitReceiving extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new OmitReceivingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"omit_receiving\",\r\n title: \"Omit RECEIVING\",\r\n shortDescription: `Omit RECEIVING`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#omit-receiving`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n badExample: `\r\n upload_pack(\r\n EXPORTING\r\n io_client = lo_client\r\n iv_url = iv_url\r\n iv_deepen_level = iv_deepen_level\r\n it_hashes = lt_hashes\r\n RECEIVING\r\n rt_objects = et_objects ).`,\r\n goodExample: `\r\n et_objects = upload_pack(\r\n io_client = lo_client\r\n iv_url = iv_url\r\n iv_deepen_level = iv_deepen_level\r\n it_hashes = lt_hashes ).`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n var _a;\r\n const issues = [];\r\n for (const e of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllExpressions(Expressions.MethodCallParam)) || []) {\r\n const p = e.findDirectExpression(Expressions.MethodParameters);\r\n if (p === undefined) {\r\n continue;\r\n }\r\n const r = p.findDirectTokenByText(\"RECEIVING\");\r\n if (r === undefined) {\r\n continue;\r\n }\r\n const ex = p.findDirectTokenByText(\"EXCEPTIONS\");\r\n if (ex !== undefined) {\r\n continue;\r\n }\r\n issues.push(issue_1.Issue.atToken(file, r, \"Omit RECEIVING\", this.getMetadata().key, this.getConfig().severity));\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.OmitReceiving = OmitReceiving;\r\n//# sourceMappingURL=omit_receiving.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/omit_receiving.js?");
|
|
12241
12241
|
|
|
12242
12242
|
/***/ }),
|
|
12243
12243
|
|
|
@@ -12248,7 +12248,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12248
12248
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12249
12249
|
|
|
12250
12250
|
"use strict";
|
|
12251
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Parser702Chaining = exports.Parser702ChainingConf = void 0;\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nclass Parser702ChainingConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.Parser702ChainingConf = Parser702ChainingConf;\r\nclass Parser702Chaining extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new Parser702ChainingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"parser_702_chaining\",\r\n title: \"Parser Error, bad chanining on 702\",\r\n shortDescription: `ABAP on 702 does not allow for method chaining with IMPORTING/EXPORTING/CHANGING keywords,\nthis rule finds these and reports errors.\nOnly active on target version 702 and below.`,\r\n tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n if (this.reg.getConfig().getVersion() !== version_1.Version.v702\r\n && this.reg.getConfig().getVersion() !== version_1.Version.v700) {\r\n return [];\r\n }\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return [];\r\n }\r\n for (const chain of stru.findAllExpressions(Expressions.MethodCallChain)) {\r\n const calls = chain.findDirectExpressions(Expressions.MethodCall);\r\n if (calls.length < 2) {\r\n continue;\r\n }\r\n for (const call of calls) {\r\n const callParam = call.findDirectExpression(Expressions.MethodCallParam);\r\n if (callParam === undefined) {\r\n continue;\r\n }\r\n const param = callParam.findDirectExpression(Expressions.MethodParameters);\r\n if (param === undefined) {\r\n continue;\r\n }\r\n if (param.findDirectTokenByText(\"IMPORTING\")\r\n || param.findDirectTokenByText(\"CHANGING\")\r\n || param.findDirectTokenByText(\"EXCEPTIONS\")) {\r\n const message = \"This kind of method chaining not possible in 702\";\r\n const issue = issue_1.Issue.atPosition(file, param.getFirstToken().getStart(), message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.Parser702Chaining = Parser702Chaining;\r\n//# sourceMappingURL=parser_702_chaining.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/parser_702_chaining.js?");
|
|
12251
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Parser702Chaining = exports.Parser702ChainingConf = void 0;\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nclass Parser702ChainingConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.Parser702ChainingConf = Parser702ChainingConf;\r\nclass Parser702Chaining extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new Parser702ChainingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"parser_702_chaining\",\r\n title: \"Parser Error, bad chanining on 702\",\r\n shortDescription: `ABAP on 702 does not allow for method chaining with IMPORTING/EXPORTING/CHANGING keywords,\r\nthis rule finds these and reports errors.\r\nOnly active on target version 702 and below.`,\r\n tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n if (this.reg.getConfig().getVersion() !== version_1.Version.v702\r\n && this.reg.getConfig().getVersion() !== version_1.Version.v700) {\r\n return [];\r\n }\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return [];\r\n }\r\n for (const chain of stru.findAllExpressions(Expressions.MethodCallChain)) {\r\n const calls = chain.findDirectExpressions(Expressions.MethodCall);\r\n if (calls.length < 2) {\r\n continue;\r\n }\r\n for (const call of calls) {\r\n const callParam = call.findDirectExpression(Expressions.MethodCallParam);\r\n if (callParam === undefined) {\r\n continue;\r\n }\r\n const param = callParam.findDirectExpression(Expressions.MethodParameters);\r\n if (param === undefined) {\r\n continue;\r\n }\r\n if (param.findDirectTokenByText(\"IMPORTING\")\r\n || param.findDirectTokenByText(\"CHANGING\")\r\n || param.findDirectTokenByText(\"EXCEPTIONS\")) {\r\n const message = \"This kind of method chaining not possible in 702\";\r\n const issue = issue_1.Issue.atPosition(file, param.getFirstToken().getStart(), message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.Parser702Chaining = Parser702Chaining;\r\n//# sourceMappingURL=parser_702_chaining.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/parser_702_chaining.js?");
|
|
12252
12252
|
|
|
12253
12253
|
/***/ }),
|
|
12254
12254
|
|
|
@@ -12259,7 +12259,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12259
12259
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12260
12260
|
|
|
12261
12261
|
"use strict";
|
|
12262
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ParserError = exports.ParserErrorConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst statement_parser_1 = __webpack_require__(/*! ../abap/2_statements/statement_parser */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statement_parser.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nclass ParserErrorConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.ParserErrorConf = ParserErrorConf;\r\nclass ParserError extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ParserErrorConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"parser_error\",\r\n title: \"Parser error\",\r\n shortDescription: `Checks for syntax not recognized by abaplint.\n\nSee recognized syntax at https://syntax.abaplint.org`,\r\n tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n for (const statement of file.getStatements()) {\r\n if (!(statement.get() instanceof _statement_1.Unknown)) {\r\n continue;\r\n }\r\n if (statement.getTokens().length > statement_parser_1.STATEMENT_MAX_TOKENS) {\r\n const message = \"Statement too long, refactor statement\";\r\n const issue = issue_1.Issue.atToken(file, statement.getTokens()[0], message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n else {\r\n const tok = statement.getFirstToken();\r\n const message = \"Statement does not exist in ABAP\" + this.reg.getConfig().getVersion() + \"(or a parser error), \\\"\" + tok.getStr() + \"\\\"\";\r\n const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.reg.getConfig().getVersion() === version_1.Version.v700) {\r\n for (const statement of file.getStatements()) {\r\n if (statement.getPragmas().length > 0) {\r\n const message = \"Pragmas not allowed in v700\";\r\n const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.ParserError = ParserError;\r\n//# sourceMappingURL=parser_error.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/parser_error.js?");
|
|
12262
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ParserError = exports.ParserErrorConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst statement_parser_1 = __webpack_require__(/*! ../abap/2_statements/statement_parser */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statement_parser.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nclass ParserErrorConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.ParserErrorConf = ParserErrorConf;\r\nclass ParserError extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ParserErrorConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"parser_error\",\r\n title: \"Parser error\",\r\n shortDescription: `Checks for syntax not recognized by abaplint.\r\n\r\nSee recognized syntax at https://syntax.abaplint.org`,\r\n tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n for (const statement of file.getStatements()) {\r\n if (!(statement.get() instanceof _statement_1.Unknown)) {\r\n continue;\r\n }\r\n if (statement.getTokens().length > statement_parser_1.STATEMENT_MAX_TOKENS) {\r\n const message = \"Statement too long, refactor statement\";\r\n const issue = issue_1.Issue.atToken(file, statement.getTokens()[0], message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n else {\r\n const tok = statement.getFirstToken();\r\n const message = \"Statement does not exist in ABAP\" + this.reg.getConfig().getVersion() + \"(or a parser error), \\\"\" + tok.getStr() + \"\\\"\";\r\n const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.reg.getConfig().getVersion() === version_1.Version.v700) {\r\n for (const statement of file.getStatements()) {\r\n if (statement.getPragmas().length > 0) {\r\n const message = \"Pragmas not allowed in v700\";\r\n const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.ParserError = ParserError;\r\n//# sourceMappingURL=parser_error.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/parser_error.js?");
|
|
12263
12263
|
|
|
12264
12264
|
/***/ }),
|
|
12265
12265
|
|
|
@@ -12270,7 +12270,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12270
12270
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12271
12271
|
|
|
12272
12272
|
"use strict";
|
|
12273
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ParserMissingSpace = exports.ParserMissingSpaceConf = void 0;\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\n// todo: this rule needs refactoring\r\nclass ParserMissingSpaceConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.ParserMissingSpaceConf = ParserMissingSpaceConf;\r\nclass ParserMissingSpace extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ParserMissingSpaceConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"parser_missing_space\",\r\n title: \"Parser Error, missing space\",\r\n shortDescription: `In special cases the ABAP language allows for not having spaces before or after string literals.\nThis rule makes sure the spaces are consistently required across the language.`,\r\n tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.Whitespace, _irule_1.RuleTag.SingleFile],\r\n badExample: `IF ( foo = 'bar').`,\r\n goodExample: `IF ( foo = 'bar' ).`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n let start = new position_1.Position(0, 0);\r\n for (const statement of file.getStatements()) {\r\n const missing = this.missingSpace(statement);\r\n if (missing) {\r\n const message = \"Missing space between string or character literal and parentheses\";\r\n start = missing;\r\n const issue = issue_1.Issue.atPosition(file, start, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n missingSpace(statement) {\r\n const found = statement.findAllExpressionsMulti([Expressions.CondSub, Expressions.SQLCond,\r\n Expressions.ValueBody, Expressions.NewObject, Expressions.Cond,\r\n Expressions.ComponentCond, Expressions.MethodCallParam], true);\r\n let pos = undefined;\r\n for (const f of found) {\r\n const type = f.get();\r\n if (type instanceof Expressions.CondSub) {\r\n pos = this.checkCondSub(f);\r\n }\r\n else if (type instanceof Expressions.ValueBody) {\r\n pos = this.checkValueBody(f);\r\n }\r\n else if (type instanceof Expressions.Cond) {\r\n pos = this.checkCond(f);\r\n }\r\n else if (type instanceof Expressions.ComponentCond) {\r\n pos = this.checkComponentCond(f);\r\n }\r\n else if (type instanceof Expressions.SQLCond) {\r\n pos = this.checkSQLCond(f);\r\n }\r\n else if (type instanceof Expressions.NewObject) {\r\n pos = this.checkNewObject(f);\r\n }\r\n else if (type instanceof Expressions.MethodCallParam) {\r\n pos = this.checkMethodCallParam(f);\r\n }\r\n if (pos) {\r\n return pos;\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkSQLCond(cond) {\r\n const children = cond.getChildren();\r\n for (let i = 0; i < children.length; i++) {\r\n if (children[i].get() instanceof Expressions.SQLCond) {\r\n const current = children[i];\r\n const prev = children[i - 1].getLastToken();\r\n const next = children[i + 1].getFirstToken();\r\n if (prev.getStr() === \"(\"\r\n && prev.getRow() === current.getFirstToken().getRow()\r\n && prev.getCol() + 1 === current.getFirstToken().getStart().getCol()) {\r\n return current.getFirstToken().getStart();\r\n }\r\n if (next.getStr() === \")\"\r\n && next.getRow() === current.getLastToken().getRow()\r\n && next.getCol() === current.getLastToken().getEnd().getCol()) {\r\n return current.getLastToken().getEnd();\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkNewObject(cond) {\r\n const children = cond.getChildren();\r\n {\r\n const first = children[children.length - 2].getLastToken();\r\n const second = children[children.length - 1].getFirstToken();\r\n if (first.getRow() === second.getRow()\r\n && first.getEnd().getCol() === second.getStart().getCol()) {\r\n return second.getStart();\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkCondSub(cond) {\r\n const children = cond.getChildren();\r\n for (let i = 0; i < children.length; i++) {\r\n if (children[i].get() instanceof Expressions.Cond) {\r\n const current = children[i];\r\n const prev = children[i - 1].getLastToken();\r\n const next = children[i + 1].getFirstToken();\r\n if (prev.getStr() === \"(\"\r\n && prev.getRow() === current.getFirstToken().getRow()\r\n && prev.getCol() + 1 === current.getFirstToken().getStart().getCol()) {\r\n return current.getFirstToken().getStart();\r\n }\r\n if (next.getStr() === \")\"\r\n && next.getRow() === current.getLastToken().getRow()\r\n && next.getCol() === current.getLastToken().getEnd().getCol()) {\r\n return current.getLastToken().getEnd();\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkComponentCond(cond) {\r\n const children = cond.getChildren();\r\n for (let i = 0; i < children.length; i++) {\r\n if (children[i].get() instanceof Expressions.ComponentCond) {\r\n const current = children[i];\r\n const prev = children[i - 1].getLastToken();\r\n const next = children[i + 1].getFirstToken();\r\n if (prev.getStr() === \"(\"\r\n && prev.getRow() === current.getFirstToken().getRow()\r\n && prev.getCol() + 1 === current.getFirstToken().getStart().getCol()) {\r\n return current.getFirstToken().getStart();\r\n }\r\n if (next.getStr() === \")\"\r\n && next.getRow() === current.getLastToken().getRow()\r\n && next.getCol() === current.getLastToken().getEnd().getCol()) {\r\n return current.getLastToken().getEnd();\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkValueBody(vb) {\r\n var _a, _b;\r\n const children = vb.getChildren();\r\n for (let i = 0; i < children.length; i++) {\r\n const current = children[i];\r\n if (current instanceof nodes_1.TokenNode) {\r\n const prev = (_a = children[i - 1]) === null || _a === void 0 ? void 0 : _a.getLastToken();\r\n const next = (_b = children[i + 1]) === null || _b === void 0 ? void 0 : _b.getFirstToken();\r\n if (current.getFirstToken().getStr() === \"(\"\r\n && next\r\n && next.getRow() === current.getLastToken().getRow()\r\n && next.getCol() === current.getLastToken().getEnd().getCol()) {\r\n return current.getFirstToken().getStart();\r\n }\r\n if (current.getFirstToken().getStr() === \")\"\r\n && prev\r\n && prev.getRow() === current.getFirstToken().getRow()\r\n && prev.getEnd().getCol() === current.getFirstToken().getStart().getCol()) {\r\n return current.getLastToken().getEnd();\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkCond(cond) {\r\n const children = cond.getAllTokens();\r\n for (let i = 0; i < children.length - 1; i++) {\r\n const current = children[i];\r\n const next = children[i + 1];\r\n if (next.getStr().startsWith(\"'\")\r\n && next.getRow() === current.getRow()\r\n && next.getCol() === current.getEnd().getCol()) {\r\n return current.getEnd();\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkMethodCallParam(call) {\r\n const children = call.getChildren();\r\n {\r\n const first = children[0].getFirstToken();\r\n const second = children[1].getFirstToken();\r\n if (first.getRow() === second.getRow()\r\n && first.getCol() + 1 === second.getStart().getCol()) {\r\n return second.getStart();\r\n }\r\n }\r\n {\r\n const first = children[children.length - 2].getLastToken();\r\n const second = children[children.length - 1].getFirstToken();\r\n if (first.getRow() === second.getRow()\r\n && first.getEnd().getCol() === second.getStart().getCol()) {\r\n return second.getStart();\r\n }\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.ParserMissingSpace = ParserMissingSpace;\r\n//# sourceMappingURL=parser_missing_space.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/parser_missing_space.js?");
|
|
12273
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ParserMissingSpace = exports.ParserMissingSpaceConf = void 0;\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\n// todo: this rule needs refactoring\r\nclass ParserMissingSpaceConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.ParserMissingSpaceConf = ParserMissingSpaceConf;\r\nclass ParserMissingSpace extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ParserMissingSpaceConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"parser_missing_space\",\r\n title: \"Parser Error, missing space\",\r\n shortDescription: `In special cases the ABAP language allows for not having spaces before or after string literals.\r\nThis rule makes sure the spaces are consistently required across the language.`,\r\n tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.Whitespace, _irule_1.RuleTag.SingleFile],\r\n badExample: `IF ( foo = 'bar').`,\r\n goodExample: `IF ( foo = 'bar' ).`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n let start = new position_1.Position(0, 0);\r\n for (const statement of file.getStatements()) {\r\n const missing = this.missingSpace(statement);\r\n if (missing) {\r\n const message = \"Missing space between string or character literal and parentheses\";\r\n start = missing;\r\n const issue = issue_1.Issue.atPosition(file, start, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n missingSpace(statement) {\r\n const found = statement.findAllExpressionsMulti([Expressions.CondSub, Expressions.SQLCond,\r\n Expressions.ValueBody, Expressions.NewObject, Expressions.Cond,\r\n Expressions.ComponentCond, Expressions.MethodCallParam], true);\r\n let pos = undefined;\r\n for (const f of found) {\r\n const type = f.get();\r\n if (type instanceof Expressions.CondSub) {\r\n pos = this.checkCondSub(f);\r\n }\r\n else if (type instanceof Expressions.ValueBody) {\r\n pos = this.checkValueBody(f);\r\n }\r\n else if (type instanceof Expressions.Cond) {\r\n pos = this.checkCond(f);\r\n }\r\n else if (type instanceof Expressions.ComponentCond) {\r\n pos = this.checkComponentCond(f);\r\n }\r\n else if (type instanceof Expressions.SQLCond) {\r\n pos = this.checkSQLCond(f);\r\n }\r\n else if (type instanceof Expressions.NewObject) {\r\n pos = this.checkNewObject(f);\r\n }\r\n else if (type instanceof Expressions.MethodCallParam) {\r\n pos = this.checkMethodCallParam(f);\r\n }\r\n if (pos) {\r\n return pos;\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkSQLCond(cond) {\r\n const children = cond.getChildren();\r\n for (let i = 0; i < children.length; i++) {\r\n if (children[i].get() instanceof Expressions.SQLCond) {\r\n const current = children[i];\r\n const prev = children[i - 1].getLastToken();\r\n const next = children[i + 1].getFirstToken();\r\n if (prev.getStr() === \"(\"\r\n && prev.getRow() === current.getFirstToken().getRow()\r\n && prev.getCol() + 1 === current.getFirstToken().getStart().getCol()) {\r\n return current.getFirstToken().getStart();\r\n }\r\n if (next.getStr() === \")\"\r\n && next.getRow() === current.getLastToken().getRow()\r\n && next.getCol() === current.getLastToken().getEnd().getCol()) {\r\n return current.getLastToken().getEnd();\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkNewObject(cond) {\r\n const children = cond.getChildren();\r\n {\r\n const first = children[children.length - 2].getLastToken();\r\n const second = children[children.length - 1].getFirstToken();\r\n if (first.getRow() === second.getRow()\r\n && first.getEnd().getCol() === second.getStart().getCol()) {\r\n return second.getStart();\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkCondSub(cond) {\r\n const children = cond.getChildren();\r\n for (let i = 0; i < children.length; i++) {\r\n if (children[i].get() instanceof Expressions.Cond) {\r\n const current = children[i];\r\n const prev = children[i - 1].getLastToken();\r\n const next = children[i + 1].getFirstToken();\r\n if (prev.getStr() === \"(\"\r\n && prev.getRow() === current.getFirstToken().getRow()\r\n && prev.getCol() + 1 === current.getFirstToken().getStart().getCol()) {\r\n return current.getFirstToken().getStart();\r\n }\r\n if (next.getStr() === \")\"\r\n && next.getRow() === current.getLastToken().getRow()\r\n && next.getCol() === current.getLastToken().getEnd().getCol()) {\r\n return current.getLastToken().getEnd();\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkComponentCond(cond) {\r\n const children = cond.getChildren();\r\n for (let i = 0; i < children.length; i++) {\r\n if (children[i].get() instanceof Expressions.ComponentCond) {\r\n const current = children[i];\r\n const prev = children[i - 1].getLastToken();\r\n const next = children[i + 1].getFirstToken();\r\n if (prev.getStr() === \"(\"\r\n && prev.getRow() === current.getFirstToken().getRow()\r\n && prev.getCol() + 1 === current.getFirstToken().getStart().getCol()) {\r\n return current.getFirstToken().getStart();\r\n }\r\n if (next.getStr() === \")\"\r\n && next.getRow() === current.getLastToken().getRow()\r\n && next.getCol() === current.getLastToken().getEnd().getCol()) {\r\n return current.getLastToken().getEnd();\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkValueBody(vb) {\r\n var _a, _b;\r\n const children = vb.getChildren();\r\n for (let i = 0; i < children.length; i++) {\r\n const current = children[i];\r\n if (current instanceof nodes_1.TokenNode) {\r\n const prev = (_a = children[i - 1]) === null || _a === void 0 ? void 0 : _a.getLastToken();\r\n const next = (_b = children[i + 1]) === null || _b === void 0 ? void 0 : _b.getFirstToken();\r\n if (current.getFirstToken().getStr() === \"(\"\r\n && next\r\n && next.getRow() === current.getLastToken().getRow()\r\n && next.getCol() === current.getLastToken().getEnd().getCol()) {\r\n return current.getFirstToken().getStart();\r\n }\r\n if (current.getFirstToken().getStr() === \")\"\r\n && prev\r\n && prev.getRow() === current.getFirstToken().getRow()\r\n && prev.getEnd().getCol() === current.getFirstToken().getStart().getCol()) {\r\n return current.getLastToken().getEnd();\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkCond(cond) {\r\n const children = cond.getAllTokens();\r\n for (let i = 0; i < children.length - 1; i++) {\r\n const current = children[i];\r\n const next = children[i + 1];\r\n if (next.getStr().startsWith(\"'\")\r\n && next.getRow() === current.getRow()\r\n && next.getCol() === current.getEnd().getCol()) {\r\n return current.getEnd();\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkMethodCallParam(call) {\r\n const children = call.getChildren();\r\n {\r\n const first = children[0].getFirstToken();\r\n const second = children[1].getFirstToken();\r\n if (first.getRow() === second.getRow()\r\n && first.getCol() + 1 === second.getStart().getCol()) {\r\n return second.getStart();\r\n }\r\n }\r\n {\r\n const first = children[children.length - 2].getLastToken();\r\n const second = children[children.length - 1].getFirstToken();\r\n if (first.getRow() === second.getRow()\r\n && first.getEnd().getCol() === second.getStart().getCol()) {\r\n return second.getStart();\r\n }\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.ParserMissingSpace = ParserMissingSpace;\r\n//# sourceMappingURL=parser_missing_space.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/parser_missing_space.js?");
|
|
12274
12274
|
|
|
12275
12275
|
/***/ }),
|
|
12276
12276
|
|
|
@@ -12303,7 +12303,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12303
12303
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12304
12304
|
|
|
12305
12305
|
"use strict";
|
|
12306
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.PreferInline = exports.PreferInlineConf = void 0;\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass PreferInlineConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.PreferInlineConf = PreferInlineConf;\r\nclass PreferInline {\r\n constructor() {\r\n this.conf = new PreferInlineConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"prefer_inline\",\r\n title: \"Prefer Inline Declarations\",\r\n shortDescription: `Prefer inline to up-front declarations.`,\r\n extendedInformation: `EXPERIMENTAL\n\nActivates if language version is v740sp02 or above.\n\nVariables must be local(METHOD or FORM).\n\nNo generic or void typed variables.\n\nFirst position used must be a full/pure write.\n\nMove statment is not a cast(?=)\n\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-inline-to-up-front-declarations`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Upport, _irule_1.RuleTag.Experimental, _irule_1.RuleTag.Quickfix],\r\n badExample: `DATA foo TYPE i.\nfoo = 2.\nDATA percentage TYPE decfloat34.\npercentage = ( comment_number / abs_statement_number ) * 100.`,\r\n goodExample: `DATA(foo) = 2.\nDATA(percentage) = CONV decfloat34( comment_number / abs_statement_number ) * 100.`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n run(obj) {\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n if (this.reg.getConfig().getVersion() < version_1.Version.v740sp02 && this.reg.getConfig().getVersion() !== version_1.Version.Cloud) {\r\n return [];\r\n }\r\n else if (!(obj instanceof _abap_object_1.ABAPObject)) {\r\n return [];\r\n }\r\n const scopes = this.findScopeCandidates(new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti.getTop());\r\n const ret = [];\r\n for (const s of scopes) {\r\n ret.push(...this.analyzeScope(s, obj));\r\n }\r\n return ret;\r\n }\r\n ///////////////////////////\r\n analyzeScope(node, obj) {\r\n var _a, _b;\r\n const ret = [];\r\n const vars = node.getData().vars;\r\n for (const name in vars) {\r\n const identifier = vars[name];\r\n if (this.isLocalDefinition(node, identifier) === false\r\n || identifier.getMeta().includes(\"inline\" /* InlineDefinition */)\r\n || identifier.getMeta().includes(\"form_parameter\" /* FormParameter */)) {\r\n continue;\r\n }\r\n else if (identifier.getType().isGeneric() === true) {\r\n continue;\r\n }\r\n else if (identifier.getType().containsVoid() === true) {\r\n continue;\r\n }\r\n const write = this.firstUseIsWrite(node, identifier);\r\n if (write === undefined) {\r\n continue;\r\n }\r\n // check that it is a pure write, eg not sub component assignment\r\n const next = this.findNextToken(write, obj);\r\n if (next === undefined) {\r\n continue;\r\n }\r\n else if ((next === null || next === void 0 ? void 0 : next.getStart().equals(write.position.getEnd())) && next.getStr() !== \".\" && next.getStr() !== \",\") {\r\n continue;\r\n }\r\n const file = obj.getABAPFileByName(identifier.getFilename());\r\n const writeStatement = edit_helper_1.EditHelper.findStatement(next, file);\r\n const statementType = writeStatement === null || writeStatement === void 0 ? void 0 : writeStatement.get();\r\n if (statementType === undefined) {\r\n continue;\r\n }\r\n // for now only allow some specific target statements, todo refactor\r\n if (!(statementType instanceof Statements.Move\r\n || statementType instanceof Statements.Catch\r\n || statementType instanceof Statements.ReadTable\r\n || statementType instanceof Statements.Loop)\r\n || ((_a = writeStatement === null || writeStatement === void 0 ? void 0 : writeStatement.concatTokens()) === null || _a === void 0 ? void 0 : _a.includes(\"?=\"))\r\n || ((_b = writeStatement === null || writeStatement === void 0 ? void 0 : writeStatement.concatTokens()) === null || _b === void 0 ? void 0 : _b.includes(\" #(\"))) {\r\n continue;\r\n }\r\n const statement = edit_helper_1.EditHelper.findStatement(identifier.getToken(), file);\r\n const concat = statement === null || statement === void 0 ? void 0 : statement.concatTokens().toUpperCase();\r\n if (concat === null || concat === void 0 ? void 0 : concat.includes(\"BEGIN OF\")) {\r\n continue;\r\n }\r\n let fix = undefined;\r\n if (file && statement) {\r\n const fix1 = edit_helper_1.EditHelper.deleteStatement(file, statement);\r\n const name = identifier.getName();\r\n const replace = name.startsWith(\"<\") ? \"FIELD-SYMBOL(\" + name + \")\" : \"DATA(\" + name + \")\";\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(file, write.position.getStart(), write.position.getEnd(), replace);\r\n fix = edit_helper_1.EditHelper.merge(fix1, fix2);\r\n }\r\n const message = this.getMetadata().title + \", \" + name;\r\n ret.push(issue_1.Issue.atIdentifier(identifier, message, this.getMetadata().key, this.conf.severity, fix));\r\n }\r\n return ret;\r\n }\r\n ////////////////////////\r\n findNextToken(ref, obj) {\r\n const file = obj.getABAPFileByName(ref.resolved.getFilename());\r\n if (file === undefined) {\r\n return undefined;\r\n }\r\n for (const t of file.getTokens()) {\r\n if (t.getStart().isAfter(ref.position.getEnd())) {\r\n return t;\r\n }\r\n }\r\n return undefined;\r\n }\r\n firstUseIsWrite(node, identifier) {\r\n // assumption: variables are local, so only the current scope must be searched\r\n var _a, _b, _c;\r\n for (const r of node.getData().references) {\r\n if (r.referenceType === _reference_1.ReferenceType.TypeReference\r\n && ((_a = r.resolved) === null || _a === void 0 ? void 0 : _a.getStart().equals(identifier.getStart())) === true) {\r\n return undefined;\r\n }\r\n }\r\n let firstRead = undefined;\r\n for (const r of node.getData().references) {\r\n if (r.referenceType !== _reference_1.ReferenceType.DataReadReference\r\n || ((_b = r.resolved) === null || _b === void 0 ? void 0 : _b.getStart().equals(identifier.getStart())) === false) {\r\n continue;\r\n }\r\n if (r.resolved) {\r\n firstRead = { position: r.position, resolved: r.resolved };\r\n break;\r\n }\r\n }\r\n let firstWrite = undefined;\r\n for (const w of node.getData().references) {\r\n if (w.referenceType !== _reference_1.ReferenceType.DataWriteReference\r\n || ((_c = w.resolved) === null || _c === void 0 ? void 0 : _c.getStart().equals(identifier.getStart())) === false) {\r\n continue;\r\n }\r\n if (w.resolved) {\r\n firstWrite = { position: w.position, resolved: w.resolved };\r\n break;\r\n }\r\n }\r\n if (firstRead === undefined) {\r\n return firstWrite;\r\n }\r\n else if (firstWrite === undefined) {\r\n return undefined;\r\n }\r\n else if (firstWrite.position.getStart().getRow() === firstRead.position.getStart().getRow()) {\r\n // if the same statement both reads and write the same variable\r\n // note that currently just the line number is compared, this is not correct, it should check if its the same statement\r\n return undefined;\r\n }\r\n else if (firstWrite.position.getStart().isBefore(firstRead.position.getStart())) {\r\n return firstWrite;\r\n }\r\n return undefined;\r\n }\r\n isLocalDefinition(node, identifier) {\r\n const { start, end } = node.calcCoverage();\r\n if (identifier.getStart().isAfter(start) && identifier.getStart().isBefore(end)) {\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n findScopeCandidates(node) {\r\n if (node.getIdentifier().stype === _scope_type_1.ScopeType.Form\r\n || node.getIdentifier().stype === _scope_type_1.ScopeType.Method) {\r\n return [node];\r\n }\r\n let ret = [];\r\n for (const c of node.getChildren()) {\r\n ret = ret.concat(this.findScopeCandidates(c));\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.PreferInline = PreferInline;\r\n//# sourceMappingURL=prefer_inline.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/prefer_inline.js?");
|
|
12306
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.PreferInline = exports.PreferInlineConf = void 0;\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass PreferInlineConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.PreferInlineConf = PreferInlineConf;\r\nclass PreferInline {\r\n constructor() {\r\n this.conf = new PreferInlineConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"prefer_inline\",\r\n title: \"Prefer Inline Declarations\",\r\n shortDescription: `Prefer inline to up-front declarations.`,\r\n extendedInformation: `EXPERIMENTAL\r\n\r\nActivates if language version is v740sp02 or above.\r\n\r\nVariables must be local(METHOD or FORM).\r\n\r\nNo generic or void typed variables.\r\n\r\nFirst position used must be a full/pure write.\r\n\r\nMove statment is not a cast(?=)\r\n\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-inline-to-up-front-declarations`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Upport, _irule_1.RuleTag.Experimental, _irule_1.RuleTag.Quickfix],\r\n badExample: `DATA foo TYPE i.\r\nfoo = 2.\r\nDATA percentage TYPE decfloat34.\r\npercentage = ( comment_number / abs_statement_number ) * 100.`,\r\n goodExample: `DATA(foo) = 2.\r\nDATA(percentage) = CONV decfloat34( comment_number / abs_statement_number ) * 100.`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n run(obj) {\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n if (this.reg.getConfig().getVersion() < version_1.Version.v740sp02 && this.reg.getConfig().getVersion() !== version_1.Version.Cloud) {\r\n return [];\r\n }\r\n else if (!(obj instanceof _abap_object_1.ABAPObject)) {\r\n return [];\r\n }\r\n const scopes = this.findScopeCandidates(new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti.getTop());\r\n const ret = [];\r\n for (const s of scopes) {\r\n ret.push(...this.analyzeScope(s, obj));\r\n }\r\n return ret;\r\n }\r\n ///////////////////////////\r\n analyzeScope(node, obj) {\r\n var _a, _b;\r\n const ret = [];\r\n const vars = node.getData().vars;\r\n for (const name in vars) {\r\n const identifier = vars[name];\r\n if (this.isLocalDefinition(node, identifier) === false\r\n || identifier.getMeta().includes(\"inline\" /* InlineDefinition */)\r\n || identifier.getMeta().includes(\"form_parameter\" /* FormParameter */)) {\r\n continue;\r\n }\r\n else if (identifier.getType().isGeneric() === true) {\r\n continue;\r\n }\r\n else if (identifier.getType().containsVoid() === true) {\r\n continue;\r\n }\r\n const write = this.firstUseIsWrite(node, identifier);\r\n if (write === undefined) {\r\n continue;\r\n }\r\n // check that it is a pure write, eg not sub component assignment\r\n const next = this.findNextToken(write, obj);\r\n if (next === undefined) {\r\n continue;\r\n }\r\n else if ((next === null || next === void 0 ? void 0 : next.getStart().equals(write.position.getEnd())) && next.getStr() !== \".\" && next.getStr() !== \",\") {\r\n continue;\r\n }\r\n const file = obj.getABAPFileByName(identifier.getFilename());\r\n const writeStatement = edit_helper_1.EditHelper.findStatement(next, file);\r\n const statementType = writeStatement === null || writeStatement === void 0 ? void 0 : writeStatement.get();\r\n if (statementType === undefined) {\r\n continue;\r\n }\r\n // for now only allow some specific target statements, todo refactor\r\n if (!(statementType instanceof Statements.Move\r\n || statementType instanceof Statements.Catch\r\n || statementType instanceof Statements.ReadTable\r\n || statementType instanceof Statements.Loop)\r\n || ((_a = writeStatement === null || writeStatement === void 0 ? void 0 : writeStatement.concatTokens()) === null || _a === void 0 ? void 0 : _a.includes(\"?=\"))\r\n || ((_b = writeStatement === null || writeStatement === void 0 ? void 0 : writeStatement.concatTokens()) === null || _b === void 0 ? void 0 : _b.includes(\" #(\"))) {\r\n continue;\r\n }\r\n const statement = edit_helper_1.EditHelper.findStatement(identifier.getToken(), file);\r\n const concat = statement === null || statement === void 0 ? void 0 : statement.concatTokens().toUpperCase();\r\n if (concat === null || concat === void 0 ? void 0 : concat.includes(\"BEGIN OF\")) {\r\n continue;\r\n }\r\n let fix = undefined;\r\n if (file && statement) {\r\n const fix1 = edit_helper_1.EditHelper.deleteStatement(file, statement);\r\n const name = identifier.getName();\r\n const replace = name.startsWith(\"<\") ? \"FIELD-SYMBOL(\" + name + \")\" : \"DATA(\" + name + \")\";\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(file, write.position.getStart(), write.position.getEnd(), replace);\r\n fix = edit_helper_1.EditHelper.merge(fix1, fix2);\r\n }\r\n const message = this.getMetadata().title + \", \" + name;\r\n ret.push(issue_1.Issue.atIdentifier(identifier, message, this.getMetadata().key, this.conf.severity, fix));\r\n }\r\n return ret;\r\n }\r\n ////////////////////////\r\n findNextToken(ref, obj) {\r\n const file = obj.getABAPFileByName(ref.resolved.getFilename());\r\n if (file === undefined) {\r\n return undefined;\r\n }\r\n for (const t of file.getTokens()) {\r\n if (t.getStart().isAfter(ref.position.getEnd())) {\r\n return t;\r\n }\r\n }\r\n return undefined;\r\n }\r\n firstUseIsWrite(node, identifier) {\r\n // assumption: variables are local, so only the current scope must be searched\r\n var _a, _b, _c;\r\n for (const r of node.getData().references) {\r\n if (r.referenceType === _reference_1.ReferenceType.TypeReference\r\n && ((_a = r.resolved) === null || _a === void 0 ? void 0 : _a.getStart().equals(identifier.getStart())) === true) {\r\n return undefined;\r\n }\r\n }\r\n let firstRead = undefined;\r\n for (const r of node.getData().references) {\r\n if (r.referenceType !== _reference_1.ReferenceType.DataReadReference\r\n || ((_b = r.resolved) === null || _b === void 0 ? void 0 : _b.getStart().equals(identifier.getStart())) === false) {\r\n continue;\r\n }\r\n if (r.resolved) {\r\n firstRead = { position: r.position, resolved: r.resolved };\r\n break;\r\n }\r\n }\r\n let firstWrite = undefined;\r\n for (const w of node.getData().references) {\r\n if (w.referenceType !== _reference_1.ReferenceType.DataWriteReference\r\n || ((_c = w.resolved) === null || _c === void 0 ? void 0 : _c.getStart().equals(identifier.getStart())) === false) {\r\n continue;\r\n }\r\n if (w.resolved) {\r\n firstWrite = { position: w.position, resolved: w.resolved };\r\n break;\r\n }\r\n }\r\n if (firstRead === undefined) {\r\n return firstWrite;\r\n }\r\n else if (firstWrite === undefined) {\r\n return undefined;\r\n }\r\n else if (firstWrite.position.getStart().getRow() === firstRead.position.getStart().getRow()) {\r\n // if the same statement both reads and write the same variable\r\n // note that currently just the line number is compared, this is not correct, it should check if its the same statement\r\n return undefined;\r\n }\r\n else if (firstWrite.position.getStart().isBefore(firstRead.position.getStart())) {\r\n return firstWrite;\r\n }\r\n return undefined;\r\n }\r\n isLocalDefinition(node, identifier) {\r\n const { start, end } = node.calcCoverage();\r\n if (identifier.getStart().isAfter(start) && identifier.getStart().isBefore(end)) {\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n findScopeCandidates(node) {\r\n if (node.getIdentifier().stype === _scope_type_1.ScopeType.Form\r\n || node.getIdentifier().stype === _scope_type_1.ScopeType.Method) {\r\n return [node];\r\n }\r\n let ret = [];\r\n for (const c of node.getChildren()) {\r\n ret = ret.concat(this.findScopeCandidates(c));\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.PreferInline = PreferInline;\r\n//# sourceMappingURL=prefer_inline.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/prefer_inline.js?");
|
|
12307
12307
|
|
|
12308
12308
|
/***/ }),
|
|
12309
12309
|
|
|
@@ -12314,7 +12314,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12314
12314
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12315
12315
|
|
|
12316
12316
|
"use strict";
|
|
12317
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.PreferIsNot = exports.PreferIsNotConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nclass PreferIsNotConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.PreferIsNotConf = PreferIsNotConf;\r\nclass PreferIsNot extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new PreferIsNotConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"prefer_is_not\",\r\n title: \"Prefer IS NOT to NOT IS\",\r\n shortDescription: `Prefer IS NOT to NOT IS`,\r\n extendedInformation: `\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-is-not-to-not-is\n\n\"if not is_valid( ).\" examples are skipped`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n goodExample: `IF variable IS NOT INITIAL.\nIF variable NP 'TODO*'.\nIF variable <> 42.`,\r\n badExample: `IF NOT variable IS INITIAL.\nIF NOT variable CP 'TODO*'.\nIF NOT variable = 42.`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n for (const s of file.getStatements()) {\r\n for (const c of s.findAllExpressions(Expressions.Compare)) {\r\n if (c.concatTokens().toUpperCase().startsWith(\"NOT \") === false) {\r\n continue;\r\n }\r\n else if (c.getChildren().length === 2 && c.getChildren()[1].get() instanceof Expressions.MethodCallChain) {\r\n continue;\r\n }\r\n const message = \"Prefer IS NOT to NOT IS\";\r\n const fix = this.getFix(file, c);\r\n issues.push(issue_1.Issue.atToken(file, c.getFirstToken(), message, this.getMetadata().key, this.conf.severity, fix));\r\n }\r\n }\r\n return issues;\r\n }\r\n getFix(file, c) {\r\n let insertFix;\r\n if (c.getChildren()[2].getFirstToken().getStr().toUpperCase() === \"IS\") {\r\n const tokenPositionBeforeDelete = c.getChildren()[2].getLastToken().getEnd();\r\n const tokenPosition = new position_1.Position(tokenPositionBeforeDelete.getRow(), tokenPositionBeforeDelete.getCol() + 1);\r\n insertFix = edit_helper_1.EditHelper.insertAt(file, tokenPosition, \"NOT \");\r\n }\r\n else if (c.getChildren()[2].getFirstToken().getStr().toUpperCase() === \"IN\" || c.getChildren()[2].getFirstToken().getStr().toUpperCase() === \"BETWEEN\") {\r\n const tokenPositionBeforeDelete = c.getChildren()[1].getLastToken().getEnd();\r\n const tokenPosition = new position_1.Position(tokenPositionBeforeDelete.getRow(), tokenPositionBeforeDelete.getCol() + 1);\r\n insertFix = edit_helper_1.EditHelper.insertAt(file, tokenPosition, \"NOT \");\r\n }\r\n else if (c.getChildren()[2].getFirstToken().getStr() === \"=\") {\r\n insertFix = edit_helper_1.EditHelper.replaceToken(file, c.getChildren()[2].getLastToken(), \"<>\");\r\n }\r\n else if (c.getChildren()[2].getFirstToken().getStr() === \"<>\") {\r\n insertFix = edit_helper_1.EditHelper.replaceToken(file, c.getChildren()[2].getLastToken(), \"=\");\r\n }\r\n else if (c.getChildren()[2].getFirstToken().getStr() === \"<\") {\r\n insertFix = edit_helper_1.EditHelper.replaceToken(file, c.getChildren()[2].getLastToken(), \">\");\r\n }\r\n else if (c.getChildren()[2].getFirstToken().getStr() === \">\") {\r\n insertFix = edit_helper_1.EditHelper.replaceToken(file, c.getChildren()[2].getLastToken(), \"<\");\r\n }\r\n else if (c.getChildren()[2].getFirstToken().getStr() === \"<=\") {\r\n insertFix = edit_helper_1.EditHelper.replaceToken(file, c.getChildren()[2].getLastToken(), \">=\");\r\n }\r\n else if (c.getChildren()[2].getFirstToken().getStr() === \">=\") {\r\n insertFix = edit_helper_1.EditHelper.replaceToken(file, c.getChildren()[2].getLastToken(), \"<=\");\r\n }\r\n else {\r\n return;\r\n }\r\n const endCol = c.getChildren()[0].getFirstToken().getEnd().getCol() + 1;\r\n const endPosition = new position_1.Position(c.getChildren()[0].getFirstToken().getEnd().getRow(), endCol);\r\n const deleteFix = edit_helper_1.EditHelper.deleteRange(file, c.getChildren()[0].getFirstToken().getStart(), endPosition);\r\n const finalFix = edit_helper_1.EditHelper.merge(insertFix, deleteFix);\r\n return finalFix;\r\n }\r\n}\r\nexports.PreferIsNot = PreferIsNot;\r\n//# sourceMappingURL=prefer_is_not.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/prefer_is_not.js?");
|
|
12317
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.PreferIsNot = exports.PreferIsNotConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nclass PreferIsNotConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.PreferIsNotConf = PreferIsNotConf;\r\nclass PreferIsNot extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new PreferIsNotConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"prefer_is_not\",\r\n title: \"Prefer IS NOT to NOT IS\",\r\n shortDescription: `Prefer IS NOT to NOT IS`,\r\n extendedInformation: `\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-is-not-to-not-is\r\n\r\n\"if not is_valid( ).\" examples are skipped`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n goodExample: `IF variable IS NOT INITIAL.\r\nIF variable NP 'TODO*'.\r\nIF variable <> 42.`,\r\n badExample: `IF NOT variable IS INITIAL.\r\nIF NOT variable CP 'TODO*'.\r\nIF NOT variable = 42.`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n for (const s of file.getStatements()) {\r\n for (const c of s.findAllExpressions(Expressions.Compare)) {\r\n if (c.concatTokens().toUpperCase().startsWith(\"NOT \") === false) {\r\n continue;\r\n }\r\n else if (c.getChildren().length === 2 && c.getChildren()[1].get() instanceof Expressions.MethodCallChain) {\r\n continue;\r\n }\r\n const message = \"Prefer IS NOT to NOT IS\";\r\n const fix = this.getFix(file, c);\r\n issues.push(issue_1.Issue.atToken(file, c.getFirstToken(), message, this.getMetadata().key, this.conf.severity, fix));\r\n }\r\n }\r\n return issues;\r\n }\r\n getFix(file, c) {\r\n let insertFix;\r\n if (c.getChildren()[2].getFirstToken().getStr().toUpperCase() === \"IS\") {\r\n const tokenPositionBeforeDelete = c.getChildren()[2].getLastToken().getEnd();\r\n const tokenPosition = new position_1.Position(tokenPositionBeforeDelete.getRow(), tokenPositionBeforeDelete.getCol() + 1);\r\n insertFix = edit_helper_1.EditHelper.insertAt(file, tokenPosition, \"NOT \");\r\n }\r\n else if (c.getChildren()[2].getFirstToken().getStr().toUpperCase() === \"IN\" || c.getChildren()[2].getFirstToken().getStr().toUpperCase() === \"BETWEEN\") {\r\n const tokenPositionBeforeDelete = c.getChildren()[1].getLastToken().getEnd();\r\n const tokenPosition = new position_1.Position(tokenPositionBeforeDelete.getRow(), tokenPositionBeforeDelete.getCol() + 1);\r\n insertFix = edit_helper_1.EditHelper.insertAt(file, tokenPosition, \"NOT \");\r\n }\r\n else if (c.getChildren()[2].getFirstToken().getStr() === \"=\") {\r\n insertFix = edit_helper_1.EditHelper.replaceToken(file, c.getChildren()[2].getLastToken(), \"<>\");\r\n }\r\n else if (c.getChildren()[2].getFirstToken().getStr() === \"<>\") {\r\n insertFix = edit_helper_1.EditHelper.replaceToken(file, c.getChildren()[2].getLastToken(), \"=\");\r\n }\r\n else if (c.getChildren()[2].getFirstToken().getStr() === \"<\") {\r\n insertFix = edit_helper_1.EditHelper.replaceToken(file, c.getChildren()[2].getLastToken(), \">\");\r\n }\r\n else if (c.getChildren()[2].getFirstToken().getStr() === \">\") {\r\n insertFix = edit_helper_1.EditHelper.replaceToken(file, c.getChildren()[2].getLastToken(), \"<\");\r\n }\r\n else if (c.getChildren()[2].getFirstToken().getStr() === \"<=\") {\r\n insertFix = edit_helper_1.EditHelper.replaceToken(file, c.getChildren()[2].getLastToken(), \">=\");\r\n }\r\n else if (c.getChildren()[2].getFirstToken().getStr() === \">=\") {\r\n insertFix = edit_helper_1.EditHelper.replaceToken(file, c.getChildren()[2].getLastToken(), \"<=\");\r\n }\r\n else {\r\n return;\r\n }\r\n const endCol = c.getChildren()[0].getFirstToken().getEnd().getCol() + 1;\r\n const endPosition = new position_1.Position(c.getChildren()[0].getFirstToken().getEnd().getRow(), endCol);\r\n const deleteFix = edit_helper_1.EditHelper.deleteRange(file, c.getChildren()[0].getFirstToken().getStart(), endPosition);\r\n const finalFix = edit_helper_1.EditHelper.merge(insertFix, deleteFix);\r\n return finalFix;\r\n }\r\n}\r\nexports.PreferIsNot = PreferIsNot;\r\n//# sourceMappingURL=prefer_is_not.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/prefer_is_not.js?");
|
|
12318
12318
|
|
|
12319
12319
|
/***/ }),
|
|
12320
12320
|
|
|
@@ -12325,7 +12325,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12325
12325
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12326
12326
|
|
|
12327
12327
|
"use strict";
|
|
12328
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.PreferRaiseExceptionNew = exports.PreferRaiseExceptionNewConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst __1 = __webpack_require__(/*! .. */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nclass PreferRaiseExceptionNewConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.PreferRaiseExceptionNewConf = PreferRaiseExceptionNewConf;\r\nclass PreferRaiseExceptionNew extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new PreferRaiseExceptionNewConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"prefer_raise_exception_new\",\r\n title: \"Prefer RAISE EXCEPTION NEW to RAISE EXCEPTION TYPE\",\r\n shortDescription: `Prefer RAISE EXCEPTION NEW to RAISE EXCEPTION TYPE`,\r\n extendedInformation: `\n https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-raise-exception-new-to-raise-exception-type`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],\r\n goodExample: `RAISE EXCEPTION NEW cx_generation_error( previous = exception ).`,\r\n badExample: `RAISE EXCEPTION TYPE cx_generation_error\n EXPORTING\n previous = exception.`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n if (this.reg.getConfig().getVersion() < __1.Version.v752) {\r\n return [];\r\n }\r\n const issues = [];\r\n for (const statement of file.getStatements()) {\r\n if (statement.get() instanceof __1.Statements.Raise) {\r\n const concat = statement.concatTokens().toUpperCase();\r\n if (concat.includes(\" MESSAGE\")) {\r\n continue;\r\n }\r\n if (concat.startsWith(\"RAISE EXCEPTION TYPE \")) {\r\n const message = \"Prefer RAISE EXCEPTION NEW to RAISE EXCEPTION TYPE\";\r\n const fix = this.getFix(file, statement, concat.includes(\" EXPORTING\") ? true : false);\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, fix));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n getFix(file, statement, withExporting) {\r\n const children = statement.getChildren();\r\n let contentFix = undefined;\r\n if (withExporting) {\r\n const fixText = \"( \" + children[5].concatTokens() + \" ).\";\r\n contentFix = edit_helper_1.EditHelper.replaceRange(file, children[3].getLastToken().getEnd(), statement.getEnd(), fixText);\r\n }\r\n else {\r\n contentFix = edit_helper_1.EditHelper.replaceRange(file, children[3].getLastToken().getEnd(), statement.getEnd(), \"( ).\");\r\n }\r\n const replaceType = edit_helper_1.EditHelper.replaceToken(file, children[2].getFirstToken(), \"NEW\");\r\n return edit_helper_1.EditHelper.merge(contentFix, replaceType);\r\n }\r\n}\r\nexports.PreferRaiseExceptionNew = PreferRaiseExceptionNew;\r\n//# sourceMappingURL=prefer_raise_exception_new.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/prefer_raise_exception_new.js?");
|
|
12328
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.PreferRaiseExceptionNew = exports.PreferRaiseExceptionNewConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst __1 = __webpack_require__(/*! .. */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nclass PreferRaiseExceptionNewConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.PreferRaiseExceptionNewConf = PreferRaiseExceptionNewConf;\r\nclass PreferRaiseExceptionNew extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new PreferRaiseExceptionNewConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"prefer_raise_exception_new\",\r\n title: \"Prefer RAISE EXCEPTION NEW to RAISE EXCEPTION TYPE\",\r\n shortDescription: `Prefer RAISE EXCEPTION NEW to RAISE EXCEPTION TYPE`,\r\n extendedInformation: `\r\n https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-raise-exception-new-to-raise-exception-type`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],\r\n goodExample: `RAISE EXCEPTION NEW cx_generation_error( previous = exception ).`,\r\n badExample: `RAISE EXCEPTION TYPE cx_generation_error\r\n EXPORTING\r\n previous = exception.`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n if (this.reg.getConfig().getVersion() < __1.Version.v752) {\r\n return [];\r\n }\r\n const issues = [];\r\n for (const statement of file.getStatements()) {\r\n if (statement.get() instanceof __1.Statements.Raise) {\r\n const concat = statement.concatTokens().toUpperCase();\r\n if (concat.includes(\" MESSAGE\")) {\r\n continue;\r\n }\r\n if (concat.startsWith(\"RAISE EXCEPTION TYPE \")) {\r\n const message = \"Prefer RAISE EXCEPTION NEW to RAISE EXCEPTION TYPE\";\r\n const fix = this.getFix(file, statement, concat.includes(\" EXPORTING\") ? true : false);\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, fix));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n getFix(file, statement, withExporting) {\r\n const children = statement.getChildren();\r\n let contentFix = undefined;\r\n if (withExporting) {\r\n const fixText = \"( \" + children[5].concatTokens() + \" ).\";\r\n contentFix = edit_helper_1.EditHelper.replaceRange(file, children[3].getLastToken().getEnd(), statement.getEnd(), fixText);\r\n }\r\n else {\r\n contentFix = edit_helper_1.EditHelper.replaceRange(file, children[3].getLastToken().getEnd(), statement.getEnd(), \"( ).\");\r\n }\r\n const replaceType = edit_helper_1.EditHelper.replaceToken(file, children[2].getFirstToken(), \"NEW\");\r\n return edit_helper_1.EditHelper.merge(contentFix, replaceType);\r\n }\r\n}\r\nexports.PreferRaiseExceptionNew = PreferRaiseExceptionNew;\r\n//# sourceMappingURL=prefer_raise_exception_new.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/prefer_raise_exception_new.js?");
|
|
12329
12329
|
|
|
12330
12330
|
/***/ }),
|
|
12331
12331
|
|
|
@@ -12336,7 +12336,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12336
12336
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12337
12337
|
|
|
12338
12338
|
"use strict";
|
|
12339
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.PreferReturningToExporting = exports.PreferReturningToExportingConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass PreferReturningToExportingConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.PreferReturningToExportingConf = PreferReturningToExportingConf;\r\nclass PreferReturningToExporting extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new PreferReturningToExportingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"prefer_returning_to_exporting\",\r\n title: \"Prefer RETURNING to EXPORTING\",\r\n shortDescription: `Prefer RETURNING to EXPORTING. Generic types cannot be RETURNING.`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-returning-to-exporting\nhttps://docs.abapopenchecks.org/checks/44/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const ret = [];\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return [];\r\n }\r\n for (const def of stru.findAllStatements(Statements.MethodDef)) {\r\n if (def.findFirstExpression(Expressions.MethodDefChanging)) {\r\n continue;\r\n }\r\n const exporting = def.findFirstExpression(Expressions.MethodDefExporting);\r\n if (exporting === undefined) {\r\n continue;\r\n }\r\n const returning = def.findFirstExpression(Expressions.MethodDefReturning);\r\n if (returning !== undefined) {\r\n continue;\r\n }\r\n const params = exporting.findDirectExpressions(Expressions.MethodParam);\r\n if (params.length !== 1) {\r\n continue;\r\n }\r\n const concat = params[0].concatTokens().toUpperCase();\r\n if (concat.endsWith(\"TYPE ANY\")\r\n || concat.endsWith(\"TYPE ANY TABLE\")\r\n || concat.endsWith(\"TYPE C\")\r\n || concat.endsWith(\"TYPE CLIKE\")\r\n || concat.endsWith(\"TYPE CSEQUENCE\")\r\n || concat.endsWith(\"TYPE DATA\")\r\n || concat.endsWith(\"TYPE DECFLOAT\")\r\n || concat.endsWith(\"TYPE HASHED TABLE\")\r\n || concat.endsWith(\"TYPE INDEX TABLE\")\r\n || concat.endsWith(\"TYPE N\")\r\n || concat.endsWith(\"TYPE NUMERIC\")\r\n || concat.endsWith(\"TYPE OBJECT\")\r\n || concat.endsWith(\"TYPE P\")\r\n || concat.endsWith(\"TYPE SIMPLE\")\r\n || concat.endsWith(\"TYPE SORTED TABLE\")\r\n || concat.endsWith(\"TYPE STANDARD TABLE\")\r\n || concat.endsWith(\"TYPE TABLE\")\r\n || concat.endsWith(\"TYPE X\")\r\n || concat.endsWith(\"TYPE XSEQUENCE\")) {\r\n continue;\r\n }\r\n const token = params[0].getFirstToken();\r\n const issue = issue_1.Issue.atToken(file, token, \"Prefer RETURNING to EXPORTING\", this.getMetadata().key, this.conf.severity);\r\n ret.push(issue);\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.PreferReturningToExporting = PreferReturningToExporting;\r\n//# sourceMappingURL=prefer_returning_to_exporting.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/prefer_returning_to_exporting.js?");
|
|
12339
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.PreferReturningToExporting = exports.PreferReturningToExportingConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass PreferReturningToExportingConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.PreferReturningToExportingConf = PreferReturningToExportingConf;\r\nclass PreferReturningToExporting extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new PreferReturningToExportingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"prefer_returning_to_exporting\",\r\n title: \"Prefer RETURNING to EXPORTING\",\r\n shortDescription: `Prefer RETURNING to EXPORTING. Generic types cannot be RETURNING.`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-returning-to-exporting\r\nhttps://docs.abapopenchecks.org/checks/44/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const ret = [];\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return [];\r\n }\r\n for (const def of stru.findAllStatements(Statements.MethodDef)) {\r\n if (def.findFirstExpression(Expressions.MethodDefChanging)) {\r\n continue;\r\n }\r\n const exporting = def.findFirstExpression(Expressions.MethodDefExporting);\r\n if (exporting === undefined) {\r\n continue;\r\n }\r\n const returning = def.findFirstExpression(Expressions.MethodDefReturning);\r\n if (returning !== undefined) {\r\n continue;\r\n }\r\n const params = exporting.findDirectExpressions(Expressions.MethodParam);\r\n if (params.length !== 1) {\r\n continue;\r\n }\r\n const concat = params[0].concatTokens().toUpperCase();\r\n if (concat.endsWith(\"TYPE ANY\")\r\n || concat.endsWith(\"TYPE ANY TABLE\")\r\n || concat.endsWith(\"TYPE C\")\r\n || concat.endsWith(\"TYPE CLIKE\")\r\n || concat.endsWith(\"TYPE CSEQUENCE\")\r\n || concat.endsWith(\"TYPE DATA\")\r\n || concat.endsWith(\"TYPE DECFLOAT\")\r\n || concat.endsWith(\"TYPE HASHED TABLE\")\r\n || concat.endsWith(\"TYPE INDEX TABLE\")\r\n || concat.endsWith(\"TYPE N\")\r\n || concat.endsWith(\"TYPE NUMERIC\")\r\n || concat.endsWith(\"TYPE OBJECT\")\r\n || concat.endsWith(\"TYPE P\")\r\n || concat.endsWith(\"TYPE SIMPLE\")\r\n || concat.endsWith(\"TYPE SORTED TABLE\")\r\n || concat.endsWith(\"TYPE STANDARD TABLE\")\r\n || concat.endsWith(\"TYPE TABLE\")\r\n || concat.endsWith(\"TYPE X\")\r\n || concat.endsWith(\"TYPE XSEQUENCE\")) {\r\n continue;\r\n }\r\n const token = params[0].getFirstToken();\r\n const issue = issue_1.Issue.atToken(file, token, \"Prefer RETURNING to EXPORTING\", this.getMetadata().key, this.conf.severity);\r\n ret.push(issue);\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.PreferReturningToExporting = PreferReturningToExporting;\r\n//# sourceMappingURL=prefer_returning_to_exporting.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/prefer_returning_to_exporting.js?");
|
|
12340
12340
|
|
|
12341
12341
|
/***/ }),
|
|
12342
12342
|
|
|
@@ -12347,7 +12347,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12347
12347
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12348
12348
|
|
|
12349
12349
|
"use strict";
|
|
12350
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.PreferXsdbool = exports.PreferXsdboolConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass PreferXsdboolConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.PreferXsdboolConf = PreferXsdboolConf;\r\nclass PreferXsdbool extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new PreferXsdboolConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"prefer_xsdbool\",\r\n title: \"Prefer xsdbool over boolc\",\r\n shortDescription: `Prefer xsdbool over boolc`,\r\n extendedInformation: `Activates if language version is v740sp08 or above.\n\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-xsdbool-to-set-boolean-variables`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Upport, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n badExample: `DATA(sdf) = boolc( 1 = 2 ).`,\r\n goodExample: `DATA(sdf) = xsdbool( 1 = 2 ).`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n var _a;\r\n const issues = [];\r\n if (this.reg.getConfig().getVersion() < version_1.Version.v740sp08 && this.reg.getConfig().getVersion() !== version_1.Version.Cloud) {\r\n return [];\r\n }\r\n for (const s of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllExpressions(Expressions.Source)) || []) {\r\n if (s.concatTokens().toUpperCase().startsWith(\"BOOLC( \") === false) {\r\n continue;\r\n }\r\n const token = s.getFirstToken();\r\n const message = \"Prefer xsdbool over boolc\";\r\n const fix = edit_helper_1.EditHelper.replaceToken(file, token, \"xsdbool\");\r\n issues.push(issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity, fix));\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.PreferXsdbool = PreferXsdbool;\r\n//# sourceMappingURL=prefer_xsdbool.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/prefer_xsdbool.js?");
|
|
12350
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.PreferXsdbool = exports.PreferXsdboolConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass PreferXsdboolConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.PreferXsdboolConf = PreferXsdboolConf;\r\nclass PreferXsdbool extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new PreferXsdboolConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"prefer_xsdbool\",\r\n title: \"Prefer xsdbool over boolc\",\r\n shortDescription: `Prefer xsdbool over boolc`,\r\n extendedInformation: `Activates if language version is v740sp08 or above.\r\n\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-xsdbool-to-set-boolean-variables`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Upport, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n badExample: `DATA(sdf) = boolc( 1 = 2 ).`,\r\n goodExample: `DATA(sdf) = xsdbool( 1 = 2 ).`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n var _a;\r\n const issues = [];\r\n if (this.reg.getConfig().getVersion() < version_1.Version.v740sp08 && this.reg.getConfig().getVersion() !== version_1.Version.Cloud) {\r\n return [];\r\n }\r\n for (const s of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllExpressions(Expressions.Source)) || []) {\r\n if (s.concatTokens().toUpperCase().startsWith(\"BOOLC( \") === false) {\r\n continue;\r\n }\r\n const token = s.getFirstToken();\r\n const message = \"Prefer xsdbool over boolc\";\r\n const fix = edit_helper_1.EditHelper.replaceToken(file, token, \"xsdbool\");\r\n issues.push(issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity, fix));\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.PreferXsdbool = PreferXsdbool;\r\n//# sourceMappingURL=prefer_xsdbool.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/prefer_xsdbool.js?");
|
|
12351
12351
|
|
|
12352
12352
|
/***/ }),
|
|
12353
12353
|
|
|
@@ -12402,7 +12402,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12402
12402
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12403
12403
|
|
|
12404
12404
|
"use strict";
|
|
12405
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.RemoveDescriptions = exports.RemoveDescriptionsConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst fast_xml_parser_1 = __webpack_require__(/*! fast-xml-parser */ \"./node_modules/fast-xml-parser/src/fxp.js\");\r\nconst Objects = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nconst xml_utils_1 = __webpack_require__(/*! ../xml_utils */ \"./node_modules/@abaplint/core/build/src/xml_utils.js\");\r\nclass RemoveDescriptionsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Ignore global exception classes */\r\n this.ignoreExceptions = false;\r\n /** Ignore global workflow classes */\r\n this.ignoreWorkflow = true;\r\n }\r\n}\r\nexports.RemoveDescriptionsConf = RemoveDescriptionsConf;\r\nclass RemoveDescriptions {\r\n constructor() {\r\n this.conf = new RemoveDescriptionsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"remove_descriptions\",\r\n title: \"Remove descriptions\",\r\n shortDescription: `Ensures you have no descriptions in metadata of methods, parameters, etc.\n\nClass descriptions are required, see rule description_empty.\n\nConsider using ABAP Doc for documentation.`,\r\n tags: [],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(obj) {\r\n // plan is omitting knowledge about descriptions in abaplint, so this rule must parse the XML\r\n const ddic = new ddic_1.DDIC(this.reg);\r\n if (obj instanceof Objects.Class) {\r\n let def;\r\n try {\r\n def = obj.getClassDefinition();\r\n }\r\n catch (_a) {\r\n return [];\r\n }\r\n if (def === undefined) {\r\n return [];\r\n }\r\n else if (this.conf.ignoreExceptions && ddic.isException(def, obj)) {\r\n return [];\r\n }\r\n else if (this.conf.ignoreWorkflow === true && def.interfaces.find(e => e.name.toUpperCase() === \"IF_WORKFLOW\")) {\r\n return [];\r\n }\r\n return this.checkClass(obj);\r\n }\r\n else if (obj instanceof Objects.Interface) {\r\n return this.checkInterface(obj);\r\n }\r\n return [];\r\n }\r\n //////////////\r\n checkInterface(obj) {\r\n const xml = obj.getXML();\r\n if (xml === undefined) {\r\n return [];\r\n }\r\n const file = obj.getXMLFile();\r\n if (file === undefined) {\r\n return [];\r\n }\r\n return this.checkXML(xml, file);\r\n }\r\n checkClass(obj) {\r\n const xml = obj.getXML();\r\n if (xml === undefined) {\r\n return [];\r\n }\r\n const file = obj.getXMLFile();\r\n if (file === undefined) {\r\n return [];\r\n }\r\n return this.checkXML(xml, file);\r\n }\r\n checkXML(xml, file) {\r\n const parsed = new fast_xml_parser_1.XMLParser({ parseTagValue: false, ignoreAttributes: true, trimValues: false }).parse(xml);\r\n if (parsed === undefined || parsed.abapGit[\"asx:abap\"][\"asx:values\"] === undefined) {\r\n return [];\r\n }\r\n const desc = parsed.abapGit[\"asx:abap\"][\"asx:values\"].DESCRIPTIONS;\r\n if (desc === undefined) {\r\n return [];\r\n }\r\n const ret = [];\r\n for (const d of (0, xml_utils_1.xmlToArray)(desc.SEOCOMPOTX)) {\r\n const message = \"Remove description for \" + d.CMPNAME;\r\n const position = new position_1.Position(1, 1);\r\n const issue = issue_1.Issue.atPosition(file, position, message, this.getMetadata().key, this.conf.severity);\r\n ret.push(issue);\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.RemoveDescriptions = RemoveDescriptions;\r\n//# sourceMappingURL=remove_descriptions.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/remove_descriptions.js?");
|
|
12405
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.RemoveDescriptions = exports.RemoveDescriptionsConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst fast_xml_parser_1 = __webpack_require__(/*! fast-xml-parser */ \"./node_modules/fast-xml-parser/src/fxp.js\");\r\nconst Objects = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nconst xml_utils_1 = __webpack_require__(/*! ../xml_utils */ \"./node_modules/@abaplint/core/build/src/xml_utils.js\");\r\nclass RemoveDescriptionsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Ignore global exception classes */\r\n this.ignoreExceptions = false;\r\n /** Ignore global workflow classes */\r\n this.ignoreWorkflow = true;\r\n }\r\n}\r\nexports.RemoveDescriptionsConf = RemoveDescriptionsConf;\r\nclass RemoveDescriptions {\r\n constructor() {\r\n this.conf = new RemoveDescriptionsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"remove_descriptions\",\r\n title: \"Remove descriptions\",\r\n shortDescription: `Ensures you have no descriptions in metadata of methods, parameters, etc.\r\n\r\nClass descriptions are required, see rule description_empty.\r\n\r\nConsider using ABAP Doc for documentation.`,\r\n tags: [],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(obj) {\r\n // plan is omitting knowledge about descriptions in abaplint, so this rule must parse the XML\r\n const ddic = new ddic_1.DDIC(this.reg);\r\n if (obj instanceof Objects.Class) {\r\n let def;\r\n try {\r\n def = obj.getClassDefinition();\r\n }\r\n catch (_a) {\r\n return [];\r\n }\r\n if (def === undefined) {\r\n return [];\r\n }\r\n else if (this.conf.ignoreExceptions && ddic.isException(def, obj)) {\r\n return [];\r\n }\r\n else if (this.conf.ignoreWorkflow === true && def.interfaces.find(e => e.name.toUpperCase() === \"IF_WORKFLOW\")) {\r\n return [];\r\n }\r\n return this.checkClass(obj);\r\n }\r\n else if (obj instanceof Objects.Interface) {\r\n return this.checkInterface(obj);\r\n }\r\n return [];\r\n }\r\n //////////////\r\n checkInterface(obj) {\r\n const xml = obj.getXML();\r\n if (xml === undefined) {\r\n return [];\r\n }\r\n const file = obj.getXMLFile();\r\n if (file === undefined) {\r\n return [];\r\n }\r\n return this.checkXML(xml, file);\r\n }\r\n checkClass(obj) {\r\n const xml = obj.getXML();\r\n if (xml === undefined) {\r\n return [];\r\n }\r\n const file = obj.getXMLFile();\r\n if (file === undefined) {\r\n return [];\r\n }\r\n return this.checkXML(xml, file);\r\n }\r\n checkXML(xml, file) {\r\n const parsed = new fast_xml_parser_1.XMLParser({ parseTagValue: false, ignoreAttributes: true, trimValues: false }).parse(xml);\r\n if (parsed === undefined || parsed.abapGit[\"asx:abap\"][\"asx:values\"] === undefined) {\r\n return [];\r\n }\r\n const desc = parsed.abapGit[\"asx:abap\"][\"asx:values\"].DESCRIPTIONS;\r\n if (desc === undefined) {\r\n return [];\r\n }\r\n const ret = [];\r\n for (const d of (0, xml_utils_1.xmlToArray)(desc.SEOCOMPOTX)) {\r\n const message = \"Remove description for \" + d.CMPNAME;\r\n const position = new position_1.Position(1, 1);\r\n const issue = issue_1.Issue.atPosition(file, position, message, this.getMetadata().key, this.conf.severity);\r\n ret.push(issue);\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.RemoveDescriptions = RemoveDescriptions;\r\n//# sourceMappingURL=remove_descriptions.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/remove_descriptions.js?");
|
|
12406
12406
|
|
|
12407
12407
|
/***/ }),
|
|
12408
12408
|
|
|
@@ -12413,7 +12413,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12413
12413
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12414
12414
|
|
|
12415
12415
|
"use strict";
|
|
12416
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.RFCErrorHandling = exports.RFCErrorHandlingConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass RFCErrorHandlingConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.RFCErrorHandlingConf = RFCErrorHandlingConf;\r\nclass RFCErrorHandling extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new RFCErrorHandlingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"rfc_error_handling\",\r\n title: \"RFC error handling\",\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n shortDescription: `Checks that exceptions 'system_failure' and 'communication_failure' are handled in RFC calls`,\r\n extendedInformation: `https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abenrfc_exception.htm`,\r\n badExample: `\nCALL FUNCTION 'ZRFC'\n DESTINATION lv_rfc.`,\r\n goodExample: `\nCALL FUNCTION 'ZRFC'\n DESTINATION lv_rfc\n EXCEPTIONS\n system_failure = 1 MESSAGE msg\n communication_failure = 2 MESSAGE msg\n resource_failure = 3\n OTHERS = 4.`,\r\n };\r\n }\r\n getMessage() {\r\n return \"RFC error handling: At least one unhandled exception from SYSTEM_FAILURE, COMMUNICATION_FAILURE, RESOURCE_FAILURE.\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const output = [];\r\n for (const stat of file.getStatements()) {\r\n const token = stat.getFirstToken();\r\n if (!(stat.get() instanceof Statements.CallFunction)) {\r\n continue;\r\n }\r\n if (!stat.findFirstExpression(Expressions.Destination)) {\r\n continue;\r\n }\r\n const list = stat.findFirstExpression(Expressions.ParameterListExceptions);\r\n if (list === undefined) {\r\n const issue = issue_1.Issue.atToken(file, token, this.getMessage(), this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n continue;\r\n }\r\n const parameters = list.findAllExpressions(Expressions.ParameterName);\r\n const names = [];\r\n for (const par of parameters) {\r\n names.push(par.getFirstToken().getStr().toUpperCase());\r\n }\r\n if (names.indexOf(\"SYSTEM_FAILURE\") < 0\r\n || names.indexOf(\"COMMUNICATION_FAILURE\") < 0\r\n || names.indexOf(\"RESOURCE_FAILURE\") < 0) {\r\n const issue = issue_1.Issue.atToken(file, token, this.getMessage(), this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n continue;\r\n }\r\n }\r\n return output;\r\n }\r\n}\r\nexports.RFCErrorHandling = RFCErrorHandling;\r\n//# sourceMappingURL=rfc_error_handling.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/rfc_error_handling.js?");
|
|
12416
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.RFCErrorHandling = exports.RFCErrorHandlingConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass RFCErrorHandlingConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.RFCErrorHandlingConf = RFCErrorHandlingConf;\r\nclass RFCErrorHandling extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new RFCErrorHandlingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"rfc_error_handling\",\r\n title: \"RFC error handling\",\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n shortDescription: `Checks that exceptions 'system_failure' and 'communication_failure' are handled in RFC calls`,\r\n extendedInformation: `https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abenrfc_exception.htm`,\r\n badExample: `\r\nCALL FUNCTION 'ZRFC'\r\n DESTINATION lv_rfc.`,\r\n goodExample: `\r\nCALL FUNCTION 'ZRFC'\r\n DESTINATION lv_rfc\r\n EXCEPTIONS\r\n system_failure = 1 MESSAGE msg\r\n communication_failure = 2 MESSAGE msg\r\n resource_failure = 3\r\n OTHERS = 4.`,\r\n };\r\n }\r\n getMessage() {\r\n return \"RFC error handling: At least one unhandled exception from SYSTEM_FAILURE, COMMUNICATION_FAILURE, RESOURCE_FAILURE.\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const output = [];\r\n for (const stat of file.getStatements()) {\r\n const token = stat.getFirstToken();\r\n if (!(stat.get() instanceof Statements.CallFunction)) {\r\n continue;\r\n }\r\n if (!stat.findFirstExpression(Expressions.Destination)) {\r\n continue;\r\n }\r\n const list = stat.findFirstExpression(Expressions.ParameterListExceptions);\r\n if (list === undefined) {\r\n const issue = issue_1.Issue.atToken(file, token, this.getMessage(), this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n continue;\r\n }\r\n const parameters = list.findAllExpressions(Expressions.ParameterName);\r\n const names = [];\r\n for (const par of parameters) {\r\n names.push(par.getFirstToken().getStr().toUpperCase());\r\n }\r\n if (names.indexOf(\"SYSTEM_FAILURE\") < 0\r\n || names.indexOf(\"COMMUNICATION_FAILURE\") < 0\r\n || names.indexOf(\"RESOURCE_FAILURE\") < 0) {\r\n const issue = issue_1.Issue.atToken(file, token, this.getMessage(), this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n continue;\r\n }\r\n }\r\n return output;\r\n }\r\n}\r\nexports.RFCErrorHandling = RFCErrorHandling;\r\n//# sourceMappingURL=rfc_error_handling.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/rfc_error_handling.js?");
|
|
12417
12417
|
|
|
12418
12418
|
/***/ }),
|
|
12419
12419
|
|
|
@@ -12424,7 +12424,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12424
12424
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12425
12425
|
|
|
12426
12426
|
"use strict";
|
|
12427
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SelectAddOrderBy = exports.SelectAddOrderByConf = void 0;\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst basic_1 = __webpack_require__(/*! ../abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nclass SelectAddOrderByConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.SelectAddOrderByConf = SelectAddOrderByConf;\r\nclass SelectAddOrderBy {\r\n constructor() {\r\n this.conf = new SelectAddOrderByConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"select_add_order_by\",\r\n title: \"SELECT add ORDER BY\",\r\n shortDescription: `SELECTs add ORDER BY clause`,\r\n extendedInformation: `\nThis will make sure that the SELECT statement returns results in the same sequence on different databases\n\nadd ORDER BY PRIMARY KEY if in doubt\n\nIf the target is a sorted/hashed table, no issue is reported`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n run(obj) {\r\n var _a;\r\n const issues = [];\r\n if (!(obj instanceof _abap_object_1.ABAPObject) || obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n const spaghetti = new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti;\r\n for (const file of obj.getABAPFiles()) {\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return issues;\r\n }\r\n const selects = stru.findAllStatements(Statements.Select);\r\n selects.push(...stru.findAllStatements(Statements.SelectLoop));\r\n for (const s of selects) {\r\n const c = s.concatTokens();\r\n if (c.startsWith(\"SELECT SINGLE \")) {\r\n continue;\r\n }\r\n // skip COUNT(*)\r\n const list = s.findFirstExpression(Expressions.SQLFieldList);\r\n if ((list === null || list === void 0 ? void 0 : list.getChildren().length) === 1 && ((_a = list.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.SQLAggregation) {\r\n continue;\r\n }\r\n else if (s.findFirstExpression(Expressions.SQLOrderBy)) {\r\n continue;\r\n }\r\n if (this.isTargetSortedOrHashed(s, spaghetti, file)) {\r\n continue;\r\n }\r\n issues.push(issue_1.Issue.atStatement(file, s, \"Add ORDER BY\", this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n return issues;\r\n }\r\n isTargetSortedOrHashed(s, spaghetti, file) {\r\n var _a, _b;\r\n const target = (_a = s.findFirstExpression(Expressions.SQLIntoTable)) === null || _a === void 0 ? void 0 : _a.findFirstExpression(Expressions.Target);\r\n if (target) {\r\n const start = target.getFirstToken().getStart();\r\n const scope = spaghetti.lookupPosition(start, file.getFilename());\r\n let type = (_b = scope === null || scope === void 0 ? void 0 : scope.findWriteReference(start)) === null || _b === void 0 ? void 0 : _b.getType();\r\n const children = target.getChildren();\r\n if (type instanceof basic_1.StructureType && children.length >= 3 && children[1].concatTokens() === \"-\") {\r\n const found = type.getComponentByName(children[2].concatTokens());\r\n if (found === undefined) {\r\n return false;\r\n }\r\n type = found;\r\n }\r\n if (type instanceof basic_1.TableType\r\n && ((type === null || type === void 0 ? void 0 : type.getAccessType()) === basic_1.TableAccessType.sorted || (type === null || type === void 0 ? void 0 : type.getAccessType()) === basic_1.TableAccessType.hashed)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\nexports.SelectAddOrderBy = SelectAddOrderBy;\r\n//# sourceMappingURL=select_add_order_by.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/select_add_order_by.js?");
|
|
12427
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SelectAddOrderBy = exports.SelectAddOrderByConf = void 0;\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst basic_1 = __webpack_require__(/*! ../abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nclass SelectAddOrderByConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.SelectAddOrderByConf = SelectAddOrderByConf;\r\nclass SelectAddOrderBy {\r\n constructor() {\r\n this.conf = new SelectAddOrderByConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"select_add_order_by\",\r\n title: \"SELECT add ORDER BY\",\r\n shortDescription: `SELECTs add ORDER BY clause`,\r\n extendedInformation: `\r\nThis will make sure that the SELECT statement returns results in the same sequence on different databases\r\n\r\nadd ORDER BY PRIMARY KEY if in doubt\r\n\r\nIf the target is a sorted/hashed table, no issue is reported`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n run(obj) {\r\n var _a;\r\n const issues = [];\r\n if (!(obj instanceof _abap_object_1.ABAPObject) || obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n const spaghetti = new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti;\r\n for (const file of obj.getABAPFiles()) {\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return issues;\r\n }\r\n const selects = stru.findAllStatements(Statements.Select);\r\n selects.push(...stru.findAllStatements(Statements.SelectLoop));\r\n for (const s of selects) {\r\n const c = s.concatTokens();\r\n if (c.startsWith(\"SELECT SINGLE \")) {\r\n continue;\r\n }\r\n // skip COUNT(*)\r\n const list = s.findFirstExpression(Expressions.SQLFieldList);\r\n if ((list === null || list === void 0 ? void 0 : list.getChildren().length) === 1 && ((_a = list.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.SQLAggregation) {\r\n continue;\r\n }\r\n else if (s.findFirstExpression(Expressions.SQLOrderBy)) {\r\n continue;\r\n }\r\n if (this.isTargetSortedOrHashed(s, spaghetti, file)) {\r\n continue;\r\n }\r\n issues.push(issue_1.Issue.atStatement(file, s, \"Add ORDER BY\", this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n return issues;\r\n }\r\n isTargetSortedOrHashed(s, spaghetti, file) {\r\n var _a, _b;\r\n const target = (_a = s.findFirstExpression(Expressions.SQLIntoTable)) === null || _a === void 0 ? void 0 : _a.findFirstExpression(Expressions.Target);\r\n if (target) {\r\n const start = target.getFirstToken().getStart();\r\n const scope = spaghetti.lookupPosition(start, file.getFilename());\r\n let type = (_b = scope === null || scope === void 0 ? void 0 : scope.findWriteReference(start)) === null || _b === void 0 ? void 0 : _b.getType();\r\n const children = target.getChildren();\r\n if (type instanceof basic_1.StructureType && children.length >= 3 && children[1].concatTokens() === \"-\") {\r\n const found = type.getComponentByName(children[2].concatTokens());\r\n if (found === undefined) {\r\n return false;\r\n }\r\n type = found;\r\n }\r\n if (type instanceof basic_1.TableType\r\n && ((type === null || type === void 0 ? void 0 : type.getAccessType()) === basic_1.TableAccessType.sorted || (type === null || type === void 0 ? void 0 : type.getAccessType()) === basic_1.TableAccessType.hashed)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\nexports.SelectAddOrderBy = SelectAddOrderBy;\r\n//# sourceMappingURL=select_add_order_by.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/select_add_order_by.js?");
|
|
12428
12428
|
|
|
12429
12429
|
/***/ }),
|
|
12430
12430
|
|
|
@@ -12435,7 +12435,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12435
12435
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12436
12436
|
|
|
12437
12437
|
"use strict";
|
|
12438
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SelectPerformance = exports.SelectPerformanceConf = void 0;\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst structure_type_1 = __webpack_require__(/*! ../abap/types/basic/structure_type */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/structure_type.js\");\r\nconst DEFAULT_COLUMNS = 10;\r\nclass SelectPerformanceConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Detects ENDSELECT */\r\n this.endSelect = true;\r\n /** Detects SELECT * */\r\n this.selectStar = true;\r\n /** \"SELECT\" * is considered okay if the table is less than X columns, the table must be known to the linter */\r\n this.starOkayIfFewColumns = DEFAULT_COLUMNS;\r\n }\r\n}\r\nexports.SelectPerformanceConf = SelectPerformanceConf;\r\nclass SelectPerformance {\r\n constructor() {\r\n this.conf = new SelectPerformanceConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"select_performance\",\r\n title: \"SELECT performance\",\r\n shortDescription: `Various checks regarding SELECT performance.`,\r\n extendedInformation: `ENDSELECT: not reported when the corresponding SELECT has PACKAGE SIZE\n\nSELECT *: not reported if using INTO/APPENDING CORRESPONDING FIELDS OF`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Performance],\r\n };\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n getConfig() {\r\n if (this.conf.starOkayIfFewColumns === undefined) {\r\n this.conf.starOkayIfFewColumns = DEFAULT_COLUMNS;\r\n }\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof _abap_object_1.ABAPObject)) {\r\n return [];\r\n }\r\n const issues = [];\r\n for (const file of obj.getABAPFiles()) {\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return issues;\r\n }\r\n if (this.conf.endSelect) {\r\n for (const s of stru.findAllStructures(Structures.Select) || []) {\r\n const select = s.findDirectStatement(Statements.SelectLoop);\r\n if (select === undefined || select.concatTokens().toUpperCase().includes(\"PACKAGE SIZE\")) {\r\n continue;\r\n }\r\n const message = \"Avoid use of ENDSELECT\";\r\n issues.push(issue_1.Issue.atStatement(file, select, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n if (this.conf.selectStar) {\r\n const spaghetti = new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti;\r\n const selects = stru.findAllStatements(Statements.Select);\r\n selects.push(...stru.findAllStatements(Statements.SelectLoop));\r\n for (const s of selects) {\r\n const concat = s.concatTokens().toUpperCase();\r\n if (concat.startsWith(\"SELECT * \") === false\r\n && concat.startsWith(\"SELECT SINGLE * \") === false) {\r\n continue;\r\n }\r\n else if (concat.includes(\" INTO CORRESPONDING FIELDS OF \")\r\n || concat.includes(\" APPENDING CORRESPONDING FIELDS OF \")) {\r\n continue;\r\n }\r\n const columnCount = this.findNumberOfColumns(s, file, spaghetti);\r\n if (columnCount\r\n && columnCount <= this.getConfig().starOkayIfFewColumns) {\r\n continue;\r\n }\r\n const message = \"Avoid use of SELECT *\";\r\n issues.push(issue_1.Issue.atToken(file, s.getFirstToken(), message, this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n findNumberOfColumns(s, file, spaghetti) {\r\n const dbnames = s.findAllExpressions(Expressions.DatabaseTable);\r\n if (dbnames.length === 1) {\r\n const start = dbnames[0].getFirstToken().getStart();\r\n const scope = spaghetti.lookupPosition(start, file.getFilename());\r\n const name = scope === null || scope === void 0 ? void 0 : scope.findTableReference(start);\r\n const tabl = this.reg.getObject(\"TABL\", name);\r\n const parsed = tabl === null || tabl === void 0 ? void 0 : tabl.parseType(this.reg);\r\n if (parsed instanceof structure_type_1.StructureType) {\r\n return parsed.getComponents().length;\r\n }\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.SelectPerformance = SelectPerformance;\r\n//# sourceMappingURL=select_performance.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/select_performance.js?");
|
|
12438
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SelectPerformance = exports.SelectPerformanceConf = void 0;\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst structure_type_1 = __webpack_require__(/*! ../abap/types/basic/structure_type */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/structure_type.js\");\r\nconst DEFAULT_COLUMNS = 10;\r\nclass SelectPerformanceConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Detects ENDSELECT */\r\n this.endSelect = true;\r\n /** Detects SELECT * */\r\n this.selectStar = true;\r\n /** \"SELECT\" * is considered okay if the table is less than X columns, the table must be known to the linter */\r\n this.starOkayIfFewColumns = DEFAULT_COLUMNS;\r\n }\r\n}\r\nexports.SelectPerformanceConf = SelectPerformanceConf;\r\nclass SelectPerformance {\r\n constructor() {\r\n this.conf = new SelectPerformanceConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"select_performance\",\r\n title: \"SELECT performance\",\r\n shortDescription: `Various checks regarding SELECT performance.`,\r\n extendedInformation: `ENDSELECT: not reported when the corresponding SELECT has PACKAGE SIZE\r\n\r\nSELECT *: not reported if using INTO/APPENDING CORRESPONDING FIELDS OF`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Performance],\r\n };\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n getConfig() {\r\n if (this.conf.starOkayIfFewColumns === undefined) {\r\n this.conf.starOkayIfFewColumns = DEFAULT_COLUMNS;\r\n }\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof _abap_object_1.ABAPObject)) {\r\n return [];\r\n }\r\n const issues = [];\r\n for (const file of obj.getABAPFiles()) {\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return issues;\r\n }\r\n if (this.conf.endSelect) {\r\n for (const s of stru.findAllStructures(Structures.Select) || []) {\r\n const select = s.findDirectStatement(Statements.SelectLoop);\r\n if (select === undefined || select.concatTokens().toUpperCase().includes(\"PACKAGE SIZE\")) {\r\n continue;\r\n }\r\n const message = \"Avoid use of ENDSELECT\";\r\n issues.push(issue_1.Issue.atStatement(file, select, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n if (this.conf.selectStar) {\r\n const spaghetti = new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti;\r\n const selects = stru.findAllStatements(Statements.Select);\r\n selects.push(...stru.findAllStatements(Statements.SelectLoop));\r\n for (const s of selects) {\r\n const concat = s.concatTokens().toUpperCase();\r\n if (concat.startsWith(\"SELECT * \") === false\r\n && concat.startsWith(\"SELECT SINGLE * \") === false) {\r\n continue;\r\n }\r\n else if (concat.includes(\" INTO CORRESPONDING FIELDS OF \")\r\n || concat.includes(\" APPENDING CORRESPONDING FIELDS OF \")) {\r\n continue;\r\n }\r\n const columnCount = this.findNumberOfColumns(s, file, spaghetti);\r\n if (columnCount\r\n && columnCount <= this.getConfig().starOkayIfFewColumns) {\r\n continue;\r\n }\r\n const message = \"Avoid use of SELECT *\";\r\n issues.push(issue_1.Issue.atToken(file, s.getFirstToken(), message, this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n findNumberOfColumns(s, file, spaghetti) {\r\n const dbnames = s.findAllExpressions(Expressions.DatabaseTable);\r\n if (dbnames.length === 1) {\r\n const start = dbnames[0].getFirstToken().getStart();\r\n const scope = spaghetti.lookupPosition(start, file.getFilename());\r\n const name = scope === null || scope === void 0 ? void 0 : scope.findTableReference(start);\r\n const tabl = this.reg.getObject(\"TABL\", name);\r\n const parsed = tabl === null || tabl === void 0 ? void 0 : tabl.parseType(this.reg);\r\n if (parsed instanceof structure_type_1.StructureType) {\r\n return parsed.getComponents().length;\r\n }\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.SelectPerformance = SelectPerformance;\r\n//# sourceMappingURL=select_performance.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/select_performance.js?");
|
|
12439
12439
|
|
|
12440
12440
|
/***/ }),
|
|
12441
12441
|
|
|
@@ -12479,7 +12479,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12479
12479
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12480
12480
|
|
|
12481
12481
|
"use strict";
|
|
12482
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SICFConsistency = exports.SICFConsistencyConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nclass SICFConsistencyConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.SICFConsistencyConf = SICFConsistencyConf;\r\nclass SICFConsistency {\r\n constructor() {\r\n this.conf = new SICFConsistencyConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"sicf_consistency\",\r\n title: \"SICF consistency\",\r\n shortDescription: `Checks the validity of ICF services:\n\n* Class defined in handler must exist\n* Class must not have any syntax errors\n* Class must implement interface IF_HTTP_EXTENSION`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(obj) {\r\n const issues = [];\r\n if (!(obj instanceof objects_1.ICFService)) {\r\n return [];\r\n }\r\n const handlers = obj.getHandlerList();\r\n if (handlers === undefined) {\r\n return [];\r\n }\r\n for (const h of handlers) {\r\n const clas = this.reg.getObject(\"CLAS\", h);\r\n if (clas === undefined) {\r\n const pattern = new RegExp(this.reg.getConfig().getSyntaxSetttings().errorNamespace, \"i\");\r\n if (pattern.test(h) === true) {\r\n const message = \"Handler class \" + h + \" not found\";\r\n const issue = issue_1.Issue.atPosition(obj.getFiles()[0], new position_1.Position(1, 1), message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n continue;\r\n }\r\n const def = clas.getClassDefinition();\r\n if (def === undefined) {\r\n const message = \"Syntax error in class \" + h;\r\n const issue = issue_1.Issue.atPosition(obj.getFiles()[0], new position_1.Position(1, 1), message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n continue;\r\n }\r\n const implementing = this.findImplementing(def);\r\n if (implementing.findIndex((i) => { return i.name.toUpperCase() === \"IF_HTTP_EXTENSION\"; }) < 0) {\r\n const message = \"Handler class \" + h + \" must implement IF_HTTP_EXTENSION\";\r\n const issue = issue_1.Issue.atPosition(obj.getFiles()[0], new position_1.Position(1, 1), message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n continue;\r\n }\r\n }\r\n return issues;\r\n }\r\n ///////////////////////////\r\n findImplementing(def) {\r\n let ret = def.interfaces;\r\n let superName = def.superClassName;\r\n while (superName !== undefined) {\r\n const clas = this.reg.getObject(\"CLAS\", superName);\r\n if (clas === undefined) {\r\n break;\r\n }\r\n const superDef = clas.getClassDefinition();\r\n if (superDef === undefined) {\r\n break;\r\n }\r\n ret = ret.concat(superDef.interfaces);\r\n superName = superDef.superClassName;\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.SICFConsistency = SICFConsistency;\r\n//# sourceMappingURL=sicf_consistency.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/sicf_consistency.js?");
|
|
12482
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SICFConsistency = exports.SICFConsistencyConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nclass SICFConsistencyConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.SICFConsistencyConf = SICFConsistencyConf;\r\nclass SICFConsistency {\r\n constructor() {\r\n this.conf = new SICFConsistencyConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"sicf_consistency\",\r\n title: \"SICF consistency\",\r\n shortDescription: `Checks the validity of ICF services:\r\n\r\n* Class defined in handler must exist\r\n* Class must not have any syntax errors\r\n* Class must implement interface IF_HTTP_EXTENSION`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(obj) {\r\n const issues = [];\r\n if (!(obj instanceof objects_1.ICFService)) {\r\n return [];\r\n }\r\n const handlers = obj.getHandlerList();\r\n if (handlers === undefined) {\r\n return [];\r\n }\r\n for (const h of handlers) {\r\n const clas = this.reg.getObject(\"CLAS\", h);\r\n if (clas === undefined) {\r\n const pattern = new RegExp(this.reg.getConfig().getSyntaxSetttings().errorNamespace, \"i\");\r\n if (pattern.test(h) === true) {\r\n const message = \"Handler class \" + h + \" not found\";\r\n const issue = issue_1.Issue.atPosition(obj.getFiles()[0], new position_1.Position(1, 1), message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n continue;\r\n }\r\n const def = clas.getClassDefinition();\r\n if (def === undefined) {\r\n const message = \"Syntax error in class \" + h;\r\n const issue = issue_1.Issue.atPosition(obj.getFiles()[0], new position_1.Position(1, 1), message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n continue;\r\n }\r\n const implementing = this.findImplementing(def);\r\n if (implementing.findIndex((i) => { return i.name.toUpperCase() === \"IF_HTTP_EXTENSION\"; }) < 0) {\r\n const message = \"Handler class \" + h + \" must implement IF_HTTP_EXTENSION\";\r\n const issue = issue_1.Issue.atPosition(obj.getFiles()[0], new position_1.Position(1, 1), message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n continue;\r\n }\r\n }\r\n return issues;\r\n }\r\n ///////////////////////////\r\n findImplementing(def) {\r\n let ret = def.interfaces;\r\n let superName = def.superClassName;\r\n while (superName !== undefined) {\r\n const clas = this.reg.getObject(\"CLAS\", superName);\r\n if (clas === undefined) {\r\n break;\r\n }\r\n const superDef = clas.getClassDefinition();\r\n if (superDef === undefined) {\r\n break;\r\n }\r\n ret = ret.concat(superDef.interfaces);\r\n superName = superDef.superClassName;\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.SICFConsistency = SICFConsistency;\r\n//# sourceMappingURL=sicf_consistency.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/sicf_consistency.js?");
|
|
12483
12483
|
|
|
12484
12484
|
/***/ }),
|
|
12485
12485
|
|
|
@@ -12501,7 +12501,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12501
12501
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12502
12502
|
|
|
12503
12503
|
"use strict";
|
|
12504
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SpaceBeforeDot = exports.SpaceBeforeDotConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst tokens_1 = __webpack_require__(/*! ../abap/1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nclass SpaceBeforeDotConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n this.ignoreGlobalDefinition = true;\r\n this.ignoreExceptions = true;\r\n }\r\n}\r\nexports.SpaceBeforeDotConf = SpaceBeforeDotConf;\r\nclass SpaceBeforeDot extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new SpaceBeforeDotConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"space_before_dot\",\r\n title: \"Space before dot\",\r\n shortDescription: `Checks for extra spaces before dots at the ends of statements`,\r\n extendedInformation: `\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#be-consistent\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#condense-your-code`,\r\n tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n badExample: `WRITE bar .`,\r\n goodExample: `WRITE bar.`,\r\n };\r\n }\r\n getMessage() {\r\n return \"Remove space before \\\",\\\" or \\\".\\\"\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file, obj) {\r\n const issues = [];\r\n let prev = undefined;\r\n let startRow = 0;\r\n if (file.getStructure() === undefined) {\r\n // some parser error exists in file\r\n return [];\r\n }\r\n const ddic = new ddic_1.DDIC(this.reg);\r\n if (this.conf.ignoreGlobalDefinition) {\r\n const structure = file.getStructure();\r\n if (obj instanceof objects_1.Class && structure !== undefined) {\r\n const endclass = structure.findFirstStatement(Statements.EndClass);\r\n if (endclass !== undefined) {\r\n startRow = endclass.getFirstToken().getRow();\r\n }\r\n const definition = obj.getClassDefinition();\r\n if (definition !== undefined && this.conf.ignoreExceptions && ddic.isException(definition, obj)) {\r\n return [];\r\n }\r\n }\r\n else if (obj instanceof objects_1.Interface && structure !== undefined) {\r\n const endinterface = structure.findFirstStatement(Statements.EndInterface);\r\n if (endinterface !== undefined) {\r\n startRow = endinterface.getFirstToken().getRow();\r\n }\r\n }\r\n }\r\n for (const t of file.getTokens()) {\r\n if (t.getRow() < startRow) {\r\n continue;\r\n }\r\n if (prev !== undefined && t instanceof tokens_1.Punctuation && prev.getCol() + prev.getStr().length < t.getCol()) {\r\n const start = new position_1.Position(t.getStart().getRow(), prev.getEnd().getCol());\r\n const end = new position_1.Position(t.getStart().getRow(), t.getStart().getCol());\r\n const fix = edit_helper_1.EditHelper.deleteRange(file, start, end);\r\n const issue = issue_1.Issue.atRange(file, start, end, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n prev = t;\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.SpaceBeforeDot = SpaceBeforeDot;\r\n//# sourceMappingURL=space_before_dot.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/space_before_dot.js?");
|
|
12504
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SpaceBeforeDot = exports.SpaceBeforeDotConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst tokens_1 = __webpack_require__(/*! ../abap/1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nclass SpaceBeforeDotConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n this.ignoreGlobalDefinition = true;\r\n this.ignoreExceptions = true;\r\n }\r\n}\r\nexports.SpaceBeforeDotConf = SpaceBeforeDotConf;\r\nclass SpaceBeforeDot extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new SpaceBeforeDotConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"space_before_dot\",\r\n title: \"Space before dot\",\r\n shortDescription: `Checks for extra spaces before dots at the ends of statements`,\r\n extendedInformation: `\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#be-consistent\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#condense-your-code`,\r\n tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n badExample: `WRITE bar .`,\r\n goodExample: `WRITE bar.`,\r\n };\r\n }\r\n getMessage() {\r\n return \"Remove space before \\\",\\\" or \\\".\\\"\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file, obj) {\r\n const issues = [];\r\n let prev = undefined;\r\n let startRow = 0;\r\n if (file.getStructure() === undefined) {\r\n // some parser error exists in file\r\n return [];\r\n }\r\n const ddic = new ddic_1.DDIC(this.reg);\r\n if (this.conf.ignoreGlobalDefinition) {\r\n const structure = file.getStructure();\r\n if (obj instanceof objects_1.Class && structure !== undefined) {\r\n const endclass = structure.findFirstStatement(Statements.EndClass);\r\n if (endclass !== undefined) {\r\n startRow = endclass.getFirstToken().getRow();\r\n }\r\n const definition = obj.getClassDefinition();\r\n if (definition !== undefined && this.conf.ignoreExceptions && ddic.isException(definition, obj)) {\r\n return [];\r\n }\r\n }\r\n else if (obj instanceof objects_1.Interface && structure !== undefined) {\r\n const endinterface = structure.findFirstStatement(Statements.EndInterface);\r\n if (endinterface !== undefined) {\r\n startRow = endinterface.getFirstToken().getRow();\r\n }\r\n }\r\n }\r\n for (const t of file.getTokens()) {\r\n if (t.getRow() < startRow) {\r\n continue;\r\n }\r\n if (prev !== undefined && t instanceof tokens_1.Punctuation && prev.getCol() + prev.getStr().length < t.getCol()) {\r\n const start = new position_1.Position(t.getStart().getRow(), prev.getEnd().getCol());\r\n const end = new position_1.Position(t.getStart().getRow(), t.getStart().getCol());\r\n const fix = edit_helper_1.EditHelper.deleteRange(file, start, end);\r\n const issue = issue_1.Issue.atRange(file, start, end, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n prev = t;\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.SpaceBeforeDot = SpaceBeforeDot;\r\n//# sourceMappingURL=space_before_dot.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/space_before_dot.js?");
|
|
12505
12505
|
|
|
12506
12506
|
/***/ }),
|
|
12507
12507
|
|
|
@@ -12523,7 +12523,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12523
12523
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12524
12524
|
|
|
12525
12525
|
"use strict";
|
|
12526
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.StartAtTab = exports.StartAtTabConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst statements_1 = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass StartAtTabConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.StartAtTabConf = StartAtTabConf;\r\nclass StartAtTab extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new StartAtTabConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"start_at_tab\",\r\n title: \"Start at tab\",\r\n shortDescription: `Checks that statements start at tabstops.`,\r\n extendedInformation: `Reports max 100 issues per file\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#indent-and-snap-to-tab`,\r\n tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n badExample: ` WRITE a.`,\r\n goodExample: ` WRITE a.`,\r\n };\r\n }\r\n getMessage() {\r\n return \"Start statement at tab position\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n let inType = false;\r\n let previous = undefined;\r\n const raw = file.getRawRows();\r\n for (const statement of file.getStatements()) {\r\n if (statement.get() instanceof _statement_1.Comment) {\r\n continue;\r\n }\r\n else if (statement.get() instanceof statements_1.TypeBegin) {\r\n inType = true;\r\n }\r\n else if (statement.get() instanceof statements_1.TypeEnd) {\r\n inType = false;\r\n }\r\n else if (inType) {\r\n continue;\r\n }\r\n const pos = statement.getStart();\r\n if (previous !== undefined && pos.getRow() === previous.getRow()) {\r\n continue;\r\n }\r\n // just skip rows that contains tabs, this will be reported by the contains_tab rule\r\n if ((pos.getCol() - 1) % 2 !== 0 && raw[pos.getRow() - 1].includes(\"\\t\") === false) {\r\n const issue = issue_1.Issue.atPosition(file, pos, this.getMessage(), this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n if (issues.length >= 100) {\r\n return issues; // only max 100 issues perfile\r\n }\r\n }\r\n previous = pos;\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.StartAtTab = StartAtTab;\r\n//# sourceMappingURL=start_at_tab.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/start_at_tab.js?");
|
|
12526
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.StartAtTab = exports.StartAtTabConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst statements_1 = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass StartAtTabConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.StartAtTabConf = StartAtTabConf;\r\nclass StartAtTab extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new StartAtTabConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"start_at_tab\",\r\n title: \"Start at tab\",\r\n shortDescription: `Checks that statements start at tabstops.`,\r\n extendedInformation: `Reports max 100 issues per file\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#indent-and-snap-to-tab`,\r\n tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n badExample: ` WRITE a.`,\r\n goodExample: ` WRITE a.`,\r\n };\r\n }\r\n getMessage() {\r\n return \"Start statement at tab position\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n let inType = false;\r\n let previous = undefined;\r\n const raw = file.getRawRows();\r\n for (const statement of file.getStatements()) {\r\n if (statement.get() instanceof _statement_1.Comment) {\r\n continue;\r\n }\r\n else if (statement.get() instanceof statements_1.TypeBegin) {\r\n inType = true;\r\n }\r\n else if (statement.get() instanceof statements_1.TypeEnd) {\r\n inType = false;\r\n }\r\n else if (inType) {\r\n continue;\r\n }\r\n const pos = statement.getStart();\r\n if (previous !== undefined && pos.getRow() === previous.getRow()) {\r\n continue;\r\n }\r\n // just skip rows that contains tabs, this will be reported by the contains_tab rule\r\n if ((pos.getCol() - 1) % 2 !== 0 && raw[pos.getRow() - 1].includes(\"\\t\") === false) {\r\n const issue = issue_1.Issue.atPosition(file, pos, this.getMessage(), this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n if (issues.length >= 100) {\r\n return issues; // only max 100 issues perfile\r\n }\r\n }\r\n previous = pos;\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.StartAtTab = StartAtTab;\r\n//# sourceMappingURL=start_at_tab.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/start_at_tab.js?");
|
|
12527
12527
|
|
|
12528
12528
|
/***/ }),
|
|
12529
12529
|
|
|
@@ -12556,7 +12556,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12556
12556
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12557
12557
|
|
|
12558
12558
|
"use strict";
|
|
12559
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SyModification = exports.SyModificationConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass SyModificationConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.SyModificationConf = SyModificationConf;\r\nclass SyModification extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new SyModificationConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"sy_modification\",\r\n title: \"Modification of SY fields\",\r\n shortDescription: `Finds modification of sy fields`,\r\n extendedInformation: `https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abensystem_fields.htm`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: `\nsy-uname = 2.\nsy = sy.`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file, obj) {\r\n var _a;\r\n const issues = [];\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n for (const t of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllExpressions(Expressions.Target)) || []) {\r\n const firstChild = t.getChildren()[0];\r\n if (firstChild.get() instanceof Expressions.TargetField\r\n && firstChild.getFirstToken().getStr().toUpperCase() === \"SY\") {\r\n const message = \"Modification of SY field\";\r\n const issue = issue_1.Issue.atToken(file, firstChild.getFirstToken(), message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.SyModification = SyModification;\r\n//# sourceMappingURL=sy_modification.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/sy_modification.js?");
|
|
12559
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SyModification = exports.SyModificationConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass SyModificationConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.SyModificationConf = SyModificationConf;\r\nclass SyModification extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new SyModificationConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"sy_modification\",\r\n title: \"Modification of SY fields\",\r\n shortDescription: `Finds modification of sy fields`,\r\n extendedInformation: `https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abensystem_fields.htm`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: `\r\nsy-uname = 2.\r\nsy = sy.`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file, obj) {\r\n var _a;\r\n const issues = [];\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n for (const t of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllExpressions(Expressions.Target)) || []) {\r\n const firstChild = t.getChildren()[0];\r\n if (firstChild.get() instanceof Expressions.TargetField\r\n && firstChild.getFirstToken().getStr().toUpperCase() === \"SY\") {\r\n const message = \"Modification of SY field\";\r\n const issue = issue_1.Issue.atToken(file, firstChild.getFirstToken(), message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.SyModification = SyModification;\r\n//# sourceMappingURL=sy_modification.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/sy_modification.js?");
|
|
12560
12560
|
|
|
12561
12561
|
/***/ }),
|
|
12562
12562
|
|
|
@@ -12567,7 +12567,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12567
12567
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12568
12568
|
|
|
12569
12569
|
"use strict";
|
|
12570
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.TABLEnhancementCategory = exports.TABLEnhancementCategoryConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nclass TABLEnhancementCategoryConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.TABLEnhancementCategoryConf = TABLEnhancementCategoryConf;\r\nclass TABLEnhancementCategory {\r\n constructor() {\r\n this.conf = new TABLEnhancementCategoryConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"tabl_enhancement_category\",\r\n title: \"TABL enhancement category must be set\",\r\n shortDescription: `Checks that tables do not have the enhancement category 'not classified'.`,\r\n extendedInformation: `SAP note 3063227 changes the default to 'Cannot be enhanced'.\n\nYou may use standard report RS_DDIC_CLASSIFICATION_FINAL for adjustment.`,\r\n tags: [],\r\n };\r\n }\r\n getDescription(name) {\r\n return \"TABL enhancement category not classified in \" + name;\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n initialize(_reg) {\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof objects_1.Table)) {\r\n return [];\r\n }\r\n if (obj.getEnhancementCategory() === objects_1.EnhancementCategory.NotClassified) {\r\n const position = new position_1.Position(1, 1);\r\n const issue = issue_1.Issue.atPosition(obj.getFiles()[0], position, this.getDescription(obj.getName()), this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n return [];\r\n }\r\n}\r\nexports.TABLEnhancementCategory = TABLEnhancementCategory;\r\n//# sourceMappingURL=tabl_enhancement_category.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/tabl_enhancement_category.js?");
|
|
12570
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.TABLEnhancementCategory = exports.TABLEnhancementCategoryConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nclass TABLEnhancementCategoryConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.TABLEnhancementCategoryConf = TABLEnhancementCategoryConf;\r\nclass TABLEnhancementCategory {\r\n constructor() {\r\n this.conf = new TABLEnhancementCategoryConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"tabl_enhancement_category\",\r\n title: \"TABL enhancement category must be set\",\r\n shortDescription: `Checks that tables do not have the enhancement category 'not classified'.`,\r\n extendedInformation: `SAP note 3063227 changes the default to 'Cannot be enhanced'.\r\n\r\nYou may use standard report RS_DDIC_CLASSIFICATION_FINAL for adjustment.`,\r\n tags: [],\r\n };\r\n }\r\n getDescription(name) {\r\n return \"TABL enhancement category not classified in \" + name;\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n initialize(_reg) {\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof objects_1.Table)) {\r\n return [];\r\n }\r\n if (obj.getEnhancementCategory() === objects_1.EnhancementCategory.NotClassified) {\r\n const position = new position_1.Position(1, 1);\r\n const issue = issue_1.Issue.atPosition(obj.getFiles()[0], position, this.getDescription(obj.getName()), this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n return [];\r\n }\r\n}\r\nexports.TABLEnhancementCategory = TABLEnhancementCategory;\r\n//# sourceMappingURL=tabl_enhancement_category.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/tabl_enhancement_category.js?");
|
|
12571
12571
|
|
|
12572
12572
|
/***/ }),
|
|
12573
12573
|
|
|
@@ -12677,7 +12677,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12677
12677
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12678
12678
|
|
|
12679
12679
|
"use strict";
|
|
12680
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UnusedMethods = exports.UnusedMethodsConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nconst visibility_1 = __webpack_require__(/*! ../abap/4_file_information/visibility */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass UnusedMethodsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.UnusedMethodsConf = UnusedMethodsConf;\r\nclass WorkArea {\r\n constructor() {\r\n this.list = [];\r\n this.list = [];\r\n }\r\n push(id) {\r\n this.list.push(id);\r\n }\r\n removeIfExists(id) {\r\n for (let i = 0; i < this.list.length; i++) {\r\n if (id.equals(this.list[i].identifier)) {\r\n this.list.splice(i, 1);\r\n return;\r\n }\r\n }\r\n }\r\n containsProteted() {\r\n for (const m of this.list) {\r\n if (m.visibility === visibility_1.Visibility.Protected) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n getLength() {\r\n return this.list.length;\r\n }\r\n get() {\r\n return this.list;\r\n }\r\n}\r\n// todo: add possibility to also search public methods\r\n// todo: for protected methods, also search subclasses\r\nclass UnusedMethods {\r\n constructor() {\r\n this.conf = new UnusedMethodsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"unused_methods\",\r\n title: \"Unused methods\",\r\n shortDescription: `Checks for unused methods`,\r\n extendedInformation: `Checks private and protected methods.\n\nSkips:\n* methods FOR TESTING\n* methods SETUP + TEARDOWN + CLASS_SETUP + CLASS_TEARDOWN in testclasses\n* class_constructor + constructor methods\n* event handlers\n* methods that are redefined\n* INCLUDEs\n`,\r\n tags: [],\r\n pragma: \"##CALLED\",\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof _abap_object_1.ABAPObject)) {\r\n return [];\r\n }\r\n else if (obj instanceof objects_1.Interface) { // todo, how to handle interfaces?\r\n return [];\r\n }\r\n else if (obj instanceof objects_1.Program && obj.isInclude() === true) {\r\n return [];\r\n }\r\n // dont report anything when there are syntax errors\r\n const syntax = new syntax_1.SyntaxLogic(this.reg, obj).run();\r\n if (syntax.issues.length > 0) {\r\n return [];\r\n }\r\n this.wa = new WorkArea();\r\n for (const file of obj.getABAPFiles()) {\r\n for (const def of file.getInfo().listClassDefinitions()) {\r\n for (const method of def.methods) {\r\n if (method.isForTesting === true\r\n || method.isRedefinition === true\r\n || method.isEventHandler === true) {\r\n continue;\r\n }\r\n else if (def.isForTesting === true\r\n && (method.name.toUpperCase() === \"SETUP\"\r\n || method.name.toUpperCase() === \"CLASS_SETUP\"\r\n || method.name.toUpperCase() === \"TEARDOWN\"\r\n || method.name.toUpperCase() === \"CLASS_TEARDOWN\")) {\r\n continue;\r\n }\r\n else if (method.name.toUpperCase() === \"CONSTRUCTOR\"\r\n || method.name.toUpperCase() === \"CLASS_CONSTRUCTOR\") {\r\n continue;\r\n }\r\n if (method.visibility === visibility_1.Visibility.Private\r\n || method.visibility === visibility_1.Visibility.Protected) {\r\n this.wa.push(method);\r\n }\r\n }\r\n }\r\n }\r\n this.traverse(syntax.spaghetti.getTop());\r\n this.searchGlobalSubclasses(obj);\r\n const issues = [];\r\n for (const i of this.wa.get()) {\r\n const file = obj.getABAPFileByName(i.identifier.getFilename());\r\n if (file === undefined) {\r\n continue;\r\n }\r\n const statement = edit_helper_1.EditHelper.findStatement(i.identifier.getToken(), file);\r\n if (statement === undefined) {\r\n continue;\r\n }\r\n if (statement.getPragmas().some(t => t.getStr() === this.getMetadata().pragma)) {\r\n continue;\r\n }\r\n const message = \"Method \\\"\" + i.identifier.getName() + \"\\\" not used\";\r\n issues.push(issue_1.Issue.atIdentifier(i.identifier, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n return issues;\r\n }\r\n searchGlobalSubclasses(obj) {\r\n var _a, _b;\r\n if (this.wa.getLength() === 0\r\n || !(obj instanceof objects_1.Class)\r\n || this.wa.containsProteted() === false) {\r\n return;\r\n }\r\n const sup = obj.getDefinition();\r\n if (sup === undefined) {\r\n return;\r\n }\r\n for (const r of this.reg.getObjects()) {\r\n if (r instanceof objects_1.Class\r\n && ((_b = (_a = r.getDefinition()) === null || _a === void 0 ? void 0 : _a.getSuperClass()) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === sup.getName().toUpperCase()) {\r\n const syntax = new syntax_1.SyntaxLogic(this.reg, r).run();\r\n this.traverse(syntax.spaghetti.getTop());\r\n // recurse to sub-sub-* classes\r\n this.searchGlobalSubclasses(r);\r\n }\r\n }\r\n }\r\n traverse(node) {\r\n if (node.getIdentifier().stype !== _scope_type_1.ScopeType.BuiltIn) {\r\n this.checkNode(node);\r\n }\r\n for (const c of node.getChildren()) {\r\n this.traverse(c);\r\n }\r\n }\r\n checkNode(node) {\r\n for (const v of node.getData().references) {\r\n if (v.referenceType === _reference_1.ReferenceType.MethodReference && v.resolved) {\r\n this.wa.removeIfExists(v.resolved);\r\n }\r\n }\r\n }\r\n}\r\nexports.UnusedMethods = UnusedMethods;\r\n//# sourceMappingURL=unused_methods.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/unused_methods.js?");
|
|
12680
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UnusedMethods = exports.UnusedMethodsConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nconst visibility_1 = __webpack_require__(/*! ../abap/4_file_information/visibility */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass UnusedMethodsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.UnusedMethodsConf = UnusedMethodsConf;\r\nclass WorkArea {\r\n constructor() {\r\n this.list = [];\r\n this.list = [];\r\n }\r\n push(id) {\r\n this.list.push(id);\r\n }\r\n removeIfExists(id) {\r\n for (let i = 0; i < this.list.length; i++) {\r\n if (id.equals(this.list[i].identifier)) {\r\n this.list.splice(i, 1);\r\n return;\r\n }\r\n }\r\n }\r\n containsProteted() {\r\n for (const m of this.list) {\r\n if (m.visibility === visibility_1.Visibility.Protected) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n getLength() {\r\n return this.list.length;\r\n }\r\n get() {\r\n return this.list;\r\n }\r\n}\r\n// todo: add possibility to also search public methods\r\n// todo: for protected methods, also search subclasses\r\nclass UnusedMethods {\r\n constructor() {\r\n this.conf = new UnusedMethodsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"unused_methods\",\r\n title: \"Unused methods\",\r\n shortDescription: `Checks for unused methods`,\r\n extendedInformation: `Checks private and protected methods.\r\n\r\nSkips:\r\n* methods FOR TESTING\r\n* methods SETUP + TEARDOWN + CLASS_SETUP + CLASS_TEARDOWN in testclasses\r\n* class_constructor + constructor methods\r\n* event handlers\r\n* methods that are redefined\r\n* INCLUDEs\r\n`,\r\n tags: [],\r\n pragma: \"##CALLED\",\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof _abap_object_1.ABAPObject)) {\r\n return [];\r\n }\r\n else if (obj instanceof objects_1.Interface) { // todo, how to handle interfaces?\r\n return [];\r\n }\r\n else if (obj instanceof objects_1.Program && obj.isInclude() === true) {\r\n return [];\r\n }\r\n // dont report anything when there are syntax errors\r\n const syntax = new syntax_1.SyntaxLogic(this.reg, obj).run();\r\n if (syntax.issues.length > 0) {\r\n return [];\r\n }\r\n this.wa = new WorkArea();\r\n for (const file of obj.getABAPFiles()) {\r\n for (const def of file.getInfo().listClassDefinitions()) {\r\n for (const method of def.methods) {\r\n if (method.isForTesting === true\r\n || method.isRedefinition === true\r\n || method.isEventHandler === true) {\r\n continue;\r\n }\r\n else if (def.isForTesting === true\r\n && (method.name.toUpperCase() === \"SETUP\"\r\n || method.name.toUpperCase() === \"CLASS_SETUP\"\r\n || method.name.toUpperCase() === \"TEARDOWN\"\r\n || method.name.toUpperCase() === \"CLASS_TEARDOWN\")) {\r\n continue;\r\n }\r\n else if (method.name.toUpperCase() === \"CONSTRUCTOR\"\r\n || method.name.toUpperCase() === \"CLASS_CONSTRUCTOR\") {\r\n continue;\r\n }\r\n if (method.visibility === visibility_1.Visibility.Private\r\n || method.visibility === visibility_1.Visibility.Protected) {\r\n this.wa.push(method);\r\n }\r\n }\r\n }\r\n }\r\n this.traverse(syntax.spaghetti.getTop());\r\n this.searchGlobalSubclasses(obj);\r\n const issues = [];\r\n for (const i of this.wa.get()) {\r\n const file = obj.getABAPFileByName(i.identifier.getFilename());\r\n if (file === undefined) {\r\n continue;\r\n }\r\n const statement = edit_helper_1.EditHelper.findStatement(i.identifier.getToken(), file);\r\n if (statement === undefined) {\r\n continue;\r\n }\r\n if (statement.getPragmas().some(t => t.getStr() === this.getMetadata().pragma)) {\r\n continue;\r\n }\r\n const message = \"Method \\\"\" + i.identifier.getName() + \"\\\" not used\";\r\n issues.push(issue_1.Issue.atIdentifier(i.identifier, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n return issues;\r\n }\r\n searchGlobalSubclasses(obj) {\r\n var _a, _b;\r\n if (this.wa.getLength() === 0\r\n || !(obj instanceof objects_1.Class)\r\n || this.wa.containsProteted() === false) {\r\n return;\r\n }\r\n const sup = obj.getDefinition();\r\n if (sup === undefined) {\r\n return;\r\n }\r\n for (const r of this.reg.getObjects()) {\r\n if (r instanceof objects_1.Class\r\n && ((_b = (_a = r.getDefinition()) === null || _a === void 0 ? void 0 : _a.getSuperClass()) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === sup.getName().toUpperCase()) {\r\n const syntax = new syntax_1.SyntaxLogic(this.reg, r).run();\r\n this.traverse(syntax.spaghetti.getTop());\r\n // recurse to sub-sub-* classes\r\n this.searchGlobalSubclasses(r);\r\n }\r\n }\r\n }\r\n traverse(node) {\r\n if (node.getIdentifier().stype !== _scope_type_1.ScopeType.BuiltIn) {\r\n this.checkNode(node);\r\n }\r\n for (const c of node.getChildren()) {\r\n this.traverse(c);\r\n }\r\n }\r\n checkNode(node) {\r\n for (const v of node.getData().references) {\r\n if (v.referenceType === _reference_1.ReferenceType.MethodReference && v.resolved) {\r\n this.wa.removeIfExists(v.resolved);\r\n }\r\n }\r\n }\r\n}\r\nexports.UnusedMethods = UnusedMethods;\r\n//# sourceMappingURL=unused_methods.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/unused_methods.js?");
|
|
12681
12681
|
|
|
12682
12682
|
/***/ }),
|
|
12683
12683
|
|
|
@@ -12699,7 +12699,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12699
12699
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12700
12700
|
|
|
12701
12701
|
"use strict";
|
|
12702
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UnusedVariables = exports.UnusedVariablesConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nclass UnusedVariablesConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** skip specific names, case insensitive\r\n * @uniqueItems true\r\n */\r\n this.skipNames = [];\r\n }\r\n}\r\nexports.UnusedVariablesConf = UnusedVariablesConf;\r\nclass WorkArea {\r\n constructor() {\r\n this.workarea = [];\r\n }\r\n push(id, count = 1) {\r\n for (const w of this.workarea) {\r\n if (id.equals(w.id)) {\r\n return;\r\n }\r\n }\r\n this.workarea.push({ id, count });\r\n }\r\n removeIfExists(id) {\r\n if (id === undefined) {\r\n return;\r\n }\r\n for (let i = 0; i < this.workarea.length; i++) {\r\n if (id.equals(this.workarea[i].id)) {\r\n this.workarea[i].count--;\r\n if (this.workarea[i].count === 0) {\r\n this.workarea.splice(i, 1);\r\n }\r\n return;\r\n }\r\n }\r\n }\r\n get() {\r\n return this.workarea;\r\n }\r\n count() {\r\n return this.workarea.length;\r\n }\r\n}\r\nclass UnusedVariables {\r\n constructor() {\r\n this.conf = new UnusedVariablesConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"unused_variables\",\r\n title: \"Unused variables\",\r\n shortDescription: `Checks for unused variables and constants`,\r\n extendedInformation: `WARNING: slow\n\nExperimental, might give false positives. Skips event parameters.\n\nNote that this currently does not work if the source code uses macros.\n\nUnused variables are not reported if the object contains syntax errors. Errors found in INCLUDES are reported for the main program.`,\r\n tags: [_irule_1.RuleTag.Quickfix],\r\n pragma: \"##NEEDED\",\r\n pseudoComment: \"EC NEEDED\",\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n if (this.conf.skipNames === undefined) {\r\n this.conf.skipNames = [];\r\n }\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof _abap_object_1.ABAPObject)) {\r\n return [];\r\n }\r\n else if (obj instanceof objects_1.Interface) { // todo, how to handle interfaces?\r\n return [];\r\n }\r\n // dont report unused variables when there are syntax errors\r\n const syntax = new syntax_1.SyntaxLogic(this.reg, obj).run();\r\n if (syntax.issues.length > 0) {\r\n return [];\r\n }\r\n this.workarea = new WorkArea();\r\n const top = syntax.spaghetti.getTop();\r\n this.buildWorkarea(top, obj);\r\n if (this.workarea.count() === 0) {\r\n return this.buildIssues(obj); // exit early if all types are used\r\n }\r\n this.findUses(top, obj);\r\n for (const o of this.reg.getObjects()) {\r\n if (o === obj) {\r\n continue;\r\n }\r\n else if (o instanceof _abap_object_1.ABAPObject) {\r\n if (this.reg.isDependency(o)) {\r\n continue; // do not search in dependencies\r\n }\r\n const syntax = new syntax_1.SyntaxLogic(this.reg, o).run();\r\n this.findUses(syntax.spaghetti.getTop(), o);\r\n if (this.workarea.count() === 0) {\r\n return this.buildIssues(obj); // exit early if all types are used\r\n }\r\n }\r\n }\r\n return this.buildIssues(obj);\r\n }\r\n findUses(node, obj) {\r\n for (const r of node.getData().references) {\r\n if (r.referenceType === _reference_1.ReferenceType.DataReadReference\r\n || r.referenceType === _reference_1.ReferenceType.DataWriteReference\r\n || r.referenceType === _reference_1.ReferenceType.TypeReference) {\r\n this.workarea.removeIfExists(r.resolved);\r\n }\r\n }\r\n for (const c of node.getChildren()) {\r\n this.findUses(c, obj);\r\n }\r\n }\r\n buildWorkarea(node, obj) {\r\n var _a;\r\n const stype = node.getIdentifier().stype;\r\n if (stype === _scope_type_1.ScopeType.OpenSQL) {\r\n return;\r\n }\r\n for (const c of node.getChildren()) {\r\n this.buildWorkarea(c, obj);\r\n }\r\n if (stype !== _scope_type_1.ScopeType.BuiltIn) {\r\n const vars = node.getData().vars;\r\n for (const name in vars) {\r\n const meta = vars[name].getMeta();\r\n if (((_a = this.conf.skipNames) === null || _a === void 0 ? void 0 : _a.length) > 0\r\n && this.conf.skipNames.some((a) => a.toUpperCase() === name)) {\r\n continue;\r\n }\r\n else if (name === \"ME\"\r\n || name === \"SUPER\"\r\n || meta.includes(\"event_parameter\" /* EventParameter */)) {\r\n // todo, workaround for \"me\" and \"super\", these should somehow be typed to built-in\r\n continue;\r\n }\r\n const isInline = meta.includes(\"inline\" /* InlineDefinition */);\r\n this.workarea.push(vars[name], isInline ? 2 : 1);\r\n }\r\n }\r\n }\r\n buildIssues(obj) {\r\n const ret = [];\r\n for (const w of this.workarea.get()) {\r\n const filename = w.id.getFilename();\r\n if (this.reg.isFileDependency(filename) === true) {\r\n continue;\r\n }\r\n else if (obj instanceof objects_1.Program === false && obj.containsFile(filename) === false) {\r\n continue;\r\n }\r\n const statement = this.findStatement(w.id);\r\n if (statement === null || statement === void 0 ? void 0 : statement.getPragmas().map(t => t.getStr()).includes(this.getMetadata().pragma + \"\")) {\r\n continue;\r\n }\r\n else if (this.suppressedbyPseudo(statement, w.id, obj)) {\r\n continue;\r\n }\r\n const name = w.id.getName();\r\n const message = \"Variable \\\"\" + name.toLowerCase() + \"\\\" not used\";\r\n const fix = this.buildFix(w.id, obj);\r\n ret.push(issue_1.Issue.atIdentifier(w.id, message, this.getMetadata().key, this.conf.severity, fix));\r\n }\r\n return ret;\r\n }\r\n suppressedbyPseudo(statement, v, obj) {\r\n if (statement === undefined) {\r\n return false;\r\n }\r\n const file = obj.getABAPFileByName(v.getFilename());\r\n if (file === undefined) {\r\n return false;\r\n }\r\n let next = false;\r\n for (const s of file.getStatements()) {\r\n if (next === true && s.get() instanceof _statement_1.Comment) {\r\n return s.concatTokens().includes(this.getMetadata().pseudoComment + \"\");\r\n }\r\n if (s === statement) {\r\n next = true;\r\n }\r\n }\r\n return false;\r\n }\r\n findStatement(v) {\r\n const file = this.reg.getFileByName(v.getFilename());\r\n if (file === undefined) {\r\n return undefined;\r\n }\r\n const object = this.reg.findObjectForFile(file);\r\n if (!(object instanceof _abap_object_1.ABAPObject)) {\r\n return undefined;\r\n }\r\n const abapfile = object.getABAPFileByName(v.getFilename());\r\n if (abapfile === undefined) {\r\n return undefined;\r\n }\r\n const statement = edit_helper_1.EditHelper.findStatement(v.getToken(), abapfile);\r\n return statement;\r\n }\r\n buildFix(v, obj) {\r\n const file = obj.getABAPFileByName(v.getFilename());\r\n if (file === undefined) {\r\n return undefined;\r\n }\r\n const statement = edit_helper_1.EditHelper.findStatement(v.getToken(), file);\r\n if (statement === undefined) {\r\n return undefined;\r\n }\r\n else if (statement.get() instanceof Statements.Data) {\r\n return edit_helper_1.EditHelper.deleteStatement(file, statement);\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.UnusedVariables = UnusedVariables;\r\n//# sourceMappingURL=unused_variables.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/unused_variables.js?");
|
|
12702
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UnusedVariables = exports.UnusedVariablesConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nclass UnusedVariablesConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** skip specific names, case insensitive\r\n * @uniqueItems true\r\n */\r\n this.skipNames = [];\r\n }\r\n}\r\nexports.UnusedVariablesConf = UnusedVariablesConf;\r\nclass WorkArea {\r\n constructor() {\r\n this.workarea = [];\r\n }\r\n push(id, count = 1) {\r\n for (const w of this.workarea) {\r\n if (id.equals(w.id)) {\r\n return;\r\n }\r\n }\r\n this.workarea.push({ id, count });\r\n }\r\n removeIfExists(id) {\r\n if (id === undefined) {\r\n return;\r\n }\r\n for (let i = 0; i < this.workarea.length; i++) {\r\n if (id.equals(this.workarea[i].id)) {\r\n this.workarea[i].count--;\r\n if (this.workarea[i].count === 0) {\r\n this.workarea.splice(i, 1);\r\n }\r\n return;\r\n }\r\n }\r\n }\r\n get() {\r\n return this.workarea;\r\n }\r\n count() {\r\n return this.workarea.length;\r\n }\r\n}\r\nclass UnusedVariables {\r\n constructor() {\r\n this.conf = new UnusedVariablesConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"unused_variables\",\r\n title: \"Unused variables\",\r\n shortDescription: `Checks for unused variables and constants`,\r\n extendedInformation: `WARNING: slow\r\n\r\nExperimental, might give false positives. Skips event parameters.\r\n\r\nNote that this currently does not work if the source code uses macros.\r\n\r\nUnused variables are not reported if the object contains syntax errors. Errors found in INCLUDES are reported for the main program.`,\r\n tags: [_irule_1.RuleTag.Quickfix],\r\n pragma: \"##NEEDED\",\r\n pseudoComment: \"EC NEEDED\",\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n if (this.conf.skipNames === undefined) {\r\n this.conf.skipNames = [];\r\n }\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof _abap_object_1.ABAPObject)) {\r\n return [];\r\n }\r\n else if (obj instanceof objects_1.Interface) { // todo, how to handle interfaces?\r\n return [];\r\n }\r\n // dont report unused variables when there are syntax errors\r\n const syntax = new syntax_1.SyntaxLogic(this.reg, obj).run();\r\n if (syntax.issues.length > 0) {\r\n return [];\r\n }\r\n this.workarea = new WorkArea();\r\n const top = syntax.spaghetti.getTop();\r\n this.buildWorkarea(top, obj);\r\n if (this.workarea.count() === 0) {\r\n return this.buildIssues(obj); // exit early if all types are used\r\n }\r\n this.findUses(top, obj);\r\n for (const o of this.reg.getObjects()) {\r\n if (o === obj) {\r\n continue;\r\n }\r\n else if (o instanceof _abap_object_1.ABAPObject) {\r\n if (this.reg.isDependency(o)) {\r\n continue; // do not search in dependencies\r\n }\r\n const syntax = new syntax_1.SyntaxLogic(this.reg, o).run();\r\n this.findUses(syntax.spaghetti.getTop(), o);\r\n if (this.workarea.count() === 0) {\r\n return this.buildIssues(obj); // exit early if all types are used\r\n }\r\n }\r\n }\r\n return this.buildIssues(obj);\r\n }\r\n findUses(node, obj) {\r\n for (const r of node.getData().references) {\r\n if (r.referenceType === _reference_1.ReferenceType.DataReadReference\r\n || r.referenceType === _reference_1.ReferenceType.DataWriteReference\r\n || r.referenceType === _reference_1.ReferenceType.TypeReference) {\r\n this.workarea.removeIfExists(r.resolved);\r\n }\r\n }\r\n for (const c of node.getChildren()) {\r\n this.findUses(c, obj);\r\n }\r\n }\r\n buildWorkarea(node, obj) {\r\n var _a;\r\n const stype = node.getIdentifier().stype;\r\n if (stype === _scope_type_1.ScopeType.OpenSQL) {\r\n return;\r\n }\r\n for (const c of node.getChildren()) {\r\n this.buildWorkarea(c, obj);\r\n }\r\n if (stype !== _scope_type_1.ScopeType.BuiltIn) {\r\n const vars = node.getData().vars;\r\n for (const name in vars) {\r\n const meta = vars[name].getMeta();\r\n if (((_a = this.conf.skipNames) === null || _a === void 0 ? void 0 : _a.length) > 0\r\n && this.conf.skipNames.some((a) => a.toUpperCase() === name)) {\r\n continue;\r\n }\r\n else if (name === \"ME\"\r\n || name === \"SUPER\"\r\n || meta.includes(\"event_parameter\" /* EventParameter */)) {\r\n // todo, workaround for \"me\" and \"super\", these should somehow be typed to built-in\r\n continue;\r\n }\r\n const isInline = meta.includes(\"inline\" /* InlineDefinition */);\r\n this.workarea.push(vars[name], isInline ? 2 : 1);\r\n }\r\n }\r\n }\r\n buildIssues(obj) {\r\n const ret = [];\r\n for (const w of this.workarea.get()) {\r\n const filename = w.id.getFilename();\r\n if (this.reg.isFileDependency(filename) === true) {\r\n continue;\r\n }\r\n else if (obj instanceof objects_1.Program === false && obj.containsFile(filename) === false) {\r\n continue;\r\n }\r\n const statement = this.findStatement(w.id);\r\n if (statement === null || statement === void 0 ? void 0 : statement.getPragmas().map(t => t.getStr()).includes(this.getMetadata().pragma + \"\")) {\r\n continue;\r\n }\r\n else if (this.suppressedbyPseudo(statement, w.id, obj)) {\r\n continue;\r\n }\r\n const name = w.id.getName();\r\n const message = \"Variable \\\"\" + name.toLowerCase() + \"\\\" not used\";\r\n const fix = this.buildFix(w.id, obj);\r\n ret.push(issue_1.Issue.atIdentifier(w.id, message, this.getMetadata().key, this.conf.severity, fix));\r\n }\r\n return ret;\r\n }\r\n suppressedbyPseudo(statement, v, obj) {\r\n if (statement === undefined) {\r\n return false;\r\n }\r\n const file = obj.getABAPFileByName(v.getFilename());\r\n if (file === undefined) {\r\n return false;\r\n }\r\n let next = false;\r\n for (const s of file.getStatements()) {\r\n if (next === true && s.get() instanceof _statement_1.Comment) {\r\n return s.concatTokens().includes(this.getMetadata().pseudoComment + \"\");\r\n }\r\n if (s === statement) {\r\n next = true;\r\n }\r\n }\r\n return false;\r\n }\r\n findStatement(v) {\r\n const file = this.reg.getFileByName(v.getFilename());\r\n if (file === undefined) {\r\n return undefined;\r\n }\r\n const object = this.reg.findObjectForFile(file);\r\n if (!(object instanceof _abap_object_1.ABAPObject)) {\r\n return undefined;\r\n }\r\n const abapfile = object.getABAPFileByName(v.getFilename());\r\n if (abapfile === undefined) {\r\n return undefined;\r\n }\r\n const statement = edit_helper_1.EditHelper.findStatement(v.getToken(), abapfile);\r\n return statement;\r\n }\r\n buildFix(v, obj) {\r\n const file = obj.getABAPFileByName(v.getFilename());\r\n if (file === undefined) {\r\n return undefined;\r\n }\r\n const statement = edit_helper_1.EditHelper.findStatement(v.getToken(), file);\r\n if (statement === undefined) {\r\n return undefined;\r\n }\r\n else if (statement.get() instanceof Statements.Data) {\r\n return edit_helper_1.EditHelper.deleteStatement(file, statement);\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.UnusedVariables = UnusedVariables;\r\n//# sourceMappingURL=unused_variables.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/unused_variables.js?");
|
|
12703
12703
|
|
|
12704
12704
|
/***/ }),
|
|
12705
12705
|
|
|
@@ -12710,7 +12710,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12710
12710
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12711
12711
|
|
|
12712
12712
|
"use strict";
|
|
12713
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UseBoolExpression = exports.UseBoolExpressionConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\n// note this rule assumes abap_true and abap_false is used for boolean variables\r\n// some other rule will in the future find assignments to abap_bool that are not abap_true/abap_false/abap_undefined\r\nclass UseBoolExpressionConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.UseBoolExpressionConf = UseBoolExpressionConf;\r\nclass UseBoolExpression extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new UseBoolExpressionConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"use_bool_expression\",\r\n title: \"Use boolean expression\",\r\n shortDescription: `Use boolean expression, xsdbool from 740sp08 and up, boolc from 702 and up`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-xsdbool-to-set-boolean-variables`,\r\n tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n badExample: `IF line IS INITIAL.\n has_entries = abap_false.\nELSE.\n has_entries = abap_true.\nENDIF.\n\nDATA(fsdf) = COND #( WHEN foo <> bar THEN abap_true ELSE abap_false ).`,\r\n goodExample: `DATA(has_entries) = xsdbool( line IS NOT INITIAL ).\n\nDATA(fsdf) = xsdbool( foo <> bar ).`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n var _a, _b, _c, _d, _e, _f, _g, _h, _j;\r\n const issues = [];\r\n const stru = file.getStructure();\r\n const version = this.reg.getConfig().getVersion();\r\n if (stru === undefined || (version < version_1.Version.v702 && version !== version_1.Version.Cloud)) {\r\n return [];\r\n }\r\n for (const i of stru.findAllStructures(Structures.If)) {\r\n if (i.findDirectStructure(Structures.ElseIf) !== undefined) {\r\n continue;\r\n }\r\n const bodyNodes = (_a = i.findDirectStructure(Structures.Body)) === null || _a === void 0 ? void 0 : _a.findAllStatementNodes();\r\n if (bodyNodes === undefined || bodyNodes.length !== 1) {\r\n continue;\r\n }\r\n const bodyStatement = bodyNodes[0];\r\n if (!(bodyStatement.get() instanceof Statements.Move)) {\r\n continue;\r\n }\r\n const elseNodes = (_c = (_b = i.findDirectStructure(Structures.Else)) === null || _b === void 0 ? void 0 : _b.findDirectStructure(Structures.Body)) === null || _c === void 0 ? void 0 : _c.findAllStatementNodes();\r\n if (elseNodes === undefined || elseNodes.length !== 1) {\r\n continue;\r\n }\r\n const elseStatement = elseNodes[0];\r\n if (!(elseStatement.get() instanceof Statements.Move)) {\r\n continue;\r\n }\r\n let bodyTarget = (_d = bodyStatement.findFirstExpression(Expressions.Target)) === null || _d === void 0 ? void 0 : _d.concatTokens();\r\n if (bodyTarget === null || bodyTarget === void 0 ? void 0 : bodyTarget.startsWith(\"DATA(\")) {\r\n bodyTarget = bodyTarget.substr(5, bodyTarget.length - 6);\r\n }\r\n const elseTarget = (_e = elseStatement.findFirstExpression(Expressions.Target)) === null || _e === void 0 ? void 0 : _e.concatTokens();\r\n if (bodyTarget === undefined\r\n || elseTarget === undefined\r\n || bodyTarget.toUpperCase() !== elseTarget.toUpperCase()) {\r\n continue;\r\n }\r\n const bodySource = (_f = bodyStatement.findFirstExpression(Expressions.Source)) === null || _f === void 0 ? void 0 : _f.concatTokens().toUpperCase();\r\n const elseSource = (_g = elseStatement.findFirstExpression(Expressions.Source)) === null || _g === void 0 ? void 0 : _g.concatTokens().toUpperCase();\r\n if ((bodySource === \"ABAP_TRUE\" && elseSource === \"ABAP_FALSE\")\r\n || (bodySource === \"ABAP_FALSE\" && elseSource === \"ABAP_TRUE\")) {\r\n const func = (this.reg.getConfig().getVersion() >= version_1.Version.v740sp08\r\n || this.reg.getConfig().getVersion() === version_1.Version.Cloud) ? \"xsdbool\" : \"boolc\";\r\n const negate = bodySource === \"ABAP_FALSE\";\r\n const message = `Use ${func} instead of IF` + (negate ? \", negate expression\" : \"\");\r\n const start = i.getFirstToken().getStart();\r\n const end = i.getLastToken().getEnd();\r\n const statement = bodyTarget + \" = \" + func + \"( \" +\r\n (negate ? \"NOT ( \" : \"\") +\r\n ((_j = (_h = i.findFirstStatement(Statements.If)) === null || _h === void 0 ? void 0 : _h.findFirstExpression(Expressions.Cond)) === null || _j === void 0 ? void 0 : _j.concatTokens()) +\r\n (negate ? \" )\" : \"\") +\r\n \" ).\";\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, start, end, statement);\r\n issues.push(issue_1.Issue.atRange(file, start, end, message, this.getMetadata().key, this.conf.severity, fix));\r\n }\r\n }\r\n if (version >= version_1.Version.v740sp08 || version === version_1.Version.Cloud) {\r\n for (const b of stru.findAllExpressions(Expressions.CondBody)) {\r\n const concat = b.concatTokens().toUpperCase();\r\n if (concat.endsWith(\" THEN ABAP_TRUE ELSE ABAP_FALSE\")\r\n || concat.endsWith(\" THEN ABAP_TRUE\")\r\n || concat.endsWith(\" THEN ABAP_FALSE ELSE ABAP_TRUE\")) {\r\n const message = \"Use xsdbool\";\r\n // eslint-disable-next-line max-len\r\n issues.push(issue_1.Issue.atRange(file, b.getFirstToken().getStart(), b.getLastToken().getEnd(), message, this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.UseBoolExpression = UseBoolExpression;\r\n//# sourceMappingURL=use_bool_expression.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/use_bool_expression.js?");
|
|
12713
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UseBoolExpression = exports.UseBoolExpressionConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\n// note this rule assumes abap_true and abap_false is used for boolean variables\r\n// some other rule will in the future find assignments to abap_bool that are not abap_true/abap_false/abap_undefined\r\nclass UseBoolExpressionConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.UseBoolExpressionConf = UseBoolExpressionConf;\r\nclass UseBoolExpression extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new UseBoolExpressionConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"use_bool_expression\",\r\n title: \"Use boolean expression\",\r\n shortDescription: `Use boolean expression, xsdbool from 740sp08 and up, boolc from 702 and up`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-xsdbool-to-set-boolean-variables`,\r\n tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n badExample: `IF line IS INITIAL.\r\n has_entries = abap_false.\r\nELSE.\r\n has_entries = abap_true.\r\nENDIF.\r\n\r\nDATA(fsdf) = COND #( WHEN foo <> bar THEN abap_true ELSE abap_false ).`,\r\n goodExample: `DATA(has_entries) = xsdbool( line IS NOT INITIAL ).\r\n\r\nDATA(fsdf) = xsdbool( foo <> bar ).`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n var _a, _b, _c, _d, _e, _f, _g, _h, _j;\r\n const issues = [];\r\n const stru = file.getStructure();\r\n const version = this.reg.getConfig().getVersion();\r\n if (stru === undefined || (version < version_1.Version.v702 && version !== version_1.Version.Cloud)) {\r\n return [];\r\n }\r\n for (const i of stru.findAllStructures(Structures.If)) {\r\n if (i.findDirectStructure(Structures.ElseIf) !== undefined) {\r\n continue;\r\n }\r\n const bodyNodes = (_a = i.findDirectStructure(Structures.Body)) === null || _a === void 0 ? void 0 : _a.findAllStatementNodes();\r\n if (bodyNodes === undefined || bodyNodes.length !== 1) {\r\n continue;\r\n }\r\n const bodyStatement = bodyNodes[0];\r\n if (!(bodyStatement.get() instanceof Statements.Move)) {\r\n continue;\r\n }\r\n const elseNodes = (_c = (_b = i.findDirectStructure(Structures.Else)) === null || _b === void 0 ? void 0 : _b.findDirectStructure(Structures.Body)) === null || _c === void 0 ? void 0 : _c.findAllStatementNodes();\r\n if (elseNodes === undefined || elseNodes.length !== 1) {\r\n continue;\r\n }\r\n const elseStatement = elseNodes[0];\r\n if (!(elseStatement.get() instanceof Statements.Move)) {\r\n continue;\r\n }\r\n let bodyTarget = (_d = bodyStatement.findFirstExpression(Expressions.Target)) === null || _d === void 0 ? void 0 : _d.concatTokens();\r\n if (bodyTarget === null || bodyTarget === void 0 ? void 0 : bodyTarget.startsWith(\"DATA(\")) {\r\n bodyTarget = bodyTarget.substr(5, bodyTarget.length - 6);\r\n }\r\n const elseTarget = (_e = elseStatement.findFirstExpression(Expressions.Target)) === null || _e === void 0 ? void 0 : _e.concatTokens();\r\n if (bodyTarget === undefined\r\n || elseTarget === undefined\r\n || bodyTarget.toUpperCase() !== elseTarget.toUpperCase()) {\r\n continue;\r\n }\r\n const bodySource = (_f = bodyStatement.findFirstExpression(Expressions.Source)) === null || _f === void 0 ? void 0 : _f.concatTokens().toUpperCase();\r\n const elseSource = (_g = elseStatement.findFirstExpression(Expressions.Source)) === null || _g === void 0 ? void 0 : _g.concatTokens().toUpperCase();\r\n if ((bodySource === \"ABAP_TRUE\" && elseSource === \"ABAP_FALSE\")\r\n || (bodySource === \"ABAP_FALSE\" && elseSource === \"ABAP_TRUE\")) {\r\n const func = (this.reg.getConfig().getVersion() >= version_1.Version.v740sp08\r\n || this.reg.getConfig().getVersion() === version_1.Version.Cloud) ? \"xsdbool\" : \"boolc\";\r\n const negate = bodySource === \"ABAP_FALSE\";\r\n const message = `Use ${func} instead of IF` + (negate ? \", negate expression\" : \"\");\r\n const start = i.getFirstToken().getStart();\r\n const end = i.getLastToken().getEnd();\r\n const statement = bodyTarget + \" = \" + func + \"( \" +\r\n (negate ? \"NOT ( \" : \"\") +\r\n ((_j = (_h = i.findFirstStatement(Statements.If)) === null || _h === void 0 ? void 0 : _h.findFirstExpression(Expressions.Cond)) === null || _j === void 0 ? void 0 : _j.concatTokens()) +\r\n (negate ? \" )\" : \"\") +\r\n \" ).\";\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, start, end, statement);\r\n issues.push(issue_1.Issue.atRange(file, start, end, message, this.getMetadata().key, this.conf.severity, fix));\r\n }\r\n }\r\n if (version >= version_1.Version.v740sp08 || version === version_1.Version.Cloud) {\r\n for (const b of stru.findAllExpressions(Expressions.CondBody)) {\r\n const concat = b.concatTokens().toUpperCase();\r\n if (concat.endsWith(\" THEN ABAP_TRUE ELSE ABAP_FALSE\")\r\n || concat.endsWith(\" THEN ABAP_TRUE\")\r\n || concat.endsWith(\" THEN ABAP_FALSE ELSE ABAP_TRUE\")) {\r\n const message = \"Use xsdbool\";\r\n // eslint-disable-next-line max-len\r\n issues.push(issue_1.Issue.atRange(file, b.getFirstToken().getStart(), b.getLastToken().getEnd(), message, this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.UseBoolExpression = UseBoolExpression;\r\n//# sourceMappingURL=use_bool_expression.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/use_bool_expression.js?");
|
|
12714
12714
|
|
|
12715
12715
|
/***/ }),
|
|
12716
12716
|
|
|
@@ -12732,7 +12732,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12732
12732
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12733
12733
|
|
|
12734
12734
|
"use strict";
|
|
12735
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UseLineExists = exports.UseLineExistsConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nclass UseLineExistsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.UseLineExistsConf = UseLineExistsConf;\r\nclass UseLineExists extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new UseLineExistsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"use_line_exists\",\r\n title: \"Use line_exists\",\r\n shortDescription: `Use line_exists, from 740sp02 and up`,\r\n extendedInformation: `\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-line_exists-to-read-table-or-loop-at\n\nNot reported if the READ TABLE statement contains BINARY SEARCH.`,\r\n tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n badExample: `READ TABLE my_table TRANSPORTING NO FIELDS WITH KEY key = 'A'.\nIF sy-subrc = 0.\nENDIF.`,\r\n goodExample: `IF line_exists( my_table[ key = 'A' ] ).\nENDIF.`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file, obj) {\r\n const issues = [];\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n const vers = this.reg.getConfig().getVersion();\r\n if (vers === version_1.Version.OpenABAP) {\r\n return [];\r\n }\r\n else if (vers < version_1.Version.v740sp02 && vers !== version_1.Version.Cloud) {\r\n return [];\r\n }\r\n const statements = file.getStatements();\r\n for (let i = 0; i < statements.length; i++) {\r\n const statement = statements[i];\r\n if (!(statement.get() instanceof Statements.ReadTable)) {\r\n continue;\r\n }\r\n const concat = statement.concatTokens().toUpperCase();\r\n if (concat.includes(\" TRANSPORTING NO FIELDS\") === true\r\n && concat.includes(\" BINARY SEARCH\") === false\r\n && this.checksSubrc(i, statements) === true\r\n && this.usesTabix(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, \"Use line_exists\", this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n return issues;\r\n }\r\n ///////////////////////\r\n checksSubrc(index, statements) {\r\n for (let i = index + 1; i < statements.length; i++) {\r\n const statement = statements[i];\r\n if (statement.get() instanceof _statement_1.Comment) {\r\n continue;\r\n }\r\n for (const c of statement.findAllExpressions(Expressions.Cond)) {\r\n for (const s of c.findAllExpressions(Expressions.Source)) {\r\n if (s.concatTokens().toUpperCase() === \"SY-SUBRC\") {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n return false;\r\n }\r\n // this is a heuristic, data flow analysis is required to get the correct result\r\n usesTabix(index, statements) {\r\n for (let i = index + 1; i < index + 5; i++) {\r\n const statement = statements[i];\r\n if (statement === undefined) {\r\n break;\r\n }\r\n else if (statement.get() instanceof _statement_1.Comment) {\r\n continue;\r\n }\r\n else if (statement.concatTokens().toUpperCase().includes(\" SY-TABIX\")) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\nexports.UseLineExists = UseLineExists;\r\n//# sourceMappingURL=use_line_exists.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/use_line_exists.js?");
|
|
12735
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UseLineExists = exports.UseLineExistsConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nclass UseLineExistsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.UseLineExistsConf = UseLineExistsConf;\r\nclass UseLineExists extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new UseLineExistsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"use_line_exists\",\r\n title: \"Use line_exists\",\r\n shortDescription: `Use line_exists, from 740sp02 and up`,\r\n extendedInformation: `\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-line_exists-to-read-table-or-loop-at\r\n\r\nNot reported if the READ TABLE statement contains BINARY SEARCH.`,\r\n tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n badExample: `READ TABLE my_table TRANSPORTING NO FIELDS WITH KEY key = 'A'.\r\nIF sy-subrc = 0.\r\nENDIF.`,\r\n goodExample: `IF line_exists( my_table[ key = 'A' ] ).\r\nENDIF.`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file, obj) {\r\n const issues = [];\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n const vers = this.reg.getConfig().getVersion();\r\n if (vers === version_1.Version.OpenABAP) {\r\n return [];\r\n }\r\n else if (vers < version_1.Version.v740sp02 && vers !== version_1.Version.Cloud) {\r\n return [];\r\n }\r\n const statements = file.getStatements();\r\n for (let i = 0; i < statements.length; i++) {\r\n const statement = statements[i];\r\n if (!(statement.get() instanceof Statements.ReadTable)) {\r\n continue;\r\n }\r\n const concat = statement.concatTokens().toUpperCase();\r\n if (concat.includes(\" TRANSPORTING NO FIELDS\") === true\r\n && concat.includes(\" BINARY SEARCH\") === false\r\n && this.checksSubrc(i, statements) === true\r\n && this.usesTabix(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, \"Use line_exists\", this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n return issues;\r\n }\r\n ///////////////////////\r\n checksSubrc(index, statements) {\r\n for (let i = index + 1; i < statements.length; i++) {\r\n const statement = statements[i];\r\n if (statement.get() instanceof _statement_1.Comment) {\r\n continue;\r\n }\r\n for (const c of statement.findAllExpressions(Expressions.Cond)) {\r\n for (const s of c.findAllExpressions(Expressions.Source)) {\r\n if (s.concatTokens().toUpperCase() === \"SY-SUBRC\") {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n return false;\r\n }\r\n // this is a heuristic, data flow analysis is required to get the correct result\r\n usesTabix(index, statements) {\r\n for (let i = index + 1; i < index + 5; i++) {\r\n const statement = statements[i];\r\n if (statement === undefined) {\r\n break;\r\n }\r\n else if (statement.get() instanceof _statement_1.Comment) {\r\n continue;\r\n }\r\n else if (statement.concatTokens().toUpperCase().includes(\" SY-TABIX\")) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\nexports.UseLineExists = UseLineExists;\r\n//# sourceMappingURL=use_line_exists.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/use_line_exists.js?");
|
|
12736
12736
|
|
|
12737
12737
|
/***/ }),
|
|
12738
12738
|
|
|
@@ -12743,7 +12743,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12743
12743
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12744
12744
|
|
|
12745
12745
|
"use strict";
|
|
12746
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UseNew = exports.UseNewConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass UseNewConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.UseNewConf = UseNewConf;\r\nclass UseNew extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new UseNewConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"use_new\",\r\n title: \"Use NEW\",\r\n shortDescription: `Checks for deprecated CREATE OBJECT statements.`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-new-to-create-object\n\nIf the target variable is referenced in the CREATE OBJECT statement, no errors are issued`,\r\n badExample: `CREATE OBJECT ref.`,\r\n goodExample: `ref = NEW #( ).`,\r\n tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getMessage() {\r\n return \"Use NEW #( ) to instantiate object.\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file, obj) {\r\n var _a;\r\n const issues = [];\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n if (this.reg.getConfig().getVersion() < version_1.Version.v740sp02 && this.reg.getConfig().getVersion() !== version_1.Version.Cloud) {\r\n return [];\r\n }\r\n for (const statement of file.getStatements()) {\r\n if (statement.get() instanceof Statements.CreateObject) {\r\n if (statement.findFirstExpression(expressions_1.Dynamic)) {\r\n continue;\r\n }\r\n else if (statement.findDirectExpression(expressions_1.ParameterListExceptions)) {\r\n continue;\r\n }\r\n const target = ((_a = statement.findDirectExpression(expressions_1.Target)) === null || _a === void 0 ? void 0 : _a.concatTokens()) + \"->\";\r\n if (statement.concatTokens().includes(target)) {\r\n continue;\r\n }\r\n const fix = this.buildFix(file, statement);\r\n const issue = issue_1.Issue.atPosition(file, statement.getStart(), this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n buildFix(file, statement) {\r\n var _a, _b;\r\n const target = (_a = statement.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n if (target === undefined) {\r\n return undefined;\r\n }\r\n const parameters = statement.findDirectExpression(Expressions.ParameterListS);\r\n const param = parameters ? parameters.concatTokens() + \" \" : \"\";\r\n let type = (_b = statement.findDirectExpression(Expressions.ClassName)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr();\r\n if (type === undefined) {\r\n type = \"#\";\r\n }\r\n const string = `${target} = NEW ${type}( ${param}).`;\r\n return edit_helper_1.EditHelper.replaceRange(file, statement.getStart(), statement.getEnd(), string);\r\n }\r\n}\r\nexports.UseNew = UseNew;\r\n//# sourceMappingURL=use_new.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/use_new.js?");
|
|
12746
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UseNew = exports.UseNewConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass UseNewConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.UseNewConf = UseNewConf;\r\nclass UseNew extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new UseNewConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"use_new\",\r\n title: \"Use NEW\",\r\n shortDescription: `Checks for deprecated CREATE OBJECT statements.`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-new-to-create-object\r\n\r\nIf the target variable is referenced in the CREATE OBJECT statement, no errors are issued`,\r\n badExample: `CREATE OBJECT ref.`,\r\n goodExample: `ref = NEW #( ).`,\r\n tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getMessage() {\r\n return \"Use NEW #( ) to instantiate object.\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file, obj) {\r\n var _a;\r\n const issues = [];\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n if (this.reg.getConfig().getVersion() < version_1.Version.v740sp02 && this.reg.getConfig().getVersion() !== version_1.Version.Cloud) {\r\n return [];\r\n }\r\n for (const statement of file.getStatements()) {\r\n if (statement.get() instanceof Statements.CreateObject) {\r\n if (statement.findFirstExpression(expressions_1.Dynamic)) {\r\n continue;\r\n }\r\n else if (statement.findDirectExpression(expressions_1.ParameterListExceptions)) {\r\n continue;\r\n }\r\n const target = ((_a = statement.findDirectExpression(expressions_1.Target)) === null || _a === void 0 ? void 0 : _a.concatTokens()) + \"->\";\r\n if (statement.concatTokens().includes(target)) {\r\n continue;\r\n }\r\n const fix = this.buildFix(file, statement);\r\n const issue = issue_1.Issue.atPosition(file, statement.getStart(), this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n buildFix(file, statement) {\r\n var _a, _b;\r\n const target = (_a = statement.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n if (target === undefined) {\r\n return undefined;\r\n }\r\n const parameters = statement.findDirectExpression(Expressions.ParameterListS);\r\n const param = parameters ? parameters.concatTokens() + \" \" : \"\";\r\n let type = (_b = statement.findDirectExpression(Expressions.ClassName)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr();\r\n if (type === undefined) {\r\n type = \"#\";\r\n }\r\n const string = `${target} = NEW ${type}( ${param}).`;\r\n return edit_helper_1.EditHelper.replaceRange(file, statement.getStart(), statement.getEnd(), string);\r\n }\r\n}\r\nexports.UseNew = UseNew;\r\n//# sourceMappingURL=use_new.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/use_new.js?");
|
|
12747
12747
|
|
|
12748
12748
|
/***/ }),
|
|
12749
12749
|
|
|
@@ -12754,7 +12754,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12754
12754
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12755
12755
|
|
|
12756
12756
|
"use strict";
|
|
12757
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.WhenOthersLast = exports.WhenOthersLastConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass WhenOthersLastConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.WhenOthersLastConf = WhenOthersLastConf;\r\nclass WhenOthersLast extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new WhenOthersLastConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"when_others_last\",\r\n title: \"WHEN OTHERS last\",\r\n shortDescription: `Checks that WHEN OTHERS is placed the last within a CASE statement.`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: `CASE bar.\n WHEN OTHERS.\n WHEN 2.\nENDCASE.`,\r\n goodExample: `CASE bar.\n WHEN 2.\n WHEN OTHERS.\nENDCASE.`,\r\n };\r\n }\r\n getMessage() {\r\n return \"WHEN OTHERS should be the last branch in a CASE statement.\";\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n const struc = file.getStructure();\r\n if (struc === undefined) {\r\n return [];\r\n }\r\n const cases = struc.findAllStructures(Structures.Case);\r\n for (const c of cases) {\r\n const whentop = c.findDirectStructures(Structures.When);\r\n for (let i = 0; i < whentop.length - 1; i++) {\r\n const whens = whentop[i].findDirectStatements(Statements.When).concat(whentop[i].findDirectStatements(Statements.WhenOthers));\r\n for (const when of whens) {\r\n if (when.get() instanceof Statements.WhenOthers) {\r\n const start = when.getFirstToken().getStart();\r\n const issue = issue_1.Issue.atPosition(file, start, this.getMessage(), this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n}\r\nexports.WhenOthersLast = WhenOthersLast;\r\n//# sourceMappingURL=when_others_last.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/when_others_last.js?");
|
|
12757
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.WhenOthersLast = exports.WhenOthersLastConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass WhenOthersLastConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.WhenOthersLastConf = WhenOthersLastConf;\r\nclass WhenOthersLast extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new WhenOthersLastConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"when_others_last\",\r\n title: \"WHEN OTHERS last\",\r\n shortDescription: `Checks that WHEN OTHERS is placed the last within a CASE statement.`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: `CASE bar.\r\n WHEN OTHERS.\r\n WHEN 2.\r\nENDCASE.`,\r\n goodExample: `CASE bar.\r\n WHEN 2.\r\n WHEN OTHERS.\r\nENDCASE.`,\r\n };\r\n }\r\n getMessage() {\r\n return \"WHEN OTHERS should be the last branch in a CASE statement.\";\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n const struc = file.getStructure();\r\n if (struc === undefined) {\r\n return [];\r\n }\r\n const cases = struc.findAllStructures(Structures.Case);\r\n for (const c of cases) {\r\n const whentop = c.findDirectStructures(Structures.When);\r\n for (let i = 0; i < whentop.length - 1; i++) {\r\n const whens = whentop[i].findDirectStatements(Statements.When).concat(whentop[i].findDirectStatements(Statements.WhenOthers));\r\n for (const when of whens) {\r\n if (when.get() instanceof Statements.WhenOthers) {\r\n const start = when.getFirstToken().getStart();\r\n const issue = issue_1.Issue.atPosition(file, start, this.getMessage(), this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n}\r\nexports.WhenOthersLast = WhenOthersLast;\r\n//# sourceMappingURL=when_others_last.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/when_others_last.js?");
|
|
12758
12758
|
|
|
12759
12759
|
/***/ }),
|
|
12760
12760
|
|