@abaplint/core 2.91.38 → 2.91.39

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.
@@ -3222,6 +3222,7 @@ export declare interface IRegistry {
3222
3222
  parseAsync(input?: IRunInput): Promise<IRegistry>;
3223
3223
  addDependencies(files: readonly IFile[]): IRegistry;
3224
3224
  addDependency(file: IFile): IRegistry;
3225
+ removeDependency(obj: IObject): void;
3225
3226
  isDependency(obj: IObject): boolean;
3226
3227
  isFileDependency(filename: string): boolean;
3227
3228
  findIssues(input?: IRunInput): readonly Issue[];
@@ -4465,7 +4466,6 @@ declare class RefreshControl implements IStatement {
4465
4466
  export declare class Registry implements IRegistry {
4466
4467
  private readonly objects;
4467
4468
  private readonly objectsByType;
4468
- /** object containing filenames of dependencies */
4469
4469
  private readonly dependencies;
4470
4470
  private readonly references;
4471
4471
  private conf;
@@ -4486,9 +4486,11 @@ export declare class Registry implements IRegistry {
4486
4486
  addFile(file: IFile): IRegistry;
4487
4487
  updateFile(file: IFile): IRegistry;
4488
4488
  removeFile(file: IFile): IRegistry;
4489
+ private _addFiles;
4489
4490
  addFiles(files: readonly IFile[]): IRegistry;
4490
4491
  addDependencies(files: readonly IFile[]): IRegistry;
4491
4492
  addDependency(file: IFile): IRegistry;
4493
+ removeDependency(obj: IObject): void;
4492
4494
  isDependency(obj: IObject): boolean;
4493
4495
  isFileDependency(filename: string): boolean;
4494
4496
  findObjectForFile(file: IFile): IObject | undefined;
@@ -7,7 +7,8 @@ const tokens_1 = require("../../1_lexer/tokens");
7
7
  const _1 = require(".");
8
8
  class SQLTarget extends combi_1.Expression {
9
9
  getRunnable() {
10
- const at = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WAt), (0, combi_1.tok)(tokens_1.At)), _1.Target));
10
+ const n = (0, combi_1.ver)(version_1.Version.v754, "NEW");
11
+ const at = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.opt)(n), (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WAt), (0, combi_1.tok)(tokens_1.At)), _1.Target));
11
12
  return (0, combi_1.altPrio)(at, _1.Target);
12
13
  }
13
14
  }
@@ -60,7 +60,6 @@ class Registry {
60
60
  constructor(conf) {
61
61
  this.objects = {};
62
62
  this.objectsByType = {};
63
- /** object containing filenames of dependencies */
64
63
  this.dependencies = {};
65
64
  this.issues = [];
66
65
  this.conf = conf ? conf : config_1.Config.getDefault();
@@ -68,7 +67,7 @@ class Registry {
68
67
  }
69
68
  static abaplintVersion() {
70
69
  // magic, see build script "version.sh"
71
- return "2.91.38";
70
+ return "2.91.39";
72
71
  }
73
72
  getDDICReferences() {
74
73
  return this.references;
@@ -143,6 +142,7 @@ class Registry {
143
142
  return this;
144
143
  }
145
144
  inErrorNamespace(name) {
145
+ // todo: performance? cache regexp?
146
146
  const reg = new RegExp(this.getConfig().getSyntaxSetttings().errorNamespace, "i");
147
147
  return reg.test(name);
148
148
  }
@@ -163,7 +163,7 @@ class Registry {
163
163
  }
164
164
  return this;
165
165
  }
166
- addFiles(files) {
166
+ _addFiles(files, dependency) {
167
167
  var _a;
168
168
  const globalExclude = ((_a = this.conf.getGlobal().exclude) !== null && _a !== void 0 ? _a : [])
169
169
  .map(pattern => new RegExp(pattern, "i"));
@@ -173,28 +173,60 @@ class Registry {
173
173
  if (isNotAbapgitFile || excludeHelper_1.ExcludeHelper.isExcluded(filename, globalExclude)) {
174
174
  continue;
175
175
  }
176
- const found = this.findOrCreate(f.getObjectName(), f.getObjectType());
176
+ let found = this.findOrCreate(f.getObjectName(), f.getObjectType());
177
+ if (dependency === false && found && this.isDependency(found)) {
178
+ this.removeDependency(found);
179
+ found = this.findOrCreate(f.getObjectName(), f.getObjectType());
180
+ }
177
181
  found.addFile(f);
178
182
  }
179
183
  return this;
180
184
  }
185
+ addFiles(files) {
186
+ this._addFiles(files, false);
187
+ return this;
188
+ }
181
189
  addDependencies(files) {
182
190
  for (const f of files) {
183
- this.dependencies[f.getFilename().toUpperCase()] = true;
191
+ this.addDependency(f);
184
192
  }
185
- return this.addFiles(files);
193
+ return this;
186
194
  }
187
195
  addDependency(file) {
188
- this.dependencies[file.getFilename().toUpperCase()] = true;
189
- this.addFile(file);
196
+ var _a;
197
+ const type = (_a = file.getObjectType()) === null || _a === void 0 ? void 0 : _a.toUpperCase();
198
+ if (type === undefined) {
199
+ return this;
200
+ }
201
+ const name = file.getObjectName().toUpperCase();
202
+ if (this.dependencies[type] === undefined) {
203
+ this.dependencies[type] = {};
204
+ }
205
+ this.dependencies[type][name] = true;
206
+ this._addFiles([file], true);
190
207
  return this;
191
208
  }
209
+ removeDependency(obj) {
210
+ var _a;
211
+ (_a = this.dependencies[obj.getType()]) === null || _a === void 0 ? true : delete _a[obj.getName()];
212
+ this.removeObject(obj);
213
+ }
192
214
  isDependency(obj) {
193
- const filename = obj.getFiles()[0].getFilename().toUpperCase();
194
- return this.dependencies[filename] === true;
215
+ var _a;
216
+ return ((_a = this.dependencies[obj.getType()]) === null || _a === void 0 ? void 0 : _a[obj.getName()]) === true;
195
217
  }
196
218
  isFileDependency(filename) {
197
- return this.dependencies[filename.toUpperCase()] === true;
219
+ var _a, _b;
220
+ const f = this.getFileByName(filename);
221
+ if (f === undefined) {
222
+ return false;
223
+ }
224
+ const type = (_a = f.getObjectType()) === null || _a === void 0 ? void 0 : _a.toUpperCase();
225
+ if (type === undefined) {
226
+ return false;
227
+ }
228
+ const name = f.getObjectName().toUpperCase();
229
+ return ((_b = this.dependencies[type]) === null || _b === void 0 ? void 0 : _b[name]) === true;
198
230
  }
199
231
  // assumption: the file is already in the registry
200
232
  findObjectForFile(file) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.91.38",
3
+ "version": "2.91.39",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -48,7 +48,7 @@
48
48
  "@microsoft/api-extractor": "^7.29.5",
49
49
  "@types/chai": "^4.3.3",
50
50
  "@types/mocha": "^9.1.1",
51
- "@types/node": "^18.7.12",
51
+ "@types/node": "^18.7.13",
52
52
  "chai": "^4.3.6",
53
53
  "eslint": "^8.22.0",
54
54
  "mocha": "^10.0.0",