mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 15:37:52 +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.markAsNeededAndReplaceIfExists( offsetFunction );
|
||||||
|
functions.markAsNeeded( STRING_CONSTANT_FUNCTION );
|
||||||
}
|
}
|
||||||
|
|
||||||
return STRING_CONSTANT_FUNCTION;
|
return STRING_CONSTANT_FUNCTION;
|
||||||
|
@ -398,7 +398,7 @@ public abstract class WasmCodeBuilder {
|
|||||||
Integer id = strings.get( value );
|
Integer id = strings.get( value );
|
||||||
FunctionName name = strings.getStringConstantFunction();
|
FunctionName name = strings.getStringConstantFunction();
|
||||||
instructions.add( new WasmConstInstruction( id, ValueType.i32, javaCodePos, lineNumber ) );
|
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 ) {
|
} else if( value instanceof Number ) {
|
||||||
instructions.add( new WasmConstInstruction( (Number)value, javaCodePos, lineNumber ) );
|
instructions.add( new WasmConstInstruction( (Number)value, javaCodePos, lineNumber ) );
|
||||||
} else if( value instanceof ConstantClass ) {
|
} else if( value instanceof ConstantClass ) {
|
||||||
|
@ -685,11 +685,11 @@ public class TextModuleWriter extends ModuleWriter {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void writeFunctionCall( FunctionName name, String comments ) throws IOException {
|
protected void writeFunctionCall( FunctionName name, String comment ) throws IOException {
|
||||||
newline( methodOutput );
|
newline( methodOutput );
|
||||||
methodOutput.append( "call $" ).append( normalizeName( name ) );
|
methodOutput.append( "call $" ).append( normalizeName( name ) );
|
||||||
if( comments != null ) {
|
if( comment != null ) {
|
||||||
methodOutput.append( ") ;; " ).append( comments );
|
methodOutput.append( " ;; \"" ).append( comment.replace( "\n", "\\n" ).replace( "\r", "\\r" ) ).append( '"' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user