Skip to content

Commit

Permalink
Version 7.3.2: Switched from the standard .NET reflection binder to a…
Browse files Browse the repository at this point in the history
… custom algorithm, ensuring consistently enhanced behavior for all reflection binding scenarios; reviewed "dynamic" usage, eliminating it where possible and reducing it elsewhere (GitHub Issue #400); added ScriptEngine.DisableDynamicBinding; added IScriptEngineException.ScriptExceptionAsObject; fixed invocation of methods that have both optional parameters and parameter arrays; added implicit conversion support for constructor and indexed property arguments (GitHub Issue #396); extended canonical referencing to Guid and all readonly struct types; added ScriptObject.InvokeAsFunction; updated API and build documentation. Tested with V8 10.5.218.8.
  • Loading branch information
ClearScriptLib committed Sep 15, 2022
1 parent 784b83c commit e13ac81
Show file tree
Hide file tree
Showing 1,074 changed files with 9,738 additions and 15,627 deletions.
2 changes: 2 additions & 0 deletions ClearScript.NoV8.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp73</s:String>
<s:Boolean x:Key="/Default/CodeInspection/ExcludedFiles/FileMasksToSkip/=_002A_002Ejs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/Highlighting/CalculateUnusedTypeMembers/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeThisQualifier/@EntryIndexedValue">SUGGESTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=AssignNullToNotNullAttribute/@EntryIndexedValue">DO_NOT_SHOW</s:String>
Expand Down Expand Up @@ -48,6 +49,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Addr/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ADODB/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=BADPARAMCOUNT/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bindable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=blittable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bytecode/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Cacheable/@EntryIndexedValue">True</s:Boolean>
Expand Down
2 changes: 2 additions & 0 deletions ClearScript.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp73</s:String>
<s:Boolean x:Key="/Default/CodeInspection/ExcludedFiles/FileMasksToSkip/=_002A_002Ejs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/Highlighting/CalculateUnusedTypeMembers/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeThisQualifier/@EntryIndexedValue">SUGGESTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=AssignNullToNotNullAttribute/@EntryIndexedValue">DO_NOT_SHOW</s:String>
Expand Down Expand Up @@ -48,6 +49,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Addr/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ADODB/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=BADPARAMCOUNT/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bindable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=blittable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bytecode/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Cacheable/@EntryIndexedValue">True</s:Boolean>
Expand Down
19 changes: 15 additions & 4 deletions ClearScript/BindSignature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
// Licensed under the MIT license.

using System;
using System.Diagnostics;
using System.Reflection;
using Microsoft.ClearScript.Util;

namespace Microsoft.ClearScript
{
Expand Down Expand Up @@ -205,6 +207,7 @@ public bool Equals(TargetInfo that)
private enum ArgKind
{
Null,
Zero,
ByValue,
Out,
Ref
Expand Down Expand Up @@ -269,14 +272,22 @@ public ArgInfo(object arg)
return;
}

if (arg is HostTarget hostTarget)
if (arg is HostObject hostObject)
{
kind = ArgKind.ByValue;
type = hostTarget.Type;
kind = hostObject.Target.IsZero() ? ArgKind.Zero : ArgKind.ByValue;
type = hostObject.Type;
return;
}

if (arg is HostVariable hostVariable)
{
kind = hostVariable.Target.IsZero() ? ArgKind.Zero : ArgKind.ByValue;
type = hostVariable.Type;
return;
}

kind = ArgKind.ByValue;
Debug.Assert(!(arg is HostTarget));
kind = arg.IsZero() ? ArgKind.Zero : ArgKind.ByValue;
type = arg.GetType();
}

Expand Down
4 changes: 4 additions & 0 deletions ClearScript/CanonicalRefTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ private static ICanonicalRefMap GetMap(object obj)
type == typeof(DateTime) ||
type == typeof(DateTimeOffset) ||
type == typeof(TimeSpan) ||
type == typeof(Guid) ||
#if NET471_OR_GREATER || NETCOREAPP2_0_OR_GREATER || NETSTANDARD2_1_OR_GREATER
type.GetOrLoadCustomAttributes<System.Runtime.CompilerServices.IsReadOnlyAttribute>(false).Any() ||
#endif
type.GetOrLoadCustomAttributes<ImmutableValueAttribute>(false).Any())
{
map = (ICanonicalRefMap)typeof(CanonicalRefMap<>).MakeGenericType(type).CreateInstance();
Expand Down
1 change: 0 additions & 1 deletion ClearScript/CustomAttributeLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public CustomAttributeLoader()

// ReSharper restore EmptyConstructor


/// <summary>
/// Loads custom attributes of the specified type for the given resource.
/// </summary>
Expand Down
Loading

0 comments on commit e13ac81

Please sign in to comment.