mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-15 10:44:47 +01:00
compile on the fly only the needed instead all given
This commit is contained in:
parent
d7b283e73a
commit
d4012a751f
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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 );
|
||||
|
Loading…
x
Reference in New Issue
Block a user