@abaplint/cli 2.102.65 → 2.102.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.
Files changed (2) hide show
  1. package/build/cli.js +46 -17
  2. package/package.json +3 -3
package/build/cli.js CHANGED
@@ -25507,6 +25507,7 @@ const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/c
25507
25507
  const _object_oriented_1 = __webpack_require__(/*! ../_object_oriented */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js");
25508
25508
  const method_parameters_1 = __webpack_require__(/*! ./method_parameters */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/method_parameters.js");
25509
25509
  const basic_types_1 = __webpack_require__(/*! ../basic_types */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/basic_types.js");
25510
+ const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js");
25510
25511
  class NewObject {
25511
25512
  runSyntax(node, scope, targetType, filename) {
25512
25513
  let ret = undefined;
@@ -25588,7 +25589,10 @@ class NewObject {
25588
25589
  if (type === undefined) {
25589
25590
  throw new Error("NewObject, no default importing parameter found for constructor, " + name);
25590
25591
  }
25591
- new source_1.Source().runSyntax(source, scope, filename, type);
25592
+ const sourceType = new source_1.Source().runSyntax(source, scope, filename, type);
25593
+ if (new _type_utils_1.TypeUtils(scope).isAssignableStrict(sourceType, type) === false) {
25594
+ throw new Error(`NEW parameter type not compatible`);
25595
+ }
25592
25596
  }
25593
25597
  else if (parameters) {
25594
25598
  // parameters with names
@@ -25678,7 +25682,12 @@ class ReduceBody {
25678
25682
  scope.push(_scope_type_1.ScopeType.Let, "LET", node.getFirstToken().getStart(), filename);
25679
25683
  scoped = true;
25680
25684
  }
25681
- const found = new inline_field_definition_1.InlineFieldDefinition().runSyntax(i, scope, filename, targetType);
25685
+ let foundType = targetType;
25686
+ const source = i.findDirectExpression(Expressions.Source);
25687
+ if (source) {
25688
+ foundType = new source_1.Source().runSyntax(source, scope, filename, targetType);
25689
+ }
25690
+ const found = new inline_field_definition_1.InlineFieldDefinition().runSyntax(i, scope, filename, foundType);
25682
25691
  if (found && first === undefined) {
25683
25692
  first = found;
25684
25693
  }
@@ -25773,6 +25782,9 @@ class Select {
25773
25782
  const token = node.getFirstToken();
25774
25783
  const from = node.findDirectExpression(Expressions.SQLFrom);
25775
25784
  const dbSources = from ? new sql_from_1.SQLFrom().runSyntax(from, scope, filename) : [];
25785
+ if (dbSources.length === 0) {
25786
+ throw new Error(`Missing FROM`);
25787
+ }
25776
25788
  const fields = this.findFields(node);
25777
25789
  if (fields.length === 0
25778
25790
  && node.findDirectExpression(Expressions.SQLFieldListLoop) === undefined) {
@@ -26564,7 +26576,7 @@ class StringTemplate {
26564
26576
  }
26565
26577
  else if ((typeUtils.isCharLike(type) === false && typeUtils.isHexLike(type) === false)
26566
26578
  || type instanceof basic_1.StructureType) {
26567
- throw new Error("Not character like, " + type.constructor.name);
26579
+ throw new Error("String template, not character like, " + type.constructor.name);
26568
26580
  }
26569
26581
  const format = templateSource.findDirectExpression(Expressions.StringTemplateFormatting);
26570
26582
  const formatConcat = format === null || format === void 0 ? void 0 : format.concatTokens();
@@ -28638,6 +28650,7 @@ const _reference_1 = __webpack_require__(/*! ../_reference */ "./node_modules/@a
28638
28650
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
28639
28651
  const types_1 = __webpack_require__(/*! ../../types */ "./node_modules/@abaplint/core/build/src/abap/types/index.js");
28640
28652
  const _object_oriented_1 = __webpack_require__(/*! ../_object_oriented */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js");
28653
+ const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js");
28641
28654
  class CreateObject {
28642
28655
  runSyntax(node, scope, filename) {
28643
28656
  let cdef = undefined;
@@ -28661,7 +28674,7 @@ class CreateObject {
28661
28674
  }
28662
28675
  }
28663
28676
  // just recurse
28664
- for (const s of node.findAllExpressions(Expressions.Source)) {
28677
+ for (const s of node.findDirectExpressions(Expressions.Source)) {
28665
28678
  new source_1.Source().runSyntax(s, scope, filename);
28666
28679
  }
28667
28680
  let first = true;
@@ -28705,26 +28718,35 @@ class CreateObject {
28705
28718
  for (const t of node.findDirectExpressions(Expressions.Dynamic)) {
28706
28719
  new dynamic_1.Dynamic().runSyntax(t, scope, filename);
28707
28720
  }
28708
- this.validateParameters(cdef, node, scope);
28721
+ this.validateParameters(cdef, node, scope, filename);
28709
28722
  }
28710
- validateParameters(cdef, node, scope) {
28711
- var _a, _b, _c;
28723
+ validateParameters(cdef, node, scope, filename) {
28724
+ var _a, _b, _c, _d;
28712
28725
  if (cdef === undefined) {
28726
+ const sources = (_a = node.findDirectExpression(Expressions.ParameterListS)) === null || _a === void 0 ? void 0 : _a.findAllExpressions(Expressions.Source);
28727
+ for (const s of sources || []) {
28728
+ new source_1.Source().runSyntax(s, scope, filename);
28729
+ }
28713
28730
  return;
28714
28731
  }
28715
28732
  const methodDef = new _object_oriented_1.ObjectOriented(scope).searchMethodName(cdef, "CONSTRUCTOR");
28716
- const methodParameters = (_a = methodDef.method) === null || _a === void 0 ? void 0 : _a.getParameters();
28733
+ const methodParameters = (_b = methodDef.method) === null || _b === void 0 ? void 0 : _b.getParameters();
28717
28734
  const allImporting = (methodParameters === null || methodParameters === void 0 ? void 0 : methodParameters.getImporting()) || [];
28718
28735
  const requiredImporting = new Set(methodParameters === null || methodParameters === void 0 ? void 0 : methodParameters.getRequiredParameters().map(i => i.getName().toUpperCase()));
28719
- // todo, validate types
28720
- for (const p of ((_b = node.findDirectExpression(Expressions.ParameterListS)) === null || _b === void 0 ? void 0 : _b.findAllExpressions(Expressions.ParameterS)) || []) {
28721
- const name = (_c = p.findDirectExpression(Expressions.ParameterName)) === null || _c === void 0 ? void 0 : _c.concatTokens().toUpperCase();
28736
+ for (const p of ((_c = node.findDirectExpression(Expressions.ParameterListS)) === null || _c === void 0 ? void 0 : _c.findAllExpressions(Expressions.ParameterS)) || []) {
28737
+ const name = (_d = p.findDirectExpression(Expressions.ParameterName)) === null || _d === void 0 ? void 0 : _d.concatTokens().toUpperCase();
28722
28738
  if (name === undefined) {
28723
28739
  continue;
28724
28740
  }
28725
- if ((allImporting === null || allImporting === void 0 ? void 0 : allImporting.some(p => p.getName().toUpperCase() === name)) === false) {
28741
+ const source = p.findDirectExpression(Expressions.Source);
28742
+ const sourceType = new source_1.Source().runSyntax(source, scope, filename);
28743
+ const found = allImporting === null || allImporting === void 0 ? void 0 : allImporting.find(p => p.getName().toUpperCase() === name);
28744
+ if (found === undefined) {
28726
28745
  throw new Error(`constructor parameter "${name}" does not exist`);
28727
28746
  }
28747
+ else if (new _type_utils_1.TypeUtils(scope).isAssignableStrict(sourceType, found.getType()) === false) {
28748
+ throw new Error(`constructor parameter "${name}" type not compatible`);
28749
+ }
28728
28750
  requiredImporting.delete(name);
28729
28751
  }
28730
28752
  for (const r of requiredImporting.values()) {
@@ -40129,10 +40151,17 @@ class AbstractFile {
40129
40151
  return this.filename;
40130
40152
  }
40131
40153
  baseName() {
40132
- const first = this.getFilename().split("\\");
40133
- const base1 = first[first.length - 1];
40134
- const base2 = base1.split("/");
40135
- return base2[base2.length - 1];
40154
+ let name = this.getFilename();
40155
+ let index = name.lastIndexOf("\\");
40156
+ if (index) {
40157
+ index = index + 1;
40158
+ }
40159
+ name = name.substring(index);
40160
+ index = name.lastIndexOf("/");
40161
+ if (index) {
40162
+ index = index + 1;
40163
+ }
40164
+ return name.substring(index);
40136
40165
  }
40137
40166
  getObjectType() {
40138
40167
  var _a;
@@ -50139,7 +50168,7 @@ class Registry {
50139
50168
  }
50140
50169
  static abaplintVersion() {
50141
50170
  // magic, see build script "version.sh"
50142
- return "2.102.65";
50171
+ return "2.102.67";
50143
50172
  }
50144
50173
  getDDICReferences() {
50145
50174
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.102.65",
3
+ "version": "2.102.67",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -38,12 +38,12 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.102.65",
41
+ "@abaplint/core": "^2.102.67",
42
42
  "@types/chai": "^4.3.9",
43
43
  "@types/glob": "^7.2.0",
44
44
  "@types/minimist": "^1.2.4",
45
45
  "@types/mocha": "^10.0.3",
46
- "@types/node": "^20.8.9",
46
+ "@types/node": "^20.8.10",
47
47
  "@types/progress": "^2.0.6",
48
48
  "chai": "^4.3.10",
49
49
  "chalk": "^5.3.0",