Skip to content

Commit

Permalink
Fix issue sq#682
Browse files Browse the repository at this point in the history
  • Loading branch information
kg committed Feb 13, 2015
1 parent 2f62256 commit a58c19a
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
41 changes: 41 additions & 0 deletions Proxies/Char.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#pragma warning disable 0660
#pragma warning disable 0661

using System;
using System.Collections.Generic;
using JSIL.Meta;
using JSIL.Proxy;

namespace JSIL.Proxies {
[JSProxy(
typeof(char),
JSProxyMemberPolicy.ReplaceDeclared
)]
public abstract class CharProxy {
[JSReplacement("$c.toLowerCase()")]
[JSIsPure]
public static char ToLower (char c) {
throw new InvalidOperationException();
}

// FIXME: Are ECMAScript strings always normalized?
[JSReplacement("$c.toLowerCase()")]
[JSIsPure]
public static char ToLowerInvariant (char c) {
throw new InvalidOperationException();
}

[JSReplacement("$c.toUpperCase()")]
[JSIsPure]
public static char ToUpper (char c) {
throw new InvalidOperationException();
}

// FIXME: Are ECMAScript strings always normalized?
[JSReplacement("$c.toUpperCase()")]
[JSIsPure]
public static char ToUpperInvariant (char c) {
throw new InvalidOperationException();
}
}
}
1 change: 1 addition & 0 deletions Proxies/Proxies.4.0.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<Compile Include="Array.cs" />
<Compile Include="Console.cs" />
<Compile Include="Collections.cs" />
<Compile Include="Char.cs" />
<Compile Include="Unsafe.cs" />
<Compile Include="DateTime.cs" />
<Compile Include="IO.cs" />
Expand Down
10 changes: 10 additions & 0 deletions Tests/SimpleTestCases/Issue682.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System;

public static class Program {
public static void Main (string[] args) {
Console.WriteLine(char.ToLower('a'));
Console.WriteLine(char.ToUpper('a'));
Console.WriteLine(char.ToLower('A'));
Console.WriteLine(char.ToUpper('A'));
}
}
1 change: 1 addition & 0 deletions Tests/SimpleTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
<None Include="SimpleTestCases\Issue491.cs" />
<None Include="SimpleTestCases\Issue491_2.cs" />
<None Include="SimpleTestCases\Issue491_3.cs" />
<None Include="SimpleTestCases\Issue682.cs" />
<Compile Include="SimpleTestCases\ReflectionGenericMethodInvoke.cs" />
<Compile Include="ExpressionTests.cs" />
<Compile Include="SimpleTests.cs" />
Expand Down

0 comments on commit a58c19a

Please sign in to comment.