@abaplint/core 2.102.55 → 2.102.56

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.
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TruncateDataset = void 0;
4
4
  const combi_1 = require("../combi");
5
5
  const expressions_1 = require("../expressions");
6
+ const version_1 = require("../../../version");
6
7
  class TruncateDataset {
7
8
  getMatcher() {
8
- return (0, combi_1.seq)("TRUNCATE DATASET", expressions_1.Source, "AT CURRENT POSITION");
9
+ return (0, combi_1.verNot)(version_1.Version.Cloud, (0, combi_1.seq)("TRUNCATE DATASET", expressions_1.Source, "AT CURRENT POSITION"));
9
10
  }
10
11
  }
11
12
  exports.TruncateDataset = TruncateDataset;
@@ -335,6 +335,7 @@ class TypeUtils {
335
335
  else if (source instanceof basic_1.XStringType) {
336
336
  if (target instanceof basic_1.CLikeType
337
337
  || target instanceof basic_1.IntegerType
338
+ || target instanceof basic_1.StringType
338
339
  || target instanceof basic_1.ObjectReferenceType
339
340
  || target instanceof basic_1.HexType) {
340
341
  return false;
@@ -27,6 +27,7 @@ class MethodCallChain {
27
27
  if (first.get() instanceof Expressions.MethodCall) {
28
28
  children.unshift(first);
29
29
  }
30
+ let previous = "";
30
31
  while (children.length > 0) {
31
32
  const current = children.shift();
32
33
  if (current === undefined) {
@@ -47,6 +48,9 @@ class MethodCallChain {
47
48
  }
48
49
  }
49
50
  else {
51
+ if (previous === "=>" && (method === null || method === void 0 ? void 0 : method.isStatic()) === false) {
52
+ throw new Error("Method \"" + methodName + "\" not static");
53
+ }
50
54
  const extra = {
51
55
  ooName: foundDef === null || foundDef === void 0 ? void 0 : foundDef.getName(),
52
56
  ooType: foundDef instanceof class_definition_1.ClassDefinition ? "CLAS" : "INTF"
@@ -84,6 +88,7 @@ class MethodCallChain {
84
88
  else if (current instanceof nodes_1.ExpressionNode && current.get() instanceof Expressions.AttributeName) {
85
89
  context = new attribute_name_1.AttributeName().runSyntax(context, current, scope, filename);
86
90
  }
91
+ previous = current.concatTokens();
87
92
  }
88
93
  return context;
89
94
  }
@@ -15,7 +15,8 @@ class StringTemplate {
15
15
  if (type === undefined) {
16
16
  throw new Error("No target type determined");
17
17
  }
18
- else if (typeUtils.isCharLike(type) === false && typeUtils.isHexLike(type) === false) {
18
+ else if ((typeUtils.isCharLike(type) === false && typeUtils.isHexLike(type) === false)
19
+ || type instanceof basic_1.StructureType) {
19
20
  throw new Error("Not character like, " + type.constructor.name);
20
21
  }
21
22
  const format = templateSource.findDirectExpression(Expressions.StringTemplateFormatting);
@@ -6,9 +6,10 @@ const source_1 = require("../expressions/source");
6
6
  const fstarget_1 = require("../expressions/fstarget");
7
7
  const basic_1 = require("../../types/basic");
8
8
  const dynamic_1 = require("../expressions/dynamic");
9
+ const _type_utils_1 = require("../_type_utils");
9
10
  class Assign {
10
11
  runSyntax(node, scope, filename) {
11
- var _a, _b;
12
+ var _a;
12
13
  const assignSource = node.findDirectExpression(Expressions.AssignSource);
13
14
  const sources = (assignSource === null || assignSource === void 0 ? void 0 : assignSource.findDirectExpressions(Expressions.Source)) || [];
14
15
  const theSource = sources[sources.length - 1];
@@ -27,10 +28,18 @@ class Assign {
27
28
  else {
28
29
  sourceType = new source_1.Source().runSyntax(theSource, scope, filename);
29
30
  }
30
- if (sourceType === undefined || ((_a = node.findDirectExpression(Expressions.AssignSource)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Dynamic))) {
31
+ if ((assignSource === null || assignSource === void 0 ? void 0 : assignSource.getChildren().length) === 5
32
+ && ((_a = assignSource === null || assignSource === void 0 ? void 0 : assignSource.getFirstChild()) === null || _a === void 0 ? void 0 : _a.concatTokens()) === "COMPONENT") {
33
+ const componentSource = sources[sources.length - 2];
34
+ const componentType = new source_1.Source().runSyntax(componentSource, scope, filename);
35
+ if (new _type_utils_1.TypeUtils(scope).isAssignable(componentType, new basic_1.CharacterType(30)) === false) {
36
+ throw new Error("component name must be charlike");
37
+ }
38
+ }
39
+ if (sourceType === undefined || (assignSource === null || assignSource === void 0 ? void 0 : assignSource.findDirectExpression(Expressions.Dynamic))) {
31
40
  sourceType = new basic_1.AnyType();
32
41
  }
33
- for (const d of ((_b = node.findDirectExpression(Expressions.AssignSource)) === null || _b === void 0 ? void 0 : _b.findAllExpressions(Expressions.Dynamic)) || []) {
42
+ for (const d of (assignSource === null || assignSource === void 0 ? void 0 : assignSource.findAllExpressions(Expressions.Dynamic)) || []) {
34
43
  new dynamic_1.Dynamic().runSyntax(d, scope, filename);
35
44
  }
36
45
  const target = node.findDirectExpression(Expressions.FSTarget);
@@ -65,7 +65,7 @@ class Registry {
65
65
  }
66
66
  static abaplintVersion() {
67
67
  // magic, see build script "version.sh"
68
- return "2.102.55";
68
+ return "2.102.56";
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.102.55",
3
+ "version": "2.102.56",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",