@abaplint/cli 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.
Files changed (2) hide show
  1. package/build/cli.js +52 -3
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -31834,6 +31834,17 @@ var __importStar = (this && this.__importStar) || (function () {
31834
31834
  return result;
31835
31835
  };
31836
31836
  })();
31837
+ var __rest = (this && this.__rest) || function (s, e) {
31838
+ var t = {};
31839
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
31840
+ t[p] = s[p];
31841
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
31842
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
31843
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
31844
+ t[p[i]] = s[p[i]];
31845
+ }
31846
+ return t;
31847
+ };
31837
31848
  Object.defineProperty(exports, "__esModule", ({ value: true }));
31838
31849
  exports.InlineData = void 0;
31839
31850
  const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
@@ -31866,7 +31877,7 @@ class InlineData {
31866
31877
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
31867
31878
  type = basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
31868
31879
  }
31869
- const identifier = new _typed_identifier_1.TypedIdentifier(token, input.filename, type, ["inline" /* IdentifierMeta.InlineDefinition */]);
31880
+ const identifier = new _typed_identifier_1.TypedIdentifier(token, input.filename, this.stripDerivedFromConstant(type), ["inline" /* IdentifierMeta.InlineDefinition */]);
31870
31881
  input.scope.addIdentifier(identifier);
31871
31882
  input.scope.addReference(token, identifier, _reference_1.ReferenceType.DataWriteReference, input.filename);
31872
31883
  }
@@ -31877,6 +31888,26 @@ class InlineData {
31877
31888
  input.scope.addReference(token, identifier, _reference_1.ReferenceType.DataWriteReference, input.filename);
31878
31889
  }
31879
31890
  }
31891
+ // The inferred type is taken from the source expression, which might be a literal.
31892
+ // The variable itself is not a constant, so the relaxations that apply to literals
31893
+ // must not be inherited, eg. a "c" variable is not assignable to a "string" parameter
31894
+ static stripDerivedFromConstant(type) {
31895
+ const data = type.getAbstractTypeData();
31896
+ if ((data === null || data === void 0 ? void 0 : data.derivedFromConstant) !== true) {
31897
+ return type;
31898
+ }
31899
+ const { derivedFromConstant } = data, rest = __rest(data, ["derivedFromConstant"]);
31900
+ if (type instanceof basic_1.CharacterType) {
31901
+ return new basic_1.CharacterType(type.getLength(), rest);
31902
+ }
31903
+ else if (type instanceof basic_1.IntegerType) {
31904
+ return basic_1.IntegerType.get(rest);
31905
+ }
31906
+ else if (type instanceof basic_1.StringType) {
31907
+ return basic_1.StringType.get(rest);
31908
+ }
31909
+ return type;
31910
+ }
31880
31911
  }
31881
31912
  exports.InlineData = InlineData;
31882
31913
  //# sourceMappingURL=inline_data.js.map
@@ -41565,17 +41596,35 @@ const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expr
41565
41596
  const inline_data_1 = __webpack_require__(/*! ../expressions/inline_data */ "../core/build/src/abap/5_syntax/expressions/inline_data.js");
41566
41597
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
41567
41598
  const target_1 = __webpack_require__(/*! ../expressions/target */ "../core/build/src/abap/5_syntax/expressions/target.js");
41599
+ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
41568
41600
  class GetTime {
41569
41601
  runSyntax(node, input) {
41570
41602
  const target = node.findDirectExpression(Expressions.Target);
41603
+ const stamp = node.findDirectTokenByText("STAMP") !== undefined;
41571
41604
  const inline = target === null || target === void 0 ? void 0 : target.findDirectExpression(Expressions.InlineData);
41572
41605
  if (inline) {
41573
41606
  inline_data_1.InlineData.runSyntax(inline, input, new basic_1.PackedType(8, 0));
41574
41607
  }
41575
41608
  else if (target) {
41576
- target_1.Target.runSyntax(target, input);
41609
+ const type = target_1.Target.runSyntax(target, input);
41610
+ if (stamp === true && this.compatibleTimeStamp(type) === false) {
41611
+ const message = "GET TIME STAMP FIELD, target type not compatible";
41612
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
41613
+ return;
41614
+ }
41577
41615
  }
41578
41616
  }
41617
+ // the target must be a timestamp, ie. packed(timestamp and timestampl) or utclong
41618
+ compatibleTimeStamp(type) {
41619
+ return type === undefined
41620
+ || type instanceof basic_1.PackedType
41621
+ || type instanceof basic_1.UTCLongType
41622
+ || type instanceof basic_1.VoidType
41623
+ || type instanceof basic_1.AnyType
41624
+ || type instanceof basic_1.DataType
41625
+ || type instanceof basic_1.UnknownType
41626
+ || type.isGeneric();
41627
+ }
41579
41628
  }
41580
41629
  exports.GetTime = GetTime;
41581
41630
  //# sourceMappingURL=get_time.js.map
@@ -70343,7 +70392,7 @@ class Registry {
70343
70392
  }
70344
70393
  static abaplintVersion() {
70345
70394
  // magic, see build script "version.js"
70346
- return "2.120.46";
70395
+ return "2.120.47";
70347
70396
  }
70348
70397
  getDDICReferences() {
70349
70398
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.46",
3
+ "version": "2.120.47",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "homepage": "https://abaplint.org",
41
41
  "devDependencies": {
42
- "@abaplint/core": "^2.120.46",
42
+ "@abaplint/core": "^2.120.47",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",