Merge pull request #1709 from atsushieno/import-codedom-core
[mono.git] / mcs / class / System / System.CodeDom / CodeMethodReferenceExpression.cs
index c673beaa6539325e28e115e356ac53ede42e8fcf..40da67b68d793464bfaa88fb678259de12a3cd4c 100644 (file)
@@ -4,10 +4,10 @@
 // Author:
 //   Miguel de Icaza (miguel@ximian.com)
 //   Daniel Stodden (stodden@in.tum.de)
+//   Marek Safar (marek.safar@seznam.cz)
 //
 // (C) 2001 Ximian, Inc.
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -41,6 +41,7 @@ namespace System.CodeDom
        {
                private string methodName;
                private CodeExpression targetObject;
+               CodeTypeReferenceCollection typeArguments;
                
                //
                // Constructors
@@ -56,11 +57,22 @@ namespace System.CodeDom
                        this.methodName = methodName;
                }
 
+               public CodeMethodReferenceExpression (CodeExpression targetObject, 
+                       string methodName, params CodeTypeReference[] typeParameters) :
+                       this (targetObject, methodName)
+               {
+                       if (typeParameters != null && typeParameters.Length > 0)
+                               TypeArguments.AddRange (typeParameters);
+               }
+
                //
                // Properties
                //
                public string MethodName {
                        get {
+                               if (methodName == null) {
+                                       return string.Empty;
+                               }
                                return methodName;
                        }
                        set {
@@ -76,5 +88,22 @@ namespace System.CodeDom
                                targetObject = value;
                        }
                }
+
+               [ComVisible (false)]
+               public CodeTypeReferenceCollection TypeArguments {
+                       get {
+                               if (typeArguments == null)
+                                       typeArguments = new CodeTypeReferenceCollection ();
+                               return typeArguments;
+                       }
+               }
+
+               //
+               // ICodeDomVisitor method
+               //
+               internal override void Accept (ICodeDomVisitor visitor)
+               {
+                       visitor.Visit (this);
+               }
        }
 }