mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-15 02:44:47 +01:00
write string constant in the text format for easer reading
This commit is contained in:
parent
548d701444
commit
b3bef1570a
@ -90,6 +90,7 @@ public class StringManager extends LinkedHashMap<String, Integer> {
|
||||
}
|
||||
};
|
||||
functions.markAsNeededAndReplaceIfExists( offsetFunction );
|
||||
functions.markAsNeeded( STRING_CONSTANT_FUNCTION );
|
||||
}
|
||||
|
||||
return STRING_CONSTANT_FUNCTION;
|
||||
|
@ -398,7 +398,7 @@ public abstract class WasmCodeBuilder {
|
||||
Integer id = strings.get( value );
|
||||
FunctionName name = strings.getStringConstantFunction();
|
||||
instructions.add( new WasmConstInstruction( id, ValueType.i32, javaCodePos, lineNumber ) );
|
||||
instructions.add( new WasmCallInstruction( name, javaCodePos, lineNumber, types, false, "\"" + value + "\"" ) );
|
||||
instructions.add( new WasmCallInstruction( name, javaCodePos, lineNumber, types, false, (String)value ) );
|
||||
} else if( value instanceof Number ) {
|
||||
instructions.add( new WasmConstInstruction( (Number)value, javaCodePos, lineNumber ) );
|
||||
} else if( value instanceof ConstantClass ) {
|
||||
|
@ -685,11 +685,11 @@ public class TextModuleWriter extends ModuleWriter {
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void writeFunctionCall( FunctionName name, String comments ) throws IOException {
|
||||
protected void writeFunctionCall( FunctionName name, String comment ) throws IOException {
|
||||
newline( methodOutput );
|
||||
methodOutput.append( "call $" ).append( normalizeName( name ) );
|
||||
if( comments != null ) {
|
||||
methodOutput.append( ") ;; " ).append( comments );
|
||||
if( comment != null ) {
|
||||
methodOutput.append( " ;; \"" ).append( comment.replace( "\n", "\\n" ).replace( "\r", "\\r" ) ).append( '"' );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user