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

Commit

Permalink
Handle static properties correctly in access -> invocation transform.
Browse files Browse the repository at this point in the history
  • Loading branch information
kg committed Aug 10, 2012
1 parent 0e49b62 commit 0fe867c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 7 additions & 1 deletion JSIL/Transforms/ConvertPropertyAccessesToInvocations.cs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ private JSExpression ConstructInvocation (
); );


JSInvocationExpressionBase invocation; JSInvocationExpressionBase invocation;
if (needsExplicitThis) if (pa.Property.Property.IsStatic)
invocation = JSInvocationExpression.InvokeStatic(
pa.OriginalMethod.Reference.DeclaringType,
pa.OriginalMethod,
arguments
);
else if (needsExplicitThis)
invocation = JSInvocationExpression.InvokeBaseMethod( invocation = JSInvocationExpression.InvokeBaseMethod(
pa.OriginalMethod.Reference.DeclaringType, pa.OriginalMethod.Reference.DeclaringType,
pa.OriginalMethod, pa.ThisReference, pa.OriginalMethod, pa.ThisReference,
Expand Down
5 changes: 4 additions & 1 deletion Tests/MetadataTests.cs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -243,7 +243,10 @@ public void RenameProperty () {


Assert.IsFalse(generatedJs.Contains("Program.Property")); Assert.IsFalse(generatedJs.Contains("Program.Property"));
Assert.IsFalse(generatedJs.Contains("$thisType.Property")); Assert.IsFalse(generatedJs.Contains("$thisType.Property"));
Assert.IsTrue(generatedJs.Contains("$thisType.RenamedProperty")); Assert.IsTrue(
generatedJs.Contains("$thisType.RenamedProperty") ||
generatedJs.Contains("$thisType.get_RenamedProperty")
);
} }


[Test] [Test]
Expand Down

0 comments on commit 0fe867c

Please sign in to comment.