@abaplint/cli 2.120.82 → 2.120.84

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.
Files changed (2) hide show
  1. package/build/cli.js +2721 -137
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -567,11 +567,40 @@ exports.LexerStream = LexerStream;
567
567
  Object.defineProperty(exports, "__esModule", ({ value: true }));
568
568
  exports.AbstractToken = void 0;
569
569
  const position_1 = __webpack_require__(/*! ../../../position */ "../core/build/src/position.js");
570
- class AbstractToken {
570
+ const virtual_position_1 = __webpack_require__(/*! ../../../virtual_position */ "../core/build/src/virtual_position.js");
571
+ // token strings repeat a lot across files (keywords, common names, upper cased copies), share them.
572
+ // Longer strings are typically comments or text literals, not worth sharing
573
+ const INTERN_MAX_LENGTH = 30;
574
+ // bound the table, it lives for the lifetime of the process
575
+ const INTERN_MAX_ENTRIES = 100000;
576
+ // V8 represents substrings of this length or longer as slices that reference the full source,
577
+ // these are flattened before being stored, so the table does not keep removed files alive
578
+ const SLICED_MIN_LENGTH = 13;
579
+ let interned = new Map();
580
+ function intern(str) {
581
+ if (str.length > INTERN_MAX_LENGTH) {
582
+ return str;
583
+ }
584
+ const found = interned.get(str);
585
+ if (found !== undefined) {
586
+ return found;
587
+ }
588
+ if (interned.size >= INTERN_MAX_ENTRIES) {
589
+ interned = new Map();
590
+ }
591
+ const copy = str.length >= SLICED_MIN_LENGTH ? str.split("").join("") : str;
592
+ interned.set(copy, copy);
593
+ return copy;
594
+ }
595
+ // the token is its own start position, saves a separate Position object per token
596
+ class AbstractToken extends position_1.Position {
571
597
  constructor(start, str) {
572
- this.start = start;
573
- this.str = str;
574
- this.strUpper = str.toUpperCase();
598
+ super(start.getRow(), start.getCol());
599
+ this.str = intern(str);
600
+ this.strUpper = intern(str.toUpperCase());
601
+ if (start instanceof virtual_position_1.VirtualPosition) {
602
+ this.virtual = start;
603
+ }
575
604
  }
576
605
  // special function, for debugging purposes, see https://github.com/abaplint/abaplint/pull/3137
577
606
  [Symbol.for("debug.description")]() {
@@ -583,17 +612,12 @@ class AbstractToken {
583
612
  getUpperStr() {
584
613
  return this.strUpper;
585
614
  }
586
- getRow() {
587
- return this.start.getRow();
588
- }
589
- getCol() {
590
- return this.start.getCol();
591
- }
592
615
  getStart() {
593
- return this.start;
616
+ var _a;
617
+ return (_a = this.virtual) !== null && _a !== void 0 ? _a : this;
594
618
  }
595
619
  getEnd() {
596
- return new position_1.Position(this.start.getRow(), this.start.getCol() + this.str.length);
620
+ return new position_1.Position(this.getRow(), this.getCol() + this.str.length);
597
621
  }
598
622
  }
599
623
  exports.AbstractToken = AbstractToken;
@@ -26213,7 +26237,7 @@ class CurrentScope {
26213
26237
  else if (this.isOO() && this.current.getData().vars[upper] !== undefined) {
26214
26238
  throw new Error(`"${name}" already defined`);
26215
26239
  }
26216
- this.current.getData().types[upper] = type;
26240
+ this.current.setType(upper, type);
26217
26241
  }
26218
26242
  addExtraLikeType(type) {
26219
26243
  if (type === undefined) {
@@ -26232,7 +26256,7 @@ class CurrentScope {
26232
26256
  if (this.current.getData().extraLikeTypes[upper] !== undefined) {
26233
26257
  throw new Error(`Type name "${name}" already defined`);
26234
26258
  }
26235
- this.current.getData().extraLikeTypes[upper] = type;
26259
+ this.current.setExtraLikeType(upper, type);
26236
26260
  }
26237
26261
  addClassDefinition(c) {
26238
26262
  if (this.current === undefined) {
@@ -26242,13 +26266,13 @@ class CurrentScope {
26242
26266
  if (this.current.getData().cdefs[name] !== undefined) {
26243
26267
  throw new Error(`Class "${name}" already defined`);
26244
26268
  }
26245
- this.current.getData().cdefs[name] = c;
26269
+ this.current.setClassDefinition(name, c);
26246
26270
  }
26247
26271
  addFormDefinitions(f) {
26248
26272
  if (this.current === undefined) {
26249
26273
  return;
26250
26274
  }
26251
- this.current.getData().forms.push(...f);
26275
+ this.current.addFormDefinitions(f);
26252
26276
  }
26253
26277
  /** The FORM definitions are built up front, at that point the program level types are not known.
26254
26278
  * When the FORM statement is traversed it is replaced with one resolved in the scope of the FORM */
@@ -26273,7 +26297,7 @@ class CurrentScope {
26273
26297
  if (this.current.getData().cdefs[name] !== undefined) {
26274
26298
  throw new Error(`Interface "${name}" already defined`);
26275
26299
  }
26276
- this.current.getData().idefs[name] = i;
26300
+ this.current.setInterfaceDefinition(name, i);
26277
26301
  }
26278
26302
  addNamedIdentifier(name, identifier) {
26279
26303
  if (this.current === undefined) {
@@ -26287,7 +26311,7 @@ class CurrentScope {
26287
26311
  else if (this.isOO() && this.current.getData().types[upper] !== undefined) {
26288
26312
  throw new Error(`"${name}" already defined`);
26289
26313
  }
26290
- this.current.getData().vars[upper] = identifier;
26314
+ this.current.setVariable(upper, identifier);
26291
26315
  }
26292
26316
  addNamedIdentifierToParent(name, identifier) {
26293
26317
  if (this.current === undefined) {
@@ -26305,7 +26329,7 @@ class CurrentScope {
26305
26329
  else if (this.isOO() && parent.getData().types[upper] !== undefined) {
26306
26330
  throw new Error(`"${name}" already defined`);
26307
26331
  }
26308
- parent.getData().vars[upper] = identifier;
26332
+ parent.setVariable(upper, identifier);
26309
26333
  }
26310
26334
  addIdentifier(identifier) {
26311
26335
  if (identifier === undefined) {
@@ -26317,7 +26341,7 @@ class CurrentScope {
26317
26341
  if (token === undefined) {
26318
26342
  return;
26319
26343
  }
26320
- this.current.getData().deferred[token.getStr().toUpperCase()] = { token, ooType: type };
26344
+ this.current.setDeferred(token.getStr().toUpperCase(), { token, ooType: type });
26321
26345
  }
26322
26346
  addListPrefix(identifiers, prefix) {
26323
26347
  for (const id of identifiers) {
@@ -26337,16 +26361,16 @@ class CurrentScope {
26337
26361
  const position = new _identifier_1.Identifier(usage, filename);
26338
26362
  if (Array.isArray(type)) {
26339
26363
  for (const t of type) {
26340
- (_a = this.current) === null || _a === void 0 ? void 0 : _a.getData().references.push({ position, resolved: referencing, referenceType: t, extra });
26364
+ (_a = this.current) === null || _a === void 0 ? void 0 : _a.addReference({ position, resolved: referencing, referenceType: t, extra });
26341
26365
  }
26342
26366
  }
26343
26367
  else {
26344
- (_b = this.current) === null || _b === void 0 ? void 0 : _b.getData().references.push({ position, resolved: referencing, referenceType: type, extra });
26368
+ (_b = this.current) === null || _b === void 0 ? void 0 : _b.addReference({ position, resolved: referencing, referenceType: type, extra });
26345
26369
  }
26346
26370
  }
26347
26371
  addSQLConversion(fieldName, message, token) {
26348
26372
  var _a;
26349
- (_a = this.current) === null || _a === void 0 ? void 0 : _a.getData().sqlConversion.push({ fieldName, message, token });
26373
+ (_a = this.current) === null || _a === void 0 ? void 0 : _a.addSQLConversion({ fieldName, message, token });
26350
26374
  }
26351
26375
  ///////////////////////////
26352
26376
  findFunctionModule(name) {
@@ -26382,6 +26406,9 @@ class CurrentScope {
26382
26406
  return undefined;
26383
26407
  }
26384
26408
  const name = (_a = this.parentObj.getClassDefinition()) === null || _a === void 0 ? void 0 : _a.behaviorDefinitionName;
26409
+ return this.findBehaviorDefinitionByName(name);
26410
+ }
26411
+ findBehaviorDefinitionByName(name) {
26385
26412
  if (name === undefined) {
26386
26413
  return undefined;
26387
26414
  }
@@ -26711,6 +26738,84 @@ exports.CurrentScope = CurrentScope;
26711
26738
 
26712
26739
  /***/ },
26713
26740
 
26741
+ /***/ "../core/build/src/abap/5_syntax/_eml.js"
26742
+ /*!***********************************************!*\
26743
+ !*** ../core/build/src/abap/5_syntax/_eml.js ***!
26744
+ \***********************************************/
26745
+ (__unused_webpack_module, exports, __webpack_require__) {
26746
+
26747
+ "use strict";
26748
+
26749
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
26750
+ if (k2 === undefined) k2 = k;
26751
+ var desc = Object.getOwnPropertyDescriptor(m, k);
26752
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
26753
+ desc = { enumerable: true, get: function() { return m[k]; } };
26754
+ }
26755
+ Object.defineProperty(o, k2, desc);
26756
+ }) : (function(o, m, k, k2) {
26757
+ if (k2 === undefined) k2 = k;
26758
+ o[k2] = m[k];
26759
+ }));
26760
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
26761
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26762
+ }) : function(o, v) {
26763
+ o["default"] = v;
26764
+ });
26765
+ var __importStar = (this && this.__importStar) || (function () {
26766
+ var ownKeys = function(o) {
26767
+ ownKeys = Object.getOwnPropertyNames || function (o) {
26768
+ var ar = [];
26769
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26770
+ return ar;
26771
+ };
26772
+ return ownKeys(o);
26773
+ };
26774
+ return function (mod) {
26775
+ if (mod && mod.__esModule) return mod;
26776
+ var result = {};
26777
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
26778
+ __setModuleDefault(result, mod);
26779
+ return result;
26780
+ };
26781
+ })();
26782
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
26783
+ exports.EML = void 0;
26784
+ const Expressions = __importStar(__webpack_require__(/*! ../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
26785
+ const _syntax_input_1 = __webpack_require__(/*! ./_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
26786
+ /** checks the entities referenced in EML statements, eg. READ ENTITIES and MODIFY ENTITIES */
26787
+ class EML {
26788
+ static checkEntities(node, input) {
26789
+ var _a;
26790
+ var _b;
26791
+ const nameNode = node.findDirectExpression(Expressions.NamespaceSimpleName);
26792
+ if (nameNode === undefined) {
26793
+ // eg. dynamic "MODIFY ENTITIES OPERATIONS" or "ENTITY zentity\_association"
26794
+ return;
26795
+ }
26796
+ const name = nameNode.concatTokens();
26797
+ const scope = input.scope;
26798
+ if (node.findDirectTokenByText("ENTITIES") !== undefined) {
26799
+ // "ENTITIES OF" refers to the behavior definition
26800
+ if (scope.findBehaviorDefinitionByName(name) === undefined && scope.getDDIC().inErrorNamespace(name)) {
26801
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, nameNode.getFirstToken(), `Behavior definition "${name}" not found`));
26802
+ }
26803
+ return;
26804
+ }
26805
+ // single "ENTITY", inside a behavior pool the alias defined in the BDEF can be used
26806
+ const entity = (_b = (_a = scope.findBehaviorDefinition()) === null || _a === void 0 ? void 0 : _a.findEntityNameByAlias(name)) !== null && _b !== void 0 ? _b : name;
26807
+ if (scope.getDDIC().inErrorNamespace(entity)
26808
+ && scope.findBehaviorDefinitionByName(entity) === undefined
26809
+ && scope.getDDIC().lookupDDLS(entity) === undefined) {
26810
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, nameNode.getFirstToken(), `Entity "${name}" not found`));
26811
+ }
26812
+ }
26813
+ }
26814
+ exports.EML = EML;
26815
+ //# sourceMappingURL=_eml.js.map
26816
+
26817
+ /***/ },
26818
+
26714
26819
  /***/ "../core/build/src/abap/5_syntax/_loop_table_change.js"
26715
26820
  /*!*************************************************************!*\
26716
26821
  !*** ../core/build/src/abap/5_syntax/_loop_table_change.js ***!
@@ -27081,6 +27186,16 @@ class ObjectOriented {
27081
27186
  }
27082
27187
  return `The special method "${name}" cannot be called directly`;
27083
27188
  }
27189
+ // classic exceptions cannot be raised in a method declaring class based exceptions, returns the message otherwise
27190
+ checkClassicException() {
27191
+ var _a;
27192
+ const methodName = this.scope.getEnclosingMethodName();
27193
+ const classDef = this.scope.findClassDefinition(this.scope.getEnclosingClassName());
27194
+ if (methodName && classDef && ((_a = this.searchMethodName(classDef, methodName).method) === null || _a === void 0 ? void 0 : _a.getRaising().length)) {
27195
+ return "Classic exceptions cannot be raised in methods with class based exceptions";
27196
+ }
27197
+ return undefined;
27198
+ }
27084
27199
  // SUPER-> can only call the previous implementation of the method it is used in, returns the message otherwise
27085
27200
  // both names are resolved in the super class, so an alias and the method it stands for are the same
27086
27201
  checkSuperCall(superDef, methodName) {
@@ -37690,23 +37805,81 @@ const _typed_identifier_1 = __webpack_require__(/*! ../types/_typed_identifier *
37690
37805
  const _identifier_1 = __webpack_require__(/*! ../4_file_information/_identifier */ "../core/build/src/abap/4_file_information/_identifier.js");
37691
37806
  const _reference_1 = __webpack_require__(/*! ./_reference */ "../core/build/src/abap/5_syntax/_reference.js");
37692
37807
  const assert_error_1 = __webpack_require__(/*! ./assert_error */ "../core/build/src/abap/5_syntax/assert_error.js");
37808
+ // most scopes only use a few of the containers, empty ones are shared and replaced on first write
37809
+ const EMPTY_OBJECT = Object.freeze({});
37810
+ const EMPTY_ARRAY = Object.freeze([]);
37693
37811
  class ScopeData {
37694
37812
  constructor() {
37695
37813
  this.data = {
37696
- vars: {},
37697
- cdefs: {},
37698
- idefs: {},
37699
- forms: [], // todo, refactor to object
37700
- types: {},
37701
- extraLikeTypes: {},
37702
- deferred: {},
37703
- references: [],
37704
- sqlConversion: [],
37814
+ vars: EMPTY_OBJECT,
37815
+ cdefs: EMPTY_OBJECT,
37816
+ idefs: EMPTY_OBJECT,
37817
+ forms: EMPTY_ARRAY, // todo, refactor to object
37818
+ types: EMPTY_OBJECT,
37819
+ extraLikeTypes: EMPTY_OBJECT,
37820
+ deferred: EMPTY_OBJECT,
37821
+ references: EMPTY_ARRAY,
37822
+ sqlConversion: EMPTY_ARRAY,
37705
37823
  };
37706
37824
  }
37707
37825
  getData() {
37708
37826
  return this.data;
37709
37827
  }
37828
+ // the shared empty containers are frozen, the methods below replace them on first write
37829
+ setVariable(name, identifier) {
37830
+ if (this.data.vars === EMPTY_OBJECT) {
37831
+ this.data.vars = {};
37832
+ }
37833
+ this.data.vars[name] = identifier;
37834
+ }
37835
+ setType(name, type) {
37836
+ if (this.data.types === EMPTY_OBJECT) {
37837
+ this.data.types = {};
37838
+ }
37839
+ this.data.types[name] = type;
37840
+ }
37841
+ setExtraLikeType(name, type) {
37842
+ if (this.data.extraLikeTypes === EMPTY_OBJECT) {
37843
+ this.data.extraLikeTypes = {};
37844
+ }
37845
+ this.data.extraLikeTypes[name] = type;
37846
+ }
37847
+ setDeferred(name, deferred) {
37848
+ if (this.data.deferred === EMPTY_OBJECT) {
37849
+ this.data.deferred = {};
37850
+ }
37851
+ this.data.deferred[name] = deferred;
37852
+ }
37853
+ setClassDefinition(name, cdef) {
37854
+ if (this.data.cdefs === EMPTY_OBJECT) {
37855
+ this.data.cdefs = {};
37856
+ }
37857
+ this.data.cdefs[name] = cdef;
37858
+ }
37859
+ setInterfaceDefinition(name, idef) {
37860
+ if (this.data.idefs === EMPTY_OBJECT) {
37861
+ this.data.idefs = {};
37862
+ }
37863
+ this.data.idefs[name] = idef;
37864
+ }
37865
+ addFormDefinitions(forms) {
37866
+ if (this.data.forms === EMPTY_ARRAY) {
37867
+ this.data.forms = [];
37868
+ }
37869
+ this.data.forms.push(...forms);
37870
+ }
37871
+ addReference(reference) {
37872
+ if (this.data.references === EMPTY_ARRAY) {
37873
+ this.data.references = [];
37874
+ }
37875
+ this.data.references.push(reference);
37876
+ }
37877
+ addSQLConversion(conversion) {
37878
+ if (this.data.sqlConversion === EMPTY_ARRAY) {
37879
+ this.data.sqlConversion = [];
37880
+ }
37881
+ this.data.sqlConversion.push(conversion);
37882
+ }
37710
37883
  }
37711
37884
  class SpaghettiScopeNode extends ScopeData {
37712
37885
  [Symbol.for("debug.description")]() {
@@ -43911,8 +44084,16 @@ const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/
43911
44084
  const source_1 = __webpack_require__(/*! ../expressions/source */ "../core/build/src/abap/5_syntax/expressions/source.js");
43912
44085
  const target_1 = __webpack_require__(/*! ../expressions/target */ "../core/build/src/abap/5_syntax/expressions/target.js");
43913
44086
  const message_source_1 = __webpack_require__(/*! ../expressions/message_source */ "../core/build/src/abap/5_syntax/expressions/message_source.js");
44087
+ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
44088
+ const _object_oriented_1 = __webpack_require__(/*! ../_object_oriented */ "../core/build/src/abap/5_syntax/_object_oriented.js");
43914
44089
  class Message {
43915
44090
  runSyntax(node, input) {
44091
+ const exceptionName = node.findDirectExpression(Expressions.ExceptionName);
44092
+ const classicMessage = exceptionName ? new _object_oriented_1.ObjectOriented(input.scope).checkClassicException() : undefined;
44093
+ if (exceptionName && classicMessage) {
44094
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, exceptionName.getFirstToken(), classicMessage));
44095
+ return;
44096
+ }
43916
44097
  const found = node.findExpressionAfterToken("INTO");
43917
44098
  const inline = found === null || found === void 0 ? void 0 : found.findDirectExpression(Expressions.InlineData);
43918
44099
  if (inline) {
@@ -44178,8 +44359,10 @@ const source_1 = __webpack_require__(/*! ../expressions/source */ "../core/build
44178
44359
  const target_1 = __webpack_require__(/*! ../expressions/target */ "../core/build/src/abap/5_syntax/expressions/target.js");
44179
44360
  const inline_data_1 = __webpack_require__(/*! ../expressions/inline_data */ "../core/build/src/abap/5_syntax/expressions/inline_data.js");
44180
44361
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
44362
+ const _eml_1 = __webpack_require__(/*! ../_eml */ "../core/build/src/abap/5_syntax/_eml.js");
44181
44363
  class ModifyEntities {
44182
44364
  runSyntax(node, input) {
44365
+ _eml_1.EML.checkEntities(node, input);
44183
44366
  for (const s of node.findDirectExpressions(Expressions.Source)) {
44184
44367
  source_1.Source.runSyntax(s, input);
44185
44368
  }
@@ -45155,6 +45338,12 @@ class Raise {
45155
45338
  var _a, _b, _c, _d, _e, _f;
45156
45339
  const helper = new _object_oriented_1.ObjectOriented(input.scope);
45157
45340
  let method;
45341
+ const exceptionName = node.findDirectExpression(Expressions.ExceptionName);
45342
+ const classicMessage = exceptionName ? helper.checkClassicException() : undefined;
45343
+ if (exceptionName && classicMessage) {
45344
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, exceptionName.getFirstToken(), classicMessage));
45345
+ return;
45346
+ }
45158
45347
  const classTok = (_a = node.findDirectExpression(Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
45159
45348
  const className = classTok === null || classTok === void 0 ? void 0 : classTok.getStr();
45160
45349
  if (classTok && className) {
@@ -45489,8 +45678,10 @@ const source_1 = __webpack_require__(/*! ../expressions/source */ "../core/build
45489
45678
  const target_1 = __webpack_require__(/*! ../expressions/target */ "../core/build/src/abap/5_syntax/expressions/target.js");
45490
45679
  const inline_data_1 = __webpack_require__(/*! ../expressions/inline_data */ "../core/build/src/abap/5_syntax/expressions/inline_data.js");
45491
45680
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
45681
+ const _eml_1 = __webpack_require__(/*! ../_eml */ "../core/build/src/abap/5_syntax/_eml.js");
45492
45682
  class ReadEntities {
45493
45683
  runSyntax(node, input) {
45684
+ _eml_1.EML.checkEntities(node, input);
45494
45685
  for (const s of node.findDirectExpressions(Expressions.Source)) {
45495
45686
  source_1.Source.runSyntax(s, input);
45496
45687
  }
@@ -49899,7 +50090,7 @@ class SyntaxLogic {
49899
50090
  this.reg.getMSAGReferences().clear(this.object);
49900
50091
  if (this.object instanceof objects_1.Program && this.object.isInclude()) {
49901
50092
  // todo, show some kind of error?
49902
- return { issues: [], spaghetti: this.scope.pop(new position_1.Position(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER)) };
50093
+ return { issues: [], spaghetti: this.scope.pop(new position_1.Position(position_1.MAX_POSITION_VALUE, position_1.MAX_POSITION_VALUE)) };
49903
50094
  }
49904
50095
  this.traverseObject();
49905
50096
  // the FORM definitions are now all traversed, ie. their parameters are typed
@@ -49908,7 +50099,7 @@ class SyntaxLogic {
49908
50099
  }
49909
50100
  this.deferred = [];
49910
50101
  for (;;) {
49911
- const spaghetti = this.scope.pop(new position_1.Position(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER)); // pop built-in scopes
50102
+ const spaghetti = this.scope.pop(new position_1.Position(position_1.MAX_POSITION_VALUE, position_1.MAX_POSITION_VALUE)); // pop built-in scopes
49912
50103
  if (spaghetti.getTop().getIdentifier().stype === _scope_type_1.ScopeType.BuiltIn) {
49913
50104
  const result = { issues: this.issues, spaghetti };
49914
50105
  this.object.syntaxResult = result;
@@ -55592,6 +55783,874 @@ exports.ArtifactsRules = ArtifactsRules;
55592
55783
 
55593
55784
  /***/ },
55594
55785
 
55786
+ /***/ "../core/build/src/bdef/bdef_parser.js"
55787
+ /*!*********************************************!*\
55788
+ !*** ../core/build/src/bdef/bdef_parser.js ***!
55789
+ \*********************************************/
55790
+ (__unused_webpack_module, exports, __webpack_require__) {
55791
+
55792
+ "use strict";
55793
+
55794
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
55795
+ if (k2 === undefined) k2 = k;
55796
+ var desc = Object.getOwnPropertyDescriptor(m, k);
55797
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
55798
+ desc = { enumerable: true, get: function() { return m[k]; } };
55799
+ }
55800
+ Object.defineProperty(o, k2, desc);
55801
+ }) : (function(o, m, k, k2) {
55802
+ if (k2 === undefined) k2 = k;
55803
+ o[k2] = m[k];
55804
+ }));
55805
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
55806
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
55807
+ }) : function(o, v) {
55808
+ o["default"] = v;
55809
+ });
55810
+ var __importStar = (this && this.__importStar) || (function () {
55811
+ var ownKeys = function(o) {
55812
+ ownKeys = Object.getOwnPropertyNames || function (o) {
55813
+ var ar = [];
55814
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
55815
+ return ar;
55816
+ };
55817
+ return ownKeys(o);
55818
+ };
55819
+ return function (mod) {
55820
+ if (mod && mod.__esModule) return mod;
55821
+ var result = {};
55822
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
55823
+ __setModuleDefault(result, mod);
55824
+ return result;
55825
+ };
55826
+ })();
55827
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
55828
+ exports.BDEFParser = void 0;
55829
+ const tokens_1 = __webpack_require__(/*! ../abap/1_lexer/tokens */ "../core/build/src/abap/1_lexer/tokens/index.js");
55830
+ const combi_1 = __webpack_require__(/*! ../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
55831
+ const nodes_1 = __webpack_require__(/*! ../abap/nodes */ "../core/build/src/abap/nodes/index.js");
55832
+ const cds_lexer_1 = __webpack_require__(/*! ../cds/cds_lexer */ "../core/build/src/cds/cds_lexer.js");
55833
+ const version_1 = __webpack_require__(/*! ../version */ "../core/build/src/version.js");
55834
+ const Expressions = __importStar(__webpack_require__(/*! ./expressions */ "../core/build/src/bdef/expressions/index.js"));
55835
+ class BDEFParser {
55836
+ parse(file) {
55837
+ if (file === undefined) {
55838
+ return undefined;
55839
+ }
55840
+ // BDEF has the same comments, strings and delimiters as CDS
55841
+ const tokens = this.removePragmas(cds_lexer_1.CDSLexer.run(file).filter(t => !(t instanceof tokens_1.Comment)));
55842
+ const res = combi_1.Combi.run(new Expressions.BDEFDefinition(), tokens, version_1.defaultRelease);
55843
+ if (res === undefined || !(res[0] instanceof nodes_1.ExpressionNode)) {
55844
+ return undefined;
55845
+ }
55846
+ return res[0];
55847
+ }
55848
+ /** pragmas can occur in many places, eg. "##NOT_ASSIGNED_TO_DETACT" or "##UNMAPPED_FIELD[SingletonID]" */
55849
+ removePragmas(tokens) {
55850
+ var _a;
55851
+ const ret = [];
55852
+ for (let i = 0; i < tokens.length; i++) {
55853
+ if (tokens[i].getStr().startsWith("##") === false) {
55854
+ ret.push(tokens[i]);
55855
+ continue;
55856
+ }
55857
+ if (((_a = tokens[i + 1]) === null || _a === void 0 ? void 0 : _a.getStr()) === "[") {
55858
+ while (i < tokens.length - 1 && tokens[i].getStr() !== "]") {
55859
+ i++;
55860
+ }
55861
+ }
55862
+ }
55863
+ return ret;
55864
+ }
55865
+ }
55866
+ exports.BDEFParser = BDEFParser;
55867
+ //# sourceMappingURL=bdef_parser.js.map
55868
+
55869
+ /***/ },
55870
+
55871
+ /***/ "../core/build/src/bdef/expressions/bdef_action.js"
55872
+ /*!*********************************************************!*\
55873
+ !*** ../core/build/src/bdef/expressions/bdef_action.js ***!
55874
+ \*********************************************************/
55875
+ (__unused_webpack_module, exports, __webpack_require__) {
55876
+
55877
+ "use strict";
55878
+
55879
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
55880
+ exports.BDEFAction = void 0;
55881
+ const _1 = __webpack_require__(/*! . */ "../core/build/src/bdef/expressions/index.js");
55882
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
55883
+ /** actions and functions, eg. "static factory action ( features : global ) copy parameter ZPARAM result [1] $self;" */
55884
+ class BDEFAction extends combi_1.Expression {
55885
+ getRunnable() {
55886
+ const modifier = (0, combi_1.altPrio)("INTERNAL", "STATIC", "FACTORY", "DEFAULT", "DRAFT", "REPEATABLE", "RECOMMENDATION", (0, combi_1.seq)("SAVE", (0, combi_1.optPrio)(_1.BDEFOptions)), (0, combi_1.seq)("KEY", _1.BDEFOptions));
55887
+ const tail = (0, combi_1.altPrio)((0, combi_1.seq)("EXTERNAL", _1.BDEFString), (0, combi_1.seq)("AS", _1.BDEFName), _1.BDEFParameter, _1.BDEFResult, _1.BDEFCardinality, "OPTIMIZED", "EXTENSIBLE", "WITH ADDITIONAL IMPLEMENTATION");
55888
+ return (0, combi_1.seq)((0, combi_1.starPrio)(modifier), (0, combi_1.altPrio)("ACTION", "FUNCTION"), (0, combi_1.optPrio)(_1.BDEFOptions), _1.BDEFName, (0, combi_1.starPrio)(tail), (0, combi_1.altPrio)(";", _1.BDEFDefaultFunction));
55889
+ }
55890
+ }
55891
+ exports.BDEFAction = BDEFAction;
55892
+ //# sourceMappingURL=bdef_action.js.map
55893
+
55894
+ /***/ },
55895
+
55896
+ /***/ "../core/build/src/bdef/expressions/bdef_alias.js"
55897
+ /*!********************************************************!*\
55898
+ !*** ../core/build/src/bdef/expressions/bdef_alias.js ***!
55899
+ \********************************************************/
55900
+ (__unused_webpack_module, exports, __webpack_require__) {
55901
+
55902
+ "use strict";
55903
+
55904
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
55905
+ exports.BDEFAlias = void 0;
55906
+ const _1 = __webpack_require__(/*! . */ "../core/build/src/bdef/expressions/index.js");
55907
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
55908
+ class BDEFAlias extends combi_1.Expression {
55909
+ getRunnable() {
55910
+ return (0, combi_1.seq)("ALIAS", _1.BDEFName);
55911
+ }
55912
+ }
55913
+ exports.BDEFAlias = BDEFAlias;
55914
+ //# sourceMappingURL=bdef_alias.js.map
55915
+
55916
+ /***/ },
55917
+
55918
+ /***/ "../core/build/src/bdef/expressions/bdef_association.js"
55919
+ /*!**************************************************************!*\
55920
+ !*** ../core/build/src/bdef/expressions/bdef_association.js ***!
55921
+ \**************************************************************/
55922
+ (__unused_webpack_module, exports, __webpack_require__) {
55923
+
55924
+ "use strict";
55925
+
55926
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
55927
+ exports.BDEFAssociation = void 0;
55928
+ const _1 = __webpack_require__(/*! . */ "../core/build/src/bdef/expressions/index.js");
55929
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
55930
+ /** eg. "association _Booking { create; with draft; }" */
55931
+ class BDEFAssociation extends combi_1.Expression {
55932
+ getRunnable() {
55933
+ // cross BO association, eg. "using /DMO/R_TRAVELTP_XBO \_Agency"
55934
+ const using = (0, combi_1.seq)("USING", _1.BDEFName, (0, combi_1.optPrio)((0, combi_1.regex)(/^\\\w+$/)));
55935
+ return (0, combi_1.seq)((0, combi_1.starPrio)((0, combi_1.altPrio)("INTERNAL", "UNMANAGED", "ANCESTOR")), "ASSOCIATION", (0, combi_1.optPrio)(_1.BDEFOptions), _1.BDEFName, (0, combi_1.optPrio)(using), (0, combi_1.optPrio)((0, combi_1.seq)("ABBREVIATION", _1.BDEFName)), (0, combi_1.optPrio)("WITH HIERARCHY"), (0, combi_1.altPrio)(";", _1.BDEFAssociationBody));
55936
+ }
55937
+ }
55938
+ exports.BDEFAssociation = BDEFAssociation;
55939
+ //# sourceMappingURL=bdef_association.js.map
55940
+
55941
+ /***/ },
55942
+
55943
+ /***/ "../core/build/src/bdef/expressions/bdef_association_body.js"
55944
+ /*!*******************************************************************!*\
55945
+ !*** ../core/build/src/bdef/expressions/bdef_association_body.js ***!
55946
+ \*******************************************************************/
55947
+ (__unused_webpack_module, exports, __webpack_require__) {
55948
+
55949
+ "use strict";
55950
+
55951
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
55952
+ exports.BDEFAssociationBody = void 0;
55953
+ const _1 = __webpack_require__(/*! . */ "../core/build/src/bdef/expressions/index.js");
55954
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
55955
+ /** eg. "{ create ( features : instance ); with draft; link action linkManager; }" */
55956
+ class BDEFAssociationBody extends combi_1.Expression {
55957
+ getRunnable() {
55958
+ const create = (0, combi_1.seq)((0, combi_1.optPrio)("INTERNAL"), "CREATE", (0, combi_1.optPrio)(_1.BDEFOptions), (0, combi_1.altPrio)(";", _1.BDEFDefaultFunction));
55959
+ const withh = (0, combi_1.seq)("WITH", (0, combi_1.altPrio)("DRAFT", "DEPENDENT DRAFT", "CASCADING DELETE"), ";");
55960
+ const link = (0, combi_1.seq)((0, combi_1.altPrio)("LINK", "UNLINK"), "ACTION", _1.BDEFName, ";");
55961
+ const inverse = (0, combi_1.seq)("INVERSE FUNCTION", _1.BDEFName, ";");
55962
+ const item = (0, combi_1.altPrio)(create, withh, link, inverse, ";");
55963
+ return (0, combi_1.seq)("{", (0, combi_1.starPrio)(item), "}");
55964
+ }
55965
+ }
55966
+ exports.BDEFAssociationBody = BDEFAssociationBody;
55967
+ //# sourceMappingURL=bdef_association_body.js.map
55968
+
55969
+ /***/ },
55970
+
55971
+ /***/ "../core/build/src/bdef/expressions/bdef_authorization_context.js"
55972
+ /*!************************************************************************!*\
55973
+ !*** ../core/build/src/bdef/expressions/bdef_authorization_context.js ***!
55974
+ \************************************************************************/
55975
+ (__unused_webpack_module, exports, __webpack_require__) {
55976
+
55977
+ "use strict";
55978
+
55979
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
55980
+ exports.BDEFAuthorizationContext = void 0;
55981
+ const _1 = __webpack_require__(/*! . */ "../core/build/src/bdef/expressions/index.js");
55982
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
55983
+ /** eg. "define own authorization context { 'S_TABU_NAM'; }" or "define own authorization context by privileged mode;" */
55984
+ class BDEFAuthorizationContext extends combi_1.Expression {
55985
+ getRunnable() {
55986
+ const item = (0, combi_1.seq)((0, combi_1.altPrio)(_1.BDEFString, _1.BDEFName), ";");
55987
+ const body = (0, combi_1.seq)("{", (0, combi_1.starPrio)(item), "}", (0, combi_1.optPrio)(";"));
55988
+ const privileged = (0, combi_1.seq)("BY PRIVILEGED MODE", (0, combi_1.optPrio)("AND"));
55989
+ return (0, combi_1.seq)("DEFINE", (0, combi_1.optPrio)("OWN"), "AUTHORIZATION CONTEXT", (0, combi_1.optPrio)((0, combi_1.altPrio)(privileged, _1.BDEFName)), (0, combi_1.optPrio)((0, combi_1.seq)("FOR DISABLE", _1.BDEFOptions)), (0, combi_1.altPrio)(";", body));
55990
+ }
55991
+ }
55992
+ exports.BDEFAuthorizationContext = BDEFAuthorizationContext;
55993
+ //# sourceMappingURL=bdef_authorization_context.js.map
55994
+
55995
+ /***/ },
55996
+
55997
+ /***/ "../core/build/src/bdef/expressions/bdef_cardinality.js"
55998
+ /*!**************************************************************!*\
55999
+ !*** ../core/build/src/bdef/expressions/bdef_cardinality.js ***!
56000
+ \**************************************************************/
56001
+ (__unused_webpack_module, exports, __webpack_require__) {
56002
+
56003
+ "use strict";
56004
+
56005
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
56006
+ exports.BDEFCardinality = void 0;
56007
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
56008
+ /** eg. "[1]" or "[0..*]" */
56009
+ class BDEFCardinality extends combi_1.Expression {
56010
+ getRunnable() {
56011
+ const integer = (0, combi_1.regex)(/^\d+$/);
56012
+ return (0, combi_1.seq)("[", integer, (0, combi_1.optPrio)((0, combi_1.seq)(".", ".", (0, combi_1.altPrio)(integer, "*"))), "]");
56013
+ }
56014
+ }
56015
+ exports.BDEFCardinality = BDEFCardinality;
56016
+ //# sourceMappingURL=bdef_cardinality.js.map
56017
+
56018
+ /***/ },
56019
+
56020
+ /***/ "../core/build/src/bdef/expressions/bdef_default_function.js"
56021
+ /*!*******************************************************************!*\
56022
+ !*** ../core/build/src/bdef/expressions/bdef_default_function.js ***!
56023
+ \*******************************************************************/
56024
+ (__unused_webpack_module, exports, __webpack_require__) {
56025
+
56026
+ "use strict";
56027
+
56028
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
56029
+ exports.BDEFDefaultFunction = void 0;
56030
+ const _1 = __webpack_require__(/*! . */ "../core/build/src/bdef/expressions/index.js");
56031
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
56032
+ /** eg. "{ default function GetDefaultsForCreate; }" */
56033
+ class BDEFDefaultFunction extends combi_1.Expression {
56034
+ getRunnable() {
56035
+ const func = (0, combi_1.seq)("DEFAULT FUNCTION", (0, combi_1.optPrio)((0, combi_1.seq)(_1.BDEFName, (0, combi_1.optPrio)((0, combi_1.seq)("EXTERNAL", _1.BDEFString)))), ";");
56036
+ return (0, combi_1.seq)("{", (0, combi_1.plusPrio)(func), "}");
56037
+ }
56038
+ }
56039
+ exports.BDEFDefaultFunction = BDEFDefaultFunction;
56040
+ //# sourceMappingURL=bdef_default_function.js.map
56041
+
56042
+ /***/ },
56043
+
56044
+ /***/ "../core/build/src/bdef/expressions/bdef_define_behavior.js"
56045
+ /*!******************************************************************!*\
56046
+ !*** ../core/build/src/bdef/expressions/bdef_define_behavior.js ***!
56047
+ \******************************************************************/
56048
+ (__unused_webpack_module, exports, __webpack_require__) {
56049
+
56050
+ "use strict";
56051
+
56052
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
56053
+ exports.BDEFDefineBehavior = void 0;
56054
+ const _1 = __webpack_require__(/*! . */ "../core/build/src/bdef/expressions/index.js");
56055
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
56056
+ /** behavior of one entity, "define behavior for ZI_Travel alias Travel ... { ... }" */
56057
+ class BDEFDefineBehavior extends combi_1.Expression {
56058
+ getRunnable() {
56059
+ const fieldMapping = (0, combi_1.seq)(_1.BDEFName, "=", _1.BDEFName);
56060
+ const lockMapping = (0, combi_1.seq)("(", fieldMapping, (0, combi_1.starPrio)((0, combi_1.seq)(",", fieldMapping)), ")");
56061
+ const dependentBy = (0, combi_1.seq)("DEPENDENT", (0, combi_1.optPrio)((0, combi_1.seq)("BY", _1.BDEFName)));
56062
+ const save = (0, combi_1.seq)((0, combi_1.altPrio)("WITH ADDITIONAL SAVE", "WITH UNMANAGED SAVE"), (0, combi_1.optPrio)("AND CLEANUP"), (0, combi_1.optPrio)("WITH FULL DATA"));
56063
+ const option = (0, combi_1.altPrio)(_1.BDEFAlias, _1.BDEFImplementationIn, (0, combi_1.seq)("EXTERNAL", _1.BDEFString), (0, combi_1.seq)("PERSISTENT TABLE", _1.BDEFName), (0, combi_1.seq)("DRAFT TABLE", _1.BDEFName), (0, combi_1.seq)("QUERY", _1.BDEFName), (0, combi_1.seq)("LOCK", (0, combi_1.altPrio)((0, combi_1.seq)("MASTER", (0, combi_1.optPrio)("UNMANAGED")), (0, combi_1.seq)(dependentBy, (0, combi_1.optPrio)(lockMapping)))), (0, combi_1.seq)("AUTHORIZATION", (0, combi_1.altPrio)((0, combi_1.seq)("MASTER", _1.BDEFOptions), dependentBy)), (0, combi_1.seq)((0, combi_1.optPrio)("TOTAL"), "ETAG", (0, combi_1.altPrio)((0, combi_1.seq)("MASTER", _1.BDEFName), dependentBy, _1.BDEFName)),
56064
+ // eg. "( lock, authorization, etag ) dependent by _Travel"
56065
+ (0, combi_1.seq)(_1.BDEFOptions, dependentBy), (0, combi_1.seq)((0, combi_1.altPrio)("LATE", "EARLY"), "NUMBERING", (0, combi_1.optPrio)("IN PLACE")), save, "WITH CONTROL", "USE ETAG", (0, combi_1.seq)("USING", _1.BDEFName), (0, combi_1.seq)("CHANGEDOCUMENTS", (0, combi_1.altPrio)((0, combi_1.seq)("MASTER", (0, combi_1.optPrio)("UTC"), (0, combi_1.optPrio)(_1.BDEFOptions)), dependentBy)), "EXTENSIBLE");
56066
+ const item = (0, combi_1.altPrio)(_1.BDEFUse, _1.BDEFDetermineAction, _1.BDEFOperation, _1.BDEFAction, _1.BDEFDetermination, _1.BDEFField, _1.BDEFAssociation, _1.BDEFMapping, _1.BDEFSideEffects, _1.BDEFEvent, _1.BDEFHierarchy, _1.BDEFKey, (0, combi_1.seq)("CHANGEDOCUMENTS", _1.BDEFOptions, ";"), ";");
56067
+ return (0, combi_1.seq)((0, combi_1.altPrio)((0, combi_1.seq)("DEFINE", (0, combi_1.optPrio)("ROOT"), "BEHAVIOR FOR"), "EXTEND BEHAVIOR FOR"), _1.BDEFName, (0, combi_1.starPrio)(option), "{", (0, combi_1.starPrio)(item), "}", (0, combi_1.optPrio)(";"));
56068
+ }
56069
+ }
56070
+ exports.BDEFDefineBehavior = BDEFDefineBehavior;
56071
+ //# sourceMappingURL=bdef_define_behavior.js.map
56072
+
56073
+ /***/ },
56074
+
56075
+ /***/ "../core/build/src/bdef/expressions/bdef_definition.js"
56076
+ /*!*************************************************************!*\
56077
+ !*** ../core/build/src/bdef/expressions/bdef_definition.js ***!
56078
+ \*************************************************************/
56079
+ (__unused_webpack_module, exports, __webpack_require__) {
56080
+
56081
+ "use strict";
56082
+
56083
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
56084
+ exports.BDEFDefinition = void 0;
56085
+ const _1 = __webpack_require__(/*! . */ "../core/build/src/bdef/expressions/index.js");
56086
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
56087
+ class BDEFDefinition extends combi_1.Expression {
56088
+ getRunnable() {
56089
+ return (0, combi_1.seq)(_1.BDEFImplementationType, (0, combi_1.starPrio)((0, combi_1.altPrio)(_1.BDEFHeader, _1.BDEFDefineBehavior, _1.BDEFAuthorizationContext)));
56090
+ }
56091
+ }
56092
+ exports.BDEFDefinition = BDEFDefinition;
56093
+ //# sourceMappingURL=bdef_definition.js.map
56094
+
56095
+ /***/ },
56096
+
56097
+ /***/ "../core/build/src/bdef/expressions/bdef_determination.js"
56098
+ /*!****************************************************************!*\
56099
+ !*** ../core/build/src/bdef/expressions/bdef_determination.js ***!
56100
+ \****************************************************************/
56101
+ (__unused_webpack_module, exports, __webpack_require__) {
56102
+
56103
+ "use strict";
56104
+
56105
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
56106
+ exports.BDEFDetermination = void 0;
56107
+ const _1 = __webpack_require__(/*! . */ "../core/build/src/bdef/expressions/index.js");
56108
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
56109
+ /** determinations and validations, eg. "validation validateDates on save { create; field BeginDate, EndDate; }" */
56110
+ class BDEFDetermination extends combi_1.Expression {
56111
+ getRunnable() {
56112
+ const fields = (0, combi_1.seq)(_1.BDEFFieldPath, (0, combi_1.starPrio)((0, combi_1.seq)(",", _1.BDEFFieldPath)));
56113
+ const trigger = (0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.altPrio)("CREATE", "UPDATE", "DELETE"), ";"), (0, combi_1.seq)("FIELD", fields, ";"), (0, combi_1.seq)("ENTITY", fields, ";"), ";");
56114
+ return (0, combi_1.seq)((0, combi_1.altPrio)("DETERMINATION", "VALIDATION"), (0, combi_1.optPrio)(_1.BDEFOptions), _1.BDEFName, "ON", (0, combi_1.altPrio)("MODIFY", "SAVE"), "{", (0, combi_1.starPrio)(trigger), "}");
56115
+ }
56116
+ }
56117
+ exports.BDEFDetermination = BDEFDetermination;
56118
+ //# sourceMappingURL=bdef_determination.js.map
56119
+
56120
+ /***/ },
56121
+
56122
+ /***/ "../core/build/src/bdef/expressions/bdef_determine_action.js"
56123
+ /*!*******************************************************************!*\
56124
+ !*** ../core/build/src/bdef/expressions/bdef_determine_action.js ***!
56125
+ \*******************************************************************/
56126
+ (__unused_webpack_module, exports, __webpack_require__) {
56127
+
56128
+ "use strict";
56129
+
56130
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
56131
+ exports.BDEFDetermineAction = void 0;
56132
+ const _1 = __webpack_require__(/*! . */ "../core/build/src/bdef/expressions/index.js");
56133
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
56134
+ /** eg. "draft determine action Prepare { validation validateDate; determination ( always ) Child ~ setStatus; }" */
56135
+ class BDEFDetermineAction extends combi_1.Expression {
56136
+ getRunnable() {
56137
+ const item = (0, combi_1.seq)((0, combi_1.altPrio)("VALIDATION", "DETERMINATION"), (0, combi_1.optPrio)(_1.BDEFOptions), _1.BDEFReference, ";");
56138
+ const body = (0, combi_1.seq)("{", (0, combi_1.starPrio)(item), "}");
56139
+ return (0, combi_1.seq)((0, combi_1.optPrio)("EXTEND"), (0, combi_1.optPrio)("DRAFT"), "DETERMINE ACTION", (0, combi_1.optPrio)(_1.BDEFOptions), _1.BDEFName, (0, combi_1.optPrio)("EXTENSIBLE"), (0, combi_1.altPrio)(";", body));
56140
+ }
56141
+ }
56142
+ exports.BDEFDetermineAction = BDEFDetermineAction;
56143
+ //# sourceMappingURL=bdef_determine_action.js.map
56144
+
56145
+ /***/ },
56146
+
56147
+ /***/ "../core/build/src/bdef/expressions/bdef_event.js"
56148
+ /*!********************************************************!*\
56149
+ !*** ../core/build/src/bdef/expressions/bdef_event.js ***!
56150
+ \********************************************************/
56151
+ (__unused_webpack_module, exports, __webpack_require__) {
56152
+
56153
+ "use strict";
56154
+
56155
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
56156
+ exports.BDEFEvent = void 0;
56157
+ const _1 = __webpack_require__(/*! . */ "../core/build/src/bdef/expressions/index.js");
56158
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
56159
+ /** eg. "event TravelCreated parameter ZD_TRAVEL_EVENT;" or "event StatusUpdated for side effects;" */
56160
+ class BDEFEvent extends combi_1.Expression {
56161
+ getRunnable() {
56162
+ const tail = (0, combi_1.altPrio)((0, combi_1.seq)("ON", _1.BDEFName), _1.BDEFParameter, "FOR SIDE EFFECTS", (0, combi_1.seq)("DESCRIPTION", _1.BDEFString), (0, combi_1.seq)("CATEGORY", _1.BDEFName));
56163
+ return (0, combi_1.seq)((0, combi_1.optPrio)("MANAGED"), "EVENT", _1.BDEFName, (0, combi_1.starPrio)(tail), ";");
56164
+ }
56165
+ }
56166
+ exports.BDEFEvent = BDEFEvent;
56167
+ //# sourceMappingURL=bdef_event.js.map
56168
+
56169
+ /***/ },
56170
+
56171
+ /***/ "../core/build/src/bdef/expressions/bdef_field.js"
56172
+ /*!********************************************************!*\
56173
+ !*** ../core/build/src/bdef/expressions/bdef_field.js ***!
56174
+ \********************************************************/
56175
+ (__unused_webpack_module, exports, __webpack_require__) {
56176
+
56177
+ "use strict";
56178
+
56179
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
56180
+ exports.BDEFField = void 0;
56181
+ const _1 = __webpack_require__(/*! . */ "../core/build/src/bdef/expressions/index.js");
56182
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
56183
+ /** field characteristics, eg. "field ( readonly, numbering : managed ) ID, CreatedBy;" */
56184
+ class BDEFField extends combi_1.Expression {
56185
+ getRunnable() {
56186
+ return (0, combi_1.seq)("FIELD", _1.BDEFOptions, _1.BDEFFieldPath, (0, combi_1.starPrio)((0, combi_1.seq)(",", _1.BDEFFieldPath)), (0, combi_1.optPrio)(","), ";");
56187
+ }
56188
+ }
56189
+ exports.BDEFField = BDEFField;
56190
+ //# sourceMappingURL=bdef_field.js.map
56191
+
56192
+ /***/ },
56193
+
56194
+ /***/ "../core/build/src/bdef/expressions/bdef_field_path.js"
56195
+ /*!*************************************************************!*\
56196
+ !*** ../core/build/src/bdef/expressions/bdef_field_path.js ***!
56197
+ \*************************************************************/
56198
+ (__unused_webpack_module, exports, __webpack_require__) {
56199
+
56200
+ "use strict";
56201
+
56202
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
56203
+ exports.BDEFFieldPath = void 0;
56204
+ const _1 = __webpack_require__(/*! . */ "../core/build/src/bdef/expressions/index.js");
56205
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
56206
+ /** field or association, possibly via associations, eg. "_Root.TotalPieces" */
56207
+ class BDEFFieldPath extends combi_1.Expression {
56208
+ getRunnable() {
56209
+ return (0, combi_1.seq)(_1.BDEFName, (0, combi_1.starPrio)((0, combi_1.seq)(".", _1.BDEFName)));
56210
+ }
56211
+ }
56212
+ exports.BDEFFieldPath = BDEFFieldPath;
56213
+ //# sourceMappingURL=bdef_field_path.js.map
56214
+
56215
+ /***/ },
56216
+
56217
+ /***/ "../core/build/src/bdef/expressions/bdef_header.js"
56218
+ /*!*********************************************************!*\
56219
+ !*** ../core/build/src/bdef/expressions/bdef_header.js ***!
56220
+ \*********************************************************/
56221
+ (__unused_webpack_module, exports, __webpack_require__) {
56222
+
56223
+ "use strict";
56224
+
56225
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
56226
+ exports.BDEFHeader = void 0;
56227
+ const _1 = __webpack_require__(/*! . */ "../core/build/src/bdef/expressions/index.js");
56228
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
56229
+ /** header statements following the implementation type, eg. "strict ( 2 );" or "with draft;" */
56230
+ class BDEFHeader extends combi_1.Expression {
56231
+ getRunnable() {
56232
+ const extensibleItem = (0, combi_1.seq)("WITH", (0, combi_1.plusPrio)((0, combi_1.regex)(/^\w+$/)), ";");
56233
+ const extensible = (0, combi_1.seq)("EXTENSIBLE", (0, combi_1.optPrio)((0, combi_1.seq)("{", (0, combi_1.starPrio)(extensibleItem), "}")), (0, combi_1.optPrio)(";"));
56234
+ return (0, combi_1.altPrio)((0, combi_1.seq)("STRICT", (0, combi_1.optPrio)((0, combi_1.seq)("(", (0, combi_1.regex)(/^\d+$/), ")")), ";"), (0, combi_1.seq)("WITH DRAFT", ";"), (0, combi_1.seq)("USE DRAFT", (0, combi_1.optPrio)("AS DEPENDENT"), ";"), (0, combi_1.seq)((0, combi_1.altPrio)("WITH", "USE"), "COLLABORATIVE DRAFT", ";"), (0, combi_1.seq)("WITH PRIVILEGED MODE", (0, combi_1.optPrio)((0, combi_1.seq)("DISABLING", _1.BDEFName)), ";"), (0, combi_1.seq)("WITH MANAGED INSTANCE FILTER", ";"), (0, combi_1.seq)("WITH HIERARCHY", ";"), (0, combi_1.seq)("WITH CROSS ASSOCIATIONS", ";"), (0, combi_1.seq)("USE SIDE EFFECTS", ";"), (0, combi_1.seq)("USE RECOMMENDATIONS", ";"), (0, combi_1.seq)("FOREIGN ENTITY", _1.BDEFName, (0, combi_1.optPrio)(_1.BDEFAlias), ";"), (0, combi_1.seq)("SCALAR ENTITY", _1.BDEFName, "FIELD", _1.BDEFName, ";"), (0, combi_1.seq)("AUXILIARY CLASS", _1.BDEFName, ";"), extensible);
56235
+ }
56236
+ }
56237
+ exports.BDEFHeader = BDEFHeader;
56238
+ //# sourceMappingURL=bdef_header.js.map
56239
+
56240
+ /***/ },
56241
+
56242
+ /***/ "../core/build/src/bdef/expressions/bdef_hierarchy.js"
56243
+ /*!************************************************************!*\
56244
+ !*** ../core/build/src/bdef/expressions/bdef_hierarchy.js ***!
56245
+ \************************************************************/
56246
+ (__unused_webpack_module, exports, __webpack_require__) {
56247
+
56248
+ "use strict";
56249
+
56250
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
56251
+ exports.BDEFHierarchy = void 0;
56252
+ const _1 = __webpack_require__(/*! . */ "../core/build/src/bdef/expressions/index.js");
56253
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
56254
+ /** eg. "instance hierarchy /DMO/I_EmployeeHN { managed reorder action changeNextSibling; ascending association _Manager; }" */
56255
+ class BDEFHierarchy extends combi_1.Expression {
56256
+ getRunnable() {
56257
+ const action = (0, combi_1.seq)((0, combi_1.optPrio)("MANAGED"), (0, combi_1.altPrio)("REORDER", "COPY"), "ACTION", _1.BDEFName, ";");
56258
+ const association = (0, combi_1.seq)((0, combi_1.altPrio)("ASCENDING", "DESCENDING"), "ASSOCIATION", _1.BDEFName, (0, combi_1.altPrio)(";", _1.BDEFAssociationBody));
56259
+ const item = (0, combi_1.altPrio)(action, association, _1.BDEFField, ";");
56260
+ return (0, combi_1.seq)("INSTANCE HIERARCHY", _1.BDEFName, "{", (0, combi_1.starPrio)(item), "}");
56261
+ }
56262
+ }
56263
+ exports.BDEFHierarchy = BDEFHierarchy;
56264
+ //# sourceMappingURL=bdef_hierarchy.js.map
56265
+
56266
+ /***/ },
56267
+
56268
+ /***/ "../core/build/src/bdef/expressions/bdef_implementation_in.js"
56269
+ /*!********************************************************************!*\
56270
+ !*** ../core/build/src/bdef/expressions/bdef_implementation_in.js ***!
56271
+ \********************************************************************/
56272
+ (__unused_webpack_module, exports, __webpack_require__) {
56273
+
56274
+ "use strict";
56275
+
56276
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
56277
+ exports.BDEFImplementationIn = void 0;
56278
+ const _1 = __webpack_require__(/*! . */ "../core/build/src/bdef/expressions/index.js");
56279
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
56280
+ class BDEFImplementationIn extends combi_1.Expression {
56281
+ getRunnable() {
56282
+ return (0, combi_1.seq)("IMPLEMENTATION IN CLASS", _1.BDEFName, (0, combi_1.optPrio)("UNIQUE"));
56283
+ }
56284
+ }
56285
+ exports.BDEFImplementationIn = BDEFImplementationIn;
56286
+ //# sourceMappingURL=bdef_implementation_in.js.map
56287
+
56288
+ /***/ },
56289
+
56290
+ /***/ "../core/build/src/bdef/expressions/bdef_implementation_type.js"
56291
+ /*!**********************************************************************!*\
56292
+ !*** ../core/build/src/bdef/expressions/bdef_implementation_type.js ***!
56293
+ \**********************************************************************/
56294
+ (__unused_webpack_module, exports, __webpack_require__) {
56295
+
56296
+ "use strict";
56297
+
56298
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
56299
+ exports.BDEFImplementationType = void 0;
56300
+ const _1 = __webpack_require__(/*! . */ "../core/build/src/bdef/expressions/index.js");
56301
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
56302
+ /** first statement, eg. "managed with additional save implementation in class zbp_travel unique;" */
56303
+ class BDEFImplementationType extends combi_1.Expression {
56304
+ getRunnable() {
56305
+ const extension = (0, combi_1.seq)("EXTENSION", (0, combi_1.optPrio)((0, combi_1.altPrio)((0, combi_1.seq)("USING INTERFACE", _1.BDEFName), (0, combi_1.seq)("FOR", (0, combi_1.altPrio)("PROJECTION", "INTERFACE")))));
56306
+ const type = (0, combi_1.altPrio)("MANAGED", "UNMANAGED", "ABSTRACT", "PROJECTION", "INTERFACE", extension,
56307
+ // old syntax, eg. "implementation unmanaged;"
56308
+ (0, combi_1.seq)("IMPLEMENTATION", (0, combi_1.altPrio)("MANAGED", "UNMANAGED", "ABSTRACT", "PROJECTION")));
56309
+ const save = (0, combi_1.seq)((0, combi_1.altPrio)("WITH ADDITIONAL SAVE", "WITH UNMANAGED SAVE"), (0, combi_1.optPrio)("AND CLEANUP"), (0, combi_1.optPrio)("WITH FULL DATA"));
56310
+ const option = (0, combi_1.altPrio)(_1.BDEFImplementationIn, save);
56311
+ return (0, combi_1.seq)(type, (0, combi_1.starPrio)(option), ";");
56312
+ }
56313
+ }
56314
+ exports.BDEFImplementationType = BDEFImplementationType;
56315
+ //# sourceMappingURL=bdef_implementation_type.js.map
56316
+
56317
+ /***/ },
56318
+
56319
+ /***/ "../core/build/src/bdef/expressions/bdef_key.js"
56320
+ /*!******************************************************!*\
56321
+ !*** ../core/build/src/bdef/expressions/bdef_key.js ***!
56322
+ \******************************************************/
56323
+ (__unused_webpack_module, exports, __webpack_require__) {
56324
+
56325
+ "use strict";
56326
+
56327
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
56328
+ exports.BDEFKey = void 0;
56329
+ const _1 = __webpack_require__(/*! . */ "../core/build/src/bdef/expressions/index.js");
56330
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
56331
+ /** alternative key, eg. "define pure key AlternativeKey { id; }" */
56332
+ class BDEFKey extends combi_1.Expression {
56333
+ getRunnable() {
56334
+ const fields = (0, combi_1.seq)(_1.BDEFName, (0, combi_1.starPrio)((0, combi_1.seq)(",", _1.BDEFName)), ";");
56335
+ return (0, combi_1.seq)("DEFINE", (0, combi_1.optPrio)("PURE"), "KEY", _1.BDEFName, "{", (0, combi_1.starPrio)(fields), "}");
56336
+ }
56337
+ }
56338
+ exports.BDEFKey = BDEFKey;
56339
+ //# sourceMappingURL=bdef_key.js.map
56340
+
56341
+ /***/ },
56342
+
56343
+ /***/ "../core/build/src/bdef/expressions/bdef_mapping.js"
56344
+ /*!**********************************************************!*\
56345
+ !*** ../core/build/src/bdef/expressions/bdef_mapping.js ***!
56346
+ \**********************************************************/
56347
+ (__unused_webpack_module, exports, __webpack_require__) {
56348
+
56349
+ "use strict";
56350
+
56351
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
56352
+ exports.BDEFMapping = void 0;
56353
+ const _1 = __webpack_require__(/*! . */ "../core/build/src/bdef/expressions/index.js");
56354
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
56355
+ /** eg. "mapping for ztravel corresponding { TravelID = travel_id; }" */
56356
+ class BDEFMapping extends combi_1.Expression {
56357
+ getRunnable() {
56358
+ const names = (0, combi_1.seq)(_1.BDEFName, (0, combi_1.starPrio)((0, combi_1.seq)(",", _1.BDEFName)));
56359
+ const line = (0, combi_1.seq)(_1.BDEFName, "=", _1.BDEFName, (0, combi_1.optPrio)((0, combi_1.seq)("CONTROL", _1.BDEFName)), ";");
56360
+ // deep mapping of a sub node, eg. "sub _Items = items;"
56361
+ const sub = (0, combi_1.seq)("SUB", _1.BDEFName, "=", _1.BDEFName, ";");
56362
+ const body = (0, combi_1.seq)("{", (0, combi_1.starPrio)((0, combi_1.altPrio)(sub, line, ";")), "}");
56363
+ const option = (0, combi_1.altPrio)("CORRESPONDING", "EXTENSIBLE", (0, combi_1.seq)("EXCEPT", names), (0, combi_1.seq)("CONTROL", _1.BDEFName));
56364
+ return (0, combi_1.seq)((0, combi_1.optPrio)("DEEP"), "MAPPING FOR", _1.BDEFName, (0, combi_1.starPrio)(option), (0, combi_1.altPrio)(";", body));
56365
+ }
56366
+ }
56367
+ exports.BDEFMapping = BDEFMapping;
56368
+ //# sourceMappingURL=bdef_mapping.js.map
56369
+
56370
+ /***/ },
56371
+
56372
+ /***/ "../core/build/src/bdef/expressions/bdef_name.js"
56373
+ /*!*******************************************************!*\
56374
+ !*** ../core/build/src/bdef/expressions/bdef_name.js ***!
56375
+ \*******************************************************/
56376
+ (__unused_webpack_module, exports, __webpack_require__) {
56377
+
56378
+ "use strict";
56379
+
56380
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
56381
+ exports.BDEFName = void 0;
56382
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
56383
+ class BDEFName extends combi_1.Expression {
56384
+ getRunnable() {
56385
+ const word = (0, combi_1.regex)(/^\$?\w+$/);
56386
+ const slashName = (0, combi_1.seq)("/", (0, combi_1.regex)(/^\w+$/), "/", (0, combi_1.regex)(/^\w+$/));
56387
+ return (0, combi_1.altPrio)(slashName, word);
56388
+ }
56389
+ }
56390
+ exports.BDEFName = BDEFName;
56391
+ //# sourceMappingURL=bdef_name.js.map
56392
+
56393
+ /***/ },
56394
+
56395
+ /***/ "../core/build/src/bdef/expressions/bdef_operation.js"
56396
+ /*!************************************************************!*\
56397
+ !*** ../core/build/src/bdef/expressions/bdef_operation.js ***!
56398
+ \************************************************************/
56399
+ (__unused_webpack_module, exports, __webpack_require__) {
56400
+
56401
+ "use strict";
56402
+
56403
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
56404
+ exports.BDEFOperation = void 0;
56405
+ const _1 = __webpack_require__(/*! . */ "../core/build/src/bdef/expressions/index.js");
56406
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
56407
+ /** standard operations, eg. "internal create ( features : global );" */
56408
+ class BDEFOperation extends combi_1.Expression {
56409
+ getRunnable() {
56410
+ return (0, combi_1.seq)((0, combi_1.starPrio)((0, combi_1.altPrio)("INTERNAL", "STATIC")), (0, combi_1.altPrio)("CREATE", "UPDATE", "DELETE"), (0, combi_1.optPrio)(_1.BDEFOptions), (0, combi_1.altPrio)(";", _1.BDEFDefaultFunction));
56411
+ }
56412
+ }
56413
+ exports.BDEFOperation = BDEFOperation;
56414
+ //# sourceMappingURL=bdef_operation.js.map
56415
+
56416
+ /***/ },
56417
+
56418
+ /***/ "../core/build/src/bdef/expressions/bdef_options.js"
56419
+ /*!**********************************************************!*\
56420
+ !*** ../core/build/src/bdef/expressions/bdef_options.js ***!
56421
+ \**********************************************************/
56422
+ (__unused_webpack_module, exports, __webpack_require__) {
56423
+
56424
+ "use strict";
56425
+
56426
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
56427
+ exports.BDEFOptions = void 0;
56428
+ const _1 = __webpack_require__(/*! . */ "../core/build/src/bdef/expressions/index.js");
56429
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
56430
+ /** eg. "( features : instance, precheck )", "( read only )" or "( hierarchy-index )" */
56431
+ class BDEFOptions extends combi_1.Expression {
56432
+ getRunnable() {
56433
+ const name = (0, combi_1.seq)(_1.BDEFName, (0, combi_1.starPrio)((0, combi_1.altPrio)((0, combi_1.seq)("-", _1.BDEFName), _1.BDEFName)));
56434
+ const option = (0, combi_1.seq)(name, (0, combi_1.optPrio)((0, combi_1.seq)(":", _1.BDEFName)));
56435
+ return (0, combi_1.seq)("(", option, (0, combi_1.starPrio)((0, combi_1.seq)(",", option)), ")");
56436
+ }
56437
+ }
56438
+ exports.BDEFOptions = BDEFOptions;
56439
+ //# sourceMappingURL=bdef_options.js.map
56440
+
56441
+ /***/ },
56442
+
56443
+ /***/ "../core/build/src/bdef/expressions/bdef_parameter.js"
56444
+ /*!************************************************************!*\
56445
+ !*** ../core/build/src/bdef/expressions/bdef_parameter.js ***!
56446
+ \************************************************************/
56447
+ (__unused_webpack_module, exports, __webpack_require__) {
56448
+
56449
+ "use strict";
56450
+
56451
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
56452
+ exports.BDEFParameter = void 0;
56453
+ const _1 = __webpack_require__(/*! . */ "../core/build/src/bdef/expressions/index.js");
56454
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
56455
+ /** eg. "deep parameter ZD_PARAMETER" */
56456
+ class BDEFParameter extends combi_1.Expression {
56457
+ getRunnable() {
56458
+ return (0, combi_1.seq)((0, combi_1.optPrio)("DEEP"), "PARAMETER", _1.BDEFName);
56459
+ }
56460
+ }
56461
+ exports.BDEFParameter = BDEFParameter;
56462
+ //# sourceMappingURL=bdef_parameter.js.map
56463
+
56464
+ /***/ },
56465
+
56466
+ /***/ "../core/build/src/bdef/expressions/bdef_reference.js"
56467
+ /*!************************************************************!*\
56468
+ !*** ../core/build/src/bdef/expressions/bdef_reference.js ***!
56469
+ \************************************************************/
56470
+ (__unused_webpack_module, exports, __webpack_require__) {
56471
+
56472
+ "use strict";
56473
+
56474
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
56475
+ exports.BDEFReference = void 0;
56476
+ const _1 = __webpack_require__(/*! . */ "../core/build/src/bdef/expressions/index.js");
56477
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
56478
+ /** reference to a determination, validation or action, optionally prefixed with an entity, eg. "Child ~ validatePercentage" */
56479
+ class BDEFReference extends combi_1.Expression {
56480
+ getRunnable() {
56481
+ const namespace = (0, combi_1.seq)("/", (0, combi_1.regex)(/^\w+$/), "/");
56482
+ const tildeEnd = (0, combi_1.regex)(/^\w+~$/);
56483
+ return (0, combi_1.altPrio)((0, combi_1.seq)(_1.BDEFName, "~", _1.BDEFName), (0, combi_1.seq)(_1.BDEFName, (0, combi_1.regex)(/^~\w+$/)), (0, combi_1.seq)((0, combi_1.optPrio)(namespace), tildeEnd, _1.BDEFName), (0, combi_1.seq)((0, combi_1.optPrio)(namespace), (0, combi_1.regex)(/^\w+~\w+$/)), _1.BDEFName);
56484
+ }
56485
+ }
56486
+ exports.BDEFReference = BDEFReference;
56487
+ //# sourceMappingURL=bdef_reference.js.map
56488
+
56489
+ /***/ },
56490
+
56491
+ /***/ "../core/build/src/bdef/expressions/bdef_result.js"
56492
+ /*!*********************************************************!*\
56493
+ !*** ../core/build/src/bdef/expressions/bdef_result.js ***!
56494
+ \*********************************************************/
56495
+ (__unused_webpack_module, exports, __webpack_require__) {
56496
+
56497
+ "use strict";
56498
+
56499
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
56500
+ exports.BDEFResult = void 0;
56501
+ const _1 = __webpack_require__(/*! . */ "../core/build/src/bdef/expressions/index.js");
56502
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
56503
+ /** eg. "result [1] $self", "deep result ZD_RESULT" or "result selective [0..*] entity ZI_Travel" */
56504
+ class BDEFResult extends combi_1.Expression {
56505
+ getRunnable() {
56506
+ return (0, combi_1.seq)((0, combi_1.optPrio)("DEEP"), "RESULT", (0, combi_1.optPrio)("SELECTIVE"), (0, combi_1.optPrio)(_1.BDEFCardinality), (0, combi_1.optPrio)("ENTITY"), _1.BDEFName);
56507
+ }
56508
+ }
56509
+ exports.BDEFResult = BDEFResult;
56510
+ //# sourceMappingURL=bdef_result.js.map
56511
+
56512
+ /***/ },
56513
+
56514
+ /***/ "../core/build/src/bdef/expressions/bdef_side_effects.js"
56515
+ /*!***************************************************************!*\
56516
+ !*** ../core/build/src/bdef/expressions/bdef_side_effects.js ***!
56517
+ \***************************************************************/
56518
+ (__unused_webpack_module, exports, __webpack_require__) {
56519
+
56520
+ "use strict";
56521
+
56522
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
56523
+ exports.BDEFSideEffects = void 0;
56524
+ const _1 = __webpack_require__(/*! . */ "../core/build/src/bdef/expressions/index.js");
56525
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
56526
+ /** eg. "side effects { field Price affects field TotalPrice, messages; }" */
56527
+ class BDEFSideEffects extends combi_1.Expression {
56528
+ getRunnable() {
56529
+ const fieldList = (0, combi_1.seq)("(", _1.BDEFName, (0, combi_1.starPrio)((0, combi_1.seq)(",", _1.BDEFName)), ")");
56530
+ // eg. "field *", "field ( A, B )", "field _Item.*" or "field _Root.( A, B )"
56531
+ const field = (0, combi_1.seq)("FIELD", (0, combi_1.altPrio)("*", fieldList, (0, combi_1.seq)(_1.BDEFName, (0, combi_1.starPrio)((0, combi_1.seq)(".", (0, combi_1.altPrio)("*", fieldList, _1.BDEFName))))));
56532
+ const permission = (0, combi_1.altPrio)((0, combi_1.seq)("ACTION", _1.BDEFReference), field, (0, combi_1.seq)((0, combi_1.altPrio)("CREATE", "UPDATE", "DELETE"), (0, combi_1.optPrio)(_1.BDEFName)));
56533
+ const permissions = (0, combi_1.seq)("PERMISSIONS", "(", permission, (0, combi_1.starPrio)((0, combi_1.seq)(",", permission)), ")");
56534
+ const target = (0, combi_1.altPrio)(field, (0, combi_1.seq)("ENTITY", _1.BDEFFieldPath), "MESSAGES", permissions, "$SELF");
56535
+ const targets = (0, combi_1.seq)(target, (0, combi_1.starPrio)((0, combi_1.seq)(",", target)));
56536
+ const trigger = (0, combi_1.altPrio)(field, (0, combi_1.seq)("ENTITY", _1.BDEFFieldPath), "$SELF");
56537
+ const triggers = (0, combi_1.seq)(trigger, (0, combi_1.starPrio)((0, combi_1.seq)(",", trigger)));
56538
+ const source = (0, combi_1.altPrio)(field, (0, combi_1.seq)("ACTION", _1.BDEFReference), (0, combi_1.seq)("DETERMINE ACTION", _1.BDEFReference, "EXECUTED ON", triggers), (0, combi_1.seq)("ENTITY", _1.BDEFFieldPath), (0, combi_1.seq)("EVENT", _1.BDEFName), "$SELF");
56539
+ const recommendation = (0, combi_1.seq)("RECOMMENDATION FUNCTION", _1.BDEFName, "EXECUTED ON", triggers, ";");
56540
+ const item = (0, combi_1.altPrio)((0, combi_1.seq)(source, "AFFECTS", targets, ";"), recommendation, ";");
56541
+ return (0, combi_1.seq)("SIDE EFFECTS", "{", (0, combi_1.starPrio)(item), "}");
56542
+ }
56543
+ }
56544
+ exports.BDEFSideEffects = BDEFSideEffects;
56545
+ //# sourceMappingURL=bdef_side_effects.js.map
56546
+
56547
+ /***/ },
56548
+
56549
+ /***/ "../core/build/src/bdef/expressions/bdef_string.js"
56550
+ /*!*********************************************************!*\
56551
+ !*** ../core/build/src/bdef/expressions/bdef_string.js ***!
56552
+ \*********************************************************/
56553
+ (__unused_webpack_module, exports, __webpack_require__) {
56554
+
56555
+ "use strict";
56556
+
56557
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
56558
+ exports.BDEFString = void 0;
56559
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
56560
+ class BDEFString extends combi_1.Expression {
56561
+ getRunnable() {
56562
+ return (0, combi_1.regex)(/^'(?:[^']|'')*'$/);
56563
+ }
56564
+ }
56565
+ exports.BDEFString = BDEFString;
56566
+ //# sourceMappingURL=bdef_string.js.map
56567
+
56568
+ /***/ },
56569
+
56570
+ /***/ "../core/build/src/bdef/expressions/bdef_use.js"
56571
+ /*!******************************************************!*\
56572
+ !*** ../core/build/src/bdef/expressions/bdef_use.js ***!
56573
+ \******************************************************/
56574
+ (__unused_webpack_module, exports, __webpack_require__) {
56575
+
56576
+ "use strict";
56577
+
56578
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
56579
+ exports.BDEFUse = void 0;
56580
+ const _1 = __webpack_require__(/*! . */ "../core/build/src/bdef/expressions/index.js");
56581
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
56582
+ /** reuse in projections and interfaces, eg. "use action acceptTravel as accept;" */
56583
+ class BDEFUse extends combi_1.Expression {
56584
+ getRunnable() {
56585
+ const end = (0, combi_1.altPrio)(";", _1.BDEFDefaultFunction);
56586
+ const operation = (0, combi_1.seq)((0, combi_1.altPrio)("CREATE", "UPDATE", "DELETE"), (0, combi_1.optPrio)(_1.BDEFOptions), end);
56587
+ const actionTail = (0, combi_1.altPrio)((0, combi_1.seq)("AS", _1.BDEFName), (0, combi_1.seq)("EXTERNAL", _1.BDEFString), _1.BDEFParameter, _1.BDEFResult);
56588
+ const action = (0, combi_1.seq)((0, combi_1.altPrio)("ACTION", "FUNCTION"), (0, combi_1.optPrio)(_1.BDEFOptions), _1.BDEFName, (0, combi_1.starPrio)(actionTail), end);
56589
+ const association = (0, combi_1.seq)("ASSOCIATION", (0, combi_1.optPrio)(_1.BDEFOptions), _1.BDEFName, (0, combi_1.optPrio)((0, combi_1.seq)("ABBREVIATION", _1.BDEFName)), (0, combi_1.altPrio)(";", _1.BDEFAssociationBody));
56590
+ return (0, combi_1.seq)("USE", (0, combi_1.altPrio)(operation, action, association, (0, combi_1.seq)("ETAG", ";"), (0, combi_1.seq)("SIDE EFFECTS", ";"), (0, combi_1.seq)("KEY", _1.BDEFName, ";"), (0, combi_1.seq)("EVENT", _1.BDEFName, (0, combi_1.optPrio)(_1.BDEFParameter), ";")));
56591
+ }
56592
+ }
56593
+ exports.BDEFUse = BDEFUse;
56594
+ //# sourceMappingURL=bdef_use.js.map
56595
+
56596
+ /***/ },
56597
+
56598
+ /***/ "../core/build/src/bdef/expressions/index.js"
56599
+ /*!***************************************************!*\
56600
+ !*** ../core/build/src/bdef/expressions/index.js ***!
56601
+ \***************************************************/
56602
+ (__unused_webpack_module, exports, __webpack_require__) {
56603
+
56604
+ "use strict";
56605
+
56606
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
56607
+ if (k2 === undefined) k2 = k;
56608
+ var desc = Object.getOwnPropertyDescriptor(m, k);
56609
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
56610
+ desc = { enumerable: true, get: function() { return m[k]; } };
56611
+ }
56612
+ Object.defineProperty(o, k2, desc);
56613
+ }) : (function(o, m, k, k2) {
56614
+ if (k2 === undefined) k2 = k;
56615
+ o[k2] = m[k];
56616
+ }));
56617
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
56618
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
56619
+ };
56620
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
56621
+ __exportStar(__webpack_require__(/*! ./bdef_action */ "../core/build/src/bdef/expressions/bdef_action.js"), exports);
56622
+ __exportStar(__webpack_require__(/*! ./bdef_alias */ "../core/build/src/bdef/expressions/bdef_alias.js"), exports);
56623
+ __exportStar(__webpack_require__(/*! ./bdef_association_body */ "../core/build/src/bdef/expressions/bdef_association_body.js"), exports);
56624
+ __exportStar(__webpack_require__(/*! ./bdef_association */ "../core/build/src/bdef/expressions/bdef_association.js"), exports);
56625
+ __exportStar(__webpack_require__(/*! ./bdef_authorization_context */ "../core/build/src/bdef/expressions/bdef_authorization_context.js"), exports);
56626
+ __exportStar(__webpack_require__(/*! ./bdef_cardinality */ "../core/build/src/bdef/expressions/bdef_cardinality.js"), exports);
56627
+ __exportStar(__webpack_require__(/*! ./bdef_default_function */ "../core/build/src/bdef/expressions/bdef_default_function.js"), exports);
56628
+ __exportStar(__webpack_require__(/*! ./bdef_define_behavior */ "../core/build/src/bdef/expressions/bdef_define_behavior.js"), exports);
56629
+ __exportStar(__webpack_require__(/*! ./bdef_definition */ "../core/build/src/bdef/expressions/bdef_definition.js"), exports);
56630
+ __exportStar(__webpack_require__(/*! ./bdef_determination */ "../core/build/src/bdef/expressions/bdef_determination.js"), exports);
56631
+ __exportStar(__webpack_require__(/*! ./bdef_determine_action */ "../core/build/src/bdef/expressions/bdef_determine_action.js"), exports);
56632
+ __exportStar(__webpack_require__(/*! ./bdef_event */ "../core/build/src/bdef/expressions/bdef_event.js"), exports);
56633
+ __exportStar(__webpack_require__(/*! ./bdef_field_path */ "../core/build/src/bdef/expressions/bdef_field_path.js"), exports);
56634
+ __exportStar(__webpack_require__(/*! ./bdef_field */ "../core/build/src/bdef/expressions/bdef_field.js"), exports);
56635
+ __exportStar(__webpack_require__(/*! ./bdef_header */ "../core/build/src/bdef/expressions/bdef_header.js"), exports);
56636
+ __exportStar(__webpack_require__(/*! ./bdef_hierarchy */ "../core/build/src/bdef/expressions/bdef_hierarchy.js"), exports);
56637
+ __exportStar(__webpack_require__(/*! ./bdef_implementation_in */ "../core/build/src/bdef/expressions/bdef_implementation_in.js"), exports);
56638
+ __exportStar(__webpack_require__(/*! ./bdef_implementation_type */ "../core/build/src/bdef/expressions/bdef_implementation_type.js"), exports);
56639
+ __exportStar(__webpack_require__(/*! ./bdef_key */ "../core/build/src/bdef/expressions/bdef_key.js"), exports);
56640
+ __exportStar(__webpack_require__(/*! ./bdef_mapping */ "../core/build/src/bdef/expressions/bdef_mapping.js"), exports);
56641
+ __exportStar(__webpack_require__(/*! ./bdef_name */ "../core/build/src/bdef/expressions/bdef_name.js"), exports);
56642
+ __exportStar(__webpack_require__(/*! ./bdef_operation */ "../core/build/src/bdef/expressions/bdef_operation.js"), exports);
56643
+ __exportStar(__webpack_require__(/*! ./bdef_options */ "../core/build/src/bdef/expressions/bdef_options.js"), exports);
56644
+ __exportStar(__webpack_require__(/*! ./bdef_parameter */ "../core/build/src/bdef/expressions/bdef_parameter.js"), exports);
56645
+ __exportStar(__webpack_require__(/*! ./bdef_reference */ "../core/build/src/bdef/expressions/bdef_reference.js"), exports);
56646
+ __exportStar(__webpack_require__(/*! ./bdef_result */ "../core/build/src/bdef/expressions/bdef_result.js"), exports);
56647
+ __exportStar(__webpack_require__(/*! ./bdef_side_effects */ "../core/build/src/bdef/expressions/bdef_side_effects.js"), exports);
56648
+ __exportStar(__webpack_require__(/*! ./bdef_string */ "../core/build/src/bdef/expressions/bdef_string.js"), exports);
56649
+ __exportStar(__webpack_require__(/*! ./bdef_use */ "../core/build/src/bdef/expressions/bdef_use.js"), exports);
56650
+ //# sourceMappingURL=index.js.map
56651
+
56652
+ /***/ },
56653
+
55595
56654
  /***/ "../core/build/src/cds/cds_determine_types.js"
55596
56655
  /*!****************************************************!*\
55597
56656
  !*** ../core/build/src/cds/cds_determine_types.js ***!
@@ -60615,6 +61674,7 @@ exports.Diagnostics = Diagnostics;
60615
61674
 
60616
61675
  Object.defineProperty(exports, "__esModule", ({ value: true }));
60617
61676
  exports.DumpScope = void 0;
61677
+ const position_1 = __webpack_require__(/*! ../position */ "../core/build/src/position.js");
60618
61678
  const _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ "../core/build/src/abap/5_syntax/_scope_type.js");
60619
61679
  class DumpScope {
60620
61680
  static dump(spaghetti) {
@@ -60628,8 +61688,8 @@ class DumpScope {
60628
61688
  const sident = "&nbsp".repeat(indent * 2);
60629
61689
  let ret = sident + "<u>" + identifier.stype + ", <tt>" + identifier.sname + "</tt>";
60630
61690
  ret += ", (" + coverage.start.getRow() + ", " + coverage.start.getCol() + ")";
60631
- if (coverage.end.getRow() === Number.MAX_SAFE_INTEGER
60632
- && coverage.end.getCol() === Number.MAX_SAFE_INTEGER) {
61691
+ if (coverage.end.getRow() === position_1.MAX_POSITION_VALUE
61692
+ && coverage.end.getCol() === position_1.MAX_POSITION_VALUE) {
60633
61693
  ret += ", (max, max)";
60634
61694
  }
60635
61695
  else {
@@ -63233,6 +64293,8 @@ exports.BADIDefinition = BADIDefinition;
63233
64293
 
63234
64294
  Object.defineProperty(exports, "__esModule", ({ value: true }));
63235
64295
  exports.BehaviorDefinition = void 0;
64296
+ const bdef_parser_1 = __webpack_require__(/*! ../bdef/bdef_parser */ "../core/build/src/bdef/bdef_parser.js");
64297
+ const expressions_1 = __webpack_require__(/*! ../bdef/expressions */ "../core/build/src/bdef/expressions/index.js");
63236
64298
  const _abstract_object_1 = __webpack_require__(/*! ./_abstract_object */ "../core/build/src/objects/_abstract_object.js");
63237
64299
  class BehaviorDefinition extends _abstract_object_1.AbstractObject {
63238
64300
  constructor() {
@@ -63255,8 +64317,30 @@ class BehaviorDefinition extends _abstract_object_1.AbstractObject {
63255
64317
  findSourceFile() {
63256
64318
  return this.getFiles().find(f => f.getFilename().endsWith(".asbdef"));
63257
64319
  }
64320
+ parse() {
64321
+ if (this.isDirty() === false && this.parsedData !== undefined) {
64322
+ return { updated: false, runtime: 0 };
64323
+ }
64324
+ const start = Date.now();
64325
+ const tree = new bdef_parser_1.BDEFParser().parse(this.findSourceFile());
64326
+ this.parsedData = {
64327
+ entities: tree ? this.findEntities(tree) : this.findEntitiesFallback(),
64328
+ tree,
64329
+ };
64330
+ this.dirty = false;
64331
+ return { updated: true, runtime: Date.now() - start };
64332
+ }
64333
+ getTree() {
64334
+ var _a;
64335
+ this.parse();
64336
+ return (_a = this.parsedData) === null || _a === void 0 ? void 0 : _a.tree;
64337
+ }
64338
+ hasParserError() {
64339
+ return this.findSourceFile() !== undefined && this.getTree() === undefined;
64340
+ }
63258
64341
  listEntities() {
63259
- return this.parseSource().entities;
64342
+ this.parse();
64343
+ return this.parsedData.entities;
63260
64344
  }
63261
64345
  /** finds the entity name for a given alias, undefined if the alias is not defined */
63262
64346
  findEntityNameByAlias(alias) {
@@ -63270,15 +64354,29 @@ class BehaviorDefinition extends _abstract_object_1.AbstractObject {
63270
64354
  return undefined;
63271
64355
  }
63272
64356
  /////////////////////////
63273
- parseSource() {
64357
+ findEntities(tree) {
63274
64358
  var _a;
63275
- if (this.parsedData !== undefined) {
63276
- return this.parsedData;
64359
+ const ret = [];
64360
+ for (const define of tree.findDirectExpressions(expressions_1.BDEFDefineBehavior)) {
64361
+ const name = define.findDirectExpression(expressions_1.BDEFName);
64362
+ if (name === undefined) {
64363
+ continue;
64364
+ }
64365
+ const alias = (_a = define.findDirectExpression(expressions_1.BDEFAlias)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(expressions_1.BDEFName);
64366
+ ret.push({
64367
+ name: name.concatTokens().replace(/ /g, ""),
64368
+ alias: alias === null || alias === void 0 ? void 0 : alias.concatTokens().replace(/ /g, ""),
64369
+ });
63277
64370
  }
63278
- this.parsedData = { entities: [] };
64371
+ return ret;
64372
+ }
64373
+ /** used if the source cannot be parsed */
64374
+ findEntitiesFallback() {
64375
+ var _a;
64376
+ const ret = [];
63279
64377
  const raw = (_a = this.findSourceFile()) === null || _a === void 0 ? void 0 : _a.getRaw();
63280
64378
  if (raw === undefined) {
63281
- return this.parsedData;
64379
+ return ret;
63282
64380
  }
63283
64381
  // BDEF uses "//" for line comments
63284
64382
  const stripped = raw.replace(/\/\/.*$/gm, "");
@@ -63286,10 +64384,10 @@ class BehaviorDefinition extends _abstract_object_1.AbstractObject {
63286
64384
  const regex = /\bdefine\s+(?:\w+\s+)*?behavior\s+for\s+([\w/]+)(?:\s+alias\s+(\w+))?/gi;
63287
64385
  let match = regex.exec(stripped);
63288
64386
  while (match !== null) {
63289
- this.parsedData.entities.push({ name: match[1], alias: match[2] });
64387
+ ret.push({ name: match[1], alias: match[2] });
63290
64388
  match = regex.exec(stripped);
63291
64389
  }
63292
- return this.parsedData;
64390
+ return ret;
63293
64391
  }
63294
64392
  }
63295
64393
  exports.BehaviorDefinition = BehaviorDefinition;
@@ -70999,7 +72097,10 @@ exports.WebReportingTemplate = WebReportingTemplate;
70999
72097
  "use strict";
71000
72098
 
71001
72099
  Object.defineProperty(exports, "__esModule", ({ value: true }));
71002
- exports.Position = void 0;
72100
+ exports.Position = exports.MAX_POSITION_VALUE = void 0;
72101
+ // largest value that is a Smi on all V8 builds, larger values (eg. Number.MAX_SAFE_INTEGER) make V8
72102
+ // store row/col of every Position as boxed heap numbers, costing ~32 bytes per Position
72103
+ exports.MAX_POSITION_VALUE = 2 ** 30 - 1;
71003
72104
  // first position is (1,1)
71004
72105
  class Position {
71005
72106
  constructor(row, col) {
@@ -71550,7 +72651,7 @@ class Registry {
71550
72651
  }
71551
72652
  static abaplintVersion() {
71552
72653
  // magic, see build script "version.js"
71553
- return "2.120.82";
72654
+ return "2.120.84";
71554
72655
  }
71555
72656
  getDDICReferences() {
71556
72657
  return this.ddicReferences;
@@ -72106,14 +73207,18 @@ var __importStar = (this && this.__importStar) || (function () {
72106
73207
  };
72107
73208
  })();
72108
73209
  Object.defineProperty(exports, "__esModule", ({ value: true }));
72109
- exports.SourceKind = exports.PredicateKind = exports.Procedure = exports.ObjectAnalysis = exports.Variable = exports.OccurrenceKind = void 0;
73210
+ exports.Hierarchy = exports.NUMERIC_FUNCTIONS = exports.SourceKind = exports.PredicateKind = exports.InitialDeclaration = exports.Procedure = exports.ObjectAnalysis = exports.Variable = exports.OccurrenceKind = void 0;
72110
73211
  exports.findStructures = findStructures;
72111
73212
  exports.expressionPath = expressionPath;
72112
73213
  exports.plainMove = plainMove;
73214
+ exports.plainCreateObject = plainCreateObject;
72113
73215
  exports.singleField = singleField;
72114
73216
  exports.singleTarget = singleTarget;
72115
73217
  exports.plainClear = plainClear;
72116
73218
  exports.plainData = plainData;
73219
+ exports.initialValue = initialValue;
73220
+ exports.initialDeclaration = initialDeclaration;
73221
+ exports.initialAtFirstReference = initialAtFirstReference;
72117
73222
  exports.isImmutable = isImmutable;
72118
73223
  exports.isReferenceType = isReferenceType;
72119
73224
  exports.identicalTypes = identicalTypes;
@@ -72124,6 +73229,10 @@ exports.isCondition = isCondition;
72124
73229
  exports.dataSource = dataSource;
72125
73230
  exports.targetType = targetType;
72126
73231
  exports.unchangedBetween = unchangedBetween;
73232
+ exports.formalParameter = formalParameter;
73233
+ exports.passedByValue = passedByValue;
73234
+ exports.literalType = literalType;
73235
+ exports.expressionType = expressionType;
72127
73236
  exports.mergeEdits = mergeEdits;
72128
73237
  exports.deleteRegion = deleteRegion;
72129
73238
  exports.deleteStatement = deleteStatement;
@@ -72143,6 +73252,10 @@ const syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ "../core/bui
72143
73252
  const nodes_1 = __webpack_require__(/*! ../abap/nodes */ "../core/build/src/abap/nodes/index.js");
72144
73253
  const _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ "../core/build/src/abap/types/_typed_identifier.js");
72145
73254
  const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "../core/build/src/abap/types/basic/index.js");
73255
+ const class_definition_1 = __webpack_require__(/*! ../abap/types/class_definition */ "../core/build/src/abap/types/class_definition.js");
73256
+ const interface_definition_1 = __webpack_require__(/*! ../abap/types/interface_definition */ "../core/build/src/abap/types/interface_definition.js");
73257
+ const class_1 = __webpack_require__(/*! ../objects/class */ "../core/build/src/objects/class.js");
73258
+ const interface_1 = __webpack_require__(/*! ../objects/interface */ "../core/build/src/objects/interface.js");
72146
73259
  const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "../core/build/src/objects/_abap_object.js");
72147
73260
  const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "../core/build/src/edit_helper.js");
72148
73261
  const position_1 = __webpack_require__(/*! ../position */ "../core/build/src/position.js");
@@ -72415,6 +73528,23 @@ class Procedure {
72415
73528
  }
72416
73529
  return between;
72417
73530
  }
73531
+ /** the next statement executed after a direct statement of a block, skipping declarations, which have no effect
73532
+ * where they are written; undefined if there is none in the block */
73533
+ nextExecuted(statement) {
73534
+ const block = this.block(statement);
73535
+ for (let index = this.index(statement) + 1; index < this.statements.length; index++) {
73536
+ const next = this.statements[index];
73537
+ const type = next.get();
73538
+ if (this.block(next) !== block) {
73539
+ return undefined;
73540
+ }
73541
+ else if (!(this.isSimple(next) && (type instanceof Statements.Data || type instanceof Statements.Type
73542
+ || type instanceof Statements.Constant || type instanceof Statements.FieldSymbol || type instanceof _statement_1.Comment))) {
73543
+ return next;
73544
+ }
73545
+ }
73546
+ return undefined;
73547
+ }
72418
73548
  /** a comment line or end of line comment between the two positions */
72419
73549
  hasComment(start, end) {
72420
73550
  if (this.comments === undefined) {
@@ -72425,6 +73555,18 @@ class Procedure {
72425
73555
  }
72426
73556
  return this.comments.some(c => !c.isBefore(start) && c.isBefore(end));
72427
73557
  }
73558
+ /** a structure of one of the types contains the statement */
73559
+ enclosedBy(statement, types) {
73560
+ let parent = this.parents.get(statement);
73561
+ while (parent !== undefined && parent !== this.structure) {
73562
+ const type = parent.get();
73563
+ if (types.some(t => type instanceof t)) {
73564
+ return true;
73565
+ }
73566
+ parent = this.parents.get(parent);
73567
+ }
73568
+ return false;
73569
+ }
72428
73570
  /** the IF structure of an IF or ELSEIF statement */
72429
73571
  ifStructure(statement) {
72430
73572
  let parent = this.parents.get(statement);
@@ -72497,6 +73639,23 @@ class Procedure {
72497
73639
  }
72498
73640
  return variable;
72499
73641
  }
73642
+ /** memory that only this procedure can reach: a local variable, or a pass-by-value or RETURNING parameter of
73643
+ * a method or form, with all references understood and its address never taken */
73644
+ private(identifier) {
73645
+ const variable = this.variable(identifier);
73646
+ if (variable === undefined || variable.complete === false || variable.escapes()
73647
+ || variable.identifier.getMeta().includes("static" /* IdentifierMeta.Static */)) {
73648
+ return undefined;
73649
+ }
73650
+ const meta = variable.identifier.getMeta();
73651
+ if (variable.isLocal()) {
73652
+ return variable;
73653
+ }
73654
+ // function module parameters can be global parameters of the function group
73655
+ const parameter = !(this.structure.get() instanceof Structures.FunctionModule)
73656
+ && (meta.includes("pass_by_value" /* IdentifierMeta.PassByValue */) || meta.includes("returning" /* IdentifierMeta.MethodReturning */));
73657
+ return parameter ? variable : undefined;
73658
+ }
72500
73659
  /** all local variables declared in the procedure */
72501
73660
  locals() {
72502
73661
  var _a;
@@ -72588,6 +73747,17 @@ class Procedure {
72588
73747
  }
72589
73748
  return statement.findFirstExpression(Expressions.NewObject) === undefined;
72590
73749
  }
73750
+ /** the method or builtin function called at the method name token */
73751
+ methodAt(token) {
73752
+ for (const reference of this.analysis.referencesAt(this.file.getFilename(), token)) {
73753
+ if ((reference.referenceType === _reference_1.ReferenceType.MethodReference
73754
+ || reference.referenceType === _reference_1.ReferenceType.BuiltinMethodReference)
73755
+ && reference.resolved !== undefined && "getParameters" in reference.resolved) {
73756
+ return reference.resolved;
73757
+ }
73758
+ }
73759
+ return undefined;
73760
+ }
72591
73761
  /** every data write in the statement goes to a local variable, a pass-by-value parameter or the
72592
73762
  * RETURNING parameter, ie. memory that no other data object, field symbol or reference can share */
72593
73763
  writesOnlyPrivate(statement) {
@@ -72758,6 +73928,31 @@ function plainMove(statement) {
72758
73928
  }
72759
73929
  return { target, source, operator };
72760
73930
  }
73931
+ /** CREATE OBJECT target [TYPE class] [EXPORTING parameters]. without chaining, pragmas, EXCEPTIONS or dynamic parts */
73932
+ function plainCreateObject(statement) {
73933
+ if (!(statement.get() instanceof Statements.CreateObject) || statement.getColon() !== undefined
73934
+ || statement.getPragmas().length > 0) {
73935
+ return undefined;
73936
+ }
73937
+ const children = statement.getChildren();
73938
+ const target = children[2];
73939
+ if (!(target instanceof nodes_1.ExpressionNode) || !(target.get() instanceof Expressions.Target)) {
73940
+ return undefined;
73941
+ }
73942
+ let type;
73943
+ // the last child is the period
73944
+ for (let i = 3; i < children.length - 1; i += 2) {
73945
+ const word = children[i] instanceof nodes_1.TokenNode ? children[i].getFirstToken().getStr().toUpperCase() : "";
73946
+ const value = children[i + 1];
73947
+ if (word === "TYPE" && value instanceof nodes_1.ExpressionNode && value.get() instanceof Expressions.ClassName) {
73948
+ type = value;
73949
+ }
73950
+ else if (!(word === "EXPORTING" && (value === null || value === void 0 ? void 0 : value.get()) instanceof Expressions.ParameterListS)) {
73951
+ return undefined;
73952
+ }
73953
+ }
73954
+ return { target, type };
73955
+ }
72761
73956
  /** the source is a single field, ie. one token */
72762
73957
  function singleField(source) {
72763
73958
  var _a;
@@ -72792,6 +73987,49 @@ function plainData(statement) {
72792
73987
  return statement.get() instanceof Statements.Data
72793
73988
  && ((_a = statement.findDirectExpression(Expressions.DataDefinition)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Value)) === undefined;
72794
73989
  }
73990
+ /** VALUE type( ) with an explicit type and an empty body, ie. the initial value of the type */
73991
+ function initialValue(source) {
73992
+ const tokens = source.getTokens();
73993
+ return tokens.length === 4 && tokens[0].getStr().toUpperCase() === "VALUE"
73994
+ && source.findDirectExpression(Expressions.TypeNameOrInfer) !== undefined
73995
+ && tokens[1].getStr() !== "#" && tokens[2].getStr() === "(" && tokens[3].getStr() === ")";
73996
+ }
73997
+ var InitialDeclaration;
73998
+ (function (InitialDeclaration) {
73999
+ /** DATA v TYPE ... without VALUE: v is initial when the procedure starts, the statement is not executed */
74000
+ InitialDeclaration["Data"] = "data";
74001
+ /** DATA(v) = VALUE t( ).: sets v to the initial value of t every time it is executed, also in each loop iteration */
74002
+ InitialDeclaration["Value"] = "value";
74003
+ })(InitialDeclaration || (exports.InitialDeclaration = InitialDeclaration = {}));
74004
+ /** how the declaration of a local variable makes it initial, undefined if it does not */
74005
+ function initialDeclaration(variable) {
74006
+ const declaration = variable.declaration;
74007
+ if (declaration === undefined) {
74008
+ return undefined;
74009
+ }
74010
+ else if (variable.inline === false) {
74011
+ return plainData(declaration) ? InitialDeclaration.Data : undefined;
74012
+ }
74013
+ const move = plainMove(declaration);
74014
+ return move !== undefined && move.operator === "=" && move.target.getChildren().length === 1
74015
+ && move.target.findDirectExpression(Expressions.InlineData) !== undefined && initialValue(move.source)
74016
+ ? InitialDeclaration.Value : undefined;
74017
+ }
74018
+ /** the variable is initial at the statement, which is its first reference after the declaration */
74019
+ function initialAtFirstReference(procedure, variable, statement) {
74020
+ const declaration = variable.declaration;
74021
+ const kind = initialDeclaration(variable);
74022
+ // neither the declaration nor the statement in a loop: nothing can change the variable before the statement
74023
+ const noLoop = procedure.loop(declaration) === undefined && procedure.loop(statement) === undefined;
74024
+ if (kind === InitialDeclaration.Data) {
74025
+ return noLoop;
74026
+ }
74027
+ else if (kind === InitialDeclaration.Value) {
74028
+ // executed before the statement in the same iteration
74029
+ return noLoop || (procedure.dominates(declaration, statement) && procedure.sameLoop(declaration, statement));
74030
+ }
74031
+ return false;
74032
+ }
72795
74033
  /** constants of the class or program, builtin constants like abap_true, and me: never change */
72796
74034
  function isImmutable(identifier) {
72797
74035
  if (!(identifier instanceof _typed_identifier_1.TypedIdentifier)) {
@@ -72919,7 +74157,7 @@ var SourceKind;
72919
74157
  (function (SourceKind) {
72920
74158
  /** constants and me, never change */
72921
74159
  SourceKind["Immutable"] = "immutable";
72922
- /** a local variable, or a component of it, changes only by references to the variable */
74160
+ /** a local variable or a pass-by-value parameter, or a component of it, changes only by references to the variable */
72923
74161
  SourceKind["Local"] = "local";
72924
74162
  /** attributes, parameters, globals, anything reached via a reference: may change by other code */
72925
74163
  SourceKind["Volatile"] = "volatile";
@@ -72928,6 +74166,7 @@ var SourceKind;
72928
74166
  * expressions, field symbols or dereferencing with ->* */
72929
74167
  function dataSource(procedure, source) {
72930
74168
  var _a;
74169
+ var _b;
72931
74170
  if (source.getChildren().length !== 1) {
72932
74171
  return undefined;
72933
74172
  }
@@ -72983,7 +74222,7 @@ function dataSource(procedure, source) {
72983
74222
  if (type === undefined || type.isGeneric() || (type instanceof basic_1.TableType && type.isWithHeader())) {
72984
74223
  return undefined;
72985
74224
  }
72986
- const local = next === 1 ? procedure.local(first) : undefined;
74225
+ const local = next === 1 ? (_b = procedure.local(first)) !== null && _b !== void 0 ? _b : procedure.private(first) : undefined;
72987
74226
  let kind = SourceKind.Volatile;
72988
74227
  if (deref === false && isImmutable(first)) {
72989
74228
  kind = SourceKind.Immutable;
@@ -73064,7 +74303,8 @@ function unchangedBetween(procedure, source, from, to, read) {
73064
74303
  const statement = procedure.statements[index];
73065
74304
  if (index === end && read !== undefined) {
73066
74305
  if (isReceiver(statement, read)
73067
- || (statement.get() instanceof Statements.Move && procedure.isCallFree(statement))) {
74306
+ || (statement.get() instanceof Statements.Move && procedure.isCallFree(statement))
74307
+ || passedByValue(procedure, statement, read)) {
73068
74308
  continue;
73069
74309
  }
73070
74310
  }
@@ -73090,6 +74330,229 @@ function isReceiver(statement, token) {
73090
74330
  && receiver.countTokens() === 1 && receiver.getFirstToken().getStart().equals(token.getStart())
73091
74331
  && ((_b = chain === null || chain === void 0 ? void 0 : chain.getChildren()[1]) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr()) === "->";
73092
74332
  }
74333
+ /** the token is the complete actual parameter for an importing parameter: m( v ), m( p = v ),
74334
+ * CALL METHOD m EXPORTING p = v, NEW c( p = v ) or CREATE OBJECT o EXPORTING p = v */
74335
+ function formalParameter(procedure, statement, token) {
74336
+ var _a, _b, _c;
74337
+ const path = expressionPath(statement, token);
74338
+ const index = path.findIndex(e => e.get() instanceof Expressions.Source && e.countTokens() === 1);
74339
+ const source = path[index];
74340
+ if (source === undefined || source.findDirectExpression(Expressions.FieldChain) === undefined
74341
+ || !source.getFirstToken().getStart().equals(token.getStart())) {
74342
+ return undefined;
74343
+ }
74344
+ const parent = index > 0 ? path[index - 1] : undefined;
74345
+ let name;
74346
+ let call;
74347
+ if ((parent === null || parent === void 0 ? void 0 : parent.get()) instanceof Expressions.MethodCallParam) {
74348
+ call = path[index - 2];
74349
+ }
74350
+ else if ((parent === null || parent === void 0 ? void 0 : parent.get()) instanceof Expressions.NewObject) {
74351
+ call = parent;
74352
+ }
74353
+ else if ((parent === null || parent === void 0 ? void 0 : parent.get()) instanceof Expressions.ParameterS && ((_a = path[index - 2]) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.ParameterListS) {
74354
+ name = (_b = parent.findDirectExpression(Expressions.ParameterName)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr();
74355
+ const list = path[index - 3];
74356
+ const above = path[index - 4];
74357
+ if (list === undefined && statement.get() instanceof Statements.CreateObject) {
74358
+ call = statement;
74359
+ }
74360
+ else if ((list === null || list === void 0 ? void 0 : list.get()) instanceof Expressions.MethodCallParam) {
74361
+ call = above;
74362
+ }
74363
+ else if ((list === null || list === void 0 ? void 0 : list.get()) instanceof Expressions.NewObject) {
74364
+ call = list;
74365
+ }
74366
+ else if ((list === null || list === void 0 ? void 0 : list.get()) instanceof Expressions.MethodParameters && (above === null || above === void 0 ? void 0 : above.get()) instanceof Expressions.MethodCallParam) {
74367
+ call = path[index - 5];
74368
+ }
74369
+ else if ((list === null || list === void 0 ? void 0 : list.get()) instanceof Expressions.MethodParameters && (above === null || above === void 0 ? void 0 : above.get()) instanceof Expressions.MethodCallBody
74370
+ && index === 4 && statement.get() instanceof Statements.Call) {
74371
+ call = statement;
74372
+ }
74373
+ }
74374
+ if (call === undefined) {
74375
+ return undefined;
74376
+ }
74377
+ let method;
74378
+ if (call instanceof nodes_1.ExpressionNode && call.get() instanceof Expressions.MethodCall) {
74379
+ const methodName = (_c = call.findDirectExpression(Expressions.MethodName)) === null || _c === void 0 ? void 0 : _c.getFirstToken();
74380
+ method = methodName === undefined ? undefined : procedure.methodAt(methodName);
74381
+ }
74382
+ else if (call instanceof nodes_1.StatementNode && call.get() instanceof Statements.Call) {
74383
+ const methodSource = call.findDirectExpression(Expressions.MethodSource);
74384
+ method = methodSource === undefined ? undefined : procedure.methodAt(methodSource.getLastToken());
74385
+ }
74386
+ else if (!(call.get() instanceof Expressions.NewObject) && !(call.get() instanceof Statements.CreateObject)) {
74387
+ return undefined;
74388
+ }
74389
+ const parameters = method === null || method === void 0 ? void 0 : method.getParameters();
74390
+ const formal = name !== null && name !== void 0 ? name : parameters === null || parameters === void 0 ? void 0 : parameters.getDefaultImporting();
74391
+ const parameter = formal === undefined ? undefined
74392
+ : parameters === null || parameters === void 0 ? void 0 : parameters.getImporting().find(p => p.getName().toUpperCase() === formal.toUpperCase());
74393
+ return { call, method, parameter };
74394
+ }
74395
+ /** the token is the complete actual parameter for a pass-by-value importing parameter of the only call in the
74396
+ * statement, so the method gets a copy of the value when it is called, and nothing else runs before */
74397
+ function passedByValue(procedure, statement, token) {
74398
+ var _a, _b;
74399
+ if (!(statement.get() instanceof Statements.Call) && plainMove(statement) === undefined) {
74400
+ return false;
74401
+ }
74402
+ const formal = formalParameter(procedure, statement, token);
74403
+ if ((formal === null || formal === void 0 ? void 0 : formal.method) === undefined || ((_a = formal.parameter) === null || _a === void 0 ? void 0 : _a.getMeta().includes("pass_by_value" /* IdentifierMeta.PassByValue */)) !== true
74404
+ || statement.findFirstExpression(Expressions.NewObject) !== undefined) {
74405
+ return false;
74406
+ }
74407
+ for (const call of statement.findAllExpressionsRecursive(Expressions.MethodCall)) {
74408
+ const name = (_b = call.findDirectExpression(Expressions.MethodName)) === null || _b === void 0 ? void 0 : _b.getFirstToken();
74409
+ const builtin = name === undefined ? false : procedure.analysis.referencesAt(procedure.file.getFilename(), name)
74410
+ .some(r => r.referenceType === _reference_1.ReferenceType.BuiltinMethodReference);
74411
+ if (call !== formal.call && builtin === false) {
74412
+ return false;
74413
+ }
74414
+ }
74415
+ return true;
74416
+ }
74417
+ /** builtin functions whose result type follows the type of the argument */
74418
+ exports.NUMERIC_FUNCTIONS = new Set(["abs", "sign", "ceil", "floor", "trunc", "frac", "ipow", "nmax", "nmin",
74419
+ "round", "rescale"]);
74420
+ /** type of a literal: 'abc' is c LENGTH 3, `abc` is string, 12 is i */
74421
+ function literalType(constant) {
74422
+ var _a;
74423
+ var _b;
74424
+ if (constant.countTokens() !== 1) {
74425
+ return undefined;
74426
+ }
74427
+ const text = constant.getFirstToken().getStr();
74428
+ if (constant.findDirectExpression(Expressions.Integer) !== undefined) {
74429
+ const value = Number(text);
74430
+ return Number.isInteger(value) && Math.abs(value) <= 2147483647 ? basic_1.IntegerType.get() : undefined;
74431
+ }
74432
+ else if (text.startsWith("'") && text.endsWith("'") && text.length >= 2) {
74433
+ return new basic_1.CharacterType(Math.max(1, text.length - 2 - ((_b = (_a = text.match(/''/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0)));
74434
+ }
74435
+ else if (text.startsWith("`") && text.endsWith("`")) {
74436
+ return basic_1.StringType.get();
74437
+ }
74438
+ return undefined;
74439
+ }
74440
+ /** Static type of an expression whose type does not depend on where it is used: literals, string templates,
74441
+ * concatenations, xsdbool( ), boolc( ), data objects, method calls and attributes after method calls.
74442
+ * Undefined if not known, e.g. for constructor expressions, arithmetic or builtin functions typed by their argument */
74443
+ function expressionType(procedure, source) {
74444
+ var _a, _b, _c;
74445
+ const children = source.getChildren();
74446
+ const first = children[0];
74447
+ const keyword = first instanceof nodes_1.TokenNode ? first.getFirstToken().getStr().toUpperCase() : "";
74448
+ if (children.length === 4 && keyword === "XSDBOOL" && source.findDirectExpression(Expressions.Cond) !== undefined) {
74449
+ return new basic_1.CharacterType(1);
74450
+ }
74451
+ else if (children.length === 4 && keyword === "BOOLC" && source.findDirectExpression(Expressions.Cond) !== undefined) {
74452
+ return basic_1.StringType.get();
74453
+ }
74454
+ else if (children.length === 3 && children[1] instanceof nodes_1.TokenNode && children[1].getFirstToken().getStr() === "&&") {
74455
+ return basic_1.StringType.get();
74456
+ }
74457
+ else if (!(first instanceof nodes_1.ExpressionNode)) {
74458
+ return undefined;
74459
+ }
74460
+ if (children.length === 1 && first.get() instanceof Expressions.Constant) {
74461
+ return literalType(first);
74462
+ }
74463
+ else if (children.length === 1 && first.get() instanceof Expressions.StringTemplate) {
74464
+ return basic_1.StringType.get();
74465
+ }
74466
+ else if (children.length === 1 && first.get() instanceof Expressions.FieldChain) {
74467
+ return (_a = dataSource(procedure, source)) === null || _a === void 0 ? void 0 : _a.type;
74468
+ }
74469
+ else if (!(first.get() instanceof Expressions.MethodCallChain)) {
74470
+ return undefined;
74471
+ }
74472
+ // the last call of the chain, optionally followed by ->attribute
74473
+ let type;
74474
+ const last = first.getChildren()[first.getChildren().length - 1];
74475
+ if (last instanceof nodes_1.ExpressionNode && last.get() instanceof Expressions.MethodCall) {
74476
+ const name = (_b = last.findDirectExpression(Expressions.MethodName)) === null || _b === void 0 ? void 0 : _b.getFirstToken();
74477
+ const method = name === undefined ? undefined : procedure.methodAt(name);
74478
+ if (name === undefined || method === undefined || exports.NUMERIC_FUNCTIONS.has(name.getStr().toLowerCase())) {
74479
+ return undefined;
74480
+ }
74481
+ type = (_c = method.getParameters().getReturning()) === null || _c === void 0 ? void 0 : _c.getType();
74482
+ }
74483
+ else {
74484
+ return undefined;
74485
+ }
74486
+ if (children.length === 1) {
74487
+ return type;
74488
+ }
74489
+ const attribute = children[2];
74490
+ if (children.length === 3 && children[1].get() instanceof Expressions.Arrow && attribute instanceof nodes_1.ExpressionNode
74491
+ && attribute.get() instanceof Expressions.AttributeChain && attribute.getChildren().length === 1) {
74492
+ const identifier = procedure.identifierAt(attribute.getFirstToken());
74493
+ return identifier instanceof _typed_identifier_1.TypedIdentifier ? identifier.getType() : undefined;
74494
+ }
74495
+ return undefined;
74496
+ }
74497
+ ////////////////////////////////////////
74498
+ // classes and interfaces
74499
+ /** classes and interfaces by name: local ones in the scope of the procedure, global ones in the registry */
74500
+ class Hierarchy {
74501
+ constructor(reg, procedure) {
74502
+ this.reg = reg;
74503
+ this.procedure = procedure;
74504
+ }
74505
+ find(name) {
74506
+ var _a;
74507
+ const scope = this.procedure.analysis.spaghetti.lookupPosition(this.procedure.getStart(), this.procedure.file.getFilename());
74508
+ const local = (_a = scope === null || scope === void 0 ? void 0 : scope.findClassDefinition(name)) !== null && _a !== void 0 ? _a : scope === null || scope === void 0 ? void 0 : scope.findInterfaceDefinition(name);
74509
+ if (local !== undefined) {
74510
+ return local;
74511
+ }
74512
+ const clas = this.reg.getObject("CLAS", name);
74513
+ if (clas instanceof class_1.Class) {
74514
+ return clas.getDefinition();
74515
+ }
74516
+ const intf = this.reg.getObject("INTF", name);
74517
+ return intf instanceof interface_1.Interface ? intf.getDefinition() : undefined;
74518
+ }
74519
+ /** the class or interface definition of an object reference type, undefined if it is not known */
74520
+ definition(type) {
74521
+ if (!(type instanceof basic_1.ObjectReferenceType)) {
74522
+ return undefined;
74523
+ }
74524
+ const identifier = type.getIdentifier();
74525
+ const found = identifier instanceof class_definition_1.ClassDefinition || identifier instanceof interface_definition_1.InterfaceDefinition
74526
+ ? identifier : this.find(identifier.getName());
74527
+ return found instanceof class_definition_1.ClassDefinition || found instanceof interface_definition_1.InterfaceDefinition ? found : undefined;
74528
+ }
74529
+ /** sub is sup, or inherits from it or implements it; false if a definition on the way is not known */
74530
+ isSubtype(sub, sup) {
74531
+ const target = sup.toUpperCase();
74532
+ const visited = new Set();
74533
+ const stack = [sub.toUpperCase()];
74534
+ while (stack.length > 0) {
74535
+ const name = stack.pop();
74536
+ if (name === target) {
74537
+ return true;
74538
+ }
74539
+ else if (visited.has(name)) {
74540
+ continue;
74541
+ }
74542
+ visited.add(name);
74543
+ const definition = this.find(name);
74544
+ const superClass = definition === null || definition === void 0 ? void 0 : definition.getSuperClass();
74545
+ if (superClass !== undefined) {
74546
+ stack.push(superClass.toUpperCase());
74547
+ }
74548
+ for (const implementing of (definition === null || definition === void 0 ? void 0 : definition.getImplementing()) || []) {
74549
+ stack.push(implementing.name.toUpperCase());
74550
+ }
74551
+ }
74552
+ return false;
74553
+ }
74554
+ }
74555
+ exports.Hierarchy = Hierarchy;
73093
74556
  ////////////////////////////////////////
73094
74557
  // edits
73095
74558
  const rowCache = new WeakMap();
@@ -75396,6 +76859,161 @@ exports.AvoidUse = AvoidUse;
75396
76859
 
75397
76860
  /***/ },
75398
76861
 
76862
+ /***/ "../core/build/src/rules/bdef_check_syntax.js"
76863
+ /*!****************************************************!*\
76864
+ !*** ../core/build/src/rules/bdef_check_syntax.js ***!
76865
+ \****************************************************/
76866
+ (__unused_webpack_module, exports, __webpack_require__) {
76867
+
76868
+ "use strict";
76869
+
76870
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
76871
+ exports.BDEFCheckSyntax = exports.BDEFCheckSyntaxConf = void 0;
76872
+ const expressions_1 = __webpack_require__(/*! ../bdef/expressions */ "../core/build/src/bdef/expressions/index.js");
76873
+ const ddic_1 = __webpack_require__(/*! ../ddic */ "../core/build/src/ddic.js");
76874
+ const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
76875
+ const objects_1 = __webpack_require__(/*! ../objects */ "../core/build/src/objects/index.js");
76876
+ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
76877
+ const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
76878
+ class BDEFCheckSyntaxConf extends _basic_rule_config_1.BasicRuleConfig {
76879
+ }
76880
+ exports.BDEFCheckSyntaxConf = BDEFCheckSyntaxConf;
76881
+ class BDEFCheckSyntax {
76882
+ constructor() {
76883
+ this.conf = new BDEFCheckSyntaxConf();
76884
+ }
76885
+ getMetadata() {
76886
+ return {
76887
+ key: "bdef_check_syntax",
76888
+ title: "BDEF Check Syntax",
76889
+ shortDescription: "Checks behavior definition references to entities and implementation classes",
76890
+ extendedInformation: `Performs semantic checks which require other objects to be available.
76891
+
76892
+ Missing objects are only reported when their names match the configured errorNamespace.`,
76893
+ tags: [_irule_1.RuleTag.Syntax],
76894
+ };
76895
+ }
76896
+ getConfig() {
76897
+ return this.conf;
76898
+ }
76899
+ setConfig(conf) {
76900
+ this.conf = conf;
76901
+ }
76902
+ initialize(reg) {
76903
+ this.reg = reg;
76904
+ return this;
76905
+ }
76906
+ run(object) {
76907
+ if (!(object instanceof objects_1.BehaviorDefinition)) {
76908
+ return [];
76909
+ }
76910
+ const tree = object.getTree();
76911
+ const file = object.findSourceFile();
76912
+ if (tree === undefined || file === undefined) {
76913
+ return [];
76914
+ }
76915
+ const issues = [];
76916
+ this.checkImplementationClasses(tree, issues, file);
76917
+ this.checkEntities(tree, issues, file);
76918
+ return issues;
76919
+ }
76920
+ checkImplementationClasses(tree, issues, file) {
76921
+ for (const implementation of tree.findAllExpressions(expressions_1.BDEFImplementationIn)) {
76922
+ const nameNode = implementation.findDirectExpression(expressions_1.BDEFName);
76923
+ if (nameNode === undefined) {
76924
+ continue;
76925
+ }
76926
+ const name = this.name(nameNode);
76927
+ if (this.reg.getObject("CLAS", name) === undefined && this.reg.inErrorNamespace(name)) {
76928
+ issues.push(issue_1.Issue.atToken(file, nameNode.getFirstToken(), `Implementation class "${name}" not found`, this.getMetadata().key, this.conf.severity));
76929
+ }
76930
+ }
76931
+ }
76932
+ checkEntities(tree, issues, file) {
76933
+ const ddic = new ddic_1.DDIC(this.reg);
76934
+ for (const define of tree.findDirectExpressions(expressions_1.BDEFDefineBehavior)) {
76935
+ if (define.getFirstToken().getStr().toUpperCase() !== "DEFINE") {
76936
+ // "extend behavior for" refers to entities of the extended BDEF
76937
+ continue;
76938
+ }
76939
+ const nameNode = define.findDirectExpression(expressions_1.BDEFName);
76940
+ if (nameNode === undefined) {
76941
+ continue;
76942
+ }
76943
+ const name = this.name(nameNode);
76944
+ if (this.reg.inErrorNamespace(name)
76945
+ && this.reg.getObject("DDLS", name) === undefined
76946
+ && ddic.lookupDDLS(name) === undefined) {
76947
+ issues.push(issue_1.Issue.atToken(file, nameNode.getFirstToken(), `Entity "${name}" not found`, this.getMetadata().key, this.conf.severity));
76948
+ }
76949
+ }
76950
+ }
76951
+ name(node) {
76952
+ return node.concatTokens().replace(/ /g, "");
76953
+ }
76954
+ }
76955
+ exports.BDEFCheckSyntax = BDEFCheckSyntax;
76956
+ //# sourceMappingURL=bdef_check_syntax.js.map
76957
+
76958
+ /***/ },
76959
+
76960
+ /***/ "../core/build/src/rules/bdef_parser_error.js"
76961
+ /*!****************************************************!*\
76962
+ !*** ../core/build/src/rules/bdef_parser_error.js ***!
76963
+ \****************************************************/
76964
+ (__unused_webpack_module, exports, __webpack_require__) {
76965
+
76966
+ "use strict";
76967
+
76968
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
76969
+ exports.BDEFParserError = exports.BDEFParserErrorConf = void 0;
76970
+ const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
76971
+ const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
76972
+ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
76973
+ const objects_1 = __webpack_require__(/*! ../objects */ "../core/build/src/objects/index.js");
76974
+ class BDEFParserErrorConf extends _basic_rule_config_1.BasicRuleConfig {
76975
+ }
76976
+ exports.BDEFParserErrorConf = BDEFParserErrorConf;
76977
+ class BDEFParserError {
76978
+ constructor() {
76979
+ this.conf = new BDEFParserErrorConf();
76980
+ }
76981
+ getMetadata() {
76982
+ return {
76983
+ key: "bdef_parser_error",
76984
+ title: "BDEF Parser Error",
76985
+ shortDescription: `BDEF parsing`,
76986
+ extendedInformation: `Parses behavior definitions and issues parser errors`,
76987
+ tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.SingleFile],
76988
+ };
76989
+ }
76990
+ getConfig() {
76991
+ return this.conf;
76992
+ }
76993
+ setConfig(conf) {
76994
+ this.conf = conf;
76995
+ }
76996
+ initialize(_reg) {
76997
+ return this;
76998
+ }
76999
+ run(object) {
77000
+ const issues = [];
77001
+ if (object instanceof objects_1.BehaviorDefinition) {
77002
+ const file = object.findSourceFile();
77003
+ if (object.hasParserError() === true && file) {
77004
+ const empty = file.getRaw().length === 0 ? ", empty file" : "";
77005
+ const message = "BDEF Parser error" + empty;
77006
+ issues.push(issue_1.Issue.atRow(file, 1, message, this.getMetadata().key, this.getConfig().severity));
77007
+ }
77008
+ }
77009
+ return issues;
77010
+ }
77011
+ }
77012
+ exports.BDEFParserError = BDEFParserError;
77013
+ //# sourceMappingURL=bdef_parser_error.js.map
77014
+
77015
+ /***/ },
77016
+
75399
77017
  /***/ "../core/build/src/rules/begin_end_names.js"
75400
77018
  /*!**************************************************!*\
75401
77019
  !*** ../core/build/src/rules/begin_end_names.js ***!
@@ -75845,14 +77463,7 @@ ENDIF.`,
75845
77463
  return false;
75846
77464
  }
75847
77465
  const constant = (0, _procedure_analysis_1.characterConstant)(procedure, move.source);
75848
- return (constant !== undefined && (0, _procedure_analysis_1.sameCharacters)(constant, "")) || this.initialValue(move.source);
75849
- }
75850
- /** VALUE type( ) */
75851
- initialValue(source) {
75852
- const tokens = source.getTokens();
75853
- return tokens.length === 4 && tokens[0].getStr().toUpperCase() === "VALUE"
75854
- && source.findDirectExpression(Expressions.TypeNameOrInfer) !== undefined
75855
- && tokens[1].getStr() !== "#" && tokens[2].getStr() === "(" && tokens[3].getStr() === ")";
77466
+ return (constant !== undefined && (0, _procedure_analysis_1.sameCharacters)(constant, "")) || (0, _procedure_analysis_1.initialValue)(move.source);
75856
77467
  }
75857
77468
  }
75858
77469
  exports.BooleanFlagViaIf = BooleanFlagViaIf;
@@ -76237,6 +77848,205 @@ exports.CallTransactionAuthorityCheck = CallTransactionAuthorityCheck;
76237
77848
 
76238
77849
  /***/ },
76239
77850
 
77851
+ /***/ "../core/build/src/rules/cast_via_generic_reference.js"
77852
+ /*!*************************************************************!*\
77853
+ !*** ../core/build/src/rules/cast_via_generic_reference.js ***!
77854
+ \*************************************************************/
77855
+ (__unused_webpack_module, exports, __webpack_require__) {
77856
+
77857
+ "use strict";
77858
+
77859
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
77860
+ if (k2 === undefined) k2 = k;
77861
+ var desc = Object.getOwnPropertyDescriptor(m, k);
77862
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
77863
+ desc = { enumerable: true, get: function() { return m[k]; } };
77864
+ }
77865
+ Object.defineProperty(o, k2, desc);
77866
+ }) : (function(o, m, k, k2) {
77867
+ if (k2 === undefined) k2 = k;
77868
+ o[k2] = m[k];
77869
+ }));
77870
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
77871
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
77872
+ }) : function(o, v) {
77873
+ o["default"] = v;
77874
+ });
77875
+ var __importStar = (this && this.__importStar) || (function () {
77876
+ var ownKeys = function(o) {
77877
+ ownKeys = Object.getOwnPropertyNames || function (o) {
77878
+ var ar = [];
77879
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
77880
+ return ar;
77881
+ };
77882
+ return ownKeys(o);
77883
+ };
77884
+ return function (mod) {
77885
+ if (mod && mod.__esModule) return mod;
77886
+ var result = {};
77887
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
77888
+ __setModuleDefault(result, mod);
77889
+ return result;
77890
+ };
77891
+ })();
77892
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
77893
+ exports.CastViaGenericReference = exports.CastViaGenericReferenceConf = void 0;
77894
+ const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
77895
+ const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "../core/build/src/abap/types/basic/index.js");
77896
+ const interface_definition_1 = __webpack_require__(/*! ../abap/types/interface_definition */ "../core/build/src/abap/types/interface_definition.js");
77897
+ const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "../core/build/src/edit_helper.js");
77898
+ const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
77899
+ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
77900
+ const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
77901
+ const _procedure_analysis_1 = __webpack_require__(/*! ./_procedure_analysis */ "../core/build/src/rules/_procedure_analysis.js");
77902
+ class CastViaGenericReferenceConf extends _basic_rule_config_1.BasicRuleConfig {
77903
+ }
77904
+ exports.CastViaGenericReferenceConf = CastViaGenericReferenceConf;
77905
+ class CastViaGenericReference {
77906
+ constructor() {
77907
+ this.conf = new CastViaGenericReferenceConf();
77908
+ }
77909
+ getMetadata() {
77910
+ return {
77911
+ key: "cast_via_generic_reference",
77912
+ title: "Cast via generic reference",
77913
+ shortDescription: `Finds a down cast from a local reference variable that only holds a copy of another reference`,
77914
+ extendedInformation: `Reports DATA o TYPE REF TO object. o = r. ... x ?= o. when all of the following hold:
77915
+
77916
+ * o is a local variable of a METHOD, FORM or FUNCTION, declared with DATA without VALUE and not chained,
77917
+ typed REF TO object, or REF TO a class or interface that is the static type of r or a supertype of it
77918
+ * o has exactly one write, o = r., exactly one read, the complete source of x ?= o., and its address is never
77919
+ taken. x is not an inline declaration
77920
+ * r is a plain object reference: a variable, or a chain of attributes and components without calls,
77921
+ offsets, table expressions, field symbols or ->*
77922
+ * r keeps its value from o = r. until the read, as in unnecessary_copy: for a local r, no write to it and its
77923
+ address is never taken; for other r, in addition no method, function or form call and no write except to
77924
+ local variables, by value parameters and RETURNING in between
77925
+ * o = r. is executed before x ?= o. on every path: the read is in the same block or a nested block, and both
77926
+ are in the same loop
77927
+ * x ?= r. is valid: x or r is typed REF TO object or an interface, or the class of x and the class of r
77928
+ are in the same inheritance line
77929
+
77930
+ The object is the same, so the cast succeeds or raises cx_sy_move_cast_error the same way.
77931
+ try_cast_empty_catch can then replace a TRY around the cast.
77932
+ Objects with syntax errors, macros or unknown statements are skipped, as are procedures with dynamic code,
77933
+ INCLUDE, test seams, enhancements or native SQL.
77934
+
77935
+ The quick fix deletes the declaration and o = r., and casts r directly. No release requirement.`,
77936
+ tags: [_irule_1.RuleTag.Quickfix],
77937
+ badExample: `DATA lo_object TYPE REF TO object.
77938
+ lo_object = io_node.
77939
+ TRY.
77940
+ lo_leaf ?= lo_object.
77941
+ CATCH cx_sy_move_cast_error.
77942
+ ENDTRY.`,
77943
+ goodExample: `TRY.
77944
+ lo_leaf ?= io_node.
77945
+ CATCH cx_sy_move_cast_error.
77946
+ ENDTRY.`,
77947
+ };
77948
+ }
77949
+ getConfig() {
77950
+ return this.conf;
77951
+ }
77952
+ setConfig(conf) {
77953
+ this.conf = conf;
77954
+ }
77955
+ initialize(reg) {
77956
+ this.reg = reg;
77957
+ return this;
77958
+ }
77959
+ run(obj) {
77960
+ var _a, _b;
77961
+ const analysis = _procedure_analysis_1.ObjectAnalysis.run(this.reg, obj);
77962
+ if (analysis === undefined) {
77963
+ return [];
77964
+ }
77965
+ const issues = [];
77966
+ for (const procedure of analysis.procedures) {
77967
+ if (procedure.supported === false) {
77968
+ continue;
77969
+ }
77970
+ const hierarchy = new _procedure_analysis_1.Hierarchy(this.reg, procedure);
77971
+ for (const variable of procedure.locals()) {
77972
+ const declaration = variable.declaration;
77973
+ const type = variable.identifier.getType();
77974
+ const writes = variable.writes();
77975
+ const reads = variable.reads();
77976
+ if (variable.inline || !(0, _procedure_analysis_1.plainData)(declaration) || declaration.getColon() !== undefined || variable.escapes()
77977
+ || !this.isObjectReference(type) || writes.length !== 1 || reads.length !== 1) {
77978
+ continue;
77979
+ }
77980
+ const write = writes[0];
77981
+ const read = reads[0];
77982
+ const assign = (0, _procedure_analysis_1.plainMove)(write.statement);
77983
+ const cast = (0, _procedure_analysis_1.plainMove)(read.statement);
77984
+ if (assign === undefined || cast === undefined || assign.operator !== "=" || cast.operator !== "?="
77985
+ || ((_a = (0, _procedure_analysis_1.singleTarget)(assign.target)) === null || _a === void 0 ? void 0 : _a.getStart().equals(write.token.getStart())) !== true
77986
+ || ((_b = (0, _procedure_analysis_1.singleField)(cast.source)) === null || _b === void 0 ? void 0 : _b.getStart().equals(read.token.getStart())) !== true
77987
+ || cast.target.findFirstExpression(Expressions.InlineData) !== undefined
77988
+ || !procedure.dominates(write.statement, read.statement)
77989
+ || !procedure.sameLoop(write.statement, read.statement)) {
77990
+ continue;
77991
+ }
77992
+ const source = (0, _procedure_analysis_1.dataSource)(procedure, assign.source);
77993
+ const target = (0, _procedure_analysis_1.targetType)(procedure, cast.target);
77994
+ if (source === undefined || source.base === variable || target === undefined
77995
+ || !this.isObjectReference(source.type)
77996
+ || !this.isSupertype(hierarchy, type, source.type)
77997
+ || !this.castable(hierarchy, source.type, target)
77998
+ || !(0, _procedure_analysis_1.unchangedBetween)(procedure, source, write.statement, read.statement, read.token)) {
77999
+ continue;
78000
+ }
78001
+ const fix = (0, _procedure_analysis_1.mergeEdits)(procedure.file, [
78002
+ (0, _procedure_analysis_1.deleteStatement)(procedure.file, declaration),
78003
+ (0, _procedure_analysis_1.deleteStatement)(procedure.file, write.statement),
78004
+ edit_helper_1.EditHelper.replaceToken(procedure.file, read.token, source.text)
78005
+ ]);
78006
+ const message = "Cast " + source.text + " directly instead of via " + variable.identifier.getName();
78007
+ issues.push(issue_1.Issue.atStatement(procedure.file, read.statement, message, this.getMetadata().key, this.conf.severity, fix));
78008
+ }
78009
+ }
78010
+ return issues;
78011
+ }
78012
+ isObjectReference(type) {
78013
+ return type instanceof basic_1.GenericObjectReferenceType || type instanceof basic_1.ObjectReferenceType;
78014
+ }
78015
+ /** every reference of type sub can be assigned to type sup without a cast */
78016
+ isSupertype(hierarchy, sup, sub) {
78017
+ if (sup instanceof basic_1.GenericObjectReferenceType) {
78018
+ return true;
78019
+ }
78020
+ else if (!(sup instanceof basic_1.ObjectReferenceType) || !(sub instanceof basic_1.ObjectReferenceType)) {
78021
+ return false;
78022
+ }
78023
+ return hierarchy.isSubtype(sub.getIdentifierName(), sup.getIdentifierName());
78024
+ }
78025
+ /** target ?= source. is statically valid */
78026
+ castable(hierarchy, source, target) {
78027
+ if (source instanceof basic_1.GenericObjectReferenceType || target instanceof basic_1.GenericObjectReferenceType) {
78028
+ return true;
78029
+ }
78030
+ else if (!(source instanceof basic_1.ObjectReferenceType) || !(target instanceof basic_1.ObjectReferenceType)) {
78031
+ return false;
78032
+ }
78033
+ const sourceDefinition = hierarchy.definition(source);
78034
+ const targetDefinition = hierarchy.definition(target);
78035
+ if (sourceDefinition === undefined || targetDefinition === undefined) {
78036
+ return false;
78037
+ }
78038
+ else if (sourceDefinition instanceof interface_definition_1.InterfaceDefinition || targetDefinition instanceof interface_definition_1.InterfaceDefinition) {
78039
+ return true;
78040
+ }
78041
+ return hierarchy.isSubtype(source.getIdentifierName(), target.getIdentifierName())
78042
+ || hierarchy.isSubtype(target.getIdentifierName(), source.getIdentifierName());
78043
+ }
78044
+ }
78045
+ exports.CastViaGenericReference = CastViaGenericReference;
78046
+ //# sourceMappingURL=cast_via_generic_reference.js.map
78047
+
78048
+ /***/ },
78049
+
76240
78050
  /***/ "../core/build/src/rules/catch_and_raise.js"
76241
78051
  /*!**************************************************!*\
76242
78052
  !*** ../core/build/src/rules/catch_and_raise.js ***!
@@ -79158,10 +80968,13 @@ class ClearAfterDeclaration {
79158
80968
  shortDescription: `Finds CLEAR of a local variable that is still initial since its declaration`,
79159
80969
  extendedInformation: `Reports CLEAR x. when all of the following hold:
79160
80970
 
79161
- * x is a local variable of a METHOD, FORM or FUNCTION, declared with DATA x TYPE/LIKE ... without VALUE
80971
+ * x is a local variable of a METHOD, FORM or FUNCTION, declared with DATA x TYPE/LIKE ... without VALUE,
80972
+ or with DATA(x) = VALUE t( ). with an explicit type and nothing in the parentheses
79162
80973
  * the CLEAR is the first reference to x after the declaration, it has no WITH addition
79163
- * neither the DATA nor the CLEAR is inside a LOOP, DO, WHILE, SELECT loop, PROVIDE, or a TRY block with
79164
- RETRY, RESUME or CATCH BEFORE UNWIND. DATA is not executed per iteration, so a CLEAR in a loop can be needed
80974
+ * neither the declaration nor the CLEAR is inside a LOOP, DO, WHILE, SELECT loop, PROVIDE, or a TRY block with
80975
+ RETRY, RESUME or CATCH BEFORE UNWIND. DATA is not executed per iteration, so a CLEAR in a loop can be needed.
80976
+ DATA(x) = VALUE t( ). is executed per iteration, it may also be in the same loop as the CLEAR, if the CLEAR is
80977
+ in the block of the declaration or a nested block
79165
80978
 
79166
80979
  Any later use of x does not matter, the CLEAR can only be reached with x still initial.
79167
80980
  Objects with syntax errors, macros or unknown statements are skipped, as are procedures with dynamic code,
@@ -79196,24 +81009,211 @@ CLEAR lv_count.`,
79196
81009
  continue;
79197
81010
  }
79198
81011
  for (const variable of procedure.locals()) {
79199
- const declaration = variable.declaration;
79200
- const first = variable.occurrences[0];
79201
- if (variable.inline || !(0, _procedure_analysis_1.plainData)(declaration) || first === undefined
79202
- || first.kind !== _procedure_analysis_1.OccurrenceKind.Write
79203
- || ((_a = (0, _procedure_analysis_1.plainClear)(first.statement)) === null || _a === void 0 ? void 0 : _a.getStart().equals(first.token.getStart())) !== true
79204
- || procedure.loop(declaration) !== undefined
79205
- || procedure.loop(first.statement) !== undefined) {
81012
+ const first = variable.occurrences[0];
81013
+ if (first === undefined
81014
+ || first.kind !== _procedure_analysis_1.OccurrenceKind.Write
81015
+ || ((_a = (0, _procedure_analysis_1.plainClear)(first.statement)) === null || _a === void 0 ? void 0 : _a.getStart().equals(first.token.getStart())) !== true
81016
+ || !(0, _procedure_analysis_1.initialAtFirstReference)(procedure, variable, first.statement)) {
81017
+ continue;
81018
+ }
81019
+ const fix = (0, _procedure_analysis_1.deleteStatement)(procedure.file, first.statement);
81020
+ issues.push(issue_1.Issue.atStatement(procedure.file, first.statement, "CLEAR of " + variable.identifier.getName() + ", which is still initial", this.getMetadata().key, this.conf.severity, fix));
81021
+ }
81022
+ }
81023
+ return issues;
81024
+ }
81025
+ }
81026
+ exports.ClearAfterDeclaration = ClearAfterDeclaration;
81027
+ //# sourceMappingURL=clear_after_declaration.js.map
81028
+
81029
+ /***/ },
81030
+
81031
+ /***/ "../core/build/src/rules/clear_before_overwrite.js"
81032
+ /*!*********************************************************!*\
81033
+ !*** ../core/build/src/rules/clear_before_overwrite.js ***!
81034
+ \*********************************************************/
81035
+ (__unused_webpack_module, exports, __webpack_require__) {
81036
+
81037
+ "use strict";
81038
+
81039
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
81040
+ if (k2 === undefined) k2 = k;
81041
+ var desc = Object.getOwnPropertyDescriptor(m, k);
81042
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
81043
+ desc = { enumerable: true, get: function() { return m[k]; } };
81044
+ }
81045
+ Object.defineProperty(o, k2, desc);
81046
+ }) : (function(o, m, k, k2) {
81047
+ if (k2 === undefined) k2 = k;
81048
+ o[k2] = m[k];
81049
+ }));
81050
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
81051
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
81052
+ }) : function(o, v) {
81053
+ o["default"] = v;
81054
+ });
81055
+ var __importStar = (this && this.__importStar) || (function () {
81056
+ var ownKeys = function(o) {
81057
+ ownKeys = Object.getOwnPropertyNames || function (o) {
81058
+ var ar = [];
81059
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
81060
+ return ar;
81061
+ };
81062
+ return ownKeys(o);
81063
+ };
81064
+ return function (mod) {
81065
+ if (mod && mod.__esModule) return mod;
81066
+ var result = {};
81067
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
81068
+ __setModuleDefault(result, mod);
81069
+ return result;
81070
+ };
81071
+ })();
81072
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
81073
+ exports.ClearBeforeOverwrite = exports.ClearBeforeOverwriteConf = void 0;
81074
+ const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
81075
+ const Structures = __importStar(__webpack_require__(/*! ../abap/3_structures/structures */ "../core/build/src/abap/3_structures/structures/index.js"));
81076
+ const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "../core/build/src/abap/types/basic/index.js");
81077
+ const _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ "../core/build/src/abap/types/_typed_identifier.js");
81078
+ const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
81079
+ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
81080
+ const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
81081
+ const _procedure_analysis_1 = __webpack_require__(/*! ./_procedure_analysis */ "../core/build/src/rules/_procedure_analysis.js");
81082
+ class ClearBeforeOverwriteConf extends _basic_rule_config_1.BasicRuleConfig {
81083
+ }
81084
+ exports.ClearBeforeOverwriteConf = ClearBeforeOverwriteConf;
81085
+ class ClearBeforeOverwrite {
81086
+ constructor() {
81087
+ this.conf = new ClearBeforeOverwriteConf();
81088
+ }
81089
+ getMetadata() {
81090
+ return {
81091
+ key: "clear_before_overwrite",
81092
+ title: "CLEAR before overwrite",
81093
+ shortDescription: `Finds CLEAR of a local variable whose next use overwrites it completely`,
81094
+ extendedInformation: `Reports CLEAR v. when all of the following hold:
81095
+
81096
+ * v is a local variable of a METHOD, FORM or FUNCTION, its address is never taken: no field symbol,
81097
+ REF #( ), GET REFERENCE, and it is not passed to a parameter by reference
81098
+ * the CLEAR is not chained and has no WITH addition
81099
+ * the next reference to v is a full overwrite in the same block: v = <expression>., including v = NEW ...,
81100
+ or CREATE OBJECT v. with optional TYPE and EXPORTING, where nothing else in the statement references v.
81101
+ Not ?=, READ TABLE INTO, offset/length or component writes, CREATE OBJECT with EXCEPTIONS, or other
81102
+ statements that can leave v unchanged
81103
+ * every statement between the CLEAR and the overwrite is a direct statement of the block, not a nested structure,
81104
+ and does not reference v
81105
+ * v is not a table with header line
81106
+ * if a TRY or CATCH SYSTEM-EXCEPTIONS encloses the CLEAR, nothing from the CLEAR to the overwrite can raise
81107
+ an exception, a CATCH could see the old value: the overwrite directly follows the CLEAR and assigns a variable
81108
+ or a literal of identical type, or a reference variable
81109
+
81110
+ Unlike clear_after_declaration, the CLEAR can be in a loop.
81111
+ Objects with syntax errors, macros or unknown statements are skipped, as are procedures with dynamic code,
81112
+ INCLUDE, test seams, enhancements or native SQL.
81113
+
81114
+ The quick fix deletes the CLEAR. No release requirement.`,
81115
+ tags: [_irule_1.RuleTag.Quickfix],
81116
+ badExample: `CLEAR lv_name.
81117
+ lv_name = iv_name.`,
81118
+ goodExample: `lv_name = iv_name.`,
81119
+ };
81120
+ }
81121
+ getConfig() {
81122
+ return this.conf;
81123
+ }
81124
+ setConfig(conf) {
81125
+ this.conf = conf;
81126
+ }
81127
+ initialize(reg) {
81128
+ this.reg = reg;
81129
+ return this;
81130
+ }
81131
+ run(obj) {
81132
+ var _a;
81133
+ const analysis = _procedure_analysis_1.ObjectAnalysis.run(this.reg, obj);
81134
+ if (analysis === undefined) {
81135
+ return [];
81136
+ }
81137
+ const issues = [];
81138
+ for (const procedure of analysis.procedures) {
81139
+ if (procedure.supported === false) {
81140
+ continue;
81141
+ }
81142
+ for (const variable of procedure.locals()) {
81143
+ const type = variable.identifier.getType();
81144
+ if (variable.escapes() || (type instanceof basic_1.TableType && type.isWithHeader())
81145
+ || this.passedByReference(procedure, variable)) {
79206
81146
  continue;
79207
81147
  }
79208
- const fix = (0, _procedure_analysis_1.deleteStatement)(procedure.file, first.statement);
79209
- issues.push(issue_1.Issue.atStatement(procedure.file, first.statement, "CLEAR of " + variable.identifier.getName() + ", which is still initial", this.getMetadata().key, this.conf.severity, fix));
81148
+ const occurrences = variable.occurrences;
81149
+ for (let i = 0; i < occurrences.length - 1; i++) {
81150
+ const clear = occurrences[i];
81151
+ const next = occurrences[i + 1];
81152
+ if (((_a = (0, _procedure_analysis_1.plainClear)(clear.statement)) === null || _a === void 0 ? void 0 : _a.getStart().equals(clear.token.getStart())) !== true
81153
+ || clear.statement.getColon() !== undefined
81154
+ || occurrences.some(o => o !== next && o.statement === next.statement)
81155
+ || !this.overwrites(next)) {
81156
+ continue;
81157
+ }
81158
+ const between = procedure.straightBetween(clear.statement, next.statement);
81159
+ if (between === undefined
81160
+ || (procedure.enclosedBy(clear.statement, [Structures.Try, Structures.CatchSystemExceptions])
81161
+ && (between.length > 0 || !this.cannotRaise(procedure, variable, next.statement)))) {
81162
+ continue;
81163
+ }
81164
+ const message = "CLEAR of " + variable.identifier.getName() + ", which is overwritten before it is read";
81165
+ issues.push(issue_1.Issue.atStatement(procedure.file, clear.statement, message, this.getMetadata().key, this.conf.severity, (0, _procedure_analysis_1.deleteStatement)(procedure.file, clear.statement)));
81166
+ }
79210
81167
  }
79211
81168
  }
79212
81169
  return issues;
79213
81170
  }
81171
+ /** passed to a method, NEW, CREATE OBJECT or RAISE EXCEPTION, other than to a pass-by-value parameter;
81172
+ * the called code could keep a reference to the parameter */
81173
+ passedByReference(procedure, variable) {
81174
+ var _a;
81175
+ for (const read of variable.reads()) {
81176
+ const path = (0, _procedure_analysis_1.expressionPath)(read.statement, read.token);
81177
+ if (!path.some(e => e.get() instanceof Expressions.MethodCallParam || e.get() instanceof Expressions.ParameterListS
81178
+ || e.get() instanceof Expressions.MethodParameters)) {
81179
+ continue;
81180
+ }
81181
+ const formal = (0, _procedure_analysis_1.formalParameter)(procedure, read.statement, read.token);
81182
+ if (((_a = formal === null || formal === void 0 ? void 0 : formal.parameter) === null || _a === void 0 ? void 0 : _a.getMeta().includes("pass_by_value" /* IdentifierMeta.PassByValue */)) !== true) {
81183
+ return true;
81184
+ }
81185
+ }
81186
+ return false;
81187
+ }
81188
+ /** v = <expression>. or CREATE OBJECT v [TYPE c] [EXPORTING ...]. */
81189
+ overwrites(occurrence) {
81190
+ var _a, _b;
81191
+ const statement = occurrence.statement;
81192
+ const move = (0, _procedure_analysis_1.plainMove)(statement);
81193
+ if (move !== undefined) {
81194
+ return move.operator === "=" && ((_a = (0, _procedure_analysis_1.singleTarget)(move.target)) === null || _a === void 0 ? void 0 : _a.getStart().equals(occurrence.token.getStart())) === true;
81195
+ }
81196
+ const create = (0, _procedure_analysis_1.plainCreateObject)(statement);
81197
+ return create !== undefined && ((_b = (0, _procedure_analysis_1.singleTarget)(create.target)) === null || _b === void 0 ? void 0 : _b.getStart().equals(occurrence.token.getStart())) === true;
81198
+ }
81199
+ /** v = w. or v = literal. without conversion */
81200
+ cannotRaise(procedure, variable, statement) {
81201
+ const move = (0, _procedure_analysis_1.plainMove)(statement);
81202
+ if (move === undefined) {
81203
+ return false;
81204
+ }
81205
+ const type = variable.identifier.getType();
81206
+ const field = (0, _procedure_analysis_1.singleField)(move.source);
81207
+ const constant = move.source.getChildren().length === 1 ? move.source.findDirectExpression(Expressions.Constant) : undefined;
81208
+ const identifier = field === undefined ? undefined : procedure.identifierAt(field);
81209
+ const source = identifier instanceof _typed_identifier_1.TypedIdentifier ? identifier.getType()
81210
+ : constant === undefined ? undefined : (0, _procedure_analysis_1.literalType)(constant);
81211
+ return source !== undefined
81212
+ && ((0, _procedure_analysis_1.identicalTypes)(source, type) || ((0, _procedure_analysis_1.isReferenceType)(source) && (0, _procedure_analysis_1.isReferenceType)(type) && field !== undefined));
81213
+ }
79214
81214
  }
79215
- exports.ClearAfterDeclaration = ClearAfterDeclaration;
79216
- //# sourceMappingURL=clear_after_declaration.js.map
81215
+ exports.ClearBeforeOverwrite = ClearBeforeOverwrite;
81216
+ //# sourceMappingURL=clear_before_overwrite.js.map
79217
81217
 
79218
81218
  /***/ },
79219
81219
 
@@ -80056,8 +82056,9 @@ c = <constant>, c <> <constant>, EQ, NE, c IS INITIAL, c IS NOT INITIAL, optiona
80056
82056
  The declaration must be executed before the condition on every path: the IF is in the block of the
80057
82057
  declaration or a nested block. The quick fix deletes the declaration.
80058
82058
 
80059
- 2. DATA v TYPE ... without VALUE, where v is never changed, except by CLEAR v., and its address is never taken,
80060
- in a condition v IS [NOT] INITIAL or v IS [NOT] BOUND. The declaration is kept.
82059
+ 2. DATA v TYPE ... without VALUE, or DATA(v) = VALUE t( ). with an explicit type and nothing in the parentheses,
82060
+ where v is never changed, except by CLEAR v., and its address is never taken, in a condition v IS [NOT] INITIAL
82061
+ or v IS [NOT] BOUND. The declaration is kept.
80061
82062
 
80062
82063
  The quick fix removes the IF branch that is never taken, or keeps the branch that is always taken and
80063
82064
  removes the rest, also in ELSEIF chains: a first IF branch that is never taken turns the next ELSEIF into IF,
@@ -80098,12 +82099,12 @@ ENDIF.`,
80098
82099
  }
80099
82100
  const candidates = [];
80100
82101
  for (const variable of procedure.locals()) {
80101
- if (variable.inline) {
80102
- this.constantVariable(procedure, variable, candidates);
80103
- }
80104
- else {
82102
+ if ((0, _procedure_analysis_1.initialDeclaration)(variable) !== undefined) {
80105
82103
  this.initialVariable(procedure, variable, candidates);
80106
82104
  }
82105
+ else if (variable.inline) {
82106
+ this.constantVariable(procedure, variable, candidates);
82107
+ }
80107
82108
  }
80108
82109
  issues.push(...(0, _procedure_analysis_1.foldIssues)(procedure.file, candidates, this.getMetadata().key, this.conf.severity));
80109
82110
  }
@@ -80139,9 +82140,9 @@ ENDIF.`,
80139
82140
  fix: (0, _procedure_analysis_1.mergeEdits)(procedure.file, [fold, (0, _procedure_analysis_1.deleteStatement)(procedure.file, declaration)]),
80140
82141
  });
80141
82142
  }
80142
- /** DATA v TYPE ... never changed: IF v IS INITIAL / IS BOUND */
82143
+ /** DATA v TYPE ... or DATA(v) = VALUE t( ). never changed: IF v IS INITIAL / IS BOUND */
80143
82144
  initialVariable(procedure, variable, candidates) {
80144
- if (!(0, _procedure_analysis_1.plainData)(variable.declaration) || variable.escapes()
82145
+ if (variable.escapes()
80145
82146
  || variable.writes().some(w => { var _a; return ((_a = (0, _procedure_analysis_1.plainClear)(w.statement)) === null || _a === void 0 ? void 0 : _a.getStart().equals(w.token.getStart())) !== true; })) {
80146
82147
  return;
80147
82148
  }
@@ -80404,6 +82405,8 @@ var __importStar = (this && this.__importStar) || (function () {
80404
82405
  Object.defineProperty(exports, "__esModule", ({ value: true }));
80405
82406
  exports.CopyChain = exports.CopyChainConf = void 0;
80406
82407
  const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
82408
+ const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
82409
+ const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "../core/build/src/abap/types/basic/index.js");
80407
82410
  const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "../core/build/src/edit_helper.js");
80408
82411
  const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
80409
82412
  const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
@@ -80421,28 +82424,49 @@ class CopyChain {
80421
82424
  key: "copy_chain",
80422
82425
  title: "Copy chain",
80423
82426
  shortDescription: `Finds a local variable that only passes a value on from one variable to another`,
80424
- extendedInformation: `Reports DATA v TYPE ... [CLEAR v.] v = src. ... y = v. when all of the following hold:
82427
+ extendedInformation: `Reports a local variable that only passes a value on, in two cases.
80425
82428
 
80426
- * v is a local variable of a METHOD, FORM or FUNCTION, declared with DATA without VALUE
82429
+ 1. DATA v TYPE ... [CLEAR v.] v = src. ... y = v. when all of the following hold:
82430
+
82431
+ * v is a local variable of a METHOD, FORM or FUNCTION, declared with DATA without VALUE, or with
82432
+ DATA(v) = VALUE t( ). with an explicit type and nothing in the parentheses
80427
82433
  * v has exactly one write besides CLEAR: v = src., and all CLEARs are before it
80428
82434
  * v has exactly one read, the complete source of y = v.
80429
- * src is a local variable, its address is never taken, and it is not written from v = src. until y = v.
82435
+ * src is a local variable, or a pass-by-value or RETURNING parameter of a method or form, its address is never
82436
+ taken, and it is not written from v = src. until y = v.
80430
82437
  * v = src. is executed before y = v. on every path: y = v. is in the same block or a nested block,
80431
82438
  and both are in the same loop
80432
82439
  * v and src are both reference types, or have identical types; for other types the copy into v can convert,
80433
82440
  e.g. truncate a string into a c field. For DATA(y) = v. the types must be identical, else y changes its type
80434
82441
  * the declaration, the CLEARs and v = src. are not chained
80435
82442
 
80436
- Objects with syntax errors, macros or unknown statements are skipped, as are procedures with dynamic code,
80437
- INCLUDE, test seams, enhancements or native SQL.
80438
-
80439
82443
  The quick fix deletes the declaration, the CLEARs and v = src., and changes the read to y = src.
80440
- No release requirement.`,
82444
+
82445
+ 2. DATA a TYPE REF TO c. CREATE OBJECT a. b = a. when all of the following hold:
82446
+
82447
+ * a is a local variable, declared with DATA without VALUE and not chained, its address is never taken
82448
+ * the only other references to a are CREATE OBJECT a. and the complete source of b = a., which is the next
82449
+ statement in the same block, apart from declarations like DATA in between
82450
+ * CREATE OBJECT has at most TYPE and EXPORTING, it is not chained. With EXCEPTIONS, a classic exception in the
82451
+ constructor would leave b unchanged instead of initial
82452
+ * b is a local variable, or a pass-by-value or RETURNING parameter, whose address is never taken, it is
82453
+ declared before the CREATE OBJECT and not used in its parameters, so the constructor cannot see b
82454
+ * b = a. passes the syntax check, so the static type of b accepts the class of a
82455
+
82456
+ The quick fix deletes the declaration of a and b = a., and creates the object in b, keeping TYPE and EXPORTING.
82457
+ If the static types of a and b differ, it adds TYPE with the class of a.
82458
+
82459
+ Objects with syntax errors, macros or unknown statements are skipped, as are procedures with dynamic code,
82460
+ INCLUDE, test seams, enhancements or native SQL. No release requirement.`,
80441
82461
  tags: [_irule_1.RuleTag.Quickfix],
80442
82462
  badExample: `DATA lo_copy TYPE REF TO zcl_node.
80443
82463
  lo_copy = lo_node.
80444
- ro_result = lo_copy.`,
80445
- goodExample: `ro_result = lo_node.`,
82464
+ ro_result = lo_copy.
82465
+ DATA lo_new TYPE REF TO zcl_node.
82466
+ CREATE OBJECT lo_new.
82467
+ ro_other = lo_new.`,
82468
+ goodExample: `ro_result = lo_node.
82469
+ CREATE OBJECT ro_other.`,
80446
82470
  };
80447
82471
  }
80448
82472
  getConfig() {
@@ -80468,7 +82492,7 @@ ro_result = lo_copy.`,
80468
82492
  }
80469
82493
  for (const variable of procedure.locals()) {
80470
82494
  const declaration = variable.declaration;
80471
- if (variable.inline || !(0, _procedure_analysis_1.plainData)(declaration) || declaration.getColon() !== undefined
82495
+ if ((0, _procedure_analysis_1.initialDeclaration)(variable) === undefined || declaration.getColon() !== undefined
80472
82496
  || variable.escapes()) {
80473
82497
  continue;
80474
82498
  }
@@ -80489,6 +82513,13 @@ ro_result = lo_copy.`,
80489
82513
  }
80490
82514
  const write = writes[0];
80491
82515
  const read = reads[0];
82516
+ if (write.statement.get() instanceof Statements.CreateObject) {
82517
+ const issue = clears.length === 0 ? this.createObject(procedure, variable, write, read) : undefined;
82518
+ if (issue !== undefined) {
82519
+ issues.push(issue);
82520
+ }
82521
+ continue;
82522
+ }
80492
82523
  const assign = (0, _procedure_analysis_1.plainMove)(write.statement);
80493
82524
  const use = (0, _procedure_analysis_1.plainMove)(read.statement);
80494
82525
  if (assign === undefined || use === undefined || assign.operator !== "=" || use.operator !== "="
@@ -80526,6 +82557,46 @@ ro_result = lo_copy.`,
80526
82557
  }
80527
82558
  return issues;
80528
82559
  }
82560
+ /** DATA a TYPE REF TO c. CREATE OBJECT a. b = a. */
82561
+ createObject(procedure, variable, write, read) {
82562
+ var _a, _b, _c;
82563
+ const create = (0, _procedure_analysis_1.plainCreateObject)(write.statement);
82564
+ const use = (0, _procedure_analysis_1.plainMove)(read.statement);
82565
+ const token = use === undefined ? undefined : (0, _procedure_analysis_1.singleTarget)(use.target);
82566
+ const target = token === undefined ? undefined : procedure.private(procedure.identifierAt(token));
82567
+ if (create === undefined || use === undefined || use.operator !== "=" || target === undefined
82568
+ || ((_a = (0, _procedure_analysis_1.singleTarget)(create.target)) === null || _a === void 0 ? void 0 : _a.getStart().equals(write.token.getStart())) !== true
82569
+ || ((_b = (0, _procedure_analysis_1.singleField)(use.source)) === null || _b === void 0 ? void 0 : _b.getStart().equals(read.token.getStart())) !== true
82570
+ || read.statement !== procedure.nextExecuted(write.statement) || !procedure.isSimple(read.statement)
82571
+ || target.occurrences.some(o => o.statement === write.statement)
82572
+ || (target.declaration !== undefined && procedure.index(target.declaration) > write.index)) {
82573
+ return undefined;
82574
+ }
82575
+ const type = variable.identifier.getType();
82576
+ const targetType = target.identifier.getType();
82577
+ let text = (0, _procedure_analysis_1.nodeText)(procedure.file, use.target);
82578
+ if (!(type instanceof basic_1.ObjectReferenceType)
82579
+ || !(targetType instanceof basic_1.ObjectReferenceType || targetType instanceof basic_1.GenericObjectReferenceType)) {
82580
+ return undefined;
82581
+ }
82582
+ else if (create.type === undefined && !(0, _procedure_analysis_1.identicalTypes)(type, targetType)) {
82583
+ // the class of a, as written in its declaration
82584
+ const declared = (_c = variable.declaration.findDirectExpression(Expressions.DataDefinition)) === null || _c === void 0 ? void 0 : _c.findDirectExpression(Expressions.Type);
82585
+ const name = declared === null || declared === void 0 ? void 0 : declared.findDirectExpression(Expressions.TypeName);
82586
+ if (name === undefined || (declared === null || declared === void 0 ? void 0 : declared.getTokens().length) !== 4) {
82587
+ return undefined;
82588
+ }
82589
+ text = text + " TYPE " + (0, _procedure_analysis_1.nodeText)(procedure.file, name);
82590
+ }
82591
+ const fix = (0, _procedure_analysis_1.mergeEdits)(procedure.file, [
82592
+ (0, _procedure_analysis_1.deleteStatement)(procedure.file, variable.declaration),
82593
+ edit_helper_1.EditHelper.replaceToken(procedure.file, write.token, text),
82594
+ (0, _procedure_analysis_1.deleteStatement)(procedure.file, read.statement)
82595
+ ]);
82596
+ const message = "Copy chain via " + variable.identifier.getName() + ", create the object in "
82597
+ + (0, _procedure_analysis_1.nodeText)(procedure.file, use.target) + " directly";
82598
+ return issue_1.Issue.atStatement(procedure.file, read.statement, message, this.getMetadata().key, this.conf.severity, fix);
82599
+ }
80529
82600
  }
80530
82601
  exports.CopyChain = CopyChain;
80531
82602
  //# sourceMappingURL=copy_chain.js.map
@@ -80595,7 +82666,9 @@ class CopyOfInitialVariable {
80595
82666
  shortDescription: `Finds assignments from a local variable that is always initial`,
80596
82667
  extendedInformation: `Reports DATA v TYPE ... [CLEAR v.] x = v. when all of the following hold:
80597
82668
 
80598
- * v is a local variable of a METHOD, FORM or FUNCTION, declared with DATA without VALUE
82669
+ * v is a local variable of a METHOD, FORM or FUNCTION, declared with DATA without VALUE, or with
82670
+ DATA(v) = VALUE t( ). with an explicit type and nothing in the parentheses. Both make v initial, the latter
82671
+ every time it is executed, so v is initial wherever it is read, also in loops
80599
82672
  * v is never changed, except by CLEAR v., and its address is never taken
80600
82673
  * v has exactly one read, the complete source of x = v., where x is not an inline declaration
80601
82674
  * x and v are both reference types, or have identical types. Initial values convert differently between
@@ -80638,7 +82711,7 @@ ro_result = lo_empty.`,
80638
82711
  const declaration = variable.declaration;
80639
82712
  const reads = variable.reads();
80640
82713
  const writes = variable.writes();
80641
- if (variable.inline || !(0, _procedure_analysis_1.plainData)(declaration) || declaration.getColon() !== undefined
82714
+ if ((0, _procedure_analysis_1.initialDeclaration)(variable) === undefined || declaration.getColon() !== undefined
80642
82715
  || variable.escapes() || reads.length !== 1
80643
82716
  || writes.some(w => { var _a; return ((_a = (0, _procedure_analysis_1.plainClear)(w.statement)) === null || _a === void 0 ? void 0 : _a.getStart().equals(w.token.getStart())) !== true
80644
82717
  || w.statement.getColon() !== undefined; })) {
@@ -89652,11 +91725,14 @@ __exportStar(__webpack_require__(/*! ./allowed_object_naming */ "../core/build/s
89652
91725
  __exportStar(__webpack_require__(/*! ./allowed_object_types */ "../core/build/src/rules/allowed_object_types.js"), exports);
89653
91726
  __exportStar(__webpack_require__(/*! ./ambiguous_statement */ "../core/build/src/rules/ambiguous_statement.js"), exports);
89654
91727
  __exportStar(__webpack_require__(/*! ./avoid_use */ "../core/build/src/rules/avoid_use.js"), exports);
91728
+ __exportStar(__webpack_require__(/*! ./bdef_check_syntax */ "../core/build/src/rules/bdef_check_syntax.js"), exports);
91729
+ __exportStar(__webpack_require__(/*! ./bdef_parser_error */ "../core/build/src/rules/bdef_parser_error.js"), exports);
89655
91730
  __exportStar(__webpack_require__(/*! ./begin_end_names */ "../core/build/src/rules/begin_end_names.js"), exports);
89656
91731
  __exportStar(__webpack_require__(/*! ./begin_single_include */ "../core/build/src/rules/begin_single_include.js"), exports);
89657
91732
  __exportStar(__webpack_require__(/*! ./boolean_flag_via_if */ "../core/build/src/rules/boolean_flag_via_if.js"), exports);
89658
91733
  __exportStar(__webpack_require__(/*! ./bound_check_after_create */ "../core/build/src/rules/bound_check_after_create.js"), exports);
89659
91734
  __exportStar(__webpack_require__(/*! ./call_transaction_authority_check */ "../core/build/src/rules/call_transaction_authority_check.js"), exports);
91735
+ __exportStar(__webpack_require__(/*! ./cast_via_generic_reference */ "../core/build/src/rules/cast_via_generic_reference.js"), exports);
89660
91736
  __exportStar(__webpack_require__(/*! ./catch_and_raise */ "../core/build/src/rules/catch_and_raise.js"), exports);
89661
91737
  __exportStar(__webpack_require__(/*! ./cds_association_name */ "../core/build/src/rules/cds_association_name.js"), exports);
89662
91738
  __exportStar(__webpack_require__(/*! ./cds_check_syntax */ "../core/build/src/rules/cds_check_syntax.js"), exports);
@@ -89677,6 +91753,7 @@ __exportStar(__webpack_require__(/*! ./check_syntax */ "../core/build/src/rules/
89677
91753
  __exportStar(__webpack_require__(/*! ./check_text_elements */ "../core/build/src/rules/check_text_elements.js"), exports);
89678
91754
  __exportStar(__webpack_require__(/*! ./check_transformation_exists */ "../core/build/src/rules/check_transformation_exists.js"), exports);
89679
91755
  __exportStar(__webpack_require__(/*! ./clear_after_declaration */ "../core/build/src/rules/clear_after_declaration.js"), exports);
91756
+ __exportStar(__webpack_require__(/*! ./clear_before_overwrite */ "../core/build/src/rules/clear_before_overwrite.js"), exports);
89680
91757
  __exportStar(__webpack_require__(/*! ./clear_exporting_parameters */ "../core/build/src/rules/clear_exporting_parameters.js"), exports);
89681
91758
  __exportStar(__webpack_require__(/*! ./class_attribute_names */ "../core/build/src/rules/class_attribute_names.js"), exports);
89682
91759
  __exportStar(__webpack_require__(/*! ./classic_exceptions_overlap */ "../core/build/src/rules/classic_exceptions_overlap.js"), exports);
@@ -102595,21 +104672,51 @@ var __importStar = (this && this.__importStar) || (function () {
102595
104672
  Object.defineProperty(exports, "__esModule", ({ value: true }));
102596
104673
  exports.SingleUseExpressionTemp = exports.SingleUseExpressionTempConf = void 0;
102597
104674
  const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
104675
+ const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
102598
104676
  const nodes_1 = __webpack_require__(/*! ../abap/nodes */ "../core/build/src/abap/nodes/index.js");
102599
104677
  const _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ "../core/build/src/abap/5_syntax/_reference.js");
102600
104678
  const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "../core/build/src/edit_helper.js");
102601
104679
  const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
104680
+ const version_1 = __webpack_require__(/*! ../version */ "../core/build/src/version.js");
102602
104681
  const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
102603
104682
  const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
102604
104683
  const _procedure_analysis_1 = __webpack_require__(/*! ./_procedure_analysis */ "../core/build/src/rules/_procedure_analysis.js");
102605
104684
  class SingleUseExpressionTempConf extends _basic_rule_config_1.BasicRuleConfig {
102606
104685
  }
102607
104686
  exports.SingleUseExpressionTempConf = SingleUseExpressionTempConf;
102608
- /** builtin functions whose result type follows the type of the argument */
102609
- const NUMERIC_FUNCTIONS = new Set(["abs", "sign", "ceil", "floor", "trunc", "frac", "ipow", "nmax", "nmin",
102610
- "round", "rescale"]);
102611
104687
  /** constructor expressions that can build the result directly in the target */
102612
104688
  const IN_PLACE = new Set(["VALUE", "CORRESPONDING", "COND", "SWITCH", "REDUCE", "FILTER"]);
104689
+ /** constructor expressions with an explicit type: KEYWORD type( ... ) */
104690
+ const CONSTRUCTORS = new Set(["VALUE", "CORRESPONDING", "COND", "SWITCH", "REDUCE", "FILTER", "CONV", "EXACT", "REF"]);
104691
+ /** types that an integer literal converts to without an exception */
104692
+ const LITERAL_CONVERSIONS = new Set(["I", "INT8", "F", "DECFLOAT16", "DECFLOAT34", "STRING"]);
104693
+ /** where the variable is read */
104694
+ var Placement;
104695
+ (function (Placement) {
104696
+ /** y = v. */
104697
+ Placement["Move"] = "move";
104698
+ /** v->m( ) or v->attr */
104699
+ Placement["Receiver"] = "receiver";
104700
+ /** m( v ), m( p = v ), CALL METHOD m EXPORTING p = v, NEW c( p = v ), CREATE OBJECT o EXPORTING p = v */
104701
+ Placement["Parameter"] = "parameter";
104702
+ /** APPEND v TO itab. */
104703
+ Placement["Append"] = "append";
104704
+ /** IF v = x., ELSEIF v = x., xsdbool( v = x ) */
104705
+ Placement["Comparison"] = "comparison";
104706
+ /** |{ v }| */
104707
+ Placement["Template"] = "template";
104708
+ })(Placement || (Placement = {}));
104709
+ var ExpressionKind;
104710
+ (function (ExpressionKind) {
104711
+ /** literal, string template without embeddings, CONV t( literal ) or a constant: the same value everywhere */
104712
+ ExpressionKind["Constant"] = "constant";
104713
+ /** reads only private variables and constants, cannot raise an exception or run other code */
104714
+ ExpressionKind["Pure"] = "pure";
104715
+ /** a data object that other code can change */
104716
+ ExpressionKind["Data"] = "data";
104717
+ /** method calls, NEW and everything else */
104718
+ ExpressionKind["Other"] = "other";
104719
+ })(ExpressionKind || (ExpressionKind = {}));
102613
104720
  class SingleUseExpressionTemp {
102614
104721
  constructor() {
102615
104722
  this.conf = new SingleUseExpressionTempConf();
@@ -102618,28 +104725,62 @@ class SingleUseExpressionTemp {
102618
104725
  return {
102619
104726
  key: "single_use_expression_temp",
102620
104727
  title: "Single use expression temporary",
102621
- shortDescription: `Finds DATA(a) = <expression>. directly followed by x = a., assign the expression to x`,
102622
- extendedInformation: `Reports DATA(a) = <expression>. when all of the following hold:
102623
-
102624
- * a is a local variable of a METHOD, FORM or FUNCTION, with no other reference than the next statement,
102625
- which is x = a., in the same block
104728
+ shortDescription: `Finds a local variable that only passes the value of an expression on to its single use`,
104729
+ extendedInformation: `Reports DATA(v) = <expression>. and DATA v TYPE t. [CLEAR v.] v = <expression>.
104730
+ when all of the following hold:
104731
+
104732
+ * v is a local variable of a METHOD, FORM or FUNCTION, its address is never taken. DATA(v) has no other
104733
+ reference than its single read; DATA v TYPE t. without VALUE and not chained, or DATA(v) = VALUE t( ). with
104734
+ nothing in the parentheses, has exactly one write besides CLEARs, v = <expression>., all CLEARs are before it,
104735
+ and exactly one read after it
104736
+ * the read is one of
104737
+ * the complete source of y = v.
104738
+ * the receiver of a method call or attribute access: v->m( ), v->attr
104739
+ * an actual parameter for an importing parameter: m( v ), m( p = v ), CALL METHOD m EXPORTING p = v,
104740
+ NEW c( p = v ) or CREATE OBJECT o EXPORTING p = v
104741
+ * APPEND v TO itab.
104742
+ * an operand of a comparison with =, <>, <, >, <=, >= or their word forms, in IF, ELSEIF or xsdbool( )
104743
+ * an embedding in a string template: |{ v }|
104744
+ * the read is in the statement directly after the assignment, in the same block, ignoring declarations like
104745
+ DATA and TYPES in between, unless the expression is
104746
+ constant: a literal, a string template without embeddings, CONV t( <integer literal> ) to a type that cannot
104747
+ overflow, or a constant. Then the assignment must be executed before the read on every path: the read is in
104748
+ the block of the assignment or a nested block
102626
104749
  * the result type of the expression does not depend on the target: no arithmetic or bit operators, no unary
102627
- minus, no numeric functions like abs( ) or trunc( ) whose type follows the argument, no CONV or EXACT,
102628
- no # type inference at the top. String templates, && concatenations, literals, method calls, NEW, CAST,
104750
+ minus, no numeric functions like abs( ) or trunc( ) whose type follows the argument, no CONV or EXACT except
104751
+ the constant CONV t( literal ), no # type inference at the top. String templates, && concatenations, literals, method calls, NEW, CAST,
102629
104752
  constructor expressions with explicit type and table expressions are fine
104753
+ * for DATA v TYPE t. and DATA(v) = VALUE t( )., the static type of the expression is identical to t. Into y = v. also a reference whose
104754
+ static type is a subtype of t, unless y is an inline declaration, and an expression whose type depends on the
104755
+ target, like arithmetic, if y has a type identical to t
102630
104756
  * VALUE, CORRESPONDING, COND, SWITCH, REDUCE and FILTER can build their result directly in the target,
102631
- they are only inlined into a new variable, or a local variable that they do not read and whose address
104757
+ they are only moved into a new variable, or a local variable that they do not read and whose address
102632
104758
  is never taken
102633
- * plain data objects are left for unnecessary_copy
104759
+ * the order of evaluation does not change: if the expression is not constant, nothing that is evaluated before the
104760
+ read in the same statement calls a method or function, constructs an object, accesses a table or an attribute
104761
+ via a reference, does arithmetic, or reads data other than local variables, pass-by-value parameters and
104762
+ constants; the read is not inside COND, SWITCH, VALUE or other constructor expressions except NEW, and not
104763
+ after AND, OR or EQUIV, where it might not be evaluated. This does not apply to expressions that only read
104764
+ local variables and cannot raise an exception
104765
+ * a data object that other code can change is only moved if it keeps its value until the read, see
104766
+ unnecessary_copy, a data object read by DATA(v) = <data object>. is left for unnecessary_copy, and a local
104767
+ variable copied into y = v. for copy_chain
104768
+ * a character constant in IF, ELSEIF, WHILE, CHECK, CASE or WHEN is left for constant_condition
102634
104769
 
102635
104770
  Objects with syntax errors, macros or unknown statements are skipped, as are procedures with dynamic code,
102636
104771
  INCLUDE, test seams, enhancements or native SQL.
102637
104772
 
102638
- The quick fix deletes the declaration and writes x = <expression>. No release requirement.`,
104773
+ The quick fix deletes the declaration, the CLEARs and the assignment, and replaces the read of v with the
104774
+ expression. Moving the expression of DATA v TYPE t. into other places than y = v. requires 7.40 SP02 or above,
104775
+ ABAP Cloud or open-abap.`,
102639
104776
  tags: [_irule_1.RuleTag.Quickfix],
102640
104777
  badExample: `DATA(lo_conf) = NEW zcl_conf( ).
102641
- mo_conf = lo_conf.`,
102642
- goodExample: `mo_conf = NEW zcl_conf( ).`,
104778
+ mo_conf = lo_conf.
104779
+ DATA lv_key TYPE string.
104780
+ lv_key = |abapdoc|.
104781
+ lo_meta = NEW zcl_meta( iv_key = lv_key ).`,
104782
+ goodExample: `mo_conf = NEW zcl_conf( ).
104783
+ lo_meta = NEW zcl_meta( iv_key = |abapdoc| ).`,
102643
104784
  };
102644
104785
  }
102645
104786
  getConfig() {
@@ -102658,61 +104799,501 @@ mo_conf = lo_conf.`,
102658
104799
  if (analysis === undefined) {
102659
104800
  return [];
102660
104801
  }
104802
+ const config = this.reg.getConfig();
104803
+ const expressions = (0, version_1.releaseAtLeast)(config.getRelease(), version_1.Release.v740sp02)
104804
+ || config.getLanguageVersion() === version_1.LanguageVersion.Cloud || config.isOpenABAP();
102661
104805
  const issues = [];
102662
104806
  for (const procedure of analysis.procedures) {
102663
104807
  if (procedure.supported === false) {
102664
104808
  continue;
102665
104809
  }
102666
104810
  for (const variable of procedure.locals()) {
102667
- const declaration = variable.declaration;
102668
- const move = variable.inline ? (0, _procedure_analysis_1.plainMove)(declaration) : undefined;
102669
- const read = variable.occurrences[0];
102670
- if (move === undefined || move.operator !== "="
102671
- || move.target.getChildren().length !== 1
102672
- || move.target.findDirectExpression(Expressions.InlineData) === undefined
102673
- || variable.occurrences.length !== 1 || read.kind !== _procedure_analysis_1.OccurrenceKind.Read
102674
- || read.statement !== procedure.statements[procedure.index(declaration) + 1]
102675
- || procedure.block(read.statement) !== procedure.block(declaration)
102676
- || !procedure.isSimple(read.statement)) {
104811
+ const temp = (_a = (variable.inline ? this.inlineTemp(procedure, variable) : undefined)) !== null && _a !== void 0 ? _a : this.declaredTemp(variable);
104812
+ const read = variable.reads()[0];
104813
+ if (temp === undefined || read === undefined) {
102677
104814
  continue;
102678
104815
  }
102679
- const use = (0, _procedure_analysis_1.plainMove)(read.statement);
102680
- if (use === undefined || use.operator !== "="
102681
- || ((_a = (0, _procedure_analysis_1.singleField)(use.source)) === null || _a === void 0 ? void 0 : _a.getStart().equals(read.token.getStart())) !== true
102682
- || (0, _procedure_analysis_1.dataSource)(procedure, move.source) !== undefined
102683
- || !this.targetIndependent(procedure, move.source)
102684
- || !this.noAliasing(procedure, move.source, use.target)) {
104816
+ const placement = this.placement(procedure, read.statement, read.token);
104817
+ if (placement === undefined
104818
+ || (!variable.inline && placement !== Placement.Move && expressions === false)
104819
+ || !this.valid(procedure, temp, read, placement)) {
102685
104820
  continue;
102686
104821
  }
102687
- const fix = (0, _procedure_analysis_1.mergeEdits)(procedure.file, [
102688
- edit_helper_1.EditHelper.replaceToken(procedure.file, read.token, (0, _procedure_analysis_1.nodeText)(procedure.file, move.source)),
102689
- (0, _procedure_analysis_1.deleteStatement)(procedure.file, declaration)
102690
- ]);
102691
- const message = "Assign the expression directly instead of via " + variable.identifier.getName();
102692
- issues.push(issue_1.Issue.atStatement(procedure.file, declaration, message, this.getMetadata().key, this.conf.severity, fix));
104822
+ const edits = [edit_helper_1.EditHelper.replaceToken(procedure.file, read.token, (0, _procedure_analysis_1.nodeText)(procedure.file, temp.source))];
104823
+ for (const statement of temp.remove) {
104824
+ edits.push((0, _procedure_analysis_1.deleteStatement)(procedure.file, statement));
104825
+ }
104826
+ const fix = (0, _procedure_analysis_1.mergeEdits)(procedure.file, edits);
104827
+ const message = "Use the expression directly instead of via " + variable.identifier.getName();
104828
+ issues.push(issue_1.Issue.atStatement(procedure.file, temp.write, message, this.getMetadata().key, this.conf.severity, fix));
102693
104829
  }
102694
104830
  }
102695
104831
  return issues;
102696
104832
  }
104833
+ /** DATA(v) = <expression>. with a single read, plain data objects are left for unnecessary_copy */
104834
+ inlineTemp(procedure, variable) {
104835
+ const declaration = variable.declaration;
104836
+ const move = (0, _procedure_analysis_1.plainMove)(declaration);
104837
+ if (move === undefined || move.operator !== "="
104838
+ || move.target.getChildren().length !== 1
104839
+ || move.target.findDirectExpression(Expressions.InlineData) === undefined
104840
+ || variable.occurrences.length !== 1 || variable.occurrences[0].kind !== _procedure_analysis_1.OccurrenceKind.Read
104841
+ || (0, _procedure_analysis_1.dataSource)(procedure, move.source) !== undefined
104842
+ || !this.targetIndependent(procedure, move.source)) {
104843
+ return undefined;
104844
+ }
104845
+ return { variable, write: declaration, source: move.source, remove: [declaration], typed: false };
104846
+ }
104847
+ /** DATA v TYPE t. or DATA(v) = VALUE t( )., [CLEAR v.] v = <expression>. with a single read after it */
104848
+ declaredTemp(variable) {
104849
+ var _a, _b;
104850
+ const declaration = variable.declaration;
104851
+ if ((0, _procedure_analysis_1.initialDeclaration)(variable) === undefined || declaration.getColon() !== undefined || variable.escapes()) {
104852
+ return undefined;
104853
+ }
104854
+ const clears = [];
104855
+ const writes = [];
104856
+ for (const write of variable.writes()) {
104857
+ if (((_a = (0, _procedure_analysis_1.plainClear)(write.statement)) === null || _a === void 0 ? void 0 : _a.getStart().equals(write.token.getStart())) === true
104858
+ && write.statement.getColon() === undefined) {
104859
+ clears.push(write);
104860
+ }
104861
+ else {
104862
+ writes.push(write);
104863
+ }
104864
+ }
104865
+ const reads = variable.reads();
104866
+ if (writes.length !== 1 || reads.length !== 1) {
104867
+ return undefined;
104868
+ }
104869
+ const write = writes[0];
104870
+ const move = (0, _procedure_analysis_1.plainMove)(write.statement);
104871
+ if (move === undefined || move.operator !== "="
104872
+ || ((_b = (0, _procedure_analysis_1.singleTarget)(move.target)) === null || _b === void 0 ? void 0 : _b.getStart().equals(write.token.getStart())) !== true
104873
+ || clears.some(c => c.index > write.index)
104874
+ || reads[0].index <= write.index) {
104875
+ return undefined;
104876
+ }
104877
+ return { variable, write: write.statement, source: move.source,
104878
+ remove: [declaration, ...clears.map(c => c.statement), write.statement], typed: true };
104879
+ }
104880
+ placement(procedure, statement, token) {
104881
+ var _a, _b, _c, _d;
104882
+ if (statement.getColon() !== undefined) {
104883
+ return undefined;
104884
+ }
104885
+ const move = (0, _procedure_analysis_1.plainMove)(statement);
104886
+ if (move !== undefined && move.operator === "=" && ((_a = (0, _procedure_analysis_1.singleField)(move.source)) === null || _a === void 0 ? void 0 : _a.getStart().equals(token.getStart())) === true) {
104887
+ return Placement.Move;
104888
+ }
104889
+ const path = (0, _procedure_analysis_1.expressionPath)(statement, token);
104890
+ if (path.some(e => e.get() instanceof Expressions.Target || e.get() instanceof Expressions.MethodSource
104891
+ || e.get() instanceof Expressions.Dereference)) {
104892
+ return undefined;
104893
+ }
104894
+ const tokens = procedure.tokensOf(statement);
104895
+ const index = tokens.findIndex(t => t.getStart().equals(token.getStart()));
104896
+ if (((_b = tokens[index + 1]) === null || _b === void 0 ? void 0 : _b.getStr()) === "->") {
104897
+ return ((_c = tokens[index + 2]) === null || _c === void 0 ? void 0 : _c.getStr()) === "*" ? undefined : Placement.Receiver;
104898
+ }
104899
+ let sourceIndex = path.length - 1;
104900
+ while (sourceIndex >= 0 && !(path[sourceIndex].get() instanceof Expressions.Source)
104901
+ && !(path[sourceIndex].get() instanceof Expressions.SimpleSource4)) {
104902
+ sourceIndex--;
104903
+ }
104904
+ const source = path[sourceIndex];
104905
+ if (source === undefined || source.countTokens() !== 1
104906
+ || source.findDirectExpression(Expressions.FieldChain) === undefined) {
104907
+ return undefined;
104908
+ }
104909
+ const parent = path[sourceIndex - 1];
104910
+ if (parent === undefined) {
104911
+ return statement.get() instanceof Statements.Append && statement.getChildren()[1] === source
104912
+ ? Placement.Append : undefined;
104913
+ }
104914
+ else if (parent.get() instanceof Expressions.StringTemplateSource) {
104915
+ return Placement.Template;
104916
+ }
104917
+ else if (parent.get() instanceof Expressions.Compare) {
104918
+ if (parent.findDirectExpression(Expressions.CompareOperator) === undefined) {
104919
+ return undefined;
104920
+ }
104921
+ let owner = sourceIndex - 2;
104922
+ while (((_d = path[owner]) === null || _d === void 0 ? void 0 : _d.get()) instanceof Expressions.Cond) {
104923
+ owner--;
104924
+ }
104925
+ if (owner === sourceIndex - 2) {
104926
+ return undefined;
104927
+ }
104928
+ else if (owner < 0) {
104929
+ const type = statement.get();
104930
+ return type instanceof Statements.If || type instanceof Statements.ElseIf ? Placement.Comparison : undefined;
104931
+ }
104932
+ const keyword = path[owner].getFirstToken().getStr().toUpperCase();
104933
+ return path[owner].get() instanceof Expressions.Source && (keyword === "XSDBOOL" || keyword === "BOOLC")
104934
+ ? Placement.Comparison : undefined;
104935
+ }
104936
+ return (0, _procedure_analysis_1.formalParameter)(procedure, statement, token) !== undefined ? Placement.Parameter : undefined;
104937
+ }
104938
+ valid(procedure, temp, read, placement) {
104939
+ const statement = read.statement;
104940
+ const kind = this.kind(procedure, temp.source);
104941
+ if (kind === ExpressionKind.Constant) {
104942
+ if (!procedure.dominates(temp.write, statement)
104943
+ || (!temp.typed && (0, _procedure_analysis_1.isCondition)(statement) && (0, _procedure_analysis_1.characterConstant)(procedure, temp.source) !== undefined)) {
104944
+ return false;
104945
+ }
104946
+ }
104947
+ else if (statement !== procedure.nextExecuted(temp.write)
104948
+ || !(procedure.isSimple(statement) || statement.get() instanceof Statements.If)) {
104949
+ return false;
104950
+ }
104951
+ if (!this.typeMatches(procedure, temp, statement, placement)) {
104952
+ return false;
104953
+ }
104954
+ else if (placement === Placement.Receiver && !this.chainable(temp.source)) {
104955
+ return false;
104956
+ }
104957
+ const data = (0, _procedure_analysis_1.dataSource)(procedure, temp.source);
104958
+ if (kind === ExpressionKind.Constant) {
104959
+ return true;
104960
+ }
104961
+ else if ((data === null || data === void 0 ? void 0 : data.kind) === _procedure_analysis_1.SourceKind.Local && (0, _procedure_analysis_1.singleField)(temp.source) !== undefined && placement === Placement.Move) {
104962
+ // left for copy_chain
104963
+ return false;
104964
+ }
104965
+ else if (!this.notWrittenIn(procedure, temp.source, statement)) {
104966
+ return false;
104967
+ }
104968
+ else if (kind === ExpressionKind.Pure) {
104969
+ return true;
104970
+ }
104971
+ else if (!this.evaluatedFirst(procedure, statement, read.token) || !this.alwaysEvaluated(statement, read.token)) {
104972
+ return false;
104973
+ }
104974
+ return data === undefined || (0, _procedure_analysis_1.unchangedBetween)(procedure, data, temp.write, statement, read.token);
104975
+ }
104976
+ kind(procedure, source) {
104977
+ var _a;
104978
+ const data = (0, _procedure_analysis_1.dataSource)(procedure, source);
104979
+ if (this.constant(source) || (data === null || data === void 0 ? void 0 : data.kind) === _procedure_analysis_1.SourceKind.Immutable) {
104980
+ return ExpressionKind.Constant;
104981
+ }
104982
+ else if (((data === null || data === void 0 ? void 0 : data.kind) === _procedure_analysis_1.SourceKind.Local && ((_a = data.base) === null || _a === void 0 ? void 0 : _a.escapes()) === false) || this.pure(procedure, source)) {
104983
+ return ExpressionKind.Pure;
104984
+ }
104985
+ else if (data !== undefined) {
104986
+ return ExpressionKind.Data;
104987
+ }
104988
+ return ExpressionKind.Other;
104989
+ }
104990
+ /** a literal, a string template without embeddings, or CONV t( literal ) that cannot raise an exception */
104991
+ constant(source) {
104992
+ var _a;
104993
+ const children = source.getChildren();
104994
+ const first = children[0];
104995
+ if (children.length === 1 && first instanceof nodes_1.ExpressionNode) {
104996
+ return first.get() instanceof Expressions.Constant
104997
+ || (first.get() instanceof Expressions.StringTemplate
104998
+ && first.findDirectExpression(Expressions.StringTemplateSource) === undefined);
104999
+ }
105000
+ if (children.length !== 5 || source.getFirstToken().getStr().toUpperCase() !== "CONV") {
105001
+ return false;
105002
+ }
105003
+ const type = ((_a = source.findDirectExpression(Expressions.TypeNameOrInfer)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase()) || "";
105004
+ const body = source.findDirectExpression(Expressions.ConvBody);
105005
+ const value = (body === null || body === void 0 ? void 0 : body.getChildren().length) === 1 ? body.findDirectExpression(Expressions.Source) : undefined;
105006
+ const literal = (value === null || value === void 0 ? void 0 : value.getChildren().length) === 1 ? value.findDirectExpression(Expressions.Constant) : undefined;
105007
+ return literal !== undefined && LITERAL_CONVERSIONS.has(type)
105008
+ && (literal.findDirectExpression(Expressions.Integer) !== undefined || type === "STRING");
105009
+ }
105010
+ /** reads only private variables and constants, and cannot raise an exception: string templates and
105011
+ * concatenations of such fields, xsdbool( ) and boolc( ) of IS INITIAL, IS BOUND, IS INSTANCE OF and
105012
+ * comparisons without conversion */
105013
+ pure(procedure, source) {
105014
+ const children = source.getChildren();
105015
+ const first = children[0];
105016
+ const keyword = first instanceof nodes_1.TokenNode ? first.getFirstToken().getStr().toUpperCase() : "";
105017
+ if (children.length === 1 && first instanceof nodes_1.ExpressionNode) {
105018
+ return this.pureOperand(procedure, first);
105019
+ }
105020
+ else if (children.length === 3 && children[1] instanceof nodes_1.TokenNode && children[1].getFirstToken().getStr() === "&&"
105021
+ && children[0] instanceof nodes_1.ExpressionNode && children[2] instanceof nodes_1.ExpressionNode) {
105022
+ return this.pureOperand(procedure, children[0]) && this.pure(procedure, children[2]);
105023
+ }
105024
+ else if (children.length === 4 && (keyword === "XSDBOOL" || keyword === "BOOLC")) {
105025
+ const cond = source.findDirectExpression(Expressions.Cond);
105026
+ return cond !== undefined && this.pureCondition(procedure, cond);
105027
+ }
105028
+ return false;
105029
+ }
105030
+ /** a literal, a private variable or constant, or a string template that embeds only those, without formatting */
105031
+ pureOperand(procedure, operand) {
105032
+ if (operand.get() instanceof Expressions.Constant) {
105033
+ return true;
105034
+ }
105035
+ else if (operand.get() instanceof Expressions.FieldChain) {
105036
+ return operand.countTokens() === 1 && this.privateField(procedure, operand.getFirstToken());
105037
+ }
105038
+ else if (operand.get() instanceof Expressions.StringTemplate) {
105039
+ return operand.findDirectExpressions(Expressions.StringTemplateSource).every(s => s.getChildren().length === 1
105040
+ && this.operandType(procedure, s.findDirectExpression(Expressions.Source)) !== undefined);
105041
+ }
105042
+ return false;
105043
+ }
105044
+ pureCondition(procedure, cond) {
105045
+ for (const child of cond.getChildren()) {
105046
+ if (child instanceof nodes_1.TokenNode) {
105047
+ continue;
105048
+ }
105049
+ else if (child.get() instanceof Expressions.Cond) {
105050
+ if (!this.pureCondition(procedure, child)) {
105051
+ return false;
105052
+ }
105053
+ }
105054
+ else if (child.get() instanceof Expressions.Compare) {
105055
+ const operands = child.findDirectExpressions(Expressions.Source);
105056
+ const words = child.getChildren().filter(c => c instanceof nodes_1.TokenNode).map(c => c.getFirstToken().getStr().toUpperCase());
105057
+ const operator = child.findDirectExpression(Expressions.CompareOperator);
105058
+ const types = operands.map(o => this.operandType(procedure, o));
105059
+ if (types.some(t => t === undefined)) {
105060
+ return false;
105061
+ }
105062
+ else if (operands.length === 1 && words[words.length - 1] !== "SUPPLIED" && words[words.length - 1] !== "REQUESTED"
105063
+ && words.includes("IS") && child.findDirectExpression(Expressions.CompareOperator) === undefined) {
105064
+ // IS [NOT] INITIAL, IS [NOT] BOUND, IS [NOT] INSTANCE OF
105065
+ continue;
105066
+ }
105067
+ else if (operands.length === 2 && operator !== undefined
105068
+ && ((0, _procedure_analysis_1.identicalTypes)(types[0], types[1]) || ((0, _procedure_analysis_1.isReferenceType)(types[0]) && (0, _procedure_analysis_1.isReferenceType)(types[1])))) {
105069
+ continue;
105070
+ }
105071
+ return false;
105072
+ }
105073
+ else {
105074
+ return false;
105075
+ }
105076
+ }
105077
+ return true;
105078
+ }
105079
+ /** type of a private variable, a constant or a literal, which can be read without side effects */
105080
+ operandType(procedure, source) {
105081
+ if (source.getChildren().length !== 1 || source.countTokens() !== 1) {
105082
+ return undefined;
105083
+ }
105084
+ const constant = source.findDirectExpression(Expressions.Constant);
105085
+ if (constant !== undefined) {
105086
+ return (0, _procedure_analysis_1.literalType)(constant);
105087
+ }
105088
+ const field = (0, _procedure_analysis_1.singleField)(source);
105089
+ if (field === undefined || !this.privateField(procedure, field)) {
105090
+ return undefined;
105091
+ }
105092
+ return procedure.identifierAt(field).getType();
105093
+ }
105094
+ privateField(procedure, token) {
105095
+ const identifier = procedure.identifierAt(token);
105096
+ return (0, _procedure_analysis_1.isImmutable)(identifier) || procedure.private(identifier) !== undefined;
105097
+ }
105098
+ /** the variables read by the expression are not changed by the statement that reads the temporary,
105099
+ * except as the target of a move, which is written after its source is evaluated */
105100
+ notWrittenIn(procedure, source, statement) {
105101
+ var _a;
105102
+ const target = (_a = (0, _procedure_analysis_1.plainMove)(statement)) === null || _a === void 0 ? void 0 : _a.target;
105103
+ const inTarget = (token) => target !== undefined
105104
+ && !token.getStart().isBefore(target.getFirstToken().getStart()) && !target.getLastToken().getStart().isBefore(token.getStart());
105105
+ for (const token of source.getTokens()) {
105106
+ const variable = procedure.variable(procedure.identifierAt(token));
105107
+ if ((variable === null || variable === void 0 ? void 0 : variable.occurrences.some(o => o.statement === statement && o.kind !== _procedure_analysis_1.OccurrenceKind.Read && !inTarget(o.token))) === true) {
105108
+ return false;
105109
+ }
105110
+ }
105111
+ return true;
105112
+ }
105113
+ /** nothing evaluated before the token in the statement can run other code, raise an exception or read data that
105114
+ * other code changes. The target of a move is evaluated after its source */
105115
+ evaluatedFirst(procedure, statement, token) {
105116
+ var _a, _b;
105117
+ const position = token.getStart();
105118
+ const before = (node) => node.getLastToken().getStart().isBefore(position);
105119
+ for (const type of [Expressions.MethodCall, Expressions.NewObject, Expressions.Cast, Expressions.TableExpression,
105120
+ Expressions.ArithOperator, Expressions.Dereference]) {
105121
+ if (statement.findAllExpressionsRecursive(type).some(before)) {
105122
+ return false;
105123
+ }
105124
+ }
105125
+ for (const source of statement.findAllExpressionsRecursive(Expressions.Source)) {
105126
+ const keyword = source.getFirstToken().getStr().toUpperCase();
105127
+ if (before(source) && CONSTRUCTORS.has(keyword) && source.findDirectExpression(Expressions.TypeNameOrInfer) !== undefined) {
105128
+ return false;
105129
+ }
105130
+ }
105131
+ // the target of a move or CREATE OBJECT is written after the source and the parameters are evaluated
105132
+ let target = (_a = (0, _procedure_analysis_1.plainMove)(statement)) === null || _a === void 0 ? void 0 : _a.target;
105133
+ if (statement.get() instanceof Statements.CreateObject) {
105134
+ target = statement.findDirectExpression(Expressions.Target);
105135
+ if ((target === null || target === void 0 ? void 0 : target.countTokens()) !== 1) {
105136
+ return false;
105137
+ }
105138
+ }
105139
+ const tokens = procedure.tokensOf(statement);
105140
+ for (let i = 0; i < tokens.length && tokens[i].getStart().isBefore(position); i++) {
105141
+ if (target !== undefined && !tokens[i].getStart().isBefore(target.getFirstToken().getStart())
105142
+ && !target.getLastToken().getStart().isBefore(tokens[i].getStart())) {
105143
+ continue;
105144
+ }
105145
+ const references = procedure.analysis.referencesAt(procedure.file.getFilename(), tokens[i]);
105146
+ if (references.some(r => r.referenceType === _reference_1.ReferenceType.DataReadReference
105147
+ || r.referenceType === _reference_1.ReferenceType.DataWriteReference)) {
105148
+ // a private variable or constant, and a reference only to call a method: v->m( ... token ... )
105149
+ if (!this.privateField(procedure, tokens[i])
105150
+ || (((_b = tokens[i + 1]) === null || _b === void 0 ? void 0 : _b.getStr()) === "->"
105151
+ && (tokens[i + 2] === undefined || procedure.methodAt(tokens[i + 2]) === undefined))) {
105152
+ return false;
105153
+ }
105154
+ }
105155
+ }
105156
+ return true;
105157
+ }
105158
+ /** the token is evaluated whenever the statement is: not in a branch of COND or SWITCH, not in an iteration of
105159
+ * VALUE, REDUCE or FILTER, and not after AND, OR or EQUIV */
105160
+ alwaysEvaluated(statement, token) {
105161
+ const position = token.getStart();
105162
+ for (const node of (0, _procedure_analysis_1.expressionPath)(statement, token)) {
105163
+ if (node.get() instanceof Expressions.Source) {
105164
+ const keyword = node.getFirstToken().getStr().toUpperCase();
105165
+ if (CONSTRUCTORS.has(keyword) && node.findDirectExpression(Expressions.TypeNameOrInfer) !== undefined) {
105166
+ return false;
105167
+ }
105168
+ }
105169
+ else if (node.get() instanceof Expressions.Cond) {
105170
+ for (const child of node.getChildren()) {
105171
+ const word = child.getFirstToken().getStr().toUpperCase();
105172
+ if (child instanceof nodes_1.TokenNode && child.getFirstToken().getStart().isBefore(position)
105173
+ && (word === "AND" || word === "OR" || word === "EQUIV")) {
105174
+ return false;
105175
+ }
105176
+ }
105177
+ }
105178
+ else if (node.get() instanceof Expressions.For || node.get() instanceof Expressions.Let) {
105179
+ return false;
105180
+ }
105181
+ }
105182
+ return true;
105183
+ }
105184
+ /** the expression can be followed by -> */
105185
+ chainable(source) {
105186
+ const children = source.getChildren();
105187
+ return children.length === 1 && (children[0].get() instanceof Expressions.FieldChain
105188
+ || children[0].get() instanceof Expressions.MethodCallChain);
105189
+ }
105190
+ typeMatches(procedure, temp, statement, placement) {
105191
+ const use = placement === Placement.Move ? (0, _procedure_analysis_1.plainMove)(statement) : undefined;
105192
+ if (use !== undefined && !this.noAliasing(procedure, temp.source, use.target)) {
105193
+ return false;
105194
+ }
105195
+ else if (!temp.typed) {
105196
+ // the variable has the type of the expression
105197
+ return true;
105198
+ }
105199
+ const type = temp.variable.identifier.getType();
105200
+ const independent = this.targetIndependent(procedure, temp.source);
105201
+ if (use === undefined) {
105202
+ return independent && this.sameType(procedure, temp, type);
105203
+ }
105204
+ const inline = use.target.findFirstExpression(Expressions.InlineData) !== undefined;
105205
+ if (independent) {
105206
+ if (this.sameType(procedure, temp, type)) {
105207
+ return true;
105208
+ }
105209
+ // an up cast into v, and v into y, is an up cast into y
105210
+ const expression = (0, _procedure_analysis_1.expressionType)(procedure, temp.source);
105211
+ const constructed = this.constructedType(temp.source);
105212
+ const reference = expression === undefined ? (constructed === null || constructed === void 0 ? void 0 : constructed.reference) === true && constructed.name !== "#"
105213
+ : (0, _procedure_analysis_1.isReferenceType)(expression);
105214
+ return inline === false && reference && (0, _procedure_analysis_1.isReferenceType)(type);
105215
+ }
105216
+ // the type of the expression follows the target
105217
+ const target = inline ? undefined : (0, _procedure_analysis_1.targetType)(procedure, use.target);
105218
+ return target !== undefined && (0, _procedure_analysis_1.identicalTypes)(target, type);
105219
+ }
105220
+ /** the expression has exactly the type of the declaration DATA v TYPE t. */
105221
+ sameType(procedure, temp, type) {
105222
+ const expression = (0, _procedure_analysis_1.expressionType)(procedure, temp.source);
105223
+ if (expression !== undefined) {
105224
+ return (0, _procedure_analysis_1.identicalTypes)(expression, type);
105225
+ }
105226
+ // constructor expressions with an explicit type, compared by the name of the type
105227
+ const declared = this.declaredType(temp.variable);
105228
+ const constructed = this.constructedType(temp.source);
105229
+ return declared !== undefined && constructed !== undefined && constructed.name !== "#"
105230
+ && constructed.name === declared.name && constructed.reference === declared.reference;
105231
+ }
105232
+ /** the type name of DATA v TYPE t., DATA v TYPE REF TO t. or DATA(v) = VALUE t( ). */
105233
+ declaredType(variable) {
105234
+ var _a, _b;
105235
+ const declaration = variable.declaration;
105236
+ if ((0, _procedure_analysis_1.initialDeclaration)(variable) === _procedure_analysis_1.InitialDeclaration.Value) {
105237
+ return this.constructedType((0, _procedure_analysis_1.plainMove)(declaration).source);
105238
+ }
105239
+ const type = (_a = declaration.findDirectExpression(Expressions.DataDefinition)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Type);
105240
+ const name = (_b = type === null || type === void 0 ? void 0 : type.findDirectExpression(Expressions.TypeName)) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase();
105241
+ const words = type === null || type === void 0 ? void 0 : type.getTokens().map(t => t.getStr().toUpperCase()).join(" ");
105242
+ if (name === undefined) {
105243
+ return undefined;
105244
+ }
105245
+ else if (words === "TYPE " + name) {
105246
+ return { name, reference: false };
105247
+ }
105248
+ else if (words === "TYPE REF TO " + name) {
105249
+ return { name, reference: true };
105250
+ }
105251
+ return undefined;
105252
+ }
105253
+ /** VALUE t( ... ), CONV t( ... ) etc., NEW c( ... ) and CAST c( ... ) with an explicit type */
105254
+ constructedType(source) {
105255
+ const children = source.getChildren();
105256
+ const last = children[children.length - 1];
105257
+ const keyword = source.getFirstToken().getStr().toUpperCase();
105258
+ let name;
105259
+ let reference = false;
105260
+ if (CONSTRUCTORS.has(keyword) && keyword !== "REF" && last instanceof nodes_1.TokenNode && last.getFirstToken().getStr() === ")") {
105261
+ name = source.findDirectExpression(Expressions.TypeNameOrInfer);
105262
+ }
105263
+ else if (children.length === 1 && children[0].get() instanceof Expressions.MethodCallChain
105264
+ && children[0].getChildren().length === 1) {
105265
+ const constructor = children[0].getChildren()[0];
105266
+ if (constructor.get() instanceof Expressions.NewObject || constructor.get() instanceof Expressions.Cast) {
105267
+ name = constructor.findDirectExpression(Expressions.TypeNameOrInfer);
105268
+ reference = true;
105269
+ }
105270
+ }
105271
+ const text = name === null || name === void 0 ? void 0 : name.concatTokens().toUpperCase();
105272
+ return text === undefined ? undefined : { name: text, reference };
105273
+ }
102697
105274
  /** the type of the expression does not depend on where it is assigned to */
102698
105275
  targetIndependent(procedure, source) {
102699
- var _a, _b;
105276
+ var _a, _b, _c;
102700
105277
  const first = source.getFirstToken().getStr().toUpperCase();
102701
- if (first === "CONV" || first === "EXACT"
105278
+ if (this.constant(source)) {
105279
+ return true;
105280
+ }
105281
+ else if (first === "CONV" || first === "EXACT"
102702
105282
  || ((_a = source.findDirectExpression(Expressions.TypeNameOrInfer)) === null || _a === void 0 ? void 0 : _a.concatTokens()) === "#"
105283
+ || ((_b = this.constructedType(source)) === null || _b === void 0 ? void 0 : _b.name) === "#"
102703
105284
  || source.findFirstExpression(Expressions.ArithOperator) !== undefined
102704
105285
  || source.getTokens().some(t => t.getStr().toUpperCase().startsWith("BIT-"))
102705
105286
  || !this.concatenationOnly(source)) {
102706
105287
  return false;
102707
105288
  }
102708
105289
  for (const call of source.findAllExpressionsRecursive(Expressions.MethodCall)) {
102709
- const name = (_b = call.findDirectExpression(Expressions.MethodName)) === null || _b === void 0 ? void 0 : _b.getFirstToken();
105290
+ const name = (_c = call.findDirectExpression(Expressions.MethodName)) === null || _c === void 0 ? void 0 : _c.getFirstToken();
102710
105291
  if (name === undefined) {
102711
105292
  return false;
102712
105293
  }
102713
105294
  const builtin = procedure.analysis.referencesAt(procedure.file.getFilename(), name)
102714
105295
  .some(r => r.referenceType === _reference_1.ReferenceType.BuiltinMethodReference);
102715
- if (builtin && NUMERIC_FUNCTIONS.has(name.getStr().toLowerCase())) {
105296
+ if (builtin && _procedure_analysis_1.NUMERIC_FUNCTIONS.has(name.getStr().toLowerCase())) {
102716
105297
  return false;
102717
105298
  }
102718
105299
  }
@@ -105980,14 +108561,17 @@ class UnnecessaryCopy {
105980
108561
  extendedInformation: `Reports DATA(a) = b. when all of the following hold:
105981
108562
 
105982
108563
  * a is a local variable of a METHOD, FORM or FUNCTION, and has exactly one more reference: a read,
105983
- which does not take its address, bind a field symbol to it, or pass it to USING, CHANGING or EXPORTING
108564
+ which does not take its address, bind a field symbol to it, or pass it to USING or CHANGING
105984
108565
  * b is a plain data object: variable, constant, attribute, or a chain of components and attributes,
105985
108566
  without calls, offsets, table expressions, field symbols or ->*
105986
108567
  * the declaration is executed before the read on every path: the read is in the block of the declaration
105987
108568
  or a nested block, and both are in the same loop
105988
- * b keeps its value from the declaration until the read: for a local b, no write to it and its address is
105989
- never taken; for other b, in addition no method, function or form call and no write except to local
105990
- variables, by value parameters and RETURNING in between
108569
+ * b keeps its value from the declaration until the read: for a local b, or a pass-by-value or RETURNING
108570
+ parameter b of a method or form, no write to it and its address is never taken; for other b, in addition no
108571
+ method, function or form call and no write except to local variables, by value parameters and RETURNING in
108572
+ between, and in the statement of the read no call before the read. A method called in that statement could
108573
+ change b while it reads the parameter that b is passed to by reference, so the read may only be the receiver
108574
+ of the call, or the actual parameter of a pass-by-value parameter of the only method called in the statement
105991
108575
 
105992
108576
  a has the type of b, so reading b instead does not change any conversion.
105993
108577
  A constant b read in IF, ELSEIF, WHILE, CHECK, CASE or WHEN is not reported, see constant_condition.