mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-15 02:44:47 +01:00
Split ModuleWriter in ModuleWrite and ModuleGenerator
This commit is contained in:
parent
50648d74a1
commit
dea54b631c
@ -30,6 +30,7 @@ import javax.annotation.Nonnull;
|
||||
|
||||
import de.inetsoftware.classparser.ClassFile;
|
||||
import de.inetsoftware.jwebassembly.binary.BinaryModuleWriter;
|
||||
import de.inetsoftware.jwebassembly.module.ModuleGenerator;
|
||||
import de.inetsoftware.jwebassembly.module.ModuleWriter;
|
||||
import de.inetsoftware.jwebassembly.text.TextModuleWriter;
|
||||
|
||||
@ -157,14 +158,15 @@ public class JWebAssembly {
|
||||
* if any conversion error occurs
|
||||
*/
|
||||
private void compile( ModuleWriter writer ) throws IOException, WasmException {
|
||||
ModuleGenerator generator = new ModuleGenerator( writer );
|
||||
for( URL url : classFiles ) {
|
||||
ClassFile classFile = new ClassFile( new BufferedInputStream( url.openStream() ) );
|
||||
writer.prepare( classFile );
|
||||
generator.prepare( classFile );
|
||||
}
|
||||
writer.prepareFinish();
|
||||
generator.prepareFinish();
|
||||
for( URL url : classFiles ) {
|
||||
ClassFile classFile = new ClassFile( new BufferedInputStream( url.openStream() ) );
|
||||
writer.write( classFile );
|
||||
generator.write( classFile );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -277,9 +277,7 @@ public class BinaryModuleWriter extends ModuleWriter implements InstructionOpcod
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void writeMethodSignature( MethodInfo method ) throws IOException, WasmException {
|
||||
super.writeMethodSignature( method );
|
||||
|
||||
protected void writeMethodParamFinish() throws IOException {
|
||||
int typeId = functionTypes.indexOf( functionType );
|
||||
if( typeId < 0 ) {
|
||||
typeId = functionTypes.size();
|
||||
|
1151
src/de/inetsoftware/jwebassembly/module/ModuleGenerator.java
Normal file
1151
src/de/inetsoftware/jwebassembly/module/ModuleGenerator.java
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -106,6 +106,12 @@ public class TextModuleWriter extends ModuleWriter {
|
||||
output.append( " (" ).append( kind ).append( ' ' ).append( valueType.toString() ).append( ')' );
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void writeMethodParamFinish() throws IOException {}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user