@abaplint/cli 2.120.65 → 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 +98 -51
  2. package/package.json +3 -2
package/build/cli.js CHANGED
@@ -7567,7 +7567,9 @@ class Source extends combi_1.Expression {
7567
7567
  const comp = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.Dash), _1.ComponentChain);
7568
7568
  const attr = (0, combi_1.seq)(_1.Arrow, attribute_chain_1.AttributeChain);
7569
7569
  const deref = (0, combi_1.optPrio)((0, combi_1.ver)(version_1.Release.v756, dereference_1.Dereference));
7570
- const dynChain = (0, combi_1.star)((0, combi_1.altPrio)((0, _dynamic_access_1.dynAttr)(), (0, _dynamic_access_1.dynComp)(), dereference_1.Dereference));
7570
+ // below v756 "->*" directly after a functional method call is a syntax error, CAST can be dereferenced
7571
+ const dynChain = (0, combi_1.star)((0, combi_1.seq)((0, combi_1.altPrio)((0, _dynamic_access_1.dynAttr)(), (0, _dynamic_access_1.dynComp)()), (0, combi_1.optPrio)(dereference_1.Dereference)));
7572
+ const castDeref = (0, combi_1.seq)(_1.Cast, dereference_1.Dereference);
7571
7573
  const method = (0, combi_1.seq)(_1.MethodCallChain, (0, combi_1.optPrio)((0, combi_1.altPrio)(attr, comp)), deref, dynChain);
7572
7574
  const rparen = (0, combi_1.tok)(tokens_1.WParenRightW);
7573
7575
  const rparenNoSpace = (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.ParenRightW), (0, combi_1.tok)(tokens_1.WParenRightW));
@@ -7577,7 +7579,7 @@ class Source extends combi_1.Expression {
7577
7579
  const after = (0, combi_1.seq)((0, combi_1.altPrio)("&", "&&", _1.ArithOperator), Source);
7578
7580
  const bool = (0, combi_1.seq)((0, combi_1.altPrio)((0, combi_1.ver)(version_1.Release.v702, (0, combi_1.regex)(/^BOOLC$/i), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v740sp08, (0, combi_1.regex)(/^XSDBOOL$/i), { also: combi_1.AlsoIn.OpenABAP })), (0, combi_1.tok)(tokens_1.ParenLeftW), _1.Cond, ")");
7579
7581
  const prefix = (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WPlus), "BIT-NOT");
7580
- const old = (0, combi_1.seq)((0, combi_1.optPrio)(prefix), (0, combi_1.altPrio)(_1.Constant, _1.StringTemplate, text_element_1.TextElement, bool, method, (0, combi_1.seq)(_1.FieldChain, deref), paren), (0, combi_1.optPrio)(after));
7582
+ const old = (0, combi_1.seq)((0, combi_1.optPrio)(prefix), (0, combi_1.altPrio)(_1.Constant, _1.StringTemplate, text_element_1.TextElement, bool, castDeref, method, (0, combi_1.seq)(_1.FieldChain, deref), paren), (0, combi_1.optPrio)(after));
7581
7583
  const corr = (0, combi_1.ver)(version_1.Release.v740sp05, (0, combi_1.seq)("CORRESPONDING", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), _1.CorrespondingBody, rparen, (0, combi_1.optPrio)(after)), { also: combi_1.AlsoIn.OpenABAP });
7582
7584
  const conv = (0, combi_1.ver)(version_1.Release.v740sp02, (0, combi_1.seq)("CONV", _1.TypeNameOrInfer, lparenNoSpace, _1.ConvBody, rparenNoSpace, (0, combi_1.optPrio)(after)), { also: combi_1.AlsoIn.OpenABAP });
7583
7585
  const swit = (0, combi_1.ver)(version_1.Release.v740sp02, (0, combi_1.seq)("SWITCH", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), _1.SwitchBody, rparenNoSpace, (0, combi_1.optPrio)(after)), { also: combi_1.AlsoIn.OpenABAP });
@@ -16910,7 +16912,9 @@ class ModifyLine {
16910
16912
  const ocp = (0, combi_1.str)("OF CURRENT PAGE");
16911
16913
  const intensified = (0, combi_1.seq)("INTENSIFIED", onOff);
16912
16914
  const intensifiedOpt = (0, combi_1.seq)("INTENSIFIED", (0, combi_1.opt)(onOff));
16913
- 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));
16914
16918
  const options = (0, combi_1.per)(index, value, format, page, lineFormat, lineValue, ocp, intensified, expressions_1.Color);
16915
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));
16916
16920
  return (0, combi_1.verNotLang)(version_1.LanguageVersion.Cloud, ret);
@@ -26469,6 +26473,7 @@ class CurrentScope {
26469
26473
  if (name === undefined) {
26470
26474
  return undefined;
26471
26475
  }
26476
+ name = name.replace(/^!/, "");
26472
26477
  const found = (_a = this.current) === null || _a === void 0 ? void 0 : _a.findVariable(name);
26473
26478
  if (found) {
26474
26479
  return found;
@@ -26798,6 +26803,61 @@ class ObjectOriented {
26798
26803
  }
26799
26804
  // does the supplied class have friendship with "friendName"?
26800
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
+ }
26801
26861
  hasFriendship(cd, friendName) {
26802
26862
  var _a;
26803
26863
  const friends = cd.getFriends().map(f => f.toUpperCase());
@@ -29774,6 +29834,8 @@ const _object_oriented_1 = __webpack_require__(/*! ../_object_oriented */ "../co
29774
29834
  const data_reference_type_1 = __webpack_require__(/*! ../../types/basic/data_reference_type */ "../core/build/src/abap/types/basic/data_reference_type.js");
29775
29835
  const _reference_1 = __webpack_require__(/*! ../_reference */ "../core/build/src/abap/5_syntax/_reference.js");
29776
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");
29777
29839
  const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
29778
29840
  class AttributeName {
29779
29841
  static runSyntax(context, node, input, type, error = true) {
@@ -29802,6 +29864,15 @@ class AttributeName {
29802
29864
  }
29803
29865
  return void_type_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
29804
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
+ }
29805
29876
  if (type) {
29806
29877
  input.scope.addReference(token, found, type, input.filename);
29807
29878
  }
@@ -32740,8 +32811,6 @@ const _reference_1 = __webpack_require__(/*! ../_reference */ "../core/build/src
32740
32811
  const component_name_1 = __webpack_require__(/*! ./component_name */ "../core/build/src/abap/5_syntax/expressions/component_name.js");
32741
32812
  const attribute_name_1 = __webpack_require__(/*! ./attribute_name */ "../core/build/src/abap/5_syntax/expressions/attribute_name.js");
32742
32813
  const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
32743
- const visibility_1 = __webpack_require__(/*! ../../4_file_information/visibility */ "../core/build/src/abap/4_file_information/visibility.js");
32744
- const class_definition_1 = __webpack_require__(/*! ../../types/class_definition */ "../core/build/src/abap/types/class_definition.js");
32745
32814
  class MethodCallChain {
32746
32815
  static runSyntax(node, input, targetType) {
32747
32816
  var _a, _b;
@@ -32790,7 +32859,9 @@ class MethodCallChain {
32790
32859
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, methodToken, message));
32791
32860
  return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
32792
32861
  }
32793
- 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;
32794
32865
  if (notVisible !== undefined) {
32795
32866
  const message = `Method "${methodName}" is ${notVisible} and cannot be accessed`;
32796
32867
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, methodToken, message));
@@ -32838,47 +32909,6 @@ class MethodCallChain {
32838
32909
  return context;
32839
32910
  }
32840
32911
  //////////////////////////////////////
32841
- // returns the visibility as text if the method cannot be accessed from the current scope
32842
- static checkVisibility(method, def, foundDef, input) {
32843
- var _a, _b, _c;
32844
- const visibility = method.getVisibility();
32845
- if (visibility === visibility_1.Visibility.Public || foundDef === undefined) {
32846
- return undefined;
32847
- }
32848
- else if (!(foundDef instanceof class_definition_1.ClassDefinition)) {
32849
- // interface members are always public
32850
- return undefined;
32851
- }
32852
- const name = foundDef.getName().toUpperCase();
32853
- const enclosing = (_a = input.scope.getEnclosingClassName()) === null || _a === void 0 ? void 0 : _a.toUpperCase();
32854
- if (enclosing === undefined || enclosing === name) {
32855
- return undefined;
32856
- }
32857
- // friendship with the class used at the call site also gives access to inherited members
32858
- const helper = new _object_oriented_1.ObjectOriented(input.scope);
32859
- const visited = [];
32860
- let current = def instanceof class_definition_1.ClassDefinition ? def : foundDef;
32861
- while (current !== undefined && visited.includes(current.getName().toUpperCase()) === false) {
32862
- visited.push(current.getName().toUpperCase());
32863
- if (helper.hasFriendship(current, enclosing)) {
32864
- return undefined;
32865
- }
32866
- const sup = current.getSuperClass();
32867
- current = sup === undefined ? undefined : input.scope.findClassDefinition(sup);
32868
- }
32869
- if (visibility === visibility_1.Visibility.Protected) {
32870
- // subclasses can access protected members
32871
- let sup = (_b = input.scope.findClassDefinition(enclosing)) === null || _b === void 0 ? void 0 : _b.getSuperClass();
32872
- while (sup !== undefined) {
32873
- if (sup.toUpperCase() === name) {
32874
- return undefined;
32875
- }
32876
- sup = (_c = input.scope.findClassDefinition(sup)) === null || _c === void 0 ? void 0 : _c.getSuperClass();
32877
- }
32878
- return "protected";
32879
- }
32880
- return "private";
32881
- }
32882
32912
  static findTop(first, input, targetType) {
32883
32913
  var _a;
32884
32914
  if (first.get() instanceof Expressions.ClassName) {
@@ -33302,6 +33332,9 @@ const field_chain_1 = __webpack_require__(/*! ./field_chain */ "../core/build/sr
33302
33332
  const _reference_1 = __webpack_require__(/*! ../_reference */ "../core/build/src/abap/5_syntax/_reference.js");
33303
33333
  const _check_offset_length_1 = __webpack_require__(/*! ./_check_offset_length */ "../core/build/src/abap/5_syntax/expressions/_check_offset_length.js");
33304
33334
  const _check_text_symbol_1 = __webpack_require__(/*! ./_check_text_symbol */ "../core/build/src/abap/5_syntax/expressions/_check_text_symbol.js");
33335
+ function normalizeParameterName(name) {
33336
+ return name.replace(/^!/, "").toUpperCase();
33337
+ }
33305
33338
  class MethodParameters {
33306
33339
  constructor() {
33307
33340
  this.requiredParameters = undefined;
@@ -33488,7 +33521,7 @@ class MethodParameters {
33488
33521
  throw new assert_error_1.AssertError("parameterListS, unexpected node, child");
33489
33522
  }
33490
33523
  const nameNode = c.findDirectExpression(Expressions.ParameterName);
33491
- const name = nameNode === null || nameNode === void 0 ? void 0 : nameNode.getFirstToken().getStr().toUpperCase();
33524
+ const name = nameNode === undefined ? undefined : normalizeParameterName(nameNode.getFirstToken().getStr());
33492
33525
  if (name === undefined || nameNode === undefined) {
33493
33526
  throw new assert_error_1.AssertError("parameterListS, no name determined");
33494
33527
  }
@@ -33543,7 +33576,7 @@ class MethodParameters {
33543
33576
  throw new assert_error_1.AssertError("parameterListT, unexpected node, child");
33544
33577
  }
33545
33578
  const nameNode = c.findDirectExpression(Expressions.ParameterName);
33546
- const name = nameNode === null || nameNode === void 0 ? void 0 : nameNode.getFirstToken().getStr().toUpperCase();
33579
+ const name = nameNode === undefined ? undefined : normalizeParameterName(nameNode.getFirstToken().getStr());
33547
33580
  if (name === undefined || nameNode === undefined) {
33548
33581
  throw new assert_error_1.AssertError("parameterListT, no name determined");
33549
33582
  }
@@ -36204,6 +36237,7 @@ const expressions_1 = __webpack_require__(/*! ../../2_statements/expressions */
36204
36237
  const field_length_1 = __webpack_require__(/*! ./field_length */ "../core/build/src/abap/5_syntax/expressions/field_length.js");
36205
36238
  const cast_1 = __webpack_require__(/*! ./cast */ "../core/build/src/abap/5_syntax/expressions/cast.js");
36206
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");
36207
36241
  class Target {
36208
36242
  static runSyntax(node, input) {
36209
36243
  const concat = node.concatTokens();
@@ -36269,6 +36303,12 @@ class Target {
36269
36303
  if (!(context instanceof basic_1.VoidType)) {
36270
36304
  context = context.getType();
36271
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
+ }
36272
36312
  }
36273
36313
  else if (current.get() instanceof Expressions.ComponentName) {
36274
36314
  context = component_name_1.ComponentName.runSyntax(context, current, input);
@@ -39562,7 +39602,7 @@ class Convert {
39562
39602
  if ((stampTarget === null || stampTarget === void 0 ? void 0 : stampTarget.get()) instanceof Expressions.Target) {
39563
39603
  const inline = stampTarget === null || stampTarget === void 0 ? void 0 : stampTarget.findDirectExpression(Expressions.InlineData);
39564
39604
  if (inline) {
39565
- inline_data_1.InlineData.runSyntax(inline, input, new basic_1.PackedType(8, 4));
39605
+ inline_data_1.InlineData.runSyntax(inline, input, new basic_1.PackedType(8, 0));
39566
39606
  }
39567
39607
  else {
39568
39608
  target_1.Target.runSyntax(stampTarget, input);
@@ -50914,6 +50954,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
50914
50954
  exports.DataReference = void 0;
50915
50955
  const _abstract_type_1 = __webpack_require__(/*! ./_abstract_type */ "../core/build/src/abap/types/basic/_abstract_type.js");
50916
50956
  const any_type_1 = __webpack_require__(/*! ./any_type */ "../core/build/src/abap/types/basic/any_type.js");
50957
+ const table_type_1 = __webpack_require__(/*! ./table_type */ "../core/build/src/abap/types/basic/table_type.js");
50917
50958
  class DataReference extends _abstract_type_1.AbstractType {
50918
50959
  constructor(type, qualifiedName) {
50919
50960
  super({ qualifiedName: qualifiedName });
@@ -50936,6 +50977,10 @@ class DataReference extends _abstract_type_1.AbstractType {
50936
50977
  if (this.type instanceof any_type_1.AnyType) {
50937
50978
  return true;
50938
50979
  }
50980
+ // LIKE REF TO a generic table, eg. a field symbol TYPE STANDARD TABLE
50981
+ if (this.type instanceof table_type_1.TableType && this.type.isGeneric()) {
50982
+ return true;
50983
+ }
50939
50984
  return false;
50940
50985
  }
50941
50986
  containsVoid() {
@@ -70053,6 +70098,7 @@ class Indent {
70053
70098
  || type instanceof Statements.ProcessBeforeOutput
70054
70099
  || type instanceof Statements.ProcessOnValueRequest
70055
70100
  || type instanceof Statements.TopOfPage
70101
+ || type instanceof Statements.EndOfPage
70056
70102
  || type instanceof Statements.Get
70057
70103
  || type instanceof Statements.EndOfSelection
70058
70104
  || type instanceof Statements.LoadOfProgram) {
@@ -70148,6 +70194,7 @@ class Indent {
70148
70194
  || type instanceof Statements.Initialization
70149
70195
  || type instanceof Statements.AtUserCommand
70150
70196
  || type instanceof Statements.TopOfPage
70197
+ || type instanceof Statements.EndOfPage
70151
70198
  || type instanceof Statements.EndOfSelection
70152
70199
  || type instanceof Statements.Public
70153
70200
  || type instanceof Statements.Protected
@@ -70345,7 +70392,7 @@ class Registry {
70345
70392
  }
70346
70393
  static abaplintVersion() {
70347
70394
  // magic, see build script "version.js"
70348
- return "2.120.65";
70395
+ return "2.120.67";
70349
70396
  }
70350
70397
  getDDICReferences() {
70351
70398
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
+
2
3
  "name": "@abaplint/cli",
3
- "version": "2.120.65",
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.65",
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",