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);
		}
Beispiel #2
0
		private void LoadImports()
		{
			XmlNodeList imports = _node.SelectNodes("import");
			foreach (XmlNode node in imports)
			{
				String ns = GetRequiredAttribute(node, "namespace");
				ImportDirective import = new ImportDirective(LexicalInfo.Empty, ns);
				import.AssemblyReference = CreateAssemblyReference(node);

				Configuration.Imports.Add(import);
			}
		}
Beispiel #3
0
		public override void OnImportDirective(ImportDirective import)
		{
			base.OnImportDirective (import);

			if (import.AssemblyReference != null)
			{
				_typeManager.AddAssembly( import.AssemblyReference.ResolvedAssembly );
			}
		}
		public void Add(ImportDirective node)
		{
			InnerList.Add(node);
		}
	protected void import_directive(
		EngineConfiguration conf
	) //throws RecognitionException, TokenStreamException
{
		
		IToken  i = null;
		
				String ns;
				String assemblyName;
				ImportDirective import = null;
			
		
		try {      // for error handling
			i = LT(1);
			match(IMPORT);
			ns=identifier();
			
					import = new ImportDirective( ToLexicalInfo(i), ns );
					conf.Imports.Add(import);
				
			{
				switch ( LA(1) )
				{
				case IN:
				{
					match(IN);
					assemblyName=identifier();
					
						        import.AssemblyReference = new AssemblyReference( ToLexicalInfo(i), assemblyName);
						
					break;
				}
				case EOF:
				case ASPECT:
				case IMPORT:
				case MIXINS:
				case INTERCEPTORS:
				{
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				 }
			}
		}
		catch (RecognitionException ex)
		{
			reportError(ex);
			consume();
			consumeUntil(tokenSet_1_);
		}
	}
Beispiel #6
0
 public void Add(ImportDirective node)
 {
     InnerList.Add(node);
 }