diff options
author | mkersten <mkersten> | 2003-08-16 03:14:36 +0000 |
---|---|---|
committer | mkersten <mkersten> | 2003-08-16 03:14:36 +0000 |
commit | eb12f56518d08c54fc17047749a5d2d66b3c4181 (patch) | |
tree | 40dd436a6848d69b5db2cfb0741a76fcfecfc194 /weaver | |
parent | 466cb82c3ba6cf23e28bb8b8e8da0e54a90486b2 (diff) | |
download | aspectj-eb12f56518d08c54fc17047749a5d2d66b3c4181.tar.gz aspectj-eb12f56518d08c54fc17047749a5d2d66b3c4181.zip |
Added spacewar project for testing.
Diffstat (limited to 'weaver')
-rw-r--r-- | weaver/src/org/aspectj/weaver/AsmRelationshipProvider.java (renamed from weaver/src/org/aspectj/weaver/AsmAdviceRelationshipProvider.java) | 35 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/Shadow.java | 2 |
2 files changed, 30 insertions, 7 deletions
diff --git a/weaver/src/org/aspectj/weaver/AsmAdviceRelationshipProvider.java b/weaver/src/org/aspectj/weaver/AsmRelationshipProvider.java index 59f65ed8d..b6ce56445 100644 --- a/weaver/src/org/aspectj/weaver/AsmAdviceRelationshipProvider.java +++ b/weaver/src/org/aspectj/weaver/AsmRelationshipProvider.java @@ -13,24 +13,47 @@ package org.aspectj.weaver; -import java.util.*; +import java.util.ArrayList; +import java.util.Iterator; import org.aspectj.asm.*; import org.aspectj.asm.internal.ProgramElement; -import org.aspectj.bridge.*; +import org.aspectj.bridge.ISourceLocation; +import org.aspectj.bridge.SourceLocation; -public class AsmAdviceRelationshipProvider { +public class AsmRelationshipProvider { public static final String ADVISES = "advises"; public static final String ADVISED_BY = "advised by"; public static final String DECLARES_ON = "declares on"; public static final String DECLAREDY_BY = "declared by"; + public static final String MATCHED_BY = "matched by"; + public static final String MATCHES_DECLARE = "matches declare"; - public static void checkerMunger(IHierarchy model, Shadow shadow) { -// System.err.println("> " + shadow.getThisVar() + " to " + shadow.getTargetVar()); + public static void checkerMunger(IHierarchy model, Shadow shadow, Checker checker) { + if (shadow.getSourceLocation() == null || checker == null) return; + + String sourceHandle = ProgramElement.createHandleIdentifier( + checker.getSourceLocation().getSourceFile(), + checker.getSourceLocation().getLine(), + checker.getSourceLocation().getColumn()); + + String targetHandle = ProgramElement.createHandleIdentifier( + shadow.getSourceLocation().getSourceFile(), + shadow.getSourceLocation().getLine(), + shadow.getSourceLocation().getColumn()); + + IRelationshipMap mapper = AsmManager.getDefault().getRelationshipMap(); + if (sourceHandle != null && targetHandle != null) { + IRelationship foreward = mapper.get(sourceHandle, IRelationship.Kind.DECLARE, MATCHED_BY); + foreward.getTargets().add(targetHandle); + + IRelationship back = mapper.get(targetHandle, IRelationship.Kind.DECLARE, MATCHES_DECLARE); + back.getTargets().add(sourceHandle); + } } - public static void nodeMunger(IHierarchy model, Shadow shadow, ShadowMunger munger) { + public static void adviceMunger(IHierarchy model, Shadow shadow, ShadowMunger munger) { if (munger instanceof Advice) { Advice advice = (Advice)munger; if (advice.getKind().isPerEntry() || advice.getKind().isCflow()) { diff --git a/weaver/src/org/aspectj/weaver/Shadow.java b/weaver/src/org/aspectj/weaver/Shadow.java index a8a1ebd94..029a16d69 100644 --- a/weaver/src/org/aspectj/weaver/Shadow.java +++ b/weaver/src/org/aspectj/weaver/Shadow.java @@ -341,7 +341,7 @@ public abstract class Shadow { munger.implementOn(this); if (world.getModel() != null) { //System.err.println("munger: " + munger + " on " + this); - AsmAdviceRelationshipProvider.nodeMunger(world.getModel(), this, munger); + AsmRelationshipProvider.adviceMunger(world.getModel(), this, munger); } } } |