@abaplint/core 2.119.65 → 2.119.67

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.
@@ -323,7 +323,8 @@ class TypeUtils {
323
323
  console.dir(target);
324
324
  console.dir(calculated);
325
325
  */
326
- if (calculated && source instanceof basic_1.StringType && target instanceof basic_1.XStringType) {
326
+ if (calculated && source instanceof basic_1.StringType
327
+ && (target instanceof basic_1.XStringType || target instanceof basic_1.XSequenceType)) {
327
328
  return false;
328
329
  }
329
330
  if (calculated) {
@@ -43,6 +43,7 @@ const source_1 = require("./source");
43
43
  const _type_utils_1 = require("../_type_utils");
44
44
  const _syntax_input_1 = require("../_syntax_input");
45
45
  const constant_1 = require("./constant");
46
+ const _builtin_1 = require("../_builtin");
46
47
  class MethodCallParam {
47
48
  static runSyntax(node, input, method) {
48
49
  if (!(node.get() instanceof Expressions.MethodCallParam)) {
@@ -103,6 +104,19 @@ class MethodCallParam {
103
104
  let sourceType = undefined;
104
105
  if (child.get() instanceof Expressions.Source) {
105
106
  sourceType = source_1.Source.runSyntax(child, input, targetType);
107
+ const chain = child.findDirectExpression(Expressions.FieldChain);
108
+ const isCalculated = child.findDirectExpression(Expressions.Source) !== undefined;
109
+ const hasOffsetOrLength = chain !== undefined
110
+ && isCalculated === false
111
+ && (chain.findDirectExpression(Expressions.FieldOffset) !== undefined
112
+ || chain.findDirectExpression(Expressions.FieldLength) !== undefined);
113
+ if (hasOffsetOrLength
114
+ && !(method instanceof _builtin_1.BuiltInMethod)
115
+ && (sourceType instanceof basic_1.StringType || sourceType instanceof basic_1.XStringType)) {
116
+ const message = `Offsets or lengths cannot be specified for fields of type "STRING" or "XSTRING" in the current statement`;
117
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, child.getFirstToken(), message));
118
+ return;
119
+ }
106
120
  }
107
121
  else if (child.get() instanceof Expressions.ConstantString) {
108
122
  sourceType = constant_1.Constant.runSyntax(child);
@@ -45,6 +45,11 @@ class Concatenate {
45
45
  runSyntax(node, input) {
46
46
  const byteMode = node.findDirectTokenByText("BYTE") !== undefined;
47
47
  const linesMode = node.findDirectTokenByText("LINES") !== undefined;
48
+ if (node.findFirstExpression(Expressions.TableExpression) !== undefined) {
49
+ const message = "CONCATENATE with table expression not possible";
50
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
51
+ return;
52
+ }
48
53
  const target = node.findFirstExpression(Expressions.Target);
49
54
  const inline = target === null || target === void 0 ? void 0 : target.findDirectExpression(Expressions.InlineData);
50
55
  if (inline) {
@@ -75,7 +75,7 @@ class Registry {
75
75
  }
76
76
  static abaplintVersion() {
77
77
  // magic, see build script "version.js"
78
- return "2.119.65";
78
+ return "2.119.67";
79
79
  }
80
80
  getDDICReferences() {
81
81
  return this.ddicReferences;
@@ -331,6 +331,18 @@ Make sure to test the downported code, it might not always be completely correct
331
331
  }
332
332
  }
333
333
  }
334
+ // INTO after WHERE parses as a valid SELECT in the low version, but is only allowed in
335
+ // strict SQL syntax, so move it also when the statement is no longer Unknown
336
+ if (ret.length === 0) {
337
+ for (let i = 0; i < lowStatements.length; i++) {
338
+ const low = lowStatements[i];
339
+ const high = highStatements[i];
340
+ const issue = this.downportSQLMoveInto(low, high, lowFile, highSyntax);
341
+ if (issue) {
342
+ ret.push(issue);
343
+ }
344
+ }
345
+ }
334
346
  }
335
347
  return ret;
336
348
  }
@@ -574,10 +586,14 @@ Make sure to test the downported code, it might not always be completely correct
574
586
  return undefined;
575
587
  }
576
588
  //////////////////////////////////////////
577
- /** move INTO from after WHERE to after FROM */
589
+ /** move INTO from after WHERE to after FROM,
590
+ * note that INTO after WHERE is only valid in strict SQL syntax, so it must be moved when
591
+ * downporting; this can happen both while the statement is still Unknown(from the main loop)
592
+ * and after the @ and FIELDS have been removed, leaving a SELECT that parses in the low version */
578
593
  downportSQLMoveInto(low, high, lowFile, _highSyntax) {
579
594
  var _a;
580
- if (!(low.get() instanceof _statement_1.Unknown)) {
595
+ if (!(high.get() instanceof Statements.Select)
596
+ && !(high.get() instanceof Statements.SelectLoop)) {
581
597
  return undefined;
582
598
  }
583
599
  // note: SQLCond is also used in JOIN(FROM) conditions
@@ -585,6 +601,7 @@ Make sure to test the downported code, it might not always be completely correct
585
601
  if (where === undefined) {
586
602
  return undefined;
587
603
  }
604
+ // the FIELDS list sits between FROM and WHERE, wait for it to be removed first
588
605
  if (high.findFirstExpression(Expressions.SQLFields) !== undefined) {
589
606
  return undefined;
590
607
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.119.65",
3
+ "version": "2.119.67",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",