@abaplint/transpiler 2.11.17 → 2.11.18

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.
@@ -13,16 +13,24 @@ class ValueBodyTranspiler {
13
13
  }
14
14
  const ret = new chunk_1.Chunk().appendString(new type_name_or_infer_1.TypeNameOrInfer().transpile(typ, traversal).getCode());
15
15
  const context = new type_name_or_infer_1.TypeNameOrInfer().findType(typ, traversal);
16
+ const hasLines = body.findDirectExpression(core_1.Expressions.ValueBodyLine) !== undefined;
17
+ let extraFields = "";
16
18
  for (const child of body.getChildren()) {
17
19
  if (child.get() instanceof core_1.Expressions.FieldAssignment && child instanceof core_1.Nodes.ExpressionNode) {
18
- ret.appendString(new field_assignment_1.FieldAssignmentTranspiler().transpile(child, traversal).getCode());
20
+ const transpiled = new field_assignment_1.FieldAssignmentTranspiler().transpile(child, traversal).getCode();
21
+ if (hasLines === false) {
22
+ ret.appendString(transpiled);
23
+ }
24
+ else {
25
+ extraFields += transpiled;
26
+ }
19
27
  }
20
28
  else if (child.get() instanceof core_1.Expressions.ValueBodyLine && child instanceof core_1.Nodes.ExpressionNode) {
21
29
  if (!(context instanceof core_1.BasicTypes.TableType)) {
22
30
  throw new Error("ValueBodyTranspiler, Expected BasicTypes");
23
31
  }
24
32
  const rowType = context.getRowType();
25
- ret.appendString(new value_body_line_1.ValueBodyLineTranspiler().transpile(rowType, child, traversal).getCode());
33
+ ret.appendString(new value_body_line_1.ValueBodyLineTranspiler().transpile(rowType, child, traversal, extraFields).getCode());
26
34
  }
27
35
  else {
28
36
  throw new Error("ValueBodyTranspiler, unknown " + child.get().constructor.name);
@@ -2,5 +2,5 @@ import { Nodes, AbstractType } from "@abaplint/core";
2
2
  import { Traversal } from "../traversal";
3
3
  import { Chunk } from "../chunk";
4
4
  export declare class ValueBodyLineTranspiler {
5
- transpile(rowType: AbstractType, line: Nodes.ExpressionNode, traversal: Traversal): Chunk;
5
+ transpile(rowType: AbstractType, line: Nodes.ExpressionNode, traversal: Traversal, extraFields: string): Chunk;
6
6
  }
@@ -6,7 +6,7 @@ const chunk_1 = require("../chunk");
6
6
  const transpile_types_1 = require("../transpile_types");
7
7
  const field_assignment_1 = require("./field_assignment");
8
8
  class ValueBodyLineTranspiler {
9
- transpile(rowType, line, traversal) {
9
+ transpile(rowType, line, traversal, extraFields) {
10
10
  const ret = new chunk_1.Chunk();
11
11
  ret.appendString(`.appendThis(${transpile_types_1.TranspileTypes.toType(rowType)}`);
12
12
  for (const child of line.getChildren()) {
@@ -21,7 +21,7 @@ class ValueBodyLineTranspiler {
21
21
  throw new Error("ValueBodyLineTranspiler, unknown " + child.get().constructor.name);
22
22
  }
23
23
  }
24
- ret.appendString(`)`);
24
+ ret.appendString(extraFields + `)`);
25
25
  return ret;
26
26
  }
27
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.11.17",
3
+ "version": "2.11.18",
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.165",
32
+ "@abaplint/core": "^2.113.166",
33
33
  "source-map": "^0.7.6"
34
34
  },
35
35
  "devDependencies": {