Permalink
Browse files

Handle static properties correctly in access -> invocation transform.

  • Loading branch information...
1 parent 0e49b62 commit 0fe867c66f01c00e238a49ae85be3ffcec203c64 @kg kg committed Aug 10, 2012
Showing with 11 additions and 2 deletions.
  1. +7 −1 JSIL/Transforms/ConvertPropertyAccessesToInvocations.cs
  2. +4 −1 Tests/MetadataTests.cs
@@ -46,7 +46,13 @@ class ConvertPropertyAccessesToInvocations : JSAstVisitor {
);
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(
pa.OriginalMethod.Reference.DeclaringType,
pa.OriginalMethod, pa.ThisReference,
View
@@ -243,7 +243,10 @@ public class MetadataTests : GenericTestFixture {
Assert.IsFalse(generatedJs.Contains("Program.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]

0 comments on commit 0fe867c

Please sign in to comment.