public override void OnMixinEntryDefinition(MixinEntryDefinition mixin) { Push(Document.CreateNode(XmlNodeType.Element, "mixin", null)); XmlAttribute att = Document.CreateAttribute("key"); att.Value = mixin.Key; Current.Attributes.Append(att); SerializeTypeReference(mixin.TypeReference); Pop(); }
private void LoadMixins() { XmlNodeList mixins = _node.SelectNodes("mixins/mixin"); foreach (XmlNode node in mixins) { String key = GetRequiredAttribute(node, "key"); MixinEntryDefinition mixin = new MixinEntryDefinition(key, LexicalInfo.Empty); mixin.TypeReference = CreateTypeReference(node); Configuration.Mixins.Add(mixin); } }
public void MixinResolvedFullTypeName() { String content = "mixins \r\n" + "[" + "\"customer\" : System.Collections.ArrayList" + "]"; EngineConfiguration conf = ProcessContent(content); Assert.IsFalse(_context.HasErrors); MixinEntryDefinition mixin = conf.Mixins[0]; Assert.IsNotNull(mixin.Key); Assert.IsNotNull(mixin.TypeReference); Assert.IsNotNull(mixin.TypeReference.ResolvedType); Assert.AreEqual(typeof(System.Collections.ArrayList), mixin.TypeReference.ResolvedType); }
public void MixinResolvedFullTypeNameAndAssembly() { String content = " " + "mixins \r\n" + "[" + "\"customer\" : AspectSharp.Lang.Tests.Types.Mixins.MockMixin in AspectSharp.Lang.Tests" + "]"; EngineConfiguration conf = ProcessContent(content); Assert.IsFalse(_context.HasErrors); MixinEntryDefinition mixin = conf.Mixins[0]; Assert.IsNotNull(mixin.Key); Assert.IsNotNull(mixin.TypeReference); Assert.IsNotNull(mixin.TypeReference.ResolvedType); Assert.AreEqual(typeof(MockMixin), mixin.TypeReference.ResolvedType); }
public void ParsingMixinDeclaration() { AspectParser parser = CreateParser( "mixins \r\n" + "[" + "\"customer\" : CustomerMixin" + "]"); EngineConfiguration conf = parser.Parse(); Assert.IsNotNull(conf); Assert.IsNotNull(conf.Mixins); Assert.AreEqual(1, conf.Mixins.Count); MixinEntryDefinition def = conf.Mixins[0]; Assert.IsNotNull(def); Assert.AreEqual("customer", def.Key); Assert.AreEqual(TargetTypeEnum.Type, def.TypeReference.TargetType); Assert.AreEqual("CustomerMixin", def.TypeReference.TypeName); }
public void ParsingMixinsDeclarations() { AspectParser parser = CreateParser( "mixins \r\n" + "[" + " \"key1\" : Namespace.CustomerMixin1 in MyAssembly;" + " \"key2\" : Namespace.CustomerMixin2 in MyAssembly;" + " \"key3\" : Namespace.CustomerMixin3 in MyAssembly" + "]"); EngineConfiguration conf = parser.Parse(); Assert.IsNotNull(conf); Assert.IsNotNull(conf.Mixins); Assert.AreEqual(3, conf.Mixins.Count); MixinEntryDefinition def = conf.Mixins[0]; Assert.IsNotNull(def); Assert.AreEqual("key1", def.Key); Assert.AreEqual(TargetTypeEnum.Type, def.TypeReference.TargetType); Assert.AreEqual("Namespace.CustomerMixin1", def.TypeReference.TypeName); Assert.AreEqual("MyAssembly", def.TypeReference.AssemblyReference.AssemblyName); def = conf.Mixins[1]; Assert.IsNotNull(def); Assert.AreEqual("key2", def.Key); Assert.AreEqual(TargetTypeEnum.Type, def.TypeReference.TargetType); Assert.AreEqual("Namespace.CustomerMixin2", def.TypeReference.TypeName); Assert.AreEqual("MyAssembly", def.TypeReference.AssemblyReference.AssemblyName); def = conf.Mixins[2]; Assert.IsNotNull(def); Assert.AreEqual("key3", def.Key); Assert.AreEqual(TargetTypeEnum.Type, def.TypeReference.TargetType); Assert.AreEqual("Namespace.CustomerMixin3", def.TypeReference.TypeName); Assert.AreEqual("MyAssembly", def.TypeReference.AssemblyReference.AssemblyName); }
public override void OnMixinEntryDefinition(MixinEntryDefinition mixin) { Push( Document.CreateNode(XmlNodeType.Element, "mixin", null) ); XmlAttribute att = Document.CreateAttribute("key"); att.Value = mixin.Key; Current.Attributes.Append( att ); SerializeTypeReference(mixin.TypeReference); Pop(); }
public override void OnMixinEntryDefinition(MixinEntryDefinition mixin) { AssertNotInterface(mixin.LexicalInfo, mixin.TypeReference.ResolvedType, MIXIN_CANT_BE_INTERFACE); }
public override void OnMixinEntryDefinition(MixinEntryDefinition mixin) { base.OnMixinEntryDefinition(mixin); _mixinKey2TypeReference[mixin.Key] = mixin.TypeReference; }
public virtual void OnMixinEntryDefinition(MixinEntryDefinition mixin) { OnTypeReferenceDefinition(mixin.TypeReference); }