File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ export async function javaRun(
1818 isUsingCse : boolean ,
1919 options ?: { uploadIsActive ?: boolean ; uploads ?: UploadResult }
2020) {
21- let compiled = { } ;
21+ let compiled : { [ key : string ] : string } = { } ;
2222
2323 const stderr = ( type : 'TypeCheck' | 'Compile' | 'Runtime' , msg : string ) => {
2424 context . errors . push ( {
@@ -110,10 +110,12 @@ export async function javaRun(
110110 }
111111
112112 try {
113- const classFile = compileFromSource ( javaCode ) ;
114- compiled = {
115- 'Main.class' : Buffer . from ( new BinaryWriter ( ) . generateBinary ( classFile ) ) . toString ( 'base64' )
116- } ;
113+ const binaryWriter = new BinaryWriter ( ) ;
114+ const classes = compileFromSource ( javaCode ) ;
115+ classes . forEach ( c => {
116+ compiled [ c . className + '.class' ]
117+ = Buffer . from ( binaryWriter . generateBinary ( c . classFile ) ) . toString ( 'base64' ) ;
118+ } ) ;
117119 } catch ( e ) {
118120 stderr ( 'Compile' , e ) ;
119121 return Promise . resolve ( { status : 'error' } ) ;
You can’t perform that action at this time.
0 commit comments