@abaplint/core 2.119.17 → 2.119.19

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.
@@ -3487,6 +3487,8 @@ declare interface IGlobalConfig {
3487
3487
  useApackDependencies?: boolean;
3488
3488
  /** Do not report any issues for includes without main programs */
3489
3489
  skipIncludesWithoutMain?: boolean;
3490
+ /** Throw an error if multiple files with the same filename are added to the registry, ignores package.devc.xml */
3491
+ errorOnDuplicateFilenames?: boolean;
3490
3492
  /** list of files to exclude, these files are not added when running syntax check or any other rules, case insensitive regex
3491
3493
  * @uniqueItems true
3492
3494
  */
@@ -5769,6 +5771,8 @@ export declare class Registry implements IRegistry {
5769
5771
  updateFile(file: IFile): IRegistry;
5770
5772
  removeFile(file: IFile): IRegistry;
5771
5773
  private _addFiles;
5774
+ private checkDuplicateFilename;
5775
+ private static filenameBasename;
5772
5776
  addFiles(files: readonly IFile[]): IRegistry;
5773
5777
  addDependencies(files: readonly IFile[]): IRegistry;
5774
5778
  addDependency(file: IFile): IRegistry;
@@ -31,6 +31,12 @@ class CallFunction {
31
31
  for (const s of node.findDirectExpressions(Expressions.Source)) {
32
32
  source_1.Source.runSyntax(s, input);
33
33
  }
34
+ for (const d of node.findDirectExpressions(Expressions.Destination)) {
35
+ const source = d.findFirstExpression(Expressions.Source);
36
+ if (source) {
37
+ source_1.Source.runSyntax(source, input);
38
+ }
39
+ }
34
40
  const fp = node.findDirectExpression(Expressions.FunctionParameters);
35
41
  if (fp) {
36
42
  function_parameters_1.FunctionParameters.runSyntax(fp, input);
@@ -3,11 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FetchNextCursor = void 0;
4
4
  const Expressions = require("../../2_statements/expressions");
5
5
  const target_1 = require("../expressions/target");
6
+ const sql_source_1 = require("../expressions/sql_source");
6
7
  class FetchNextCursor {
7
8
  runSyntax(node, input) {
8
9
  for (const t of node.findAllExpressions(Expressions.Target)) {
9
10
  target_1.Target.runSyntax(t, input);
10
11
  }
12
+ for (const s of node.findAllExpressions(Expressions.SQLSourceSimple)) {
13
+ sql_source_1.SQLSource.runSyntax(s, input);
14
+ }
11
15
  }
12
16
  }
13
17
  exports.FetchNextCursor = FetchNextCursor;
@@ -33,6 +33,7 @@ class Config {
33
33
  skipGeneratedProxyInterfaces: false,
34
34
  useApackDependencies: false,
35
35
  skipIncludesWithoutMain: false,
36
+ errorOnDuplicateFilenames: false,
36
37
  },
37
38
  dependencies: [{
38
39
  url: "https://github.com/abaplint/deps",
@@ -96,6 +97,9 @@ class Config {
96
97
  if (this.config.global.skipIncludesWithoutMain === undefined) {
97
98
  this.config.global.skipIncludesWithoutMain = false;
98
99
  }
100
+ if (this.config.global.errorOnDuplicateFilenames === undefined) {
101
+ this.config.global.errorOnDuplicateFilenames = false;
102
+ }
99
103
  this.checkVersion();
100
104
  }
101
105
  get() {
@@ -74,7 +74,7 @@ class Registry {
74
74
  }
75
75
  static abaplintVersion() {
76
76
  // magic, see build script "version.sh"
77
- return "2.119.17";
77
+ return "2.119.19";
78
78
  }
79
79
  getDDICReferences() {
80
80
  return this.ddicReferences;
@@ -190,6 +190,9 @@ class Registry {
190
190
  continue;
191
191
  }
192
192
  let found = this.findOrCreate(f.getObjectName(), f.getObjectType());
193
+ if (this.conf.getGlobal().errorOnDuplicateFilenames === true) {
194
+ this.checkDuplicateFilename(filename, found.getFiles());
195
+ }
193
196
  if (dependency === false && found && this.isDependency(found)) {
194
197
  this.removeDependency(found);
195
198
  found = this.findOrCreate(f.getObjectName(), f.getObjectType());
@@ -198,6 +201,22 @@ class Registry {
198
201
  }
199
202
  return this;
200
203
  }
204
+ checkDuplicateFilename(filename, files) {
205
+ const basename = Registry.filenameBasename(filename);
206
+ if (basename === "PACKAGE.DEVC.XML") {
207
+ return;
208
+ }
209
+ for (const existingFile of files) {
210
+ if (Registry.filenameBasename(existingFile.getFilename()) === basename) {
211
+ throw new Error("Duplicate filename: " + filename + " already exists as " + existingFile.getFilename());
212
+ }
213
+ }
214
+ }
215
+ static filenameBasename(filename) {
216
+ const normalized = filename.replace(/\\/g, "/");
217
+ const last = normalized.split("/").pop();
218
+ return (last !== null && last !== void 0 ? last : normalized).toUpperCase();
219
+ }
201
220
  addFiles(files) {
202
221
  this._addFiles(files, false);
203
222
  return this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.119.17",
3
+ "version": "2.119.19",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",