mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 07:27:52 +01:00
Add setCopy()/getCopy()
This commit is contained in:
parent
3fd3c63351
commit
28bf07567f
@ -23,6 +23,7 @@ import java.util.HashSet;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import de.inetsoftware.classparser.LocalVariable;
|
import de.inetsoftware.classparser.LocalVariable;
|
||||||
@ -439,6 +440,32 @@ class LocaleVariableManager {
|
|||||||
return variables[slot].valueType;
|
return variables[slot].valueType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a copy of the internal state
|
||||||
|
*
|
||||||
|
* @return the state
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
Variable[] getCopy() {
|
||||||
|
Variable[] copy = Arrays.copyOf( variables, size );
|
||||||
|
for( int i = 0; i < size; i++ ) {
|
||||||
|
variables[i] = new Variable();
|
||||||
|
}
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a previous copy
|
||||||
|
*
|
||||||
|
* @param copy
|
||||||
|
* the previous state
|
||||||
|
*/
|
||||||
|
void setCopy( @Nonnull Variable[] copy ) {
|
||||||
|
size = copy.length;
|
||||||
|
ensureCapacity( size );
|
||||||
|
System.arraycopy( copy, 0, variables, 0, size );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensure that there is enough capacity.
|
* Ensure that there is enough capacity.
|
||||||
*
|
*
|
||||||
@ -458,7 +485,7 @@ class LocaleVariableManager {
|
|||||||
/**
|
/**
|
||||||
* The state of a single local variable slot.
|
* The state of a single local variable slot.
|
||||||
*/
|
*/
|
||||||
private static class Variable implements Comparable<Variable> {
|
static class Variable implements Comparable<Variable> {
|
||||||
|
|
||||||
private AnyType valueType;
|
private AnyType valueType;
|
||||||
|
|
||||||
@ -477,7 +504,7 @@ class LocaleVariableManager {
|
|||||||
* the position to check
|
* the position to check
|
||||||
* @return true, if this variable match
|
* @return true, if this variable match
|
||||||
*/
|
*/
|
||||||
public boolean matchCodePosition( int codePosition ) {
|
private boolean matchCodePosition( int codePosition ) {
|
||||||
return startPos <= codePosition && codePosition <= endPos;
|
return startPos <= codePosition && codePosition <= endPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user