@abaplint/core 2.120.59 → 2.120.60

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,9 @@ const combi_1 = require("../combi");
5
5
  const _1 = require(".");
6
6
  class MethodDefExceptions extends combi_1.Expression {
7
7
  getRunnable() {
8
- const exceptions = (0, combi_1.seq)("EXCEPTIONS", (0, combi_1.plusPrio)(_1.NamespaceSimpleName));
8
+ // parameter section keywords cannot be exception names
9
+ const name = (0, combi_1.seq)((0, combi_1.stopBefore1)("IMPORTING", "EXPORTING", "CHANGING", "RETURNING", "RAISING", "EXCEPTIONS"), _1.NamespaceSimpleName);
10
+ const exceptions = (0, combi_1.seq)("EXCEPTIONS", (0, combi_1.plusPrio)(name));
9
11
  return exceptions;
10
12
  }
11
13
  }
@@ -7,7 +7,9 @@ const class_name_1 = require("./class_name");
7
7
  class MethodDefRaising extends combi_1.Expression {
8
8
  getRunnable() {
9
9
  const resumable = (0, combi_1.seq)("RESUMABLE", (0, combi_1.tok)(tokens_1.ParenLeft), class_name_1.ClassName, (0, combi_1.tok)(tokens_1.ParenRightW));
10
- const raising = (0, combi_1.seq)("RAISING", (0, combi_1.plus)((0, combi_1.altPrio)(resumable, class_name_1.ClassName)));
10
+ // parameter section keywords cannot be exception names
11
+ const name = (0, combi_1.seq)((0, combi_1.stopBefore1)("IMPORTING", "EXPORTING", "CHANGING", "RETURNING", "RAISING", "EXCEPTIONS"), class_name_1.ClassName);
12
+ const raising = (0, combi_1.seq)("RAISING", (0, combi_1.plus)((0, combi_1.altPrio)(resumable, name)));
11
13
  return raising;
12
14
  }
13
15
  }
@@ -26,7 +26,7 @@ class MethodDef {
26
26
  (0, combi_1.seq)("VALIDATE ON SAVE IMPORTING", expressions_1.MethodParamName, "FOR", expressions_1.TypeName), (0, combi_1.seq)("MODIFY", (0, combi_1.opt)("IMPORTING"), (0, combi_1.plus)((0, combi_1.seq)(expressions_1.MethodParamName, modify))), (0, combi_1.seq)("PRECHECK IMPORTING", expressions_1.MethodParamName, modify), (0, combi_1.seq)("DETERMINATION", expressions_1.TypeName, "IMPORTING", expressions_1.MethodParamName, "FOR", expressions_1.TypeName), (0, combi_1.seq)("VALIDATION", expressions_1.TypeName, "IMPORTING", expressions_1.MethodParamName, "FOR", expressions_1.TypeName), (0, combi_1.seq)("NUMBERING IMPORTING", expressions_1.MethodParamName, modify), (0, combi_1.seq)("READ IMPORTING", expressions_1.MethodParamName, (0, combi_1.altPrio)(forRead, forfunction)), (0, combi_1.seq)("FEATURES IMPORTING", expressions_1.MethodParamName, "REQUEST", expressions_1.NamespaceSimpleName, "FOR", expressions_1.NamespaceSimpleName, result), (0, combi_1.seq)("BEHAVIOR IMPORTING", expressions_1.MethodParamName, "FOR CREATE", expressions_1.TypeName, expressions_1.MethodParamName, "FOR UPDATE", expressions_1.TypeName, expressions_1.MethodParamName, "FOR DELETE", expressions_1.TypeName), (0, combi_1.seq)("BEHAVIOR IMPORTING", expressions_1.MethodParamName, "FOR READ", expressions_1.TypeName, result), (0, combi_1.seq)("BEHAVIOR IMPORTING", expressions_1.MethodParamName, "FOR UPDATE", expressions_1.TypeName), (0, combi_1.seq)((0, combi_1.alt)("BEHAVIOR", "LOCK"), "IMPORTING", expressions_1.MethodParamName, "FOR LOCK", expressions_1.TypeName), (0, combi_1.seq)("DETERMINE", (0, combi_1.alt)("ON MODIFY", "ON SAVE"), "IMPORTING", expressions_1.MethodParamName, "FOR", expressions_1.TypeName), (0, combi_1.seq)("GLOBAL AUTHORIZATION IMPORTING REQUEST", expressions_1.MethodParamName, "FOR", expressions_1.TypeName, result), (0, combi_1.seq)("GLOBAL FEATURES IMPORTING REQUEST", expressions_1.MethodParamName, "FOR", expressions_1.TypeName, result), (0, combi_1.seq)((0, combi_1.seq)((0, combi_1.opt)("INSTANCE"), "AUTHORIZATION IMPORTING"), expressions_1.MethodParamName, "REQUEST", expressions_1.MethodParamName, "FOR", expressions_1.TypeName, result), (0, combi_1.seq)("INSTANCE FEATURES IMPORTING", expressions_1.MethodParamName, "REQUEST", expressions_1.MethodParamName, "FOR", expressions_1.TypeName, result));
27
27
  // todo, this is only from version something
28
28
  // AMDP OPTIONS clause blocked in KeyUser
29
- const amdp = (0, combi_1.verNotLang)(version_1.LanguageVersion.KeyUser, (0, combi_1.seq)("AMDP OPTIONS", (0, combi_1.optPrio)("READ-ONLY"), "CDS SESSION CLIENT", (0, combi_1.alt)("CURRENT", "DEPENDENT"), (0, combi_1.optPrio)(expressions_1.MethodDefImporting), (0, combi_1.optPrio)(expressions_1.MethodDefExporting), (0, combi_1.optPrio)(expressions_1.MethodDefRaising)));
29
+ const amdp = (0, combi_1.verNotLang)(version_1.LanguageVersion.KeyUser, (0, combi_1.seq)("AMDP OPTIONS", (0, combi_1.per)("READ-ONLY", (0, combi_1.seq)("CDS SESSION CLIENT", (0, combi_1.alt)("CURRENT", "DEPENDENT"))), (0, combi_1.optPrio)(expressions_1.MethodDefImporting), (0, combi_1.optPrio)(expressions_1.MethodDefExporting), (0, combi_1.optPrio)(expressions_1.MethodDefRaising)));
30
30
  // FOR DDL OBJECT / FOR TABLE FUNCTION / FOR SCALAR FUNCTION blocked in KeyUser
31
31
  const regular = (0, combi_1.seq)((0, combi_1.altPrio)("CLASS-METHODS", "METHODS"), expressions_1.MethodName, (0, combi_1.alt)((0, combi_1.seq)((0, combi_1.optPrio)(expressions_1.Abstract), (0, combi_1.optPrio)(def), expressions_1.EventHandler), parameters, testing, (0, combi_1.verNotLang)(version_1.LanguageVersion.KeyUser, (0, combi_1.seq)("FOR", behavior)), amdp, "NOT AT END OF MODE", (0, combi_1.optPrio)(expressions_1.Redefinition)));
32
32
  // RAP event handlers are instance methods; CLASS-METHODS is not allowed.
@@ -9,7 +9,8 @@ class MethodImplementation {
9
9
  const name = (0, combi_1.regex)(/[\w~]+/);
10
10
  const kernel = (0, combi_1.seq)("KERNEL MODULE", (0, combi_1.plus)(name), (0, combi_1.optPrio)((0, combi_1.altPrio)("FAIL", "IGNORE")));
11
11
  const using = (0, combi_1.seq)("USING", (0, combi_1.plus)(expressions_1.SimpleFieldChain));
12
- const database = (0, combi_1.seq)("DATABASE", (0, combi_1.alt)("PROCEDURE", "FUNCTION", "GRAPH WORKSPACE"), "FOR HDB", expressions_1.Language, (0, combi_1.opt)("OPTIONS READ-ONLY"), (0, combi_1.opt)(using));
12
+ const options = (0, combi_1.seq)("OPTIONS", (0, combi_1.per)("READ-ONLY", "SUPPRESS SYNTAX ERRORS", "DETERMINISTIC"));
13
+ const database = (0, combi_1.seq)("DATABASE", (0, combi_1.alt)("PROCEDURE", "FUNCTION", "GRAPH WORKSPACE"), "FOR HDB", expressions_1.Language, (0, combi_1.opt)(options), (0, combi_1.opt)(using));
13
14
  // BY DATABASE and BY KERNEL both blocked in KeyUser
14
15
  const by = (0, combi_1.verNotLang)(version_1.LanguageVersion.KeyUser, (0, combi_1.seq)("BY", (0, combi_1.alt)(kernel, database)));
15
16
  return (0, combi_1.seq)("METHOD", expressions_1.MethodName, (0, combi_1.optPrio)(by));
@@ -42,10 +42,22 @@ const basic_types_1 = require("../basic_types");
42
42
  const basic_1 = require("../../types/basic");
43
43
  const _typed_identifier_1 = require("../../types/_typed_identifier");
44
44
  const _reference_1 = require("../_reference");
45
+ const _syntax_input_1 = require("../_syntax_input");
45
46
  class CreateData {
46
47
  runSyntax(node, input) {
48
+ const likeLineOf = node.concatTokens().toUpperCase().includes(" LIKE LINE OF ");
47
49
  for (const s of node.findDirectExpressions(Expressions.Source)) {
48
- source_1.Source.runSyntax(s, input);
50
+ const sourceType = source_1.Source.runSyntax(s, input);
51
+ if (likeLineOf === true
52
+ && sourceType !== undefined
53
+ && !(sourceType instanceof basic_1.TableType)
54
+ && !(sourceType instanceof basic_1.VoidType)
55
+ && !(sourceType instanceof basic_1.UnknownType)
56
+ && !(sourceType instanceof basic_1.AnyType)) {
57
+ const message = `"${s.concatTokens()}" is not an internal table`;
58
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
59
+ return;
60
+ }
49
61
  }
50
62
  for (const t of node.findDirectExpressions(Expressions.Target)) {
51
63
  target_1.Target.runSyntax(t, input);
@@ -141,6 +141,11 @@ class CreateObject {
141
141
  ooName = found.getVoided();
142
142
  }
143
143
  input.scope.addReference(t === null || t === void 0 ? void 0 : t.getFirstToken(), cdef, _reference_1.ReferenceType.ConstructorReference, input.filename, { ooName: ooName });
144
+ if (type && type.get() instanceof Expressions.Dynamic) {
145
+ // the class is only known at runtime, cdef is the static type of the target
146
+ this.validateParameters(undefined, node, input);
147
+ return;
148
+ }
144
149
  if (cdef !== undefined) {
145
150
  const err = CreateObject.checkInstantiationAllowed(cdef, input);
146
151
  if (err) {
@@ -75,7 +75,7 @@ class Registry {
75
75
  }
76
76
  static abaplintVersion() {
77
77
  // magic, see build script "version.js"
78
- return "2.120.59";
78
+ return "2.120.60";
79
79
  }
80
80
  getDDICReferences() {
81
81
  return this.ddicReferences;
@@ -110,12 +110,13 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#abap-doc-on
110
110
  return issues;
111
111
  }
112
112
  getAbapdoc(rows, pos) {
113
+ var _a, _b, _c;
113
114
  let previousRow = pos.getRow() - 2;
114
- let rowText = rows[previousRow].trim().toUpperCase();
115
+ let rowText = ((_a = rows[previousRow]) !== null && _a !== void 0 ? _a : "").trim().toUpperCase();
115
116
  const text = [];
116
117
  if (rowText === "METHODS" || rowText === "CLASS-METHODS") {
117
118
  previousRow--;
118
- rowText = rows[previousRow].trim().toUpperCase();
119
+ rowText = ((_b = rows[previousRow]) !== null && _b !== void 0 ? _b : "").trim().toUpperCase();
119
120
  }
120
121
  text.push(rowText);
121
122
  //we need to push the first row despite if it is actually an abapdoc or not
@@ -123,7 +124,7 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#abap-doc-on
123
124
  if (rowText.trim().substring(0, 2) === "\"!") {
124
125
  while (previousRow >= 0) {
125
126
  previousRow--;
126
- rowText = rows[previousRow].trim().toUpperCase();
127
+ rowText = ((_c = rows[previousRow]) !== null && _c !== void 0 ? _c : "").trim().toUpperCase();
127
128
  if (rowText.trim().substring(0, 2) !== "\"!") {
128
129
  break;
129
130
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.120.59",
3
+ "version": "2.120.60",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",