mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 15:37:52 +01:00
Also replace static constructor methods
This commit is contained in:
parent
820a4ac6df
commit
f04369fac5
@ -93,6 +93,13 @@ class StaticCodeBuilder {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scan a class initializer (static constructor). If it reference to another class with has class initializer which
|
||||||
|
* was not call then it patch the code and call it before the other class is access.
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* name of the static constuctor
|
||||||
|
*/
|
||||||
private void scanAndPatchIfNeeded( FunctionName name ) {
|
private void scanAndPatchIfNeeded( FunctionName name ) {
|
||||||
String className = name.className;
|
String className = name.className;
|
||||||
String sourceFile = null;
|
String sourceFile = null;
|
||||||
@ -101,6 +108,7 @@ class StaticCodeBuilder {
|
|||||||
ClassFile classFile = classFileLoader.get( className );
|
ClassFile classFile = classFileLoader.get( className );
|
||||||
sourceFile = classFile.getSourceFile();
|
sourceFile = classFile.getSourceFile();
|
||||||
MethodInfo method = classFile.getMethod( name.methodName, name.signature );
|
MethodInfo method = classFile.getMethod( name.methodName, name.signature );
|
||||||
|
method = options.functions.replace( name, method );
|
||||||
|
|
||||||
Code code = method.getCode();
|
Code code = method.getCode();
|
||||||
javaCodeBuilder.buildCode( code, method );
|
javaCodeBuilder.buildCode( code, method );
|
||||||
@ -134,10 +142,8 @@ class StaticCodeBuilder {
|
|||||||
|
|
||||||
if( patched ) {
|
if( patched ) {
|
||||||
options.functions.markAsNeededAndReplaceIfExists( new SyntheticFunctionName( className, name.methodName, name.signature ) {
|
options.functions.markAsNeededAndReplaceIfExists( new SyntheticFunctionName( className, name.methodName, name.signature ) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean hasWasmCode() {
|
protected boolean hasWasmCode() {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user