X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FSystem%2FSystem.CodeDom.Compiler%2FCompilerInfo.cs;h=09c5ad954ca25bce7f055785928887d2089cc72a;hb=2d23bfcbce7a3f7e54dcd5911adb88b244baca35;hp=269cc54bdff8320fee9f112b9751cae3375dc519;hpb=a097b5471761180c4aae2dab224ed9caeeae3e86;p=mono.git diff --git a/mcs/class/System/System.CodeDom.Compiler/CompilerInfo.cs b/mcs/class/System/System.CodeDom.Compiler/CompilerInfo.cs index 269cc54bdff..09c5ad954ca 100644 --- a/mcs/class/System/System.CodeDom.Compiler/CompilerInfo.cs +++ b/mcs/class/System/System.CodeDom.Compiler/CompilerInfo.cs @@ -31,18 +31,23 @@ #if NET_2_0 +using System.Configuration; +using System.Collections.Generic; +using System.Reflection; using System.Security.Permissions; namespace System.CodeDom.Compiler { [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)] - public sealed class CompilerInfo { - + public sealed class CompilerInfo + { internal string Languages; internal string Extensions; internal string TypeName; internal int WarningLevel; internal string CompilerOptions; + internal Dictionary ProviderOptions; + bool inited; Type type; @@ -65,9 +70,20 @@ namespace System.CodeDom.Compiler { } public Type CodeDomProviderType { - get { return type; } + get { + if (type == null) { + type = Type.GetType (TypeName, false); +#if CONFIGURATION_DEP + if (type == null) + throw new ConfigurationErrorsException ("Unable to locate compiler type '" + TypeName + "'"); +#endif + } + + return type; + } } + public bool IsCodeDomProviderTypeValid { get { return type != null; } } @@ -86,7 +102,22 @@ namespace System.CodeDom.Compiler { public CodeDomProvider CreateProvider () { - return (CodeDomProvider) Activator.CreateInstance (type); + return CreateProvider (ProviderOptions); + } + +#if NET_4_0 + public +#endif + CodeDomProvider CreateProvider (IDictionary providerOptions) + { + Type providerType = CodeDomProviderType; + if (providerOptions != null && providerOptions.Count > 0) { + ConstructorInfo ctor = providerType.GetConstructor (new [] { typeof (IDictionary ) }); + if (ctor != null) + return (CodeDomProvider) ctor.Invoke (new object[] { providerOptions }); + } + + return (CodeDomProvider) Activator.CreateInstance (providerType); } public override bool Equals (object o)