Browse Source

Hide GlobalObject public methods (#1723)

Marko Lahma 1 year ago
parent
commit
8d2d9864e0

+ 10 - 10
Jint/Native/Global/GlobalObject.cs

@@ -31,7 +31,7 @@ namespace Jint.Native.Global
         /// <summary>
         /// https://tc39.es/ecma262/#sec-parseint-string-radix
         /// </summary>
-        public static JsValue ParseInt(JsValue thisObject, JsValue[] arguments)
+        internal static JsValue ParseInt(JsValue thisObject, JsValue[] arguments)
         {
             var inputString = TypeConverter.ToString(arguments.At(0));
             var trimmed = StringPrototype.TrimEx(inputString);
@@ -120,7 +120,7 @@ namespace Jint.Native.Global
         /// <summary>
         /// https://tc39.es/ecma262/#sec-parsefloat-string
         /// </summary>
-        public static JsValue ParseFloat(JsValue thisObject, JsValue[] arguments)
+        internal static JsValue ParseFloat(JsValue thisObject, JsValue[] arguments)
         {
             var inputString = TypeConverter.ToString(arguments.At(0));
             var trimmedString = StringPrototype.TrimStartEx(inputString);
@@ -241,7 +241,7 @@ namespace Jint.Native.Global
         /// <summary>
         /// http://www.ecma-international.org/ecma-262/5.1/#sec-15.1.2.4
         /// </summary>
-        public static JsValue IsNaN(JsValue thisObject, JsValue[] arguments)
+        private static JsValue IsNaN(JsValue thisObject, JsValue[] arguments)
         {
             var value = arguments.At(0);
 
@@ -257,7 +257,7 @@ namespace Jint.Native.Global
         /// <summary>
         /// http://www.ecma-international.org/ecma-262/5.1/#sec-15.1.2.5
         /// </summary>
-        public static JsValue IsFinite(JsValue thisObject, JsValue[] arguments)
+        private static JsValue IsFinite(JsValue thisObject, JsValue[] arguments)
         {
             if (arguments.Length != 1)
             {
@@ -288,7 +288,7 @@ namespace Jint.Native.Global
         /// <param name="thisObject"></param>
         /// <param name="arguments"></param>
         /// <returns></returns>
-        public JsValue EncodeUri(JsValue thisObject, JsValue[] arguments)
+        private JsValue EncodeUri(JsValue thisObject, JsValue[] arguments)
         {
             var uriString = TypeConverter.ToString(arguments.At(0));
 
@@ -302,7 +302,7 @@ namespace Jint.Native.Global
         /// <param name="thisObject"></param>
         /// <param name="arguments"></param>
         /// <returns></returns>
-        public JsValue EncodeUriComponent(JsValue thisObject, JsValue[] arguments)
+        private JsValue EncodeUriComponent(JsValue thisObject, JsValue[] arguments)
         {
             var uriString = TypeConverter.ToString(arguments.At(0));
 
@@ -409,14 +409,14 @@ uriError:
             return JsEmpty.Instance;
         }
 
-        public JsValue DecodeUri(JsValue thisObject, JsValue[] arguments)
+        private JsValue DecodeUri(JsValue thisObject, JsValue[] arguments)
         {
             var uriString = TypeConverter.ToString(arguments.At(0));
 
             return Decode(uriString, ReservedUriSet);
         }
 
-        public JsValue DecodeUriComponent(JsValue thisObject, JsValue[] arguments)
+        private JsValue DecodeUriComponent(JsValue thisObject, JsValue[] arguments)
         {
             var componentString = TypeConverter.ToString(arguments.At(0));
 
@@ -596,7 +596,7 @@ uriError:
         /// <summary>
         /// http://www.ecma-international.org/ecma-262/5.1/#sec-B.2.1
         /// </summary>
-        public JsValue Escape(JsValue thisObject, JsValue[] arguments)
+        private JsValue Escape(JsValue thisObject, JsValue[] arguments)
         {
             var uriString = TypeConverter.ToString(arguments.At(0));
 
@@ -628,7 +628,7 @@ uriError:
         /// <summary>
         /// http://www.ecma-international.org/ecma-262/5.1/#sec-B.2.2
         /// </summary>
-        public JsValue Unescape(JsValue thisObject, JsValue[] arguments)
+        private JsValue Unescape(JsValue thisObject, JsValue[] arguments)
         {
             var uriString = TypeConverter.ToString(arguments.At(0));
 

+ 1 - 1
Jint/Native/Json/JsonParser.cs

@@ -770,7 +770,7 @@ namespace Jint.Native.Json
 
     internal static class StringExtensions
     {
-        public static char CharCodeAt(this string source, int index)
+        internal static char CharCodeAt(this string source, int index)
         {
             if (index > source.Length - 1)
             {

+ 11 - 14
Jint/Native/Number/Dtoa/NumberExtensions.cs

@@ -1,21 +1,18 @@
-#nullable disable
-
 using System.Runtime.CompilerServices;
 
-namespace Jint.Native.Number.Dtoa
+namespace Jint.Native.Number.Dtoa;
+
+internal static class NumberExtensions
 {
-    internal static class NumberExtensions
+    [MethodImpl(MethodImplOptions.AggressiveInlining)]
+    internal static long UnsignedShift(this long l, int shift)
     {
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public static long UnsignedShift(this long l, int shift)
-        {
-            return (long) ((ulong) l >> shift);
-        }        
+        return (long) ((ulong) l >> shift);
+    }
         
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public static ulong UnsignedShift(this ulong l, int shift)
-        {
-            return l >> shift;
-        }
+    [MethodImpl(MethodImplOptions.AggressiveInlining)]
+    internal static ulong UnsignedShift(this ulong l, int shift)
+    {
+        return l >> shift;
     }
 }