Skip to content

Commit 3c7c21c

Browse files
committed
update
1 parent 46dbfa5 commit 3c7c21c

File tree

3 files changed

+37
-6
lines changed

3 files changed

+37
-6
lines changed

public/zcl_excel_demo1.xlsx

1 Byte
Binary file not shown.

public/zcl_excel_demo2.xlsx

1 Byte
Binary file not shown.

src/index.ts

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import "./index.css";
1818
import "../public/favicon-16x16.png";
1919
import "../public/favicon-32x32.png";
2020
import * as monaco from "monaco-editor";
21-
import {config, Transpiler} from "@abaplint/transpiler";
22-
import {ABAP, MemoryConsole} from "@abaplint/runtime";
21+
import {config, ITranspilerOptions, Transpiler, UnknownTypesEnum} from "@abaplint/transpiler";
22+
// import {ABAP, MemoryConsole} from "@abaplint/runtime";
2323
import * as abaplint from "@abaplint/core";
2424
import * as abapMonaco from "@abaplint/monaco";
2525
import Split from "split-grid";
@@ -111,9 +111,9 @@ const AsyncFunction = new Function(`return Object.getPrototypeOf(async function(
111111
async function abapChanged() {
112112
// @ts-ignore
113113
console.dir(globalThis.abap);
114+
const contents = editor1.getValue();
114115

115116
try {
116-
const contents = editor1.getValue();
117117
const file = new abaplint.MemoryFile(filename, contents);
118118
reg.updateFile(file);
119119
reg.parse();
@@ -124,6 +124,7 @@ async function abapChanged() {
124124
document.getElementById("container2").innerHTML = `<iframe src="https://view.officeapps.live.com/op/view.aspx?src=https://abap2xlsx.github.io/abap2xlsx-web/${name}.xlsx" title="Excel"></iframe>`;
125125

126126
setTimeout(() => monaco.editor.getEditors()[0].focus(), 1000);
127+
return;
127128
} else {
128129
const markers = monaco.editor.getModelMarkers({});
129130
if (markers.length > 0) {
@@ -135,13 +136,43 @@ async function abapChanged() {
135136
return;
136137
}
137138

138-
document.getElementById("container2").innerHTML = `todo, compiling`;
139-
140-
// const res = await new Transpiler().runRaw([{filename, contents}]);
139+
document.getElementById("container2").innerHTML = `<b>Compiling</b>`;
141140
}
142141
} catch (error) {
143142
console.dir(error);
144143
}
144+
145+
try {
146+
/*
147+
const raw = [];
148+
for (const filename in abapfiles) {
149+
if (filename.indexOf("zcl_excel_demo") === 0) {
150+
continue;
151+
}
152+
raw.push({
153+
filename: filename,
154+
contents: abapfiles[filename],
155+
})
156+
if (filename === "cl_ixml.clas.locals_imp.abap") {
157+
console.log(abapfiles[filename]);
158+
}
159+
}
160+
*/
161+
// console.dir(raw);
162+
const options: ITranspilerOptions = {
163+
"ignoreSyntaxCheck": false,
164+
"addFilenames": true,
165+
"addCommonJS": true,
166+
"skipReposrc": true,
167+
"unknownTypes": UnknownTypesEnum.runtimeError,
168+
}
169+
const res = await new Transpiler(options).run(reg);
170+
console.dir("RESULT:");
171+
console.dir(res);
172+
} catch (error) {
173+
document.getElementById("container2").innerHTML = `<u><b>Issues found during compilation</b></u><br>`;
174+
document.getElementById("container2").innerHTML += error.toString();
175+
}
145176
}
146177

147178
editor1.onDidChangeModelContent(abapChanged);

0 commit comments

Comments
 (0)