@abaplint/core 2.113.219 → 2.113.221

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.
@@ -5,7 +5,7 @@ const combi_1 = require("../combi");
5
5
  const tokens_1 = require("../../1_lexer/tokens");
6
6
  class ReportName extends combi_1.Expression {
7
7
  getRunnable() {
8
- return (0, combi_1.seq)((0, combi_1.regex)(/^[\w/$%]+$/), (0, combi_1.star)((0, combi_1.seq)((0, combi_1.tok)(tokens_1.Dash), (0, combi_1.regex)(/^\w+$/))));
8
+ return (0, combi_1.seq)((0, combi_1.regex)(/^[\w/$%&]+$/), (0, combi_1.star)((0, combi_1.seq)((0, combi_1.tok)(tokens_1.Dash), (0, combi_1.regex)(/^\w+$/))));
9
9
  }
10
10
  }
11
11
  exports.ReportName = ReportName;
@@ -11,13 +11,14 @@ const sql_field_name_1 = require("./sql_field_name");
11
11
  const sql_source_1 = require("./sql_source");
12
12
  class SQLCase extends combi_1.Expression {
13
13
  getRunnable() {
14
+ const abap = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), _1.SimpleFieldChain2);
14
15
  const field = (0, combi_1.altPrio)(_1.SQLAggregation, SQLCase, _1.SQLFunction, _1.SQLPath, sql_field_name_1.SQLFieldName, constant_1.Constant);
15
16
  const sub = (0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/", "&&"), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenLeftW)), field, (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)));
16
17
  const sourc = (0, combi_1.altPrio)(SQLCase, _1.SQLAggregation, _1.SQLFunction, sql_source_1.SQLSource, constant_1.Constant);
17
- const val = (0, combi_1.altPrio)(sql_cond_1.SQLCond, constant_1.Constant, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), _1.SimpleSource3));
18
+ const val = (0, combi_1.altPrio)(sql_cond_1.SQLCond, constant_1.Constant, abap);
18
19
  const when = (0, combi_1.seq)("WHEN", val, "THEN", sourc, (0, combi_1.starPrio)(sub));
19
20
  const els = (0, combi_1.seq)("ELSE", sourc);
20
- return (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)("CASE", (0, combi_1.opt)(sql_field_name_1.SQLFieldName), (0, combi_1.plusPrio)(when), (0, combi_1.optPrio)(els), "END"));
21
+ return (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)("CASE", (0, combi_1.opt)((0, combi_1.altPrio)(sql_field_name_1.SQLFieldName, abap)), (0, combi_1.plusPrio)(when), (0, combi_1.optPrio)(els), "END"));
21
22
  }
22
23
  }
23
24
  exports.SQLCase = SQLCase;
@@ -15,7 +15,8 @@ class ModifyEntities {
15
15
  const updateFrom = (0, combi_1.seq)("UPDATE FROM", expressions_1.Source, (0, combi_1.opt)(relating));
16
16
  const deleteFrom = (0, combi_1.seq)("DELETE FROM", expressions_1.Source);
17
17
  const updateFields = (0, combi_1.seq)("UPDATE", fieldsWith);
18
- const operation = (0, combi_1.alt)((0, combi_1.seq)("UPDATE SET FIELDS WITH", expressions_1.Source), (0, combi_1.seq)("CREATE SET FIELDS WITH", expressions_1.Source), updateFields, deleteFrom, updateFrom, create, execute, (0, combi_1.seq)("CREATE", (0, combi_1.opt)(by), (0, combi_1.optPrio)("AUTO FILL CID"), (0, combi_1.altPrio)(withh, fieldsWith)));
18
+ const updateSetFields = (0, combi_1.seq)("UPDATE SET FIELDS WITH", expressions_1.Source);
19
+ const operation = (0, combi_1.alt)(updateSetFields, (0, combi_1.seq)("CREATE SET FIELDS WITH", expressions_1.Source), updateFields, deleteFrom, updateFrom, create, execute, (0, combi_1.seq)("CREATE", (0, combi_1.opt)(by), (0, combi_1.optPrio)("AUTO FILL CID"), (0, combi_1.altPrio)(withh, fieldsWith)));
19
20
  const failed = (0, combi_1.seq)("FAILED", expressions_1.Target);
20
21
  const result = (0, combi_1.seq)("RESULT", expressions_1.Target);
21
22
  const mapped = (0, combi_1.seq)("MAPPED", expressions_1.Target);
@@ -25,7 +26,7 @@ class ModifyEntities {
25
26
  const create2 = (0, combi_1.seq)("CREATE", fieldsWith, (0, combi_1.opt)((0, combi_1.seq)("CREATE BY", expressions_1.AssociationName, fieldsWith)));
26
27
  const create3 = (0, combi_1.seq)("CREATE BY", expressions_1.AssociationName, fieldsWith);
27
28
  const create4 = (0, combi_1.seq)("CREATE FROM", expressions_1.Source, (0, combi_1.plus)((0, combi_1.seq)("CREATE BY", expressions_1.AssociationName, "FROM", expressions_1.Source)));
28
- 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, updateFrom, create2, create3, create4));
29
+ 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));
29
30
  return (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)("MODIFY", (0, combi_1.alt)(entities, entity), end));
30
31
  }
31
32
  }
@@ -13,7 +13,8 @@ class ReadEntities {
13
13
  const result = (0, combi_1.seq)("RESULT", expressions_1.Target);
14
14
  const failed = (0, combi_1.seq)("FAILED", expressions_1.Target);
15
15
  const reported = (0, combi_1.seq)("REPORTED", expressions_1.Target);
16
- const entity = (0, combi_1.seq)("ENTITY", expressions_1.NamespaceSimpleName, (0, combi_1.opt)((0, combi_1.seq)("BY", expressions_1.AssociationName)), (0, combi_1.alt)(fields, from, all), (0, combi_1.optPrio)(result));
16
+ const foo = (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.seq)("BY", expressions_1.AssociationName)), (0, combi_1.alt)(fields, from, all), (0, combi_1.optPrio)(result));
17
+ const entity = (0, combi_1.seq)("ENTITY", expressions_1.NamespaceSimpleName, (0, combi_1.plus)(foo));
17
18
  const s = (0, combi_1.seq)("ENTITIES OF", expressions_1.NamespaceSimpleName, (0, combi_1.opt)("IN LOCAL MODE"), (0, combi_1.plus)(entity), (0, combi_1.optPrio)((0, combi_1.seq)("LINK", expressions_1.Target)), (0, combi_1.optPrio)((0, combi_1.per)(failed, reported)));
18
19
  const byall = (0, combi_1.seq)("BY", expressions_1.AssociationName, all);
19
20
  const by = (0, combi_1.seq)("BY", expressions_1.AssociationName, fields);
@@ -29,11 +29,13 @@ class Submit {
29
29
  const cover = (0, combi_1.seq)("SAP COVER PAGE", expressions_1.Source);
30
30
  const copies = (0, combi_1.seq)("COPIES", expressions_1.Source);
31
31
  const datasetExpiration = (0, combi_1.seq)("DATASET EXPIRATION", expressions_1.Source);
32
+ const coverText = (0, combi_1.seq)("COVER TEXT", expressions_1.Source);
33
+ const listName = (0, combi_1.seq)("LIST NAME", expressions_1.Source);
32
34
  const keep = (0, combi_1.seq)("KEEP IN SPOOL", expressions_1.Source);
33
35
  const imm = (0, combi_1.seq)("IMMEDIATELY", expressions_1.Source);
34
36
  const dest = (0, combi_1.seq)("DESTINATION", expressions_1.Source);
35
37
  const language = (0, combi_1.seq)("LANGUAGE", expressions_1.Source);
36
- const perm = (0, combi_1.per)((0, combi_1.plus)(awith), selectionTable, (0, combi_1.plus)(awith), spool, lineSize, lineCount, archive, user, sset, ssetp, keep, cover, imm, layout, dest, language, free, newList, uss, copies, datasetExpiration, "TO SAP-SPOOL", "WITHOUT SPOOL DYNPRO", "VIA SELECTION-SCREEN", exporting, expressions_1.AndReturn, job);
38
+ const perm = (0, combi_1.per)((0, combi_1.plus)(awith), selectionTable, (0, combi_1.plus)(awith), spool, lineSize, lineCount, archive, user, sset, ssetp, keep, cover, imm, layout, dest, coverText, listName, language, free, newList, uss, copies, datasetExpiration, "TO SAP-SPOOL", "WITHOUT SPOOL DYNPRO", "VIA SELECTION-SCREEN", exporting, expressions_1.AndReturn, job);
37
39
  const ret = (0, combi_1.seq)("SUBMIT", prog, (0, combi_1.opt)(perm));
38
40
  return (0, combi_1.verNot)(version_1.Version.Cloud, ret);
39
41
  }
@@ -364,7 +364,9 @@ class BuiltIn {
364
364
  // https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abennews-610-system.htm
365
365
  const id3 = new tokens_1.Identifier(new position_1.Position(this.row++, 1), "sy-repid");
366
366
  const syrepid = new _typed_identifier_1.TypedIdentifier(id3, BuiltIn.filename, new basic_1.CharacterType(40, { qualifiedName: "sy-repid" }), ["read_only" /* IdentifierMeta.ReadOnly */, "built-in" /* IdentifierMeta.BuiltIn */]);
367
- return [sy, syst, syrepid];
367
+ const id4 = new tokens_1.Identifier(new position_1.Position(this.row++, 1), "syst-repid");
368
+ const systrepid = new _typed_identifier_1.TypedIdentifier(id4, BuiltIn.filename, new basic_1.CharacterType(40, { qualifiedName: "syst-repid" }), ["read_only" /* IdentifierMeta.ReadOnly */, "built-in" /* IdentifierMeta.BuiltIn */]);
369
+ return [sy, syst, syrepid, systrepid];
368
370
  }
369
371
  buildConstant(name, type, value) {
370
372
  const id = new tokens_1.Identifier(new position_1.Position(this.row++, 1), name);
@@ -422,7 +422,7 @@ class BasicTypes {
422
422
  const name = typename.concatTokens();
423
423
  const type = (_d = this.input.scope.getDDIC().lookupDDLS(name)) === null || _d === void 0 ? void 0 : _d.type;
424
424
  if (type) {
425
- return new Types.TableType(basic_1.VoidType.get("RapTodo"), options);
425
+ return new Types.TableType(basic_1.VoidType.get("RAP-TODO"), options);
426
426
  }
427
427
  else if (this.input.scope.getDDIC().inErrorNamespace(name)) {
428
428
  return new Types.UnknownType(`DDLS ${name} not found`);
@@ -32,7 +32,7 @@ class ClassImplementation {
32
32
  }
33
33
  else {
34
34
  // todo: instead of the void type, do proper typing, ie. only empty constructor method
35
- input.scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(new tokens_1.Identifier(new position_1.Position(1, 1), "super"), _builtin_1.BuiltIn.filename, basic_1.VoidType.get("noSuper")));
35
+ input.scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(new tokens_1.Identifier(new position_1.Position(1, 1), "super"), _builtin_1.BuiltIn.filename, basic_1.VoidType.get("noSuperClass")));
36
36
  }
37
37
  input.scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(new tokens_1.Identifier(new position_1.Position(1, 1), "me"), _builtin_1.BuiltIn.filename, new basic_1.ObjectReferenceType(classDefinition)));
38
38
  helper.addAliasedAttributes(classDefinition); // todo, this is not correct, take care of instance vs static
@@ -7,7 +7,7 @@ const cds_integer_1 = require("./cds_integer");
7
7
  class CDSArithmetics extends combi_1.Expression {
8
8
  getRunnable() {
9
9
  const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.optPrio)((0, combi_1.seq)(".", _1.CDSName)));
10
- const val = (0, combi_1.altPrio)(cds_integer_1.CDSInteger, _1.CDSFunction, _1.CDSCase, _1.CDSCast, _1.CDSString, name);
10
+ const val = (0, combi_1.altPrio)(cds_integer_1.CDSInteger, _1.CDSFunction, _1.CDSCase, _1.CDSCast, _1.CDSString, _1.CDSAggregate, name);
11
11
  const operator = (0, combi_1.altPrio)("+", "-", "*", "/");
12
12
  const operatorValue = (0, combi_1.seq)(operator, val);
13
13
  const paren = (0, combi_1.seq)("(", val, (0, combi_1.plusPrio)(operatorValue), ")");
@@ -6,7 +6,8 @@ const combi_1 = require("../../abap/2_statements/combi");
6
6
  class CDSCast extends combi_1.Expression {
7
7
  getRunnable() {
8
8
  const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.starPrio)((0, combi_1.seq)(".", _1.CDSName)));
9
- return (0, combi_1.seq)("CAST", "(", (0, combi_1.altPrio)(_1.CDSFunction, _1.CDSCase, _1.CDSAggregate, _1.CDSArithmetics, CDSCast, _1.CDSString, name), "AS", _1.CDSType, (0, combi_1.optPrio)((0, combi_1.seq)("PRESERVING", "TYPE")), ")");
9
+ const first = (0, combi_1.altPrio)(_1.CDSFunction, _1.CDSCase, _1.CDSAggregate, _1.CDSArithmetics, CDSCast, _1.CDSString, _1.CDSInteger, name);
10
+ return (0, combi_1.seq)("CAST", "(", first, "AS", _1.CDSType, (0, combi_1.optPrio)((0, combi_1.seq)("PRESERVING", "TYPE")), ")");
10
11
  }
11
12
  }
12
13
  exports.CDSCast = CDSCast;
@@ -6,7 +6,7 @@ const combi_1 = require("../../abap/2_statements/combi");
6
6
  class CDSFunctionInput extends combi_1.Expression {
7
7
  getRunnable() {
8
8
  const qualified = (0, combi_1.seq)(_1.CDSName, (0, combi_1.opt)(_1.CDSParameters), (0, combi_1.starPrio)((0, combi_1.seq)(".", _1.CDSName, (0, combi_1.opt)(_1.CDSParameters))));
9
- const input = (0, combi_1.altPrio)(_1.CDSCast, _1.CDSFunction, _1.CDSArithmetics, _1.CDSCase, _1.CDSString, qualified, _1.CDSInteger);
9
+ const input = (0, combi_1.altPrio)(_1.CDSArithmetics, _1.CDSCast, _1.CDSFunction, _1.CDSCase, _1.CDSString, qualified, _1.CDSInteger);
10
10
  return input;
11
11
  }
12
12
  }
@@ -8,7 +8,7 @@ class CDSJoin extends combi_1.Expression {
8
8
  getRunnable() {
9
9
  const cond = (0, combi_1.seq)(_1.CDSSource, "ON", cds_condition_1.CDSCondition);
10
10
  const foo = (0, combi_1.altPrio)((0, combi_1.seq)("(", cond, ")"), cond);
11
- return (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.altPrio)("LEFT OUTER TO ONE", "LEFT OUTER", "INNER", "CROSS")), "JOIN", foo);
11
+ return (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.altPrio)("LEFT OUTER TO ONE", "LEFT OUTER", "INNER", "CROSS", "RIGHT OUTER")), "JOIN", foo);
12
12
  }
13
13
  }
14
14
  exports.CDSJoin = CDSJoin;
@@ -67,7 +67,7 @@ class Registry {
67
67
  }
68
68
  static abaplintVersion() {
69
69
  // magic, see build script "version.sh"
70
- return "2.113.219";
70
+ return "2.113.221";
71
71
  }
72
72
  getDDICReferences() {
73
73
  return this.ddicReferences;
@@ -88,6 +88,7 @@ ENDINTERFACE.`,
88
88
  }
89
89
  issues.push(...this.checkTypes(stru, file));
90
90
  issues.push(...this.checkMethods(stru, file));
91
+ issues.push(...this.checkEvents(stru, file));
91
92
  return issues;
92
93
  }
93
94
  check(fields, column, file) {
@@ -147,6 +148,26 @@ ENDINTERFACE.`,
147
148
  }
148
149
  return issues;
149
150
  }
151
+ checkEvents(stru, file) {
152
+ const issues = [];
153
+ const events = stru.findAllStatements(Statements.Events);
154
+ for (const e of events) {
155
+ const fields = [];
156
+ const params = e.findAllExpressions(Expressions.MethodParam);
157
+ let column = 0;
158
+ for (const p of params) {
159
+ const children = p.getChildren();
160
+ const name = children[children.length - 2];
161
+ fields.push({
162
+ nameEnd: name.getLastToken().getEnd(),
163
+ after: p.findFirstExpression(Expressions.TypeParam).getFirstToken().getStart()
164
+ });
165
+ column = Math.max(column, name.getFirstToken().getEnd().getCol() + 1);
166
+ }
167
+ issues.push(...this.check(fields, column, file));
168
+ }
169
+ return issues;
170
+ }
150
171
  checkTypes(stru, file) {
151
172
  const issues = [];
152
173
  const types = stru.findAllStructuresRecursive(Structures.Types);
@@ -58,6 +58,7 @@ class CloudTypes {
58
58
  || obj instanceof Objects.ApplicationLogObject
59
59
  || obj instanceof Objects.CommunicationScenario
60
60
  || obj instanceof Objects.DataControl
61
+ || obj instanceof Objects.Namespace
61
62
  || obj instanceof Objects.KnowledgeTransferDocument
62
63
  || obj instanceof Objects.DataDefinition
63
64
  || obj instanceof Objects.DataElement
@@ -66,20 +66,51 @@ WRITE 'world'.`,
66
66
  ////////////////
67
67
  analyzeIf(file, node) {
68
68
  var _a;
69
- if (node.getChildren().length !== 4) {
69
+ const ifBody = node.findDirectStructure(Structures.Body);
70
+ const elseIfBodies = node.findDirectStructures(Structures.ElseIf) || [];
71
+ const elseBody = (_a = node.findDirectStructure(Structures.Else)) === null || _a === void 0 ? void 0 : _a.findDirectStructure(Structures.Body);
72
+ if (elseBody === undefined) {
70
73
  return [];
71
74
  }
72
- const ifBody = node.findDirectStructure(Structures.Body);
73
- if (node.findDirectStructure(Structures.ElseIf)) {
75
+ const ifFirst = ifBody === null || ifBody === void 0 ? void 0 : ifBody.getFirstChild();
76
+ const elseFirst = elseBody === null || elseBody === void 0 ? void 0 : elseBody.getFirstChild();
77
+ const ifLast = ifBody === null || ifBody === void 0 ? void 0 : ifBody.getLastChild();
78
+ const elseLast = elseBody === null || elseBody === void 0 ? void 0 : elseBody.getLastChild();
79
+ if (elseIfBodies.length > 0) {
80
+ let firstMatch = true;
81
+ let lastMatch = true;
82
+ for (const elseif of elseIfBodies) {
83
+ const elseifBody = elseif.findDirectStructure(Structures.Body);
84
+ const elseifFirst = elseifBody === null || elseifBody === void 0 ? void 0 : elseifBody.getFirstChild();
85
+ const elseifLast = elseifBody === null || elseifBody === void 0 ? void 0 : elseifBody.getLastChild();
86
+ if (ifFirst === undefined
87
+ || ifLast === undefined
88
+ || elseLast === undefined
89
+ || elseFirst === undefined) {
90
+ return [];
91
+ }
92
+ if (elseifFirst === undefined
93
+ || ifFirst.concatTokens() !== elseifFirst.concatTokens()
94
+ || elseFirst.concatTokens() !== elseifFirst.concatTokens()) {
95
+ firstMatch = false;
96
+ }
97
+ if (elseifLast === undefined
98
+ || ifLast.concatTokens() !== elseifLast.concatTokens()
99
+ || elseLast.concatTokens() !== elseifLast.concatTokens()) {
100
+ lastMatch = false;
101
+ }
102
+ }
103
+ if (firstMatch === true || lastMatch === true) {
104
+ const message = "Identical contents";
105
+ const issue = issue_1.Issue.atToken(file, node.getFirstToken(), message, this.getMetadata().key, this.conf.severity);
106
+ return [issue];
107
+ }
74
108
  return [];
75
109
  }
76
- const elseBody = (_a = node.findDirectStructure(Structures.Else)) === null || _a === void 0 ? void 0 : _a.findDirectStructure(Structures.Body);
77
- if (elseBody === undefined || ifBody === undefined) {
110
+ else if (elseBody === undefined || ifBody === undefined) {
78
111
  return [];
79
112
  }
80
113
  {
81
- const ifFirst = ifBody.getFirstChild();
82
- const elseFirst = elseBody.getFirstChild();
83
114
  if (ifFirst === undefined || elseFirst === undefined || this.isChained(ifFirst)) {
84
115
  return [];
85
116
  }
@@ -90,8 +121,6 @@ WRITE 'world'.`,
90
121
  }
91
122
  }
92
123
  {
93
- const ifLast = ifBody.getLastChild();
94
- const elseLast = elseBody.getLastChild();
95
124
  if (ifLast === undefined || elseLast === undefined || this.isChained(ifLast)) {
96
125
  return [];
97
126
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.113.219",
3
+ "version": "2.113.221",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",