@abaplint/cli 2.120.19 → 2.120.21

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 +155 -7
  2. package/package.json +5 -4
package/build/cli.js CHANGED
@@ -16769,11 +16769,12 @@ class ModifyEntities {
16769
16769
  const reported = (0, combi_1.seq)("REPORTED", expressions_1.Target);
16770
16770
  const end = (0, combi_1.optPrio)((0, combi_1.per)(failed, result, mapped, reported));
16771
16771
  const entities = (0, combi_1.seq)((0, combi_1.optPrio)("AUGMENTING"), "ENTITIES OF", expressions_1.NamespaceSimpleName, (0, combi_1.opt)("IN LOCAL MODE"), (0, combi_1.plusPrio)((0, combi_1.seq)("ENTITY", expressions_1.NamespaceSimpleName, (0, combi_1.plus)(operation))));
16772
+ const dynamic = (0, combi_1.seq)("ENTITIES", (0, combi_1.optPrio)((0, combi_1.altPrio)("IN LOCAL MODE", (0, combi_1.seq)((0, combi_1.opt)("FORWARDING"), "PRIVILEGED"))), "OPERATIONS", expressions_1.Source);
16772
16773
  const create2 = (0, combi_1.seq)("CREATE", fieldsWith, (0, combi_1.opt)((0, combi_1.seq)("CREATE BY", expressions_1.EMLEntityPath, fieldsWith)));
16773
16774
  const create3 = (0, combi_1.seq)("CREATE BY", expressions_1.EMLEntityPath, fieldsWith);
16774
16775
  const create4 = (0, combi_1.seq)("CREATE FROM", expressions_1.Source, (0, combi_1.plus)((0, combi_1.seq)("CREATE BY", expressions_1.EMLEntityPath, "FROM", expressions_1.Source)));
16775
16776
  const entity = (0, combi_1.seq)("ENTITY", (0, combi_1.opt)("IN LOCAL MODE"), (0, combi_1.alt)(expressions_1.NamespaceSimpleName, expressions_1.EntityAssociation), (0, combi_1.alt)(execute, create, updateFields, deleteFrom, updateSetFields, updateFrom, create2, create3, create4));
16776
- return (0, combi_1.ver)(version_1.Release.v754, (0, combi_1.seq)("MODIFY", (0, combi_1.alt)(entities, entity), end), { also: combi_1.AlsoIn.OpenABAP });
16777
+ return (0, combi_1.ver)(version_1.Release.v754, (0, combi_1.seq)("MODIFY", (0, combi_1.alt)(entities, dynamic, entity), end), { also: combi_1.AlsoIn.OpenABAP });
16777
16778
  }
16778
16779
  }
16779
16780
  exports.ModifyEntities = ModifyEntities;
@@ -26422,6 +26423,20 @@ class CurrentScope {
26422
26423
  }
26423
26424
  return false;
26424
26425
  }
26426
+ isInStaticMethod() {
26427
+ let curr = this.current;
26428
+ while (curr !== undefined) {
26429
+ const stype = curr.getIdentifier().stype;
26430
+ if (stype === _scope_type_1.ScopeType.MethodInstance) {
26431
+ return false;
26432
+ }
26433
+ else if (stype === _scope_type_1.ScopeType.ClassImplementation) {
26434
+ return true;
26435
+ }
26436
+ curr = curr.getParent();
26437
+ }
26438
+ return false;
26439
+ }
26425
26440
  addLocalFriend(className, friendName) {
26426
26441
  var _a;
26427
26442
  const key = className.toUpperCase();
@@ -27787,7 +27802,8 @@ class TypeUtils {
27787
27802
  }
27788
27803
  }
27789
27804
  else if (source instanceof basic_1.XStringType) {
27790
- if (target instanceof basic_1.CLikeType
27805
+ if (target instanceof basic_1.CharacterType
27806
+ || target instanceof basic_1.CLikeType
27791
27807
  || target instanceof basic_1.IntegerType
27792
27808
  || target instanceof basic_1.StringType
27793
27809
  || target instanceof basic_1.ObjectReferenceType
@@ -29149,19 +29165,59 @@ function checkOffsetLength(source, sourceType, method, input) {
29149
29165
 
29150
29166
  "use strict";
29151
29167
 
29168
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
29169
+ if (k2 === undefined) k2 = k;
29170
+ var desc = Object.getOwnPropertyDescriptor(m, k);
29171
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
29172
+ desc = { enumerable: true, get: function() { return m[k]; } };
29173
+ }
29174
+ Object.defineProperty(o, k2, desc);
29175
+ }) : (function(o, m, k, k2) {
29176
+ if (k2 === undefined) k2 = k;
29177
+ o[k2] = m[k];
29178
+ }));
29179
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29180
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
29181
+ }) : function(o, v) {
29182
+ o["default"] = v;
29183
+ });
29184
+ var __importStar = (this && this.__importStar) || (function () {
29185
+ var ownKeys = function(o) {
29186
+ ownKeys = Object.getOwnPropertyNames || function (o) {
29187
+ var ar = [];
29188
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29189
+ return ar;
29190
+ };
29191
+ return ownKeys(o);
29192
+ };
29193
+ return function (mod) {
29194
+ if (mod && mod.__esModule) return mod;
29195
+ var result = {};
29196
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
29197
+ __setModuleDefault(result, mod);
29198
+ return result;
29199
+ };
29200
+ })();
29152
29201
  Object.defineProperty(exports, "__esModule", ({ value: true }));
29153
29202
  exports.AttributeChain = void 0;
29203
+ const nodes_1 = __webpack_require__(/*! ../../nodes */ "../core/build/src/abap/nodes/index.js");
29204
+ const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
29154
29205
  const void_type_1 = __webpack_require__(/*! ../../types/basic/void_type */ "../core/build/src/abap/types/basic/void_type.js");
29155
- const object_reference_type_1 = __webpack_require__(/*! ../../types/basic/object_reference_type */ "../core/build/src/abap/types/basic/object_reference_type.js");
29206
+ const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
29156
29207
  const _object_oriented_1 = __webpack_require__(/*! ../_object_oriented */ "../core/build/src/abap/5_syntax/_object_oriented.js");
29157
29208
  const expressions_1 = __webpack_require__(/*! ../../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js");
29158
29209
  const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
29210
+ const component_name_1 = __webpack_require__(/*! ./component_name */ "../core/build/src/abap/5_syntax/expressions/component_name.js");
29211
+ const attribute_name_1 = __webpack_require__(/*! ./attribute_name */ "../core/build/src/abap/5_syntax/expressions/attribute_name.js");
29212
+ const table_expression_1 = __webpack_require__(/*! ./table_expression */ "../core/build/src/abap/5_syntax/expressions/table_expression.js");
29213
+ const field_offset_1 = __webpack_require__(/*! ./field_offset */ "../core/build/src/abap/5_syntax/expressions/field_offset.js");
29214
+ const field_length_1 = __webpack_require__(/*! ./field_length */ "../core/build/src/abap/5_syntax/expressions/field_length.js");
29159
29215
  class AttributeChain {
29160
29216
  static runSyntax(inputContext, node, input, type) {
29161
29217
  if (inputContext instanceof void_type_1.VoidType) {
29162
29218
  return inputContext;
29163
29219
  }
29164
- else if (!(inputContext instanceof object_reference_type_1.ObjectReferenceType)) {
29220
+ else if (!(inputContext instanceof basic_1.ObjectReferenceType)) {
29165
29221
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), "Not an object reference(AttributeChain)"));
29166
29222
  return void_type_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
29167
29223
  }
@@ -29191,8 +29247,69 @@ class AttributeChain {
29191
29247
  for (const t of type) {
29192
29248
  input.scope.addReference(nameToken, context, t, input.filename);
29193
29249
  }
29194
- // todo, loop, handle ArrowOrDash, ComponentName, TableExpression
29195
- return context.getType();
29250
+ let contextType = context.getType();
29251
+ const children = node.getChildren();
29252
+ for (let i = 1; i < children.length; i++) {
29253
+ const child = children[i];
29254
+ if (contextType instanceof void_type_1.VoidType || contextType instanceof basic_1.UnknownType) {
29255
+ return contextType;
29256
+ }
29257
+ else if (child.get() instanceof Expressions.ArrowOrDash) {
29258
+ const operator = child.getFirstToken().getStr();
29259
+ if (operator === "-" && !(contextType instanceof basic_1.StructureType)) {
29260
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, child.getFirstToken(), "AttributeChain, not a structure"));
29261
+ return void_type_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
29262
+ }
29263
+ else if ((operator === "->" || operator === "=>")
29264
+ && !(contextType instanceof basic_1.ObjectReferenceType)
29265
+ && !(contextType instanceof basic_1.DataReference)) {
29266
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, child.getFirstToken(), "AttributeChain, not a reference"));
29267
+ return void_type_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
29268
+ }
29269
+ }
29270
+ else if (child.get() instanceof Expressions.ComponentName) {
29271
+ if (contextType instanceof basic_1.ObjectReferenceType || contextType instanceof basic_1.DataReference) {
29272
+ contextType = attribute_name_1.AttributeName.runSyntax(contextType, child, input, type);
29273
+ }
29274
+ else {
29275
+ contextType = component_name_1.ComponentName.runSyntax(contextType, child, input);
29276
+ }
29277
+ }
29278
+ else if (child.getFirstToken().getStr() === "*" && contextType instanceof basic_1.DataReference) {
29279
+ contextType = contextType.getType();
29280
+ }
29281
+ else if (child instanceof nodes_1.ExpressionNode && child.get() instanceof Expressions.TableExpression) {
29282
+ if (!(contextType instanceof basic_1.TableType)) {
29283
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, child.getFirstToken(), "Table expression, expected table"));
29284
+ return void_type_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
29285
+ }
29286
+ table_expression_1.TableExpression.runSyntax(child, input, contextType);
29287
+ contextType = contextType.getRowType();
29288
+ }
29289
+ else if (child instanceof nodes_1.ExpressionNode && child.get() instanceof Expressions.FieldOffset) {
29290
+ const offset = field_offset_1.FieldOffset.runSyntax(child, input);
29291
+ if (offset !== undefined) {
29292
+ if (contextType instanceof basic_1.CharacterType) {
29293
+ contextType = new basic_1.CharacterType(contextType.getLength() - offset);
29294
+ }
29295
+ else if (contextType instanceof basic_1.HexType) {
29296
+ contextType = new basic_1.HexType(contextType.getLength() - offset);
29297
+ }
29298
+ }
29299
+ }
29300
+ else if (child instanceof nodes_1.ExpressionNode && child.get() instanceof Expressions.FieldLength) {
29301
+ const length = field_length_1.FieldLength.runSyntax(child, input);
29302
+ if (length !== undefined) {
29303
+ if (contextType instanceof basic_1.CharacterType) {
29304
+ contextType = new basic_1.CharacterType(length);
29305
+ }
29306
+ else if (contextType instanceof basic_1.HexType) {
29307
+ contextType = new basic_1.HexType(length);
29308
+ }
29309
+ }
29310
+ }
29311
+ }
29312
+ return contextType;
29196
29313
  }
29197
29314
  }
29198
29315
  exports.AttributeChain = AttributeChain;
@@ -32168,6 +32285,11 @@ class MethodCallChain {
32168
32285
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, methodToken, message));
32169
32286
  return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
32170
32287
  }
32288
+ if (current === first && (method === null || method === void 0 ? void 0 : method.isStatic()) === false && input.scope.isInStaticMethod() === true) {
32289
+ const message = "Method \"" + methodName + "\" not static";
32290
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, methodToken, message));
32291
+ return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
32292
+ }
32171
32293
  const voidedName = context instanceof basic_1.VoidType ? context.getVoided() : undefined;
32172
32294
  const extra = helper.methodReferenceExtras(foundDef, className || voidedName);
32173
32295
  input.scope.addReference(methodToken, method, _reference_1.ReferenceType.MethodReference, input.filename, extra);
@@ -32958,9 +33080,11 @@ class MethodSource {
32958
33080
  throw new assert_error_1.AssertError("MethodSource, first child expected");
32959
33081
  }
32960
33082
  let context = this.findTop(first, input, children);
33083
+ let implicitMe = false;
32961
33084
  if (context === undefined) {
32962
33085
  context = (_a = input.scope.findVariable("me")) === null || _a === void 0 ? void 0 : _a.getType();
32963
33086
  children.unshift(first);
33087
+ implicitMe = true;
32964
33088
  }
32965
33089
  if (input.scope.getLanguageVersion() === version_1.LanguageVersion.Cloud
32966
33090
  && first.get() instanceof Expressions.Dynamic
@@ -33020,6 +33144,11 @@ class MethodSource {
33020
33144
  const def = input.scope.findObjectDefinition(className);
33021
33145
  // eslint-disable-next-line prefer-const
33022
33146
  let { method, def: foundDef } = helper.searchMethodName(def, methodName);
33147
+ if (implicitMe && current === first && (method === null || method === void 0 ? void 0 : method.isStatic()) === false && input.scope.isInStaticMethod() === true) {
33148
+ const message = "Method \"" + methodName + "\" not static";
33149
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, methodToken, message));
33150
+ return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
33151
+ }
33023
33152
  if (method === undefined && (methodName === null || methodName === void 0 ? void 0 : methodName.toUpperCase()) === "CONSTRUCTOR") {
33024
33153
  context = basic_1.VoidType.get("CONSTRUCTOR"); // todo, this is a workaround, constructors always exists
33025
33154
  }
@@ -51582,6 +51711,8 @@ class ClassDefinition extends _identifier_1.Identifier {
51582
51711
  // perform checks after everything has been initialized
51583
51712
  this.checkInterfaceVisibility(input, node);
51584
51713
  this.checkMethodsFromSuperClasses(input);
51714
+ this.checkMethodNameConflicts(input);
51715
+ this.checkEventNameConflicts(input);
51585
51716
  this.checkClassNameLength(input);
51586
51717
  this.checkMethodNameLength(input);
51587
51718
  this.checkClassConstructorStatic(input);
@@ -51713,6 +51844,23 @@ class ClassDefinition extends _identifier_1.Identifier {
51713
51844
  }
51714
51845
  }
51715
51846
  }
51847
+ checkMethodNameConflicts(input) {
51848
+ for (const m of this.methodDefs.getAll()) {
51849
+ if (this.attributes.findByName(m.getName()) !== undefined
51850
+ || this.types.getByName(m.getName()) !== undefined) {
51851
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, m.getToken(), `"${m.getName()}" already defined`));
51852
+ }
51853
+ }
51854
+ }
51855
+ checkEventNameConflicts(input) {
51856
+ for (const e of this.events) {
51857
+ if (this.attributes.findByName(e.getName()) !== undefined
51858
+ || this.types.getByName(e.getName()) !== undefined
51859
+ || this.methodDefs.getByName(e.getName()) !== undefined) {
51860
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, e.getToken(), `"${e.getName()}" already defined`));
51861
+ }
51862
+ }
51863
+ }
51716
51864
  findFriends(def, input) {
51717
51865
  var _a;
51718
51866
  const result = [];
@@ -69513,7 +69661,7 @@ class Registry {
69513
69661
  }
69514
69662
  static abaplintVersion() {
69515
69663
  // magic, see build script "version.js"
69516
- return "2.120.19";
69664
+ return "2.120.21";
69517
69665
  }
69518
69666
  getDDICReferences() {
69519
69667
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.19",
3
+ "version": "2.120.21",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "scripts": {
10
10
  "lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
11
- "clean": "rm -rf build",
11
+ "clean": "rimraf build",
12
12
  "compile": "npm run clean && tsc",
13
13
  "test": "npm run compile && mocha && npm run lint && npm run webpack",
14
14
  "webpack": "webpack --progress",
@@ -26,7 +26,7 @@
26
26
  "url": "git+https://github.com/abaplint/abaplint.git"
27
27
  },
28
28
  "engines": {
29
- "node": ">=18.0.0"
29
+ "node": ">=22.0.0"
30
30
  },
31
31
  "keywords": [
32
32
  "ABAP",
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "homepage": "https://abaplint.org",
41
41
  "devDependencies": {
42
- "@abaplint/core": "^2.120.19",
42
+ "@abaplint/core": "^2.120.21",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",
@@ -55,6 +55,7 @@
55
55
  "mocha": "^11.7.6",
56
56
  "p-limit": "^3.1.0",
57
57
  "progress": "^2.0.3",
58
+ "rimraf": "^6.1.3",
58
59
  "typescript": "^7.0.2",
59
60
  "webpack": "^5.107.2",
60
61
  "webpack-cli": "^7.0.3",