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(
18
18
isUsingCse : boolean ,
19
19
options ?: { uploadIsActive ?: boolean ; uploads ?: UploadResult }
20
20
) {
21
- let compiled = { } ;
21
+ let compiled : { [ key : string ] : string } = { } ;
22
22
23
23
const stderr = ( type : 'TypeCheck' | 'Compile' | 'Runtime' , msg : string ) => {
24
24
context . errors . push ( {
@@ -110,10 +110,12 @@ export async function javaRun(
110
110
}
111
111
112
112
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
+ } ) ;
117
119
} catch ( e ) {
118
120
stderr ( 'Compile' , e ) ;
119
121
return Promise . resolve ( { status : 'error' } ) ;
You can’t perform that action at this time.
0 commit comments