コード例 #1
0
        public void InstantiatedMethodByArgumentTest_Complex()
        {
            // build "T MyMethod<T,S> (S b, KeyValuePair<S, T> a)"
            DomMethod method = new DomMethod();

            method.Name       = "MyMethod";
            method.ReturnType = new DomReturnType("T");
            method.AddTypeParameter(new TypeParameter("T"));
            method.AddTypeParameter(new TypeParameter("S"));
            method.Add(new DomParameter(method, "b", new DomReturnType("S")));

            DomReturnType returnType = new DomReturnType("KeyValuePair");

            returnType.AddTypeParameter(new DomReturnType("T"));
            returnType.AddTypeParameter(new DomReturnType("S"));
            method.Add(new DomParameter(method, "a", returnType));

            // give int, object as param type
            List <IReturnType> genArgs = new List <IReturnType> ();
            List <IReturnType> args    = new List <IReturnType> ();

            genArgs.Add(DomReturnType.Int32);
            genArgs.Add(DomReturnType.Object);

            IMethod instMethod = DomMethod.CreateInstantiatedGenericMethod(method, genArgs, args);

            // check
            Assert.AreEqual(DomReturnType.Int32.FullName, instMethod.ReturnType.FullName);
            Assert.AreEqual(DomReturnType.Object.FullName, instMethod.Parameters[0].ReturnType.FullName);

            Assert.AreEqual(DomReturnType.Int32.FullName, instMethod.Parameters[1].ReturnType.GenericArguments[0].FullName);
            Assert.AreEqual(DomReturnType.Object.FullName, instMethod.Parameters[1].ReturnType.GenericArguments[1].FullName);
        }
コード例 #2
0
        public void ExtensionMethodPreserveParameterTest()
        {
            // build "T MyMethod<T, S> (T a, S b)"
            DomMethod method = new DomMethod();

            method.Name       = "MyMethod";
            method.ReturnType = new DomReturnType("T");
            method.AddTypeParameter(new TypeParameter("T"));
            method.AddTypeParameter(new TypeParameter("S"));

            method.Add(new DomParameter(method, "a", new DomReturnType("T")));
            method.Add(new DomParameter(method, "b", new DomReturnType("S")));

            // extend method
            List <IReturnType> genArgs = new List <IReturnType> ();
            List <IReturnType> args    = new List <IReturnType> ();
            DomType            extType = new DomType("MyType");

            ExtensionMethod extMethod = new ExtensionMethod(extType, method, genArgs, args);

            // check for MyType MyMethod<S> (S b)
            Assert.AreEqual("MyType", extMethod.ReturnType.FullName);
            Assert.AreEqual("S", extMethod.Parameters[0].ReturnType.FullName);
            Assert.AreEqual(1, extMethod.TypeParameters.Count);
            Assert.AreEqual("S", extMethod.TypeParameters[0].Name);
        }
コード例 #3
0
        public static DomMethod ReadMethod(BinaryReader reader, INameDecoder nameTable)
        {
            DomMethod result = new DomMethod();

            ReadMemberInformation(reader, nameTable, result);
            uint explicitInterfaces = ReadUInt(reader, 500);

            while (explicitInterfaces-- > 0)
            {
                result.AddExplicitInterface(ReadReturnType(reader, nameTable));
            }

            result.BodyRegion     = ReadRegion(reader, nameTable);
            result.ReturnType     = ReadReturnType(reader, nameTable);
            result.MethodModifier = (MethodModifier)reader.ReadInt32();

            uint arguments = ReadUInt(reader, 5000);

            while (arguments-- > 0)
            {
                result.Add(ReadParameter(reader, nameTable));
            }
            arguments = ReadUInt(reader, 500);
            while (arguments-- > 0)
            {
                result.AddTypeParameter(ReadTypeParameter(reader, nameTable));
            }
            return(result);
        }
コード例 #4
0
			public override object VisitOperatorDeclaration (ICSharpCode.NRefactory.Ast.OperatorDeclaration operatorDeclaration, object data)
			{
				DomMethod method = new DomMethod ();
				method.Name = GetOperatorName (operatorDeclaration);
				method.Documentation = RetrieveDocumentation (operatorDeclaration.StartLocation.Line);
				method.Location = ConvertLocation (operatorDeclaration.StartLocation);
				method.BodyRegion = ConvertRegion (operatorDeclaration.EndLocation, operatorDeclaration.Body != null ? operatorDeclaration.Body.EndLocation : new ICSharpCode.NRefactory.Location (-1, -1));
				method.Modifiers = ConvertModifiers (operatorDeclaration.Modifier) | Modifiers.SpecialName;
				if (operatorDeclaration.IsExtensionMethod)
					method.MethodModifier |= MethodModifier.IsExtension;
				method.ReturnType = ConvertReturnType (operatorDeclaration.TypeReference);
				AddAttributes (method, operatorDeclaration.Attributes);
				method.Add (ConvertParameterList (method, operatorDeclaration.Parameters));
				AddExplicitInterfaces (method, operatorDeclaration.InterfaceImplementations);

				if (operatorDeclaration.Templates != null && operatorDeclaration.Templates.Count > 0) {
					foreach (ICSharpCode.NRefactory.Ast.TemplateDefinition td in operatorDeclaration.Templates) {
						method.AddTypeParameter (ConvertTemplateDefinition (td));
					}
				}
				method.DeclaringType = typeStack.Peek ();
				typeStack.Peek ().Add (method);

				return null;
			}
コード例 #5
0
        public void InstantiatedMethodByParameterTest()
        {
            // build "T MyMethod<T> (T[] a)"
            DomMethod method = new DomMethod();

            method.Name       = "MyMethod";
            method.ReturnType = new DomReturnType("T");
            method.AddTypeParameter(new TypeParameter("T"));
            DomReturnType returnType = new DomReturnType("T");

            returnType.ArrayDimensions = 1;
            method.Add(new DomParameter(method, "a", returnType));

            // give int[] as param type.
            List <IReturnType> genArgs = new List <IReturnType> ();
            List <IReturnType> args    = new List <IReturnType> ();

            returnType = new DomReturnType(DomReturnType.Int32.FullName);
            returnType.ArrayDimensions = 1;
            args.Add(returnType);

            IMethod instMethod = DomMethod.CreateInstantiatedGenericMethod(method, genArgs, args);

            // check (note that return type should be int and not int[])
            Assert.AreEqual(DomReturnType.Int32.FullName, instMethod.ReturnType.FullName);
            Assert.AreEqual(0, instMethod.ReturnType.ArrayDimensions);
            Assert.AreEqual(DomReturnType.Int32.FullName, instMethod.Parameters[0].ReturnType.FullName);
        }
コード例 #6
0
        public void InstantiatedMethodByArgumentTestComplex2()
        {
            // build "T MyMethod<T> (MyType<T> a)"
            DomMethod method = new DomMethod();

            method.Name       = "MyMethod";
            method.ReturnType = new DomReturnType("T");
            method.AddTypeParameter(new TypeParameter("T"));

            DomReturnType returnType = new DomReturnType("MyType");

            returnType.AddTypeParameter(new DomReturnType("T"));
            method.Add(new DomParameter(method, "a", returnType));

            // give int as param type
            List <IReturnType> genArgs = new List <IReturnType> ();
            List <IReturnType> args    = new List <IReturnType> ();

            returnType = new DomReturnType("MyType");
            returnType.AddTypeParameter(DomReturnType.Int32);
            args.Add(returnType);
            IMethod instMethod = DomMethod.CreateInstantiatedGenericMethod(method, genArgs, args);

            // check
            Assert.AreEqual(DomReturnType.Int32.FullName, instMethod.ReturnType.FullName);
        }
コード例 #7
0
ファイル: DomTests.cs プロジェクト: Kalnor/monodevelop
		public void InstantiatedMethodByParameterTest ()
		{
			// build "T MyMethod<T> (T[] a)"
			DomMethod method = new DomMethod ();
			method.Name = "MyMethod";
			method.ReturnType = new DomReturnType ("T");
			method.AddTypeParameter (new TypeParameter ("T"));
			DomReturnType returnType = new DomReturnType ("T");
			returnType.ArrayDimensions = 1;
			method.Add (new DomParameter (method, "a", returnType));
			
			// give int[] as param type.
			List<IReturnType> genArgs = new List<IReturnType> ();
			List<IReturnType> args    = new List<IReturnType> ();
			returnType = new DomReturnType (DomReturnType.Int32.FullName);
			returnType.ArrayDimensions = 1;
			args.Add (returnType);
			
			IMethod instMethod = DomMethod.CreateInstantiatedGenericMethod (method, genArgs, args);
			
			// check (note that return type should be int and not int[])
			Assert.AreEqual (DomReturnType.Int32.FullName, instMethod.ReturnType.FullName);
			Assert.AreEqual (0, instMethod.ReturnType.ArrayDimensions);
			Assert.AreEqual (DomReturnType.Int32.FullName, instMethod.Parameters[0].ReturnType.FullName);
		}
コード例 #8
0
        public void ExtensionMethodTest()
        {
            // build "T MyMethod<T, S> (this KeyValuePair<T, S> a, S b)"
            DomMethod method = new DomMethod();

            method.Name       = "MyMethod";
            method.ReturnType = new DomReturnType("T");
            method.AddTypeParameter(new TypeParameter("T"));
            method.AddTypeParameter(new TypeParameter("S"));

            DomReturnType returnType = new DomReturnType("KeyValuePair");

            returnType.AddTypeParameter(new DomReturnType("T"));
            returnType.AddTypeParameter(new DomReturnType("S"));
            method.Add(new DomParameter(method, "a", returnType));
            method.Add(new DomParameter(method, "b", new DomReturnType("S")));

            // Build extendet type KeyValuePair<int, object>
            DomType type = new DomType("KeyValuePair");

            type.AddTypeParameter(new TypeParameter("T"));
            type.AddTypeParameter(new TypeParameter("S"));
            IType extType = DomType.CreateInstantiatedGenericTypeInternal(type, new IReturnType[] { DomReturnType.Int32, DomReturnType.Object });

            Console.WriteLine(extType);

            // extend method
            List <IReturnType> genArgs = new List <IReturnType> ();
            List <IReturnType> args    = new List <IReturnType> ();

            ExtensionMethod extMethod = new ExtensionMethod(extType, method, genArgs, args);

            Console.WriteLine(extMethod);
            // check
            Assert.AreEqual(DomReturnType.Int32.FullName, extMethod.ReturnType.FullName);
            Assert.AreEqual(DomReturnType.Object.FullName, extMethod.Parameters[0].ReturnType.FullName);
        }
コード例 #9
0
ファイル: DomTests.cs プロジェクト: Kalnor/monodevelop
		public void InstantiatedMethodByArgumentTest ()
		{
			// build "T MyMethod<T> (T a)"
			DomMethod method = new DomMethod ();
			method.Name = "MyMethod";
			method.ReturnType = new DomReturnType ("T");
			method.AddTypeParameter (new TypeParameter ("T"));
			method.Add (new DomParameter (method, "a", new DomReturnType ("T")));
			
			// give int as param type
			List<IReturnType> genArgs = new List<IReturnType> ();
			List<IReturnType> args    = new List<IReturnType> ();
			args.Add (DomReturnType.Int32);
			IMethod instMethod = DomMethod.CreateInstantiatedGenericMethod (method, genArgs, args);
			
			// check 
			Assert.AreEqual (DomReturnType.Int32.FullName, instMethod.ReturnType.FullName);
			Assert.AreEqual (DomReturnType.Int32.FullName, instMethod.Parameters[0].ReturnType.FullName);
		}
コード例 #10
0
        public void ReadWriteMethodTest()
        {
            DomMethod input = new DomMethod();

            input.Name           = "Test";
            input.MethodModifier = MethodModifier.IsConstructor;
            input.Add(new DomParameter(input, "par1", DomReturnType.Void));
            input.AddTypeParameter(new TypeParameter("T"));
            MemoryStream ms     = new MemoryStream();
            BinaryWriter writer = new BinaryWriter(ms);

            DomPersistence.Write(writer, DefaultNameEncoder, input);
            byte[] bytes = ms.ToArray();

            DomMethod result = DomPersistence.ReadMethod(CreateReader(bytes), DefaultNameDecoder, null);

            Assert.AreEqual("Test", result.Name);
            Assert.AreEqual(true, result.IsConstructor);
            Assert.AreEqual("par1", result.Parameters [0].Name);
            Assert.AreEqual("Void", result.Parameters [0].ReturnType.Name);
            Assert.AreEqual(1, result.TypeParameters.Count);
            Assert.AreEqual("T", result.TypeParameters [0].Name);
        }
コード例 #11
0
ファイル: ParsedDModule.cs プロジェクト: nazriel/Mono-D
        public static MonoDevelop.Projects.Dom.INode ConvertDParserToDomNode(D_Parser.Dom.INode n, ParsedDocument doc)
        {
            //TODO: DDoc comments!

            if (n is DMethod)
            {
                var dm = n as DMethod;

                var domMethod = new DomMethod(
                    n.Name,
                    GetNodeModifiers(dm),
                    dm.SpecialType == DMethod.MethodType.Constructor ? MethodModifier.IsConstructor : MethodModifier.None,
                    FromCodeLocation(n.StartLocation),
                    GetBlockBodyRegion(dm),
                    GetReturnType(n));

                foreach (var pn in dm.Parameters)
                    domMethod.Add(new DomParameter(domMethod, pn.Name, GetReturnType(pn)));

                domMethod.AddTypeParameter(GetTypeParameters(dm));

                foreach (var subNode in dm) domMethod.AddChild(ConvertDParserToDomNode(subNode, doc));

                return domMethod;
            }
            else if (n is DEnum)
            {
                var de = n as DEnum;

                var domType = new DomType(
                    doc.CompilationUnit,
                    ClassType.Enum,
                    GetNodeModifiers(de),
                    n.Name,
                    FromCodeLocation(n.StartLocation),
                    BuildTypeNamespace(n), GetBlockBodyRegion(de));

                foreach (var subNode in de)
                    domType.Add(ConvertDParserToDomNode(subNode, doc) as IMember);
                return domType;
            }
            else if (n is DClassLike)
            {
                var dc = n as DClassLike;

                ClassType ct = ClassType.Unknown;

                switch (dc.ClassType)
                {
                    case DTokens.Template:
                    case DTokens.Class:
                        ct = ClassType.Class;
                        break;
                    case DTokens.Interface:
                        ct = ClassType.Interface;
                        break;
                    case DTokens.Union:
                    case DTokens.Struct:
                        ct = ClassType.Struct;
                        break;
                }

                var domType = new DomType(
                    doc.CompilationUnit,
                    ct,
                    GetNodeModifiers(dc),
                    n.Name,
                    FromCodeLocation(n.StartLocation),
                    BuildTypeNamespace(n),
                    GetBlockBodyRegion(dc));

                domType.AddTypeParameter(GetTypeParameters(dc));
                foreach (var subNode in dc)
                    domType.Add(ConvertDParserToDomNode(subNode, doc) as IMember);
                return domType;
            }
            else if (n is DVariable)
            {
                var dv = n as DVariable;
                return new DomField(n.Name, GetNodeModifiers(dv), FromCodeLocation(n.StartLocation), GetReturnType(n));
            }
            return null;
        }
コード例 #12
0
		public static DomMethod ReadMethod (BinaryReader reader, INameDecoder nameTable, IDomObjectTable objectTable)
		{
			DomMethod result = new DomMethod ();
			ReadMemberInformation (reader, nameTable, objectTable, result);
			uint explicitInterfaces = ReadUInt (reader, 500);
			while (explicitInterfaces-- > 0) {
				result.AddExplicitInterface (ReadReturnType (reader, nameTable, objectTable));
			}
			
			result.BodyRegion = ReadRegion (reader, nameTable);
			result.ReturnType = ReadReturnType (reader, nameTable, objectTable);
			result.MethodModifier = (MethodModifier)reader.ReadInt32 ();
			
			uint arguments = ReadUInt (reader, 5000);
			while (arguments-- > 0) {
				result.Add (ReadParameter (reader, nameTable, objectTable));
			}
			arguments = ReadUInt (reader, 500);
			while (arguments-- > 0) {
				result.AddTypeParameter (ReadTypeParameter (reader, nameTable, objectTable));
			}
			return result;
		}
コード例 #13
0
ファイル: ParsedDModule.cs プロジェクト: nazriel/Mono-D
        public static MonoDevelop.Projects.Dom.INode ConvertDParserToDomNode(D_Parser.Dom.INode n, ParsedDocument doc)
        {
            //TODO: DDoc comments!

            if (n is DMethod)
            {
                var dm = n as DMethod;

                var domMethod = new DomMethod(
                    n.Name,
                    GetNodeModifiers(dm),
                    dm.SpecialType == DMethod.MethodType.Constructor ? MethodModifier.IsConstructor : MethodModifier.None,
                    FromCodeLocation(n.StartLocation),
                    GetBlockBodyRegion(dm),
                    GetReturnType(n));

                foreach (var pn in dm.Parameters)
                {
                    domMethod.Add(new DomParameter(domMethod, pn.Name, GetReturnType(pn)));
                }


                domMethod.AddTypeParameter(GetTypeParameters(dm));

                foreach (var subNode in dm)
                {
                    domMethod.AddChild(ConvertDParserToDomNode(subNode, doc));
                }

                return(domMethod);
            }
            else if (n is DEnum)
            {
                var de = n as DEnum;

                var domType = new DomType(
                    doc.CompilationUnit,
                    ClassType.Enum,
                    GetNodeModifiers(de),
                    n.Name,
                    FromCodeLocation(n.StartLocation),
                    BuildTypeNamespace(n), GetBlockBodyRegion(de));

                foreach (var subNode in de)
                {
                    domType.Add(ConvertDParserToDomNode(subNode, doc) as IMember);
                }
                return(domType);
            }
            else if (n is DClassLike)
            {
                var dc = n as DClassLike;

                ClassType ct = ClassType.Unknown;

                switch (dc.ClassType)
                {
                case DTokens.Template:
                case DTokens.Class:
                    ct = ClassType.Class;
                    break;

                case DTokens.Interface:
                    ct = ClassType.Interface;
                    break;

                case DTokens.Union:
                case DTokens.Struct:
                    ct = ClassType.Struct;
                    break;
                }

                var domType = new DomType(
                    doc.CompilationUnit,
                    ct,
                    GetNodeModifiers(dc),
                    n.Name,
                    FromCodeLocation(n.StartLocation),
                    BuildTypeNamespace(n),
                    GetBlockBodyRegion(dc));

                domType.AddTypeParameter(GetTypeParameters(dc));
                foreach (var subNode in dc)
                {
                    domType.Add(ConvertDParserToDomNode(subNode, doc) as IMember);
                }
                return(domType);
            }
            else if (n is DVariable)
            {
                var dv = n as DVariable;
                return(new DomField(n.Name, GetNodeModifiers(dv), FromCodeLocation(n.StartLocation), GetReturnType(n)));
            }
            return(null);
        }
コード例 #14
0
		public void ReadWriteMethodTest ()
		{
			DomMethod input = new DomMethod ();
			input.Name      = "Test";
			input.MethodModifier = MethodModifier.IsConstructor;
			input.Add (new DomParameter (input, "par1", DomReturnType.Void));
			input.AddTypeParameter (new TypeParameter ("T"));
			MemoryStream ms = new MemoryStream ();
			BinaryWriter writer = new BinaryWriter (ms);
			DomPersistence.Write (writer, DefaultNameEncoder, input);
			byte[] bytes = ms.ToArray ();
			
			DomMethod result = DomPersistence.ReadMethod (CreateReader (bytes), DefaultNameDecoder);
			Assert.AreEqual ("Test", result.Name);
			Assert.AreEqual (true, result.IsConstructor);
			Assert.AreEqual ("par1", result.Parameters [0].Name);
			Assert.AreEqual ("Void", result.Parameters [0].ReturnType.Name);
			Assert.AreEqual (1, result.TypeParameters.Count);
			Assert.AreEqual ("T", result.TypeParameters [0].Name);
		}
コード例 #15
0
ファイル: DomTests.cs プロジェクト: Kalnor/monodevelop
		public void ExtensionMethodPreserveParameterTest ()
		{
			// build "T MyMethod<T, S> (T a, S b)"
			DomMethod method = new DomMethod ();
			method.Name = "MyMethod";
			method.ReturnType = new DomReturnType ("T");
			method.AddTypeParameter (new TypeParameter ("T"));
			method.AddTypeParameter (new TypeParameter ("S"));
			
			method.Add (new DomParameter (method, "a", new DomReturnType ("T")));
			method.Add (new DomParameter (method, "b", new DomReturnType ("S")));
			
			// extend method
			List<IReturnType> genArgs = new List<IReturnType> ();
			List<IReturnType> args    = new List<IReturnType> ();
			DomType extType = new DomType ("MyType");
			
			ExtensionMethod extMethod = new ExtensionMethod (extType, method, genArgs, args);
			
			// check for MyType MyMethod<S> (S b)
			Assert.AreEqual ("MyType", extMethod.ReturnType.FullName);
			Assert.AreEqual ("S", extMethod.Parameters[0].ReturnType.FullName);
			Assert.AreEqual (1, extMethod.TypeParameters.Count);
			Assert.AreEqual ("S", extMethod.TypeParameters[0].Name);
		}
コード例 #16
0
ファイル: DomTests.cs プロジェクト: Kalnor/monodevelop
		public void InstantiatedMethodByArgumentTest_Complex ()
		{
			// build "T MyMethod<T,S> (S b, KeyValuePair<S, T> a)"
			DomMethod method = new DomMethod ();
			method.Name = "MyMethod";
			method.ReturnType = new DomReturnType ("T");
			method.AddTypeParameter (new TypeParameter ("T"));
			method.AddTypeParameter (new TypeParameter ("S"));
			method.Add (new DomParameter (method, "b", new DomReturnType ("S")));
			
			DomReturnType returnType = new DomReturnType ("KeyValuePair");
			returnType.AddTypeParameter (new DomReturnType ("T"));
			returnType.AddTypeParameter (new DomReturnType ("S"));
			method.Add (new DomParameter (method, "a", returnType));
			
			// give int, object as param type
			List<IReturnType> genArgs = new List<IReturnType> ();
			List<IReturnType> args    = new List<IReturnType> ();
			genArgs.Add (DomReturnType.Int32);
			genArgs.Add (DomReturnType.Object);
			
			IMethod instMethod = DomMethod.CreateInstantiatedGenericMethod (method, genArgs, args);
			
			// check
			Assert.AreEqual (DomReturnType.Int32.FullName, instMethod.ReturnType.FullName);
			Assert.AreEqual (DomReturnType.Object.FullName, instMethod.Parameters[0].ReturnType.FullName);
			
			Assert.AreEqual (DomReturnType.Int32.FullName, instMethod.Parameters[1].ReturnType.GenericArguments[0].FullName);
			Assert.AreEqual (DomReturnType.Object.FullName, instMethod.Parameters[1].ReturnType.GenericArguments[1].FullName);
		}
コード例 #17
0
			public override object VisitOperatorDeclaration (ICSharpCode.NRefactory.Ast.OperatorDeclaration operatorDeclaration, object data)
			{
				DomMethod method = new DomMethod ();
				method.Name = GetOperatorName (operatorDeclaration);
				method.Documentation = RetrieveDocumentation (operatorDeclaration.StartLocation.Line);
				method.Location = ConvertLocation (operatorDeclaration.StartLocation);
				method.BodyRegion = ConvertRegion (operatorDeclaration.EndLocation, operatorDeclaration.Body != null ? operatorDeclaration.Body.EndLocation : new ICSharpCode.NRefactory.Location (-1, -1));
				method.Modifiers = ConvertModifiers (operatorDeclaration.Modifier) | Modifiers.SpecialName;
				if (operatorDeclaration.IsExtensionMethod)
					method.MethodModifier |= MethodModifier.IsExtension;
				method.ReturnType = ConvertReturnType (operatorDeclaration.TypeReference);
				AddAttributes (method, operatorDeclaration.Attributes);
				method.Add (ConvertParameterList (method, operatorDeclaration.Parameters));
				AddExplicitInterfaces (method, operatorDeclaration.InterfaceImplementations);

				if (operatorDeclaration.Templates != null && operatorDeclaration.Templates.Count > 0) {
					foreach (ICSharpCode.NRefactory.Ast.TemplateDefinition td in operatorDeclaration.Templates) {
						method.AddTypeParameter (ConvertTemplateDefinition (td));
					}
				}
				method.DeclaringType = typeStack.Peek ();
				typeStack.Peek ().Add (method);

				return null;
			}
コード例 #18
0
ファイル: DomTests.cs プロジェクト: Kalnor/monodevelop
		public void ExtensionMethodTest ()
		{
			// build "T MyMethod<T, S> (this KeyValuePair<T, S> a, S b)"
			DomMethod method = new DomMethod ();
			method.Name = "MyMethod";
			method.ReturnType = new DomReturnType ("T");
			method.AddTypeParameter (new TypeParameter ("T"));
			method.AddTypeParameter (new TypeParameter ("S"));
			
			DomReturnType returnType = new DomReturnType ("KeyValuePair");
			returnType.AddTypeParameter (new DomReturnType ("T"));
			returnType.AddTypeParameter (new DomReturnType ("S"));
			method.Add (new DomParameter (method, "a", returnType));
			method.Add (new DomParameter (method, "b", new DomReturnType ("S")));
			
			// Build extendet type KeyValuePair<int, object>
			DomType type = new DomType ("KeyValuePair");
			type.AddTypeParameter (new TypeParameter ("T"));
			type.AddTypeParameter (new TypeParameter ("S"));
			IType extType = DomType.CreateInstantiatedGenericTypeInternal (type, new IReturnType[] { DomReturnType.Int32, DomReturnType.Object });
			Console.WriteLine (extType);
			
			// extend method
			List<IReturnType> genArgs = new List<IReturnType> ();
			List<IReturnType> args    = new List<IReturnType> ();
			
			ExtensionMethod extMethod = new ExtensionMethod (extType, method, genArgs, args);
			
			Console.WriteLine (extMethod);
			// check 
			Assert.AreEqual (DomReturnType.Int32.FullName, extMethod.ReturnType.FullName);
			Assert.AreEqual (DomReturnType.Object.FullName, extMethod.Parameters[0].ReturnType.FullName);
		}