@abaplint/core 2.113.121 → 2.113.123

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.
@@ -3241,6 +3241,8 @@ export declare const enum IdentifierMeta {
3241
3241
  export declare interface IDependency {
3242
3242
  /** Url of a git repository */
3243
3243
  url?: string;
3244
+ /** Git branch */
3245
+ branch?: string;
3244
3246
  /** Name of local folder with dependencies */
3245
3247
  folder?: string;
3246
3248
  /** File search, glob pattern */
@@ -4,6 +4,7 @@ exports.TypeUtils = void 0;
4
4
  const types_1 = require("../types");
5
5
  const basic_1 = require("../types/basic");
6
6
  const cgeneric_type_1 = require("../types/basic/cgeneric_type");
7
+ const Expressions = require("../2_statements/expressions");
7
8
  // todo: refactor to static? for performance
8
9
  class TypeUtils {
9
10
  constructor(scope) {
@@ -222,8 +223,22 @@ class TypeUtils {
222
223
  }
223
224
  return false;
224
225
  }
225
- isAssignableStrict(source, target, calculated = false) {
226
+ isCalculated(node) {
227
+ /*
228
+ if (node.getChildren().length === 1
229
+ && node.get() instanceof Expressions.Source
230
+ && node.getFirstChild()?.get() instanceof Expressions.MethodCallChain) {
231
+ return false;
232
+ }
233
+ */
234
+ const calculated = node.findFirstExpression(Expressions.MethodCallChain) !== undefined
235
+ || node.findFirstExpression(Expressions.StringTemplate) !== undefined
236
+ || node.findFirstExpression(Expressions.ArithOperator) !== undefined;
237
+ return calculated;
238
+ }
239
+ isAssignableStrict(source, target, node) {
226
240
  var _a, _b, _c, _d, _e, _f, _g, _h;
241
+ const calculated = node ? this.isCalculated(node) : false;
227
242
  /*
228
243
  console.dir(source);
229
244
  console.dir(target);
@@ -275,6 +290,13 @@ class TypeUtils {
275
290
  else if (source instanceof basic_1.StringType) {
276
291
  if (target instanceof basic_1.StructureType && this.structureContainsString(target)) {
277
292
  return false;
293
+ /*
294
+ } else if (target instanceof CharacterType) {
295
+ if (source.getAbstractTypeData()?.derivedFromConstant === true) {
296
+ return true;
297
+ }
298
+ return false;
299
+ */
278
300
  }
279
301
  else if (target instanceof basic_1.IntegerType) {
280
302
  if (((_f = source.getAbstractTypeData()) === null || _f === void 0 ? void 0 : _f.derivedFromConstant) === true) {
@@ -70,15 +70,12 @@ class MethodCallParam {
70
70
  if (child.get() instanceof Expressions.Source) {
71
71
  sourceType = new source_1.Source().runSyntax(child, input, targetType);
72
72
  }
73
- const calculated = child.findFirstExpression(Expressions.MethodCallChain) !== undefined
74
- || child.findFirstExpression(Expressions.StringTemplate) !== undefined
75
- || child.findFirstExpression(Expressions.ArithOperator) !== undefined;
76
73
  if (sourceType === undefined) {
77
74
  const message = "No source type determined, method source";
78
75
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
79
76
  return;
80
77
  }
81
- else if (new _type_utils_1.TypeUtils(input.scope).isAssignableStrict(sourceType, targetType, calculated) === false) {
78
+ else if (new _type_utils_1.TypeUtils(input.scope).isAssignableStrict(sourceType, targetType, child) === false) {
82
79
  const message = "Method parameter type not compatible";
83
80
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
84
81
  return;
@@ -158,15 +158,12 @@ class MethodParameters {
158
158
  }
159
159
  for (const item of items) {
160
160
  const parameter = allImporting.find(p => p.getName().toUpperCase() === item.name);
161
- const calculated = item.source.findFirstExpression(Expressions.MethodCallChain) !== undefined
162
- || item.source.findFirstExpression(Expressions.StringTemplate) !== undefined
163
- || item.source.findFirstExpression(Expressions.ArithOperator) !== undefined;
164
161
  if (parameter === undefined) {
165
162
  const message = "Method importing parameter \"" + item.name + "\" does not exist";
166
163
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
167
164
  continue;
168
165
  }
169
- else if (new _type_utils_1.TypeUtils(input.scope).isAssignableStrict(item.sourceType, parameter.getType(), calculated) === false) {
166
+ else if (new _type_utils_1.TypeUtils(input.scope).isAssignableStrict(item.sourceType, parameter.getType(), item.source) === false) {
170
167
  const message = "Method parameter type not compatible, " + item.name;
171
168
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
172
169
  return;
@@ -120,16 +120,13 @@ class CreateObject {
120
120
  }
121
121
  const source = p.findDirectExpression(Expressions.Source);
122
122
  const sourceType = new source_1.Source().runSyntax(source, input);
123
- const calculated = (source === null || source === void 0 ? void 0 : source.findFirstExpression(Expressions.MethodCallChain)) !== undefined
124
- || (source === null || source === void 0 ? void 0 : source.findFirstExpression(Expressions.StringTemplate)) !== undefined
125
- || (source === null || source === void 0 ? void 0 : source.findFirstExpression(Expressions.ArithOperator)) !== undefined;
126
123
  const found = allImporting === null || allImporting === void 0 ? void 0 : allImporting.find(p => p.getName().toUpperCase() === name);
127
124
  if (found === undefined) {
128
125
  const message = `constructor parameter "${name}" does not exist`;
129
126
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
130
127
  return;
131
128
  }
132
- else if (new _type_utils_1.TypeUtils(input.scope).isAssignableStrict(sourceType, found.getType(), calculated) === false) {
129
+ else if (new _type_utils_1.TypeUtils(input.scope).isAssignableStrict(sourceType, found.getType(), source) === false) {
133
130
  const message = `constructor parameter "${name}" type not compatible`;
134
131
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
135
132
  return;
@@ -67,7 +67,7 @@ class Registry {
67
67
  }
68
68
  static abaplintVersion() {
69
69
  // magic, see build script "version.sh"
70
- return "2.113.121";
70
+ return "2.113.123";
71
71
  }
72
72
  getDDICReferences() {
73
73
  return this.ddicReferences;
@@ -59,6 +59,7 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#check-vs-re
59
59
  else if (this.conf.allowCheck === false && get instanceof Statements.Check && stack.length === 0) {
60
60
  const message = "CHECK is not allowed outside of loops";
61
61
  let tokensString = statement.concatTokens();
62
+ tokensString = tokensString.replace(/^check /i, "CHECK ");
62
63
  tokensString = tokensString.split("CHECK")[1].trim();
63
64
  const replacement = "IF NOT " + tokensString + "\n RETURN.\nENDIF.";
64
65
  const fix = edit_helper_1.EditHelper.replaceRange(file, statement.getFirstToken().getStart(), statement.getLastToken().getEnd(), replacement);
@@ -47,8 +47,9 @@ ENDINTERFACE.`,
47
47
  var _a;
48
48
  const issues = [];
49
49
  for (const s of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllStatements(Statements.MethodDef)) || []) {
50
- if (s.findDirectExpression(Expressions.MethodDefExceptions)) {
51
- issues.push(issue_1.Issue.atStatement(file, s, this.getMessage(), this.getMetadata().key));
50
+ const expr = s.findDirectExpression(Expressions.MethodDefExceptions);
51
+ if (expr) {
52
+ issues.push(issue_1.Issue.atToken(file, expr.getFirstToken(), this.getMessage(), this.getMetadata().key));
52
53
  }
53
54
  }
54
55
  return issues;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.113.121",
3
+ "version": "2.113.123",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -53,10 +53,10 @@
53
53
  "@microsoft/api-extractor": "^7.52.8",
54
54
  "@types/chai": "^4.3.20",
55
55
  "@types/mocha": "^10.0.10",
56
- "@types/node": "^22.15.19",
56
+ "@types/node": "^22.15.21",
57
57
  "chai": "^4.5.0",
58
58
  "eslint": "^9.27.0",
59
- "mocha": "^11.3.0",
59
+ "mocha": "^11.5.0",
60
60
  "c8": "^10.1.3",
61
61
  "source-map-support": "^0.5.21",
62
62
  "ts-json-schema-generator": "^2.4.0",