Skip to content

Commit b99c939

Browse files
Fix null argument binding, add tests, minor code fixes, bump version to 5.1.1.
1 parent bb0c181 commit b99c939

File tree

12 files changed

+152
-23
lines changed

12 files changed

+152
-23
lines changed

ClearScript/HostItem.Invoke.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,18 @@ private IEnumerable<CSharpArgumentInfo> CreateArgInfoEnum(object[] args)
219219

220220
private static CSharpArgumentInfo CreateArgInfo(object arg)
221221
{
222-
var flags = CSharpArgumentInfoFlags.UseCompileTimeType;
223-
if (arg is IOutArg)
222+
var flags = CSharpArgumentInfoFlags.None;
223+
if (arg != null)
224224
{
225-
flags |= CSharpArgumentInfoFlags.IsOut;
226-
}
227-
else if (arg is IRefArg)
228-
{
229-
flags |= CSharpArgumentInfoFlags.IsRef;
225+
flags |= CSharpArgumentInfoFlags.UseCompileTimeType;
226+
if (arg is IOutArg)
227+
{
228+
flags |= CSharpArgumentInfoFlags.IsOut;
229+
}
230+
else if (arg is IRefArg)
231+
{
232+
flags |= CSharpArgumentInfoFlags.IsRef;
233+
}
230234
}
231235

232236
return CSharpArgumentInfo.Create(flags, null);

ClearScript/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,5 @@
7373
[assembly: InternalsVisibleTo("ClearScriptTest")]
7474

7575
[assembly: ComVisible(false)]
76-
[assembly: AssemblyVersion("5.1.0.0")]
77-
[assembly: AssemblyFileVersion("5.1.0.0")]
76+
[assembly: AssemblyVersion("5.1.1.0")]
77+
[assembly: AssemblyFileVersion("5.1.1.0")]

ClearScript/V8/ClearScriptV8/32/AssemblyInfo.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@
5959
// fitness for a particular purpose and non-infringement.
6060
//
6161

62+
#include "..\..\..\VersionSymbols.h"
63+
6264
using namespace System::Reflection;
6365
using namespace System::Runtime::CompilerServices;
6466
using namespace System::Runtime::InteropServices;
@@ -69,5 +71,5 @@ using namespace System::Runtime::InteropServices;
6971
[assembly:InternalsVisibleTo("ClearScript")];
7072

7173
[assembly:ComVisible(false)];
72-
[assembly:AssemblyVersion("5.0.0.0")];
73-
[assembly:AssemblyFileVersion("5.0.0.0")];
74+
[assembly:AssemblyVersion(CLEARSCRIPT_VERSION_STRING)];
75+
[assembly:AssemblyFileVersion(CLEARSCRIPT_VERSION_STRING)];

ClearScript/V8/ClearScriptV8/64/AssemblyInfo.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@
5959
// fitness for a particular purpose and non-infringement.
6060
//
6161

62+
#include "..\..\..\VersionSymbols.h"
63+
6264
using namespace System::Reflection;
6365
using namespace System::Runtime::CompilerServices;
6466
using namespace System::Runtime::InteropServices;
@@ -69,5 +71,5 @@ using namespace System::Runtime::InteropServices;
6971
[assembly:InternalsVisibleTo("ClearScript")];
7072

7173
[assembly:ComVisible(false)];
72-
[assembly:AssemblyVersion("5.0.0.0")];
73-
[assembly:AssemblyFileVersion("5.0.0.0")];
74+
[assembly:AssemblyVersion(CLEARSCRIPT_VERSION_STRING)];
75+
[assembly:AssemblyFileVersion(CLEARSCRIPT_VERSION_STRING)];

ClearScript/VersionSymbols.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,5 @@
6161

6262

6363

64-
#define CLEARSCRIPT_VERSION_STRING "5.1.0.0"
65-
#define CLEARSCRIPT_VERSION_COMMA_SEPARATED 5,1,0,0
64+
#define CLEARSCRIPT_VERSION_STRING "5.1.1.0"
65+
#define CLEARSCRIPT_VERSION_COMMA_SEPARATED 5,1,1,0

ClearScriptBenchmarks/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,5 @@
6969
[assembly: AssemblyCopyright("© Microsoft Corporation")]
7070

7171
[assembly: ComVisible(false)]
72-
[assembly: AssemblyVersion("5.1.0.0")]
73-
[assembly: AssemblyFileVersion("5.1.0.0")]
72+
[assembly: AssemblyVersion("5.1.1.0")]
73+
[assembly: AssemblyFileVersion("5.1.1.0")]

ClearScriptBenchmarks/SunSpider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868

6969
namespace Microsoft.ClearScript.Test
7070
{
71-
internal class SunSpider
71+
internal static class SunSpider
7272
{
7373
private const string version = "sunspider-0.9.1";
7474
private const string baseUrl = "http://www.webkit.org/perf/" + version + "/" + version + "/";

ClearScriptConsole/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,5 @@
6969
[assembly: AssemblyCopyright("© Microsoft Corporation")]
7070

7171
[assembly: ComVisible(false)]
72-
[assembly: AssemblyVersion("5.1.0.0")]
73-
[assembly: AssemblyFileVersion("5.1.0.0")]
72+
[assembly: AssemblyVersion("5.1.1.0")]
73+
[assembly: AssemblyFileVersion("5.1.1.0")]

ClearScriptTest/BugFixTest.cs

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
//
2+
// Copyright © Microsoft Corporation. All rights reserved.
3+
//
4+
// Microsoft Public License (MS-PL)
5+
//
6+
// This license governs use of the accompanying software. If you use the
7+
// software, you accept this license. If you do not accept the license, do not
8+
// use the software.
9+
//
10+
// 1. Definitions
11+
//
12+
// The terms "reproduce," "reproduction," "derivative works," and
13+
// "distribution" have the same meaning here as under U.S. copyright law. A
14+
// "contribution" is the original software, or any additions or changes to
15+
// the software. A "contributor" is any person that distributes its
16+
// contribution under this license. "Licensed patents" are a contributor's
17+
// patent claims that read directly on its contribution.
18+
//
19+
// 2. Grant of Rights
20+
//
21+
// (A) Copyright Grant- Subject to the terms of this license, including the
22+
// license conditions and limitations in section 3, each contributor
23+
// grants you a non-exclusive, worldwide, royalty-free copyright license
24+
// to reproduce its contribution, prepare derivative works of its
25+
// contribution, and distribute its contribution or any derivative works
26+
// that you create.
27+
//
28+
// (B) Patent Grant- Subject to the terms of this license, including the
29+
// license conditions and limitations in section 3, each contributor
30+
// grants you a non-exclusive, worldwide, royalty-free license under its
31+
// licensed patents to make, have made, use, sell, offer for sale,
32+
// import, and/or otherwise dispose of its contribution in the software
33+
// or derivative works of the contribution in the software.
34+
//
35+
// 3. Conditions and Limitations
36+
//
37+
// (A) No Trademark License- This license does not grant you rights to use
38+
// any contributors' name, logo, or trademarks.
39+
//
40+
// (B) If you bring a patent claim against any contributor over patents that
41+
// you claim are infringed by the software, your patent license from such
42+
// contributor to the software ends automatically.
43+
//
44+
// (C) If you distribute any portion of the software, you must retain all
45+
// copyright, patent, trademark, and attribution notices that are present
46+
// in the software.
47+
//
48+
// (D) If you distribute any portion of the software in source code form, you
49+
// may do so only under this license by including a complete copy of this
50+
// license with your distribution. If you distribute any portion of the
51+
// software in compiled or object code form, you may only do so under a
52+
// license that complies with this license.
53+
//
54+
// (E) The software is licensed "as-is." You bear the risk of using it. The
55+
// contributors give no express warranties, guarantees or conditions. You
56+
// may have additional consumer rights under your local laws which this
57+
// license cannot change. To the extent permitted under your local laws,
58+
// the contributors exclude the implied warranties of merchantability,
59+
// fitness for a particular purpose and non-infringement.
60+
//
61+
62+
using System;
63+
using System.Diagnostics.CodeAnalysis;
64+
using Microsoft.CSharp.RuntimeBinder;
65+
using Microsoft.ClearScript.V8;
66+
using Microsoft.VisualStudio.TestTools.UnitTesting;
67+
68+
namespace Microsoft.ClearScript.Test
69+
{
70+
[TestClass]
71+
[DeploymentItem("ClearScriptV8-64.dll")]
72+
[DeploymentItem("ClearScriptV8-32.dll")]
73+
[DeploymentItem("v8-x64.dll")]
74+
[DeploymentItem("v8-ia32.dll")]
75+
[SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable", Justification = "Test classes use TestCleanupAttribute for deterministic teardown.")]
76+
public class BugFixTest : ClearScriptTest
77+
{
78+
#region setup / teardown
79+
80+
private ScriptEngine engine;
81+
82+
[TestInitialize]
83+
public void TestInitialize()
84+
{
85+
engine = new V8ScriptEngine(V8ScriptEngineFlags.EnableDebugging);
86+
}
87+
88+
[TestCleanup]
89+
public void TestCleanup()
90+
{
91+
engine.Dispose();
92+
}
93+
94+
#endregion
95+
96+
#region test methods
97+
98+
// ReSharper disable InconsistentNaming
99+
100+
[TestMethod, TestCategory("BugFix")]
101+
public void BugFix_NullArgumentBinding()
102+
{
103+
var value = 123.456 as IConvertible;
104+
engine.AddRestrictedHostObject("value", value);
105+
Assert.AreEqual(value.ToString(null), engine.Evaluate("value.ToString(null)"));
106+
}
107+
108+
[TestMethod, TestCategory("BugFix")]
109+
[ExpectedException(typeof(RuntimeBinderException))]
110+
public void BugFix_NullArgumentBinding_Ambiguous()
111+
{
112+
engine.AddHostObject("lib", new HostTypeCollection("mscorlib"));
113+
engine.Execute("lib.System.Console.WriteLine(null)");
114+
}
115+
116+
// ReSharper restore InconsistentNaming
117+
118+
#endregion
119+
}
120+
}

ClearScriptTest/ClearScriptTest.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
</ItemGroup>
5454
<ItemGroup>
5555
<Compile Include="BindSignatureTest.cs" />
56+
<Compile Include="BugFixTest.cs" />
5657
<Compile Include="CrossEngineTest.cs" />
5758
<Compile Include="DynamicHostItemTest.cs" />
5859
<Compile Include="ExplicitBaseInterfaceMemberAccessTest.cs" />

0 commit comments

Comments
 (0)