compile on the fly only the needed instead all given

This commit is contained in:
Volker Berlin 2018-12-13 20:05:13 +01:00
parent d7b283e73a
commit d4012a751f
2 changed files with 5 additions and 20 deletions

View File

@ -255,10 +255,6 @@ public class JWebAssembly {
generator.prepare( classFile );
}
generator.prepareFinish();
for( URL url : classFiles ) {
ClassFile classFile = new ClassFile( new BufferedInputStream( url.openStream() ) );
generator.write( classFile );
}
generator.finish();
}
}

View File

@ -91,18 +91,6 @@ public class ModuleGenerator {
writer.prepareFinish();
}
/**
* Write the content of the class to the writer.
*
* @param classFile
* the class file
* @throws WasmException
* if some Java code can't converted
*/
public void write( ClassFile classFile ) throws WasmException {
iterateMethods( classFile, m -> writeMethod( m ) );
}
/**
* Finish the code generation.
*
@ -163,10 +151,6 @@ public class ModuleGenerator {
MethodInfo[] methods = classFile.getMethods();
for( MethodInfo method : methods ) {
Code code = method.getCode();
if( method.getName().equals( "<init>" ) && method.getType().equals( "()V" )
&& code.isSuperInitReturn( classFile.getSuperClass() ) ) {
continue; //default constructor
}
handler.accept( method );
}
} catch( IOException ioex ) {
@ -192,6 +176,11 @@ public class ModuleGenerator {
String importName = (String)annotationValues.get( "name" );
writer.prepareImport( name, impoarModule, importName );
writeMethodSignature( name, null, null );
} else {
annotationValues = method.getAnnotation( JWebAssembly.EXPORT_ANNOTATION );
if( annotationValues != null ) {
functions.functionCall( name );
}
}
} catch( Exception ioex ) {
throw WasmException.create( ioex, sourceFile, className, -1 );