#1459 fansh variable types

vkuzkokov Thu 24 Mar 2011

Fansh always uses raw sys::Map? type for variables (because maps' signatures start with [). Also FFI types are always nullable.

Here's a patch:

diff -r 033fdcafd433 src/fansh/fan/Evaluator.fan
--- a/src/fansh/fan/Evaluator.fan       Wed Mar 23 15:53:52 2011 -0400
+++ b/src/fansh/fan/Evaluator.fan       Thu Mar 24 22:20:18 2011 +0600
@@ -138,17 +138,17 @@
   private Str typeSig(Type t)
   {
     // FFI types aren't qualified
-    if (t.signature.startsWith("["))
+    if (t.pod == null)
     {
       // see if we are FFI using as
       a := shell.usings.find |u| { u.matchAs(t) }
-      if (a != null) return "${a.asTo}?"
+      if (a != null) return a.asTo + (t.isNullable ? "?" : "")
 
       // use unqualified name
-      return "${t.name}?"
+      return t.name + (t.isNullable ? "?" : "")
     }
 
-    // use qualified nullable type
+    // use qualified type
     return t.signature
   }
 

brian Thu 24 Mar 2011

Login or Signup to reply.