Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
larshp committed Jul 8, 2024
1 parent e2fa39b commit 1fcaedb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 11 additions & 4 deletions packages/transpiler/src/statements/delete_internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,21 @@ import {Chunk} from "../chunk";
export class DeleteInternalTranspiler implements IStatementTranspiler {

public transpile(node: abaplint.Nodes.StatementNode, traversal: Traversal): Chunk {
const target = traversal.traverse(node.findFirstExpression(abaplint.Expressions.Target)).getCode();
const target = traversal.traverse(node.findDirectExpression(abaplint.Expressions.Target)).getCode();
const concat = node.concatTokens().toUpperCase();

const extra: string[] = [];
const where = node.findFirstExpression(abaplint.Expressions.ComponentCond);
if (where) {

const componentCond = node.findDirectExpression(abaplint.Expressions.ComponentCond);
if (componentCond) {
// todo, replacing "await" is a hack
extra.push("where: " + traversal.traverse(where).getCode().replace("await ", ""));
extra.push("where: " + traversal.traverse(componentCond).getCode().replace("await ", ""));
}

const componentCompare = node.findDirectExpression(abaplint.Expressions.ComponentCompare);
if (componentCompare) {
// todo: this can be optimized, WITH TABLE KEY
extra.push("where: " + traversal.traverse(componentCompare).getCode());
}

// todo, this is not completely correct, fields might have the name ADJACENT
Expand Down
2 changes: 1 addition & 1 deletion test/statements/delete_internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ ENDLOOP.`;
expect(abap.console.get()).to.equal("6\n3\n10");
});

it.only("DELETE, with table key", async () => {
it("DELETE, with table key", async () => {
const code = `
TYPES: BEGIN OF ty,
foobar TYPE i,
Expand Down

0 comments on commit 1fcaedb

Please sign in to comment.