public override void Before(UnifiedElement model, AspectElement.Pointcut target, UnifiedBlock advice) { var exceptions = model.Descendants<UnifiedCatch>(); foreach (var e in exceptions) { var regex = new Regex("^" + target.GetTargetName().ElementAt(1) + "$"); var type = e.Types[0].BasicTypeName as UnifiedIdentifier; if(type == null) continue; var m = regex.Match(type.Name); if (m.Success) { //アドバイスを対象関数に合成する e.Body.Insert(0, advice.DeepCopy()); } } }
// TODO Pointcutの名前が競合しないようにする public abstract void Before(UnifiedElement model, AspectElement.Pointcut target, UnifiedBlock advice);
public override void Before(UnifiedElement model, AspectElement.Pointcut target, UnifiedBlock advice) { InsertAtBeforeCallByName(model, target.GetTargetName().ElementAt(1), advice); }
public override void After(UnifiedElement model, AspectElement.Pointcut target, UnifiedBlock advice) { InsertAtAfterGetByName(model, target.GetTargetName().ElementAt(1), advice); }
// 指定されたポイントカット(名)に対応するafterの織り込み処理を与えられたmodelに適用します public static void WeavingAfter(string name, UnifiedElement model, AspectElement.Pointcut target, UnifiedBlock advice) { var aspect = GetProcessorFromName(name); aspect.After(model, target, advice); }
public override void After(UnifiedElement model, AspectElement.Pointcut target, UnifiedBlock advice) { throw new NotImplementedException(); }