@abaplint/core 2.101.17 → 2.101.18

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.
@@ -256,6 +256,9 @@ class TypeUtils {
256
256
  if (target instanceof basic_1.StructureType && this.structureContainsString(target)) {
257
257
  return false;
258
258
  }
259
+ else if (target instanceof basic_1.IntegerType) {
260
+ return false;
261
+ }
259
262
  else if (target instanceof basic_1.XSequenceType || target instanceof basic_1.XStringType) {
260
263
  if (((_f = source.getAbstractTypeData()) === null || _f === void 0 ? void 0 : _f.derivedFromConstant) === true) {
261
264
  return true;
@@ -282,6 +285,11 @@ class TypeUtils {
282
285
  return false;
283
286
  }
284
287
  }
288
+ else if (source instanceof basic_1.FloatType) {
289
+ if (target instanceof basic_1.IntegerType) {
290
+ return false;
291
+ }
292
+ }
285
293
  else if (source instanceof basic_1.XStringType) {
286
294
  if (target instanceof basic_1.CLikeType) {
287
295
  return false;
@@ -176,19 +176,24 @@ class Source {
176
176
  context = new string_template_1.StringTemplate().runSyntax(first, scope, filename);
177
177
  }
178
178
  else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.Source) {
179
- context = new Source().runSyntax(first, scope, filename);
179
+ const found = new Source().runSyntax(first, scope, filename);
180
+ context = this.infer(context, found);
180
181
  }
181
182
  else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.Constant) {
182
- context = new constant_1.Constant().runSyntax(first);
183
+ const found = new constant_1.Constant().runSyntax(first);
184
+ context = this.infer(context, found);
183
185
  }
184
186
  else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.Dereference) {
185
187
  context = new dereference_1.Dereference().runSyntax(context);
186
- // } else if (first instanceof ExpressionNode && first.get() instanceof Expressions.ArrowOrDash) {
187
- // console.dir("dash");
188
188
  }
189
189
  else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.ComponentChain) {
190
190
  context = new component_chain_1.ComponentChain().runSyntax(context, first, scope, filename);
191
191
  }
192
+ else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.ArithOperator) {
193
+ if (first.concatTokens() === "**") {
194
+ context = new basic_1.FloatType();
195
+ }
196
+ }
192
197
  else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.AttributeChain) {
193
198
  context = new attribute_chain_1.AttributeChain().runSyntax(context, first, scope, filename, type);
194
199
  }
@@ -203,6 +208,14 @@ class Source {
203
208
  return context;
204
209
  }
205
210
  ////////////////////////////////
211
+ infer(context, found) {
212
+ if (context instanceof basic_1.FloatType && found instanceof basic_1.IntegerType) {
213
+ return context;
214
+ }
215
+ else {
216
+ return found;
217
+ }
218
+ }
206
219
  addIfInferred(node, scope, filename, inferredType) {
207
220
  const basic = new basic_types_1.BasicTypes(filename, scope);
208
221
  const typeExpression = node.findFirstExpression(Expressions.TypeNameOrInfer);
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SQLCompare = void 0;
4
4
  const Expressions = require("../../2_statements/expressions");
5
+ const nodes_1 = require("../../nodes");
5
6
  const basic_1 = require("../../types/basic");
6
7
  const sql_source_1 = require("./sql_source");
7
8
  class SQLCompare {
@@ -10,7 +11,12 @@ class SQLCompare {
10
11
  let sourceType;
11
12
  let token;
12
13
  for (const s of node.findAllExpressions(Expressions.SQLSource)) {
13
- token = s.getFirstToken();
14
+ for (const child of s.getChildren()) {
15
+ if (child instanceof nodes_1.ExpressionNode) {
16
+ token = child.getFirstToken();
17
+ break;
18
+ }
19
+ }
14
20
  sourceType = new sql_source_1.SQLSource().runSyntax(s, scope, filename);
15
21
  }
16
22
  const fieldName = (_a = node.findDirectExpression(Expressions.SQLFieldName)) === null || _a === void 0 ? void 0 : _a.concatTokens();
@@ -13,7 +13,6 @@ const dynamic_1 = require("../expressions/dynamic");
13
13
  const loop_group_by_1 = require("../expressions/loop_group_by");
14
14
  class Loop {
15
15
  runSyntax(node, scope, filename) {
16
- var _a;
17
16
  const loopTarget = node.findDirectExpression(Expressions.LoopTarget);
18
17
  let target = loopTarget === null || loopTarget === void 0 ? void 0 : loopTarget.findDirectExpression(Expressions.Target);
19
18
  const targetType = target ? new target_1.Target().runSyntax(target, scope, filename) : undefined;
@@ -47,14 +46,24 @@ class Loop {
47
46
  && concat.startsWith("LOOP AT GROUP ") === false) {
48
47
  throw new Error("Loop, not a table type");
49
48
  }
49
+ else if (loopTarget === undefined
50
+ && sourceType instanceof basic_1.TableType
51
+ && sourceType.isWithHeader() === false) {
52
+ throw new Error("Loop, no header");
53
+ }
54
+ const targetConcat = loopTarget === null || loopTarget === void 0 ? void 0 : loopTarget.concatTokens().toUpperCase();
50
55
  if (sourceType instanceof basic_1.TableType) {
51
- const targetConcat = (_a = node.findDirectExpression(Expressions.LoopTarget)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
52
56
  rowType = sourceType.getRowType();
53
57
  sourceType = rowType;
54
58
  if (targetConcat === null || targetConcat === void 0 ? void 0 : targetConcat.startsWith("REFERENCE INTO ")) {
55
59
  sourceType = new basic_1.DataReference(sourceType);
56
60
  }
57
61
  }
62
+ if (targetConcat
63
+ && targetConcat.startsWith("TRANSPORTING ")
64
+ && node.findDirectTokenByText("WHERE") === undefined) {
65
+ throw new Error("Loop, TRANSPORTING NO FIELDS only with WHERE");
66
+ }
58
67
  const inline = target === null || target === void 0 ? void 0 : target.findDirectExpression(Expressions.InlineData);
59
68
  if (inline) {
60
69
  new inline_data_1.InlineData().runSyntax(inline, scope, filename, sourceType);
@@ -65,7 +65,7 @@ class Registry {
65
65
  }
66
66
  static abaplintVersion() {
67
67
  // magic, see build script "version.sh"
68
- return "2.101.17";
68
+ return "2.101.18";
69
69
  }
70
70
  getDDICReferences() {
71
71
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.101.17",
3
+ "version": "2.101.18",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -53,7 +53,7 @@
53
53
  "@microsoft/api-extractor": "^7.35.2",
54
54
  "@types/chai": "^4.3.5",
55
55
  "@types/mocha": "^10.0.1",
56
- "@types/node": "^20.2.6",
56
+ "@types/node": "^20.3.0",
57
57
  "chai": "^4.3.7",
58
58
  "eslint": "^8.42.0",
59
59
  "mocha": "^10.2.0",