Skip to content

Commit 8591cc5

Browse files
Version 5.5.3: Changed V8Update to use V8's GN-based build system; fixed VB.NET access to nonexistent JavaScript properties (GitHub Issue ClearFoundry#47, Take 2); fixed script object serialization via Json.NET (GitHub Issue ClearFoundry#60); added host item invocability assessment and patched V8's typeof implementation to return "object" for all non-delegate host objects (GitHub Issue ClearFoundry#62); added DocumentInfo and related APIs to address GitHub Issue ClearFoundry#46; fixed property bag invocation; updated deployment and API documentation. Tested with V8 6.8.275.28.
1 parent 69ce8fa commit 8591cc5

507 files changed

Lines changed: 3395 additions & 1403 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ _ReSharper*/
3434
ClearScript/V8/V8/build/
3535
ClearScript/V8/V8/lib/
3636
ClearScript/V8/V8/include/
37-
.vs/
37+
.vs/
38+
packages/

ClearScript.NoV8.sln.DotSettings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp50</s:String>
33
<s:Boolean x:Key="/Default/CodeInspection/ExcludedFiles/FileMasksToSkip/=_002A_002Ecpp/@EntryIndexedValue">True</s:Boolean>
44
<s:Boolean x:Key="/Default/CodeInspection/ExcludedFiles/FileMasksToSkip/=_002A_002Eh/@EntryIndexedValue">True</s:Boolean>
5+
<s:Boolean x:Key="/Default/CodeInspection/Highlighting/CalculateUnusedTypeMembers/@EntryValue">False</s:Boolean>
56
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeRedundantParentheses/@EntryIndexedValue">DO_NOT_SHOW</s:String>
67
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertIfStatementToConditionalTernaryExpression/@EntryIndexedValue">DO_NOT_SHOW</s:String>
78
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertIfStatementToNullCoalescingExpression/@EntryIndexedValue">DO_NOT_SHOW</s:String>

ClearScript.sln.DotSettings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp50</s:String>
33
<s:Boolean x:Key="/Default/CodeInspection/ExcludedFiles/FileMasksToSkip/=_002A_002Ecpp/@EntryIndexedValue">True</s:Boolean>
44
<s:Boolean x:Key="/Default/CodeInspection/ExcludedFiles/FileMasksToSkip/=_002A_002Eh/@EntryIndexedValue">True</s:Boolean>
5+
<s:Boolean x:Key="/Default/CodeInspection/Highlighting/CalculateUnusedTypeMembers/@EntryValue">False</s:Boolean>
56
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeRedundantParentheses/@EntryIndexedValue">DO_NOT_SHOW</s:String>
67
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertIfStatementToConditionalTernaryExpression/@EntryIndexedValue">DO_NOT_SHOW</s:String>
78
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertIfStatementToNullCoalescingExpression/@EntryIndexedValue">DO_NOT_SHOW</s:String>

ClearScript/ByRefArg.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ public override bool TryInvoke(IHostInvokeContext context, BindingFlags invokeFl
8383
return target.TryInvoke(context, invokeFlags, args, bindArgs, out result);
8484
}
8585

86+
public override Invocability GetInvocability(BindingFlags bindFlags, ScriptAccess defaultAccess, bool ignoreDynamic)
87+
{
88+
return target.GetInvocability(bindFlags, defaultAccess, ignoreDynamic);
89+
}
90+
8691
#endregion
8792

8893
#region IByRefArg implementation

ClearScript/ClearScript.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@
6464
<ItemGroup>
6565
<Compile Include="CanonicalRefTable.cs" />
6666
<Compile Include="ContinuationCallback.cs" />
67+
<Compile Include="DocumentFlags.cs" />
68+
<Compile Include="DocumentInfo.cs" />
69+
<Compile Include="Invocability.cs" />
6770
<Compile Include="ImmutableValueAttribute.cs" />
6871
<Compile Include="HostItemCollateral.cs" />
6972
<Compile Include="HostItemFlags.cs" />

ClearScript/DocumentFlags.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT license.
3+
4+
using System;
5+
6+
namespace Microsoft.ClearScript
7+
{
8+
/// <summary>
9+
/// Defines script document attributes.
10+
/// </summary>
11+
[Flags]
12+
public enum DocumentFlags
13+
{
14+
/// <summary>
15+
/// Indicates that no attributes are present.
16+
/// </summary>
17+
None = 0,
18+
19+
/// <summary>
20+
/// Indicates that the script document is temporary and can be discarded after execution.
21+
/// Only Windows Script engines honor this attribute.
22+
/// </summary>
23+
IsTransient = 0x00000001
24+
}
25+
}

ClearScript/DocumentInfo.cs

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT license.
3+
4+
using System;
5+
using System.IO;
6+
using Microsoft.ClearScript.Util;
7+
8+
namespace Microsoft.ClearScript
9+
{
10+
/// <summary>
11+
/// Contains information about a script document.
12+
/// </summary>
13+
public struct DocumentInfo
14+
{
15+
internal const string DefaultName = "Script Document";
16+
17+
private readonly string name;
18+
private readonly Uri uri;
19+
20+
/// <summary>
21+
/// Initializes a new <see cref="DocumentInfo"/> structure with the specified document name.
22+
/// </summary>
23+
/// <param name="name">The document name.</param>
24+
public DocumentInfo(string name)
25+
: this()
26+
{
27+
this.name = MiscHelpers.EnsureNonBlank(name, DefaultName);
28+
}
29+
30+
/// <summary>
31+
/// Initializes a new <see cref="DocumentInfo"/> structure with the specified document URI.
32+
/// </summary>
33+
/// <param name="uri">The document URI.</param>
34+
public DocumentInfo(Uri uri)
35+
: this()
36+
{
37+
MiscHelpers.VerifyNonNullArgument(uri, "uri");
38+
this.uri = uri.IsAbsoluteUri ? uri : new Uri(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + uri);
39+
name = Path.GetFileName(this.uri.AbsolutePath);
40+
}
41+
42+
/// <summary>
43+
/// Gets the document's name.
44+
/// </summary>
45+
/// <remarks>
46+
/// This property always returns a non-blank string. If a null or blank document name was
47+
/// specified at instantiation time, this property returns a default document name.
48+
/// </remarks>
49+
public string Name
50+
{
51+
get { return MiscHelpers.EnsureNonBlank(name, DefaultName); }
52+
}
53+
54+
/// <summary>
55+
/// Gets the document's URI.
56+
/// </summary>
57+
/// <remarks>
58+
/// This property returns <c>null</c> if a URI was not specified at instantiation time.
59+
/// </remarks>
60+
public Uri Uri
61+
{
62+
get { return uri; }
63+
}
64+
65+
/// <summary>
66+
/// Gets or sets a source map URI for the document.
67+
/// </summary>
68+
public Uri SourceMapUri { get; set; }
69+
70+
/// <summary>
71+
/// Gets or sets optional document attributes.
72+
/// </summary>
73+
public DocumentFlags? Flags { get; set; }
74+
75+
internal string UniqueName { get; set; }
76+
}
77+
}

ClearScript/Exports/VersionSymbols.h

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

66
#pragma once
77

8-
#define CLEARSCRIPT_VERSION_STRING "5.5.2.0"
9-
#define CLEARSCRIPT_VERSION_COMMA_SEPARATED 5,5,2,0
8+
#define CLEARSCRIPT_VERSION_STRING "5.5.3.0"
9+
#define CLEARSCRIPT_VERSION_COMMA_SEPARATED 5,5,3,0

ClearScript/HostFunctions.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,12 @@ public object newArr(params int[] lengths)
223223
/// <item>
224224
/// <term><c>out</c></term>
225225
/// <term>read-only</term>
226-
/// <description>A reference to the host variable that can be passed as an <c><see href="http://msdn.microsoft.com/en-us/library/t3c3bfhx(VS.80).aspx">out</see></c> argument.</description>
226+
/// <description>A reference to the host variable that can be passed as an <c><see href="https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/out-parameter-modifier">out</see></c> argument.</description>
227227
/// </item>
228228
/// <item>
229229
/// <term><c>ref</c></term>
230230
/// <term>read-only</term>
231-
/// <description>A reference to the host variable that can be passed as a <c><see href="http://msdn.microsoft.com/en-us/library/14akc2c7(VS.80).aspx">ref</see></c> argument.</description>
231+
/// <description>A reference to the host variable that can be passed as a <c><see href="https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/ref">ref</see></c> argument.</description>
232232
/// </item>
233233
/// </list>
234234
/// </para>
@@ -305,7 +305,7 @@ public T del<T>(object scriptFunc)
305305
/// This function creates a delegate that accepts <paramref name="argCount"/> arguments and
306306
/// returns no value. The type of all parameters is <see cref="System.Object"/>. Such a
307307
/// delegate is often useful in strongly typed contexts because of
308-
/// <see href="http://msdn.microsoft.com/en-us/library/ms173174(VS.80).aspx">contravariance</see>.
308+
/// <see href="https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/covariance-contravariance/">contravariance</see>.
309309
/// </remarks>
310310
/// <example>
311311
/// The following code demonstrates delegating a callback to a script function.
@@ -344,7 +344,7 @@ public object proc(int argCount, object scriptFunc)
344344
/// returns a value of the specified type. The type of all parameters is
345345
/// <see cref="System.Object"/>. Such a delegate is often useful in strongly typed contexts
346346
/// because of
347-
/// <see href="http://msdn.microsoft.com/en-us/library/ms173174(VS.80).aspx">contravariance</see>.
347+
/// <see href="https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/covariance-contravariance/">contravariance</see>.
348348
/// </remarks>
349349
/// <example>
350350
/// The following code demonstrates delegating a callback to a script function.
@@ -385,7 +385,7 @@ public object func<T>(int argCount, object scriptFunc)
385385
/// returns the result of invoking <paramref name="scriptFunc"/>. The type of all
386386
/// parameters and the return value is <see cref="System.Object"/>. Such a delegate is
387387
/// often useful in strongly typed contexts because of
388-
/// <see href="http://msdn.microsoft.com/en-us/library/ms173174(VS.80).aspx">contravariance</see>.
388+
/// <see href="https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/covariance-contravariance/">contravariance</see>.
389389
/// </para>
390390
/// <para>
391391
/// For information about the types of result values that script code can return, see
@@ -407,7 +407,7 @@ public object func(int argCount, object scriptFunc)
407407
/// <remarks>
408408
/// <para>
409409
/// This function is similar to C#'s
410-
/// <c><see href="http://msdn.microsoft.com/en-us/library/58918ffs(VS.71).aspx">typeof</see></c>
410+
/// <c><see href="https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/typeof">typeof</see></c>
411411
/// operator. It is overloaded with <see cref="typeOf(object)"/> and selected at runtime if
412412
/// <typeparamref name="T"/> can be used as a type argument.
413413
/// </para>
@@ -442,7 +442,7 @@ public Type typeOf<T>()
442442
/// <remarks>
443443
/// <para>
444444
/// This function is similar to C#'s
445-
/// <c><see href="http://msdn.microsoft.com/en-us/library/58918ffs(VS.71).aspx">typeof</see></c>
445+
/// <c><see href="https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/typeof">typeof</see></c>
446446
/// operator. It is overloaded with <see cref="typeOf{T}"/> and selected at runtime if
447447
/// <paramref name="value"/> cannot be used as a type argument. Note that this applies to
448448
/// some host types; examples are static types and overloaded generic type groups.
@@ -477,7 +477,7 @@ public Type typeOf(object value)
477477
/// <returns><c>True</c> if <paramref name="value"/> is compatible with the specified type, <c>false</c> otherwise.</returns>
478478
/// <remarks>
479479
/// This function is similar to C#'s
480-
/// <c><see href="http://msdn.microsoft.com/en-us/library/scekt9xw(VS.71).aspx">is</see></c>
480+
/// <c><see href="https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/is">is</see></c>
481481
/// operator.
482482
/// </remarks>
483483
/// <example>
@@ -508,7 +508,7 @@ public bool isType<T>(object value)
508508
/// <returns>The result of the cast if successful, <c>null</c> otherwise.</returns>
509509
/// <remarks>
510510
/// This function is similar to C#'s
511-
/// <c><see href="http://msdn.microsoft.com/en-us/library/cscsdfbt(VS.71).aspx">as</see></c>
511+
/// <c><see href="https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/as">as</see></c>
512512
/// operator.
513513
/// </remarks>
514514
/// <example>

ClearScript/HostIndexedProperty.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ public override bool TryInvoke(IHostInvokeContext context, BindingFlags invokeFl
8888
return true;
8989
}
9090

91+
public override Invocability GetInvocability(BindingFlags bindFlags, ScriptAccess defaultAccess, bool ignoreDynamic)
92+
{
93+
return Invocability.Delegate;
94+
}
95+
9196
#endregion
9297
}
9398
}

0 commit comments

Comments
 (0)