@abaplint/transpiler 2.11.36 → 2.11.38

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.
@@ -18,7 +18,10 @@ class SQLFieldListTranspiler {
18
18
  fields.push(code);
19
19
  }
20
20
  else {
21
- fields.push(f.concatTokens());
21
+ const concat = f.concatTokens();
22
+ if (concat !== ",") {
23
+ fields.push(concat);
24
+ }
22
25
  }
23
26
  }
24
27
  return new chunk_1.Chunk().append(fields.join(", "), node, traversal);
@@ -0,0 +1,7 @@
1
+ import { Nodes } from "@abaplint/core";
2
+ import { IExpressionTranspiler } from "./_expression_transpiler";
3
+ import { Traversal } from "../traversal";
4
+ import { Chunk } from "../chunk";
5
+ export declare class SQLGroupByTranspiler implements IExpressionTranspiler {
6
+ transpile(node: Nodes.ExpressionNode, traversal: Traversal): Chunk;
7
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SQLGroupByTranspiler = void 0;
4
+ const abaplint = require("@abaplint/core");
5
+ const chunk_1 = require("../chunk");
6
+ const sql_field_name_1 = require("./sql_field_name");
7
+ class SQLGroupByTranspiler {
8
+ transpile(node, traversal) {
9
+ const fields = [];
10
+ for (const f of node.getChildren()) {
11
+ if (f instanceof abaplint.Nodes.TokenNode) {
12
+ // keywords
13
+ continue;
14
+ }
15
+ else if (f instanceof abaplint.Nodes.ExpressionNode && f.get() instanceof abaplint.Expressions.SQLFieldName) {
16
+ const code = new sql_field_name_1.SQLFieldNameTranspiler().transpile(f, traversal).getCode();
17
+ fields.push(code);
18
+ }
19
+ else {
20
+ const concat = f.concatTokens();
21
+ if (concat !== ",") {
22
+ fields.push(concat);
23
+ }
24
+ }
25
+ }
26
+ return new chunk_1.Chunk().appendString("GROUP BY ").append(fields.join(", "), node, traversal);
27
+ }
28
+ }
29
+ exports.SQLGroupByTranspiler = SQLGroupByTranspiler;
30
+ //# sourceMappingURL=sql_group_by.js.map
@@ -6,6 +6,7 @@ const chunk_1 = require("../chunk");
6
6
  const expressions_1 = require("../expressions");
7
7
  const unique_identifier_1 = require("../unique_identifier");
8
8
  const sql_from_1 = require("../expressions/sql_from");
9
+ const sql_group_by_1 = require("../expressions/sql_group_by");
9
10
  function escapeRegExp(string) {
10
11
  return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
11
12
  }
@@ -47,6 +48,10 @@ class SelectTranspiler {
47
48
  if (where) {
48
49
  select += "WHERE " + new expressions_1.SQLCondTranspiler().transpile(where, traversal, table).getCode() + " ";
49
50
  }
51
+ const groupBy = node.findFirstExpression(abaplint.Expressions.SQLGroupBy);
52
+ if (groupBy) {
53
+ select += new sql_group_by_1.SQLGroupByTranspiler().transpile(groupBy, traversal).getCode() + " ";
54
+ }
50
55
  const upTo = node.findFirstExpression(abaplint.Expressions.SQLUpTo);
51
56
  if (upTo) {
52
57
  const s = upTo.findFirstExpression(abaplint.Expressions.SimpleSource3);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.11.36",
3
+ "version": "2.11.38",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
@@ -29,7 +29,7 @@
29
29
  "author": "abaplint",
30
30
  "license": "MIT",
31
31
  "dependencies": {
32
- "@abaplint/core": "^2.113.178",
32
+ "@abaplint/core": "^2.113.180",
33
33
  "source-map": "^0.7.6"
34
34
  },
35
35
  "devDependencies": {