@abaplint/core 2.113.135 → 2.113.137

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.
@@ -5570,6 +5570,7 @@ export declare class Registry implements IRegistry {
5570
5570
  private readonly ddicReferences;
5571
5571
  private readonly msagReferences;
5572
5572
  private readonly macroReferences;
5573
+ private errorNamespace;
5573
5574
  private conf;
5574
5575
  constructor(conf?: IConfiguration);
5575
5576
  static abaplintVersion(): string;
@@ -5710,6 +5711,7 @@ declare class RollbackEntities implements IStatement {
5710
5711
 
5711
5712
  export declare class RulesRunner {
5712
5713
  private readonly reg;
5714
+ private readonly syntaxPerformance;
5713
5715
  constructor(reg: IRegistry);
5714
5716
  objectsToCheck(objects: Iterable<IObject>): readonly IObject[];
5715
5717
  runRules(objects: Iterable<IObject>, input?: IRunInput): readonly Issue[];
@@ -6,7 +6,7 @@ const combi_1 = require("../combi");
6
6
  class MessageClass extends combi_1.Expression {
7
7
  getRunnable() {
8
8
  // "&1" can be used for almost anything(field names, method names etc.) in macros
9
- return (0, combi_1.seq)((0, combi_1.regex)(/^>?[\w\/]+#?@?\/?!?&?>?\$?\??<?$/), (0, combi_1.starPrio)((0, combi_1.tok)(tokens_1.Plus)), (0, combi_1.starPrio)((0, combi_1.tok)(tokens_1.PlusW)), (0, combi_1.starPrio)((0, combi_1.seq)((0, combi_1.tok)(tokens_1.Dash), (0, combi_1.optPrio)((0, combi_1.regex)(/^\w+$/)))), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.DashW)));
9
+ return (0, combi_1.seq)((0, combi_1.regex)(/^>?[\w\/]+#?@?\/?!?&?>?\$?\??<?§?~?$/), (0, combi_1.starPrio)((0, combi_1.tok)(tokens_1.Plus)), (0, combi_1.starPrio)((0, combi_1.tok)(tokens_1.PlusW)), (0, combi_1.starPrio)((0, combi_1.seq)((0, combi_1.tok)(tokens_1.Dash), (0, combi_1.optPrio)((0, combi_1.regex)(/^\w+$/)))), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.DashW)));
10
10
  }
11
11
  }
12
12
  exports.MessageClass = MessageClass;
@@ -7,7 +7,7 @@ const version_1 = require("../../../version");
7
7
  const transporting_fields_1 = require("../expressions/transporting_fields");
8
8
  class ReadTable {
9
9
  getMatcher() {
10
- const comparing = (0, combi_1.seq)("COMPARING", (0, combi_1.alt)((0, combi_1.plus)(expressions_1.FieldSub), expressions_1.Dynamic));
10
+ const comparing = (0, combi_1.seq)("COMPARING", (0, combi_1.alt)((0, combi_1.plus)(expressions_1.FieldSub), (0, combi_1.plus)(expressions_1.Dynamic)));
11
11
  const index = (0, combi_1.seq)("INDEX", expressions_1.Source);
12
12
  const components = (0, combi_1.seq)((0, combi_1.alt)(expressions_1.Field, expressions_1.Dynamic), "COMPONENTS", expressions_1.ComponentCompareSimple);
13
13
  const key = (0, combi_1.seq)((0, combi_1.altPrio)("WITH KEY", "WITH TABLE KEY"), (0, combi_1.alt)(expressions_1.ComponentCompareSimple, components, (0, combi_1.seq)((0, combi_1.optPrio)("="), expressions_1.Source)));
@@ -203,6 +203,13 @@ class TypeUtils {
203
203
  }
204
204
  return ret;
205
205
  }
206
+ isConvable(source, target) {
207
+ if (source instanceof basic_1.TableType && target instanceof basic_1.TableType) {
208
+ // table key conversion, eg DEFAULT to EMPTY
209
+ return this.isAssignable(source.getRowType(), target.getRowType());
210
+ }
211
+ return this.isAssignable(source, target);
212
+ }
206
213
  isCastable(_source, _target) {
207
214
  // todo
208
215
  return true;
@@ -111,7 +111,7 @@ class Source {
111
111
  {
112
112
  const foundType = this.determineType(node, input, targetType);
113
113
  const bodyType = conv_body_1.ConvBody.runSyntax(node.findDirectExpression(Expressions.ConvBody), input);
114
- if (new _type_utils_1.TypeUtils(input.scope).isAssignable(foundType, bodyType) === false) {
114
+ if (new _type_utils_1.TypeUtils(input.scope).isConvable(foundType, bodyType) === false) {
115
115
  const message = `CONV: Types not compatible, ${foundType === null || foundType === void 0 ? void 0 : foundType.constructor.name}, ${bodyType === null || bodyType === void 0 ? void 0 : bodyType.constructor.name}`;
116
116
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
117
117
  return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
@@ -60,14 +60,14 @@ class Registry {
60
60
  this.objects = {};
61
61
  this.objectsByType = {};
62
62
  this.dependencies = {};
63
- this.conf = conf ? conf : config_1.Config.getDefault();
63
+ this.setConfig(conf ? conf : config_1.Config.getDefault());
64
64
  this.ddicReferences = new ddic_references_1.DDICReferences();
65
65
  this.msagReferences = new msag_references_1.MSAGReferences();
66
66
  this.macroReferences = new macro_references_1.MacroReferences();
67
67
  }
68
68
  static abaplintVersion() {
69
69
  // magic, see build script "version.sh"
70
- return "2.113.135";
70
+ return "2.113.137";
71
71
  }
72
72
  getDDICReferences() {
73
73
  return this.ddicReferences;
@@ -145,12 +145,11 @@ class Registry {
145
145
  obj.setDirty();
146
146
  }
147
147
  this.conf = conf;
148
+ this.errorNamespace = new RegExp(this.getConfig().getSyntaxSetttings().errorNamespace, "i");
148
149
  return this;
149
150
  }
150
151
  inErrorNamespace(name) {
151
- // todo: performance? cache regexp?
152
- const reg = new RegExp(this.getConfig().getSyntaxSetttings().errorNamespace, "i");
153
- return reg.test(name);
152
+ return this.errorNamespace.test(name);
154
153
  }
155
154
  addFile(file) {
156
155
  return this.addFiles([file]);
@@ -6,9 +6,35 @@ const artifacts_rules_1 = require("./artifacts_rules");
6
6
  const _abap_object_1 = require("./objects/_abap_object");
7
7
  const skip_logic_1 = require("./skip_logic");
8
8
  const excludeHelper_1 = require("./utils/excludeHelper");
9
+ class SyntaxPerformance {
10
+ constructor() {
11
+ this.results = [];
12
+ }
13
+ push(obj, runtime) {
14
+ if (runtime < 100) {
15
+ return;
16
+ }
17
+ this.results.push({
18
+ runtime: runtime,
19
+ name: obj.getType() + " " + obj.getName(),
20
+ });
21
+ }
22
+ output() {
23
+ const MAX = 10;
24
+ this.results.sort((a, b) => { return b.runtime - a.runtime; });
25
+ for (let i = 0; i < MAX; i++) {
26
+ const row = this.results[i];
27
+ if (row === undefined) {
28
+ break;
29
+ }
30
+ process.stderr.write(`\t${row.runtime}ms\t${row.name}\n`);
31
+ }
32
+ }
33
+ }
9
34
  class RulesRunner {
10
35
  constructor(reg) {
11
36
  this.reg = reg;
37
+ this.syntaxPerformance = new SyntaxPerformance();
12
38
  }
13
39
  objectsToCheck(objects) {
14
40
  const check = [];
@@ -33,12 +59,25 @@ class RulesRunner {
33
59
  for (const obj of check) {
34
60
  (_b = input === null || input === void 0 ? void 0 : input.progress) === null || _b === void 0 ? void 0 : _b.tick("Run Syntax - " + obj.getName());
35
61
  if (obj instanceof _abap_object_1.ABAPObject) {
62
+ const start = Date.now();
36
63
  new syntax_1.SyntaxLogic(this.reg, obj).run();
64
+ if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {
65
+ this.syntaxPerformance.push(obj, Date.now() - start);
66
+ }
37
67
  }
38
68
  }
69
+ if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {
70
+ process.stderr.write("Syntax Performance:\n");
71
+ this.syntaxPerformance.output();
72
+ }
39
73
  (_c = input === null || input === void 0 ? void 0 : input.progress) === null || _c === void 0 ? void 0 : _c.set(rules.length, "Initialize Rules");
40
74
  for (const rule of rules) {
41
- (_d = input === null || input === void 0 ? void 0 : input.progress) === null || _d === void 0 ? void 0 : _d.tick("Initialize Rules - " + rule.getMetadata().key);
75
+ if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {
76
+ process.stderr.write("Initializing rule " + rule.getMetadata().key + "\n");
77
+ }
78
+ else {
79
+ (_d = input === null || input === void 0 ? void 0 : input.progress) === null || _d === void 0 ? void 0 : _d.tick("Initialize Rules - " + rule.getMetadata().key);
80
+ }
42
81
  if (rule.initialize === undefined) {
43
82
  throw new Error(rule.getMetadata().key + " missing initialize method");
44
83
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.113.135",
3
+ "version": "2.113.137",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -53,9 +53,9 @@
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": "^24.0.8",
56
+ "@types/node": "^24.0.10",
57
57
  "chai": "^4.5.0",
58
- "eslint": "^9.30.0",
58
+ "eslint": "^9.30.1",
59
59
  "mocha": "^11.7.1",
60
60
  "c8": "^10.1.3",
61
61
  "source-map-support": "^0.5.21",