@abaplint/cli 2.120.19 → 2.120.20
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.
- package/build/cli.js +143 -6
- package/package.json +5 -4
package/build/cli.js
CHANGED
|
@@ -26422,6 +26422,20 @@ class CurrentScope {
|
|
|
26422
26422
|
}
|
|
26423
26423
|
return false;
|
|
26424
26424
|
}
|
|
26425
|
+
isInStaticMethod() {
|
|
26426
|
+
let curr = this.current;
|
|
26427
|
+
while (curr !== undefined) {
|
|
26428
|
+
const stype = curr.getIdentifier().stype;
|
|
26429
|
+
if (stype === _scope_type_1.ScopeType.MethodInstance) {
|
|
26430
|
+
return false;
|
|
26431
|
+
}
|
|
26432
|
+
else if (stype === _scope_type_1.ScopeType.ClassImplementation) {
|
|
26433
|
+
return true;
|
|
26434
|
+
}
|
|
26435
|
+
curr = curr.getParent();
|
|
26436
|
+
}
|
|
26437
|
+
return false;
|
|
26438
|
+
}
|
|
26425
26439
|
addLocalFriend(className, friendName) {
|
|
26426
26440
|
var _a;
|
|
26427
26441
|
const key = className.toUpperCase();
|
|
@@ -27787,7 +27801,8 @@ class TypeUtils {
|
|
|
27787
27801
|
}
|
|
27788
27802
|
}
|
|
27789
27803
|
else if (source instanceof basic_1.XStringType) {
|
|
27790
|
-
if (target instanceof basic_1.
|
|
27804
|
+
if (target instanceof basic_1.CharacterType
|
|
27805
|
+
|| target instanceof basic_1.CLikeType
|
|
27791
27806
|
|| target instanceof basic_1.IntegerType
|
|
27792
27807
|
|| target instanceof basic_1.StringType
|
|
27793
27808
|
|| target instanceof basic_1.ObjectReferenceType
|
|
@@ -29149,19 +29164,59 @@ function checkOffsetLength(source, sourceType, method, input) {
|
|
|
29149
29164
|
|
|
29150
29165
|
"use strict";
|
|
29151
29166
|
|
|
29167
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
29168
|
+
if (k2 === undefined) k2 = k;
|
|
29169
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
29170
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
29171
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
29172
|
+
}
|
|
29173
|
+
Object.defineProperty(o, k2, desc);
|
|
29174
|
+
}) : (function(o, m, k, k2) {
|
|
29175
|
+
if (k2 === undefined) k2 = k;
|
|
29176
|
+
o[k2] = m[k];
|
|
29177
|
+
}));
|
|
29178
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29179
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
29180
|
+
}) : function(o, v) {
|
|
29181
|
+
o["default"] = v;
|
|
29182
|
+
});
|
|
29183
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
29184
|
+
var ownKeys = function(o) {
|
|
29185
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
29186
|
+
var ar = [];
|
|
29187
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29188
|
+
return ar;
|
|
29189
|
+
};
|
|
29190
|
+
return ownKeys(o);
|
|
29191
|
+
};
|
|
29192
|
+
return function (mod) {
|
|
29193
|
+
if (mod && mod.__esModule) return mod;
|
|
29194
|
+
var result = {};
|
|
29195
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
29196
|
+
__setModuleDefault(result, mod);
|
|
29197
|
+
return result;
|
|
29198
|
+
};
|
|
29199
|
+
})();
|
|
29152
29200
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
29153
29201
|
exports.AttributeChain = void 0;
|
|
29202
|
+
const nodes_1 = __webpack_require__(/*! ../../nodes */ "../core/build/src/abap/nodes/index.js");
|
|
29203
|
+
const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
29154
29204
|
const void_type_1 = __webpack_require__(/*! ../../types/basic/void_type */ "../core/build/src/abap/types/basic/void_type.js");
|
|
29155
|
-
const
|
|
29205
|
+
const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
29156
29206
|
const _object_oriented_1 = __webpack_require__(/*! ../_object_oriented */ "../core/build/src/abap/5_syntax/_object_oriented.js");
|
|
29157
29207
|
const expressions_1 = __webpack_require__(/*! ../../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js");
|
|
29158
29208
|
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
29209
|
+
const component_name_1 = __webpack_require__(/*! ./component_name */ "../core/build/src/abap/5_syntax/expressions/component_name.js");
|
|
29210
|
+
const attribute_name_1 = __webpack_require__(/*! ./attribute_name */ "../core/build/src/abap/5_syntax/expressions/attribute_name.js");
|
|
29211
|
+
const table_expression_1 = __webpack_require__(/*! ./table_expression */ "../core/build/src/abap/5_syntax/expressions/table_expression.js");
|
|
29212
|
+
const field_offset_1 = __webpack_require__(/*! ./field_offset */ "../core/build/src/abap/5_syntax/expressions/field_offset.js");
|
|
29213
|
+
const field_length_1 = __webpack_require__(/*! ./field_length */ "../core/build/src/abap/5_syntax/expressions/field_length.js");
|
|
29159
29214
|
class AttributeChain {
|
|
29160
29215
|
static runSyntax(inputContext, node, input, type) {
|
|
29161
29216
|
if (inputContext instanceof void_type_1.VoidType) {
|
|
29162
29217
|
return inputContext;
|
|
29163
29218
|
}
|
|
29164
|
-
else if (!(inputContext instanceof
|
|
29219
|
+
else if (!(inputContext instanceof basic_1.ObjectReferenceType)) {
|
|
29165
29220
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), "Not an object reference(AttributeChain)"));
|
|
29166
29221
|
return void_type_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
29167
29222
|
}
|
|
@@ -29191,8 +29246,69 @@ class AttributeChain {
|
|
|
29191
29246
|
for (const t of type) {
|
|
29192
29247
|
input.scope.addReference(nameToken, context, t, input.filename);
|
|
29193
29248
|
}
|
|
29194
|
-
|
|
29195
|
-
|
|
29249
|
+
let contextType = context.getType();
|
|
29250
|
+
const children = node.getChildren();
|
|
29251
|
+
for (let i = 1; i < children.length; i++) {
|
|
29252
|
+
const child = children[i];
|
|
29253
|
+
if (contextType instanceof void_type_1.VoidType || contextType instanceof basic_1.UnknownType) {
|
|
29254
|
+
return contextType;
|
|
29255
|
+
}
|
|
29256
|
+
else if (child.get() instanceof Expressions.ArrowOrDash) {
|
|
29257
|
+
const operator = child.getFirstToken().getStr();
|
|
29258
|
+
if (operator === "-" && !(contextType instanceof basic_1.StructureType)) {
|
|
29259
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, child.getFirstToken(), "AttributeChain, not a structure"));
|
|
29260
|
+
return void_type_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
29261
|
+
}
|
|
29262
|
+
else if ((operator === "->" || operator === "=>")
|
|
29263
|
+
&& !(contextType instanceof basic_1.ObjectReferenceType)
|
|
29264
|
+
&& !(contextType instanceof basic_1.DataReference)) {
|
|
29265
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, child.getFirstToken(), "AttributeChain, not a reference"));
|
|
29266
|
+
return void_type_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
29267
|
+
}
|
|
29268
|
+
}
|
|
29269
|
+
else if (child.get() instanceof Expressions.ComponentName) {
|
|
29270
|
+
if (contextType instanceof basic_1.ObjectReferenceType || contextType instanceof basic_1.DataReference) {
|
|
29271
|
+
contextType = attribute_name_1.AttributeName.runSyntax(contextType, child, input, type);
|
|
29272
|
+
}
|
|
29273
|
+
else {
|
|
29274
|
+
contextType = component_name_1.ComponentName.runSyntax(contextType, child, input);
|
|
29275
|
+
}
|
|
29276
|
+
}
|
|
29277
|
+
else if (child.getFirstToken().getStr() === "*" && contextType instanceof basic_1.DataReference) {
|
|
29278
|
+
contextType = contextType.getType();
|
|
29279
|
+
}
|
|
29280
|
+
else if (child instanceof nodes_1.ExpressionNode && child.get() instanceof Expressions.TableExpression) {
|
|
29281
|
+
if (!(contextType instanceof basic_1.TableType)) {
|
|
29282
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, child.getFirstToken(), "Table expression, expected table"));
|
|
29283
|
+
return void_type_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
29284
|
+
}
|
|
29285
|
+
table_expression_1.TableExpression.runSyntax(child, input, contextType);
|
|
29286
|
+
contextType = contextType.getRowType();
|
|
29287
|
+
}
|
|
29288
|
+
else if (child instanceof nodes_1.ExpressionNode && child.get() instanceof Expressions.FieldOffset) {
|
|
29289
|
+
const offset = field_offset_1.FieldOffset.runSyntax(child, input);
|
|
29290
|
+
if (offset !== undefined) {
|
|
29291
|
+
if (contextType instanceof basic_1.CharacterType) {
|
|
29292
|
+
contextType = new basic_1.CharacterType(contextType.getLength() - offset);
|
|
29293
|
+
}
|
|
29294
|
+
else if (contextType instanceof basic_1.HexType) {
|
|
29295
|
+
contextType = new basic_1.HexType(contextType.getLength() - offset);
|
|
29296
|
+
}
|
|
29297
|
+
}
|
|
29298
|
+
}
|
|
29299
|
+
else if (child instanceof nodes_1.ExpressionNode && child.get() instanceof Expressions.FieldLength) {
|
|
29300
|
+
const length = field_length_1.FieldLength.runSyntax(child, input);
|
|
29301
|
+
if (length !== undefined) {
|
|
29302
|
+
if (contextType instanceof basic_1.CharacterType) {
|
|
29303
|
+
contextType = new basic_1.CharacterType(length);
|
|
29304
|
+
}
|
|
29305
|
+
else if (contextType instanceof basic_1.HexType) {
|
|
29306
|
+
contextType = new basic_1.HexType(length);
|
|
29307
|
+
}
|
|
29308
|
+
}
|
|
29309
|
+
}
|
|
29310
|
+
}
|
|
29311
|
+
return contextType;
|
|
29196
29312
|
}
|
|
29197
29313
|
}
|
|
29198
29314
|
exports.AttributeChain = AttributeChain;
|
|
@@ -32168,6 +32284,11 @@ class MethodCallChain {
|
|
|
32168
32284
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, methodToken, message));
|
|
32169
32285
|
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
32170
32286
|
}
|
|
32287
|
+
if (current === first && (method === null || method === void 0 ? void 0 : method.isStatic()) === false && input.scope.isInStaticMethod() === true) {
|
|
32288
|
+
const message = "Method \"" + methodName + "\" not static";
|
|
32289
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, methodToken, message));
|
|
32290
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
32291
|
+
}
|
|
32171
32292
|
const voidedName = context instanceof basic_1.VoidType ? context.getVoided() : undefined;
|
|
32172
32293
|
const extra = helper.methodReferenceExtras(foundDef, className || voidedName);
|
|
32173
32294
|
input.scope.addReference(methodToken, method, _reference_1.ReferenceType.MethodReference, input.filename, extra);
|
|
@@ -32958,9 +33079,11 @@ class MethodSource {
|
|
|
32958
33079
|
throw new assert_error_1.AssertError("MethodSource, first child expected");
|
|
32959
33080
|
}
|
|
32960
33081
|
let context = this.findTop(first, input, children);
|
|
33082
|
+
let implicitMe = false;
|
|
32961
33083
|
if (context === undefined) {
|
|
32962
33084
|
context = (_a = input.scope.findVariable("me")) === null || _a === void 0 ? void 0 : _a.getType();
|
|
32963
33085
|
children.unshift(first);
|
|
33086
|
+
implicitMe = true;
|
|
32964
33087
|
}
|
|
32965
33088
|
if (input.scope.getLanguageVersion() === version_1.LanguageVersion.Cloud
|
|
32966
33089
|
&& first.get() instanceof Expressions.Dynamic
|
|
@@ -33020,6 +33143,11 @@ class MethodSource {
|
|
|
33020
33143
|
const def = input.scope.findObjectDefinition(className);
|
|
33021
33144
|
// eslint-disable-next-line prefer-const
|
|
33022
33145
|
let { method, def: foundDef } = helper.searchMethodName(def, methodName);
|
|
33146
|
+
if (implicitMe && current === first && (method === null || method === void 0 ? void 0 : method.isStatic()) === false && input.scope.isInStaticMethod() === true) {
|
|
33147
|
+
const message = "Method \"" + methodName + "\" not static";
|
|
33148
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, methodToken, message));
|
|
33149
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
33150
|
+
}
|
|
33023
33151
|
if (method === undefined && (methodName === null || methodName === void 0 ? void 0 : methodName.toUpperCase()) === "CONSTRUCTOR") {
|
|
33024
33152
|
context = basic_1.VoidType.get("CONSTRUCTOR"); // todo, this is a workaround, constructors always exists
|
|
33025
33153
|
}
|
|
@@ -51582,6 +51710,7 @@ class ClassDefinition extends _identifier_1.Identifier {
|
|
|
51582
51710
|
// perform checks after everything has been initialized
|
|
51583
51711
|
this.checkInterfaceVisibility(input, node);
|
|
51584
51712
|
this.checkMethodsFromSuperClasses(input);
|
|
51713
|
+
this.checkMethodNameConflicts(input);
|
|
51585
51714
|
this.checkClassNameLength(input);
|
|
51586
51715
|
this.checkMethodNameLength(input);
|
|
51587
51716
|
this.checkClassConstructorStatic(input);
|
|
@@ -51713,6 +51842,14 @@ class ClassDefinition extends _identifier_1.Identifier {
|
|
|
51713
51842
|
}
|
|
51714
51843
|
}
|
|
51715
51844
|
}
|
|
51845
|
+
checkMethodNameConflicts(input) {
|
|
51846
|
+
for (const m of this.methodDefs.getAll()) {
|
|
51847
|
+
if (this.attributes.findByName(m.getName()) !== undefined
|
|
51848
|
+
|| this.types.getByName(m.getName()) !== undefined) {
|
|
51849
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, m.getToken(), `"${m.getName()}" already defined`));
|
|
51850
|
+
}
|
|
51851
|
+
}
|
|
51852
|
+
}
|
|
51716
51853
|
findFriends(def, input) {
|
|
51717
51854
|
var _a;
|
|
51718
51855
|
const result = [];
|
|
@@ -69513,7 +69650,7 @@ class Registry {
|
|
|
69513
69650
|
}
|
|
69514
69651
|
static abaplintVersion() {
|
|
69515
69652
|
// magic, see build script "version.js"
|
|
69516
|
-
return "2.120.
|
|
69653
|
+
return "2.120.20";
|
|
69517
69654
|
}
|
|
69518
69655
|
getDDICReferences() {
|
|
69519
69656
|
return this.ddicReferences;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/cli",
|
|
3
|
-
"version": "2.120.
|
|
3
|
+
"version": "2.120.20",
|
|
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": "
|
|
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": ">=
|
|
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.
|
|
42
|
+
"@abaplint/core": "^2.120.20",
|
|
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",
|