Skip to content
This repository was archived by the owner on Aug 24, 2022. It is now read-only.

Commit 0a33194

Browse files
committed
Merge pull request #870 from iskiselev/EliminateTemporaries_Fix868
EliminateTemporaries don't treat JSIndexerExpression as immutable
2 parents e484f5d + 405c9a8 commit 0a33194

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

JSIL/Transforms/StaticAnalysis/EliminateSingleUseTemporaries.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,6 @@ protected bool IsEffectivelyConstant (JSVariable target, JSExpression source) {
7272
}
7373
}
7474

75-
// Handle special cases where our interpretation of 'constant' needs to be more flexible
76-
{
77-
var ie = source as JSIndexerExpression;
78-
if (ie != null) {
79-
if (
80-
IsEffectivelyConstant(target, ie.Target) &&
81-
IsEffectivelyConstant(target, ie.Index)
82-
)
83-
return true;
84-
}
85-
}
86-
8775
{
8876
var ae = source as JSArrayExpression;
8977
if (
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System;
2+
using System.Collections.Generic;
3+
4+
public static class Program
5+
{
6+
public static void Main(string[] args)
7+
{
8+
var stack = new Stack<string>();
9+
stack.Push("test");
10+
Console.WriteLine(stack.Pop());
11+
}
12+
}

Tests/SimpleTests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@
128128
<None Include="SimpleTestCases\Issue743.cs" />
129129
<None Include="SimpleTestCases\UInt64_Issue855.cs" />
130130
<None Include="SimpleTestCases\StringFromCtor.cs" />
131+
<None Include="SimpleTestCasesForTranslatedBcl\Stack.cs" />
131132
<Compile Include="SimpleTests.cs" />
132133
<None Include="SimpleTestCases\BaseAutoProperties.cs" />
133134
<None Include="SimpleTestCases\OverloadedVirtualMethods.cs" />

0 commit comments

Comments
 (0)