@abaplint/core 2.85.18 → 2.85.22

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.
@@ -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") });
@@ -166,11 +166,7 @@ class CurrentScope {
166
166
  if (name === undefined) {
167
167
  return { found: false };
168
168
  }
169
- const def = (_a = this.current) === null || _a === void 0 ? void 0 : _a.findDeferred(name);
170
- if (def !== undefined) {
171
- return { found: true, id: def };
172
- }
173
- const findLocalClass = (_b = this.current) === null || _b === void 0 ? void 0 : _b.findClassDefinition(name);
169
+ const findLocalClass = (_a = this.current) === null || _a === void 0 ? void 0 : _a.findClassDefinition(name);
174
170
  if (findLocalClass) {
175
171
  return { found: true, id: findLocalClass, type: _reference_1.ReferenceType.ObjectOrientedReference, ooType: "CLAS" };
176
172
  }
@@ -178,7 +174,7 @@ class CurrentScope {
178
174
  if (globalClas) {
179
175
  return { found: true, id: globalClas.getIdentifier(), type: _reference_1.ReferenceType.ObjectOrientedReference, ooType: "CLAS" };
180
176
  }
181
- const findLocalInterface = (_c = this.current) === null || _c === void 0 ? void 0 : _c.findInterfaceDefinition(name);
177
+ const findLocalInterface = (_b = this.current) === null || _b === void 0 ? void 0 : _b.findInterfaceDefinition(name);
182
178
  if (findLocalInterface) {
183
179
  return { found: true, id: findLocalInterface, type: _reference_1.ReferenceType.ObjectOrientedReference, ooType: "INTF" };
184
180
  }
@@ -186,6 +182,10 @@ class CurrentScope {
186
182
  if (globalIntf) {
187
183
  return { found: true, id: globalIntf.getIdentifier(), type: _reference_1.ReferenceType.ObjectOrientedReference, ooType: "INTF" };
188
184
  }
185
+ const def = (_c = this.current) === null || _c === void 0 ? void 0 : _c.findDeferred(name);
186
+ if (def !== undefined) {
187
+ return { found: true, id: def };
188
+ }
189
189
  return { found: false };
190
190
  }
191
191
  ///////////////////////////
@@ -1,9 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TypeUtils = void 0;
4
+ const types_1 = require("../types");
4
5
  const basic_1 = require("../types/basic");
5
6
  class TypeUtils {
6
- static isCharLike(type) {
7
+ constructor(scope) {
8
+ this.scope = scope;
9
+ }
10
+ isCharLike(type) {
7
11
  if (type === undefined) {
8
12
  return false;
9
13
  }
@@ -40,7 +44,7 @@ class TypeUtils {
40
44
  }
41
45
  return false;
42
46
  }
43
- static isHexLike(type) {
47
+ isHexLike(type) {
44
48
  if (type === undefined) {
45
49
  return false;
46
50
  }
@@ -61,7 +65,100 @@ class TypeUtils {
61
65
  }
62
66
  return false;
63
67
  }
64
- static isAssignable(source, target) {
68
+ isOOAssignable(source, target) {
69
+ let sid = source.getIdentifier();
70
+ let tid = target.getIdentifier();
71
+ const tname = tid.getName().toUpperCase();
72
+ const sname = sid.getName().toUpperCase();
73
+ if (tname === sname) {
74
+ return true;
75
+ }
76
+ if (!(sid instanceof types_1.ClassDefinition || sid instanceof types_1.InterfaceDefinition)) {
77
+ const found = this.scope.findObjectDefinition(sid.getName());
78
+ if (found) {
79
+ sid = found;
80
+ }
81
+ else {
82
+ return false;
83
+ }
84
+ }
85
+ if (!(tid instanceof types_1.ClassDefinition || tid instanceof types_1.InterfaceDefinition)) {
86
+ const found = this.scope.findObjectDefinition(tid.getName());
87
+ if (found) {
88
+ tid = found;
89
+ }
90
+ else {
91
+ return false;
92
+ }
93
+ }
94
+ if (sid instanceof types_1.ClassDefinition && tid instanceof types_1.ClassDefinition) {
95
+ if (sname === tname) {
96
+ return true;
97
+ }
98
+ const slist = this.listAllSupers(sid);
99
+ if (slist.indexOf(tname) >= 0) {
100
+ return true;
101
+ }
102
+ }
103
+ else if (sid instanceof types_1.ClassDefinition && tid instanceof types_1.InterfaceDefinition) {
104
+ if (sid.getImplementing().some(i => i.name === tname)) {
105
+ return true;
106
+ }
107
+ const slist = this.listAllInterfaces(sid);
108
+ if (slist.indexOf(tname) >= 0) {
109
+ return true;
110
+ }
111
+ }
112
+ else if (sid instanceof types_1.InterfaceDefinition && tid instanceof types_1.InterfaceDefinition) {
113
+ if (sname === tname) {
114
+ return true;
115
+ }
116
+ if (sid.getImplementing().some(i => i.name === tname)) {
117
+ return true;
118
+ }
119
+ const slist = this.listAllInterfaces(sid);
120
+ if (slist.indexOf(tname) >= 0) {
121
+ return true;
122
+ }
123
+ }
124
+ return false;
125
+ }
126
+ listAllInterfaces(cdef) {
127
+ var _a;
128
+ const ret = new Set();
129
+ const stack = [];
130
+ // initialize
131
+ cdef.getImplementing().forEach(i => stack.push(i.name));
132
+ if (cdef instanceof types_1.ClassDefinition) {
133
+ const supers = this.listAllSupers(cdef);
134
+ for (const s of supers) {
135
+ (_a = this.scope.findClassDefinition(s)) === null || _a === void 0 ? void 0 : _a.getImplementing().forEach(i => stack.push(i.name));
136
+ }
137
+ }
138
+ // main loop
139
+ while (stack.length > 0) {
140
+ const intf = stack.pop().toUpperCase();
141
+ ret.add(intf);
142
+ const idef = this.scope.findInterfaceDefinition(intf);
143
+ idef === null || idef === void 0 ? void 0 : idef.getImplementing().forEach(i => stack.push(i.name));
144
+ }
145
+ return Array.from(ret.values());
146
+ }
147
+ listAllSupers(cdef) {
148
+ var _a, _b;
149
+ const ret = [];
150
+ let sup = cdef.getSuperClass();
151
+ while (sup !== undefined) {
152
+ ret.push(sup === null || sup === void 0 ? void 0 : sup.toUpperCase());
153
+ sup = (_b = (_a = this.scope.findClassDefinition(sup)) === null || _a === void 0 ? void 0 : _a.getSuperClass()) === null || _b === void 0 ? void 0 : _b.toUpperCase();
154
+ }
155
+ return ret;
156
+ }
157
+ isCastable(_source, _target) {
158
+ // todo
159
+ return true;
160
+ }
161
+ isAssignable(source, target) {
65
162
  /*
66
163
  console.dir(source);
67
164
  console.dir(target);
@@ -78,6 +175,9 @@ class TypeUtils {
78
175
  }
79
176
  return false;
80
177
  }
178
+ else if (target instanceof basic_1.ObjectReferenceType && source instanceof basic_1.ObjectReferenceType) {
179
+ return this.isOOAssignable(source, target);
180
+ }
81
181
  else if (target instanceof basic_1.ObjectReferenceType
82
182
  || target instanceof basic_1.GenericObjectReferenceType) {
83
183
  if (source instanceof basic_1.ObjectReferenceType
@@ -4,30 +4,42 @@ exports.Cast = void 0;
4
4
  const basic_1 = require("../../types/basic");
5
5
  const Expressions = require("../../2_statements/expressions");
6
6
  const source_1 = require("./source");
7
+ const _type_utils_1 = require("../_type_utils");
7
8
  class Cast {
8
9
  runSyntax(node, scope, targetType, filename) {
9
10
  var _a;
10
- for (const s of node.findAllExpressions(Expressions.Source)) {
11
- new source_1.Source().runSyntax(s, scope, filename);
11
+ const sourceNode = node.findDirectExpression(Expressions.Source);
12
+ if (sourceNode === undefined) {
13
+ throw new Error("Cast, source node not found");
12
14
  }
15
+ const sourceType = new source_1.Source().runSyntax(sourceNode, scope, filename);
16
+ let tt = undefined;
13
17
  const typeName = (_a = node.findDirectExpression(Expressions.TypeNameOrInfer)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr();
14
18
  if (typeName === undefined) {
15
19
  throw new Error("Cast, child TypeNameOrInfer not found");
16
20
  }
17
21
  else if (typeName === "#" && targetType) {
18
- return targetType;
22
+ tt = targetType;
19
23
  }
20
24
  else if (typeName === "#") {
21
25
  throw new Error("Cast, todo, infer type");
22
26
  }
23
- const found = scope.findObjectDefinition(typeName);
24
- if (found === undefined && scope.getDDIC().inErrorNamespace(typeName) === false) {
25
- return new basic_1.VoidType(typeName);
27
+ if (tt === undefined) {
28
+ const found = scope.findObjectDefinition(typeName);
29
+ if (found === undefined && scope.getDDIC().inErrorNamespace(typeName) === false) {
30
+ tt = new basic_1.VoidType(typeName);
31
+ }
32
+ else if (found === undefined) {
33
+ throw new Error("Type \"" + typeName + "\" not found in scope, Cast");
34
+ }
35
+ else {
36
+ tt = new basic_1.ObjectReferenceType(found);
37
+ }
26
38
  }
27
- else if (found === undefined) {
28
- throw new Error("Type \"" + typeName + "\" not found in scope, Cast");
39
+ if (new _type_utils_1.TypeUtils(scope).isCastable(sourceType, tt) === false) {
40
+ throw new Error("Cast, incompatible types");
29
41
  }
30
- return new basic_1.ObjectReferenceType(found);
42
+ return tt;
31
43
  }
32
44
  }
33
45
  exports.Cast = Cast;
@@ -50,7 +50,7 @@ class MethodCallParam {
50
50
  if (sourceType === undefined) {
51
51
  throw new Error("No source type determined, method source");
52
52
  }
53
- else if (_type_utils_1.TypeUtils.isAssignable(sourceType, targetType) === false) {
53
+ else if (new _type_utils_1.TypeUtils(scope).isAssignable(sourceType, targetType) === false) {
54
54
  throw new Error("Method parameter type not compatible");
55
55
  }
56
56
  }
@@ -65,7 +65,7 @@ class MethodParameters {
65
65
  }
66
66
  else if (target) {
67
67
  const targetType = new target_1.Target().runSyntax(target, scope, filename);
68
- if (targetType && _type_utils_1.TypeUtils.isAssignable(type, targetType) === false) {
68
+ if (targetType && new _type_utils_1.TypeUtils(scope).isAssignable(type, targetType) === false) {
69
69
  throw new Error("Method returning value not type compatible");
70
70
  }
71
71
  }
@@ -90,7 +90,7 @@ class MethodParameters {
90
90
  else if (item.targetType === undefined) {
91
91
  throw new Error("Could not determine target type");
92
92
  }
93
- else if (item.targetType && _type_utils_1.TypeUtils.isAssignable(parameterType, item.targetType) === false) {
93
+ else if (item.targetType && new _type_utils_1.TypeUtils(scope).isAssignable(parameterType, item.targetType) === false) {
94
94
  throw new Error("Method parameter type not compatible, " + item.name);
95
95
  }
96
96
  }
@@ -109,7 +109,7 @@ class MethodParameters {
109
109
  }
110
110
  parameterType = parameter.getType();
111
111
  }
112
- if (item.targetType && _type_utils_1.TypeUtils.isAssignable(parameterType, item.targetType) === false) {
112
+ if (item.targetType && new _type_utils_1.TypeUtils(scope).isAssignable(parameterType, item.targetType) === false) {
113
113
  throw new Error("Method parameter type not compatible, " + item.name);
114
114
  }
115
115
  (_a = this.requiredParameters) === null || _a === void 0 ? void 0 : _a.delete(item.name);
@@ -129,7 +129,7 @@ class MethodParameters {
129
129
  if (parameter === undefined) {
130
130
  throw new Error("Method importing parameter \"" + item.name + "\" does not exist");
131
131
  }
132
- else if (_type_utils_1.TypeUtils.isAssignable(parameter.getType(), item.sourceType) === false) {
132
+ else if (new _type_utils_1.TypeUtils(scope).isAssignable(item.sourceType, parameter.getType()) === false) {
133
133
  throw new Error("Method parameter type not compatible, " + item.name);
134
134
  }
135
135
  this.requiredParameters.delete(item.name);
@@ -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
@@ -30,7 +30,12 @@ class Move {
30
30
  new inline_data_1.InlineData().runSyntax(inline, scope, filename, sourceType);
31
31
  targetType = sourceType;
32
32
  }
33
- if (_type_utils_1.TypeUtils.isAssignable(sourceType, targetType) === false) {
33
+ if (node.findDirectTokenByText("?=")) {
34
+ if (new _type_utils_1.TypeUtils(scope).isCastable(sourceType, targetType) === false) {
35
+ throw new Error("Incompatible types");
36
+ }
37
+ }
38
+ else if (new _type_utils_1.TypeUtils(scope).isAssignable(sourceType, targetType) === false) {
34
39
  throw new Error("Incompatible types");
35
40
  }
36
41
  }
@@ -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
  }
@@ -35,14 +35,14 @@ class ReadTable {
35
35
  const indexSource = node.findExpressionAfterToken("INDEX");
36
36
  if (indexSource) {
37
37
  const indexType = new source_1.Source().runSyntax(indexSource, scope, filename);
38
- if (_type_utils_1.TypeUtils.isAssignable(indexType, new basic_1.IntegerType()) === false) {
38
+ if (new _type_utils_1.TypeUtils(scope).isAssignable(indexType, new basic_1.IntegerType()) === false) {
39
39
  throw new Error("READ TABLE, INDEX must be simple");
40
40
  }
41
41
  }
42
42
  const fromSource = node.findExpressionAfterToken("FROM");
43
43
  if (fromSource) {
44
44
  const fromType = new source_1.Source().runSyntax(fromSource, scope, filename);
45
- if (_type_utils_1.TypeUtils.isAssignable(fromType, new basic_1.IntegerType()) === false) {
45
+ if (new _type_utils_1.TypeUtils(scope).isAssignable(fromType, new basic_1.IntegerType()) === false) {
46
46
  throw new Error("READ TABLE, FROM must be simple");
47
47
  }
48
48
  }
@@ -77,7 +77,7 @@ class ReadTable {
77
77
  const t = target.findFirstExpression(Expressions.Target);
78
78
  if (t) {
79
79
  const targetType = new target_1.Target().runSyntax(t, scope, filename);
80
- if (_type_utils_1.TypeUtils.isAssignable(rowType, targetType) === false) {
80
+ if (new _type_utils_1.TypeUtils(scope).isAssignable(rowType, targetType) === false) {
81
81
  throw new Error("Incompatible types");
82
82
  }
83
83
  return;
@@ -16,12 +16,12 @@ class Shift {
16
16
  }
17
17
  const targetType = new target_1.Target().runSyntax(target, scope, filename);
18
18
  if (node.concatTokens().toUpperCase().includes(" IN BYTE MODE")) {
19
- if (_type_utils_1.TypeUtils.isHexLike(targetType) === false) {
19
+ if (new _type_utils_1.TypeUtils(scope).isHexLike(targetType) === false) {
20
20
  throw new Error("Shift, Target not hex like");
21
21
  }
22
22
  }
23
23
  else {
24
- if (_type_utils_1.TypeUtils.isCharLike(targetType) === false) {
24
+ if (new _type_utils_1.TypeUtils(scope).isCharLike(targetType) === false) {
25
25
  throw new Error("Shift, Target not char like");
26
26
  }
27
27
  }
@@ -13,8 +13,8 @@ class Write {
13
13
  for (const s of node.findAllExpressions(Expressions.Source)) {
14
14
  const type = new source_1.Source().runSyntax(s, scope, filename);
15
15
  if (s === second
16
- && _type_utils_1.TypeUtils.isCharLike(type) === false
17
- && _type_utils_1.TypeUtils.isHexLike(type) === false) {
16
+ && new _type_utils_1.TypeUtils(scope).isCharLike(type) === false
17
+ && new _type_utils_1.TypeUtils(scope).isHexLike(type) === false) {
18
18
  throw new Error("Source not character like");
19
19
  }
20
20
  }
@@ -68,7 +68,7 @@ class Registry {
68
68
  }
69
69
  static abaplintVersion() {
70
70
  // magic, see build script "version.sh"
71
- return "2.85.18";
71
+ return "2.85.22";
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;
@@ -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
  };
@@ -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.18",
3
+ "version": "2.85.22",
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.19",
52
52
  "chai": "^4.3.6",
53
53
  "eslint": "^8.9.0",
54
- "mocha": "^9.2.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"