Skip to content

Commit

Permalink
Assembly.GetType fixed (sq#1035)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgarg committed Feb 24, 2017
1 parent 855b753 commit 9d1c35f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@
$.Method({ Static: false, Public: true }, "GetType",
(new JSIL.MethodSignature($jsilcore.TypeRef("System.Type"), [$.String], [])),
function GetType(name) {
return JSIL.GetTypeFromAssembly(this, name, null, false);
return JSIL.ReflectionGetTypeInternal(this, name, false, false);
}
);

$.Method({ Static: false, Public: true }, "GetType",
(new JSIL.MethodSignature($jsilcore.TypeRef("System.Type"), [$.String, $.Boolean], [])),
function GetType(name, throwOnError) {
return JSIL.GetTypeFromAssembly(this, name, null, throwOnError);
return JSIL.ReflectionGetTypeInternal(this, name, throwOnError, false);
}
);

Expand All @@ -81,7 +81,7 @@
if (ignoreCase)
throw new Error("ignoreCase not implemented");

return JSIL.GetTypeFromAssembly(this, name, null, throwOnError);
return JSIL.ReflectionGetTypeInternal(this, name, throwOnError, ignoreCase);
}
);

Expand Down
17 changes: 17 additions & 0 deletions Tests/SimpleTestCases/GetTypeFromAssembly_Issue1035.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;

public static class Program
{
public static void Main(string[] args)
{
var typeInt32 = typeof(object).Assembly.GetType("System.Int32");
var typeDictionary =
typeof (object).Assembly.GetType(
"System.Collections.Generic.Dictionary`2[[System.Int32, mscorlib],[System.Object, mscorlib]]");
Console.WriteLine(
"{0} {1}", typeInt32.Name, typeDictionary.Name
);

}
}
1 change: 1 addition & 0 deletions Tests/SimpleTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
<None Include="SimpleTestCases\BoxNumeric_Issue981.cs" />
<None Include="SimpleTestCases\NullableUnary_Issue997.cs" />
<None Include="SimpleTestCasesForTranslatedBcl\Issue1008_MethodReturnType.cs" />
<None Include="SimpleTestCases\GetTypeFromAssembly_Issue1035.cs" />
<Compile Include="SimpleTests.cs" />
<None Include="SimpleTestCases\BaseAutoProperties.cs" />
<None Include="SimpleTestCases\OverloadedVirtualMethods.cs" />
Expand Down

0 comments on commit 9d1c35f

Please sign in to comment.