@abaplint/core 2.115.21 → 2.115.23

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.
@@ -9,7 +9,7 @@ const let_1 = require("./let");
9
9
  class Cast extends combi_1.Expression {
10
10
  getRunnable() {
11
11
  const rparen = (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenRightW), (0, combi_1.tok)(tokens_1.WParenRight));
12
- const cast = (0, combi_1.seq)("CAST", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), (0, combi_1.optPrio)(let_1.Let), _1.Source, rparen);
12
+ const cast = (0, combi_1.seq)("CAST", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), (0, combi_1.optPrio)(let_1.Let), _1.Source, rparen, (0, combi_1.opt)(_1.Dereference));
13
13
  return (0, combi_1.ver)(version_1.Version.v740sp02, cast, version_1.Version.OpenABAP);
14
14
  }
15
15
  }
@@ -14,7 +14,7 @@ class Move {
14
14
  const equals = (0, combi_1.altPrio)((0, combi_1.altPrio)(chained, "?="), calcAssign);
15
15
  // todo, move "?=" to CAST?
16
16
  const eq = (0, combi_1.seq)(expressions_1.Target, equals, expressions_1.Source);
17
- return (0, combi_1.altPrio)(move, eq);
17
+ return (0, combi_1.alt)(move, eq);
18
18
  }
19
19
  }
20
20
  exports.Move = Move;
@@ -72,8 +72,9 @@ class CreateObject {
72
72
  return;
73
73
  }
74
74
  else if (found instanceof basic_1.ObjectReferenceType) {
75
- const id = found.getIdentifier();
76
- if (id instanceof types_1.InterfaceDefinition && type === undefined) {
75
+ const identifier = found.getIdentifier();
76
+ const idFound = input.scope.findObjectDefinition(identifier.getName());
77
+ if (idFound instanceof types_1.InterfaceDefinition && type === undefined) {
77
78
  const message = "Interface reference, cannot be instantiated";
78
79
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
79
80
  return;
@@ -85,11 +86,11 @@ class CreateObject {
85
86
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
86
87
  return;
87
88
  }
88
- else if (id instanceof types_1.ClassDefinition && cdef === undefined) {
89
- cdef = id;
89
+ else if (idFound instanceof types_1.ClassDefinition && cdef === undefined) {
90
+ cdef = idFound;
90
91
  }
91
- if (type === undefined && id instanceof types_1.ClassDefinition && id.isAbstract() === true) {
92
- const message = id.getName() + " is abstract, cannot be instantiated";
92
+ if (type === undefined && idFound instanceof types_1.ClassDefinition && idFound.isAbstract() === true) {
93
+ const message = identifier.getName() + " is abstract, cannot be instantiated";
93
94
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
94
95
  return;
95
96
  }
@@ -7,6 +7,7 @@ const target_1 = require("../expressions/target");
7
7
  const inline_data_1 = require("../expressions/inline_data");
8
8
  const _type_utils_1 = require("../_type_utils");
9
9
  const _syntax_input_1 = require("../_syntax_input");
10
+ const dereference_1 = require("../expressions/dereference");
10
11
  class Move {
11
12
  runSyntax(node, input) {
12
13
  const targets = node.findDirectExpressions(Expressions.Target);
@@ -23,12 +24,15 @@ class Move {
23
24
  }
24
25
  }
25
26
  const source = node.findDirectExpression(Expressions.Source);
26
- const sourceType = source ? source_1.Source.runSyntax(source, input, targetType) : undefined;
27
+ let sourceType = source ? source_1.Source.runSyntax(source, input, targetType) : undefined;
27
28
  if (sourceType === undefined) {
28
29
  const message = "No source type determined";
29
30
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
30
31
  return;
31
32
  }
33
+ if (node.findDirectExpression(Expressions.Dereference)) {
34
+ sourceType = dereference_1.Dereference.runSyntax(node, sourceType, input);
35
+ }
32
36
  if (inline) {
33
37
  inline_data_1.InlineData.runSyntax(inline, input, sourceType);
34
38
  targetType = sourceType;
@@ -74,7 +74,7 @@ class Registry {
74
74
  }
75
75
  static abaplintVersion() {
76
76
  // magic, see build script "version.sh"
77
- return "2.115.21";
77
+ return "2.115.23";
78
78
  }
79
79
  getDDICReferences() {
80
80
  return this.ddicReferences;
@@ -6,6 +6,7 @@ const _abap_rule_1 = require("./_abap_rule");
6
6
  const Objects = require("../objects");
7
7
  const _basic_rule_config_1 = require("./_basic_rule_config");
8
8
  const _irule_1 = require("./_irule");
9
+ const objects_1 = require("../objects");
9
10
  class GlobalClassConf extends _basic_rule_config_1.BasicRuleConfig {
10
11
  }
11
12
  exports.GlobalClassConf = GlobalClassConf;
@@ -27,7 +28,9 @@ class GlobalClass extends _abap_rule_1.ABAPRule {
27
28
 
28
29
  * global classes must be global definitions
29
30
 
30
- * global interfaces must be global definitions`,
31
+ * global interfaces must be global definitions
32
+
33
+ * global FOR TESTING, must have CATEGORY = 05 in the XML`,
31
34
  tags: [_irule_1.RuleTag.Syntax],
32
35
  };
33
36
  }
@@ -52,6 +55,18 @@ class GlobalClass extends _abap_rule_1.ABAPRule {
52
55
  const issue = issue_1.Issue.atIdentifier(definition.identifier, "Class must be local", this.getMetadata().key, this.conf.severity);
53
56
  output.push(issue);
54
57
  }
58
+ if (definition.isGlobal && obj instanceof Objects.Class) {
59
+ if (definition.isForTesting === true && obj instanceof Objects.Class && obj.getCategory() !== objects_1.ClassCategory.Test) {
60
+ const message = "Class is marked as FOR TESTING, but CATEGORY is not 05 in the XML";
61
+ const issue = issue_1.Issue.atIdentifier(definition.identifier, message, this.getMetadata().key, this.conf.severity);
62
+ output.push(issue);
63
+ }
64
+ else if (definition.isForTesting === false && obj instanceof Objects.Class && obj.getCategory() === objects_1.ClassCategory.Test) {
65
+ const message = "Class has CATEGORY 05 in the XML, but is not marked as FOR TESTING";
66
+ const issue = issue_1.Issue.atIdentifier(definition.identifier, message, this.getMetadata().key, this.conf.severity);
67
+ output.push(issue);
68
+ }
69
+ }
55
70
  }
56
71
  for (const impl of file.getInfo().listClassImplementations()) {
57
72
  if (file.getFilename().match(/\.clas\.abap$/)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.115.21",
3
+ "version": "2.115.23",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",