Merge pull request #4403 from BrzVlad/fix-workers-par-context
[mono.git] / mcs / class / referencesource / System / regex / system / text / regularexpressions / Regex.cs
index 8256cb7a4173c51eb316c17db828fbc612348ec8..a978e8e73ab7a590ce9e510bb6de9c7291917ca5 100644 (file)
@@ -405,7 +405,7 @@ namespace System.Text.RegularExpressions {
         * This method is internal virtual so the jit does not inline it.
         */
         [
-#if !DISABLE_CAS_USE
+#if MONO_FEATURE_CAS
             HostProtection(MayLeakOnAbort=true),
 #endif
             MethodImplAttribute(MethodImplOptions.NoInlining)
@@ -471,7 +471,62 @@ namespace System.Text.RegularExpressions {
                 }
             }
         }
-        
+
+        [CLSCompliant (false)]
+        protected IDictionary Caps
+        {
+            get
+            {
+                var dict = new Dictionary<int, int>();
+
+                foreach (int key in caps.Keys)
+                {
+                    dict.Add (key, (int)caps[key]);
+                }
+
+                return dict;
+            }
+            set
+            {
+                if (value == null)
+                    throw new ArgumentNullException("value");
+
+                caps = new Hashtable (value.Count);
+                foreach (DictionaryEntry entry in value)
+                {
+                    caps[(int)entry.Key] = (int)entry.Value;
+                }
+            }
+        }
+
+        [CLSCompliant (false)]
+        protected IDictionary CapNames
+        {
+            get
+            {
+                var dict = new Dictionary<string, int>();
+
+                foreach (string key in capnames.Keys)
+                {
+                    dict.Add (key, (int)capnames[key]);
+                }
+
+                return dict;
+            }
+            set
+            {
+                if (value == null)
+                    throw new ArgumentNullException("value");
+
+                capnames = new Hashtable (value.Count);
+                foreach (DictionaryEntry entry in value)
+                {
+                    capnames[(string)entry.Key] = (int)entry.Value;
+                }
+            }
+        }
+
         /// <devdoc>
         ///    <para>
         ///       Returns the options passed into the constructor
@@ -1195,7 +1250,7 @@ namespace System.Text.RegularExpressions {
 #if !(SILVERLIGHT || FULL_AOT_RUNTIME)
         /// <devdoc>
         /// </devdoc>
-#if !DISABLE_CAS_USE
+#if MONO_FEATURE_CAS
         [HostProtection(MayLeakOnAbort=true)]
 #endif
         [ResourceExposure(ResourceScope.Machine)] // The AssemblyName is interesting.
@@ -1208,7 +1263,7 @@ namespace System.Text.RegularExpressions {
 
         /// <devdoc>
         /// </devdoc>
-#if !DISABLE_CAS_USE
+#if MONO_FEATURE_CAS
         [HostProtection(MayLeakOnAbort=true)]
 #endif
         [ResourceExposure(ResourceScope.Machine)] // The AssemblyName is interesting.
@@ -1218,7 +1273,7 @@ namespace System.Text.RegularExpressions {
             CompileToAssemblyInternal(regexinfos, assemblyname, attributes, null);
         }
 
-#if !DISABLE_CAS_USE
+#if MONO_FEATURE_CAS
         [HostProtection(MayLeakOnAbort=true)]
 #endif
         [ResourceExposure(ResourceScope.Machine)]
@@ -1343,7 +1398,7 @@ namespace System.Text.RegularExpressions {
             return newcached;
         }
 
-#if !(SILVERLIGHT||FULL_AOT_RUNTIME)
+#if !SILVERLIGHT
         /*
          * True if the O option was set
          */
@@ -1351,9 +1406,17 @@ namespace System.Text.RegularExpressions {
         /// <devdoc>
         /// </devdoc>
         protected bool UseOptionC() {
-               /* Mono: Set to false until we investigate  https://bugzilla.xamarin.com/show_bug.cgi?id=25671 */
-           return false;
+#if FULL_AOT_RUNTIME
+            return false;
+#else
+
+#if MONO
+            /* Mono: Set to false until we investigate  https://bugzilla.xamarin.com/show_bug.cgi?id=25671 */
+            return false;
+#else
             return(roptions & RegexOptions.Compiled) != 0;
+#endif
+#endif
         }
 #endif