public override void OnMixinDefinition(MixinDefinition mixin) { AssertNotInterface(mixin.LexicalInfo, mixin.TypeReference.ResolvedType, MIXIN_CANT_BE_INTERFACE); }
public void BuildUsingCode() { CodeEngineBuilder builder = new CodeEngineBuilder(); EngineConfiguration conf = builder.GetConfiguration(); ImportDirective import = new ImportDirective(LexicalInfo.Empty, "AspectSharp.Tests.Classes"); import.AssemblyReference = new AssemblyReference(LexicalInfo.Empty, "AspectSharp.Tests"); conf.Imports.Add( import ); conf.Mixins.Add( "key", LexicalInfo.Empty ).TypeReference = new TypeReference(LexicalInfo.Empty, "DummyMixin"); conf.Interceptors.Add( "key", LexicalInfo.Empty ).TypeReference = new TypeReference(LexicalInfo.Empty, "DummyInterceptor"); AspectDefinition aspect = new AspectDefinition(LexicalInfo.Empty, "McBrother"); aspect.TargetType = new TargetTypeDefinition(); aspect.TargetType.SingleType = new TypeReference(LexicalInfo.Empty, "DummyCustomer"); conf.Aspects.Add(aspect); MixinDefinition mixin = new MixinDefinition(LexicalInfo.Empty); mixin.TypeReference = new TypeReference(LexicalInfo.Empty, "key", TargetTypeEnum.Link); aspect.Mixins.Add( mixin ); PointCutDefinition pointcut = new PointCutDefinition(LexicalInfo.Empty, PointCutFlags.Method); pointcut.Method = AllMethodSignature.Instance; InterceptorDefinition interceptor = new InterceptorDefinition(LexicalInfo.Empty); interceptor.TypeReference = new TypeReference(LexicalInfo.Empty, "key", TargetTypeEnum.Link); pointcut.Advices.Add(interceptor); aspect.PointCuts.Add(pointcut); AspectEngine engine = builder.Build(); AssertEngineConfiguration(engine); }
private void LoadAspects() { XmlNodeList aspects = _node.SelectNodes("aspect"); foreach (XmlNode node in aspects) { String name = GetRequiredAttribute(node, "name"); AspectDefinition aspect = new AspectDefinition(LexicalInfo.Empty, name); Configuration.Aspects.Add(aspect); XmlNode singleType = node.SelectSingleNode("for/singletype"); if (singleType != null) { aspect.TargetType = new TargetTypeDefinition(); aspect.TargetType.SingleType = CreateTypeReference(singleType); aspect.TargetType.TargetStrategy = TargetStrategyEnum.SingleType; } XmlNode assignableType = node.SelectSingleNode("for/assignable"); if (assignableType != null) { aspect.TargetType = new TargetTypeDefinition(); aspect.TargetType.AssignType = CreateTypeReference(assignableType); aspect.TargetType.TargetStrategy = TargetStrategyEnum.Assignable; } XmlNodeList mixins = node.SelectNodes("mixin"); foreach (XmlNode inner in mixins) { MixinDefinition def = new MixinDefinition(LexicalInfo.Empty); def.TypeReference = CreateTypeReference(inner); aspect.Mixins.Add(def); } XmlNodeList pointcuts = node.SelectNodes("pointcut"); foreach (XmlNode inner in pointcuts) { PointCutDefinition def = CreatePointCutDefinition(inner); aspect.PointCuts.Add(def); } } }
public override void OnMixinDefinition(MixinDefinition mixin) { if (mixin.TypeReference.TargetType == TargetTypeEnum.Type) { base.OnMixinDefinition(mixin); } else { mixin.TypeReference = _mixinKey2TypeReference[ mixin.TypeReference.LinkRef ] as TypeReference; } }
public void Add( MixinDefinition entry ) { InnerList.Add( entry ); }
protected void include( AspectDefinition aspect ) //throws RecognitionException, TokenStreamException { IToken i = null; TypeReference tr = null; MixinDefinition md; try { // for error handling i = LT(1); match(INCLUDE); md = new MixinDefinition( ToLexicalInfo(i) ); tr=type_name_or_ref(); md.TypeReference = tr; aspect.Mixins.Add( md ); } catch (RecognitionException ex) { reportError(ex); consume(); consumeUntil(tokenSet_10_); } }
public void Add(MixinDefinition entry) { InnerList.Add(entry); }