@abaplint/cli 2.120.66 → 2.120.67

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 +83 -46
  2. package/package.json +3 -2
package/build/cli.js CHANGED
@@ -16912,7 +16912,9 @@ class ModifyLine {
16912
16912
  const ocp = (0, combi_1.str)("OF CURRENT PAGE");
16913
16913
  const intensified = (0, combi_1.seq)("INTENSIFIED", onOff);
16914
16914
  const intensifiedOpt = (0, combi_1.seq)("INTENSIFIED", (0, combi_1.opt)(onOff));
16915
- const lineFormat = (0, combi_1.seq)("LINE FORMAT", (0, combi_1.per)("INPUT OFF", "INVERSE", "RESET", intensifiedOpt, expressions_1.Color));
16915
+ const inputOpt = (0, combi_1.seq)("INPUT", (0, combi_1.opt)((0, combi_1.alt)(eq, onOff)));
16916
+ const inverseOpt = (0, combi_1.seq)("INVERSE", (0, combi_1.opt)((0, combi_1.alt)(eq, onOff)));
16917
+ const lineFormat = (0, combi_1.seq)("LINE FORMAT", (0, combi_1.per)(inputOpt, inverseOpt, "RESET", intensifiedOpt, expressions_1.Color));
16916
16918
  const options = (0, combi_1.per)(index, value, format, page, lineFormat, lineValue, ocp, intensified, expressions_1.Color);
16917
16919
  const ret = (0, combi_1.seq)("MODIFY", (0, combi_1.altPrio)("CURRENT LINE", (0, combi_1.seq)("LINE", expressions_1.Source)), (0, combi_1.opt)(options));
16918
16920
  return (0, combi_1.verNotLang)(version_1.LanguageVersion.Cloud, ret);
@@ -26471,6 +26473,7 @@ class CurrentScope {
26471
26473
  if (name === undefined) {
26472
26474
  return undefined;
26473
26475
  }
26476
+ name = name.replace(/^!/, "");
26474
26477
  const found = (_a = this.current) === null || _a === void 0 ? void 0 : _a.findVariable(name);
26475
26478
  if (found) {
26476
26479
  return found;
@@ -26800,6 +26803,61 @@ class ObjectOriented {
26800
26803
  }
26801
26804
  // does the supplied class have friendship with "friendName"?
26802
26805
  // note that interfaces of the friend, and subclasses of the friend also have friendship
26806
+ // returns the visibility as text if a member declared in foundDef, reached via def, cannot be accessed from enclosing
26807
+ memberNotVisible(visibility, def, foundDef, enclosing) {
26808
+ var _a, _b;
26809
+ if (visibility === visibility_1.Visibility.Public || foundDef === undefined) {
26810
+ return undefined;
26811
+ }
26812
+ else if (!(foundDef instanceof types_1.ClassDefinition)) {
26813
+ // interface members are always public
26814
+ return undefined;
26815
+ }
26816
+ const name = foundDef.getName().toUpperCase();
26817
+ enclosing = enclosing === null || enclosing === void 0 ? void 0 : enclosing.toUpperCase();
26818
+ if (enclosing === undefined || enclosing === name) {
26819
+ return undefined;
26820
+ }
26821
+ // friendship with the class used at the call site also gives access to inherited members
26822
+ const visited = [];
26823
+ let current = def instanceof types_1.ClassDefinition ? def : foundDef;
26824
+ while (current !== undefined && visited.includes(current.getName().toUpperCase()) === false) {
26825
+ visited.push(current.getName().toUpperCase());
26826
+ if (this.hasFriendship(current, enclosing)) {
26827
+ return undefined;
26828
+ }
26829
+ const sup = current.getSuperClass();
26830
+ current = sup === undefined ? undefined : this.scope.findClassDefinition(sup);
26831
+ }
26832
+ if (visibility === visibility_1.Visibility.Protected) {
26833
+ // subclasses can access protected members
26834
+ let sup = (_a = this.scope.findClassDefinition(enclosing)) === null || _a === void 0 ? void 0 : _a.getSuperClass();
26835
+ while (sup !== undefined) {
26836
+ if (sup.toUpperCase() === name) {
26837
+ return undefined;
26838
+ }
26839
+ sup = (_b = this.scope.findClassDefinition(sup)) === null || _b === void 0 ? void 0 : _b.getSuperClass();
26840
+ }
26841
+ return "protected";
26842
+ }
26843
+ return "private";
26844
+ }
26845
+ // the class declaring the attribute or constant, searched from def up through the super classes
26846
+ findAttributeOwner(def, found) {
26847
+ const visited = [];
26848
+ let current = def;
26849
+ while (current instanceof types_1.ClassDefinition && visited.includes(current.getName().toUpperCase()) === false) {
26850
+ visited.push(current.getName().toUpperCase());
26851
+ const attributes = current.getAttributes();
26852
+ if (attributes.getAll().includes(found)
26853
+ || attributes.getConstants().includes(found)) {
26854
+ return current;
26855
+ }
26856
+ const sup = current.getSuperClass();
26857
+ current = sup === undefined ? undefined : this.findSuperDefinition(sup);
26858
+ }
26859
+ return undefined;
26860
+ }
26803
26861
  hasFriendship(cd, friendName) {
26804
26862
  var _a;
26805
26863
  const friends = cd.getFriends().map(f => f.toUpperCase());
@@ -29776,6 +29834,8 @@ const _object_oriented_1 = __webpack_require__(/*! ../_object_oriented */ "../co
29776
29834
  const data_reference_type_1 = __webpack_require__(/*! ../../types/basic/data_reference_type */ "../core/build/src/abap/types/basic/data_reference_type.js");
29777
29835
  const _reference_1 = __webpack_require__(/*! ../_reference */ "../core/build/src/abap/5_syntax/_reference.js");
29778
29836
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
29837
+ const class_attribute_1 = __webpack_require__(/*! ../../types/class_attribute */ "../core/build/src/abap/types/class_attribute.js");
29838
+ const class_constant_1 = __webpack_require__(/*! ../../types/class_constant */ "../core/build/src/abap/types/class_constant.js");
29779
29839
  const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
29780
29840
  class AttributeName {
29781
29841
  static runSyntax(context, node, input, type, error = true) {
@@ -29804,6 +29864,15 @@ class AttributeName {
29804
29864
  }
29805
29865
  return void_type_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
29806
29866
  }
29867
+ if (found instanceof class_attribute_1.ClassAttribute || found instanceof class_constant_1.ClassConstant) {
29868
+ const owner = helper.findAttributeOwner(def, found);
29869
+ const notVisible = helper.memberNotVisible(found.getVisibility(), def, owner, input.scope.getEnclosingClassName());
29870
+ if (notVisible !== undefined) {
29871
+ const message = `Attribute "${name}" is ${notVisible} and cannot be accessed`;
29872
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, token, message));
29873
+ return void_type_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
29874
+ }
29875
+ }
29807
29876
  if (type) {
29808
29877
  input.scope.addReference(token, found, type, input.filename);
29809
29878
  }
@@ -32742,8 +32811,6 @@ const _reference_1 = __webpack_require__(/*! ../_reference */ "../core/build/src
32742
32811
  const component_name_1 = __webpack_require__(/*! ./component_name */ "../core/build/src/abap/5_syntax/expressions/component_name.js");
32743
32812
  const attribute_name_1 = __webpack_require__(/*! ./attribute_name */ "../core/build/src/abap/5_syntax/expressions/attribute_name.js");
32744
32813
  const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
32745
- const visibility_1 = __webpack_require__(/*! ../../4_file_information/visibility */ "../core/build/src/abap/4_file_information/visibility.js");
32746
- const class_definition_1 = __webpack_require__(/*! ../../types/class_definition */ "../core/build/src/abap/types/class_definition.js");
32747
32814
  class MethodCallChain {
32748
32815
  static runSyntax(node, input, targetType) {
32749
32816
  var _a, _b;
@@ -32792,7 +32859,9 @@ class MethodCallChain {
32792
32859
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, methodToken, message));
32793
32860
  return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
32794
32861
  }
32795
- const notVisible = method ? this.checkVisibility(method, def, foundDef, input) : undefined;
32862
+ const notVisible = method
32863
+ ? helper.memberNotVisible(method.getVisibility(), def, foundDef, input.scope.getEnclosingClassName())
32864
+ : undefined;
32796
32865
  if (notVisible !== undefined) {
32797
32866
  const message = `Method "${methodName}" is ${notVisible} and cannot be accessed`;
32798
32867
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, methodToken, message));
@@ -32840,47 +32909,6 @@ class MethodCallChain {
32840
32909
  return context;
32841
32910
  }
32842
32911
  //////////////////////////////////////
32843
- // returns the visibility as text if the method cannot be accessed from the current scope
32844
- static checkVisibility(method, def, foundDef, input) {
32845
- var _a, _b, _c;
32846
- const visibility = method.getVisibility();
32847
- if (visibility === visibility_1.Visibility.Public || foundDef === undefined) {
32848
- return undefined;
32849
- }
32850
- else if (!(foundDef instanceof class_definition_1.ClassDefinition)) {
32851
- // interface members are always public
32852
- return undefined;
32853
- }
32854
- const name = foundDef.getName().toUpperCase();
32855
- const enclosing = (_a = input.scope.getEnclosingClassName()) === null || _a === void 0 ? void 0 : _a.toUpperCase();
32856
- if (enclosing === undefined || enclosing === name) {
32857
- return undefined;
32858
- }
32859
- // friendship with the class used at the call site also gives access to inherited members
32860
- const helper = new _object_oriented_1.ObjectOriented(input.scope);
32861
- const visited = [];
32862
- let current = def instanceof class_definition_1.ClassDefinition ? def : foundDef;
32863
- while (current !== undefined && visited.includes(current.getName().toUpperCase()) === false) {
32864
- visited.push(current.getName().toUpperCase());
32865
- if (helper.hasFriendship(current, enclosing)) {
32866
- return undefined;
32867
- }
32868
- const sup = current.getSuperClass();
32869
- current = sup === undefined ? undefined : input.scope.findClassDefinition(sup);
32870
- }
32871
- if (visibility === visibility_1.Visibility.Protected) {
32872
- // subclasses can access protected members
32873
- let sup = (_b = input.scope.findClassDefinition(enclosing)) === null || _b === void 0 ? void 0 : _b.getSuperClass();
32874
- while (sup !== undefined) {
32875
- if (sup.toUpperCase() === name) {
32876
- return undefined;
32877
- }
32878
- sup = (_c = input.scope.findClassDefinition(sup)) === null || _c === void 0 ? void 0 : _c.getSuperClass();
32879
- }
32880
- return "protected";
32881
- }
32882
- return "private";
32883
- }
32884
32912
  static findTop(first, input, targetType) {
32885
32913
  var _a;
32886
32914
  if (first.get() instanceof Expressions.ClassName) {
@@ -36209,6 +36237,7 @@ const expressions_1 = __webpack_require__(/*! ../../2_statements/expressions */
36209
36237
  const field_length_1 = __webpack_require__(/*! ./field_length */ "../core/build/src/abap/5_syntax/expressions/field_length.js");
36210
36238
  const cast_1 = __webpack_require__(/*! ./cast */ "../core/build/src/abap/5_syntax/expressions/cast.js");
36211
36239
  const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
36240
+ const version_1 = __webpack_require__(/*! ../../../version */ "../core/build/src/version.js");
36212
36241
  class Target {
36213
36242
  static runSyntax(node, input) {
36214
36243
  const concat = node.concatTokens();
@@ -36274,6 +36303,12 @@ class Target {
36274
36303
  if (!(context instanceof basic_1.VoidType)) {
36275
36304
  context = context.getType();
36276
36305
  }
36306
+ if ((context === null || context === void 0 ? void 0 : context.isGeneric()) === true
36307
+ && !(0, version_1.releaseAtLeast)(input.scope.getRelease(), version_1.Release.v756)
36308
+ && input.scope.getLanguageVersion() !== version_1.LanguageVersion.Cloud
36309
+ && !input.scope.getOpenABAP()) {
36310
+ throw new Error("A generic reference cannot be dereferenced");
36311
+ }
36277
36312
  }
36278
36313
  else if (current.get() instanceof Expressions.ComponentName) {
36279
36314
  context = component_name_1.ComponentName.runSyntax(context, current, input);
@@ -70063,6 +70098,7 @@ class Indent {
70063
70098
  || type instanceof Statements.ProcessBeforeOutput
70064
70099
  || type instanceof Statements.ProcessOnValueRequest
70065
70100
  || type instanceof Statements.TopOfPage
70101
+ || type instanceof Statements.EndOfPage
70066
70102
  || type instanceof Statements.Get
70067
70103
  || type instanceof Statements.EndOfSelection
70068
70104
  || type instanceof Statements.LoadOfProgram) {
@@ -70158,6 +70194,7 @@ class Indent {
70158
70194
  || type instanceof Statements.Initialization
70159
70195
  || type instanceof Statements.AtUserCommand
70160
70196
  || type instanceof Statements.TopOfPage
70197
+ || type instanceof Statements.EndOfPage
70161
70198
  || type instanceof Statements.EndOfSelection
70162
70199
  || type instanceof Statements.Public
70163
70200
  || type instanceof Statements.Protected
@@ -70355,7 +70392,7 @@ class Registry {
70355
70392
  }
70356
70393
  static abaplintVersion() {
70357
70394
  // magic, see build script "version.js"
70358
- return "2.120.66";
70395
+ return "2.120.67";
70359
70396
  }
70360
70397
  getDDICReferences() {
70361
70398
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
+
2
3
  "name": "@abaplint/cli",
3
- "version": "2.120.66",
4
+ "version": "2.120.67",
4
5
  "description": "abaplint - Command Line Interface",
5
6
  "funding": "https://github.com/sponsors/larshp",
6
7
  "bin": {
@@ -39,7 +40,7 @@
39
40
  },
40
41
  "homepage": "https://abaplint.org",
41
42
  "devDependencies": {
42
- "@abaplint/core": "^2.120.66",
43
+ "@abaplint/core": "^2.120.67",
43
44
  "@types/chai": "^4.3.20",
44
45
  "@types/minimist": "^1.2.5",
45
46
  "@types/mocha": "^10.0.10",