Skip to content

Commit

Permalink
Move Js* types to be directly under Jint.Native namespace (#1745)
Browse files Browse the repository at this point in the history
  • Loading branch information
lahma committed Jan 17, 2024
1 parent 45fca04 commit 511523b
Show file tree
Hide file tree
Showing 41 changed files with 63 additions and 87 deletions.
5 changes: 1 addition & 4 deletions Jint.Tests.PublicInterface/ConstraintUsageTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using Jint.Constraints;
using Jint.Runtime;

namespace Jint.Tests.PublicInterface;
namespace Jint.Tests.PublicInterface;

[Collection("ConstraintUsageTests")]
public class ConstraintUsageTests
Expand Down
1 change: 0 additions & 1 deletion Jint.Tests.PublicInterface/JavaScriptExceptionTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Jint.Native;
using Jint.Native.Error;
using Jint.Runtime;

namespace Jint.Tests.PublicInterface
Expand Down
1 change: 0 additions & 1 deletion Jint.Tests.PublicInterface/PublicInterfaceTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Collections.Concurrent;
using Jint.Native;
using Jint.Native.Argument;
using Jint.Native.Function;

namespace Jint.Tests.PublicInterface;
Expand Down
1 change: 0 additions & 1 deletion Jint.Tests.Test262/Test262Test.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Esprima;
using Jint.Native;
using Jint.Native.ArrayBuffer;
using Jint.Runtime;
using Jint.Runtime.Descriptors;
using Jint.Runtime.Interop;
Expand Down
2 changes: 1 addition & 1 deletion Jint.Tests/Runtime/InteropTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3423,7 +3423,7 @@ public void CanSelectShadowedPropertiesBasedOnReadableAndWritable()
}

[Fact]
public void ShouldSomethingFoo()
public void ShouldRespectConcreteGenericReturnTypes()
{
var engine = new Engine(opt =>
{
Expand Down
1 change: 0 additions & 1 deletion Jint.Tests/Runtime/JsValueConversionTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Jint.Native;
using Jint.Native.RegExp;

namespace Jint.Tests.Runtime
{
Expand Down
1 change: 0 additions & 1 deletion Jint.Tests/Runtime/PromiseTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Jint.Native;
using Jint.Native.Object;
using Jint.Native.Promise;
using Jint.Runtime;

// obsolete GetCompletionValue
Expand Down
1 change: 0 additions & 1 deletion Jint.Tests/Runtime/PropertyDescriptorTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Jint.Native;
using Jint.Native.Argument;
using Jint.Runtime.Descriptors;
using Jint.Runtime.Descriptors.Specialized;
using Jint.Runtime.Interop;
Expand Down
2 changes: 0 additions & 2 deletions Jint.Tests/Runtime/WeakSetMapTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Jint.Native;
using Jint.Native.WeakMap;
using Jint.Native.WeakSet;
using Jint.Runtime;

namespace Jint.Tests.Runtime;
Expand Down
1 change: 0 additions & 1 deletion Jint/Engine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Esprima;
using Esprima.Ast;
using Jint.Native;
using Jint.Native.Argument;
using Jint.Native.Function;
using Jint.Native.Generator;
using Jint.Native.Object;
Expand Down
1 change: 0 additions & 1 deletion Jint/JsValueExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using Jint.Native.Function;
using Jint.Native.Object;
using Jint.Native.Promise;
using Jint.Native.RegExp;
using Jint.Native.Symbol;
using Jint.Native.TypedArray;
using Jint.Runtime;
Expand Down
1 change: 0 additions & 1 deletion Jint/Native/Array/ArrayIteratorPrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Jint.Native.Iterator;
using Jint.Native.Object;
using Jint.Native.Symbol;
using Jint.Native.TypedArray;
using Jint.Runtime;
using Jint.Runtime.Descriptors;
using Jint.Runtime.Interop;
Expand Down
1 change: 0 additions & 1 deletion Jint/Native/Array/ArrayOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Jint.Native.Number;
using Jint.Native.Object;
using Jint.Native.String;
using Jint.Native.TypedArray;
using Jint.Runtime;

namespace Jint.Native.Array
Expand Down
2 changes: 0 additions & 2 deletions Jint/Native/ArrayBuffer/ArrayBufferConstructor.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using Jint.Collections;
using Jint.Native.DataView;
using Jint.Native.Function;
using Jint.Native.Object;
using Jint.Native.Symbol;
using Jint.Native.TypedArray;
using Jint.Runtime;
using Jint.Runtime.Descriptors;
using Jint.Runtime.Interop;
Expand Down
2 changes: 1 addition & 1 deletion Jint/Native/Boolean/BooleanConstructor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public override ObjectInstance Construct(JsValue[] arguments, JsValue newTarget)
var o = OrdinaryCreateFromConstructor(
newTarget,
static intrinsics => intrinsics.Boolean.PrototypeObject,
static (engine, realm, state) => new BooleanInstance(engine, (JsBoolean) state!), b);
static (engine, realm, state) => new BooleanInstance(engine, state!), b);
return o;
}

Expand Down
2 changes: 0 additions & 2 deletions Jint/Native/DataView/DataViewConstructor.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using Jint.Native.ArrayBuffer;
using Jint.Native.Function;
using Jint.Native.Object;
using Jint.Native.TypedArray;
using Jint.Runtime;
using Jint.Runtime.Descriptors;

Expand Down
7 changes: 0 additions & 7 deletions Jint/Native/Error/ErrorInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@

namespace Jint.Native.Error;

public sealed class JsError : ErrorInstance
{
internal JsError(Engine engine) : base(engine, ObjectClass.Error)
{
}
}

public class ErrorInstance : ObjectInstance
{
private protected ErrorInstance(Engine engine, ObjectClass objectClass)
Expand Down
1 change: 0 additions & 1 deletion Jint/Native/Function/Function.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Runtime.CompilerServices;
using Esprima.Ast;
using Jint.Native.Object;
using Jint.Native.Proxy;
using Jint.Runtime;
using Jint.Runtime.Descriptors;
using Jint.Runtime.Environments;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Jint.Runtime.Environments;
using Jint.Runtime.Interop;

namespace Jint.Native.Argument
namespace Jint.Native
{
/// <summary>
/// https://tc39.es/ecma262/#sec-arguments-exotic-objects
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using Jint.Native.ArrayBuffer;
using Jint.Native.Object;
using Jint.Native.TypedArray;
using Jint.Runtime;

namespace Jint.Native.ArrayBuffer;
namespace Jint.Native;

/// <summary>
/// https://tc39.es/ecma262/#sec-arraybuffer-objects
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Jint.Native.ArrayBuffer;
using Jint.Native.Object;

namespace Jint.Native.DataView;
namespace Jint.Native;

/// <summary>
/// https://tc39.es/ecma262/#sec-properties-of-dataview-instances
Expand Down
11 changes: 11 additions & 0 deletions Jint/Native/JsError.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Jint.Native.Error;
using Jint.Native.Object;

namespace Jint.Native;

public sealed class JsError : ErrorInstance
{
internal JsError(Engine engine) : base(engine, ObjectClass.Error)
{
}
}
2 changes: 1 addition & 1 deletion Jint/Native/Map/JsMap.cs → Jint/Native/JsMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Jint.Runtime;
using Jint.Runtime.Descriptors;

namespace Jint.Native.Map;
namespace Jint.Native;

internal sealed class JsMap : ObjectInstance
{
Expand Down
34 changes: 2 additions & 32 deletions Jint/Native/Promise/JsPromise.cs → Jint/Native/JsPromise.cs
Original file line number Diff line number Diff line change
@@ -1,40 +1,10 @@
using Jint.Native.Object;
using Jint.Native.Promise;
using Jint.Runtime;
using Jint.Runtime.Descriptors;
using Jint.Runtime.Interop;

namespace Jint.Native.Promise;

internal enum PromiseState
{
Pending,
Fulfilled,
Rejected
}

internal enum ReactionType
{
Fulfill,
Reject
}

internal sealed record PromiseReaction(
ReactionType Type,
PromiseCapability Capability,
JsValue Handler
);

internal sealed record ResolvingFunctions(
Function.Function Resolve,
Function.Function Reject
);

public sealed record ManualPromise(
JsValue Promise,
Action<JsValue> Resolve,
Action<JsValue> Reject
);

namespace Jint.Native;

internal sealed class JsPromise : ObjectInstance
{
Expand Down
2 changes: 1 addition & 1 deletion Jint/Native/Proxy/JsProxy.cs → Jint/Native/JsProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Jint.Runtime;
using Jint.Runtime.Descriptors;

namespace Jint.Native.Proxy
namespace Jint.Native
{
internal sealed class JsProxy : ObjectInstance, IConstructor, ICallable
{
Expand Down
3 changes: 2 additions & 1 deletion Jint/Native/RegExp/JsRegExp.cs → Jint/Native/JsRegExp.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using System.Text.RegularExpressions;
using Esprima;
using Jint.Native.Object;
using Jint.Native.RegExp;
using Jint.Runtime;
using Jint.Runtime.Descriptors;

namespace Jint.Native.RegExp
namespace Jint.Native
{
public sealed class JsRegExp : ObjectInstance
{
Expand Down
2 changes: 1 addition & 1 deletion Jint/Native/Set/JsSet.cs → Jint/Native/JsSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Jint.Runtime;
using Jint.Runtime.Descriptors;

namespace Jint.Native.Set;
namespace Jint.Native;

internal sealed class JsSet : ObjectInstance
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Jint.Native.ArrayBuffer;
using Jint.Runtime;

namespace Jint.Native.SharedArrayBuffer;
namespace Jint.Native;

/// <summary>
/// https://tc39.es/ecma262/#sec-sharedarraybuffer-objects
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
using Jint.Native.ArrayBuffer;
using Jint.Native.Number;
using Jint.Native.Object;
using Jint.Native.TypedArray;
using Jint.Runtime;
using Jint.Runtime.Descriptors;

namespace Jint.Native.TypedArray
namespace Jint.Native
{
public sealed class JsTypedArray : ObjectInstance
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using System.Runtime.CompilerServices;

using Jint.Native.Object;
using Jint.Runtime;

namespace Jint.Native.WeakMap;
namespace Jint.Native;

internal sealed class JsWeakMap : ObjectInstance
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Jint.Native.Object;

namespace Jint.Native.WeakRef;
namespace Jint.Native;

/// <summary>
/// https://tc39.es/ecma262/#sec-properties-of-weak-ref-instances
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using System.Runtime.CompilerServices;

using Jint.Native.Object;
using Jint.Runtime;

namespace Jint.Native.WeakSet;
namespace Jint.Native;

internal sealed class JsWeakSet : ObjectInstance
{
Expand Down
1 change: 0 additions & 1 deletion Jint/Native/Json/JsonSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using Jint.Native.Boolean;
using Jint.Native.Number;
using Jint.Native.Object;
using Jint.Native.Proxy;
using Jint.Native.String;
using Jint.Runtime;
using Jint.Runtime.Descriptors;
Expand Down
1 change: 0 additions & 1 deletion Jint/Native/Object/ObjectInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using Jint.Native.Boolean;
using Jint.Native.Json;
using Jint.Native.Number;
using Jint.Native.RegExp;
using Jint.Native.String;
using Jint.Native.Symbol;
using Jint.Native.TypedArray;
Expand Down
1 change: 0 additions & 1 deletion Jint/Native/Object/ObjectPrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

using Jint.Collections;
using Jint.Native.Array;
using Jint.Native.Proxy;
using Jint.Native.Symbol;
using Jint.Runtime;
using Jint.Runtime.Descriptors;
Expand Down
31 changes: 31 additions & 0 deletions Jint/Native/Promise/PromiseTypes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
namespace Jint.Native.Promise;

internal enum PromiseState
{
Pending,
Fulfilled,
Rejected
}

internal enum ReactionType
{
Fulfill,
Reject
}

internal sealed record PromiseReaction(
ReactionType Type,
PromiseCapability Capability,
JsValue Handler
);

internal sealed record ResolvingFunctions(
Function.Function Resolve,
Function.Function Reject
);

public sealed record ManualPromise(
JsValue Promise,
Action<JsValue> Resolve,
Action<JsValue> Reject
);
2 changes: 0 additions & 2 deletions Jint/Native/SharedArrayBuffer/SharedArrayBufferConstructor.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using Jint.Collections;
using Jint.Native.DataView;
using Jint.Native.Function;
using Jint.Native.Object;
using Jint.Native.Symbol;
using Jint.Native.TypedArray;
using Jint.Runtime;
using Jint.Runtime.Descriptors;
using Jint.Runtime.Interop;
Expand Down
1 change: 0 additions & 1 deletion Jint/Pooling/ArgumentsInstancePool.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Jint.Native;
using Jint.Native.Argument;
using Jint.Native.Function;
using Jint.Runtime.Environments;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Esprima.Ast;
using Jint.Native.Promise;
using Jint.Native;

namespace Jint.Runtime.Interpreter.Expressions;

Expand Down
Loading

0 comments on commit 511523b

Please sign in to comment.