mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-15 02:44:47 +01:00
add THIS parameter to lambda methods
This commit is contained in:
parent
a6a038aad0
commit
c1869baee5
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2011 - 2020 Volker Berlin (i-net software)
|
||||
Copyright 2011 - 2021 Volker Berlin (i-net software)
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@ -110,6 +110,15 @@ public class MethodInfo implements Member {
|
||||
return (accessFlags & 0x0400) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* If the method is synthetic
|
||||
*
|
||||
* @return true, if synthetic
|
||||
*/
|
||||
public boolean isSynthetic() {
|
||||
return (accessFlags & 0x1000) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
|
@ -222,7 +222,9 @@ public class ModuleGenerator {
|
||||
}
|
||||
if( method != null ) {
|
||||
createInstructions( functions.replace( next, method ) );
|
||||
boolean needThisParameter = !method.isStatic() || "<init>".equals( method.getName() );
|
||||
boolean needThisParameter = !method.isStatic() // if not static there is a not declared THIS parameter
|
||||
|| "<init>".equals( method.getName() ) // constructor method need also the THIS parameter also if marked as static
|
||||
|| (method.isSynthetic() && method.getName().startsWith( "lambda$" )); // lambda functions are static but will call with a THIS parameter which need be removed from stack
|
||||
functions.markAsScanned( next, needThisParameter );
|
||||
if( needThisParameter ) {
|
||||
types.valueOf( next.className ); // for the case that the type unknown yet
|
||||
|
Loading…
x
Reference in New Issue
Block a user