@abaplint/core 2.85.16 → 2.85.20

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.
@@ -3824,11 +3824,19 @@ declare class Normal implements IStructure {
3824
3824
  }
3825
3825
 
3826
3826
  declare class NumberRange extends AbstractObject {
3827
+ private parsedXML;
3827
3828
  getType(): string;
3828
3829
  getAllowedNaming(): {
3829
3830
  maxLength: number;
3830
3831
  allowNamespace: boolean;
3831
3832
  };
3833
+ getDomain(): string | undefined;
3834
+ getPercentage(): number | undefined;
3835
+ setDirty(): void;
3836
+ parse(): {
3837
+ updated: boolean;
3838
+ runtime: number;
3839
+ };
3832
3840
  getDescription(): string | undefined;
3833
3841
  }
3834
3842
 
@@ -4547,6 +4555,7 @@ export declare enum ScopeType {
4547
4555
  Method = "method",
4548
4556
  MethodInstance = "method_instance",
4549
4557
  For = "for",
4558
+ Let = "let",
4550
4559
  OpenSQL = "open_sql"
4551
4560
  }
4552
4561
 
@@ -5,7 +5,7 @@ const combi_1 = require("../combi");
5
5
  const _1 = require(".");
6
6
  class CondBody extends combi_1.Expression {
7
7
  getRunnable() {
8
- const when = (0, combi_1.seq)("WHEN", _1.Cond, "THEN", (0, combi_1.alt)(_1.Source, _1.Throw));
8
+ const when = (0, combi_1.seq)("WHEN", (0, combi_1.alt)(_1.Cond, _1.Source), "THEN", (0, combi_1.alt)(_1.Source, _1.Throw));
9
9
  const elsee = (0, combi_1.seq)("ELSE", (0, combi_1.alt)(_1.Source, _1.Throw));
10
10
  return (0, combi_1.seq)((0, combi_1.opt)(_1.Let), (0, combi_1.plus)(when), (0, combi_1.opt)(elsee));
11
11
  }
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ReduceNext = void 0;
4
4
  const combi_1 = require("../combi");
5
5
  const _1 = require(".");
6
+ const tokens_1 = require("../../1_lexer/tokens");
6
7
  class ReduceNext extends combi_1.Expression {
7
8
  getRunnable() {
8
- const fields = (0, combi_1.seq)(_1.Field, "=", _1.Source);
9
+ const fields = (0, combi_1.seq)(_1.Field, (0, combi_1.altPrio)("=", (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WPlus), "=")), _1.Source);
9
10
  return (0, combi_1.seq)("NEXT", (0, combi_1.plus)(fields));
10
11
  }
11
12
  }
@@ -19,7 +19,7 @@ class Select extends combi_1.Expression {
19
19
  const fields = (0, combi_1.seq)("FIELDS", _1.SQLFieldList);
20
20
  const perm = (0, combi_1.per)(_1.SQLFrom, into, _1.SQLForAllEntries, where, _1.SQLOrderBy, up, offset, client, _1.SQLHaving, bypass, sql_group_by_1.SQLGroupBy, fields, _1.DatabaseConnection);
21
21
  const paren = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), sql_field_name_1.SQLFieldName, (0, combi_1.tok)(tokens_1.WParenRightW));
22
- const ret = (0, combi_1.seq)("SELECT", (0, combi_1.altPrio)("DISTINCT", (0, combi_1.optPrio)((0, combi_1.seq)("SINGLE", (0, combi_1.optPrio)("FOR UPDATE")))), (0, combi_1.optPrio)((0, combi_1.altPrio)(_1.SQLFieldList, paren)), perm);
22
+ const ret = (0, combi_1.seq)("SELECT", (0, combi_1.altPrio)("DISTINCT", (0, combi_1.optPrio)((0, combi_1.seq)("SINGLE", (0, combi_1.optPrio)("FOR UPDATE")))), (0, combi_1.optPrio)((0, combi_1.altPrio)(_1.SQLFieldList, paren)), perm, (0, combi_1.optPrio)(_1.SQLHints));
23
23
  return ret;
24
24
  }
25
25
  }
@@ -13,7 +13,7 @@ class TypeTable extends combi_1.Expression {
13
13
  const likeType = (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.alt)("STANDARD", "HASHED", "INDEX", "SORTED", "ANY")), "TABLE OF", (0, combi_1.optPrio)("REF TO"), (0, combi_1.opt)(field_chain_1.FieldChain), (0, combi_1.opt)((0, combi_1.per)(header, initial, (0, combi_1.plusPrio)(type_table_key_1.TypeTableKey))));
14
14
  const rangeType = (0, combi_1.seq)("RANGE OF", _1.TypeName, (0, combi_1.opt)(header), (0, combi_1.opt)(initial));
15
15
  const rangeLike = (0, combi_1.seq)("RANGE OF", _1.SimpleFieldChain, (0, combi_1.opt)(header), (0, combi_1.opt)(initial));
16
- const typetable = (0, combi_1.seq)(normal1, (0, combi_1.opt)((0, combi_1.per)(header, initial, (0, combi_1.plusPrio)(type_table_key_1.TypeTableKey))));
16
+ const typetable = (0, combi_1.seq)(normal1, (0, combi_1.alt)((0, combi_1.opt)((0, combi_1.per)(header, initial, (0, combi_1.plusPrio)(type_table_key_1.TypeTableKey))), (0, combi_1.seq)((0, combi_1.plus)(type_table_key_1.TypeTableKey), (0, combi_1.optPrio)(initial))));
17
17
  const occurs = (0, combi_1.seq)("OCCURS", _1.Integer);
18
18
  const oldType = (0, combi_1.seq)((0, combi_1.opt)("REF TO"), _1.TypeName, (0, combi_1.alt)((0, combi_1.seq)(occurs, (0, combi_1.opt)(header)), header));
19
19
  const oldLike = (0, combi_1.seq)((0, combi_1.opt)("REF TO"), field_chain_1.FieldChain, (0, combi_1.alt)((0, combi_1.seq)(occurs, (0, combi_1.opt)(header)), header));
@@ -7,7 +7,7 @@ const version_1 = require("../../../version");
7
7
  class Select {
8
8
  getMatcher() {
9
9
  const union = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)("UNION", (0, combi_1.optPrio)((0, combi_1.altPrio)("DISTINCT", "ALL")), expressions_1.Select));
10
- return (0, combi_1.seq)(expressions_1.Select, (0, combi_1.starPrio)(union), (0, combi_1.optPrio)(expressions_1.SQLHints));
10
+ return (0, combi_1.seq)(expressions_1.Select, (0, combi_1.starPrio)(union));
11
11
  }
12
12
  }
13
13
  exports.Select = Select;
@@ -169,9 +169,9 @@ class BuiltIn {
169
169
  components.push({ name: "folen", type: new basic_1.IntegerType() });
170
170
  components.push({ name: "host", type: new basic_1.CharacterType(32, "sy-host") });
171
171
  components.push({ name: "index", type: new basic_1.IntegerType() });
172
+ components.push({ name: "input", type: new basic_1.CharacterType(1, "sy-input") });
172
173
  components.push({ name: "langu", type: new basic_1.CharacterType(1, "sy-langu") });
173
174
  components.push({ name: "ldbpg", type: new basic_1.CharacterType(40, "sy-ldbpg") });
174
- components.push({ name: "pdest", type: new basic_1.CharacterType(4, "sy-pdest") });
175
175
  components.push({ name: "lilli", type: new basic_1.IntegerType() });
176
176
  components.push({ name: "linct", type: new basic_1.IntegerType() });
177
177
  components.push({ name: "linno", type: new basic_1.IntegerType() });
@@ -194,6 +194,7 @@ class BuiltIn {
194
194
  components.push({ name: "msgv4", type: new basic_1.CharacterType(50, "sy-msgv4") });
195
195
  components.push({ name: "opsys", type: new basic_1.CharacterType(10, "sy-opsys") });
196
196
  components.push({ name: "pagno", type: new basic_1.IntegerType() });
197
+ components.push({ name: "pdest", type: new basic_1.CharacterType(4, "sy-pdest") });
197
198
  components.push({ name: "pfkey", type: new basic_1.CharacterType(20, "sy-pfkey") });
198
199
  components.push({ name: "repid", type: new basic_1.CharacterType(40, "sy-repid") });
199
200
  components.push({ name: "saprl", type: new basic_1.CharacterType(4, "sy-saprl") });
@@ -887,14 +888,14 @@ BuiltIn.methods = [
887
888
  {
888
889
  name: "STRLEN",
889
890
  mandatory: {
890
- "val": new basic_1.StringType(),
891
+ "val": new basic_1.CLikeType(),
891
892
  },
892
893
  return: new basic_1.IntegerType(),
893
894
  },
894
895
  {
895
896
  name: "SUBSTRING",
896
897
  mandatory: {
897
- "val": new basic_1.StringType(),
898
+ "val": new basic_1.CLikeType(),
898
899
  },
899
900
  optional: {
900
901
  "off": new basic_1.IntegerType(),
@@ -906,7 +907,7 @@ BuiltIn.methods = [
906
907
  {
907
908
  name: "SUBSTRING_AFTER",
908
909
  mandatory: {
909
- "val": new basic_1.StringType(),
910
+ "val": new basic_1.CLikeType(),
910
911
  },
911
912
  optional: {
912
913
  "sub": new basic_1.StringType(),
@@ -922,7 +923,7 @@ BuiltIn.methods = [
922
923
  {
923
924
  name: "SUBSTRING_BEFORE",
924
925
  mandatory: {
925
- "val": new basic_1.StringType(),
926
+ "val": new basic_1.CLikeType(),
926
927
  },
927
928
  optional: {
928
929
  "sub": new basic_1.StringType(),
@@ -938,7 +939,7 @@ BuiltIn.methods = [
938
939
  {
939
940
  name: "SUBSTRING_FROM",
940
941
  mandatory: {
941
- "val": new basic_1.StringType(),
942
+ "val": new basic_1.CLikeType(),
942
943
  },
943
944
  optional: {
944
945
  "sub": new basic_1.StringType(),
@@ -954,7 +955,7 @@ BuiltIn.methods = [
954
955
  {
955
956
  name: "SUBSTRING_TO",
956
957
  mandatory: {
957
- "val": new basic_1.StringType(),
958
+ "val": new basic_1.CLikeType(),
958
959
  },
959
960
  optional: {
960
961
  "sub": new basic_1.StringType(),
@@ -17,6 +17,7 @@ var ScopeType;
17
17
  ScopeType["Method"] = "method";
18
18
  ScopeType["MethodInstance"] = "method_instance";
19
19
  ScopeType["For"] = "for";
20
+ ScopeType["Let"] = "let";
20
21
  ScopeType["OpenSQL"] = "open_sql";
21
22
  })(ScopeType = exports.ScopeType || (exports.ScopeType = {}));
22
23
  //# sourceMappingURL=_scope_type.js.map
@@ -78,7 +78,8 @@ class TypeUtils {
78
78
  }
79
79
  return false;
80
80
  }
81
- else if (target instanceof basic_1.ObjectReferenceType || target instanceof basic_1.GenericObjectReferenceType) {
81
+ else if (target instanceof basic_1.ObjectReferenceType
82
+ || target instanceof basic_1.GenericObjectReferenceType) {
82
83
  if (source instanceof basic_1.ObjectReferenceType
83
84
  || source instanceof basic_1.GenericObjectReferenceType
84
85
  || source instanceof basic_1.VoidType
@@ -120,10 +121,12 @@ class TypeUtils {
120
121
  }
121
122
  else if (target instanceof basic_1.IntegerType
122
123
  || target instanceof basic_1.StringType) {
123
- if (source instanceof basic_1.DataReference
124
+ if (source instanceof basic_1.TableType && source.isWithHeader() === false) {
125
+ return false;
126
+ }
127
+ else if (source instanceof basic_1.DataReference
124
128
  || source instanceof basic_1.ObjectReferenceType
125
- || source instanceof basic_1.GenericObjectReferenceType
126
- || source instanceof basic_1.TableType) {
129
+ || source instanceof basic_1.GenericObjectReferenceType) {
127
130
  return false;
128
131
  }
129
132
  return true;
@@ -10,9 +10,10 @@ class CondBody {
10
10
  if (node === undefined) {
11
11
  return targetType;
12
12
  }
13
+ let scoped = false;
13
14
  const l = node.findDirectExpression(Expressions.Let);
14
15
  if (l) {
15
- new let_1.Let().runSyntax(l, scope, filename);
16
+ scoped = new let_1.Let().runSyntax(l, scope, filename);
16
17
  }
17
18
  for (const s of node.findDirectExpressions(Expressions.Cond)) {
18
19
  new cond_1.Cond().runSyntax(s, scope, filename);
@@ -26,6 +27,9 @@ class CondBody {
26
27
  new source_1.Source().runSyntax(s, scope, filename);
27
28
  }
28
29
  }
30
+ if (scoped === true) {
31
+ scope.pop(node.getLastToken().getEnd());
32
+ }
29
33
  return targetType ? targetType : type;
30
34
  }
31
35
  }
@@ -9,13 +9,17 @@ class ConvBody {
9
9
  if (node === undefined) {
10
10
  return;
11
11
  }
12
+ let scoped = false;
12
13
  const l = node.findDirectExpression(Expressions.Let);
13
14
  if (l) {
14
- new let_1.Let().runSyntax(l, scope, filename);
15
+ scoped = new let_1.Let().runSyntax(l, scope, filename);
15
16
  }
16
17
  for (const s of node.findDirectExpressions(Expressions.Source)) {
17
18
  new source_1.Source().runSyntax(s, scope, filename);
18
19
  }
20
+ if (scoped === true) {
21
+ scope.pop(node.getLastToken().getEnd());
22
+ }
19
23
  }
20
24
  }
21
25
  exports.ConvBody = ConvBody;
@@ -7,12 +7,14 @@ const source_1 = require("./source");
7
7
  const inline_loop_definition_1 = require("./inline_loop_definition");
8
8
  const _scope_type_1 = require("../_scope_type");
9
9
  const component_cond_1 = require("./component_cond");
10
+ const cond_1 = require("./cond");
10
11
  class For {
11
12
  runSyntax(node, scope, filename) {
12
13
  const inlineLoop = node.findDirectExpressions(Expressions.InlineLoopDefinition);
13
14
  const inlineField = node.findAllExpressions(Expressions.InlineFieldDefinition);
14
15
  const addScope = inlineLoop.length > 0 || inlineField.length > 0;
15
16
  if (addScope) {
17
+ // this scope is popped in parent expressions
16
18
  scope.push(_scope_type_1.ScopeType.For, "FOR", node.getFirstToken().getStart(), filename);
17
19
  }
18
20
  for (const s of inlineLoop) {
@@ -27,11 +29,9 @@ class For {
27
29
  for (const s of node.findDirectExpressions(Expressions.ComponentCond)) {
28
30
  new component_cond_1.ComponentCond().runSyntax(s, scope, filename);
29
31
  }
30
- /*
31
- if (addScope) {
32
- scope.pop(node.getLastToken().getEnd());
32
+ for (const s of node.findDirectExpressions(Expressions.Cond)) {
33
+ new cond_1.Cond().runSyntax(s, scope, filename);
33
34
  }
34
- */
35
35
  }
36
36
  }
37
37
  exports.For = For;
@@ -9,8 +9,9 @@ const unknown_type_1 = require("../../types/basic/unknown_type");
9
9
  const _reference_1 = require("../_reference");
10
10
  class InlineFieldDefinition {
11
11
  runSyntax(node, scope, filename) {
12
+ var _a;
12
13
  let type = undefined;
13
- const field = node.findDirectExpression(Expressions.Field);
14
+ const field = (_a = node.findDirectExpression(Expressions.Field)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
14
15
  if (field === undefined) {
15
16
  return;
16
17
  }
@@ -25,8 +26,12 @@ class InlineFieldDefinition {
25
26
  if (type === undefined) {
26
27
  type = new unknown_type_1.UnknownType("InlineFieldDefinition, fallback");
27
28
  }
28
- const identifier = new _typed_identifier_1.TypedIdentifier(field.getFirstToken(), filename, type, ["inline" /* InlineDefinition */]);
29
- scope.addReference(field.getFirstToken(), identifier, _reference_1.ReferenceType.DataWriteReference, filename);
29
+ const name = field.getStr();
30
+ if (scope.findVariable(name) !== undefined) {
31
+ throw new Error(`Variable ${name} already defined`);
32
+ }
33
+ const identifier = new _typed_identifier_1.TypedIdentifier(field, filename, type, ["inline" /* InlineDefinition */]);
34
+ scope.addReference(field, identifier, _reference_1.ReferenceType.DataWriteReference, filename);
30
35
  scope.addIdentifier(identifier);
31
36
  }
32
37
  }
@@ -3,14 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Let = void 0;
4
4
  const Expressions = require("../../2_statements/expressions");
5
5
  const inline_field_definition_1 = require("./inline_field_definition");
6
+ const _scope_type_1 = require("../_scope_type");
6
7
  class Let {
7
8
  runSyntax(node, scope, filename) {
8
9
  if (node === undefined) {
9
- return;
10
+ return false;
10
11
  }
12
+ scope.push(_scope_type_1.ScopeType.Let, "LET", node.getFirstToken().getStart(), filename);
11
13
  for (const f of node.findDirectExpressions(Expressions.InlineFieldDefinition)) {
12
14
  new inline_field_definition_1.InlineFieldDefinition().runSyntax(f, scope, filename);
13
15
  }
16
+ return true;
14
17
  }
15
18
  }
16
19
  exports.Let = Let;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RaiseWith = void 0;
4
+ const Expressions = require("../../2_statements/expressions");
5
+ const source_1 = require("./source");
6
+ class RaiseWith {
7
+ runSyntax(node, scope, filename) {
8
+ for (const f of node.findDirectExpressions(Expressions.Source)) {
9
+ new source_1.Source().runSyntax(f, scope, filename);
10
+ }
11
+ }
12
+ }
13
+ exports.RaiseWith = RaiseWith;
14
+ //# sourceMappingURL=raise_with.js.map
@@ -12,14 +12,15 @@ class ValueBody {
12
12
  if (node === undefined) {
13
13
  return targetType;
14
14
  }
15
- const letNode = node.findDirectExpression(Expressions.Let);
16
- if (letNode) {
17
- new let_1.Let().runSyntax(letNode, scope, filename);
18
- }
19
15
  const forNode = node.findDirectExpression(Expressions.For);
20
16
  if (forNode) {
21
17
  new for_1.For().runSyntax(forNode, scope, filename);
22
18
  }
19
+ let scoped = false;
20
+ const letNode = node.findDirectExpression(Expressions.Let);
21
+ if (letNode) {
22
+ scoped = new let_1.Let().runSyntax(letNode, scope, filename);
23
+ }
23
24
  for (const s of node.findDirectExpressions(Expressions.FieldAssignment)) {
24
25
  new field_assignment_1.FieldAssignment().runSyntax(s, scope, filename, targetType);
25
26
  }
@@ -27,6 +28,9 @@ class ValueBody {
27
28
  for (const s of node.findDirectExpressions(Expressions.Source)) {
28
29
  type = new source_1.Source().runSyntax(s, scope, filename);
29
30
  }
31
+ if (scoped === true) {
32
+ scope.pop(node.getLastToken().getEnd());
33
+ }
30
34
  if (scope.getType() === _scope_type_1.ScopeType.For) {
31
35
  scope.pop(node.getLastToken().getEnd());
32
36
  }
@@ -7,6 +7,7 @@ const source_1 = require("../expressions/source");
7
7
  const _reference_1 = require("../_reference");
8
8
  const basic_1 = require("../../types/basic");
9
9
  const message_source_1 = require("../expressions/message_source");
10
+ const raise_with_1 = require("../expressions/raise_with");
10
11
  class Raise {
11
12
  runSyntax(node, scope, filename) {
12
13
  // todo
@@ -47,6 +48,9 @@ class Raise {
47
48
  new source_1.Source().runSyntax(s, scope, filename);
48
49
  }
49
50
  }
51
+ for (const s of node.findDirectExpressions(Expressions.RaiseWith)) {
52
+ new raise_with_1.RaiseWith().runSyntax(s, scope, filename);
53
+ }
50
54
  for (const s of node.findDirectExpressions(Expressions.Source)) {
51
55
  new source_1.Source().runSyntax(s, scope, filename);
52
56
  }
@@ -12,9 +12,43 @@ class NumberRange extends _abstract_object_1.AbstractObject {
12
12
  allowNamespace: true,
13
13
  };
14
14
  }
15
+ getDomain() {
16
+ var _a;
17
+ this.parse();
18
+ return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.domain;
19
+ }
20
+ getPercentage() {
21
+ var _a;
22
+ this.parse();
23
+ return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.percentage;
24
+ }
25
+ setDirty() {
26
+ this.parsedXML = undefined;
27
+ super.setDirty();
28
+ }
29
+ parse() {
30
+ var _a, _b, _c, _d, _e, _f;
31
+ if (this.parsedXML) {
32
+ return { updated: false, runtime: 0 };
33
+ }
34
+ const start = Date.now();
35
+ this.parsedXML = {};
36
+ const parsed = super.parseRaw2();
37
+ if (parsed === undefined) {
38
+ return { updated: false, runtime: 0 };
39
+ }
40
+ const text = (_c = (_b = (_a = parsed.abapGit) === null || _a === void 0 ? void 0 : _a["asx:abap"]) === null || _b === void 0 ? void 0 : _b["asx:values"]) === null || _c === void 0 ? void 0 : _c.TEXT;
41
+ this.parsedXML.description = text === null || text === void 0 ? void 0 : text.TXT;
42
+ const attributes = (_f = (_e = (_d = parsed.abapGit) === null || _d === void 0 ? void 0 : _d["asx:abap"]) === null || _e === void 0 ? void 0 : _e["asx:values"]) === null || _f === void 0 ? void 0 : _f.ATTRIBUTES;
43
+ this.parsedXML.domain = attributes === null || attributes === void 0 ? void 0 : attributes.DOMLEN;
44
+ this.parsedXML.percentage = parseFloat((attributes === null || attributes === void 0 ? void 0 : attributes.PERCENTAGE) || "");
45
+ const end = Date.now();
46
+ return { updated: true, runtime: end - start };
47
+ }
15
48
  getDescription() {
16
- // todo
17
- return undefined;
49
+ var _a;
50
+ this.parse();
51
+ return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.description;
18
52
  }
19
53
  }
20
54
  exports.NumberRange = NumberRange;
@@ -68,7 +68,7 @@ class Registry {
68
68
  }
69
69
  static abaplintVersion() {
70
70
  // magic, see build script "version.sh"
71
- return "2.85.16";
71
+ return "2.85.20";
72
72
  }
73
73
  getDDICReferences() {
74
74
  return this.references;
@@ -56,6 +56,7 @@ Current rules:
56
56
  * PARTIALLY IMPLEMENTED removed, it can be quick fixed via rule implement_methods
57
57
  * RAISE EXCEPTION ... MESSAGE
58
58
  * APPEND expression is outlined
59
+ * Moving with +=, -=, /=, *=, &&=
59
60
 
60
61
  Only one transformation is applied to a statement at a time, so multiple steps might be required to do the full downport.`,
61
62
  tags: [_irule_1.RuleTag.Experimental, _irule_1.RuleTag.Downport, _irule_1.RuleTag.Quickfix],
@@ -163,6 +164,10 @@ Only one transformation is applied to a statement at a time, so multiple steps m
163
164
  if (found) {
164
165
  return found;
165
166
  }
167
+ found = this.moveWithOperator(high, lowFile);
168
+ if (found) {
169
+ return found;
170
+ }
166
171
  found = this.downportSelectInline(low, high, lowFile, highSyntax);
167
172
  if (found) {
168
173
  return found;
@@ -560,6 +565,48 @@ ${indentation}RAISE EXCEPTION ${uniqueName2}.`;
560
565
  }
561
566
  return undefined;
562
567
  }
568
+ moveWithOperator(high, lowFile) {
569
+ var _a, _b, _c;
570
+ if (!(high.get() instanceof Statements.Move)) {
571
+ return undefined;
572
+ }
573
+ const children = high.getChildren();
574
+ const secondChild = children[1];
575
+ if (secondChild === undefined) {
576
+ return undefined;
577
+ }
578
+ const op = secondChild.getFirstToken();
579
+ let operator = "";
580
+ switch (op.getStr()) {
581
+ case "+":
582
+ operator = " + ";
583
+ break;
584
+ case "-":
585
+ operator = " - ";
586
+ break;
587
+ case "/=":
588
+ operator = " / ";
589
+ break;
590
+ case "*=":
591
+ operator = " * ";
592
+ break;
593
+ case "&&=":
594
+ operator = " && ";
595
+ break;
596
+ default:
597
+ return undefined;
598
+ }
599
+ const target = (_a = high.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.concatTokens();
600
+ if (target === undefined) {
601
+ return;
602
+ }
603
+ const sourceStart = (_c = (_b = high.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.getFirstChild()) === null || _c === void 0 ? void 0 : _c.getFirstToken().getStart();
604
+ if (sourceStart === undefined) {
605
+ return;
606
+ }
607
+ const fix = edit_helper_1.EditHelper.replaceRange(lowFile, op.getStart(), sourceStart, "= " + target + operator);
608
+ return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Expand operator", this.getMetadata().key, this.conf.severity, fix);
609
+ }
563
610
  // must be very simple string templates, like "|{ ls_line-no ALPHA = IN }|"
564
611
  stringTemplateAlpha(node, lowFile) {
565
612
  var _a, _b, _c;
@@ -659,8 +706,34 @@ ${indentation} output = ${topTarget}.`;
659
706
  }
660
707
  return undefined;
661
708
  }
709
+ outlineFor(forLoop, indentation) {
710
+ var _a, _b, _c, _d, _e, _f;
711
+ let body = "";
712
+ let end = "";
713
+ const loopSource = (_a = forLoop.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();
714
+ const loopTargetField = (_b = forLoop.findFirstExpression(Expressions.TargetField)) === null || _b === void 0 ? void 0 : _b.concatTokens();
715
+ if (forLoop.findDirectTokenByText("UNTIL")) {
716
+ const name = (_c = forLoop.findFirstExpression(Expressions.Field)) === null || _c === void 0 ? void 0 : _c.concatTokens();
717
+ body += indentation + "DATA " + name + " TYPE i.\n";
718
+ const cond = forLoop.findFirstExpression(Expressions.Cond);
719
+ body += indentation + `WHILE NOT ${cond === null || cond === void 0 ? void 0 : cond.concatTokens()}.\n`;
720
+ const field = (_e = (_d = forLoop.findDirectExpression(Expressions.InlineFieldDefinition)) === null || _d === void 0 ? void 0 : _d.findFirstExpression(Expressions.Field)) === null || _e === void 0 ? void 0 : _e.concatTokens();
721
+ body += indentation + ` ${field} = ${field} + 1.\n`;
722
+ end = "ENDWHILE";
723
+ }
724
+ else if (loopTargetField) {
725
+ body += indentation + `LOOP AT ${loopSource} INTO DATA(${loopTargetField}).\n`;
726
+ end = "ENDLOOP";
727
+ }
728
+ else if (loopTargetField === undefined) {
729
+ const loopTargetFieldSymbol = (_f = forLoop.findFirstExpression(Expressions.TargetFieldSymbol)) === null || _f === void 0 ? void 0 : _f.concatTokens();
730
+ body += indentation + `LOOP AT ${loopSource} ASSIGNING FIELD-SYMBOL(${loopTargetFieldSymbol}).\n`;
731
+ end = "ENDLOOP";
732
+ }
733
+ return { body, end };
734
+ }
662
735
  outlineReduce(node, lowFile, highSyntax) {
663
- var _a, _b, _c, _d;
736
+ var _a;
664
737
  for (const i of node.findAllExpressionsRecursive(Expressions.Source)) {
665
738
  const firstToken = i.getFirstToken();
666
739
  if (firstToken.getStr().toUpperCase() !== "REDUCE") {
@@ -682,19 +755,12 @@ ${indentation} output = ${topTarget}.`;
682
755
  name = init.getFirstToken().getStr();
683
756
  body += indentation + `DATA(${name}) = ${(_a = reduceBody.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens()}.\n`;
684
757
  }
685
- const loop = reduceBody.findFirstExpression(Expressions.InlineLoopDefinition);
686
- if (loop === undefined) {
758
+ const forLoop = reduceBody.findDirectExpression(Expressions.For);
759
+ if (forLoop === undefined) {
687
760
  continue;
688
761
  }
689
- const loopSource = (_b = loop.findFirstExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens();
690
- const loopTargetField = (_c = loop.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens();
691
- if (loopTargetField) {
692
- body += indentation + `LOOP AT ${loopSource} INTO DATA(${loopTargetField}).\n`;
693
- }
694
- if (loopTargetField === undefined) {
695
- const loopTargetFieldSymbol = (_d = loop.findFirstExpression(Expressions.TargetFieldSymbol)) === null || _d === void 0 ? void 0 : _d.concatTokens();
696
- body += indentation + `LOOP AT ${loopSource} ASSIGNING FIELD-SYMBOL(${loopTargetFieldSymbol}).\n`;
697
- }
762
+ const outlineFor = this.outlineFor(forLoop, indentation);
763
+ body += outlineFor.body;
698
764
  const next = reduceBody.findDirectExpression(Expressions.ReduceNext);
699
765
  if (next === undefined) {
700
766
  continue;
@@ -713,7 +779,7 @@ ${indentation} output = ${topTarget}.`;
713
779
  body += n.concatTokens() + ".\n";
714
780
  }
715
781
  }
716
- body += indentation + `ENDLOOP.\n`;
782
+ body += indentation + outlineFor.end + `.\n`;
717
783
  body += indentation + `${uniqueName} = ${name}.\n`;
718
784
  const abap = `DATA ${uniqueName} TYPE ${type}.\n` +
719
785
  body +
@@ -726,7 +792,6 @@ ${indentation} output = ${topTarget}.`;
726
792
  return undefined;
727
793
  }
728
794
  outlineValue(node, lowFile, highSyntax) {
729
- var _a, _b;
730
795
  const allSources = node.findAllExpressionsRecursive(Expressions.Source);
731
796
  for (const i of allSources) {
732
797
  const firstToken = i.getFirstToken();
@@ -741,11 +806,11 @@ ${indentation} output = ${topTarget}.`;
741
806
  const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);
742
807
  let indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
743
808
  let body = "";
744
- const loop = valueBody === null || valueBody === void 0 ? void 0 : valueBody.findFirstExpression(Expressions.InlineLoopDefinition);
745
- if (loop) {
746
- const loopSource = (_a = loop.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();
747
- const loopTargetFieldSymbol = (_b = loop.findFirstExpression(Expressions.TargetFieldSymbol)) === null || _b === void 0 ? void 0 : _b.concatTokens();
748
- body += indentation + `LOOP AT ${loopSource} ASSIGNING FIELD-SYMBOL(${loopTargetFieldSymbol}).\n`;
809
+ const forLoop = valueBody === null || valueBody === void 0 ? void 0 : valueBody.findDirectExpression(Expressions.For);
810
+ let outlineFor = { body: "", end: "" };
811
+ if (forLoop !== undefined) {
812
+ outlineFor = this.outlineFor(forLoop, indentation);
813
+ body += outlineFor.body;
749
814
  indentation += " ";
750
815
  }
751
816
  let structureName = uniqueName;
@@ -773,9 +838,9 @@ ${indentation} output = ${topTarget}.`;
773
838
  body += indentation + `APPEND ${structureName} TO ${uniqueName}.\n`;
774
839
  }
775
840
  }
776
- if (loop) {
777
- indentation = indentation.substr(2);
778
- body += indentation + `ENDLOOP.\n`;
841
+ if (forLoop !== undefined) {
842
+ indentation = indentation.substring(2);
843
+ body += indentation + outlineFor.end + `.\n`;
779
844
  }
780
845
  const abap = `DATA ${uniqueName} TYPE ${type}.\n` +
781
846
  body +
@@ -913,7 +978,7 @@ ${indentation} output = ${topTarget}.`;
913
978
  const uniqueName = this.uniqueName(i.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
914
979
  const type = this.findType(i, lowFile, highSyntax);
915
980
  const indent = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
916
- const bodyCode = this.buildCondBody(body, uniqueName, indent);
981
+ const bodyCode = this.buildCondBody(body, uniqueName, indent, lowFile, highSyntax);
917
982
  const abap = `DATA ${uniqueName} TYPE ${type}.\n` + bodyCode;
918
983
  const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), abap);
919
984
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), uniqueName);
@@ -922,13 +987,13 @@ ${indentation} output = ${topTarget}.`;
922
987
  }
923
988
  return undefined;
924
989
  }
925
- buildCondBody(body, uniqueName, indent) {
926
- let code = indent;
990
+ buildCondBody(body, uniqueName, indent, lowFile, highSyntax) {
991
+ let code = "";
927
992
  for (const c of body.getChildren()) {
928
993
  if (c instanceof nodes_1.TokenNode) {
929
994
  switch (c.getFirstToken().getStr().toUpperCase()) {
930
995
  case "WHEN":
931
- code += "IF ";
996
+ code += indent + "IF ";
932
997
  break;
933
998
  case "THEN":
934
999
  code += ".\n";
@@ -943,11 +1008,14 @@ ${indentation} output = ${topTarget}.`;
943
1008
  else if (c.get() instanceof Expressions.Cond) {
944
1009
  code += c.concatTokens();
945
1010
  }
1011
+ else if (c.get() instanceof Expressions.Let) {
1012
+ code += this.outlineLet(c, indent, highSyntax, lowFile);
1013
+ }
946
1014
  else if (c.get() instanceof Expressions.Source) {
947
1015
  code += indent + " " + uniqueName + " = " + c.concatTokens() + ".\n";
948
1016
  }
949
1017
  else {
950
- throw "buildCondBody, unexpected expression";
1018
+ throw "buildCondBody, unexpected expression, " + c.get().constructor.name;
951
1019
  }
952
1020
  }
953
1021
  code += indent + "ENDIF.\n";
@@ -32,6 +32,8 @@ class FunctionModuleRecommendationsConf extends _basic_rule_config_1.BasicRuleCo
32
32
  { name: "REUSE_ALV_GRID_DISPLAY", replace: "use CL_SALV_TABLE=>FACTORY or CL_GUI_ALV_GRID" },
33
33
  { name: "CALCULATE_HASH_FOR_RAW", replace: "use CL_ABAP_HMAC" },
34
34
  { name: "FUNCTION_EXISTS", replace: "surround with try-catch CX_SY_DYN_CALL_ILLEGAL_METHOD instead" },
35
+ { name: "IGN_TIMESTAMP_DIFFERENCE", replace: "use CL_ABAP_TSTMP" },
36
+ { name: "IGN_TIMESTAMP_PLUSMINUS", replace: "use CL_ABAP_TSTMP" },
35
37
  ];
36
38
  }
37
39
  }
@@ -45,7 +47,7 @@ class FunctionModuleRecommendations extends _abap_rule_1.ABAPRule {
45
47
  return {
46
48
  key: "function_module_recommendations",
47
49
  title: "Function Module Recommendations",
48
- shortDescription: `Function Module Recommendations`,
50
+ shortDescription: `Suggests replacements for various function modules`,
49
51
  extendedInformation: `https://docs.abapopenchecks.org/checks/53/`,
50
52
  tags: [_irule_1.RuleTag.SingleFile],
51
53
  };
@@ -25,7 +25,9 @@ class UseNew extends _abap_rule_1.ABAPRule {
25
25
  shortDescription: `Checks for deprecated CREATE OBJECT statements.`,
26
26
  extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-new-to-create-object
27
27
 
28
- If the target variable is referenced in the CREATE OBJECT statement, no errors are issued`,
28
+ If the target variable is referenced in the CREATE OBJECT statement, no errors are issued
29
+
30
+ Applicable from v740sp02 and up`,
29
31
  badExample: `CREATE OBJECT ref.`,
30
32
  goodExample: `ref = NEW #( ).`,
31
33
  tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],
@@ -18,7 +18,7 @@ var Version;
18
18
  Version["v756"] = "v756";
19
19
  Version["Cloud"] = "Cloud";
20
20
  })(Version = exports.Version || (exports.Version = {}));
21
- exports.defaultVersion = Version.v755;
21
+ exports.defaultVersion = Version.v756;
22
22
  function getPreviousVersion(v) {
23
23
  if (v === Version.OpenABAP) {
24
24
  return Version.v702;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.85.16",
3
+ "version": "2.85.20",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -48,17 +48,17 @@
48
48
  "@microsoft/api-extractor": "^7.19.4",
49
49
  "@types/chai": "^4.3.0",
50
50
  "@types/mocha": "^9.1.0",
51
- "@types/node": "^17.0.17",
51
+ "@types/node": "^17.0.18",
52
52
  "chai": "^4.3.6",
53
- "eslint": "^8.8.0",
54
- "mocha": "^9.2.0",
53
+ "eslint": "^8.9.0",
54
+ "mocha": "^9.2.1",
55
55
  "c8": "^7.11.0",
56
56
  "source-map-support": "^0.5.21",
57
- "ts-json-schema-generator": "^0.97.0",
57
+ "ts-json-schema-generator": "^0.98.0",
58
58
  "typescript": "^4.5.5"
59
59
  },
60
60
  "dependencies": {
61
- "fast-xml-parser": "^4.0.2",
61
+ "fast-xml-parser": "^4.0.3",
62
62
  "json5": "^2.2.0",
63
63
  "vscode-languageserver-protocol": "^3.16.0",
64
64
  "vscode-languageserver-types": "^3.16.0"