@abaplint/core 2.120.46 → 2.120.47

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.
@@ -32,6 +32,17 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ var __rest = (this && this.__rest) || function (s, e) {
36
+ var t = {};
37
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
38
+ t[p] = s[p];
39
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
40
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
41
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
42
+ t[p[i]] = s[p[i]];
43
+ }
44
+ return t;
45
+ };
35
46
  Object.defineProperty(exports, "__esModule", { value: true });
36
47
  exports.InlineData = void 0;
37
48
  const Expressions = __importStar(require("../../2_statements/expressions"));
@@ -64,7 +75,7 @@ class InlineData {
64
75
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
65
76
  type = basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
66
77
  }
67
- const identifier = new _typed_identifier_1.TypedIdentifier(token, input.filename, type, ["inline" /* IdentifierMeta.InlineDefinition */]);
78
+ const identifier = new _typed_identifier_1.TypedIdentifier(token, input.filename, this.stripDerivedFromConstant(type), ["inline" /* IdentifierMeta.InlineDefinition */]);
68
79
  input.scope.addIdentifier(identifier);
69
80
  input.scope.addReference(token, identifier, _reference_1.ReferenceType.DataWriteReference, input.filename);
70
81
  }
@@ -75,6 +86,26 @@ class InlineData {
75
86
  input.scope.addReference(token, identifier, _reference_1.ReferenceType.DataWriteReference, input.filename);
76
87
  }
77
88
  }
89
+ // The inferred type is taken from the source expression, which might be a literal.
90
+ // The variable itself is not a constant, so the relaxations that apply to literals
91
+ // must not be inherited, eg. a "c" variable is not assignable to a "string" parameter
92
+ static stripDerivedFromConstant(type) {
93
+ const data = type.getAbstractTypeData();
94
+ if ((data === null || data === void 0 ? void 0 : data.derivedFromConstant) !== true) {
95
+ return type;
96
+ }
97
+ const { derivedFromConstant } = data, rest = __rest(data, ["derivedFromConstant"]);
98
+ if (type instanceof basic_1.CharacterType) {
99
+ return new basic_1.CharacterType(type.getLength(), rest);
100
+ }
101
+ else if (type instanceof basic_1.IntegerType) {
102
+ return basic_1.IntegerType.get(rest);
103
+ }
104
+ else if (type instanceof basic_1.StringType) {
105
+ return basic_1.StringType.get(rest);
106
+ }
107
+ return type;
108
+ }
78
109
  }
79
110
  exports.InlineData = InlineData;
80
111
  //# sourceMappingURL=inline_data.js.map
@@ -38,17 +38,35 @@ const Expressions = __importStar(require("../../2_statements/expressions"));
38
38
  const inline_data_1 = require("../expressions/inline_data");
39
39
  const basic_1 = require("../../types/basic");
40
40
  const target_1 = require("../expressions/target");
41
+ const _syntax_input_1 = require("../_syntax_input");
41
42
  class GetTime {
42
43
  runSyntax(node, input) {
43
44
  const target = node.findDirectExpression(Expressions.Target);
45
+ const stamp = node.findDirectTokenByText("STAMP") !== undefined;
44
46
  const inline = target === null || target === void 0 ? void 0 : target.findDirectExpression(Expressions.InlineData);
45
47
  if (inline) {
46
48
  inline_data_1.InlineData.runSyntax(inline, input, new basic_1.PackedType(8, 0));
47
49
  }
48
50
  else if (target) {
49
- target_1.Target.runSyntax(target, input);
51
+ const type = target_1.Target.runSyntax(target, input);
52
+ if (stamp === true && this.compatibleTimeStamp(type) === false) {
53
+ const message = "GET TIME STAMP FIELD, target type not compatible";
54
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
55
+ return;
56
+ }
50
57
  }
51
58
  }
59
+ // the target must be a timestamp, ie. packed(timestamp and timestampl) or utclong
60
+ compatibleTimeStamp(type) {
61
+ return type === undefined
62
+ || type instanceof basic_1.PackedType
63
+ || type instanceof basic_1.UTCLongType
64
+ || type instanceof basic_1.VoidType
65
+ || type instanceof basic_1.AnyType
66
+ || type instanceof basic_1.DataType
67
+ || type instanceof basic_1.UnknownType
68
+ || type.isGeneric();
69
+ }
52
70
  }
53
71
  exports.GetTime = GetTime;
54
72
  //# sourceMappingURL=get_time.js.map
@@ -75,7 +75,7 @@ class Registry {
75
75
  }
76
76
  static abaplintVersion() {
77
77
  // magic, see build script "version.js"
78
- return "2.120.46";
78
+ return "2.120.47";
79
79
  }
80
80
  getDDICReferences() {
81
81
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.120.46",
3
+ "version": "2.120.47",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",