@abaplint/core 2.119.45 → 2.119.46

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.
@@ -50,7 +50,7 @@ const _syntax_input_1 = require("../_syntax_input");
50
50
  const version_1 = require("../../../version");
51
51
  const isSimple = /^\w+$/;
52
52
  class Select {
53
- static runSyntax(node, input, skipImplicitInto = false) {
53
+ static runSyntax(node, input, skipImplicitInto = false, selectLoop = false) {
54
54
  var _a;
55
55
  const token = node.getFirstToken();
56
56
  let from = node.findDirectExpression(Expressions.SQLFrom);
@@ -109,6 +109,14 @@ class Select {
109
109
  sql_source_1.SQLSource.runSyntax(s, input);
110
110
  }
111
111
  for (const up of node.findDirectExpressions(Expressions.SQLUpTo)) {
112
+ if (intoExpression
113
+ && this.isStrictMode(node, input)
114
+ && (selectLoop === false || input.scope.getLanguageVersion() === version_1.LanguageVersion.Cloud)
115
+ && from.getFirstToken().getStart().isBefore(up.getFirstToken().getStart())
116
+ && up.getFirstToken().getStart().isBefore(intoExpression.getFirstToken().getStart())) {
117
+ const message = `The addition "UP TO n ROWS" must only be placed after the INTO/APPENDING clause.`;
118
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, up.getFirstToken(), message));
119
+ }
112
120
  for (const s of up.findDirectExpressions(Expressions.SQLSource)) {
113
121
  sql_source_1.SQLSource.runSyntax(s, input);
114
122
  }
@@ -134,7 +142,7 @@ class Select {
134
142
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, orderBy.getFirstToken(), message));
135
143
  }
136
144
  }
137
- if (this.isStrictMode(node)) {
145
+ if (this.isStrictMode(node, input)) {
138
146
  this.strictModeChecks(node, input);
139
147
  }
140
148
  if (input.scope.getType() === _scope_type_1.ScopeType.OpenSQL) {
@@ -142,7 +150,11 @@ class Select {
142
150
  }
143
151
  }
144
152
  // there are multiple rules, but gotta start somewhere
145
- static isStrictMode(node) {
153
+ static isStrictMode(node, input) {
154
+ // strict OpenSQL is always required in the cloud language version
155
+ if (input.scope.getLanguageVersion() === version_1.LanguageVersion.Cloud) {
156
+ return true;
157
+ }
146
158
  const into = node.findDirectExpressionsMulti([Expressions.SQLIntoList, Expressions.SQLIntoStructure, Expressions.SQLIntoTable])[0];
147
159
  const where = node.findDirectExpression(Expressions.SQLCond);
148
160
  // INTO is after WHERE
@@ -54,8 +54,9 @@ class DeleteInternal {
54
54
  const localVariable = input.scope.findVariable(target.concatTokens());
55
55
  if (localVariable === undefined && node.getChildren().length === 5 && node.getChildren()[2].concatTokens().toUpperCase() === "FROM") {
56
56
  // it might be a database table
57
- tabl = (_a = input.scope.getDDIC()) === null || _a === void 0 ? void 0 : _a.lookupTableOrView(target.concatTokens());
58
- if (tabl) {
57
+ const found = (_a = input.scope.getDDIC()) === null || _a === void 0 ? void 0 : _a.lookupTableOrView(target.concatTokens());
58
+ if ((found === null || found === void 0 ? void 0 : found.object) !== undefined) {
59
+ tabl = found;
59
60
  input.scope.getDDICReferences().addUsing(input.scope.getParentObj(), { object: tabl.object });
60
61
  }
61
62
  }
@@ -63,7 +64,7 @@ class DeleteInternal {
63
64
  targetType = target_1.Target.runSyntax(target, input);
64
65
  if (node.findDirectTokenByText("TABLE") === undefined
65
66
  && node.findDirectTokenByText("ADJACENT") === undefined
66
- && node.findDirectTokenByText("FROM")
67
+ && (node.findDirectTokenByText("FROM") || node.findDirectTokenByText("INDEX"))
67
68
  && targetType instanceof basic_1.TableType
68
69
  && targetType.getAccessType() === basic_1.TableAccessType.hashed) {
69
70
  const message = "Implicit or explicit index operation on hashed table is not possible";
@@ -99,6 +99,14 @@ class Loop {
99
99
  }
100
100
  const targetConcat = loopTarget === null || loopTarget === void 0 ? void 0 : loopTarget.concatTokens().toUpperCase();
101
101
  const topType = sourceType; // todo: refactor topType vs sourceType vs rowType
102
+ if (topType instanceof basic_1.TableType
103
+ && topType.getAccessType() === basic_1.TableAccessType.hashed
104
+ && node.findDirectTokenByText("USING") === undefined
105
+ && (node.findDirectTokenByText("FROM") || node.findDirectTokenByText("TO"))) {
106
+ const message = "Implicit or explicit index operation on hashed table is not possible";
107
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
108
+ return;
109
+ }
102
110
  if (sourceType instanceof basic_1.TableType) {
103
111
  rowType = sourceType.getRowType();
104
112
  sourceType = rowType;
@@ -58,6 +58,13 @@ class ModifyInternal {
58
58
  // ok
59
59
  }
60
60
  else if (targetType instanceof basic_1.TableType) {
61
+ if (node.findDirectTokenByText("TABLE") === undefined
62
+ && node.findDirectTokenByText("INDEX")
63
+ && targetType.getAccessType() === basic_1.TableAccessType.hashed) {
64
+ const message = "Implicit or explicit index operation on hashed table is not possible";
65
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
66
+ return;
67
+ }
61
68
  if (node.findDirectTokenByText("TABLE")
62
69
  && node.findDirectTokenByText("INDEX")
63
70
  && targetType.isWithHeader() === false) {
@@ -40,7 +40,7 @@ class SelectLoop {
40
40
  runSyntax(node, input) {
41
41
  const s = node.findDirectExpression(Expressions.Select);
42
42
  if (s) {
43
- select_1.Select.runSyntax(s, input);
43
+ select_1.Select.runSyntax(s, input, false, true);
44
44
  }
45
45
  }
46
46
  }
@@ -74,7 +74,7 @@ class Registry {
74
74
  }
75
75
  static abaplintVersion() {
76
76
  // magic, see build script "version.js"
77
- return "2.119.45";
77
+ return "2.119.46";
78
78
  }
79
79
  getDDICReferences() {
80
80
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.119.45",
3
+ "version": "2.119.46",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",