@abaplint/core 2.120.94 → 2.120.96

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.
@@ -67,8 +67,11 @@ class ObjectOriented {
67
67
  }
68
68
  return ret;
69
69
  }
70
- addAliasedAttributes(classDefinition) {
70
+ addAliasedAttributes(classDefinition, inherited = false) {
71
71
  for (const alias of classDefinition.getAliases() || []) {
72
+ if (inherited === true && alias.getVisibility() === visibility_1.Visibility.Private) {
73
+ continue;
74
+ }
72
75
  const comp = alias.getComponent();
73
76
  const idef = this.scope.findInterfaceDefinition(comp.split("~")[0]);
74
77
  if (idef) {
@@ -82,12 +85,15 @@ class ObjectOriented {
82
85
  if (superName !== undefined) {
83
86
  const def = this.scope.findClassDefinition(superName);
84
87
  if (def) {
85
- this.addAliasedAttributes(def);
88
+ this.addAliasedAttributes(def, true);
86
89
  }
87
90
  }
88
91
  }
89
- addAliasedTypes(classDefinition) {
92
+ addAliasedTypes(classDefinition, inherited = false) {
90
93
  for (const alias of classDefinition.getAliases() || []) {
94
+ if (inherited === true && alias.getVisibility() === visibility_1.Visibility.Private) {
95
+ continue;
96
+ }
91
97
  const comp = alias.getComponent();
92
98
  const idef = this.scope.findInterfaceDefinition(comp.split("~")[0]);
93
99
  if (idef) {
@@ -101,7 +107,7 @@ class ObjectOriented {
101
107
  if (superName !== undefined) {
102
108
  const def = this.scope.findClassDefinition(superName);
103
109
  if (def) {
104
- this.addAliasedTypes(def);
110
+ this.addAliasedTypes(def, true);
105
111
  }
106
112
  }
107
113
  }
@@ -165,9 +165,10 @@ class Source {
165
165
  return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
166
166
  }
167
167
  if ((foundType === null || foundType === void 0 ? void 0 : foundType.isGeneric()) && bodyType !== undefined) {
168
- this.addIfInferred(node, input, bodyType);
168
+ const derived = this.inferGenericConv(foundType, input) || bodyType;
169
+ this.addIfInferred(node, input, derived);
169
170
  this.traverseRemainingChildren(children, input);
170
- return bodyType;
171
+ return derived;
171
172
  }
172
173
  this.addIfInferred(node, input, foundType);
173
174
  this.traverseRemainingChildren(children, input);
@@ -469,6 +470,19 @@ class Source {
469
470
  }
470
471
  }
471
472
  }
473
+ /** CONV #( ) at a generic operand position, the type ABAP derives for the # */
474
+ static inferGenericConv(foundType, input) {
475
+ if (foundType instanceof basic_1.CLikeType || foundType instanceof basic_1.CSequenceType) {
476
+ return input.scope.getDDIC().lookupBuiltinType("STRING");
477
+ }
478
+ else if (foundType instanceof basic_1.XSequenceType) {
479
+ return input.scope.getDDIC().lookupBuiltinType("XSTRING");
480
+ }
481
+ else if (foundType instanceof basic_1.NumericGenericType || foundType instanceof basic_1.DecFloatType) {
482
+ return input.scope.getDDIC().lookupBuiltinType("DECFLOAT34", undefined, undefined, "DECFLOAT34");
483
+ }
484
+ return undefined;
485
+ }
472
486
  static determineType(node, input, targetType) {
473
487
  const basic = new basic_types_1.BasicTypes(input);
474
488
  const typeExpression = node.findDirectExpression(Expressions.TypeNameOrInfer);
@@ -266,6 +266,8 @@ class MethodParameters {
266
266
  || concat.includes(" FOR FEATURES ")
267
267
  || concat.includes(" FOR INSTANCE FEATURES ")
268
268
  || concat.includes(" FOR GLOBAL AUTHORIZATION ")
269
+ || concat.includes(" FOR INSTANCE AUTHORIZATION ")
270
+ || concat.includes(" FOR AUTHORIZATION ")
269
271
  || concat.includes(" FOR PRECHECK ")
270
272
  || concat.includes(" FOR NUMBERING ")
271
273
  || concat.includes(" FOR READ ")
@@ -75,7 +75,7 @@ class Registry {
75
75
  }
76
76
  static abaplintVersion() {
77
77
  // magic, see build script "version.js"
78
- return "2.120.94";
78
+ return "2.120.96";
79
79
  }
80
80
  getDDICReferences() {
81
81
  return this.ddicReferences;
@@ -3334,8 +3334,12 @@ ${indentation} output = ${uniqueName}.\n`;
3334
3334
  const indent = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
3335
3335
  // the CONV type might just be a component of the row type, so prefer the row type
3336
3336
  const rowOf = this.findRowTypeOf(high, i);
3337
+ const type = rowOf === undefined ? this.findType(i, lowFile, highSyntax) : undefined;
3338
+ if (rowOf === undefined && type === undefined) {
3339
+ return issue_1.Issue.atToken(lowFile, i.getFirstToken(), "Downport CONV, type of # not known", this.getMetadata().key, this.conf.severity);
3340
+ }
3337
3341
  const declaration = rowOf === undefined
3338
- ? `DATA ${uniqueName} TYPE ${this.findType(i, lowFile, highSyntax)}.`
3342
+ ? `DATA ${uniqueName} TYPE ${type}.`
3339
3343
  : `DATA ${uniqueName} LIKE LINE OF ${rowOf}.`;
3340
3344
  const abap = declaration + "\n" +
3341
3345
  indent + `${uniqueName} = ${body}.\n` +
@@ -74,6 +74,7 @@ class XMLConsistency {
74
74
  * Transparent TABL objects have delivery class and size category set
75
75
  * TABL fields with a built-in type carry the INTTYPE abapGit serializes for it, for the confirmed pairs
76
76
  * Lock parameter names in ENQU objects are max 16 characters
77
+ * DEVC objects are serialized as package.devc.xml
77
78
  * Texts and translations do not exceed maximum allowed length.`,
78
79
  tags: [_irule_1.RuleTag.Naming, _irule_1.RuleTag.Syntax],
79
80
  };
@@ -134,6 +135,9 @@ class XMLConsistency {
134
135
  else if (obj instanceof Objects.LockObject) {
135
136
  issues.push(...this.runLockObject(obj, file));
136
137
  }
138
+ else if (obj instanceof Objects.Package) {
139
+ issues.push(...this.runPackage(obj, file));
140
+ }
137
141
  if (obj instanceof _abap_object_1.ABAPObject) {
138
142
  issues.push(...this.runTextPool(obj, file));
139
143
  }
@@ -159,14 +163,26 @@ class XMLConsistency {
159
163
  return issues;
160
164
  }
161
165
  checkClearedFields(obj, file, structure, fields) {
162
- var _a, _b;
166
+ var _a;
163
167
  const issues = [];
164
- const block = (_b = (_a = obj.getXML()) === null || _a === void 0 ? void 0 : _a.match(new RegExp(`<${structure}>([\\s\\S]*?)</${structure}>`))) === null || _b === void 0 ? void 0 : _b[1];
165
- if (block === undefined) {
168
+ const xml = obj.getXML();
169
+ const start = (_a = xml === null || xml === void 0 ? void 0 : xml.indexOf(`<${structure}>`)) !== null && _a !== void 0 ? _a : -1;
170
+ if (xml === undefined || start < 0) {
166
171
  return issues;
167
172
  }
173
+ const end = xml.indexOf(`</${structure}>`, start);
174
+ if (end < 0) {
175
+ return issues;
176
+ }
177
+ const present = new Set();
178
+ const tag = /<([A-Z0-9_]+)[\s/>]/g;
179
+ tag.lastIndex = start + structure.length + 2;
180
+ let match;
181
+ while ((match = tag.exec(xml)) !== null && match.index < end) {
182
+ present.add(match[1]);
183
+ }
168
184
  for (const field of fields) {
169
- if (block.match(new RegExp(`<${field}[\\s/>]`)) !== null) {
185
+ if (present.has(field)) {
170
186
  const message = `Field ${field} in ${structure} is cleared by abapGit and should not be in the XML`;
171
187
  issues.push(issue_1.Issue.atRow(file, 1, message, this.getMetadata().key, this.conf.severity));
172
188
  }
@@ -334,6 +350,15 @@ class XMLConsistency {
334
350
  }
335
351
  return issues;
336
352
  }
353
+ runPackage(obj, file) {
354
+ // abapGit always serializes DEVC as package.devc.xml, the package name comes from the folder;
355
+ // the object name is taken from the filename, so it must be PACKAGE
356
+ if (obj.getName().toUpperCase() !== "PACKAGE") {
357
+ const message = `DEVC file must be named "package.devc.xml", found "${obj.getName().toLowerCase()}.devc.xml"`;
358
+ return [issue_1.Issue.atRow(file, 1, message, this.getMetadata().key, this.conf.severity)];
359
+ }
360
+ return [];
361
+ }
337
362
  runLockObject(obj, file) {
338
363
  var _a;
339
364
  const maxParameterLength = 16;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.120.94",
3
+ "version": "2.120.96",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -56,10 +56,10 @@
56
56
  "@types/chai": "^4.3.20",
57
57
  "@types/mocha": "^10.0.10",
58
58
  "@types/node": "^24.13.3",
59
- "c8": "^11.0.0",
59
+ "c8": "^12.0.0",
60
60
  "chai": "^4.5.0",
61
61
  "eslint": "^9.39.5",
62
- "mocha": "^11.8.0",
62
+ "mocha": "^12.0.3",
63
63
  "rimraf": "^6.1.4",
64
64
  "source-map-support": "^0.5.21",
65
65
  "ts-json-schema-generator": "^2.9.0",