aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/javassist/bytecode/LocalVariableAttribute.java
diff options
context:
space:
mode:
authorchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2003-12-31 05:56:29 +0000
committerchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2003-12-31 05:56:29 +0000
commit33894b1cae728946d3363b5ad27fcbfcf33c86d1 (patch)
tree3f430ab69c49cca58ea0114f60bf211d57948303 /src/main/javassist/bytecode/LocalVariableAttribute.java
parentba0a3e173968737f8683069775e491d3b8764a9d (diff)
downloadjavassist-33894b1cae728946d3363b5ad27fcbfcf33c86d1.tar.gz
javassist-33894b1cae728946d3363b5ad27fcbfcf33c86d1.zip
CtBehavior#insertAt() and support methods have been implemented.
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@63 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/main/javassist/bytecode/LocalVariableAttribute.java')
-rw-r--r--src/main/javassist/bytecode/LocalVariableAttribute.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/javassist/bytecode/LocalVariableAttribute.java b/src/main/javassist/bytecode/LocalVariableAttribute.java
index 74262b67..0bc273d5 100644
--- a/src/main/javassist/bytecode/LocalVariableAttribute.java
+++ b/src/main/javassist/bytecode/LocalVariableAttribute.java
@@ -69,6 +69,22 @@ public class LocalVariableAttribute extends AttributeInfo {
}
/**
+ * Adjusts start_pc and length if bytecode is inserted in a method body.
+ */
+ void shiftPc(int where, int gapLength, boolean exclusive) {
+ int n = tableLength();
+ for (int i = 0; i < n; ++i) {
+ int pos = i * 10 + 2;
+ int pc = ByteArray.readU16bit(info, pos);
+ int len = ByteArray.readU16bit(info, pos + 2);
+ if (pc > where || (exclusive && pc == where))
+ ByteArray.write16bit(pc + gapLength, info, pos);
+ else if (pc + len > where)
+ ByteArray.write16bit(len + gapLength, info, pos + 2);
+ }
+ }
+
+ /**
* Returns <code>local_variable_table[i].name_index</code>.
* This represents the name of the local variable.
*