Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Small fixes to allow use of instances of CLR objects
  • Loading branch information
sorear committed Sep 10, 2011
1 parent acb2aad commit d30d449
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions lib/NieczaCLR.cs
Expand Up @@ -415,6 +415,7 @@ public class CLRWrapperProvider {
m.FillClass(new string[] { }, new STable[] { pm }, mro);

HashSet<string> needNewWrapper = new HashSet<string>();
needNewWrapper.Add("new"); // don't inherit constructors
Dictionary<string,List<MethodBase>> allMethods
= new Dictionary<string,List<MethodBase>>();
Dictionary<string,List<PropertyInfo>> allProperties
Expand Down Expand Up @@ -516,7 +517,9 @@ public class CLRWrapperProvider {
if (cty == typeof(P6any))
return Kernel.NewROScalar((P6any)ret);

return Kernel.BoxAnyMO<object>(ret, null); // XXX
if (ret == null)
return Kernel.AnyMO.typeVar;
return Kernel.BoxAnyMO<object>(ret, GetWrapper(ret.GetType()));
}

public static bool CoerceArgument(out object clr, Type ty, Variable var) {
Expand Down Expand Up @@ -601,13 +604,3 @@ public class CLRWrapperProvider {

}
}

public partial class Builtins {
public static Variable clr_test() {
Variable tv = CLRWrapperProvider.GetWrapper(typeof(System.Console)).typeVar;
return Kernel.RunInferior(tv.Fetch().InvokeMethod(
Kernel.GetInferiorRoot(), "WriteLine", new Variable[] {
tv, Kernel.BoxAnyMO("Hello, world", Kernel.StrMO) }, null));
}
}

0 comments on commit d30d449

Please sign in to comment.