Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: sq/JSIL
base: daacf4ed73
...
head fork: sq/JSIL
compare: 3eafff3f04
  • 2 commits
  • 6 files changed
  • 0 commit comments
  • 1 contributor
17 JSIL/TypeInformation.cs
View
@@ -476,6 +476,7 @@ public class TypeInfo {
Interfaces = interfaces.ToArray();
_IsIgnored = module.IsIgnored ||
+ IsIgnoredName(type.Namespace, false) ||
IsIgnoredName(type.Name, false) ||
Metadata.HasAttribute("JSIL.Meta.JSIgnore") ||
Metadata.HasAttribute("System.Runtime.CompilerServices.UnsafeValueTypeAttribute") ||
@@ -902,6 +903,8 @@ protected bool BeforeAddProxyMember<T> (ProxyInfo proxy, T member, out IMemberIn
}
public static bool IsIgnoredName (string shortName, bool isField) {
+ bool defaultResult = false;
+
foreach (Match m2 in IgnoredKeywordRegex.Matches(shortName)) {
if (m2.Success) {
switch (m2.Value) {
@@ -909,14 +912,6 @@ protected bool BeforeAddProxyMember<T> (ProxyInfo proxy, T member, out IMemberIn
case "__DisplayClass":
return false;
- case "<PrivateImplementationDetails>":
- case "Runtime.CompilerServices.CallSite":
- case "<Module>":
- case "__SiteContainer":
- case "__DynamicSite":
- return true;
-
-
case "CS$<":
if (!isField)
return true;
@@ -928,6 +923,10 @@ protected bool BeforeAddProxyMember<T> (ProxyInfo proxy, T member, out IMemberIn
return true;
break;
+
+ default:
+ defaultResult = true;
+ break;
}
}
}
@@ -947,7 +946,7 @@ protected bool BeforeAddProxyMember<T> (ProxyInfo proxy, T member, out IMemberIn
}
}
- return false;
+ return defaultResult;
}
protected MethodInfo AddMember (MethodDefinition method, PropertyInfo property, ProxyInfo sourceProxy = null) {
11 Libraries/JSIL.Core.js
View
@@ -364,12 +364,21 @@ JSIL.EscapeName = function (name) {
var caretRe = /\`/g;
var ltRe = /\</g;
var gtRe = /\>/g;
+ var commaRe = /\,/g;
+ var equalsRe = /\=/g;
name = name.replace(JSIL.AngleGroupRegex, function (match, group1) {
return "$l" + group1.replace(JSIL.UnderscoreRegex, "_") + "$g";
});
- return name.replace(caretRe, "$$b").replace(JSIL.UnderscoreRegex, "_").replace(ltRe, "$$l").replace(gtRe, "$$g");
+ return (
+ name.replace(caretRe, "$$b")
+ .replace(JSIL.UnderscoreRegex, "_")
+ .replace(ltRe, "$$l")
+ .replace(gtRe, "$$g")
+ .replace(commaRe, "$$cm")
+ .replace(equalsRe, "$$eq")
+ );
};
JSIL.GetParentName = function (name) {
BIN  Tests/BinaryTestCases/ConsoleApplication8.exe
View
Binary file not shown
10 Tests/ComparisonTests.cs
View
@@ -46,6 +46,16 @@ public class ComparisonTests : GenericTestFixture {
}
[Test]
+ [Ignore]
+ public void FSharpExecutable () {
+ // FIXME: Doesn't work yet.
+ var js = GetJavascript(
+ @"BinaryTestCases\ConsoleApplication8.exe"
+ );
+ Console.WriteLine(js);
+ }
+
+ [Test]
[TestCaseSource("DynamicsSource")]
public void Dynamics (object[] parameters) {
RunSingleComparisonTestCase(parameters);
35 Tests/TestUtil.cs
View
@@ -302,17 +302,23 @@ public class ComparisonTest : IDisposable {
}
protected MethodInfo GetTestMethod () {
- var program = Assembly.GetType("Program");
- if (program == null)
- throw new Exception("Test missing 'Program' main class");
-
- var testMethod = program.GetMethod("Main");
- if (testMethod == null)
- throw new Exception("Test missing 'Main' method of 'Program' main class");
+ var entryPoint = Assembly.EntryPoint;
+
+ if (entryPoint == null) {
+ var program = Assembly.GetType("Program");
+ if (program == null)
+ throw new Exception("Test missing 'Program' main class");
+
+ var testMethod = program.GetMethod("Main");
+ if (testMethod == null)
+ throw new Exception("Test missing 'Main' method of 'Program' main class");
+
+ entryPoint = testMethod;
+ }
- MainAcceptsArguments = testMethod.GetParameters().Length > 0;
+ MainAcceptsArguments = entryPoint.GetParameters().Length > 0;
- return testMethod;
+ return entryPoint;
}
public string RunCSharp (string[] args, out long elapsed) {
@@ -403,7 +409,9 @@ public class ComparisonTest : IDisposable {
elapsedTranslation = DateTime.UtcNow.Ticks - translationStarted;
var testMethod = GetTestMethod();
- var declaringType = JSIL.Internal.Util.EscapeIdentifier(testMethod.DeclaringType.FullName, Internal.EscapingMode.TypeIdentifier);
+ var declaringType = JSIL.Internal.Util.EscapeIdentifier(
+ testMethod.DeclaringType.FullName, Internal.EscapingMode.TypeIdentifier
+ );
string argsJson;
@@ -428,9 +436,12 @@ public class ComparisonTest : IDisposable {
@"if (typeof (elapsed) !== 'function') {{ if (typeof (Date) === 'object') elapsed = Date.now; else elapsed = function () {{ return 0; }} }}" +
@"timeout({0});" +
@"JSIL.Initialize(); var started = elapsed(); " +
- @"{1}.Main({2}); " +
+ @"JSIL.GetAssembly({1}).{2}.{3}({4}); " +
@"var ended = elapsed(); print('// elapsed: ' + (ended - started));",
- JavascriptExecutionTimeout, declaringType, argsJson
+ JavascriptExecutionTimeout,
+ Util.EscapeString(testMethod.Module.Assembly.FullName),
+ declaringType, Util.EscapeIdentifier(testMethod.Name),
+ argsJson
);
generatedJavascript = translatedJs;
4 Tests/Tests.csproj
View
@@ -527,7 +527,9 @@
<Name>Mono.Cecil</Name>
</ProjectReference>
</ItemGroup>
- <ItemGroup />
+ <ItemGroup>
+ <None Include="BinaryTestCases\ConsoleApplication8.exe" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

No commit comments for this range

Something went wrong with that request. Please try again.