This commit is contained in:
James Newton-King
2015-08-30 11:05:25 +12:00
parent 32869955f1
commit d5b1976483
3 changed files with 45 additions and 27 deletions
+5 -4
View File
@@ -11,6 +11,7 @@
$buildNuGet = $true $buildNuGet = $true
$treatWarningsAsErrors = $false $treatWarningsAsErrors = $false
$workingName = if ($workingName) {$workingName} else {"Working"} $workingName = if ($workingName) {$workingName} else {"Working"}
$dnvmVersion = "1.0.0-beta8-15530"
$baseDir = resolve-path .. $baseDir = resolve-path ..
$buildDir = "$baseDir\Build" $buildDir = "$baseDir\Build"
@@ -210,8 +211,8 @@ function DnxBuild($build)
{ {
$name = $build.Name $name = $build.Name
exec { dnvm install 1.0.0-beta8-15120 -r clr -u | Out-Default } exec { dnvm install $dnvmVersion -r clr -u | Out-Default }
exec { dnvm use 1.0.0-beta8-15120 -r clr | Out-Default } exec { dnvm use $dnvmVersion -r clr | Out-Default }
Write-Host -ForegroundColor Green "Restoring packages for $name" Write-Host -ForegroundColor Green "Restoring packages for $name"
Write-Host Write-Host
@@ -240,8 +241,8 @@ function DnxTests($build)
#Write-Host #Write-Host
#exec { & $toolsDir\Kvm\kvm.ps1 upgrade -r CoreCLR -NoNative | Out-Default } #exec { & $toolsDir\Kvm\kvm.ps1 upgrade -r CoreCLR -NoNative | Out-Default }
exec { dnvm install 1.0.0-beta8-15120 -r coreclr -u | Out-Default } exec { dnvm install $dnvmVersion -r coreclr -u | Out-Default }
exec { dnvm use 1.0.0-beta8-15120 -r coreclr | Out-Default } exec { dnvm use $dnvmVersion -r coreclr | Out-Default }
Write-Host -ForegroundColor Green "Restoring packages for $name" Write-Host -ForegroundColor Green "Restoring packages for $name"
Write-Host Write-Host
+35 -18
View File
@@ -227,7 +227,11 @@ namespace Newtonsoft.Json.Linq
/// </value> /// </value>
public override JToken First public override JToken First
{ {
get { return ChildrenTokens.FirstOrDefault(); } get
{
IList<JToken> children = ChildrenTokens;
return (children.Count > 0) ? children[0] : null;
}
} }
/// <summary> /// <summary>
@@ -238,7 +242,12 @@ namespace Newtonsoft.Json.Linq
/// </value> /// </value>
public override JToken Last public override JToken Last
{ {
get { return ChildrenTokens.LastOrDefault(); } get
{
IList<JToken> children = ChildrenTokens;
int count = children.Count;
return (count > 0) ? children[count - 1] : null;
}
} }
/// <summary> /// <summary>
@@ -349,16 +358,18 @@ namespace Newtonsoft.Json.Linq
internal virtual void InsertItem(int index, JToken item, bool skipParentCheck) internal virtual void InsertItem(int index, JToken item, bool skipParentCheck)
{ {
if (index > ChildrenTokens.Count) IList<JToken> children = ChildrenTokens;
if (index > children.Count)
throw new ArgumentOutOfRangeException("index", "Index must be within the bounds of the List."); throw new ArgumentOutOfRangeException("index", "Index must be within the bounds of the List.");
CheckReentrancy(); CheckReentrancy();
item = EnsureParentToken(item, skipParentCheck); item = EnsureParentToken(item, skipParentCheck);
JToken previous = (index == 0) ? null : ChildrenTokens[index - 1]; JToken previous = (index == 0) ? null : children[index - 1];
// haven't inserted new token yet so next token is still at the inserting index // haven't inserted new token yet so next token is still at the inserting index
JToken next = (index == ChildrenTokens.Count) ? null : ChildrenTokens[index]; JToken next = (index == children.Count) ? null : children[index];
ValidateToken(item, null); ValidateToken(item, null);
@@ -372,7 +383,7 @@ namespace Newtonsoft.Json.Linq
if (next != null) if (next != null)
next.Previous = item; next.Previous = item;
ChildrenTokens.Insert(index, item); children.Insert(index, item);
#if !(DOTNET || PORTABLE40 || PORTABLE) #if !(DOTNET || PORTABLE40 || PORTABLE)
if (_listChanged != null) if (_listChanged != null)
@@ -386,16 +397,18 @@ namespace Newtonsoft.Json.Linq
internal virtual void RemoveItemAt(int index) internal virtual void RemoveItemAt(int index)
{ {
IList<JToken> children = ChildrenTokens;
if (index < 0) if (index < 0)
throw new ArgumentOutOfRangeException("index", "Index is less than 0."); throw new ArgumentOutOfRangeException("index", "Index is less than 0.");
if (index >= ChildrenTokens.Count) if (index >= children.Count)
throw new ArgumentOutOfRangeException("index", "Index is equal to or greater than Count."); throw new ArgumentOutOfRangeException("index", "Index is equal to or greater than Count.");
CheckReentrancy(); CheckReentrancy();
JToken item = ChildrenTokens[index]; JToken item = children[index];
JToken previous = (index == 0) ? null : ChildrenTokens[index - 1]; JToken previous = (index == 0) ? null : children[index - 1];
JToken next = (index == ChildrenTokens.Count - 1) ? null : ChildrenTokens[index + 1]; JToken next = (index == children.Count - 1) ? null : children[index + 1];
if (previous != null) if (previous != null)
previous.Next = next; previous.Next = next;
@@ -406,7 +419,7 @@ namespace Newtonsoft.Json.Linq
item.Previous = null; item.Previous = null;
item.Next = null; item.Next = null;
ChildrenTokens.RemoveAt(index); children.RemoveAt(index);
#if !(DOTNET || PORTABLE40 || PORTABLE) #if !(DOTNET || PORTABLE40 || PORTABLE)
if (_listChanged != null) if (_listChanged != null)
@@ -437,12 +450,14 @@ namespace Newtonsoft.Json.Linq
internal virtual void SetItem(int index, JToken item) internal virtual void SetItem(int index, JToken item)
{ {
IList<JToken> children = ChildrenTokens;
if (index < 0) if (index < 0)
throw new ArgumentOutOfRangeException("index", "Index is less than 0."); throw new ArgumentOutOfRangeException("index", "Index is less than 0.");
if (index >= ChildrenTokens.Count) if (index >= children.Count)
throw new ArgumentOutOfRangeException("index", "Index is equal to or greater than Count."); throw new ArgumentOutOfRangeException("index", "Index is equal to or greater than Count.");
JToken existing = ChildrenTokens[index]; JToken existing = children[index];
if (IsTokenUnchanged(existing, item)) if (IsTokenUnchanged(existing, item))
return; return;
@@ -453,8 +468,8 @@ namespace Newtonsoft.Json.Linq
ValidateToken(item, existing); ValidateToken(item, existing);
JToken previous = (index == 0) ? null : ChildrenTokens[index - 1]; JToken previous = (index == 0) ? null : children[index - 1];
JToken next = (index == ChildrenTokens.Count - 1) ? null : ChildrenTokens[index + 1]; JToken next = (index == children.Count - 1) ? null : children[index + 1];
item.Parent = this; item.Parent = this;
@@ -466,7 +481,7 @@ namespace Newtonsoft.Json.Linq
if (next != null) if (next != null)
next.Previous = item; next.Previous = item;
ChildrenTokens[index] = item; children[index] = item;
existing.Parent = null; existing.Parent = null;
existing.Previous = null; existing.Previous = null;
@@ -486,14 +501,16 @@ namespace Newtonsoft.Json.Linq
{ {
CheckReentrancy(); CheckReentrancy();
foreach (JToken item in ChildrenTokens) IList<JToken> children = ChildrenTokens;
foreach (JToken item in children)
{ {
item.Parent = null; item.Parent = null;
item.Previous = null; item.Previous = null;
item.Next = null; item.Next = null;
} }
ChildrenTokens.Clear(); children.Clear();
#if !(DOTNET || PORTABLE40 || PORTABLE) #if !(DOTNET || PORTABLE40 || PORTABLE)
if (_listChanged != null) if (_listChanged != null)
+4 -4
View File
@@ -3,9 +3,9 @@
<packageSources> <packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below --> <!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear /> <clear />
<add key="CI Builds (aspnetvnext)" value="https://www.myget.org/F/aspnetvnext/" /> <add key="AspNet VNext (CI Builds)" value="https://www.myget.org/F/aspnetvnext/" />
<add key="CI Builds (xunit)" value="https://www.myget.org/F/xunit/" /> <add key="xunit (CI Builds)" value="https://www.myget.org/F/xunit/" />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> <add key="NuGet.org (v3)" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="nuget.org/api/v2" value="https://nuget.org/api/v2/" /> <add key="NuGet.org (v2)" value="https://www.nuget.org/api/v2/" />
</packageSources> </packageSources>
</configuration> </configuration>