@abaplint/core 2.113.225 → 2.113.227

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.
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FieldGroup = void 0;
4
+ const Expressions = require("../../2_statements/expressions");
5
+ const _typed_identifier_1 = require("../../types/_typed_identifier");
6
+ const basic_1 = require("../../types/basic");
7
+ class FieldGroup {
8
+ runSyntax(node, input) {
9
+ const nameExpression = node.findFirstExpression(Expressions.Field);
10
+ if (nameExpression === undefined) {
11
+ return;
12
+ }
13
+ const name = nameExpression === null || nameExpression === void 0 ? void 0 : nameExpression.concatTokens();
14
+ if (name === undefined) {
15
+ return;
16
+ }
17
+ const id = new _typed_identifier_1.TypedIdentifier(nameExpression === null || nameExpression === void 0 ? void 0 : nameExpression.getFirstToken(), input.filename, basic_1.VoidType.get("FIELD-GROUP"));
18
+ input.scope.addIdentifier(id);
19
+ }
20
+ }
21
+ exports.FieldGroup = FieldGroup;
22
+ //# sourceMappingURL=field_group.js.map
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Free = void 0;
4
+ const Expressions = require("../../2_statements/expressions");
5
+ const target_1 = require("../expressions/target");
6
+ class Free {
7
+ runSyntax(node, input) {
8
+ for (const t of node.findDirectExpressions(Expressions.Target)) {
9
+ target_1.Target.runSyntax(t, input);
10
+ }
11
+ }
12
+ }
13
+ exports.Free = Free;
14
+ //# sourceMappingURL=free.js.map
@@ -9,7 +9,7 @@ const _syntax_input_1 = require("../_syntax_input");
9
9
  const assert_error_1 = require("../assert_error");
10
10
  class IncludeType {
11
11
  runSyntax(node, input) {
12
- var _a, _b, _c;
12
+ var _a, _b, _c, _d, _e;
13
13
  const components = [];
14
14
  const iname = node.findFirstExpression(Expressions.TypeName);
15
15
  if (iname === undefined) {
@@ -24,7 +24,10 @@ class IncludeType {
24
24
  ityp = found;
25
25
  }
26
26
  }
27
- const as = (_b = node.findExpressionAfterToken("AS")) === null || _b === void 0 ? void 0 : _b.concatTokens();
27
+ else if (ityp instanceof basic_1.UnknownType) {
28
+ ityp = (_c = (_b = input.scope.findVariable(name)) === null || _b === void 0 ? void 0 : _b.getType()) !== null && _c !== void 0 ? _c : ityp;
29
+ }
30
+ const as = (_d = node.findExpressionAfterToken("AS")) === null || _d === void 0 ? void 0 : _d.concatTokens();
28
31
  if (as && ityp instanceof basic_1.StructureType) {
29
32
  ityp = new basic_1.StructureType(ityp.getComponents().concat([{
30
33
  name: as,
@@ -35,7 +38,10 @@ class IncludeType {
35
38
  else if (ityp instanceof basic_1.TableType && isStructure) {
36
39
  ityp = ityp.getRowType();
37
40
  }
38
- else if (ityp instanceof basic_1.VoidType) {
41
+ if (ityp instanceof basic_1.VoidType) {
42
+ return ityp;
43
+ }
44
+ else if (ityp instanceof basic_1.UnknownType) {
39
45
  return ityp;
40
46
  }
41
47
  if (!(ityp instanceof basic_1.StructureType)) {
@@ -43,7 +49,7 @@ class IncludeType {
43
49
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, iname.getFirstToken(), message));
44
50
  return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
45
51
  }
46
- const suffix = (_c = node.findExpressionAfterToken("SUFFIX")) === null || _c === void 0 ? void 0 : _c.concatTokens();
52
+ const suffix = (_e = node.findExpressionAfterToken("SUFFIX")) === null || _e === void 0 ? void 0 : _e.concatTokens();
47
53
  if (suffix && ityp instanceof basic_1.StructureType) {
48
54
  const components = [];
49
55
  for (const c of ityp.getComponents()) {
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Refresh = void 0;
4
+ const Expressions = require("../../2_statements/expressions");
5
+ const target_1 = require("../expressions/target");
6
+ class Refresh {
7
+ runSyntax(node, input) {
8
+ for (const t of node.findDirectExpressions(Expressions.Target)) {
9
+ target_1.Target.runSyntax(t, input);
10
+ }
11
+ }
12
+ }
13
+ exports.Refresh = Refresh;
14
+ //# sourceMappingURL=refresh.js.map
@@ -50,46 +50,6 @@ class Data {
50
50
  }
51
51
  else if (c instanceof nodes_1.StatementNode && ctyp instanceof Statements.IncludeType) {
52
52
  // INCLUDES
53
- /*
54
- const typeToken = c.findFirstExpression(Expressions.TypeName)?.getFirstToken();
55
- const typeName = typeToken?.getStr();
56
-
57
- let foundId = input.scope.findType(typeName);
58
- if (foundId === undefined) {
59
- foundId = input.scope.findVariable(typeName);
60
- }
61
-
62
- let found = foundId?.getType();
63
- if (found === undefined) {
64
- const f = input.scope.getDDIC().lookupTableOrView(typeName).type;
65
- if (f instanceof TypedIdentifier) {
66
- found = f.getType();
67
- } else {
68
- found = f;
69
- }
70
- } else {
71
- input.scope.addReference(typeToken, foundId, ReferenceType.TypeReference, input.filename);
72
- }
73
- if (found instanceof Basic.VoidType) {
74
- if (table === true) {
75
- const ttyp = new Basic.TableType(found, {withHeader: true, keyType: Basic.TableKeyType.default});
76
- return new TypedIdentifier(name, input.filename, ttyp);
77
- } else {
78
- return new TypedIdentifier(name, input.filename, found);
79
- }
80
- }
81
- if (found instanceof Basic.UnknownType) {
82
- return new TypedIdentifier(name, input.filename, new Basic.UnknownType("unknown type, " + typeName));
83
- }
84
- if (found instanceof Basic.TableType && found.isWithHeader()) {
85
- found = found.getRowType();
86
- }
87
- if (!(found instanceof Basic.StructureType)) {
88
- const message = "not structured, " + typeName;
89
- input.issues.push(syntaxIssue(input, typeToken!, message));
90
- return new TypedIdentifier(name, input.filename, Basic.VoidType.get(CheckSyntaxKey));
91
- }
92
- */
93
53
  const found = new include_type_1.IncludeType().runSyntax(c, input);
94
54
  if (found instanceof Basic.VoidType) {
95
55
  if (table === true) {
@@ -100,6 +60,9 @@ class Data {
100
60
  return new _typed_identifier_1.TypedIdentifier(name, input.filename, found);
101
61
  }
102
62
  }
63
+ else if (found instanceof Basic.UnknownType) {
64
+ return new _typed_identifier_1.TypedIdentifier(name, input.filename, found);
65
+ }
103
66
  for (const c of found) {
104
67
  components.push(c);
105
68
  }
@@ -30,7 +30,7 @@ class Types {
30
30
  }
31
31
  else if (ctyp instanceof Statements.IncludeType) {
32
32
  const found = new include_type_1.IncludeType().runSyntax(c, input);
33
- if (found instanceof basic_1.VoidType) {
33
+ if (found instanceof basic_1.VoidType || found instanceof Basic.UnknownType) {
34
34
  voidd = found;
35
35
  }
36
36
  else {
@@ -66,6 +66,8 @@ const do_1 = require("./statements/do");
66
66
  const concatenate_1 = require("./statements/concatenate");
67
67
  const call_function_1 = require("./statements/call_function");
68
68
  const clear_1 = require("./statements/clear");
69
+ const refresh_1 = require("./statements/refresh");
70
+ const free_1 = require("./statements/free");
69
71
  const replace_1 = require("./statements/replace");
70
72
  const get_bit_1 = require("./statements/get_bit");
71
73
  const raise_1 = require("./statements/raise");
@@ -148,6 +150,7 @@ const modify_entities_1 = require("./statements/modify_entities");
148
150
  const commit_entities_1 = require("./statements/commit_entities");
149
151
  const _syntax_input_1 = require("./_syntax_input");
150
152
  const assert_error_1 = require("./assert_error");
153
+ const field_group_1 = require("./statements/field_group");
151
154
  // -----------------------------------
152
155
  const map = {};
153
156
  function addToMap(handler) {
@@ -191,6 +194,8 @@ if (Object.keys(map).length === 0) {
191
194
  addToMap(new delete_internal_1.DeleteInternal());
192
195
  addToMap(new delete_cluster_1.DeleteCluster());
193
196
  addToMap(new clear_1.Clear());
197
+ addToMap(new free_1.Free());
198
+ addToMap(new refresh_1.Refresh());
194
199
  addToMap(new receive_1.Receive());
195
200
  addToMap(new get_bit_1.GetBit());
196
201
  addToMap(new class_local_friends_1.ClassLocalFriends());
@@ -278,6 +283,7 @@ if (Object.keys(map).length === 0) {
278
283
  addToMap(new translate_1.Translate());
279
284
  addToMap(new modify_internal_1.ModifyInternal());
280
285
  addToMap(new read_textpool_1.ReadTextpool());
286
+ addToMap(new field_group_1.FieldGroup());
281
287
  addToMap(new editor_call_1.EditorCall());
282
288
  addToMap(new delete_memory_1.DeleteMemory());
283
289
  }
@@ -67,7 +67,7 @@ class Registry {
67
67
  }
68
68
  static abaplintVersion() {
69
69
  // magic, see build script "version.sh"
70
- return "2.113.225";
70
+ return "2.113.227";
71
71
  }
72
72
  getDDICReferences() {
73
73
  return this.ddicReferences;
@@ -65,6 +65,10 @@ DATA END OF foo.`,
65
65
  if (t.getChildren().length !== 3) {
66
66
  continue;
67
67
  }
68
+ const data = t.findFirstStatement(Statements.DataBegin);
69
+ if (data === null || data === void 0 ? void 0 : data.findDirectTokenByText("OCCURS")) {
70
+ continue;
71
+ }
68
72
  if (t.findFirstStatement(Statements.IncludeType)) {
69
73
  const token = t.getFirstToken();
70
74
  const message = "DATA BEGIN with single INCLUDE";
@@ -71,6 +71,12 @@ class ObsoleteStatementConf extends _basic_rule_config_1.BasicRuleConfig {
71
71
  this.formDefinition = true;
72
72
  /** Check for FORM IMPLEMENTATION */
73
73
  this.formImplementation = true;
74
+ /** Check for COMMON PART */
75
+ this.commonPart = true;
76
+ /** Check for FIELD-GROUPS */
77
+ this.fieldGroups = true;
78
+ /** Check for REPLACE INTO */
79
+ this.replaceInto = true;
74
80
  }
75
81
  }
76
82
  exports.ObsoleteStatementConf = ObsoleteStatementConf;
@@ -182,10 +188,22 @@ ENDIF.`,
182
188
  const issue = issue_1.Issue.atStatement(file, staNode, "COMMUNICATION is obsolete", this.getMetadata().key, this.conf.severity);
183
189
  issues.push(issue);
184
190
  }
191
+ if (this.conf.commonPart && sta instanceof Statements.DataBegin && staNode.findDirectTokenByText("COMMON")) {
192
+ const issue = issue_1.Issue.atStatement(file, staNode, "COMMON PART is obsolete", this.getMetadata().key, this.conf.severity);
193
+ issues.push(issue);
194
+ }
195
+ if (this.conf.replaceInto && sta instanceof Statements.Replace && staNode.findDirectTokenByText("INTO")) {
196
+ const issue = issue_1.Issue.atStatement(file, staNode, "REPLACE INTO is obsolete", this.getMetadata().key, this.conf.severity);
197
+ issues.push(issue);
198
+ }
185
199
  if (this.conf.pack && sta instanceof Statements.Pack) {
186
200
  const issue = issue_1.Issue.atStatement(file, staNode, "PACK is obsolete", this.getMetadata().key, this.conf.severity);
187
201
  issues.push(issue);
188
202
  }
203
+ if (this.conf.fieldGroups && sta instanceof Statements.FieldGroup) {
204
+ const issue = issue_1.Issue.atStatement(file, staNode, "FIELD-GROUPS is obsolete", this.getMetadata().key, this.conf.severity);
205
+ issues.push(issue);
206
+ }
189
207
  if (this.conf.parameter && sta instanceof Statements.Parameter) {
190
208
  const token = staNode.getFirstToken();
191
209
  if (token.getStr().toUpperCase() === "PARAMETER") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.113.225",
3
+ "version": "2.113.227",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",