Skip to content

Commit

Permalink
Hide GlobalObject public methods (#1723)
Browse files Browse the repository at this point in the history
  • Loading branch information
lahma authored Jan 5, 2024
1 parent 7e08bab commit 8d2d986
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 25 deletions.
20 changes: 10 additions & 10 deletions Jint/Native/Global/GlobalObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private JsValue ToStringString(JsValue thisObject, JsValue[] arguments)
/// <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);
Expand Down Expand Up @@ -120,7 +120,7 @@ public static JsValue ParseInt(JsValue thisObject, JsValue[] arguments)
/// <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);
Expand Down Expand Up @@ -241,7 +241,7 @@ public static JsValue ParseFloat(JsValue thisObject, JsValue[] arguments)
/// <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);

Expand All @@ -257,7 +257,7 @@ public static JsValue IsNaN(JsValue thisObject, JsValue[] arguments)
/// <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)
{
Expand Down Expand Up @@ -288,7 +288,7 @@ public static JsValue IsFinite(JsValue thisObject, JsValue[] arguments)
/// <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));

Expand All @@ -302,7 +302,7 @@ public JsValue EncodeUri(JsValue thisObject, JsValue[] arguments)
/// <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));

Expand Down Expand Up @@ -409,14 +409,14 @@ private JsValue Encode(string uriString, SearchValues<char> unescapedUriSet)
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));

Expand Down Expand Up @@ -596,7 +596,7 @@ private static bool IsDigit(char c, int radix, out int result)
/// <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));

Expand Down Expand Up @@ -628,7 +628,7 @@ public JsValue Escape(JsValue thisObject, JsValue[] arguments)
/// <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));

Expand Down
2 changes: 1 addition & 1 deletion Jint/Native/Json/JsonParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ static class Messages

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)
{
Expand Down
25 changes: 11 additions & 14 deletions Jint/Native/Number/Dtoa/NumberExtensions.cs
Original file line number Diff line number Diff line change
@@ -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;
}
}

0 comments on commit 8d2d986

Please sign in to comment.