@@ -18,8 +18,8 @@ import "./index.css";
18
18
import "../public/favicon-16x16.png" ;
19
19
import "../public/favicon-32x32.png" ;
20
20
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";
23
23
import * as abaplint from "@abaplint/core" ;
24
24
import * as abapMonaco from "@abaplint/monaco" ;
25
25
import Split from "split-grid" ;
@@ -111,9 +111,9 @@ const AsyncFunction = new Function(`return Object.getPrototypeOf(async function(
111
111
async function abapChanged ( ) {
112
112
// @ts -ignore
113
113
console . dir ( globalThis . abap ) ;
114
+ const contents = editor1 . getValue ( ) ;
114
115
115
116
try {
116
- const contents = editor1 . getValue ( ) ;
117
117
const file = new abaplint . MemoryFile ( filename , contents ) ;
118
118
reg . updateFile ( file ) ;
119
119
reg . parse ( ) ;
@@ -124,6 +124,7 @@ async function abapChanged() {
124
124
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>` ;
125
125
126
126
setTimeout ( ( ) => monaco . editor . getEditors ( ) [ 0 ] . focus ( ) , 1000 ) ;
127
+ return ;
127
128
} else {
128
129
const markers = monaco . editor . getModelMarkers ( { } ) ;
129
130
if ( markers . length > 0 ) {
@@ -135,13 +136,43 @@ async function abapChanged() {
135
136
return ;
136
137
}
137
138
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>` ;
141
140
}
142
141
} catch ( error ) {
143
142
console . dir ( error ) ;
144
143
}
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
+ }
145
176
}
146
177
147
178
editor1 . onDidChangeModelContent ( abapChanged ) ;
0 commit comments