From a58c19a684a6c7f59808892b1b447ab617cb8dd1 Mon Sep 17 00:00:00 2001 From: "K. Gadd" Date: Fri, 13 Feb 2015 04:55:08 -0800 Subject: [PATCH] Fix issue #682 --- Proxies/Char.cs | 41 +++++++++++++++++++++++++++++++ Proxies/Proxies.4.0.csproj | 1 + Tests/SimpleTestCases/Issue682.cs | 10 ++++++++ Tests/SimpleTests.csproj | 1 + 4 files changed, 53 insertions(+) create mode 100644 Proxies/Char.cs create mode 100644 Tests/SimpleTestCases/Issue682.cs diff --git a/Proxies/Char.cs b/Proxies/Char.cs new file mode 100644 index 000000000..ea8bcff7d --- /dev/null +++ b/Proxies/Char.cs @@ -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(); + } + } +} diff --git a/Proxies/Proxies.4.0.csproj b/Proxies/Proxies.4.0.csproj index 61b837c84..73fad126b 100644 --- a/Proxies/Proxies.4.0.csproj +++ b/Proxies/Proxies.4.0.csproj @@ -37,6 +37,7 @@ + diff --git a/Tests/SimpleTestCases/Issue682.cs b/Tests/SimpleTestCases/Issue682.cs new file mode 100644 index 000000000..d0a19066b --- /dev/null +++ b/Tests/SimpleTestCases/Issue682.cs @@ -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')); + } +} \ No newline at end of file diff --git a/Tests/SimpleTests.csproj b/Tests/SimpleTests.csproj index 03002869e..72d22674d 100644 --- a/Tests/SimpleTests.csproj +++ b/Tests/SimpleTests.csproj @@ -90,6 +90,7 @@ +