diff --git a/packages/transpiler/src/keywords.ts b/packages/transpiler/src/keywords.ts index bae8ce1af..75071a3d7 100644 --- a/packages/transpiler/src/keywords.ts +++ b/packages/transpiler/src/keywords.ts @@ -34,6 +34,9 @@ export class Keywords { } public handle(reg: abaplint.IRegistry) { + if (this.keywords.length === 0) { + return; + } reg.parse(); for (const o of reg.getObjects()) { diff --git a/test/keywords.ts b/test/keywords.ts index ac91c55a0..882c667d4 100644 --- a/test/keywords.ts +++ b/test/keywords.ts @@ -67,6 +67,29 @@ START-OF-SELECTION. expect(abap.console.get()).to.equal("2"); }); -// TODO: class attribute + it("class attribute", async () => { + const code = ` +CLASS lcl DEFINITION. + PUBLIC SECTION. + METHODS constructor. + PRIVATE SECTION. + DATA class TYPE i. +ENDCLASS. + +CLASS lcl IMPLEMENTATION. + METHOD constructor. + WRITE class. + ENDMETHOD. +ENDCLASS. + +START-OF-SELECTION. + DATA lo TYPE REF TO lcl. + CREATE OBJECT lo.`; + + const js = await run(code); + const f = new AsyncFunction("abap", js); + await f(abap); + expect(abap.console.get()).to.equal("0"); + }); }); \ No newline at end of file