aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2005-04-19 12:21:15 +0000
committeraclement <aclement>2005-04-19 12:21:15 +0000
commitc105853907f4ea53f0cc4370651c3adf11b1c641 (patch)
tree8288f60f7cc70b84cade4ddfcbefb04e1447d9b6
parente2e4adc3655a9c69ba9e3f2050c83e38d1a0c17e (diff)
downloadaspectj-c105853907f4ea53f0cc4370651c3adf11b1c641.tar.gz
aspectj-c105853907f4ea53f0cc4370651c3adf11b1c641.zip
from branch: new utility methods for @AJ support
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/Utility.java48
1 files changed, 45 insertions, 3 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/Utility.java b/weaver/src/org/aspectj/weaver/bcel/Utility.java
index 68f2ef2b1..48e23e90f 100644
--- a/weaver/src/org/aspectj/weaver/bcel/Utility.java
+++ b/weaver/src/org/aspectj/weaver/bcel/Utility.java
@@ -124,6 +124,29 @@ public class Utility {
kind);
}
+ /**
+ * Creae a field GET instruction
+ *
+ * @param fact
+ * @param signature
+ * @param declaringType
+ * @return
+ */
+ public static Instruction createGetOn(InstructionFactory fact, Member signature, TypeX declaringType) {
+ short kind;
+ if (signature.isStatic()) {
+ kind = Constants.GETSTATIC;
+ } else {
+ kind = Constants.GETFIELD;
+ }
+
+ return fact.createFieldAccess(
+ declaringType.getName(),
+ signature.getName(),
+ BcelWorld.makeBcelType(signature.getReturnType()),
+ kind);
+ }
+
public static Instruction createSet(InstructionFactory fact, Member signature) {
short kind;
if (signature.isStatic()) {
@@ -201,9 +224,28 @@ public class Utility {
m.getReturnType(),
m.getArgumentTypes(),
kind);
- }
-
-
+ }
+
+ /**
+ * Create an invoke instruction
+ *
+ * @param fact
+ * @param kind INVOKEINTERFACE, INVOKEVIRTUAL..
+ * @param member
+ * @return
+ */
+ public static Instruction createInvoke(
+ InstructionFactory fact,
+ short kind,
+ Member member) {
+ return fact.createInvoke(
+ member.getDeclaringType().getName(),
+ member.getName(),
+ BcelWorld.makeBcelType(member.getReturnType()),
+ BcelWorld.makeBcelTypes(member.getParameterTypes()),
+ kind);
+ }
+
// ??? these should perhaps be cached. Remember to profile this to see if it's a problem.
public static String[] makeArgNames(int n) {
String[] ret = new String[n];