diff options
author | acolyer <acolyer> | 2004-12-16 11:04:19 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2004-12-16 11:04:19 +0000 |
commit | ee0b12f950c0c24acf8df868e529385aec523c06 (patch) | |
tree | 846bd7e6e668e8608ca146586fca1cefa14ffa32 /weaver/src | |
parent | ded1a744fc4a518275dbb4fcfa219939ae48ad11 (diff) | |
download | aspectj-ee0b12f950c0c24acf8df868e529385aec523c06.tar.gz aspectj-ee0b12f950c0c24acf8df868e529385aec523c06.zip |
it is now safe to short-circuit in and/or pc matching (all side-effects removed)
Diffstat (limited to 'weaver/src')
-rw-r--r-- | weaver/src/org/aspectj/weaver/patterns/AndPointcut.java | 4 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/patterns/OrPointcut.java | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/weaver/src/org/aspectj/weaver/patterns/AndPointcut.java b/weaver/src/org/aspectj/weaver/patterns/AndPointcut.java index 1775ba3db..dcb951d46 100644 --- a/weaver/src/org/aspectj/weaver/patterns/AndPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/AndPointcut.java @@ -53,7 +53,9 @@ public class AndPointcut extends Pointcut { } protected FuzzyBoolean matchInternal(Shadow shadow) { - return left.match(shadow).and(right.match(shadow)); + FuzzyBoolean leftMatch = left.match(shadow); + if (leftMatch.alwaysFalse()) return leftMatch; + return leftMatch.and(right.match(shadow)); } public FuzzyBoolean match(JoinPoint jp, JoinPoint.StaticPart encJP) { diff --git a/weaver/src/org/aspectj/weaver/patterns/OrPointcut.java b/weaver/src/org/aspectj/weaver/patterns/OrPointcut.java index e204ef329..2eca6de01 100644 --- a/weaver/src/org/aspectj/weaver/patterns/OrPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/OrPointcut.java @@ -51,7 +51,9 @@ public class OrPointcut extends Pointcut { } protected FuzzyBoolean matchInternal(Shadow shadow) { - return left.match(shadow).or(right.match(shadow)); + FuzzyBoolean leftMatch = left.match(shadow); + if (leftMatch.alwaysTrue()) return leftMatch; + return leftMatch.or(right.match(shadow)); } public FuzzyBoolean match(JoinPoint jp, JoinPoint.StaticPart encJP) { |